You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
6.7 KiB
1 lines
6.7 KiB
!function(){"use strict";var e=["/Private/thirdparty.js","/Private/three.js","/Bimface/lib/loaders/PntLoader.js","/Bimface/lib/loaders/BimTilesLoader.js","/Private/Editor.js","/Private/WebViewer.js","/Private/bimface.bufferfly.js","/Private/mdvDrawing2D.js"],t=window.hostConfig||{APIHost:"https://api.bimface.com",resourceHost:"https://m.bimface.com",staticHost:"https://static.bimface.com",dataEnvType:"BIMFACE",securityApi:!0};void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),a=1;a<arguments.length;a++){var i=arguments[a];if(null!=i)for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t});let a=Object.freeze({Release:"Release",Debug:"Debug"}),i=Object.freeze({Normal:"Normal",DrawingView:"drawingView"}),n=Object.freeze({BIMFACE:"BIMFACE",Local:"Local"}),o=Object.freeze({zh_CN:"zh_CN",en_GB:"en_GB",sv_SE:"sv_SE",zh_TW:"zh_TW"}),s=Object.freeze({Normal:"Normal",Bake:"Bake"});window.BimfaceSDKLoaderConfig=function(){if(window.hostConfig){for(let e in window.hostConfig)t[e]=window.hostConfig[e];t.securityApi=window.hostConfig.securityApi}return{staticHost:`${t.staticHost}/api`,APIHost:t.APIHost,language:"zh_CN",viewToken:null,configuration:a.Release,dataEnvType:t.dataEnvType||"BIMFACE",viewType:i.Normal,visualStyle:s.Bake,version:"",securityApi:t.securityApi}},window.BimfaceEnvOption=n,window.BimfaceLanguageOption=o,window.BimfaceConfigrationOption=a,window.BimfaceViewTypeOption=i;var r=function(e,t){for(var a=0;a<t.length;a++)t[a]=e+t[a]},c=function(e){var t=e.sdkVersion,a=e.options,n=a.configuration,o=[],s=[`/${t}/${a.language}.js`,`/${t}/Application${n}.js`];return o=function(e,t){return"drawingView"==e.renderType||t.viewType==i.DrawingView}(e.metadata,e.options)?[...o,...s,`/${t}/Drawing.css`,`/${t}/bimface.bufferfly.js`,`/${t}/Drawing${n}.js`]:[...o,...s,`/${t}/Bimface.css`,`/${t}/thirdparty.js`,`/${t}/lib/loaders/BimTilesLoader.js`,`/${t}/Bimface${n}.js`],o};window.postProcessing=function(e){var t=e.metadata,i=e.options,n=e.successCb,o=c(e);r(i.staticHost,o),t.databagId=`${t.databagId}`,i.path?(t.path=i.path,t.dataPath="./"):i.resourcePath&&(t.path=i.resourcePath.replace("viewToken","")),t.sdkPath=i.sdkPath,0==o.length?n(t):d(o,(function(){if(i.build===a.Debug&&i.dataPath){let e=i.dataPath.split("/");n({databagId:e.pop(),path:e.join("/")})}n(t)}))};var d=function(e,t,i){var n=e.length,o=0,s=function(f){if(f&&"error"==f.message&&f.element.indexOf("bimface.index")>-1){o=0;var p=i.options;p.build,a.Release;var u=c(i);return r(p.staticHost,u),void d(u,t)}++o==n?t():l(e[o],s)};l(e[o],s)},f=[],l=function(e,t){if(!(f.indexOf(e.split("/").pop())>-1)){var a,i=document.getElementsByTagName("head")[0];return e.indexOf(".css")>-1?((a=document.createElement("link")).setAttribute("href",e),a.setAttribute("rel","stylesheet")):(a=document.createElement("script")).setAttribute("src",e),a.url=e,i.appendChild(a),a.addEventListener("load",(function(){f.push(this.url.split("/").pop()),t&&t({message:"success"})})),a.addEventListener("error",(function(){t&&t({element:e,message:"error"})})),a}t()};window.loadResource=d;var p=function(e,t){for(var a=0;a<t.length;a++)t[a]=e+t[a]},u=function(e,t){var a="pdf-transfer"===e.workerType||"pdfView"===t.viewType;return a&&(e.renderType="pdfView"),a},m=function(e,t){return"drawingView"==e.renderType||t.viewType==i.DrawingView};const w=function(e,t,a){const i="Local"==BimfaceLoaderConfig.dataEnvType||BimfaceLoaderConfig.sdkPath?"bimface":t.sdkVersion;let n=[`/${i}/lib/Base64.min.js`,`/${i}/lib/CryptoJS.min.js`,`/${i}/lib/JSEncrypt.min.js`];p(e,n);let o="";if(t.options.resourcePath.startsWith("http"))o=t.options.resourcePath+"/certfile.cer";else{let e=location.href.lastIndexOf("/");o=location.href.substring(0,e)+"/certfile.cer"}d(n,(function(){var e,i,n;e={type:"get",url:o,async:!0,success:function(e){const i=new JSEncrypt;i.setPublicKey("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCP15iz0j7CO8vUP/w/rpT5VR4CLhYoVOJWjbHbWQ/esw/K7SC4qjTIN2OOOJjrbITVW8i9vRU3fLxlG0NFw6TaRDfy+UsozGSoqvEtRyzCdxNb3v7TdUqcRKLHsbgTsM8KlFn13dh606Idi+FHYAxFp1e75tbjvJ0S5BhG6oJZHQIDAQAB");let n=JSON.parse(Base64.decode(e)),o=n.content;if((new Date(o.expiryTime).getTime()||0)<(new Date).getTime())return void console.warn("您的离线包已过期,如果您是订阅用户,请在官网-【控制台】-【离线数据包】中获取更新授权。");const s=t.metadata;if(s.modelId!=o.modelId||s.databagVersion!=o.databagVersion)return void console.warn("授权错误,请确认证书属于当前模型!");const r=n.sign;o=JSON.stringify(o),i.verify(o,r,CryptoJS.SHA256)?(t.metadata.databagId=n.content.databagId,a(t)):console.warn("授权错误,请确认证书属于当前模型!")},failure:()=>{console.log("获取证书文件失败")}},n=Object.assign({type:"get",data:null,success:null,failure:null},e),(i=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")).onreadystatechange=function(){if(4==i.readyState){var e=i.status;e>=200&&e<300||304==e||0===e&&"file:"===window.location.protocol?n.success&&n.success(i.responseText,i.responseXML):n.failure&&n.failure(e)}},i.open(n.type,n.url,n.async),i.send(n.data)}))};var g=function(t){var i=t.metadata,n=t.options,o=t.successCb,s=function(t){var i="Local"==BimfaceLoaderConfig.dataEnvType||BimfaceLoaderConfig.sdkPath?"bimface":t.sdkVersion,n=t.options,o=n.configuration,s=["/Bimface/Bimface.css","/Bimface/Application.js","/Bimface/Bimface.js","/Bimface/Drawing.js"],r=[];n.build===a.Debug?r=n.dataPath?[...e,...s]:u(t.metadata,t.options)?[]:[...e]:n.build!==a.Release||m(t.metadata,t.options)||u(t.metadata,t.options)||(r=[...r,`/${i}/three.min.js`,`/${i}/bimface.foxfly${o}.js`]);var c=[`/${i}/${n.language}.js`,`/${i}/Application${o}.js`];return u(t.metadata,t.options)?r=[...r,...c,`/${i}/Bimface.css`,`/${i}/bimface.pdf.css`,`/${i}/bimface.pdf.js`,`/${i}/bimface.pdfviewer.js`]:m(t.metadata,t.options)?r=[...r,...c,`/${i}/Drawing.css`,`/${i}/bimface.bufferfly.js`,`/${i}/Drawing${o}.js`]:(r=[...r,...c,`/${i}/Bimface.css`,`/${i}/thirdparty.js`,`/${i}/lib/loaders/BimTilesLoader.js`,`/${i}/Bimface${o}.js`],"gisView"===t.metadata.renderType&&r.push(`/${i}/bimface.ui.js`,`/${i}/bimface.ui.css`)),r}(t);p(n.staticHost,s),i.databagId=`${i.databagId}`,n.path?(i.path=n.path,i.dataPath="./"):n.resourcePath&&(i.path=n.resourcePath.replace("viewToken","")),i.sdkPath=n.sdkPath,0==s.length?o(i):d(s,(function(){if(n.build===a.Debug&&n.dataPath){let e=n.dataPath.split("/");o({databagId:e.pop(),path:e.join("/")})}o(i)}))};window.postProcessing=function(e){window.bimfaceStaticHost&&!window.BimfaceLoaderConfig.fullStaticHost&&(window.BimfaceLoaderConfig.fullStaticHost=window.bimfaceStaticHost,delete window.bimfaceStaticHost);var t=e.metadata,a=e.options;"1.0"===t.licenseVersion?w(a.staticHost,e,g):g(e)}}(); |