@realsee/five 6.2.0-alpha.11 → 6.2.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/umd/five.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 9/19/2024
5
- * Version: 6.2.0-alpha.11
4
+ * Generated: 2024/10/10
5
+ * Version: 6.2.0-alpha.13
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -388,7 +388,7 @@
388
388
  `}else if(S==="cRLDistributionPoints"){var O=this.getExtCRLDistributionPoints();T+=E(O)}else if(S==="authorityInfoAccess"){var k=this.getExtAuthorityInfoAccess();T+=b(k)}else S==="certificatePolicies"&&(T+=g(this.getExtCertificatePolicies()))}}return T+="signature algorithm: "+this.getSignatureAlgorithmName()+`
389
389
  `,T+="signature: "+this.getSignatureValueHex().substr(0,16)+`...
390
390
  `,T},typeof n=="string"&&(n.indexOf("-----BEGIN")!=-1?this.readCertPEM(n):KJUR.lang.String.isHex(n)&&this.readCertHex(n))}X509.hex2dn=function(n,t){t===void 0&&(t=0);var e=new X509;ASN1HEX.getTLV(n,t);var r=e.getX500Name(n);return r.str},X509.hex2rdn=function(n,t){if(t===void 0&&(t=0),n.substr(t,2)!=="31")throw new Error("malformed RDN");for(var e=new Array,r=ASN1HEX.getChildIdx(n,t),i=0;i<r.length;i++)e.push(X509.hex2attrTypeValue(n,r[i]));return e=e.map(function(o){return o.replace("+","\\+")}),e.join("+")},X509.hex2attrTypeValue=function(n,t){var e=ASN1HEX,r=e.getV;if(t===void 0&&(t=0),n.substr(t,2)!=="30")throw new Error("malformed attribute type and value");var i=e.getChildIdx(n,t);i.length!==2||n.substr(i[0],2);var o=r(n,i[0]),s=KJUR.asn1.ASN1Util.oidHexToInt(o),u=KJUR.asn1.x509.OID.oid2atype(s),c=r(n,i[1]),l=hextorstr(c);return u+"="+l},X509.getPublicKeyFromCertHex=function(n){var t=new X509;return t.readCertHex(n),t.getPublicKey()},X509.getPublicKeyFromCertPEM=function(n){var t=new X509;return t.readCertPEM(n),t.getPublicKey()},X509.getPublicKeyInfoPropOfCertPEM=function(n){var t=ASN1HEX,e=t.getVbyList,r={},i,o;return r.algparam=null,i=new X509,i.readCertPEM(n),o=i.getPublicKeyHex(),r.keyhex=e(o,0,[1],"03").substr(2),r.algoid=e(o,0,[0,0],"06"),r.algoid==="2a8648ce3d0201"&&(r.algparam=e(o,0,[0,1],"06")),r},X509.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];function sha256(n){return CryptoJS.SHA256(n).toString()}var certificates=[function(){var n=new X509;return n.readCertPEM(function(){var t=113,e=126,r=0,i="";return arguments[r].split(i).map(function(o){return o.charCodeAt(r)>e?o:String.fromCharCode((o.charCodeAt(r)+t)%e)}).join(i)}(":::::ORTV[-PR_aVSVPNaR:::::ZVVS@ PPNErtNVONtVWNZR}@]nU\0ZaZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg R^ZNATN>bROU^zc}nzyg R]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\x07\\QN>Z N\\Q^B[QqnS=\b\\QN>Zwp\\Q^B[QqnZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg R^ZNATN>bROU^zc}nzyg R]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaPPNvVQ^fWX|gVup[N^ROO^NQttV]NQPPNt|PttVONZU|C\b\\@@e^Xv{[vTtd8`nyO@\x07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e_\b[oOVU\x07ep@pYY\0cegY{r ?\bAbq?ff8}UaXoN_D]_X_8yozYFT`N{`\\{zvu?\bDWT}=_<\x07StX Nx\x07\0\b \0aT=c@ucnWfR[vf>RFxAFV}{N`dN^\\<eawBPxx}quT=|{T_R@Fp^Y<ZevRsWaZ]V CVrRVtAAc[ Qp|d|tqoQ=T|XX =u\\N8XNCx\\aU>wz X<e@Vc?dy\\|^FEq|=p`pBdF@bs^d<]vp\\^TZ P\bZ\b\\YNNSZ_\\w^|TsD8db _ Y\\o^Cw>Z\0x\\^aN]wWf\bA} C^d_{\x07ZC@\by]gY@E BFY?OsaqbDcVgQbZeFc ovtucxnq|<TnuyXRveYFOegCpAs{YTe|>bE<OXsSqCBWD_SVepfvCCUg]z ZvQ[\0s|U>pFz\b=OwT``fNJJ:::::R[Q-PR_aVSVPNaR:::::")),n}()];function getCertificateBySubjectHex(n,t){for(var e=0,r=t;e<r.length;e++){var i=r[e];if(i.getSubjectHex()===n)return i}}function verifyCertificate_(n,t){var e=n.getIssuerHex();if(e===n.getSubjectHex())return n.verifySignature(n.getPublicKey());var r=getCertificateBySubjectHex(e,t);return!r||n.verifySignature(r.getPublicKey())===!1?!1:verifyCertificate_(r,t)}function verifyCertificate(n){var t=n.getIssuerHex();return t===n.getSubjectHex()?!1:verifyCertificate_(n,certificates)}function addCertificate(n){var t=new X509;typeof n=="string"?t.readCertPEM(n):t.readCertHex(n.hex);var e=verifyCertificate(t);return certificates.push(t),e}function verifyMessage(n,t,e){var r=new X509;if(typeof e=="string"?r.readCertPEM(e):r.readCertHex(e.hex),verifyCertificate(r)===!1)return!1;var i=new RSAKey;return i.readCertPubKeyHex(r.hex,6),!!i.verify(n,b64tohex(t))}addCertificate(function(){var t=113,e=126,r=0,i="";return arguments[r].split(i).map(function(o){return o.charCodeAt(r)>e?o:String.fromCharCode((o.charCodeAt(r)+t)%e)}).join(i)}(":::::ORTV[-PR_aVSVPNaR:::::ZVVTU PPONrtNVONtVWNW=_SVw VE=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?g_8v{|}}WF>Sr>QBxO d_D}eBb?Uq^b [y}x]}{?P|BQtecTB[pQBW>|p|nfv\0zU\x07xOO}WqwE=<PURZy@X8r\\]u=<pPNRNNn\\OtaO<ZOETPdPT`NTT8RVOQ^^`SuO`gdSp?cyVRg\bo?B=VR[OZO=TN>bqQt^dOO`Fy\x07WadZcAD peXybcW@}Qf\\QNsOt[cU`ZRTQNdtOaAFXw= PCVxsv?{`a\bvS8YQ[aN]Ot[cU_ZONsEROaNQN^U<ZNTN>bqQ^RNVOOwN[Otx\0uxvTF=ON^SNN\\PNtRNrx a[}tP_g8FbD\0^\0qt<f88ufuN]^}]gp\bqYudF88Fas_Ef` ?^x>X}esa{>\\r?eE]CC_cZ[vQs >gX[szONg=^pn=<e]nbSz\bZvac\b[w^nA_`vP|@8w[}nQobe=??oRYf{vpRxcC}yCd>8[NDx{Ne\\t8oou=guC\x07>>g\x07vb}ACd ``Ntq\0yC[Q{|ynpNQqSqzxF<_PFDw<]Bnnu>F<XgU_Zf\\\\A=gu\\codOwQ]oQ<f>gv_pwozwC}xX>C`c]suEdfW?cbeo\b`BbyR@eFTUwSud=t]sS\\onc XSq {\0\x07DvAVBbnTqEE[QzDyqF`bF}R=Q?VeDo<Vzb\0w}D}NZ\0t}^?OyFP\bVaVNrTNYqe?[NRYTSQby@yzWvT`wQo}y]c_WgxBYCy RNRg@\x07NZCaaq8?` ^`?ryD =obzw?E]Ou\x07]n@>bVzqAQT?@_zo@}CxWVTUsAYdNd?{APQr8{P]]AZ>aR\0[D<z?Tr@`u@X|YDwd_<p<>zWE>]\0=X`\b@uucp|^_Qb@uZouTX^o\0\\{PCq{ug\x078^f[YQAWad8FNqxFQE?ZOo }RnO\bsQc xyccn=nxvs>bDBf\b\bW\\TuTnvAO^U\0QXC>xx8FxRFf<tJ:::::R[Q-PR_aVSVPNaR:::::"));var extendStatics=function(n,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])},extendStatics(n,t)};function __extends(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");extendStatics(n,t);function e(){this.constructor=n}n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var __assign=function(){return __assign=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},__assign.apply(this,arguments)};function __decorate(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(s=n[u])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o}function __metadata(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)}function __awaiter(n,t,e,r){function i(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function u(d){try{l(r.next(d))}catch(f){s(f)}}function c(d){try{l(r.throw(d))}catch(f){s(f)}}function l(d){d.done?o(d.value):i(d.value).then(u,c)}l((r=r.apply(n,t||[])).next())})}function __generator(n,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(l){return function(d){return c([l,d])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(e=0)),e;)try{if(r=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,i=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){e.label=l[1];break}if(l[0]===6&&e.label<o[1]){e.label=o[1],o=l;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(l);break}o[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(d){l=[6,d],i=0}finally{r=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function __spreadArray(n,t,e){if(e||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return n.concat(o||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;function createSymbol(n){return typeof Symbol=="undefined"?"$Symbol<".concat(n,">$"):Symbol(n)}var EVENT_SYMBOL=createSymbol("$$FIVE_EVENT$$");function __generateEventIfNotExisted(n){return n[EVENT_SYMBOL]||(n[EVENT_SYMBOL]={}),n[EVENT_SYMBOL]}function __removeEvents(n){n[EVENT_SYMBOL]&&delete n[EVENT_SYMBOL]}var Subscribe=function(){function n(){}return n.prototype.hasListener=function(t){var e=__generateEventIfNotExisted(this);return e&&e[t]&&e[t].callbacks.length>0},n.prototype.on=function(t,e,r){var i=this,o=__generateEventIfNotExisted(this);return o[t]||(o[t]={called:[!1],callbacks:[]}),o[t].callbacks.push([e,r||!1]),function(){return i.off(t,e)}},n.prototype.once=function(t,e){return this.on(t,e,!0)},n.prototype.off=function(t,e){if(t===void 0){__removeEvents(this);return}var r=__generateEventIfNotExisted(this);if(r[t]||(r[t]={called:[!1],callbacks:[]}),e===void 0){r[t].callbacks.length=0;return}for(var i=0;i<r[t].callbacks.length&&r[t].callbacks[i][0]!==e;i++);i<r[t].callbacks.length&&r[t].callbacks.splice(i,1)},n.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var i=!1,o=__generateEventIfNotExisted(this);o[t]||(o[t]={called:[!1],callbacks:[]}),o[t].called=[!0,e];for(var s=o[t].callbacks.slice(),u=0,c=s;u<c.length;u++){var l=c[u],d=l[0],f=l[1],m=f===void 0?!1:f,A=d.apply(void 0,e);m&&this.off(t,d),A===!1&&(i=!0)}return i},n.prototype.waitUnitl=function(t){var e=this,r=__generateEventIfNotExisted(this);r[t]||(r[t]={called:[!1],callbacks:[]});var i=r[t].called,o=i[0],s=i[1];return o?Promise.resolve(s):new Promise(function(u){e.once(t,function(){for(var c=[],l=0;l<arguments.length;l++)c[l]=arguments[l];return u(c),!0})})},n}();function noop$1(){}var start=typeof performance!="undefined"&&typeof performance.timing!="undefined"?performance.timing.navigationStart:Date.now(),now=typeof performance!="undefined"?function(){return start+performance.now()}:function(){return Date.now()};function deepFreeze(n){Object.freeze(n);var t=typeof n=="function",e=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(n).forEach(function(r){e.call(n,r)&&(!t||r!=="caller"&&r!=="callee"&&r!=="arguments")&&n[r]!==null&&(typeof n[r]=="object"||typeof n[r]=="function")&&!Object.isFrozen(n[r])&&deepFreeze(n[r])}),n}var domainRegex=/^([^.]+)(\.([^.]+))*$/;function match(n,t){if(n==="*")return!0;var e=n.split(".").reverse(),r=t.split(".").reverse();if(e.length<=1)return n===t;for(var i=0;i<e.length;i++)if(e[i]!==r[i])return!1;return!0}function isIPDomain(n){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(n)}function matchDomain(n,t){return domainRegex.test(n)&&domainRegex.test(t)&&match(n,t)}var JSONP_REGEXPS=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],BUILDIN_ALLOW_HOST=deepFreeze(JSON.parse(function(){var t=113,e=126,r=0,i="";return arguments[r].split(i).map(function(o){return o.charCodeAt(r)>e?o:String.fromCharCode((o.charCodeAt(r)+t)%e)}).join(i)}("h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/rnyrr;p{/9/rnyrr;p|z/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/rnyrr;nv/9/;p{/9/pq{;p{/9/pnyp{|qr;vr/j"))),NetworkProxyError=function(n){__extends(t,n);function t(e,r,i){return n.call(this,"[NETWORK]: request proxy error(type: ".concat(r,", reason: ").concat(i,"): ").concat(e))||this}return t}(Error),NetworkResponseError=function(n){__extends(t,n);function t(e,r,i){var o=n.call(this,"[NETWORK]: response error(type: ".concat(r,", status: ").concat(i,"): ").concat(e))||this;return o.httpStatus=i,o}return t}(Error);(function(n){__extends(t,n);function t(e,r){return n.call(this,"[NETWORK]: request abort(type: ".concat(r,"): ").concat(e))||this}return t})(Error);var NetworkTimeoutError=function(n){__extends(t,n);function t(e,r,i){return n.call(this,"[NETWORK]: request timeout(type: ".concat(r,", timeout: ").concat(i,"ms): ").concat(e))||this}return t}(Error),NetworkFirbiddenError=function(n){__extends(t,n);function t(e,r,i){return n.call(this,"[NETWORK]: request forbidden(type: ".concat(r,", reason: ").concat(i,"): ").concat(e))||this}return t}(Error);function parseHeaders(n){if(!n)return{};for(var t={},e=n.trim().split(`
391
- `),r=0;r<e.length;r++){var i=e[r],o=i.indexOf(":"),s=i.slice(0,o).trim().toLowerCase(),u=i.slice(o+1).trim();u&&(t[s]?t[s]+=", "+u:t[s]=u)}return t}function matchJsonpFunctionName(n){for(var t=0,e=JSONP_REGEXPS;t<e.length;t++){var r=e[t],i=n.match(r);if(i)return"jsonp_"+i[1]}return null}function isJsonpSource(n){return matchJsonpFunctionName(n)!==null}function getProtocol(n){var t=n.match(/^([0-9a-z]+\:)\/\/(([^:/?#]*)(?::[0-9]+)?)/);return t?t[1]:location.protocol}function hostnameFromURL(n){if(/^blob\:/i.test(n))return"blob:";if(/^data\:/i.test(n))return"data:";var t=n.match(/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i);return t?t[2]:location.hostname}var NetworkSubscribe=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(Subscribe);function ajax(n,t,e,r,i){t===void 0&&(t={}),e===void 0&&(e=noop$1),r===void 0&&(r=noop$1),i===void 0&&(i=noop$1);var o=now(),s=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(u){return/^https\:/.test(location.href)&&/^http\:/.test(u)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(u,"'. This request was automatically upgraded to HTTPS")),u.replace(/^http\:/,"https:")):u}).catch(function(u){var c,l=matchJsonpFunctionName(n),d=l?"Script":"XMLHttpRequest",f=new NetworkProxyError(s,d,u&&u.message?String(u.message):String(u));return(c=t.networkSubscribe)===null||c===void 0||c.emit("network",n,d,"proxy-error",f.message),Promise.reject(f)}).then(function(u){return new Promise(function(c,l){var d,f=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),m=hostnameFromURL(u),A=matchJsonpFunctionName(u);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(H){return matchDomain(H,location.hostname)}).length===0&&!isIPDomain(m)&&f.filter(function(H){return matchDomain(H,m)}).length===0){var h=A?"Script":"XMLHttpRequest",p=new NetworkFirbiddenError(u,h,"request host(".concat(m,") is not allowed"));r(p),l(p),(d=t.networkSubscribe)===null||d===void 0||d.emit("network",u,h,"forbidden",p.message);return}if(A){var y=window,v=null,g=!1,E=document.createElement("script"),b=function(){var H;if(v=null,g!==!0){g=!0;var B=new NetworkTimeoutError(u,"Script",t.timeout||NaN);r(B),l(B),(H=t.networkSubscribe)===null||H===void 0||H.emit("network",u,"Script","timeout",B.message)}},T=function(H){var B,L,O=now(),k=O-o;if(delete y[A],E.parentNode&&E.parentNode.removeChild(E),v!==null&&(window.clearTimeout(v),v=null),g!==!0){if(H.indexOf("data:")!==0){var G=new NetworkResponseError(u,"Script",500);r(G),l(G),(B=t.networkSubscribe)===null||B===void 0||B.emit("network",u,"Script","error",G.message);return}var z=H.split(","),D=(z[0].match(/:(.*?);/)||[])[1],U=z[1];if(t.responseType==="arraybuffer"||t.responseType==="blob"){for(var K=atob(z[1]),Q=K.length,q=new Uint8Array(Q),J=0;J<Q;J++)q[J]=K.charCodeAt(J);t.responseType==="arraybuffer"?U=q.buffer:U=new Blob([q],{type:D})}var W={},re={body:U,meta:{origin:s,source:u,requestTime:o,responseTime:O,costs:k,headers:W}};e(re),c(re),(L=t.networkSubscribe)===null||L===void 0||L.emit("network",u,"Script","ok",JSON.stringify(re.meta)),g=!0}};y[A]=T,E.src=u,document.body.appendChild(E),typeof t.timeout=="number"&&(v=window.setTimeout(b,t.timeout))}else{var x=!1,R=new XMLHttpRequest,_=function(){R&&(R.removeEventListener("timeout",M,!1),R.removeEventListener("progress",S,!1),R.removeEventListener("load",I,!1),R.removeEventListener("error",C,!1)),R=null,_=noop$1},M=function(){var H;if(x!==!0){x=!0,_();var B=new NetworkTimeoutError(u,"XMLHttpRequest",t.timeout||NaN);r(B),l(B),(H=t.networkSubscribe)===null||H===void 0||H.emit("network",u,"XMLHttpRequest","timeout",B.message)}},S=function(H){x!==!0&&H.lengthComputable&&(H.total<=0||i(H.loaded/H.total))},I=function(H){var B;if(x!==!0){var L=this.status;if(L===0||L>=200&&L<400){x=!0,_();var O=now(),k=O-o,G=parseHeaders(this.getAllResponseHeaders()),z=H.total,D={body:this.response,meta:{origin:s,source:u,requestTime:o,responseTime:O,costs:k,headers:G,size:z}};e(D),c(D),(B=t.networkSubscribe)===null||B===void 0||B.emit("network",u,"XMLHttpRequest","ok",JSON.stringify(D.meta))}else C.call(this)}},C=function(){var H;if(x!==!0){x=!0,_();var B=new NetworkResponseError(u,"XMLHttpRequest",this.status);r(B),l(B),(H=t.networkSubscribe)===null||H===void 0||H.emit("network",u,"XMLHttpRequest","error",B.message)}};R.addEventListener("timeout",M,!1),R.addEventListener("progress",S,!1),R.addEventListener("load",I,!1),R.addEventListener("error",C,!1),t.responseType&&(R.responseType=t.responseType),typeof t.timeout=="number"&&(R.timeout=t.timeout),R.open("GET",u,!0),R.send(null)}})})}var preloadCache={};function preload(n,t){t===void 0&&(t={});var e=now(),r=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(i){return/^https\:/.test(location.href)&&/^http\:/.test(i)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(i,"'. This request was automatically upgraded to HTTPS")),i.replace(/^http\:/,"https:")):i}).catch(function(i){var o,s=new NetworkProxyError(r,"Link",i&&i.message?String(i.message):String(i));return(o=t.networkSubscribe)===null||o===void 0||o.emit("network",n,"Link","proxy-error",s.message),Promise.reject(s)}).then(function(i){return i in preloadCache?preloadCache[i]:preloadCache[i]=new Promise(function(o,s){var u,c=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),l=hostnameFromURL(i);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(h){return matchDomain(h,location.hostname)}).length===0&&!isIPDomain(l)&&c.filter(function(h){return matchDomain(h,l)}).length===0){var d=new NetworkFirbiddenError(i,"Link","request host(".concat(l,") is not allowed"));s(d),(u=t.networkSubscribe)===null||u===void 0||u.emit("network",i,"Link","forbidden",d.message);return}var f=document.createElement("link");f.href=i,f.rel=f.relList&&f.relList.supports("prefetch")?"prefetch":"preload",f.as="fetch",f.crossOrigin="";var m=document.head||document.getElementsByTagName("head")[0];m&&m.appendChild(f);var A=!1;f.onload=function(){var h;if(A!==!0){A=!0,o();var p=now(),y=p-e,v={},g={origin:r,source:i,requestTime:e,responseTime:p,costs:y,headers:v};(h=t.networkSubscribe)===null||h===void 0||h.emit("network",i,"Link","preload",JSON.stringify(g))}},f.onerror=function(h){var p;if(A!==!0){A=!0;var y=new NetworkResponseError(i,"Link",0);s(y),(p=t.networkSubscribe)===null||p===void 0||p.emit("network",i,"Link","error",y.message)}}})})}function loadImage(n,t,e,r,i,o){t===void 0&&(t={}),e===void 0&&(e=noop$1),r===void 0&&(r=noop$1),i===void 0&&(i=noop$1);var s=now(),u=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(c){return/^https\:/.test(location.href)&&/^http\:/.test(c)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(c,"'. This request was automatically upgraded to HTTPS")),c.replace(/^http\:/,"https:")):c}).catch(function(c){var l,d=new NetworkProxyError(u,"Image",c&&c.message?String(c.message):String(c));return(l=t.networkSubscribe)===null||l===void 0||l.emit("network",n,"Image","proxy-error",d.message),Promise.reject(d)}).then(function(c){return new Promise(function(l,d){var f,m=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),A=hostnameFromURL(c);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(b){return matchDomain(b,location.hostname)}).length===0&&!isIPDomain(A)&&m.filter(function(b){return matchDomain(b,A)}).length===0){var h=new NetworkFirbiddenError(c,"Image","request host(".concat(A,") is not allowed"));r(h),d(h),(f=t.networkSubscribe)===null||f===void 0||f.emit("network",c,"Image","forbidden",h.message);return}var p=o!=null?o:new Image,y=!1,v=null,g=function(){var b;if(p.onload=noop$1,p.onerror=noop$1,v!==null&&(clearTimeout(v),v=null),y!==!0){var T=now(),x={headers:{},origin:u,source:c,requestTime:s,responseTime:T,costs:T-s};y=!0;var R={body:p,meta:x};i(1),e(R),l(R),(b=t.networkSubscribe)===null||b===void 0||b.emit("network",c,"Image","ok",JSON.stringify(R.meta))}},E=function(){var b;if(p.onload=noop$1,p.onerror=noop$1,v!==null&&(clearTimeout(v),v=null),y!==!0){y=!0;var T=new NetworkResponseError(c,"Image",0);r(T),d(T),(b=t.networkSubscribe)===null||b===void 0||b.emit("network",c,"Image","ok",T.message)}};typeof t.timeout=="number"&&(v=window.setTimeout(function(){var b;if(p.onload=noop$1,p.onerror=noop$1,v=null,y!==!0){y=!0;var T=new NetworkTimeoutError(c,"Image",t.timeout);r(T),d(T),(b=t.networkSubscribe)===null||b===void 0||b.emit("network",c,"Image","timeout",T.message)}},t.timeout)),p.onload=g,p.onerror=E,i(0),p.src=c})})}var Fetcher=function(){function n(t){t===void 0&&(t={}),this.options=Object.freeze(t),this.options.allowHosts&&Object.freeze(this.options.allowHosts)}return n.prototype.ajax=function(t,e,r,i,o){var s;e===void 0&&(e={}),r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var u=this.options,c={responseType:e.responseType,timeout:(s=e.timeout)!==null&&s!==void 0?s:u.timeout,get allowHosts(){var l;return(l=e.allowHosts)!==null&&l!==void 0?l:u.allowHosts},get requestProxy(){var l;return(l=e.requestProxy)!==null&&l!==void 0?l:u.requestProxy},get networkSubscribe(){var l;return(l=e.networkSubscribe)!==null&&l!==void 0?l:u.networkSubscribe}};return ajax(t,c,r,i,o)},n.prototype.loadImage=function(t,e,r,i,o,s){var u;e===void 0&&(e={}),r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var c=this.options,l={timeout:(u=e.timeout)!==null&&u!==void 0?u:c.timeout,get allowHosts(){var d;return(d=e.allowHosts)!==null&&d!==void 0?d:c.allowHosts},get requestProxy(){var d;return(d=e.requestProxy)!==null&&d!==void 0?d:c.requestProxy},get networkSubscribe(){var d;return(d=e.networkSubscribe)!==null&&d!==void 0?d:c.networkSubscribe}};return loadImage(t,l,r,i,o,s)},n.prototype.preload=function(t,e){var r;e===void 0&&(e={});var i=this.options,o={timeout:(r=e.timeout)!==null&&r!==void 0?r:i.timeout,get allowHosts(){var s;return(s=e.allowHosts)!==null&&s!==void 0?s:i.allowHosts},get requestProxy(){var s;return(s=e.requestProxy)!==null&&s!==void 0?s:i.requestProxy},get networkSubscribe(){var s;return(s=e.networkSubscribe)!==null&&s!==void 0?s:i.networkSubscribe}};return preload(t,o)},n}(),internalFetcher=new Fetcher,_requestAnimationFrame=function(){if(typeof window!="undefined"){var n=window;return n.requestAnimationFrame||n.mozRequestAnimationFrame||n.webkitRequestAnimationFrame||n.msRequestAnimationFrame||function(t){return setTimeout(t,16)}}else return function(t){return setTimeout(t,16)}}(),_cancelAnimationFrame=function(n){var t;if(typeof window!="undefined"){var e=window;t=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||e.msCancelAnimationFrame||function(r){return window.clearTimeout(r)}}else t=function(r){return window.clearTimeout(r)};t(n)},DEFAULT_ORDER=5,deviceFrameTime=16,AnimationFrameLoop=function(){function n(){this.frames=[],this.stoped=!1,this.time=now(),this.context=null,this.loop=this.loop.bind(this),this.loop()}return Object.defineProperty(n,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new n),this.sharedInstance},enumerable:!1,configurable:!0}),n.getFrameTime=function(){return deviceFrameTime},n.prototype.loop=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!this.stoped){var r=now(),i=r-this.time;this.time=r;var o=[];deviceFrameTime=i;for(var s=0,u=this.frames;s<u.length;s++){var c=u[s];if(c.delay>0){c.delay=c.delay-1;continue}try{c.callback.apply(c,__spreadArray([r,i],t,!1))}catch(l){console.error(l)}c.once&&o.push(c)}o.length>0&&(this.frames=this.frames.filter(function(l){return o.indexOf(l)===-1})),this.requestAnimationFrame(this.loop)}},n.prototype.setContext=function(t){this.cancelAnimationFrame(this.requestId),this.context=t,this.requestId=this.requestAnimationFrame(this.loop)},n.prototype.getContext=function(){return this.context},n.prototype.requestAnimationFrame=function(t){return this.context?this.context.requestAnimationFrame(t):_requestAnimationFrame(t)},n.prototype.cancelAnimationFrame=function(t){this.context?this.context.cancelAnimationFrame(t):_cancelAnimationFrame(this.loop),this.requestId=null},n.prototype.remove=function(t){var e=this.frames.indexOf(t);e>=0&&this.frames.splice(e,1)},n.prototype.add=function(t,e,r,i){var o=this;e===void 0&&(e=!1),r===void 0&&(r=0),i===void 0&&(i=DEFAULT_ORDER);var s={callback:t,once:e,delay:r,order:i};return this.frames.push(s),this.frames.sort(function(u,c){return u.order-c.order}),function(){return o.remove(s)}},n.prototype.disponse=function(){this.stoped=!0,this.frames.length=0},n}();function clamp$1(n,t,e){return n<t?t:n>e?e:n}var DEFAULT_IMAGE_URL_MAPPINGS={"vrlab-public.ljcdn.com":{type:"tencentCloud",pano:["vrlab-image1.ljcdn.com","vrlab-image2.ljcdn.com"],texture:["vrlab-image3.ljcdn.com"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vrlab-image4.ljcdn.com"]},"vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["vr-image-1.realsee-cdn.cn","vr-image-2.realsee-cdn.cn"],texture:["vr-image-3.realsee-cdn.cn"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vr-image-4.realsee-cdn.cn"]},"vr-public.rscdn.cn":{type:"tencentCloud",pano:["vr-image-1.rscdn.cn","vr-image-2.rscdn.cn"],texture:["vr-image-3.rscdn.cn"],tile:["vr-tile-1.rscdn.cn","vr-tile-2.rscdn.cn"],model:["vr-model-1.rscdn.cn","vr-model-2.rscdn.cn"],default:["vr-image-4.rscdn.cn"]},"mars-public.realsee-cdn.cn":{type:"aliyun",pano:["mars-image-1.realsee-cdn.cn","mars-image-2.realsee-cdn.cn"],texture:["mars-image-3.realsee-cdn.cn"],tile:["mars-tile-1.realsee-cdn.cn","mars-tile-2.realsee-cdn.cn"],model:["mars-model-1.realsee-cdn.cn","mars-model-2.realsee-cdn.cn"],default:["mars-image-4.realsee-cdn.cn"]},"global-public.realsee-cdn.com":{type:"tencentCloud",pano:["global-image-1.realsee-cdn.com","global-image-2.realsee-cdn.com"],texture:["global-image-3.realsee-cdn.com"],tile:["global-tile-1.realsee-cdn.com","global-tile-2.realsee-cdn.com"],model:["global-model-1.realsee-cdn.com","global-model-2.realsee-cdn.com"],default:["global-image-4.realsee-cdn.com"]},"earth-ga-public.realsee-cdn.cn":{type:"tencentCloud",pano:["earth-ga-image-1.realsee-cdn.cn","earth-ga-image-2.realsee-cdn.cn"],texture:["earth-ga-image-3.realsee-cdn.cn"],tile:["earth-ga-tile-1.realsee-cdn.cn","earth-ga-tile-2.realsee-cdn.cn"],model:["earth-ga-model-1.realsee-cdn.cn","earth-ga-model-2.realsee-cdn.cn"],default:["earth-ga-image-4.realsee-cdn.cn"]},"test-vr-public.realsee-cdn.com":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],texture:["test-vr-image.realsee-cdn.com"],tile:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],model:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],default:["test-vr-image.realsee-cdn.com"]},"test-vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],texture:["test-vr-image.realsee-cdn.cn"],tile:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],model:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],default:["test-vr-image.realsee-cdn.cn"]}},URL_DOMAIN_REGEX=/^https?\:\/\/?([^\/]+)/;function getDomain(n){var t=n.match(URL_DOMAIN_REGEX);return t===null?null:t[1]}function replaceDomain(n,t){return n.replace(URL_DOMAIN_REGEX,function(e,r){return e.slice(0,e.length-r.length)+t})}function route(n,t,e){var r=t.split("."),i=r[0],o=r.slice(1);if(i==="texture")return replaceDomain(n,e.texture[0]);if(i==="pano"||i==="pano_luminance"){o[0];var s=o[1];switch(s){case"front":case"left":case"up":return replaceDomain(n,e.pano[0]);case"down":case"right":case"back":return replaceDomain(n,e.pano[1])}}else if(i==="pano_tile"||i==="pano_tile_luminance"){o[0],o[1];var u=o[2],c=o[3],l=o[4],d=Math.pow(2,Number(u))*Number(c)+Number(l);if(!isNaN(d))return replaceDomain(n,e.tile[d%2])}else if(i==="model"){var f=o[0],d=Number(f);if(!isNaN(d))return replaceDomain(n,e.model[d%2])}return replaceDomain(n,e.default[0])}var tencentCloudImageProcesser=function(n,t){var e,r=n.split("?")[0],i=r.split(".").pop();if(i==="jpeg"&&(i="jpg"),i!=="png"&&i!=="jpg")return n;var o="";if(t.format!==void 0&&t.format!==i&&(o+="/format/".concat(t.format)),t.cut!==void 0&&(o+="/cut/".concat(t.cut[2],"x").concat(t.cut[3],"x").concat(t.cut[0],"x").concat(t.cut[1])),t.quality!==void 0){var s=(e=t.format)!==null&&e!==void 0?e:i;s&&["jpg","webp","tpg","heif","avif"].indexOf(s)>=0&&(o+="/quality/".concat(t.quality))}if(t.size!==void 0){var u=n.match(/\/cube_(\d+)\//),c=u?Number(u[1]):NaN;c!==Number(t.size)&&(o+="/thumbnail/".concat(t.size,"x"))}return t.sharpen!==void 0&&(o+="/sharpen/".concat(t.sharpen)),o.length&&(o="?imageMogr2"+o),r+o},aliyunOOSImageProcesser=function(n,t){var e,r=n.split("?")[0],i=r.split(".").pop();if(i==="jpeg"&&(i="jpg"),i!=="png"&&i!=="jpg")return n;var o="",s=[],u=t.format,c=t.quality,l=t.size;if(u!==void 0&&u!==i&&s.push("format,".concat(u==="heif"?"heic":u)),t.cut!==void 0){var d=t.cut,f=d[0],m=d[1],A=d[2],h=d[3];s.push("crop,x_".concat(f,",y_").concat(m,",w_").concat(A,",h_").concat(h,",g_nw"))}if(c!==void 0&&c!==100){var p=(e=t.format)!==null&&e!==void 0?e:i;p&&["jpg","webp"].indexOf(p)>=0&&s.push("quality,Q_".concat(c))}return l&&l!==2048&&s.push("resize,w_".concat(l)),t.sharpen!==void 0&&s.push("sharpen,".concat(t.sharpen)),s.length&&(o="?x-oss-process=image/"+s.join("/")),r+o},MAX_SAFE_INTEGER=9007199254740991;function formatNumber(n){var t=Math.round(n);return Math.abs(t-n)<.001?t:Math.floor(n)}function formatOptions(n){return n=Object.assign({},n),n.size!==void 0&&(n.size=formatNumber(clamp$1(n.size,0,MAX_SAFE_INTEGER))),n.quality!==void 0&&(n.quality=formatNumber(clamp$1(n.quality,0,100))),n.cut!==void 0&&(n.cut=[formatNumber(clamp$1(n.cut[0],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[1],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[2],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[3],0,MAX_SAFE_INTEGER))]),n.sharpen!==void 0&&(n.sharpen=formatNumber(clamp$1(n.sharpen,0,MAX_SAFE_INTEGER))),n}function imageURL(n,t){var e=__assign(__assign({},DEFAULT_IMAGE_URL_MAPPINGS),t.mappings),r=getDomain(n);if(r===null)return n;t=formatOptions(t);var i=e[r];return i?(n=route(n,t.key,i),/\.basis(\?|$)/.test(n)&&(n=n.replace(/\.basis(\?|$)/,".jpg$1")),i.type==="tencentCloud"?tencentCloudImageProcesser(n,t):i.type==="aliyun"?aliyunOOSImageProcesser(n,t):n):n}function applyImageURLOptions(n,t,e){t===void 0&&(t=imageURL);var r=t(n,e);if(r===n&&e.cut)throw new Error("ImageURL: cut option not applied.");return r}var IMAGE_SIZE_REG=/\/cube_(\d+)\//;function getImageSizeFromURL(n){var t=n.match(IMAGE_SIZE_REG);return t?Number(t[1]):null}function replaceImageSize(n,t){return n.replace(IMAGE_SIZE_REG,"/cube_".concat(t,"/"))}var webp="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAIAAUAmJaQAA3AA/vz0AAA=",avif="data:image/avif;base64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vYwAAAABEQAABAAEAAAAAAU8AAQAAAAAAAAAOAAAAFm1kYXQAAAAKJgGvLvkQwuWM4A==";function checkImage(n){return new Promise(function(t){var e=new Image,r=setTimeout(function(){e.onload=e.onerror=function(){},clearTimeout(r),t(!1)},100);e.onload=e.onerror=function(){e.onload=e.onerror=function(){},clearTimeout(r),t(e.height===2)},e.src=n})}var imageSupportCache=null;function imageSupport(){return imageSupportCache||(imageSupportCache=Promise.all([checkImage(webp),checkImage(avif),checkImage(heif)]).then(function(n){return{webp:n[0],avif:n[1],heif:n[2]}}))}var PANO_ID_REG=/^(.*)\[(\d+)\]$/;function panoStringify(n){if(!isNaN(n.panoIndex)&&isFinite(n.panoIndex))return"".concat(n.workCode,"[").concat(n.panoIndex,"]");throw new Error("Invalid Pano")}function panoParse(n){var t=n.match(PANO_ID_REG);if(t){t[0];var e=t[1],r=t[2],i=Math.floor(Number(r));if(!isNaN(i)&&isFinite(i))return{workCode:e,panoIndex:i}}throw new Error("Invalid PanoId")}function panoEqual(n,t){return panoStringify(n)===panoStringify(t)}function isPanoId(n){return typeof n=="string"&&PANO_ID_REG.test(n)}var PBMGroup=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(THREE__namespace.Group),PBMMesh=function(n){__extends(t,n);function t(e,r){var i=n.call(this,e,r)||this;return i.onBeforeRender=onBeforeRender$1,i}return t}(THREE__namespace.Mesh);function onBeforeRender$1(n,t,e){for(var r=0,i=this.material;r<i.length;r++){var o=i[r];this.model&&o.syncModel(this.model),o.update(n,e)}}var gradientTexture=function(){return typeof document!="undefined"?new THREE__namespace.TextureLoader().load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAABCAYAAACouxZ2AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAAAAQAAAAB7UD0+AAACA0lEQVRIDXWUW3YjIQxEwdnV/GT/q8kO3FO3pAJst3PSAaR6Cbszf//9XeMxxpjXmI+pVXudp2s6PC4dqHff9e6D7/PZLy46xQvG+sZvrfK8xgXUeq85yINe9bdmtOK1+kun5vjgq58a+eZPna9jvmjiserqG/+Whathvo3L3WhV89L9sXI/m18z2uene9ap/ftsuT9WZxoHXzW56/fpj8l7+tTw7P011NdpqnY19sRsfuHMA9u8oZWfDz4+fra/dfG1V60ydZ7qba1g7UNAeK0JP7ydD7/OqH6wO2f7HTq+B/lbL9qsB3/N1/UzR81XfPzw4tp5OPvRneacteq8Xo0xR3vuv/kPz0KtX0Nhg0eHuaNXdWI3X/ld427h++vzyp99V6VPrzWFhbv4ayay4oFecm198MmUXN/mL+x7npq/uJXBGb/MTw4+t+SvbLoTZnUW5uHhz7nWcTxT73OwXV7cxT9wbBf/0LnDBgcnHmtPLYba32Hp808sMy1u88yhr58n70/v4xX92GSN19l/2UsqGmiH94Hpxjcs+DO/ccpIVNVp62PUWXu//ur1GQy1Cf+GZ13rtNYN1po3/NI79fGXibHkq4z25xvV2pW3szpneXsW8SsreTe/NIPrtXMnH7wPf+LEN6tqhUVHj3XKD/72p9eafCeYB3zuonnbv7yqP8d/o4K6gRb1wbYAAAAASUVORK5CYII="):new THREE__namespace.Texture}();gradientTexture.minFilter=THREE__namespace.NearestFilter,gradientTexture.magFilter=THREE__namespace.NearestFilter,gradientTexture.wrapS=THREE__namespace.RepeatWrapping,gradientTexture.wrapT=THREE__namespace.RepeatWrapping;var defaultPbmParameters={pano0:null,pano1:null,shownFloorIndex:-1,modelAlpha:1,opacity:1,progress:0,transition:"FADE",clippers:null,brightness:1,constantColor:null,useEDL:!1,useHQWeight:!1,useHQDepth:!1,pointColor:"RGB",pointSize:"ATTENUATION",pointBack:"DARK",pointShape:"SQUARE",pointScale:.03,pointMaxPixel:40,pointMinPixel:.5,gradientTexture};function isEqualClipperParameters(n,t){var e=n!=null?n:[],r=t!=null?t:[];if(r.length!==e.length)return!1;for(var i=0;i<r.length;i++)if(!e[i].clippingBoxMatrix.equals(r[i].clippingBoxMatrix)||e[i].floorIndex!==r[i].floorIndex)return!1;return!0}function isEqualPBMPanoPicture(n,t){return n&&t?n.luminanceMap===t.luminanceMap&&n.map===t.map&&n.zoom===t.zoom&&n.matrix.equals(t.matrix):!n&&!t}function updatePBMParameters(n,t){var e=!1;for(var r in t)switch(r){case"clippers":isEqualClipperParameters(n[r],t[r])||(n[r]=t[r],e=!0);break;case"pano0":case"pano1":isEqualPBMPanoPicture(n[r],t[r])||(n[r]=t[r],e=!0);break;default:n[r]!==t[r]&&(n[r]=t[r],e=!0);break}return e}var PBMPointCloud=function(n){__extends(t,n);function t(e,r){var i=n.call(this,e,r)||this;return i.onBeforeRender=onBeforeRender,i}return t}(THREE__namespace.Points);function onBeforeRender(n,t,e){this.model&&this.material.syncModel(this.model),this.material.update(n,e)}var scratchMaterialSet=new Set,PBMContainer=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.needsRender=!0,e.pbmMaterialParametersVersion=0,e.materialParameters=__assign({},defaultPbmParameters),e}return t.prototype.getMaterial=function(){return __assign({},this.materialParameters)},t.prototype.setMaterial=function(e){var r=this;Object.assign(this.materialParameters,e),scratchMaterialSet.clear(),this.traverse(function(i){if(i instanceof PBMMesh)for(var o=0,s=i.material;o<s.length;o++){var u=s[o];scratchMaterialSet.has(u)||(Object.assign(u,r.materialParameters),scratchMaterialSet.add(u))}i instanceof PBMPointCloud&&(scratchMaterialSet.has(i.material)||(Object.assign(i.material,r.materialParameters),scratchMaterialSet.add(i.material)))}),scratchMaterialSet.clear(),this.needsRender=!0},t}(THREE__namespace.Group),FACE_ORDER$1=["right","left","up","down","front","back"];function getBox(n,t,e,r){var i=new THREE__namespace.Box3;switch(n){case"up":i.min.y=.5,i.max.y=.5,i.min.x=+t-.5,i.max.x=+t-.5+r,i.min.z=-e+.5-r,i.max.z=-e+.5;break;case"down":i.min.y=-.5,i.max.y=-.5,i.min.x=+t-.5,i.max.x=+t-.5+r,i.min.z=+e-.5,i.max.z=+e-.5+r;break;case"left":i.min.x=-.5,i.max.x=-.5,i.min.z=-t+.5-r,i.max.z=-t+.5,i.min.y=-e+.5-r,i.max.y=-e+.5;break;case"right":i.min.x=.5,i.max.x=.5,i.min.z=+t-.5,i.max.z=+t-.5+r,i.min.y=-e+.5-r,i.max.y=-e+.5;break;case"front":i.min.z=-.5,i.max.z=-.5,i.min.x=+t-.5,i.max.x=+t-.5+r,i.min.y=-e+.5-r,i.max.y=-e+.5;break;case"back":i.min.z=.5,i.max.z=.5,i.min.x=-t+.5-r,i.max.x=-t+.5,i.min.y=-e+.5-r,i.max.y=-e+.5;break}return i.applyMatrix4(new THREE__namespace.Matrix4().makeRotationY(Math.PI))}var createChildren=function(n,t){if(!(n.level>=t))for(var e=n.level+1,r=n.size/2,i=[new THREE__namespace.Vector2(n.position.x,n.position.y),new THREE__namespace.Vector2(n.position.x+r,n.position.y),new THREE__namespace.Vector2(n.position.x,n.position.y+r),new THREE__namespace.Vector2(n.position.x+r,n.position.y+r)],o=0,s=i;o<s.length;o++){var u=s[o],c={face:n.face,level:e,size:r,position:u,box:getBox(n.face,u.x,u.y,r),children:[]};n.children.push(c),createChildren(c,t)}};function createTileCubeNode(n,t){var e={level:0,face:n,position:new THREE__namespace.Vector2(0,0),size:1,box:getBox(n,0,0,1),children:[]};return createChildren(e,t),e}function createTileCubeTree(n){var t=FACE_ORDER$1.map(function(e){return createTileCubeNode(e,n)});return{children:t}}function traverseTileCubeNode(n,t){for(var e=0,r=n.children;e<r.length;e++){var i=r[e],o=t(i);o!==!1&&traverseTileCubeNode(i,t)}}var CUBE_GEOMETRY=new THREE__namespace.BoxBufferGeometry(1,1,1,1,1);CUBE_GEOMETRY.deleteAttribute("uv"),CUBE_GEOMETRY.deleteAttribute("normal"),CUBE_GEOMETRY.groups=[],CUBE_GEOMETRY.scale(-1,1,1);var CUBE_VERTEX_SHADER=`
391
+ `),r=0;r<e.length;r++){var i=e[r],o=i.indexOf(":"),s=i.slice(0,o).trim().toLowerCase(),u=i.slice(o+1).trim();u&&(t[s]?t[s]+=", "+u:t[s]=u)}return t}function matchJsonpFunctionName(n){for(var t=0,e=JSONP_REGEXPS;t<e.length;t++){var r=e[t],i=n.match(r);if(i)return"jsonp_"+i[1]}return null}function isJsonpSource(n){return matchJsonpFunctionName(n)!==null}function getProtocol(n){var t=n.match(/^([0-9a-z]+\:)\/\/(([^:/?#]*)(?::[0-9]+)?)/);return t?t[1]:location.protocol}function hostnameFromURL(n){if(/^blob\:/i.test(n))return"blob:";if(/^data\:/i.test(n))return"data:";var t=n.match(/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i);return t?t[2]:location.hostname}var NetworkSubscribe=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(Subscribe);function ajax(n,t,e,r,i){t===void 0&&(t={}),e===void 0&&(e=noop$1),r===void 0&&(r=noop$1),i===void 0&&(i=noop$1);var o=now(),s=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(u){return/^https\:/.test(location.href)&&/^http\:/.test(u)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(u,"'. This request was automatically upgraded to HTTPS")),u.replace(/^http\:/,"https:")):u}).catch(function(u){var c,l=matchJsonpFunctionName(n),d=l?"Script":"XMLHttpRequest",f=new NetworkProxyError(s,d,u&&u.message?String(u.message):String(u));return(c=t.networkSubscribe)===null||c===void 0||c.emit("network",n,d,"proxy-error",f.message),Promise.reject(f)}).then(function(u){return new Promise(function(c,l){var d,f=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),m=hostnameFromURL(u),A=matchJsonpFunctionName(u);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(H){return matchDomain(H,location.hostname)}).length===0&&!isIPDomain(m)&&f.filter(function(H){return matchDomain(H,m)}).length===0){var h=A?"Script":"XMLHttpRequest",p=new NetworkFirbiddenError(u,h,"request host(".concat(m,") is not allowed"));r(p),l(p),(d=t.networkSubscribe)===null||d===void 0||d.emit("network",u,h,"forbidden",p.message);return}if(A){var y=window,v=null,g=!1,E=document.createElement("script"),b=function(){var H;if(v=null,g!==!0){g=!0;var B=new NetworkTimeoutError(u,"Script",t.timeout||NaN);r(B),l(B),(H=t.networkSubscribe)===null||H===void 0||H.emit("network",u,"Script","timeout",B.message)}},T=function(H){var B,L,O=now(),k=O-o;if(delete y[A],E.parentNode&&E.parentNode.removeChild(E),v!==null&&(window.clearTimeout(v),v=null),g!==!0){if(H.indexOf("data:")!==0){var G=new NetworkResponseError(u,"Script",500);r(G),l(G),(B=t.networkSubscribe)===null||B===void 0||B.emit("network",u,"Script","error",G.message);return}var z=H.split(","),D=(z[0].match(/:(.*?);/)||[])[1],U=z[1];if(t.responseType==="arraybuffer"||t.responseType==="blob"){for(var K=atob(z[1]),Q=K.length,q=new Uint8Array(Q),J=0;J<Q;J++)q[J]=K.charCodeAt(J);t.responseType==="arraybuffer"?U=q.buffer:U=new Blob([q],{type:D})}var j={},re={body:U,meta:{origin:s,source:u,requestTime:o,responseTime:O,costs:k,headers:j}};e(re),c(re),(L=t.networkSubscribe)===null||L===void 0||L.emit("network",u,"Script","ok",JSON.stringify(re.meta)),g=!0}};y[A]=T,E.src=u,document.body.appendChild(E),typeof t.timeout=="number"&&(v=window.setTimeout(b,t.timeout))}else{var x=!1,R=new XMLHttpRequest,_=function(){R&&(R.removeEventListener("timeout",M,!1),R.removeEventListener("progress",S,!1),R.removeEventListener("load",I,!1),R.removeEventListener("error",C,!1)),R=null,_=noop$1},M=function(){var H;if(x!==!0){x=!0,_();var B=new NetworkTimeoutError(u,"XMLHttpRequest",t.timeout||NaN);r(B),l(B),(H=t.networkSubscribe)===null||H===void 0||H.emit("network",u,"XMLHttpRequest","timeout",B.message)}},S=function(H){x!==!0&&H.lengthComputable&&(H.total<=0||i(H.loaded/H.total))},I=function(H){var B;if(x!==!0){var L=this.status;if(L===0||L>=200&&L<400){x=!0,_();var O=now(),k=O-o,G=parseHeaders(this.getAllResponseHeaders()),z=H.total,D={body:this.response,meta:{origin:s,source:u,requestTime:o,responseTime:O,costs:k,headers:G,size:z}};e(D),c(D),(B=t.networkSubscribe)===null||B===void 0||B.emit("network",u,"XMLHttpRequest","ok",JSON.stringify(D.meta))}else C.call(this)}},C=function(){var H;if(x!==!0){x=!0,_();var B=new NetworkResponseError(u,"XMLHttpRequest",this.status);r(B),l(B),(H=t.networkSubscribe)===null||H===void 0||H.emit("network",u,"XMLHttpRequest","error",B.message)}};R.addEventListener("timeout",M,!1),R.addEventListener("progress",S,!1),R.addEventListener("load",I,!1),R.addEventListener("error",C,!1),t.responseType&&(R.responseType=t.responseType),typeof t.timeout=="number"&&(R.timeout=t.timeout),R.open("GET",u,!0),R.send(null)}})})}var preloadCache={};function preload(n,t){t===void 0&&(t={});var e=now(),r=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(i){return/^https\:/.test(location.href)&&/^http\:/.test(i)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(i,"'. This request was automatically upgraded to HTTPS")),i.replace(/^http\:/,"https:")):i}).catch(function(i){var o,s=new NetworkProxyError(r,"Link",i&&i.message?String(i.message):String(i));return(o=t.networkSubscribe)===null||o===void 0||o.emit("network",n,"Link","proxy-error",s.message),Promise.reject(s)}).then(function(i){return i in preloadCache?preloadCache[i]:preloadCache[i]=new Promise(function(o,s){var u,c=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),l=hostnameFromURL(i);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(h){return matchDomain(h,location.hostname)}).length===0&&!isIPDomain(l)&&c.filter(function(h){return matchDomain(h,l)}).length===0){var d=new NetworkFirbiddenError(i,"Link","request host(".concat(l,") is not allowed"));s(d),(u=t.networkSubscribe)===null||u===void 0||u.emit("network",i,"Link","forbidden",d.message);return}var f=document.createElement("link");f.href=i,f.rel=f.relList&&f.relList.supports("prefetch")?"prefetch":"preload",f.as="fetch",f.crossOrigin="";var m=document.head||document.getElementsByTagName("head")[0];m&&m.appendChild(f);var A=!1;f.onload=function(){var h;if(A!==!0){A=!0,o();var p=now(),y=p-e,v={},g={origin:r,source:i,requestTime:e,responseTime:p,costs:y,headers:v};(h=t.networkSubscribe)===null||h===void 0||h.emit("network",i,"Link","preload",JSON.stringify(g))}},f.onerror=function(h){var p;if(A!==!0){A=!0;var y=new NetworkResponseError(i,"Link",0);s(y),(p=t.networkSubscribe)===null||p===void 0||p.emit("network",i,"Link","error",y.message)}}})})}function loadImage(n,t,e,r,i,o){t===void 0&&(t={}),e===void 0&&(e=noop$1),r===void 0&&(r=noop$1),i===void 0&&(i=noop$1);var s=now(),u=n;return Promise.resolve().then(function(){return t.requestProxy?t.requestProxy(n):n}).then(function(c){return/^https\:/.test(location.href)&&/^http\:/.test(c)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(c,"'. This request was automatically upgraded to HTTPS")),c.replace(/^http\:/,"https:")):c}).catch(function(c){var l,d=new NetworkProxyError(u,"Image",c&&c.message?String(c.message):String(c));return(l=t.networkSubscribe)===null||l===void 0||l.emit("network",n,"Image","proxy-error",d.message),Promise.reject(d)}).then(function(c){return new Promise(function(l,d){var f,m=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),A=hostnameFromURL(c);if(location.hostname.length!==0&&!isIPDomain(location.hostname)&&BUILDIN_ALLOW_HOST.filter(function(b){return matchDomain(b,location.hostname)}).length===0&&!isIPDomain(A)&&m.filter(function(b){return matchDomain(b,A)}).length===0){var h=new NetworkFirbiddenError(c,"Image","request host(".concat(A,") is not allowed"));r(h),d(h),(f=t.networkSubscribe)===null||f===void 0||f.emit("network",c,"Image","forbidden",h.message);return}var p=o!=null?o:new Image,y=!1,v=null,g=function(){var b;if(p.onload=noop$1,p.onerror=noop$1,v!==null&&(clearTimeout(v),v=null),y!==!0){var T=now(),x={headers:{},origin:u,source:c,requestTime:s,responseTime:T,costs:T-s};y=!0;var R={body:p,meta:x};i(1),e(R),l(R),(b=t.networkSubscribe)===null||b===void 0||b.emit("network",c,"Image","ok",JSON.stringify(R.meta))}},E=function(){var b;if(p.onload=noop$1,p.onerror=noop$1,v!==null&&(clearTimeout(v),v=null),y!==!0){y=!0;var T=new NetworkResponseError(c,"Image",0);r(T),d(T),(b=t.networkSubscribe)===null||b===void 0||b.emit("network",c,"Image","ok",T.message)}};typeof t.timeout=="number"&&(v=window.setTimeout(function(){var b;if(p.onload=noop$1,p.onerror=noop$1,v=null,y!==!0){y=!0;var T=new NetworkTimeoutError(c,"Image",t.timeout);r(T),d(T),(b=t.networkSubscribe)===null||b===void 0||b.emit("network",c,"Image","timeout",T.message)}},t.timeout)),p.onload=g,p.onerror=E,i(0),p.src=c})})}var Fetcher=function(){function n(t){t===void 0&&(t={}),this.options=Object.freeze(t),this.options.allowHosts&&Object.freeze(this.options.allowHosts)}return n.prototype.ajax=function(t,e,r,i,o){var s;e===void 0&&(e={}),r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var u=this.options,c={responseType:e.responseType,timeout:(s=e.timeout)!==null&&s!==void 0?s:u.timeout,get allowHosts(){var l;return(l=e.allowHosts)!==null&&l!==void 0?l:u.allowHosts},get requestProxy(){var l;return(l=e.requestProxy)!==null&&l!==void 0?l:u.requestProxy},get networkSubscribe(){var l;return(l=e.networkSubscribe)!==null&&l!==void 0?l:u.networkSubscribe}};return ajax(t,c,r,i,o)},n.prototype.loadImage=function(t,e,r,i,o,s){var u;e===void 0&&(e={}),r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var c=this.options,l={timeout:(u=e.timeout)!==null&&u!==void 0?u:c.timeout,get allowHosts(){var d;return(d=e.allowHosts)!==null&&d!==void 0?d:c.allowHosts},get requestProxy(){var d;return(d=e.requestProxy)!==null&&d!==void 0?d:c.requestProxy},get networkSubscribe(){var d;return(d=e.networkSubscribe)!==null&&d!==void 0?d:c.networkSubscribe}};return loadImage(t,l,r,i,o,s)},n.prototype.preload=function(t,e){var r;e===void 0&&(e={});var i=this.options,o={timeout:(r=e.timeout)!==null&&r!==void 0?r:i.timeout,get allowHosts(){var s;return(s=e.allowHosts)!==null&&s!==void 0?s:i.allowHosts},get requestProxy(){var s;return(s=e.requestProxy)!==null&&s!==void 0?s:i.requestProxy},get networkSubscribe(){var s;return(s=e.networkSubscribe)!==null&&s!==void 0?s:i.networkSubscribe}};return preload(t,o)},n}(),internalFetcher=new Fetcher,_requestAnimationFrame=function(){if(typeof window!="undefined"){var n=window;return n.requestAnimationFrame||n.mozRequestAnimationFrame||n.webkitRequestAnimationFrame||n.msRequestAnimationFrame||function(t){return setTimeout(t,16)}}else return function(t){return setTimeout(t,16)}}(),_cancelAnimationFrame=function(n){var t;if(typeof window!="undefined"){var e=window;t=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||e.msCancelAnimationFrame||function(r){return window.clearTimeout(r)}}else t=function(r){return window.clearTimeout(r)};t(n)},DEFAULT_ORDER=5,deviceFrameTime=16,AnimationFrameLoop=function(){function n(){this.frames=[],this.stoped=!1,this.time=now(),this.context=null,this.loop=this.loop.bind(this),this.loop()}return Object.defineProperty(n,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new n),this.sharedInstance},enumerable:!1,configurable:!0}),n.getFrameTime=function(){return deviceFrameTime},n.prototype.loop=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!this.stoped){var r=now(),i=r-this.time;this.time=r;var o=[];deviceFrameTime=i;for(var s=0,u=this.frames;s<u.length;s++){var c=u[s];if(c.delay>0){c.delay=c.delay-1;continue}try{c.callback.apply(c,__spreadArray([r,i],t,!1))}catch(l){console.error(l)}c.once&&o.push(c)}o.length>0&&(this.frames=this.frames.filter(function(l){return o.indexOf(l)===-1})),this.requestAnimationFrame(this.loop)}},n.prototype.setContext=function(t){this.cancelAnimationFrame(this.requestId),this.context=t,this.requestId=this.requestAnimationFrame(this.loop)},n.prototype.getContext=function(){return this.context},n.prototype.requestAnimationFrame=function(t){return this.context?this.context.requestAnimationFrame(t):_requestAnimationFrame(t)},n.prototype.cancelAnimationFrame=function(t){this.context?this.context.cancelAnimationFrame(t):_cancelAnimationFrame(this.loop),this.requestId=null},n.prototype.remove=function(t){var e=this.frames.indexOf(t);e>=0&&this.frames.splice(e,1)},n.prototype.add=function(t,e,r,i){var o=this;e===void 0&&(e=!1),r===void 0&&(r=0),i===void 0&&(i=DEFAULT_ORDER);var s={callback:t,once:e,delay:r,order:i};return this.frames.push(s),this.frames.sort(function(u,c){return u.order-c.order}),function(){return o.remove(s)}},n.prototype.disponse=function(){this.stoped=!0,this.frames.length=0},n}();function clamp$1(n,t,e){return n<t?t:n>e?e:n}var DEFAULT_IMAGE_URL_MAPPINGS={"vrlab-public.ljcdn.com":{type:"tencentCloud",pano:["vrlab-image1.ljcdn.com","vrlab-image2.ljcdn.com"],texture:["vrlab-image3.ljcdn.com"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vrlab-image4.ljcdn.com"]},"vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["vr-image-1.realsee-cdn.cn","vr-image-2.realsee-cdn.cn"],texture:["vr-image-3.realsee-cdn.cn"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vr-image-4.realsee-cdn.cn"]},"vr-public.rscdn.cn":{type:"tencentCloud",pano:["vr-image-1.rscdn.cn","vr-image-2.rscdn.cn"],texture:["vr-image-3.rscdn.cn"],tile:["vr-tile-1.rscdn.cn","vr-tile-2.rscdn.cn"],model:["vr-model-1.rscdn.cn","vr-model-2.rscdn.cn"],default:["vr-image-4.rscdn.cn"]},"mars-public.realsee-cdn.cn":{type:"aliyun",pano:["mars-image-1.realsee-cdn.cn","mars-image-2.realsee-cdn.cn"],texture:["mars-image-3.realsee-cdn.cn"],tile:["mars-tile-1.realsee-cdn.cn","mars-tile-2.realsee-cdn.cn"],model:["mars-model-1.realsee-cdn.cn","mars-model-2.realsee-cdn.cn"],default:["mars-image-4.realsee-cdn.cn"]},"global-public.realsee-cdn.com":{type:"tencentCloud",pano:["global-image-1.realsee-cdn.com","global-image-2.realsee-cdn.com"],texture:["global-image-3.realsee-cdn.com"],tile:["global-tile-1.realsee-cdn.com","global-tile-2.realsee-cdn.com"],model:["global-model-1.realsee-cdn.com","global-model-2.realsee-cdn.com"],default:["global-image-4.realsee-cdn.com"]},"earth-ga-public.realsee-cdn.cn":{type:"tencentCloud",pano:["earth-ga-image-1.realsee-cdn.cn","earth-ga-image-2.realsee-cdn.cn"],texture:["earth-ga-image-3.realsee-cdn.cn"],tile:["earth-ga-tile-1.realsee-cdn.cn","earth-ga-tile-2.realsee-cdn.cn"],model:["earth-ga-model-1.realsee-cdn.cn","earth-ga-model-2.realsee-cdn.cn"],default:["earth-ga-image-4.realsee-cdn.cn"]},"test-vr-public.realsee-cdn.com":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],texture:["test-vr-image.realsee-cdn.com"],tile:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],model:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],default:["test-vr-image.realsee-cdn.com"]},"test-vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],texture:["test-vr-image.realsee-cdn.cn"],tile:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],model:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],default:["test-vr-image.realsee-cdn.cn"]}},URL_DOMAIN_REGEX=/^https?\:\/\/?([^\/]+)/;function getDomain(n){var t=n.match(URL_DOMAIN_REGEX);return t===null?null:t[1]}function replaceDomain(n,t){return n.replace(URL_DOMAIN_REGEX,function(e,r){return e.slice(0,e.length-r.length)+t})}function route(n,t,e){var r=t.split("."),i=r[0],o=r.slice(1);if(i==="texture")return replaceDomain(n,e.texture[0]);if(i==="pano"||i==="pano_luminance"){o[0];var s=o[1];switch(s){case"front":case"left":case"up":return replaceDomain(n,e.pano[0]);case"down":case"right":case"back":return replaceDomain(n,e.pano[1])}}else if(i==="pano_tile"||i==="pano_tile_luminance"){o[0],o[1];var u=o[2],c=o[3],l=o[4],d=Math.pow(2,Number(u))*Number(c)+Number(l);if(!isNaN(d))return replaceDomain(n,e.tile[d%2])}else if(i==="model"){var f=o[0],d=Number(f);if(!isNaN(d))return replaceDomain(n,e.model[d%2])}return replaceDomain(n,e.default[0])}var tencentCloudImageProcesser=function(n,t){var e,r=n.split("?")[0],i=r.split(".").pop();if(i==="jpeg"&&(i="jpg"),i!=="png"&&i!=="jpg")return n;var o="";if(t.format!==void 0&&t.format!==i&&(o+="/format/".concat(t.format)),t.cut!==void 0&&(o+="/cut/".concat(t.cut[2],"x").concat(t.cut[3],"x").concat(t.cut[0],"x").concat(t.cut[1])),t.quality!==void 0){var s=(e=t.format)!==null&&e!==void 0?e:i;s&&["jpg","webp","tpg","heif","avif"].indexOf(s)>=0&&(o+="/quality/".concat(t.quality))}if(t.size!==void 0){var u=n.match(/\/cube_(\d+)\//),c=u?Number(u[1]):NaN;c!==Number(t.size)&&(o+="/thumbnail/".concat(t.size,"x"))}return t.sharpen!==void 0&&(o+="/sharpen/".concat(t.sharpen)),o.length&&(o="?imageMogr2"+o),r+o},aliyunOOSImageProcesser=function(n,t){var e,r=n.split("?")[0],i=r.split(".").pop();if(i==="jpeg"&&(i="jpg"),i!=="png"&&i!=="jpg")return n;var o="",s=[],u=t.format,c=t.quality,l=t.size;if(u!==void 0&&u!==i&&s.push("format,".concat(u==="heif"?"heic":u)),t.cut!==void 0){var d=t.cut,f=d[0],m=d[1],A=d[2],h=d[3];s.push("crop,x_".concat(f,",y_").concat(m,",w_").concat(A,",h_").concat(h,",g_nw"))}if(c!==void 0&&c!==100){var p=(e=t.format)!==null&&e!==void 0?e:i;p&&["jpg","webp"].indexOf(p)>=0&&s.push("quality,Q_".concat(c))}return l&&l!==2048&&s.push("resize,w_".concat(l)),t.sharpen!==void 0&&s.push("sharpen,".concat(t.sharpen)),s.length&&(o="?x-oss-process=image/"+s.join("/")),r+o},MAX_SAFE_INTEGER=9007199254740991;function formatNumber(n){var t=Math.round(n);return Math.abs(t-n)<.001?t:Math.floor(n)}function formatOptions(n){return n=Object.assign({},n),n.size!==void 0&&(n.size=formatNumber(clamp$1(n.size,0,MAX_SAFE_INTEGER))),n.quality!==void 0&&(n.quality=formatNumber(clamp$1(n.quality,0,100))),n.cut!==void 0&&(n.cut=[formatNumber(clamp$1(n.cut[0],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[1],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[2],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(n.cut[3],0,MAX_SAFE_INTEGER))]),n.sharpen!==void 0&&(n.sharpen=formatNumber(clamp$1(n.sharpen,0,MAX_SAFE_INTEGER))),n}function imageURL(n,t){var e=__assign(__assign({},DEFAULT_IMAGE_URL_MAPPINGS),t.mappings),r=getDomain(n);if(r===null)return n;t=formatOptions(t);var i=e[r];return i?(n=route(n,t.key,i),/\.basis(\?|$)/.test(n)&&(n=n.replace(/\.basis(\?|$)/,".jpg$1")),i.type==="tencentCloud"?tencentCloudImageProcesser(n,t):i.type==="aliyun"?aliyunOOSImageProcesser(n,t):n):n}function applyImageURLOptions(n,t,e){t===void 0&&(t=imageURL);var r=t(n,e);if(r===n&&e.cut)throw new Error("ImageURL: cut option not applied.");return r}var IMAGE_SIZE_REG=/\/cube_(\d+)\//;function getImageSizeFromURL(n){var t=n.match(IMAGE_SIZE_REG);return t?Number(t[1]):null}function replaceImageSize(n,t){return n.replace(IMAGE_SIZE_REG,"/cube_".concat(t,"/"))}var webp="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAIAAUAmJaQAA3AA/vz0AAA=",avif="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAAGhbWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAsaWxvYwAAAABEAAACAAEAAAABAAAB3gAAABkAAgAAAAEAAAHJAAAAFQAAAEJpaW5mAAAAAAACAAAAGmluZmUCAAAAAAEAAGF2MDFDb2xvcgAAAAAaaW5mZQIAAAAAAgAAYXYwMUFscGhhAAAAABppcmVmAAAAAAAAAA5hdXhsAAIAAQABAAAA12lwcnAAAACxaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIAAoAAAAAUaXNwZQAAAAAAAAACAAAAAgAAAA5waXhpAAAAAAEIAAAADGF2MUOBABwAAAAAOGF1eEMAAAAAdXJuOm1wZWc6bXBlZ0I6Y2ljcDpzeXN0ZW1zOmF1eGlsaWFyeTphbHBoYQAAAAAeaXBtYQAAAAAAAAACAAEEAQKDBAACBAUGhwgAAAA2bWRhdBIACgQYADLVMgsWQBhhIAQqrNj/+BIACgUYADLEoDIOFkADDDDCQAACDaqCCb4=",heif="data:image/heif;base64,AAAAGGZ0eXBoZWljAAAAAG1pZjFoZWljAAABL21ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAHBpY3QAAAAAAAAAAAAAAAAAAAAADnBpdG0AAAAAAAEAAAAjaWluZgAAAAAAAQAAABVpbmZlAgAAAAABAABodmMxAAAAAK9pcHJwAAAAkmlwY28AAAB2aHZjQwEBYAAAAAAAAAAAAADwAPz9+PgAACcDoAABAB5AAQwG//8BYAAAAwAAAwAAAwAAAwAAAwAAreTLgSChAAEAI0IBBwFgAAADAAADAAADAAADAAADAAChInJJlreTLySZNdggogABAAdEAcA98DMkAAAAFGlzcGUAAAAAAAAAAgAAAAIAAAAVaXBtYQAAAAAAAAABAAECgQIAAAAiaWxvYwAAAABEQAABAAEAAAAAAU8AAQAAAAAAAAAOAAAAFm1kYXQAAAAKJgGvLvkQwuWM4A==";function checkImage(n){return new Promise(function(t){var e=new Image,r=setTimeout(function(){e.onload=e.onerror=function(){},clearTimeout(r),t(!1)},100);e.onload=e.onerror=function(){e.onload=e.onerror=function(){},clearTimeout(r),t(e.height===2)},e.src=n})}var imageSupportCache=null;function imageSupport(){return imageSupportCache||(imageSupportCache=Promise.all([checkImage(webp),checkImage(avif),checkImage(heif)]).then(function(n){return{webp:n[0],avif:n[1],heif:n[2]}}))}var PANO_ID_REG=/^(.*)\[(\d+)\]$/;function panoStringify(n){if(!isNaN(n.panoIndex)&&isFinite(n.panoIndex))return"".concat(n.workCode,"[").concat(n.panoIndex,"]");throw new Error("Invalid Pano")}function panoParse(n){var t=n.match(PANO_ID_REG);if(t){t[0];var e=t[1],r=t[2],i=Math.floor(Number(r));if(!isNaN(i)&&isFinite(i))return{workCode:e,panoIndex:i}}throw new Error("Invalid PanoId")}function panoEqual(n,t){return panoStringify(n)===panoStringify(t)}function isPanoId(n){return typeof n=="string"&&PANO_ID_REG.test(n)}var PBMGroup=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(THREE__namespace.Group),PBMMesh=function(n){__extends(t,n);function t(e,r){var i=n.call(this,e,r)||this;return i.onBeforeRender=onBeforeRender$1,i}return t}(THREE__namespace.Mesh);function onBeforeRender$1(n,t,e){for(var r=0,i=this.material;r<i.length;r++){var o=i[r];this.model&&o.syncModel(this.model),o.update(n,e)}}var gradientTexture=function(){return typeof document!="undefined"?new THREE__namespace.TextureLoader().load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAABCAYAAACouxZ2AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAAAAQAAAAB7UD0+AAACA0lEQVRIDXWUW3YjIQxEwdnV/GT/q8kO3FO3pAJst3PSAaR6Cbszf//9XeMxxpjXmI+pVXudp2s6PC4dqHff9e6D7/PZLy46xQvG+sZvrfK8xgXUeq85yINe9bdmtOK1+kun5vjgq58a+eZPna9jvmjiserqG/+Whathvo3L3WhV89L9sXI/m18z2uene9ap/ftsuT9WZxoHXzW56/fpj8l7+tTw7P011NdpqnY19sRsfuHMA9u8oZWfDz4+fra/dfG1V60ydZ7qba1g7UNAeK0JP7ydD7/OqH6wO2f7HTq+B/lbL9qsB3/N1/UzR81XfPzw4tp5OPvRneacteq8Xo0xR3vuv/kPz0KtX0Nhg0eHuaNXdWI3X/ld427h++vzyp99V6VPrzWFhbv4ayay4oFecm198MmUXN/mL+x7npq/uJXBGb/MTw4+t+SvbLoTZnUW5uHhz7nWcTxT73OwXV7cxT9wbBf/0LnDBgcnHmtPLYba32Hp808sMy1u88yhr58n70/v4xX92GSN19l/2UsqGmiH94Hpxjcs+DO/ccpIVNVp62PUWXu//ur1GQy1Cf+GZ13rtNYN1po3/NI79fGXibHkq4z25xvV2pW3szpneXsW8SsreTe/NIPrtXMnH7wPf+LEN6tqhUVHj3XKD/72p9eafCeYB3zuonnbv7yqP8d/o4K6gRb1wbYAAAAASUVORK5CYII="):new THREE__namespace.Texture}();gradientTexture.minFilter=THREE__namespace.NearestFilter,gradientTexture.magFilter=THREE__namespace.NearestFilter,gradientTexture.wrapS=THREE__namespace.RepeatWrapping,gradientTexture.wrapT=THREE__namespace.RepeatWrapping;var defaultPbmParameters={pano0:null,pano1:null,shownFloorIndex:-1,modelAlpha:1,opacity:1,progress:0,transition:"FADE",clippers:null,brightness:1,constantColor:null,useEDL:!1,useHQWeight:!1,useHQDepth:!1,pointColor:"RGB",pointSize:"ATTENUATION",pointBack:"DARK",pointShape:"SQUARE",pointScale:.03,pointMaxPixel:40,pointMinPixel:.5,gradientTexture};function isEqualClipperParameters(n,t){var e=n!=null?n:[],r=t!=null?t:[];if(r.length!==e.length)return!1;for(var i=0;i<r.length;i++)if(!e[i].clippingBoxMatrix.equals(r[i].clippingBoxMatrix)||e[i].floorIndex!==r[i].floorIndex)return!1;return!0}function isEqualPBMPanoPicture(n,t){return n&&t?n.luminanceMap===t.luminanceMap&&n.map===t.map&&n.zoom===t.zoom&&n.matrix.equals(t.matrix):!n&&!t}function updatePBMParameters(n,t){var e=!1;for(var r in t)switch(r){case"clippers":isEqualClipperParameters(n[r],t[r])||(n[r]=t[r],e=!0);break;case"pano0":case"pano1":isEqualPBMPanoPicture(n[r],t[r])||(n[r]=t[r],e=!0);break;default:n[r]!==t[r]&&(n[r]=t[r],e=!0);break}return e}var PBMPointCloud=function(n){__extends(t,n);function t(e,r){var i=n.call(this,e,r)||this;return i.onBeforeRender=onBeforeRender,i}return t}(THREE__namespace.Points);function onBeforeRender(n,t,e){this.model&&this.material.syncModel(this.model),this.material.update(n,e)}var scratchMaterialSet=new Set,PBMContainer=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.needsRender=!0,e.pbmMaterialParametersVersion=0,e.materialParameters=__assign({},defaultPbmParameters),e}return t.prototype.getMaterial=function(){return __assign({},this.materialParameters)},t.prototype.setMaterial=function(e){var r=this;Object.assign(this.materialParameters,e),scratchMaterialSet.clear(),this.traverse(function(i){if(i instanceof PBMMesh)for(var o=0,s=i.material;o<s.length;o++){var u=s[o];scratchMaterialSet.has(u)||(Object.assign(u,r.materialParameters),scratchMaterialSet.add(u))}i instanceof PBMPointCloud&&(scratchMaterialSet.has(i.material)||(Object.assign(i.material,r.materialParameters),scratchMaterialSet.add(i.material)))}),scratchMaterialSet.clear(),this.needsRender=!0},t}(THREE__namespace.Group),FACE_ORDER$1=["right","left","up","down","front","back"];function getBox(n,t,e,r){var i=new THREE__namespace.Box3;switch(n){case"up":i.min.y=.5,i.max.y=.5,i.min.x=+t-.5,i.max.x=+t-.5+r,i.min.z=-e+.5-r,i.max.z=-e+.5;break;case"down":i.min.y=-.5,i.max.y=-.5,i.min.x=+t-.5,i.max.x=+t-.5+r,i.min.z=+e-.5,i.max.z=+e-.5+r;break;case"left":i.min.x=-.5,i.max.x=-.5,i.min.z=-t+.5-r,i.max.z=-t+.5,i.min.y=-e+.5-r,i.max.y=-e+.5;break;case"right":i.min.x=.5,i.max.x=.5,i.min.z=+t-.5,i.max.z=+t-.5+r,i.min.y=-e+.5-r,i.max.y=-e+.5;break;case"front":i.min.z=-.5,i.max.z=-.5,i.min.x=+t-.5,i.max.x=+t-.5+r,i.min.y=-e+.5-r,i.max.y=-e+.5;break;case"back":i.min.z=.5,i.max.z=.5,i.min.x=-t+.5-r,i.max.x=-t+.5,i.min.y=-e+.5-r,i.max.y=-e+.5;break}return i.applyMatrix4(new THREE__namespace.Matrix4().makeRotationY(Math.PI))}var createChildren=function(n,t){if(!(n.level>=t))for(var e=n.level+1,r=n.size/2,i=[new THREE__namespace.Vector2(n.position.x,n.position.y),new THREE__namespace.Vector2(n.position.x+r,n.position.y),new THREE__namespace.Vector2(n.position.x,n.position.y+r),new THREE__namespace.Vector2(n.position.x+r,n.position.y+r)],o=0,s=i;o<s.length;o++){var u=s[o],c={face:n.face,level:e,size:r,position:u,box:getBox(n.face,u.x,u.y,r),children:[]};n.children.push(c),createChildren(c,t)}};function createTileCubeNode(n,t){var e={level:0,face:n,position:new THREE__namespace.Vector2(0,0),size:1,box:getBox(n,0,0,1),children:[]};return createChildren(e,t),e}function createTileCubeTree(n){var t=FACE_ORDER$1.map(function(e){return createTileCubeNode(e,n)});return{children:t}}function traverseTileCubeNode(n,t){for(var e=0,r=n.children;e<r.length;e++){var i=r[e],o=t(i);o!==!1&&traverseTileCubeNode(i,t)}}var CUBE_GEOMETRY=new THREE__namespace.BoxBufferGeometry(1,1,1,1,1);CUBE_GEOMETRY.deleteAttribute("uv"),CUBE_GEOMETRY.deleteAttribute("normal"),CUBE_GEOMETRY.groups=[],CUBE_GEOMETRY.scale(-1,1,1);var CUBE_VERTEX_SHADER=`
392
392
  varying vec3 worldPosition;
393
393
  void main() {
394
394
  vec4 transform = vec4(position, 1.0);
@@ -414,7 +414,7 @@ varying vec2 vUv;
414
414
  void main() {
415
415
  gl_FragColor = texture2D(map, vUv);
416
416
  }
417
- `,cacheMaterials=[],cameraPX=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPX.up.set(0,-1,0),cameraPX.lookAt(new THREE__namespace.Vector3(1,0,0)),cameraPX.updateMatrix(),cameraPX.matrixAutoUpdate=!1;var cameraNX=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNX.up.set(0,-1,0),cameraNX.lookAt(new THREE__namespace.Vector3(-1,0,0)),cameraNX.updateMatrix(),cameraNX.matrixAutoUpdate=!1;var cameraPY=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPY.up.set(0,0,1),cameraPY.lookAt(new THREE__namespace.Vector3(0,1,0)),cameraPY.updateMatrix(),cameraPY.matrixAutoUpdate=!1;var cameraNY=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNY.up.set(0,0,-1),cameraNY.lookAt(new THREE__namespace.Vector3(0,-1,0)),cameraNY.updateMatrix(),cameraNY.matrixAutoUpdate=!1;var cameraPZ=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPZ.up.set(0,-1,0),cameraPZ.lookAt(new THREE__namespace.Vector3(0,0,1)),cameraPZ.updateMatrix(),cameraPZ.matrixAutoUpdate=!1;var cameraNZ=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNZ.up.set(0,-1,0),cameraNZ.lookAt(new THREE__namespace.Vector3(0,0,-1)),cameraNZ.updateMatrix(),cameraNZ.matrixAutoUpdate=!1;var FACES={front:{camera:cameraPZ,index:4},back:{camera:cameraNZ,index:5},up:{camera:cameraPY,index:2},down:{camera:cameraNY,index:3},left:{camera:cameraNX,index:1},right:{camera:cameraPX,index:0}};function getMaterial(){var n=cacheMaterials.pop();return n||new THREE__namespace.ShaderMaterial({uniforms:{map:{value:null},flipY:{value:0}},vertexShader:PLANE_VERTEX_SHADER,fragmentShader:PLANE_FRAGMENT_SHADER,depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:THREE__namespace.NoBlending,lights:!1,toneMapped:!1,fog:!1})}function releaseMaterial(n){n.uniforms.map.value=null,cacheMaterials.push(n)}function renderTexturesToCubeRenderTarget(n,t,e){var r=new THREE__namespace.Scene;r.matrixAutoUpdate=!1;var i=new THREE__namespace.Group;i.scale.set(1,1,-1),r.add(i);for(var o=[],s=new Set,u=0,c=n;u<c.length;u++){var l=c[u];s.add(l.face);var d=getMaterial();o.push(d),d.uniforms.map.value=l.texture,d.uniforms.flipY.value=l.flipY?1:0;var f=new THREE__namespace.Group,m=new THREE__namespace.Mesh(PLAME_GEOMETRY,d);m.position.set(l.position.x+l.size.x/2-.5,1-(l.position.y+l.size.y/2)-.5,-.5),m.scale.set(l.size.x,l.size.y,1),f.quaternion.copy(QUATERNION[l.face]),f.add(m),i.add(f)}var A=e.autoClear,h=e.sortObjects,p=e.xr.enabled,y=t.texture.generateMipmaps;e.autoClear=!1,e.sortObjects=!1,e.xr.enabled=!1,t.texture.generateMipmaps=!1;var v=e.getRenderTarget(),g=0;s.forEach(function(T){++g===s.size&&(t.texture.generateMipmaps=y),e.setRenderTarget(t,FACES[T].index),e.render(r,FACES[T].camera)}),e.setRenderTarget(v),e.autoClear=A,e.sortObjects=h,e.xr.enabled=p;for(var E=0,b=o;E<b.length;E++){var d=b[E];releaseMaterial(d)}}var canUseNativeImageBitmap=function(){return!1}();function createImageBitmapLikeImage(n){n===void 0&&(n={});var t=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){n.onClose&&n.onClose.call(this),this.onerror=this.onload=this.close=noop$1,this.removeAttribute("src")}});return t}function createImageBitmapLike(n){return new Promise(function(t,e){var r=URL.createObjectURL(n),i=createImageBitmapLikeImage({onClose:function(){this.src===r&&URL.revokeObjectURL(r)}});i.onload=function(){i.src===r&&URL.revokeObjectURL(r),i.onload=i.onerror=noop$1,setTimeout(function(){t(i)},10)},i.onerror=function(){var o=i.src;i.onload=i.onerror=noop$1,i.close(),e(new Error("image load error: ".concat(o)))},i.decoding="async",i.src=r})}var canvasPool=[];function createCanvas(n,t){var e=canvasPool.shift();if(e)return e.width=n,e.height=t,e;var r=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),{close:function(){r.close=noop$1,canvasPool.push(r)}});return r}function poolImageToTexture(n,t){if(t&&(n.width>t.width||n.height>t.height)){var e=createCanvas(Math.min(n.width,t.width),Math.min(n.height,t.height)),r=e.getContext("2d");r.clearRect(0,0,e.width,e.height),r.drawImage(n,0,0,e.width,e.height),n.close();var i=new THREE__namespace.Texture(e);i.needsUpdate=!0,i.flipY=!0;var o=i.dispose;return i.dispose=function(){e.close(),o.call(i),i.dispose=o},i}else{var s=new THREE__namespace.Texture(n);s.needsUpdate=!0,typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?s.flipY=!1:s.flipY=!0;var u=s.dispose;return s.dispose=function(){n.close(),u.call(s),s.dispose=u},s}}function poolImagesToCubeTexture(n){var t=new THREE__namespace.CubeTexture(n);t.needsUpdate=!0,t.flipY=!1;var e=t.dispose;return t.dispose=function(){for(var r=0,i=n;r<i.length;r++){var o=i[r];o.close()}e.call(t),t.dispose=e},t}var FACE_ORDER=["right","left","up","down","front","back"],TileCubeTextureTarget=function(){function n(t,e,r,i,o){this.tileTree=e,this.tileSources=r,this.options=i,this.renderer=o,this.name="",this.needsRender=!1,this.maxRequest=n.DEFAULT_MAX_REQUEST,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.textures=[],this.baseCubeTexture=t}return Object.defineProperty(n.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(t){var e,r,i,o,s,u;if(t===null)throw new Error("cannot set cubeRenderTarget to null.");t.width!==this.options.textureSize&&t.setSize(this.options.textureSize,this.options.textureSize),t.texture.format=(e=this.options.format)!==null&&e!==void 0?e:THREE__namespace.RGBAFormat,t.texture.minFilter=(r=this.options.minFilter)!==null&&r!==void 0?r:THREE__namespace.LinearFilter,t.texture.magFilter=(i=this.options.magFilter)!==null&&i!==void 0?i:THREE__namespace.LinearFilter,t.texture.wrapS=(o=this.options.wrapS)!==null&&o!==void 0?o:THREE__namespace.ClampToEdgeWrapping,t.texture.wrapT=(s=this.options.wrapT)!==null&&s!==void 0?s:THREE__namespace.ClampToEdgeWrapping,t.texture.generateMipmaps=(u=this.options.generateMipmaps)!==null&&u!==void 0?u:!1,this.baseCubeTexture&&(renderCubeTextureToCubeRenderTarget(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&renderCubeTextureToCubeRenderTarget(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),n.prototype.requestTile=function(t){var e=this,r,i,o,s,u,c,l=this.tileSources.filter(function(p){return p.level===t.level})[0];if(!l){this.loadedCubeNodes.add(t);return}var d=l.size,f=Math.pow(2,t.level)*t.position.y,m=Math.pow(2,t.level)*t.position.x,A="".concat(((o=(i=(r=this.options.imageURL)===null||r===void 0?void 0:r.options)===null||i===void 0?void 0:i.key)!==null&&o!==void 0?o:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(f,".").concat(m),h=__assign(__assign({},(u=(s=this.options.imageURL)===null||s===void 0?void 0:s.options)!==null&&u!==void 0?u:{key:"unknown"}),{key:A,size:l.scale>=1?void 0:d*t.size*l.scale,quality:void 0,cut:[d*t.position.x,d*t.position.y,d*t.size,d*t.size]});this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(l[t.face],{imageURL:{transform:(c=this.options.imageURL)===null||c===void 0?void 0:c.transform,options:__assign({},h)},format:THREE__namespace.RGBAFormat,timeout:this.options.timeout,magFilter:this.options.magFilter,minFilter:this.options.minFilter,fetcher:this.options.fetcher}).then(function(p){if(e.disposed){p.body.dispose();return}e.textures.push({face:t.face,level:t.level,position:t.position,size:new THREE__namespace.Vector2(t.size,t.size),texture:p.body,flipY:!p.body.flipY}),e.loadedCubeNodes.add(t)}).catch(noop$1).then(function(){e.disposed||e.loadingCubeNodes.delete(t)})},n.prototype.update=function(t,e){var r=this;if(!this.disposed){var i=[];traverseTileCubeNode(this.tileTree,function(f){if(!(i.length>r.maxRequest-r.loadingCubeNodes.size)){if(r.loadingCubeNodes.has(f)||f.level>e||!t.intersectsBox(f.box))return!1;if(!r.loadedCubeNodes.has(f))return i.push(f),!1}});for(var o=0,s=i;o<s.length;o++){var u=s[o];this.requestTile(u)}if(this.cubeRenderTarget&&this.textures.length){renderTexturesToCubeRenderTarget(this.textures,this.cubeRenderTarget,this.renderer);for(var c=0,l=this.textures;c<l.length;c++){var d=l[c];d.texture.dispose()}this.textures.length=0,this.needsRender=!0}}},Object.defineProperty(n.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),n.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var t=0,e=this.textures;t<e.length;t++){var r=e[t];r.texture.dispose()}this.textures.length=0}},n.DEFAULT_MAX_REQUEST=3,n}(),TextureLoader=function(){function n(){}return n.prototype.loadTexture=function(t,e,r,i,o,s){var u,c,l,d,f,m,A;r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var h={};typeof e.flipY!="undefined"&&(h.flipY=e.flipY),typeof e.format!="undefined"&&(h.format=e.format),typeof e.encoding!="undefined"&&(h.encoding=e.encoding),h.generateMipmaps=(u=e.generateMipmaps)!==null&&u!==void 0?u:!1,h.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,h.magFilter=(l=e.magFilter)!==null&&l!==void 0?l:THREE__namespace.LinearFilter;var p=(f=(d=e.imageURL)===null||d===void 0?void 0:d.options)!==null&&f!==void 0?f:{key:"unknown"};t=applyImageURLOptions(t,(m=e.imageURL)===null||m===void 0?void 0:m.transform,p);var y=getProtocol(t),v=(A=e.viaAjax)!==null&&A!==void 0?A:canUseNativeImageBitmap,g=isJsonpSource(t),E=/^https?:/.test(y);if(g?v=!0:E||(v=!1),v){var b=null,T="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:T},void 0,void 0,o).then(function(_){return createImageBitmapLike(_.body)}).then(function(_){return poolImageToTexture(_,e.maxSize)}).then(function(_){return Object.assign(_,h),_}).then(function(_){var M={meta:b,body:_};return r(M),M}).catch(function(_){return i(_),Promise.reject(_)})}else{var x=null,R;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(_){return R=_,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,o,_)}).then(function(_){return x=_.meta,poolImageToTexture(_.body,e.maxSize)}).then(function(_){return Object.assign(_,h),_}).then(function(_){var M={meta:x,body:_};return r(M),M}).catch(function(_){return R&&R.close(),i(_),Promise.reject(_)})}},n.prototype.loadCubeTexture=function(t,e,r,i,o,s){var u,c,l,d,f,m,A;r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var h={};typeof e.format!="undefined"&&(h.format=e.format),h.generateMipmaps=(u=e.generateMipmaps)!==null&&u!==void 0?u:!1,h.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,h.magFilter=(l=e.magFilter)!==null&&l!==void 0?l:THREE__namespace.LinearFilter;for(var p=[t[FACE_ORDER[0]],t[FACE_ORDER[1]],t[FACE_ORDER[2]],t[FACE_ORDER[3]],t[FACE_ORDER[4]],t[FACE_ORDER[5]]],y=[],v=[0,0,0,0,0,0],g=[],E=function(T){var x=(f=(d=e.imageURL)===null||d===void 0?void 0:d.options)!==null&&f!==void 0?f:{key:"unknown"},R=applyImageURLOptions(p[T],(m=e.imageURL)===null||m===void 0?void 0:m.transform,__assign(__assign({},x),{key:x.key+"."+FACE_ORDER[T]})),_=getProtocol(R),M=function(O){v[T]=O,o(v.reduce(function(k,G){return k+G},0)/6)},S=(A=e.viaAjax)!==null&&A!==void 0?A:!1,I=/^https?:$/.test(_),C=isJsonpSource(R);if(C?S=!0:I||(S=!1),S){var H="blob",B=e.fetcher.ajax(R,{timeout:e.timeout,responseType:H},void 0,void 0,M).then(function(O){return g[T]=O.meta,createImageBitmapLike(O.body)});y.push(B)}else{var L,B=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(k){return L=k,e.fetcher.loadImage(R,{timeout:e.timeout},void 0,void 0,M,k)}).then(function(k){return g[T]=k.meta,k.body}).catch(function(k){return L&&L.close(),Promise.reject(k)});y.push(B)}},b=0;b<6;b++)E(b);return Promise.all(y).then(function(T){return poolImagesToCubeTexture(T)}).then(function(T){return Object.assign(T,__assign({encoding:THREE__namespace.sRGBEncoding},h)),T}).then(function(T){var x={body:T,meta:g};return r(x),x}).catch(function(T){for(var x=0,R=y;x<R.length;x++){var _=R[x];_.then(function(M){return M.close()}).catch(noop$1)}return i(T),Promise.reject(T)})},n.prototype.loadTiledCubeTexture=function(t,e,r,i,o,s,u){var c=this;return i===void 0&&(i=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1),new Promise(function(l,d){var f,m;c.loadCubeTexture(t,{imageURL:{transform:(f=r.imageURL)===null||f===void 0?void 0:f.transform,options:(m=r.imageURL)===null||m===void 0?void 0:m.options},format:THREE__namespace.RGBAFormat,viaAjax:r.viaAjax,timeout:r.timeout,fetcher:r.fetcher,magFilter:r.magFilter,minFilter:r.minFilter,generateMipmaps:r.generateMipmaps},function(A){var h,p=A.meta,y=A.body,v=(h=r.tileMaxLevel)!==null&&h!==void 0?h:2,g=Math.max(1024*v,512),E=createTileCubeTree(v),b=new TileCubeTextureTarget(y,E,e,{textureSize:g,textureLoader:c,imageURL:r.imageURL,magFilter:r.magFilter,minFilter:r.minFilter,generateMipmaps:r.generateMipmaps,timeout:r.timeout,fetcher:r.fetcher},u),T={meta:p,body:b};i(T),l(T)},function(A){o(A),d(A)},s,u).catch(noop$1)})},n}();const meshNoneVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("n\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07K|vq-znv{56-\n--0v{pyqr-Ixv{onrlrr\x07K--0v{pyqr-Iortv{lrr\x07K--0v{pyqr-Iz|}untrlrr\x07K--0v{pyqr-Ixv{{v{tlrr\x07K--0v{pyqr-I}|wrplrr\x07K--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K\f"),meshNoneFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H{vs|z-sy|n-}n{|>l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvsn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{H{vs|z-sy|n-u|{Sy||V{qr\x07H{vs|z-rp?-r|yv|{H{vs|z-sy|n-}v\x07ry_nv|H{vs|z-sy|n-|}npv\bH{vs|z-sy|n-ovtu{rH0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-Iqvurv{tl}nlsntzr{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-I}rpynzn}l}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{Krp@- ||zcrp|5rp@-qvrpv|{9-rp@-rp|9-sy|n- ||z6-\n--sy|n-urn-J-q|5qvrpv|{9-rp|6H--rp@-q-J-qvrpv|{-7-urnH--rp@-}-J-rp|-:-qH--rp@-\0-J-}-7- ||zH--r{-{|znyv r5q-8-\x006H\f|vq-znv{56-\n--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--tylSntP|y|-J-rpA5>;=9->;=9->;=9-|}npv\b6H--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-?;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J--qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--tylSntP|y|;n-J-|}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K\f"),meshBasicVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6--nvor-sy|n-sy||H0ryr--{vs|z-sy|n-sy||H0r{qvsn\bv{t-sy|n-Sy||H0vs-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nv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--V_||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----V_||sZnx-J-r}5no5znx-:->;=69-=;>6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Ir{zn}lrr\x07K--0v{pyqr-Is|tlrr\x07K\f"),meshBasicFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H{vs|z-sy|n-}n{|>l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvsp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvs0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|{qv{tZn\x07;\b-:-||sP]|tr-7-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6--6-\n----qvpnqH--\f--<<-JJJJJJJJJJJJJJ--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5Sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--rpA-qvssrP|y|-J-rpA5-qvssr9-|}npv\b-6H--0v{pyqr-Iy|tqr}uoslsntzr{K--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-6-6H--<<-nppzynv|{-5onxrq-v{qvrp-yvtuv{t-|{y\b6--0vsqrs-b`RlYVTUaZN]----rpA-yvtuZn}ar\x07ryJ-r\x07r?Q5-yvtuZn}9-b?-6H----rsyrprqYvtu;v{qvrpQvssr-8J-yvtuZn}ar\x07rya|Yv{rn5-yvtuZn}ar\x07ry-6;to-7-yvtuZn}V{r{v\bH--0ryr----rsyrprqYvtu;v{qvrpQvssr-8J-rp@5->;=-6H--0r{qvs--<<-z|qynv|{--0v{pyqr-In|zn}lsntzr{K--rsyrprqYvtu;v{qvrpQvssr-7J-qvssrP|y|;toH--rp@-|t|v{tYvtu-J-rsyrprqYvtu;v{qvrpQvssrH--0v{pyqr-Ir{zn}lsntzr{K--tylSntP|y|-J-rpA5-|t|v{tYvtu9-qvssrP|y|;n-6H--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-KJ-=;=-33-no5Sy||-:-u|{Sy||V{qr\x076-KJ->;=6-\n----sy||\\}npv\b-J-=;>-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJ--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-?;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J-qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--<<-JJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs\f"),meshPhongVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-]U\\[T0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6--nvor-sy|n-sy||H0ryr--{vs|z-sy|n-sy||H0r{qvsn\bv{t-sy|n-Sy||H0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs0vs-qrsv{rq5b`RlcR_aRelZN_X6--nvor-sy|n-znxH0r{qvsn\bv{t-sy|n-V_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-cvr]|vv|{H0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrr\x07K0v{pyqr-I?l}nlrr\x07K0v{pyqr-Iqv}ynprzr{zn}l}nlrr\x07K0v{pyqr-Ir{zn}l}nlrr\x07K0v{pyqr-Ip|y|l}nlrr\x07K0v{pyqr-Is|tl}nlrr\x07K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K0v{pyqr-Iunq|zn}l}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07K|vq-znv{56-\n--0v{pyqr-Ilrr\x07K--0v{pyqr-I?lrr\x07K--0v{pyqr-Ip|y|lrr\x07K--0v{pyqr-Iortv{{|znylrr\x07K--0v{pyqr-Iz|}u{|znylrr\x07K--0v{pyqr-Ixv{onrlrr\x07K--0v{pyqr-Ixv{{|znylrr\x07K--0v{pyqr-Iqrsny{|znylrr\x07K0vs{qrs-SYNal`UNQRQ-<<-[|zny-p|z}rq-vu-qrvnvr-ur{-SYNal`UNQRQ--[|zny-J-{|znyv r5-n{s|zrq[|zny-6H0r{qvs--0v{pyqr-Iortv{lrr\x07K--0v{pyqr-Iz|}untrlrr\x07K--0v{pyqr-Ixv{{v{tlrr\x07K--0v{pyqr-Iqv}ynprzr{zn}lrr\x07K--0v{pyqr-I}|wrplrr\x07K--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--cvr]|vv|{-J-:-z]|vv|{;\x07\b H--Sy||-J-sy||H--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--V_||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----V_||sZnx-J-r}5no5znx-:->;=69-=;>6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Ir{zn}lrr\x07K--0v{pyqr-Iunq|zn}lrr\x07K--0v{pyqr-Is|tlrr\x07K\f"),meshPhongFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+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Izn}l}nlsntzr{K0v{pyqr-Iny}unzn}l}nlsntzr{K0v{pyqr-In|zn}l}nlsntzr{K0v{pyqr-Iyvtuzn}l}nlsntzr{K0v{pyqr-Irzvvrzn}l}nlsntzr{K0v{pyqr-Ir{zn}lp|zz|{l}nlsntzr{K0v{pyqr-Ir{zn}l}nlsntzr{K0v{pyqr-Iporllrsyrpv|{lsntzr{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-IoqsK0v{pyqr-Iyvtul}nlortv{K0v{pyqr-Iyvtul}u|{tl}nlsntzr{K0v{pyqr-Iunq|zn}l}nlsntzr{K0v{pyqr-Ioz}zn}l}nlsntzr{K0v{pyqr-I{|znyzn}l}nlsntzr{K0v{pyqr-I}rpynzn}l}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{Krp@- ||zcrp|5rp@-qvrpv|{9-rp@-rp|9-sy|n- ||z6-\n--sy|n-urn-J-q|5qvrpv|{9-rp|6H--rp@-q-J-qvrpv|{-7-urnH--rp@-}-J-rp|-:-qH--rp@-\0-J-}-7- ||zH--r{-{|znyv r5q-8-\x006H\f|vq-znv{56-\n--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----V_||sZnx-K-=;B-33----d|yq]|vv|{;\b-K-z|qryO|{qv{tZn\x07;\b-:-||sP]|tr-7-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6--6-\n----qvpnqH--\f--<<-JJJJJJJJJJJJJJ--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5Sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--rpA-qvssrP|y|-J-rpA5-qvssr9-|}npv\b-6H--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-6-6H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Iy|tqr}uoslsntzr{K--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--<<-nppzynv|{--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--<<-z|qynv|{--0v{pyqr-In|zn}lsntzr{K--rp@-|t|v{tYvtu-J-rsyrprqYvtu;qvrpQvssr-8-rsyrprqYvtu;v{qvrpQvssr-8-rsyrprqYvtu;qvrp`}rpyn-8-rsyrprqYvtu;v{qvrp`}rpyn-8-|nyRzvvr_nqvn{prH--0v{pyqr-Ir{zn}lsntzr{K--tylSntP|y|-J-rpA5-|t|v{tYvtu9-qvssrP|y|;n-6H--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-KJ-=;=-33-no5Sy||-:-u|{Sy||V{qr\x076-KJ->;=6-\n----sy||\\}npv\b-J-=;>-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJ--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-?;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J-qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--<<-JJJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs\f");function coordinatesToVector(n,t){var e=Math.abs(Math.cos(n.latitude)),r=-Math.sin(n.longitude)*e,i=-Math.sin(n.latitude),o=-Math.cos(n.longitude)*e;return t?t.set(r,i,o):new THREE__namespace.Vector3(r,i,o)}var DEFAULT_ASPECT=1,DEFAULT_NEAR=.1,DEFAULT_FAR=2e3,TAU$2=Math.PI*2,PI_2=Math.PI/2;function formatRad$1(n){return n>0&&n<=TAU$2?n:(n%TAU$2+TAU$2)%TAU$2}function matrixLerp(n,t,e,r){e=Math.pow(e,4);for(var i=0;i<16;i++)r.elements[i]=n.elements[i]+(t.elements[i]-n.elements[i])*e;return r}var Camera=function(n){__extends(t,n);function t(e,r,i,o,s,u,c){r===void 0&&(r=DEFAULT_ASPECT),i===void 0&&(i=DEFAULT_NEAR),o===void 0&&(o=DEFAULT_FAR),s===void 0&&(s=new THREE__namespace.Vector2),u===void 0&&(u=new THREE__namespace.Vector2(512,512)),c===void 0&&(c=1);var l=n.call(this)||this;l.fov=e,l.aspect=r,l.near=i,l.far=o,l.perspToOrtho=s,l.resolution=u,l.pixelRatio=c,l.needsRender=!0,l.refineModel=!0,l.pose={longitude:0,latitude:0,fov:e,distance:0,offset:new THREE__namespace.Vector3},l.computePose(),l.perspectiveCamera=new THREE__namespace.PerspectiveCamera(l.fov,l.aspect,.001,l.far);var d=Math.max(l.orthoDistance,.01)*Math.tan(.5*l.fov/180*Math.PI),f=-.5*l.aspect*2*d;return l.orthographicCamera=new THREE__namespace.OrthographicCamera(f,-f,d,-d,.001,l.far),l.computeProjectionMatrix(),l.lastValues={position:l.position.clone(),quaternion:l.quaternion.clone(),scale:l.scale.clone(),fov:l.fov,aspect:l.aspect,near:l.near,far:l.far,orthoDistance:l.orthoDistance,perspToOrtho:l.perspToOrtho.clone()},l.type=l.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera",l}return Object.defineProperty(t.prototype,"orthoDistance",{get:function(){return this.pose.distance>1?this.pose.distance:1+(this.pose.distance-1)*this.perspToOrtho.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.zoom:this.type==="PerspectiveCamera"?this.perspectiveCamera.zoom:1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.top:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.bottom:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.left:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.right:0},enumerable:!1,configurable:!0}),t.prototype.getDirection=function(e){return coordinatesToVector(this.pose,e)},t.prototype.computePose=function(e){e===void 0&&(e=0),this.updateMatrix();var r=this.matrix.elements,i=new THREE__namespace.Vector3().set(-r[8],-r[9],-r[10]).normalize();this.pose.longitude=formatRad$1(-Math.atan2(i.x,-i.z)),this.pose.latitude=-Math.asin(i.y/1),this.pose.fov=this.fov,this.pose.distance=e;var o=new THREE__namespace.Vector3().add(this.position).add(i.clone().setLength(this.pose.distance));return this.pose.offset.copy(o),this},t.prototype.setFromPose=function(e){var r,i,o,s,u,c=formatRad$1((r=e.longitude)!==null&&r!==void 0?r:this.pose.longitude),l=Math.max(-PI_2+1e-4,Math.min(PI_2-1e-4,(i=e.latitude)!==null&&i!==void 0?i:this.pose.latitude)),d=(o=e.fov)!==null&&o!==void 0?o:this.pose.fov,f=(s=e.distance)!==null&&s!==void 0?s:this.pose.distance,m=(u=e.offset)!==null&&u!==void 0?u:this.pose.offset,A=coordinatesToVector({longitude:c,latitude:l}).normalize();return this.position.set(0,0,0),this.lookAt(A),this.position.add(m).sub(A.clone().setLength(f)),this.fov!==d&&(this.fov=d,this.updateProjectionMatrix()),this.updateMatrixWorld(),this.pose.longitude=c,this.pose.latitude=l,this.pose.fov=d,this.pose.distance=f,this.pose.offset.copy(m),this.needsRender=!0,this},t.prototype.copyPose=function(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}},t.prototype.computeProjectionMatrix=function(){matrixLerp(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},t.prototype.setViewOffset=function(e,r,i,o,s,u){this.perspectiveCamera.setViewOffset(e,r,i,o,s,u),this.orthographicCamera.setViewOffset(e,r,i,o,s,u),this.computeProjectionMatrix()},t.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},t.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(t.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),t.prototype.updateTime=function(e,r){var i=!1;if((this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.aspect!==this.aspect)&&(this.perspectiveCamera.fov=this.fov,this.perspectiveCamera.near=this.near,this.perspectiveCamera.far=this.far,this.perspectiveCamera.aspect=this.aspect,this.perspectiveCamera.updateProjectionMatrix(),i=!0),!this.lastValues.position.equals(this.position)||!this.lastValues.quaternion.equals(this.quaternion)||!this.lastValues.scale.equals(this.scale)||!this.lastValues.perspToOrtho.equals(this.perspToOrtho)||this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.orthoDistance!==this.orthoDistance||this.lastValues.aspect!==this.aspect){var o=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),s=-.5*this.aspect*2*o;this.orthographicCamera.left=s,this.orthographicCamera.right=-s,this.orthographicCamera.top=o,this.orthographicCamera.bottom=-o,this.orthographicCamera.near=this.near,this.orthographicCamera.far=this.far,this.orthographicCamera.updateProjectionMatrix(),i=!0}i&&this.computeProjectionMatrix(),this.lastValues.position.copy(this.position),this.lastValues.quaternion.copy(this.quaternion),this.lastValues.scale.copy(this.scale),this.lastValues.fov=this.fov,this.lastValues.aspect=this.aspect,this.lastValues.near=this.near,this.lastValues.far=this.far,this.lastValues.orthoDistance=this.orthoDistance,this.lastValues.perspToOrtho.copy(this.perspToOrtho),this.type=this.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera"},Object.defineProperty(t.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e,r){return n.prototype.copy.call(this,e,r),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.perspToOrtho.copy(e.perspToOrtho),this.updateTime(now(),0),this},t}(THREE__namespace.Camera),scratchVector4$1=new THREE__namespace.Vector4,pbmUniforms={modelAlpha:new THREE__namespace.Uniform(0),progress:new THREE__namespace.Uniform(0),pano0_map:new THREE__namespace.Uniform(null),pano0_luminanceMap:new THREE__namespace.Uniform(null),pano0_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano0_zoom:new THREE__namespace.Uniform(1),pano1_map:new THREE__namespace.Uniform(null),pano1_luminanceMap:new THREE__namespace.Uniform(null),pano1_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano1_zoom:new THREE__namespace.Uniform(1),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(null),geometricError:new THREE__namespace.Uniform(0),pixelRatio:new THREE__namespace.Uniform(1),resolution:new THREE__namespace.Uniform(new THREE__namespace.Vector2(512,512)),floor:new THREE__namespace.Uniform(0),brightness:new THREE__namespace.Uniform(1),modelBoundingMin:new THREE__namespace.Uniform(new THREE__namespace.Vector3),modelBoundingMax:new THREE__namespace.Uniform(new THREE__namespace.Vector3)},shaderLib={none:{vertexShader:meshNoneVertexShader,fragmentShader:meshNoneFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms,{opacity:{value:1}},THREE__namespace.UniformsLib.fog]),lights:!1},basic:{vertexShader:meshBasicVertexShader,fragmentShader:meshBasicFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms,THREE__namespace.ShaderLib.basic.uniforms]),lights:!1},phong:{vertexShader:meshPhongVertexShader,fragmentShader:meshPhongFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms,THREE__namespace.ShaderLib.phong.uniforms]),lights:!0}},PBMMeshMaterial=function(n){__extends(t,n);function t(e,r){e===void 0&&(e="basic"),r===void 0&&(r={});var i=this,o,s,u,c,l,d,f,m,A,h,p,y,v,g,E,b,T,x,R,_,M,S=shaderLib[e];i=n.call(this,{vertexShader:S.vertexShader,fragmentShader:S.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(S.uniforms),lights:S.lights,defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_FLOOR:!1,USE_VERTEX_MARK:!1,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_SPREAD_TRANSITION:!1,USE_POINT_NORMAL:!1,USE_POINT_CIRCLE:!1,USE_POINT_ADAPTIVE_SIZE:!1,USE_POINT_COLOR_ALTITUDE:!1}})||this,i.shaderType=e,i.color=new THREE__namespace.Color(16777215),i.map=null,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=null,i.aoMapIntensity=1,i.specularMap=null,i.specular=new THREE__namespace.Color(1118481),i.alphaMap=null,i.envMap=null,i.reflectivity=1,i.refractionRatio=.98,i.emissiveMap=null,i.emissive=new THREE__namespace.Color(0),i.emissiveIntensity=1,i.bumpMap=null,i.bumpScale=1,i.normalMap=null,i.normalMapType=THREE__namespace.TangentSpaceNormalMap,i.normalScale=new THREE__namespace.Vector2(1,1),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.shininess=30;var I,C=null,H=null;return Object.defineProperties(i,{pano0:{get:function(){return C},set:function(B){if(C!==B){C=B,B===null?(this.uniforms.pano0_map.value=null,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity(),this.uniforms.pano0_zoom.value=1):(this.uniforms.pano0_map.value=B.map instanceof TileCubeTextureTarget?B.map.texture:B.map,this.uniforms.pano0_luminanceMap.value=B.luminanceMap instanceof TileCubeTextureTarget?B.luminanceMap.texture:B.luminanceMap,this.uniforms.pano0_matrix.value.copy(B.matrix),this.uniforms.pano0_zoom.value=B.zoom);var L=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,O=this.defines.USE_LUMINANCE;O!==L&&(this.defines.USE_LUMINANCE=L,this.needsUpdate=!0)}}},pano1:{get:function(){return H},set:function(B){if(H!==B){H=B,B===null?(this.uniforms.pano1_map.value=null,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity(),this.uniforms.pano1_zoom.value=1):(this.uniforms.pano1_map.value=B.map instanceof TileCubeTextureTarget?B.map.texture:B.map,this.uniforms.pano1_luminanceMap.value=B.luminanceMap instanceof TileCubeTextureTarget?B.luminanceMap.texture:B.luminanceMap,this.uniforms.pano1_matrix.value.copy(B.matrix),this.uniforms.pano1_zoom.value=B.zoom);var L=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,O=this.defines.USE_LUMINANCE;O!==L&&(this.defines.USE_LUMINANCE=L,this.needsUpdate=!0)}}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(B){this.uniforms.modelAlpha.value=B}},progress:{get:function(){return this.uniforms.progress.value},set:function(B){this.uniforms.progress.value=B}},transition:{get:function(){return this.defines.USE_BLACK_TRANSITION?"BLACK":this.defines.USE_SPREAD_TRANSITION?"SPREAD":"FADE"},set:function(B){var L=this.defines.USE_BLACK_TRANSITION,O=this.defines.USE_SPREAD_TRANSITION;this.defines.USE_BLACK_TRANSITION=!1,this.defines.USE_SPREAD_TRANSITION=!1,this.defines["USE_".concat(B,"_TRANSITION")]=!0;var k=!1;L!==this.defines.USE_BLACK_TRANSITION&&(k=!0),O!==this.defines.USE_SPREAD_TRANSITION&&(k=!0),k&&(this.needsUpdate=!0)}},constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(B){this.uniforms.constantColor.value=B;var L=this.defines.USE_CONSTANT_COLOR,O=B!==null;L!==O&&(this.defines.USE_CONSTANT_COLOR=O,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(B){this.uniforms.opacity.value=B}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(B){this.uniforms.shownFloorIndex.value=B}},brightness:{get:function(){return this.uniforms.brightness.value},set:function(B){this.uniforms.brightness.value=B}},clippers:{get:function(){return I},set:function(B){I!==B&&(I=B,this.uniforms.clippers.value=(I||[]).map(function(L){var O=typeof L.floorIndex=="number"?L.floorIndex:-1,k=new THREE__namespace.Matrix4().getInverse(L.clippingBoxMatrix);return{matrixInverse:k,floorIndex:O}}),this.needsUpdate=!0)}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(B){B!==this.defines.USE_EDL&&(this.defines.USE_EDL=B,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(B){B!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=B,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(B){B!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=B,this.needsUpdate=!0)}},floor:{get:function(){return this.uniforms.floor.value},set:function(B){this.uniforms.floor.value=B}}}),i.pano0=(o=r.pano0)!==null&&o!==void 0?o:defaultPbmParameters.pano0,i.pano1=(s=r.pano1)!==null&&s!==void 0?s:defaultPbmParameters.pano1,i.modelAlpha=(u=r.modelAlpha)!==null&&u!==void 0?u:defaultPbmParameters.modelAlpha,i.progress=(c=r.progress)!==null&&c!==void 0?c:defaultPbmParameters.progress,i.transition=(l=r.transition)!==null&&l!==void 0?l:defaultPbmParameters.transition,i.constantColor=(d=r.constantColor)!==null&&d!==void 0?d:defaultPbmParameters.constantColor,i.opacity=(f=r.opacity)!==null&&f!==void 0?f:defaultPbmParameters.opacity,i.shownFloorIndex=(m=r.shownFloorIndex)!==null&&m!==void 0?m:defaultPbmParameters.shownFloorIndex,i.clippers=(A=r.clippers)!==null&&A!==void 0?A:defaultPbmParameters.clippers,i.useEDL=(h=r.useEDL)!==null&&h!==void 0?h:defaultPbmParameters.useEDL,i.useHQWeight=(p=r.useHQWeight)!==null&&p!==void 0?p:defaultPbmParameters.useHQWeight,i.useHQDepth=(y=r.useHQDepth)!==null&&y!==void 0?y:defaultPbmParameters.useHQDepth,i.pointSize=(v=r.pointSize)!==null&&v!==void 0?v:defaultPbmParameters.pointSize,i.pointColor=(g=r.pointColor)!==null&&g!==void 0?g:defaultPbmParameters.pointColor,i.pointShape=(E=r.pointShape)!==null&&E!==void 0?E:defaultPbmParameters.pointShape,i.pointScale=(b=r.pointScale)!==null&&b!==void 0?b:defaultPbmParameters.pointScale,i.pointBack=(T=r.pointBack)!==null&&T!==void 0?T:defaultPbmParameters.pointBack,i.pointMinPixel=(x=r.pointMinPixel)!==null&&x!==void 0?x:defaultPbmParameters.pointMinPixel,i.pointMaxPixel=(R=r.pointMaxPixel)!==null&&R!==void 0?R:defaultPbmParameters.pointMaxPixel,i.gradientTexture=(_=r.gradientTexture)!==null&&_!==void 0?_:defaultPbmParameters.gradientTexture,i.brightness=(M=r.brightness)!==null&&M!==void 0?M:defaultPbmParameters.brightness,i.floor=0,i}return t.prototype.onBeforeCompile=function(e,r){var i,o,s=String((o=(i=this.clippers)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,s),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,s)},t.prototype.refreshUniforms=function(e){var r,i,o=this.uniforms;o.diffuse&&o.diffuse.value.copy(this.color),o.opacity&&(o.opacity.value=this.opacity),o.color&&o.diffuse.value.copy(this.color),o.emissive&&o.emissive.value.copy(this.emissive).multiplyScalar(this.emissiveIntensity),o.map&&(o.map.value=this.map),o.alphaMap&&(o.alphaMap.value=this.alphaMap),o.specularMap&&(o.specularMap.value=this.specularMap),o.envMap&&(o.envMap.value=this.envMap,o.flipEnvMap.value=!((r=this.envMap)===null||r===void 0)&&r.isCubeTexture?-1:1,o.reflectivity.value=this.reflectivity,o.refractionRatio.value=this.refractionRatio,o.maxMipLevel.value=this.envMap&&(i=e.properties.get(this.envMap).__maxMipLevel)!==null&&i!==void 0?i:0),o.lightMap&&(o.lightMap.value=this.lightMap,o.lightMapIntensity.value=this.lightMapIntensity),o.aoMap&&(o.aoMap.value=this.aoMap,o.aoMapIntensity.value=this.aoMapIntensity),o.specular&&o.specular.value.copy(this.specular),o.shininess&&(o.shininess.value=Math.max(this.shininess,1e-4)),o.emissiveMap&&(o.emissiveMap.value=this.emissiveMap),o.bumpMap&&(o.bumpMap.value=this.bumpMap,o.bumpScale.value=this.bumpScale,this.side===THREE__namespace.BackSide&&(o.bumpScale.value*=-1)),o.normalMap&&(o.normalMap.value=this.normalMap,o.normalScale.value.copy(this.normalScale),this.side===THREE__namespace.BackSide&&o.normalScale.value.negate()),o.displacementMap&&(o.displacementMap.value=this.displacementMap,o.displacementScale.value=this.displacementScale,o.displacementBias.value=this.displacementBias);var s;this.map?s=this.map:this.specularMap?s=this.specularMap:this.displacementMap?s=this.displacementMap:this.normalMap?s=this.normalMap:this.bumpMap?s=this.bumpMap:this.alphaMap?s=this.alphaMap:this.emissiveMap&&(s=this.emissiveMap),s!==void 0&&(s.matrixAutoUpdate===!0&&s.updateMatrix(),o.uvTransform.value.copy(s.matrix));var u;this.aoMap?u=this.aoMap:this.lightMap&&(u=this.lightMap),u!==void 0&&(u.matrixAutoUpdate===!0&&u.updateMatrix(),o.uv2Transform.value.copy(u.matrix))},t.prototype.update=function(e,r){if(this.refreshUniforms(e),this.transparent=!1,this.shownFloorIndex>-1&&(this.defines.USE_VERTEX_FLOOR?this.transparent=!0:this.transparent=this.shownFloorIndex!==this.floor),this.opacity<1&&(this.transparent=!0),this.alphaMap&&(this.transparent=!0),this.brightness<1&&(this.transparent=!0),this.blending=this.transparent?THREE__namespace.NormalBlending:THREE__namespace.NoBlending,r instanceof Camera)this.uniforms.pixelRatio.value=r.pixelRatio,this.uniforms.resolution.value.copy(r.resolution);else{this.uniforms.pixelRatio.value=e.getPixelRatio();var i=e.getViewport(scratchVector4$1);this.uniforms.resolution.value.set(i.z,i.w)}},t.prototype.syncModel=function(e){var r="".concat(e.id,":").concat(e.materialVersion);r!==this.syncModelVersion&&(Object.assign(this,e.getMaterial()),this.uniforms.modelBoundingMax.value.copy(e.bounding.max),this.uniforms.modelBoundingMin.value.copy(e.bounding.min),this.syncModelVersion=r)},t.prototype.copy=function(e){return n.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.specular.copy(e.specular),this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.emissiveMap=e.emissiveMap,this.emissive.copy(e.emissive),this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.shininess=e.shininess,this.pano0=e.pano0,this.pano1=e.pano1,this.modelAlpha=e.modelAlpha,this.progress=e.progress,this.transition=e.transition,this.opacity=e.opacity,this.constantColor=e.constantColor,this.shownFloorIndex=e.shownFloorIndex,this.brightness=e.brightness,this.clippers=e.clippers,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.pointColor=e.pointColor,this.pointSize=e.pointSize,this.pointShape=e.pointShape,this.pointScale=e.pointScale,this.pointBack=e.pointBack,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.gradientTexture=e.gradientTexture,this.floor=e.floor,this},t}(THREE__namespace.ShaderMaterial),InternalWebGLRenderer=function(n){__extends(t,n);function t(e){var r=e.preserveDrawingBuffer,i=r===void 0?!0:r,o=e.premultipliedAlpha,s=o===void 0?!0:o,u=e.stencil,c=u===void 0?!0:u,l=e.backgroundColor,d=l===void 0?1579548:l,f=e.backgroundAlpha,m=f===void 0?1:f,A=e.pixelRatio,h=A===void 0?1:A,p=e.antialias,y=e.webgl2,v=e.logarithmicDepthBuffer,g=e.precision,E=this,b={antialias:p,alpha:!0,depth:!0,preserveDrawingBuffer:i,stencil:c,premultipliedAlpha:s,powerPreference:"high-performance"},T={logarithmicDepthBuffer:v,precision:g};if(y){var x=document.createElement("canvas"),R=x.getContext("webgl2",b);R?E=n.call(this,__assign(__assign(__assign({},b),T),{antialias:!0,canvas:x,context:R}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),E=n.call(this,__assign(__assign({},b),T))||this)}else E=n.call(this,__assign(__assign({},b),T))||this;return E.setPixelRatio(h),E.setClearColor(d,m),E.outputEncoding=THREE__namespace.sRGBEncoding,E.autoClear=!0,E}return t}(THREE__namespace.WebGLRenderer),Scene=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.add=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.add.apply(this,e)},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.remove.apply(this,e)},t}(THREE__namespace.Scene),VolumePlaneIntersect;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(VolumePlaneIntersect||(VolumePlaneIntersect={}));var EPSILON$2=1e-6,scratchVector=new THREE__namespace.Vector3,scratchMatrix4$4=new THREE__namespace.Matrix4,scratchXAxis=new THREE__namespace.Vector3,scratchYAxis=new THREE__namespace.Vector3,scratchZAxis=new THREE__namespace.Vector3,scratchSize=new THREE__namespace.Vector3,scratchBox3=new THREE__namespace.Box3,scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4Inverse$1=new THREE__namespace.Matrix4,scratchRay$1=new THREE__namespace.Ray,scratchObject3D=new THREE__namespace.Object3D,scratchFrustum=new THREE__namespace.Frustum;function quaternionFromMatrix3(n,t){var e=n.elements;return t.setFromRotationMatrix(scratchMatrix4$4.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1)),t}var CullingVolume=function(){function n(t){t===void 0&&(t=[]),this.planes=t}return Object.defineProperty(n,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),n.prototype.setFromFrustum=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.setFromCamera=function(t){return scratchMatrix4$4.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$4),this.setFromFrustum(scratchFrustum),this},n.prototype.applyMatrix4=function(t){for(var e=0,r=this.planes;e<r.length;e++){var i=r[e];i.applyMatrix4(t)}},n.prototype.copy=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.computeVisibility=function(t){for(var e=VolumePlaneIntersect.Inside,r=0,i=this.planes;r<i.length;r++){var o=i[r],s=t.intersectPlane(o);switch(s){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:e=VolumePlaneIntersect.Intersecting;break}}return e},n.prototype.computeVisibilityWithPlaneMask=function(t,e){if(e===n.MASK_OUTSIDE||e===n.MASK_INSIDE)return e;for(var r=n.MASK_INSIDE,i=Math.min(32,this.planes.length),o=0;o<i;++o){var s=1<<o;if(e&s){var u=this.planes[o],c=t.intersectPlane(u);if(c===VolumePlaneIntersect.Outside)return n.MASK_OUTSIDE;c===VolumePlaneIntersect.Intersecting&&(r|=s)}}return r},n}(),BoxBoundingVolume=function(){function n(){this.type="box",this.center=new THREE__namespace.Vector3,this.halfSize=new THREE__namespace.Vector3,this.rotation=new THREE__namespace.Matrix3}return n.prototype.fromJson=function(t){var e=t.box;this.center.set(e[0],e[1],e[2]);var r=e[3],i=e[4],o=e[5],s=e[6],u=e[7],c=e[8],l=e[9],d=e[10],f=e[11],m=Math.sqrt(r*r+i*i+o*o),A=Math.sqrt(s*s+u*u+c*c),h=Math.sqrt(l*l+d*d+f*f);this.halfSize.set(m,A,h);var p=this.halfSize.toArray().reduce(function(y,v){return y+v},0);return(isNaN(p)||p<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/m,i/m,o/m,s/A,u/A,c/A,l/h,d/h,f/h]),isNaN(this.rotation.toArray().reduce(function(y,v){return y+v},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:__spreadArray(__spreadArray(__spreadArray(__spreadArray([],this.center.toArray(),!0),scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),!0),scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),!0),scratchZAxis.multiplyScalar(this.halfSize.z).toArray(),!0)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.applyMatrix4=function(t){return scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(t),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$4.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.scale),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.rotation.elements,r=t.x-this.center.x,i=t.y-this.center.y,o=t.z-this.center.z,s=0,u;return u=r*e[0]+i*e[1]+o*e[2],u<0&&(u=-u),u-=this.halfSize.x,u>0&&(s+=u*u),u=r*e[3]+i*e[4]+o*e[5],u<0&&(u=-u),u-=this.halfSize.y,u>0&&(s+=u*u),u=r*e[6]+i*e[7]+o*e[8],u<0&&(u=-u),u-=this.halfSize.z,u>0&&(s+=u*u),s},n.prototype.distanceToPoint=function(t){return Math.sqrt(this.distanceSquaredToPoint(t))},n.prototype.distanceToPlane=function(t){var e=t.projectPoint(this.center,new THREE__namespace.Vector3);return this.distanceToPoint(e)},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),t.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),t},n.prototype.toGeometry=function(){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),e=new Float32Array(8*3);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new THREE__namespace.BufferGeometry;return r.setIndex(new THREE__namespace.BufferAttribute(t,1)),r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,i=this.rotation.elements,o=this.halfSize,s=r.x,u=r.y,c=r.z,l=Math.abs(s*i[0]*o.x+u*i[1]*o.x+c*i[2]*o.x)+Math.abs(s*i[3]*o.y+u*i[4]*o.y+c*i[5]*o.y)+Math.abs(s*i[6]*o.z+u*i[7]*o.z+c*i[8]*o.z),d=r.dot(e)+t.constant;return d<=-l?VolumePlaneIntersect.Outside:d>=l?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting},n.prototype.intersectRay=function(t,e){if(scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$4.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$4.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$4),scratchRay$1.copy(t).applyMatrix4(scratchMatrix4Inverse$1),scratchBox3.containsPoint(scratchRay$1.origin))return!0;var r=scratchRay$1.intersectBox(scratchBox3,scratchVector);return r?e!==void 0?r.applyMatrix4(scratchMatrix4$4).distanceTo(t.origin)<e:!0:!1},n}(),SphereBoundingVolume=function(){function n(){this.type="sphere",this.center=new THREE__namespace.Vector3,this.radius=-1}return n.prototype.fromJson=function(t){var e=t.sphere;return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],EPSILON$2),this},n.prototype.toJson=function(){return{sphere:__spreadArray(__spreadArray([],this.center.toArray(),!0),[this.radius],!1)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){return t.setFromCenterAndSize(this.center,scratchSize.set(1,1,1).multiplyScalar(this.radius*2)),t},n.prototype.toGeometry=function(){for(var t=32,e=new Float32Array(t*3*2*2),r=0;r<=t;r++){var i=0;i=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(i)*this.radius,e[r*6+1]=this.center.y+Math.sin(i)*this.radius,e[r*6+2]=this.center.z+0,i=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(i)*this.radius,e[r*6+4]=this.center.y+Math.sin(i)*this.radius,e[r*6+5]=this.center.z+0}for(var r=t;r<=t*2;r++){var i=0;i=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(i)*this.radius,e[r*6+1]=this.center.y+0,e[r*6+2]=this.center.z+Math.sin(i)*this.radius,i=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(i)*this.radius,e[r*6+4]=this.center.y+0,e[r*6+5]=this.center.z+Math.sin(i)*this.radius}var o=new THREE__namespace.BufferGeometry;return o.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o},n.prototype.applyMatrix4=function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.distanceToPoint(t);return e*e},n.prototype.distanceToPoint=function(t){var e=this.center.distanceTo(t)-this.radius;return e<=0?0:e},n.prototype.distanceToPlane=function(t){var e=Math.abs(t.distanceToPoint(this.center));return Math.max(0,e-this.radius)},n.prototype.intersectPlane=function(t){var e=this.center,r=this.radius,i=t.normal,o=i.dot(e)+t.constant;return o<-r?VolumePlaneIntersect.Outside:o<r?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside},n.prototype.intersectRay=function(t,e){if(scratchSphere$1.set(this.center,this.radius),scratchSphere$1.containsPoint(t.origin))return!0;var r=t.intersectSphere(scratchSphere$1,scratchVector);return r?e!==void 0?t.origin.distanceTo(r)<e:!0:!1},n}(),RegionBoundingVolume=function(){function n(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return n.prototype.fromJson=function(t){var e=t.region;return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this},n.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},n.prototype.copy=function(t){return this.west=t.west,this.south=t.south,this.east=t.east,this.north=t.north,this.minHeight=t.minHeight,this.maxHeight=t.maxHeight,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){throw new Error("not implemented")},n.prototype.toGeometry=function(){throw new Error("not implemented")},n.prototype.applyMatrix4=function(t){throw new Error("not implemented")},n.prototype.getCenter=function(t){throw new Error("not implemented")},n.prototype.distanceToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceSquaredToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceToPlane=function(t){throw new Error("not implemented")},n.prototype.intersectPlane=function(t){throw new Error("not implemented")},n.prototype.intersectRay=function(t){throw new Error("not implemented")},n}();function makeBoundingVolume(n){if("box"in n)return new BoxBoundingVolume().fromJson(n);if("sphere"in n)return new SphereBoundingVolume().fromJson(n);if("region"in n)return new RegionBoundingVolume().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var debugMaterials=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(function(n){return new THREE__namespace.LineBasicMaterial({color:n,depthWrite:!1,depthTest:!1,transparent:!0})}),debugBoxGeometry=function(){var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(8*3);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);var e=new THREE__namespace.BufferGeometry;return e.setIndex(new THREE__namespace.BufferAttribute(n,1)),e.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e}(),debugSphereGeometry=function(){for(var n=32,t=new Float32Array(n*3*2*2),e=0;e<=n;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=Math.sin(r),t[e*6+2]=0,r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=Math.sin(r),t[e*6+5]=0}for(var e=n;e<=n*2;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=0,t[e*6+2]=Math.sin(r),r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=0,t[e*6+5]=Math.sin(r)}var i=new THREE__namespace.BufferGeometry;return i.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),i.computeBoundingBox(),i.computeBoundingSphere(),i}();function createDebugBoundingMesh(n,t){if(n instanceof BoxBoundingVolume){var e=new THREE__namespace.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),quaternionFromMatrix3(n.rotation,e.quaternion),e.scale.set(n.halfSize.x,n.halfSize.y,n.halfSize.z),e.matrix.compose(e.position,e.quaternion,e.scale),e}else if(n instanceof SphereBoundingVolume){var e=new THREE__namespace.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),e.scale.set(n.radius,n.radius,n.radius),e.matrix.compose(e.position,e.quaternion,e.scale),e}throw new Error("never")}var scratchVector3$5=new THREE__namespace.Vector3,Tile=function(){function n(t,e,r,i){var o=this,s,u,c;this.parent=null,this.floor=0,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=i!=null?i:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(s=e.refine)!==null&&s!==void 0?s:this.parent?this.parent.refine:"REPLACE",this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof e.geometricError=="number"?this.geometricError=e.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(c=(u=this.parent)===null||u===void 0?void 0:u.geometricError)!==null&&c!==void 0?c:0,e.content&&e.content.uri?(this.content={uri:e.content.uri,loadState:"UNLOADED",byteLength:0},e.content.group!==void 0&&(this.content.group=e.content.group),e.content.boundingVolume&&(this.content.boundingVolume=makeBoundingVolume(e.content.boundingVolume).applyMatrix4(this.transform)),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type==="SCENEGRAPH"&&(this.levelOfContent=this.levelOfContent+1),e.boundingVolume&&(this.boundingVolume=makeBoundingVolume(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=e.extras||{},typeof this.extras.floor=="number"&&(this.floor=this.extras.floor),this.boundingVolume&&(this.boundingVolumeDebugObject=createDebugBoundingMesh(this.boundingVolume,this.levelOfContent)),e.children?this.children=e.children.map(function(l,d){return new n("".concat(o.id,".").concat(d),l,r,o)}):this.children=[]}return n.prototype.traverse=function(t){t(this);for(var e=0,r=this.children;e<r.length;e++){var i=r[e];i.traverse(t)}},n.prototype.updateState=function(t){this.state.frameNumber=t.frameNumber;var e=this.tileset.transformIsIdentity?null:this.tileset.transform;if(this.boundingVolume){var r=e?this.boundingVolume.clone().applyMatrix4(e):this.boundingVolume;if(t.camera.type==="OrthographicCamera"){var i=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(t.camera.direction,t.camera.position);this.state.distanceToCamera=r.distanceToPlane(i)}else this.state.distanceToCamera=r.distanceToPoint(t.camera.position);var o=r.getCenter(scratchVector3$5).sub(t.camera.position);this.state.centerZDepth=t.camera.direction.dot(o);var s=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,s),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=CullingVolume.MASK_INDETERMINATE,this.state.visible=!0;if(this.state.distanceToCamera<t.camera.near&&(this.state.distanceToCamera=t.camera.near),this.levelOfContent<=0&&(this.state.visible=!0),this.viewerRequestVolume){var u=e?this.viewerRequestVolume.clone().applyMatrix4(e):this.viewerRequestVolume;this.state.inRequestVolume=u.distanceSquaredToPoint(t.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(t,this.state.distanceToCamera,!1)},Object.defineProperty(n.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"siblingIndex",{get:function(){var t,e;return(e=(t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))!==null&&e!==void 0?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&this.type==="TILESET"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderContent",{get:function(){return this.type==="SCENEGRAPH"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentAvailable",{get:function(){var t;return this.hasRenderContent&&((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasUnloadedContent",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="UNLOADED"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasEmptyContent",{get:function(){return this.type==="EMPTY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentReady",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),n.prototype.loadContent=function(){var t=this,e;if(this.hasEmptyContent||!(!((e=this.content)===null||e===void 0)&&e.uri))return Promise.resolve(!1);var r=this.content;return r.data?Promise.resolve(!0):(r.loadState="LOADING",this.tileset.requestScheduler.scheduleRequest(this.id,function(){return t.getPriority()}).then(function(i){return i?t.tileset.options.contentLoader(t).then(function(o){return i.done(),r.loadState=o?"READY":"UNLOADED",o}).catch(function(o){return r.loadState="FAILED",i.done(),Promise.reject(o)}):(r.loadState="UNLOADED",Promise.resolve(!1))}))},n.prototype.unloadContent=function(){return this.content&&(this.content.loadState="UNLOADED",this.content.byteLength=0),!0},n.prototype.getScreenSpaceError=function(t,e,r){var i=this.tileset.transformIsIdentity?1:this.tileset.transform.getMaxScaleOnAxis(),o=this.parent?this.parent.geometricError:this.tileset.geometricError,s=i*(r?o:this.geometricError);if(s===0)return 0;var u=Math.max(e,.001),c=s*t.height/(u*t.sseDenominator);return c},n.prototype.getPriority=function(){var t=this.refine==="ADD"||this.tileset.skipLevelOfDetail;if(t&&!this.state.visible||this.tileset.frameNumber-this.state.touchedFrameNumber>=1||this.content.loadState==="UNLOADED")return-1;var e=this.parent,r=e&&(!t||this.state.screenSpaceError===0),i=r?e.state.screenSpaceError:this.state.screenSpaceError,o=this.tileset.root?this.tileset.root.state.screenSpaceError:0,s=Math.max(o-i,0);return s},n}(),TileRequestScheduler=function(){function n(t){this.tileset=t,this.activeRequests=0,this.requestQueue=[],this.requestMap=new Map,this.deferred=null}return n.prototype.scheduleRequest=function(t,e){var r=this.requestMap.get(t);if(r)return r;var i={identiy:t,priority:0,getPriority:e,resolve:function(){}},o=new Promise(function(s){return i.resolve=s});return this.requestQueue.push(i),this.requestMap.set(t,o),this.issueNewRequests(),o},n.prototype.reset=function(){for(var t=0,e=this.requestQueue;t<e.length;t++){var r=e[t];r.resolve(null)}this.requestQueue.length=0,this.requestMap.clear(),this.activeRequests=0},n.prototype.issueRequest=function(t){var e=this,r=t.identiy,i=t.resolve,o=!1,s=function(){o||(o=!0,e.requestMap.delete(r),e.activeRequests--,e.issueNewRequests())};this.activeRequests++,i({done:s})},n.prototype.issueNewRequests=function(){var t=this;this.deferred||(this.deferred=setTimeout(function(){return t.issueNewRequestsAsync()},0))},n.prototype.issueNewRequestsAsync=function(){this.deferred=null;var t=Math.max(this.tileset.maxRequests-this.activeRequests,0);if(t!==0){this.updateAllRequests();for(var e=0;e<t;e++){var r=this.requestQueue.shift();if(r)this.issueRequest(r);else break}}},n.prototype.updateAllRequests=function(){for(var t=this.requestQueue,e=0;e<t.length;e++){var r=t[e];this.updateRequest(r)===!1&&(t.splice(e,1),this.requestMap.delete(r.identiy),e--)}t.sort(function(i,o){return i.priority-o.priority})},n.prototype.updateRequest=function(t){return t.priority=t.getPriority(t.identiy),t.priority<0?(t.resolve(null),!1):!0},n}(),CacheNode=function(){function n(t,e,r){this.item=t,this.previous=e,this.next=r}return n}(),CacheNodeList=function(){function n(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.add=function(t){var e=new CacheNode(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++,e},n.prototype.remove=function(t){t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,this._length--},n.prototype.splice=function(t,e){t!==e&&(this.remove(e),this.insert(t,e))},n.prototype.insert=function(t,e){var r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,this._length++},n.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},n}(),TileCache=function(){function n(){this.cacheNodeMap=new Map,this.list=new CacheNodeList,this.sentinel=this.list.add("sentinel")}return n.prototype.reset=function(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)},n.prototype.touch=function(t){var e=this.cacheNodeMap.get(t);e&&this.list.splice(this.sentinel,e)},n.prototype.add=function(t,e){if(!this.cacheNodeMap.has(t)){var r=this.list.add(t);this.cacheNodeMap.set(t,r),e&&e(t)}},n.prototype.unloadTile=function(t,e){var r=this.cacheNodeMap.get(t);r&&(this.list.remove(r),this.cacheNodeMap.delete(t),e&&e(t))},n.prototype.unloadTiles=function(t,e){for(var r=this.list.head;r!==this.sentinel&&t();){var i=r.item;r=r.next,this.unloadTile(i,e)}},n.prototype.toArray=function(){for(var t=[],e=0,r=this.list.toArray();e<r.length;e++){var i=r[e];i.item!=="sentinel"&&t.push(i.item)}return t},n}(),ManagedArray=function(){function n(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.get=function(t){return this.array[t]},n.prototype.set=function(t,e){t>=this.length&&(this._length=t+1),this.map.has(this.array[t])&&this.map.delete(this.array[t]),this.array[t]=e,this.map.set(e,t)},n.prototype.delete=function(t){var e=this.map.get(t);e!==void 0&&e>=0&&(this.array.splice(e,1),this.map.delete(t),this._length--)},n.prototype.push=function(t){if(!this.map.has(t)){var e=this._length++;this.array[e]=t,this.map.set(t,e)}},n.prototype.pop=function(){var t=this.array[--this._length];return this.map.delete(t),this.array[this._length]=void 0,t},n.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},n.prototype.find=function(t){return this.map.has(t)},n.prototype.peek=function(){return this.array[this._length-1]},n}(),TilesetBaseTraverser=function(){function n(t){this.tileset=t,this._canSelectTile=!0,this.root=null}return n.prototype.traverse=function(t,e,r){this.root=t,this.reset()},n.prototype.reset=function(){this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0},n.prototype.updateTile=function(t,e){this.updateTileVisibility(t,e),t.state.shouldSelect=!1,t.state.finalResolution=!0},n.prototype.selectTile=function(t,e){var r=t.contentAvailable&&this._canSelectTile;r&&(t.state.selectedFrameNumber=e.frameNumber,this.tileset.selectedTiles.push(t),this.tileset.needsRefinedTiles.add(t))},n.prototype.loadTile=function(t,e){t.hasUnloadedContent&&(t.state.requestedFrameNumber=e.frameNumber,this.tileset.requestedTiles.push(t)),this.tileset.needsRefinedTiles.add(t)},n.prototype.touchTile=function(t,e){this.tileset.cache.touch(t),t.state.touchedFrameNumber=e.frameNumber},n.prototype.canTraverse=function(t,e){return t.levelOfContent>=e.maxLevelOfDetail||t.children.length===0?!1:t.levelOfContent<=e.minLevelOfDetail||t.hasTilesetContent?!0:t.state.screenSpaceError>e.maxScreenSpaceError},n.prototype.updateTileVisibility=function(t,e){if(t.updateState(e),!(!t.state.visible||!t.state.inRequestVolume)){var r=t.children.length>0;if(t.hasTilesetContent&&r){var i=t.children[0];this.updateTileVisibility(i,e),t.state.visible=i.state.visible;return}if(this.meetsScreenSpaceErrorEarly(t,e)){t.state.visible=!1;return}var o=t.refine==="REPLACE";if(o&&r&&!this.anyChildrenVisible(t,e)){t.state.visible=!1;return}}},n.prototype.anyChildrenVisible=function(t,e){for(var r=!1,i=t.children,o=0,s=i;o<s.length;o++){var u=s[o];u.updateState(e),r=r||u.state.visible}return r},n.prototype.meetsScreenSpaceErrorEarly=function(t,e){var r=t.parent;return!r||r.refine!=="ADD"||r.levelOfContent<e.minLevelOfDetail?!1:r.levelOfContent>e.maxLevelOfDetail?!0:t.getScreenSpaceError(e,t.state.distanceToCamera,!0)<e.maxScreenSpaceError},n.prototype.sortTilesByDistanceToCamera=function(t){t.sort(function(e,r){return r.state.distanceToCamera===0&&e.state.distanceToCamera===0?r.state.centerZDepth-e.state.centerZDepth:r.state.distanceToCamera-e.state.distanceToCamera})},n}(),TilesetNormalTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r._traversalStack=new ManagedArray,r._emptyTraversalStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,i){i===void 0&&(i=[]),n.prototype.traverse.call(this,e,r,i);for(var o=0,s=i;o<s.length;o++){var u=s[o];this._traversalStack.reset(),this._emptyTraversalStack.reset(),u.camera.refine&&(this._canSelectTile=u.camera.visible,this.updateTile(e,u),this.executeTraversal(e,u))}this._traversalStack.reset(),this._emptyTraversalStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._emptyTraversalStack.reset()},t.prototype.executeTraversal=function(e,r){var i=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&i.push(e);i.length>0;){var o=i.pop(),s=o.parent,u=!s||s.state.shouldRefine,c=!1;this.canTraverse(o,r)&&(c=this.updateAndPushChildren(o,r,i)&&u);var l=!c&&u;o.hasRenderContent?o.refine==="ADD"?(this.loadTile(o,r),this.selectDesiredTile(o,r)):o.refine==="REPLACE"&&(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)):(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)),this.touchTile(o,r),o.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,i){for(var o=e.children,s=0,u=o;s<u.length;s++){var c=u[s];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(o);for(var l=e.refine==="REPLACE"&&e.hasRenderContent,d=!1,f=!0,m=0,A=o;m<A.length;m++){var c=A[m];if(c.state.visible&&c.state.inRequestVolume?(i.find(c)&&i.delete(c),i.push(c),d===!1&&(d=!0)):(l||this.tileset.loadSiblings)&&(this.loadTile(c,r),this.touchTile(c,r)),l){var h=void 0;c.state.inRequestVolume?c.hasRenderContent?h=c.contentAvailable:h=this.executeEmptyTraversal(c,r):h=!1,f=f&&h}}return d||(f=!1),f},t.prototype.selectDesiredTile=function(e,r){e.contentAvailable&&n.prototype.selectTile.call(this,e,r)},t.prototype.executeEmptyTraversal=function(e,r){var i=!0,o=this._emptyTraversalStack;for(o.push(e);o.length>0&&i;){var s=o.pop(),u=!s.hasRenderContent&&this.canTraverse(s,r);if(!u&&!s.contentAvailable&&(i=!1),this.updateTile(s,r),s.state.visible||(this.loadTile(s,r),this.touchTile(s,r)),u)for(var c=s.children,l=0,d=c;l<d.length;l++){var f=d[l];o.find(f)&&o.delete(f),o.push(f)}}return i},t}(TilesetBaseTraverser),TilesetSkipTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r.baseScreenSpaceError=1024,r.skipScreenSpaceErrorFactor=16,r.skipLevels=1,r._traversalStack=new ManagedArray,r._descendantTraversalStack=new ManagedArray,r._selectionTraversalStack=new ManagedArray,r._selectionTraversalancestorStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,i){i===void 0&&(i=[]),n.prototype.traverse.call(this,e,r,i);for(var o=0,s=i;o<s.length;o++){var u=s[o];this._traversalStack.reset(),u.camera.refine&&(this._canSelectTile=u.camera.visible,this.updateTile(e,u),this.executeTraversal(e,u),this.traverseAndSelect(e,u))}this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r),this.traverseAndSelect(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()},t.prototype.executeTraversal=function(e,r){var i=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&i.push(e);i.length>0;){var o=i.pop();this.updateTileAncestorContentLinks(o,r);var s=o.parent,u=!s||s.state.shouldRefine,c=!1;this.canTraverse(o,r)&&(c=this.updateAndPushChildren(o,r,i)&&u);var l=!c&&u;o.hasRenderContent?o.refine==="ADD"?(this.loadTile(o,r),this.selectDesiredTile(o,r)):o.refine==="REPLACE"&&(this.inBaseTraversal(o,this.baseScreenSpaceError)?(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)):l?(this.loadTile(o,r),this.selectDesiredTile(o,r)):this.reachedSkippingThreshold(o)&&this.loadTile(o,r)):(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)),this.touchTile(o,r),o.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,i){for(var o=e.children,s=0,u=o;s<u.length;s++){var c=u[s];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(o);for(var l=!1,d=0,f=o;d<f.length;d++){var c=f[d];c.state.visible&&c.state.inRequestVolume?(i.push(c),l===!1&&(l=!0)):this.tileset.loadSiblings&&(this.loadTile(c,r),this.touchTile(c,r))}return l},t.prototype.selectDesiredTile=function(e,r){var i=e.contentAvailable?e:e.state.ancestorWithContentAvailable;i&&(i.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,r)},t.prototype.selectDescendants=function(e,r){var i=this._descendantTraversalStack;for(i.push(e);i.length>0;)for(var o=i.pop(),s=o.children,u=0,c=s;u<c.length;u++){var l=c[u];l.state.visible&&(l.contentAvailable?(this.updateTile(l,r),this.touchTile(l,r),this.selectTile(l,r)):i.push(l))}},t.prototype.reachedSkippingThreshold=function(e){var r=e.state.ancestorWithContent,i=r!==null&&e.state.screenSpaceError<r.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>r.levelOfContent+this.skipLevels;return i},t.prototype.updateTileAncestorContentLinks=function(e,r){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;var i=e.parent;if(i){var o=!(i.hasRenderContent&&i.hasUnloadedContent)||i.state.requestedFrameNumber===r.frameNumber;e.state.ancestorWithContent=o?i:i.state.ancestorWithContent,e.state.ancestorWithContentAvailable=i.contentAvailable?i:i.state.ancestorWithContentAvailable}},t.prototype.inBaseTraversal=function(e,r){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>r:e.state.screenSpaceError>r:!0},t.prototype.traverseAndSelect=function(e,r){var i=this._selectionTraversalStack,o=this._selectionTraversalancestorStack,s;for(i.push(e);i.length>0||o.length>0;){if(o.length>0){var u=o.peek();if(u.state.stackLength===i.length){o.pop(),u!==s&&(u.state.finalResolution=!1),this.selectTile(u,r);continue}}var c=i.pop();if(c){var l=this.canTraverse(c,r);if(c.state.shouldSelect)if(c.refine==="ADD")this.selectTile(c,r);else{if(c.state.selectionDepth=o.length,c.state.selectionDepth>0&&(c.tileset.hasMixedContent=!0),s=c,!l){this.selectTile(c,r);continue}o.push(c),c.state.stackLength=i.length}if(l)for(var d=0,f=c.children;d<f.length;d++){var m=f[d];m.state.visible&&i.push(m)}}}},t}(TilesetBaseTraverser),identityMatrix4=new THREE__namespace.Matrix4,Tileset=function(){function n(t,e,r){var i,o,s,u,c;this.id=t,this.transform=new THREE__namespace.Matrix4,this.transformIsIdentity=!0,this.hasMixedContent=!1,this.url=(i=r.url)!==null&&i!==void 0?i:"",this.referer=(o=r.referer)!==null&&o!==void 0?o:"",this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||"",gltfUpAxis:(s=e.asset.gltfUpAxis)!==null&&s!==void 0?s:"Y",overview:e.asset.overview},this.rootMeta=(u=e.rootMeta)!==null&&u!==void 0?u:{},this.properties=(c=e.properties)!==null&&c!==void 0?c:{},this.options=r,this.maxMemoryUsage=n.DEFAULT_MAX_MEMORY_USAGE,this.maxScreenSpaceError=n.DEFAULT_MAX_SCREEN_SPACE_ERROR,this.skipLevelOfDetail=n.DEFAULT_SKIP_LEVEL_OF_DETAIL,this.loadSiblings=n.DEFAULT_LOAD_SIBLINGS,this.maxRequests=n.DEFAULT_MAX_REQUESTS,this.requestedTiles=[],this.selectedTiles=[],this.needsRefinedTiles=new Set,this.cache=new TileCache,this.normalTraverser=new TilesetNormalTraverser(this),this.skipTraverser=new TilesetSkipTraverser(this),this.requestScheduler=new TileRequestScheduler(this),this.frameNumber=0,this.pendingCount=0,this.loadedTiles=new Set,this.memoryUsageInBytes=0,this.root=new Tile("".concat(this.id,".0"),e.root,this),this.geometricError=e.geometricError}return Object.defineProperty(n.prototype,"traverser",{get:function(){return this.skipLevelOfDetail?this.skipTraverser:this.normalTraverser},enumerable:!1,configurable:!0}),n.prototype.reset=function(){for(var t=this,e=[this.root],r;r=e.pop();){for(var i=0,o=r.children.length;i<o;i++)e.push(r.children[i]);this.cache.unloadTile(r,function(s){return t.unloadTile(s)})}this.cache.reset(),this.traverser.reset(),this.requestScheduler.reset(),this.loadedTiles.clear()},n.prototype.isLoaded=function(){return this.pendingCount===0&&this.frameNumber!==0},n.prototype.traverse=function(t,e){var r=this;e===void 0&&(e=[]),this.transformIsIdentity=this.transform.equals(identityMatrix4),this.traverser.traverse(this.root,t,e),this.requestedTiles.forEach(function(i){i.hasUnloadedContent&&r.loadTile(i)}),this.cache.unloadTiles(function(){var i=r.memoryUsageInBytes>r.maxMemoryUsage*1024*1024;return i},function(i){r.unloadTile(i),r.loadedTiles.delete(i)})},n.prototype.loadTile=function(t){var e=this;this.pendingCount++,t.loadContent().catch(function(r){return e.options.onTileError(t,r),!1}).then(function(r){var i;e.pendingCount--,r&&(!((i=t.content)===null||i===void 0)&&i.data&&(e.loadedTiles.add(t),e.cache.add(t,function(){e.memoryUsageInBytes+=t.contentByteLength})),e.options.onTileLoad(t))})},n.prototype.unloadTile=function(t){this.memoryUsageInBytes-=t.contentByteLength,this.options.onTileUnload(t),t.unloadContent()},n.DEFAULT_MAX_MEMORY_USAGE=16,n.DEFAULT_MAX_SCREEN_SPACE_ERROR=4,n.DEFAULT_SKIP_LEVEL_OF_DETAIL=!1,n.DEFAULT_LOAD_SIBLINGS=!1,n.DEFAULT_MAX_REQUESTS=6,n}(),BVHObject=function(){function n(t,e){this.position=t,this.indices=e}return n.prototype.getPositionCount=function(){var t,e,r=this.indices,i=this.position;return r?r.array.length/((t=r.stride)!==null&&t!==void 0?t:1):i.array.length/((e=i.stride)!==null&&e!==void 0?e:3)},n.prototype.getPositionByIndex=function(t,e){var r,i,o,s,u=this.indices,c=this.position,l=t;if(u){var d=u.array,f=(r=u.stride)!==null&&r!==void 0?r:1,m=(i=u.offset)!==null&&i!==void 0?i:0;l=d[t*f+m]}var A=c.array,h=(o=c.stride)!==null&&o!==void 0?o:3,p=(s=c.offset)!==null&&s!==void 0?s:0;return l=l*h+p,e.x=A[l],e.y=A[l+1],e.z=A[l+2],e},n.prototype.createTree=function(t,e,r){throw new Error("not implemented")},n.prototype.trianglesInSphere=function(t,e){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r,i){throw new Error("not implemented")},n}(),BVHNode=function(){function n(t,e,r,i,o){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=i,this.deepth=o}return n}(),BYTES_PER_NODE=6*4+4+4+2+2;function packBVHNode(n,t){for(var e=new ArrayBuffer(t*BYTES_PER_NODE),r=new Float32Array(e),i=new Uint32Array(e),o=new Uint16Array(e),s=[n],u,c;u=s.pop();)c=u.id*BYTES_PER_NODE/4,r[c]=u.extents[0],r[c+1]=u.extents[1],r[c+2]=u.extents[2],r[c+3]=u.extents[3],r[c+4]=u.extents[4],r[c+5]=u.extents[5],i[c+6]=u.startIndex,i[c+7]=u.endIndex,c=u.id*BYTES_PER_NODE/2,u.node0&&(o[c+16]=u.node0.id,s.push(u.node0)),u.node1&&(o[c+17]=u.node1.id,s.push(u.node1));return e}function intersectNodeBox(n,t,e,r,i,o,s,u,c){c===void 0&&(c=0),e=e-c,r=r-c,i=i-c,o=o+c,s=s+c,u=u+c;var l=0,d=0,f=0,m=0,A=0,h=0;return t.x>=0?(l=(e-n.x)*t.x,d=(o-n.x)*t.x):(l=(o-n.x)*t.x,d=(e-n.x)*t.x),t.y>=0?(f=(r-n.y)*t.y,m=(s-n.y)*t.y):(f=(s-n.y)*t.y,m=(r-n.y)*t.y),!(l>m||f>d||(f>l&&(l=f),m<d&&(d=m),t.z>=0?(A=(i-n.z)*t.z,h=(u-n.z)*t.z):(A=(u-n.z)*t.z,h=(i-n.z)*t.z),l>h||A>d)||(A>l&&(l=A),h<d&&(d=h),d<0))}var BVHVector3=function(){function n(t,e,r){this.x=t,this.y=e,this.z=r}return n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.cross=function(t){var e=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-e*t.z,this.z=e*t.y-r*t.x,this},n.prototype.crossVectors=function(t,e){var r=t.x,i=t.y,o=t.z,s=e.x,u=e.y,c=e.z;return this.x=i*c-o*u,this.y=o*s-r*c,this.z=r*u-i*s,this},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n}(),BVHIntersect=function(){function n(t,e,r){this.triangle=t,this.intersectionPoint=e,this.index=r}return n}(),EPSILON$1=1e-6,scratchVector3$4=new BVHVector3(0,0,0),scratchVector3A=new BVHVector3(0,0,0),scratchVector3B=new BVHVector3(0,0,0),scratchVector3C=new BVHVector3(0,0,0),BVHMesh=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,i){r=Math.min(r,16);var o=this.getPositionCount()/3,s=o>65535?new Uint32Array(o):new Uint16Array(o),u=new Float32Array(o*6),c=[],l=0,d=-1;if(i)for(var f=0,m=0,A=0,h=void 0,p=void 0,y=void 0,v=void 0,g=void 0,E=void 0,b=void 0;f<o;f+=1,m+=3,A+=6)s[f]=f,this.getPositionByIndex(m,scratchVector3A),this.getPositionByIndex(m+1,scratchVector3B),this.getPositionByIndex(m+2,scratchVector3C),h=v=scratchVector3A.x,b=scratchVector3B.x,b<h&&(h=b),b>v&&(v=b),b=scratchVector3C.x,b<h&&(h=b),b>v&&(v=b),p=g=scratchVector3A.y,b=scratchVector3B.y,b<p&&(p=b),b>g&&(g=b),b=scratchVector3C.y,b<p&&(p=b),b>g&&(g=b),y=E=scratchVector3A.z,b=scratchVector3B.z,b<y&&(y=b),b>E&&(E=b),b=scratchVector3C.z,b<y&&(y=b),b>E&&(E=b),u[A]=h,u[A+1]=p,u[A+2]=y,u[A+3]=v,u[A+4]=g,u[A+5]=E;else{for(var T=1/0,x=1/0,R=1/0,_=-1/0,M=-1/0,S=-1/0,f=0,m=0,A=0,h=void 0,p=void 0,y=void 0,v=void 0,g=void 0,E=void 0,b=void 0;f<o;f+=1,m+=3,A+=6)s[f]=f,this.getPositionByIndex(m,scratchVector3A),this.getPositionByIndex(m+1,scratchVector3B),this.getPositionByIndex(m+2,scratchVector3C),h=v=scratchVector3A.x,b=scratchVector3B.x,b<h&&(h=b),b>v&&(v=b),b=scratchVector3C.x,b<h&&(h=b),b>v&&(v=b),p=g=scratchVector3A.y,b=scratchVector3B.y,b<p&&(p=b),b>g&&(g=b),b=scratchVector3C.y,b<p&&(p=b),b>g&&(g=b),y=E=scratchVector3A.z,b=scratchVector3B.z,b<y&&(y=b),b>E&&(E=b),b=scratchVector3C.z,b<y&&(y=b),b>E&&(E=b),u[A]=h,u[A+1]=p,u[A+2]=y,u[A+3]=v,u[A+4]=g,u[A+5]=E,h<T&&(T=h),v>_&&(_=v),p<x&&(x=p),g>M&&(M=g),y<R&&(R=y),E>S&&(S=E);i=[T,x,R,_,M,S]}var I=new BVHNode(++d,i,0,o,0);c[l++]=I;var C=[],H=[0,1,2],B=function(O,k){return C[k]-C[O]};function L(O){var k=O.startIndex,G=O.endIndex,z=O.extents;C[0]=z[3]-z[0],C[1]=z[4]-z[1],C[2]=z[5]-z[2],H.sort(B);for(var D=0;D<3;D++){for(var U=H[D],K=z[U]+z[U+3],Q=k,q=G-1,J=-1,W=void 0;Q<=q;)J===-1?(W=s[Q],u[W*6+U]+u[W*6+U+3]<K?Q++:J=W):(W=s[q],u[W*6+U]+u[W*6+U+3]>=K||(s[Q]=W,s[q]=J,J=-1,Q++),q--);if(Q>k&&Q<G){var re=new BVHNode(++d,calcExtents(s,u,k,Q,EPSILON$1),k,Q,O.deepth+1);re.deepth<r&&re.endIndex-re.startIndex>e&&(c[l++]=re);var j=new BVHNode(++d,calcExtents(s,u,Q,G,EPSILON$1),Q,G,O.deepth+1);j.deepth<r&&j.endIndex-j.startIndex>e&&(c[l++]=j),O.node0=re,O.node1=j,O.startIndex=0,O.endIndex=0;break}}}for(;l;)L(c[--l]);return this.offsetArray=s,this.rootNodePacked=packBVHNode(I,d+1),c.length=0,this},t.prototype.trianglesInSphere=function(e,r){for(var i=this.offsetArray,o=this.rootNodePacked,s=new Float32Array(o),u=new Uint32Array(o),c=new Uint16Array(o),l=[0],d=[],f,m,A,h;(f=l.pop())!==void 0;){h=f*BYTES_PER_NODE/4;var p=clamp(e.x,s[h],s[h+3])-e.x,y=clamp(e.y,s[h+1],s[h+4])-e.y,v=clamp(e.z,s[h+2],s[h+5])-e.z;if(p*p+y*y+v*v<=r*r){for(var g=u[h+6];g<u[h+7];g++)d.push(i[g]);h=f*BYTES_PER_NODE/2,m=c[h+16],A=c[h+17],m&&l.push(m),A&&l.push(A)}}for(var E=d.length,b=new Float32Array(E*9),g=0;g<E;g++){var T=d[g];this.getPositionByIndex(T,scratchVector3$4),b[g*9]=scratchVector3$4.x,b[g*9+1]=scratchVector3$4.y,b[g*9+2]=scratchVector3$4.z,this.getPositionByIndex(T+1,scratchVector3$4),b[g*9+3]=scratchVector3$4.x,b[g*9+4]=scratchVector3$4.y,b[g*9+5]=scratchVector3$4.z,this.getPositionByIndex(T+2,scratchVector3$4),b[g*9+6]=scratchVector3$4.x,b[g*9+7]=scratchVector3$4.y,b[g*9+8]=scratchVector3$4.z}return b},t.prototype.intersectRay=function(e,r,i,o){for(var s=this.offsetArray,u=this.rootNodePacked,c=new Float32Array(u),l=new Uint32Array(u),d=new Uint16Array(u),f=new BVHVector3(1/r.x,1/r.y,1/r.z),m=[0],A,h,p,y;(A=m.pop())!==void 0;)if(y=A*BYTES_PER_NODE/4,intersectNodeBox(e,f,c[y],c[y+1],c[y+2],c[y+3],c[y+4],c[y+5])){for(var v=l[y+6],g=l[y+7],E=void 0,b=void 0,T=void 0,x=e.x,R=e.y,_=e.z,M=r.x,S=r.y,I=r.z,C=void 0,H=void 0,B=void 0,L=void 0,O=void 0,k=void 0,G=void 0,z=void 0,D=void 0,U=void 0,K=void 0,Q=void 0,q=void 0,J=void 0,W=void 0,re=void 0,j=void 0,te=void 0,$=void 0,ne=void 0,ee=void 0,fe=void 0,ie=void 0,se=void 0,Ae=void 0,he=void 0,me=void 0;v<g;v++){if(E=s[v],b=E*3,this.getPositionByIndex(b,scratchVector3$4),C=scratchVector3$4.x,H=scratchVector3$4.y,B=scratchVector3$4.z,this.getPositionByIndex(b+1,scratchVector3$4),L=scratchVector3$4.x,O=scratchVector3$4.y,k=scratchVector3$4.z,this.getPositionByIndex(b+2,scratchVector3$4),G=scratchVector3$4.x,z=scratchVector3$4.y,D=scratchVector3$4.z,U=L-C,K=O-H,Q=k-B,q=G-C,J=z-H,W=D-B,re=K*W-Q*J,j=Q*q-U*W,te=U*J-K*q,ie=M*re+S*j+I*te,ie>0)fe=1;else if(ie<0)fe=-1,ie=-ie;else continue;$=x-C,ne=R-H,ee=_-B,se=fe*(M*(ne*W-ee*J)+S*(ee*q-$*W)+I*($*J-ne*q)),!(se<0)&&(Ae=fe*(M*(K*ee-Q*ne)+S*(Q*$-U*ee)+I*(U*ne-K*$)),!(Ae<0)&&(se+Ae>ie||(he=-fe*($*re+ne*j+ee*te),!(he<0)&&(me=he/ie,o.push(new BVHIntersect([C,H,B,L,O,k,G,z,D],[x+M*me,R+S*me,_+I*me],E))))))}y=A*BYTES_PER_NODE/2,h=d[y+16],p=d[y+17],h&&m.push(h),p&&m.push(p)}return o},t}(BVHObject);function clamp(n,t,e){return n<t?t:n>e?e:n}function calcExtents(n,t,e,r,i){if(e>=r)return[0,0,0,0,0,0];for(var o=1/0,s=1/0,u=1/0,c=-1/0,l=-1/0,d=-1/0,f=e,m=void 0,A=void 0;f<r;f++)m=n[f]*6,A=t[m],A<o&&(o=A),A=t[m+1],A<s&&(s=A),A=t[m+2],A<u&&(u=A),A=t[m+3],A>c&&(c=A),A=t[m+4],A>l&&(l=A),A=t[m+5],A>d&&(d=A);return[o-i,s-i,u-i,c+i,l+i,d+i]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$3=new BVHVector3(0,0,0),BVHPoints=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,i){r=Math.min(r,16);var o=this.getPositionByIndex.bind(this),s=this.getPositionCount(),u=s>65535?new Uint32Array(s):new Uint16Array(s),c=[],l=0,d=-1;if(i)for(var f=0;f<s;f+=1)u[f]=f;else{o(0,scratchVector3$3);for(var m=scratchVector3$3.x,A=scratchVector3$3.y,h=scratchVector3$3.z,p=m,y=A,v=h,f=0,g=void 0,E=void 0,b=void 0;f<s;f+=1)u[f]=f,o(f,scratchVector3$3),g=scratchVector3$3.x,E=scratchVector3$3.y,b=scratchVector3$3.z,g<m?m=g:g>p&&(p=g),E<A?A=E:E>y&&(y=E),b<h?h=b:b>v&&(v=b);i=[m,A,h,p,y,v]}var T=new BVHNode(++d,i,0,s,0);c[l++]=T;var x=[],R=[0,1,2],_=function(S,I){return x[I]-x[S]};function M(S){var I=S.startIndex,C=S.endIndex,H=S.extents;x[0]=H[3]-H[0],x[1]=H[4]-H[1],x[2]=H[5]-H[2];for(var B=R.sort(_)[0],L=ORDER_AXISES[B],O=(H[B]+H[B+3])/2,k=I,G=C-1,z=-1,D;k<=G;)z===-1?(D=u[k],o(D,scratchVector3$3),scratchVector3$3[L]<O?k++:z=D):(D=u[G],o(D,scratchVector3$3),scratchVector3$3[L]>=O||(u[k]=D,u[G]=z,z=-1,k++),G--);if(k>I){var U=H.slice();U[B+3]=O+EPSILON;var K=new BVHNode(++d,U,I,k,S.deepth+1);K.deepth<r&&K.endIndex-K.startIndex>e&&(c[l++]=K),S.node0=K}if(C>k){var Q=H.slice();Q[B]=O-EPSILON;var q=new BVHNode(++d,Q,k,C,S.deepth+1);q.deepth<r&&q.endIndex-q.startIndex>e&&(c[l++]=q),S.node1=q}S.startIndex=0,S.endIndex=0}for(;l;)M(c[--l]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(T,d+1),c.length=0,this},t.prototype.intersectRay=function(e,r,i,o){for(var s=this.offsetArray,u=this.rootNodePacked,c=new Float32Array(u),l=new Uint32Array(u),d=new Uint16Array(u),f=i*i,m=new BVHVector3(1/r.x,1/r.y,1/r.z),A=[0],h,p,y,v;(h=A.pop())!==void 0;)if(v=h*BYTES_PER_NODE/4,intersectNodeBox(e,m,c[v],c[v+1],c[v+2],c[v+3],c[v+4],c[v+5],i)){for(var g=l[v+6],E=l[v+7],b=void 0,T=void 0,x=void 0,R=void 0,_=void 0,M=void 0,S=void 0,I=void 0,C=void 0,H=void 0,B=void 0,L=void 0;g<E;g++)b=s[g],this.getPositionByIndex(b,scratchVector3$3),T=scratchVector3$3.x,x=scratchVector3$3.y,R=scratchVector3$3.z,_=e.x,M=e.y,S=e.z,I=r.x,C=r.y,H=r.z,B=I*(T-_)+C*(x-M)+H*(R-S),B>0&&(_+=I*B,M+=C*B,S+=H*B),I=T-_,C=x-M,H=R-S,B=I*I+C*C+H*H,B<=f&&o.push(new BVHIntersect([T,x,R,T,x,R,T,x,R],[_,M,S],b));v=h*BYTES_PER_NODE/2,p=d[v+16],y=d[v+17],p&&A.push(p),y&&A.push(y)}return o},t}(BVHObject);const encodedJs$1="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlcj1mdW5jdGlvbihlLHIpe3JldHVybiBlcj1PYmplY3Quc2V0UHJvdG90eXBlT2Z8fHtfX3Byb3RvX186W119aW5zdGFuY2VvZiBBcnJheSYmZnVuY3Rpb24odCxvKXt0Ll9fcHJvdG9fXz1vfXx8ZnVuY3Rpb24odCxvKXtmb3IodmFyIGYgaW4gbylPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobyxmKSYmKHRbZl09b1tmXSl9LGVyKGUscil9O2Z1bmN0aW9uIGhyKGUscil7aWYodHlwZW9mIHIhPSJmdW5jdGlvbiImJnIhPT1udWxsKXRocm93IG5ldyBUeXBlRXJyb3IoIkNsYXNzIGV4dGVuZHMgdmFsdWUgIitTdHJpbmcocikrIiBpcyBub3QgYSBjb25zdHJ1Y3RvciBvciBudWxsIik7ZXIoZSxyKTtmdW5jdGlvbiB0KCl7dGhpcy5jb25zdHJ1Y3Rvcj1lfWUucHJvdG90eXBlPXI9PT1udWxsP09iamVjdC5jcmVhdGUocik6KHQucHJvdG90eXBlPXIucHJvdG90eXBlLG5ldyB0KX10eXBlb2YgU3VwcHJlc3NlZEVycm9yPT0iZnVuY3Rpb24iJiZTdXBwcmVzc2VkRXJyb3I7dmFyIGRyPWZ1bmN0aW9uKCl7ZnVuY3Rpb24gZShyLHQpe3RoaXMucG9zaXRpb249cix0aGlzLmluZGljZXM9dH1yZXR1cm4gZS5wcm90b3R5cGUuZ2V0UG9zaXRpb25Db3VudD1mdW5jdGlvbigpe3ZhciByLHQsbz10aGlzLmluZGljZXMsZj10aGlzLnBvc2l0a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3IEFyKHYuYXR0cmlidXRlcy5wb3NpdGlvbix2LmluZGljZXMpO2Vsc2UgaWYodi50eXBlPT09InBvaW50cyIpbj1uZXcgUHIodi5hdHRyaWJ1dGVzLnBvc2l0aW9uLHYuaW5kaWNlcyk7ZWxzZSB0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgVHlwZSIpO24uY3JlYXRlVHJlZSh2Lm1heEl0ZW1QZXJOb2RlLHYubWF4VHJlZURlcHRoLHYuZXh0ZW50cyk7dmFyIHM9e3R5cGU6di50eXBlLGF0dHJpYnV0ZXM6di5hdHRyaWJ1dGVzLGluZGljZXM6di5pbmRpY2VzLG9mZnNldEFycmF5Om4ub2Zmc2V0QXJyYXkscm9vdE5vZGVQYWNrZWQ6bi5yb290Tm9kZVBhY2tlZH07dC5wdXNoKHMpO3ZhciB1PXZvaWQgMDtmb3IodmFyIHcgaW4gcy5hdHRyaWJ1dGVzKXt2YXIgeT1zLmF0dHJpYnV0ZXNbd107eSYmeS5idWZmZXIgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlciYmby5hZGQoeS5idWZmZXIpfXU9cy5pbmRpY2VzLHUmJnUuYnVmZmVyIGluc3RhbmNlb2YgQXJyYXlCdWZmZXImJm8uYWRkKHUuYnVmZmVyKSx1PXMub2Zmc2V0QXJyYXksdSYmdS5idWZmZXIgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlciYmby5hZGQodS5idWZmZXIpLG8uYWRkKHMucm9vdE5vZGVQYWNrZWQpfXJldHVybntvdXRwdXQ6dCx0cmFuc2ZlcjpBcnJheS5mcm9tKG8pfX0pfSl9KSgpOwo=",decodeBase64$1=n=>Uint8Array.from(atob(n),t=>t.charCodeAt(0)),blob$2=typeof self!="undefined"&&self.Blob&&new Blob([decodeBase64$1(encodedJs$1)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$1(n){let t;try{if(t=blob$2&&(self.URL||self.webkitURL).createObjectURL(blob$2),!t)throw"";const e=new Worker(t,{name:n==null?void 0:n.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch(e){return new Worker("data:text/javascript;base64,"+encodedJs$1,{name:n==null?void 0:n.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var WorkerPool$1=function(){function n(t,e){this.pool=e,this.workerCreator=t,this.queue=[],this.workers=[],this.workersResolver=[],this.workerStatus=0}return n.prototype.initWorker=function(t){if(this.workerCreator&&!this.workers[t]){var e=this.workerCreator();e.addEventListener("message",this.onMessage.bind(this,t)),this.workers[t]=e}},n.prototype.getIdleWorker=function(){for(var t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1},n.prototype.onMessage=function(t,e){var r=this.workersResolver[t],i=r.resolve,o=r.reject;if(e.data&&"$$error"in e.data?o(e.data.$$error):i(e.data),this.queue.length){var s=this.queue.shift(),u=s.resolve,c=s.reject,l=s.input,d=s.transfer;this.workersResolver[t]={resolve:u,reject:c},this.workers[t].postMessage(l,d)}else this.workerStatus^=1<<t},n.prototype.postMessage=function(t,e){var r=this;return e===void 0&&(e=[]),new Promise(function(i,o){var s=r.getIdleWorker();s!==-1?(r.initWorker(s),r.workerStatus|=1<<s,r.workersResolver[s]={resolve:i,reject:o},r.workers[s].postMessage(t,e)):r.queue.push({resolve:i,reject:o,input:t,transfer:e})})},n.prototype.dispose=function(){this.workers.forEach(function(t){return t.terminate()}),this.workersResolver.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0},n}(),bvhWorkerPool=new WorkerPool$1(function(){return new WorkerWrapper$1},4),bvhMeshMap=new Map,scratchRay=new THREE__namespace.Ray,scratchNormalMatrix=new THREE__namespace.Matrix3,scratchInverseMatrix=new THREE__namespace.Matrix4,scratchIntersectionFaceA$1=new THREE__namespace.Vector3,scratchIntersectionFaceB$1=new THREE__namespace.Vector3,scratchIntersectionFaceC$1=new THREE__namespace.Vector3,scratchIntersectionTriangle=new THREE__namespace.Triangle;function raycastMesh(n,t,e,r){var i,o=n.matrixWorld;scratchInverseMatrix.getInverse(o),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var s=t.intersectRay(scratchRay.origin,scratchRay.direction,0,[]),u=n.geometry,c=n.material,l=u.groups,d=u.index,f=0,m=s.length;f<m;f++){var A=s[f],h=A.triangle,p=A.index,y=A.intersectionPoint,v=new THREE__namespace.Vector3(y[0],y[1],y[2]).applyMatrix4(o),g=e.ray.origin.distanceTo(v);if(!(g<e.near||g>e.far)){var E=void 0;if(Array.isArray(c)){if(l)for(var b=p*3,T=0,x=l;T<x.length;T++){var R=x[T];if(b>=R.start&&b-R.start<R.count){E=c[(i=R.materialIndex)!==null&&i!==void 0?i:0];break}}}else E=c;if(E){var _=scratchIntersectionTriangle.set(scratchIntersectionFaceA$1.set(h[0],h[1],h[2]).applyMatrix4(o),scratchIntersectionFaceB$1.set(h[3],h[4],h[5]).applyMatrix4(o),scratchIntersectionFaceC$1.set(h[6],h[7],h[8]).applyMatrix4(o)).getNormal(new THREE__namespace.Vector3),M=p*3,S=new THREE__namespace.Face3(d?d.array[M]:M,d?d.array[M+1]:M+1,d?d.array[M+2]:M+2,_),I=e.ray.direction.dot(_);E.side===THREE__namespace.FrontSide&&I>=0||E.side===THREE__namespace.BackSide&&I<=0||r.push({distance:g,object:n,face:S,point:v,distanceToRay:0,faceIndex:p})}}}}function raycastPoints(n,t,e,r){var i,o,s=n.matrixWorld;scratchNormalMatrix.getNormalMatrix(s),scratchInverseMatrix.getInverse(s);var u=((o=(i=e.params.Points)===null||i===void 0?void 0:i.threshold)!==null&&o!==void 0?o:1)*scratchInverseMatrix.getMaxScaleOnAxis();scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var c=t.intersectRay(scratchRay.origin,scratchRay.direction,u,[]),l=n.geometry,d=l.index,f=l.getAttribute("normal"),m=0,A=c.length;m<A;m++){var h=c[m],p=h.triangle,y=h.index,v=h.intersectionPoint,g=new THREE__namespace.Vector3(v[0],v[1],v[2]).applyMatrix4(s),E=e.ray.origin.distanceTo(g);if(!(E<e.near||E>e.far)){var b=scratchIntersectionFaceA$1.set(p[0],p[1],p[2]).applyMatrix4(s),T=d?d.array[y]:y,x=void 0;f instanceof THREE__namespace.BufferAttribute&&(x=new THREE__namespace.Vector3().fromBufferAttribute(f,T).applyNormalMatrix(scratchNormalMatrix));var R=new THREE__namespace.Face3(T,T,T,x);r.push({distance:E,object:n,face:R,point:g,distanceToRay:g.distanceTo(b),index:y})}}}var BVH_MESH_PROP="__bvh_mesh__",originMeshRaycast=THREE__namespace.Mesh.prototype.raycast;function overrideMeshRaycast(n,t){var e=getBvhTreeForMesh(this);e?raycastMesh(this,e,n,t):originMeshRaycast.call(this,n,t)}function getBvhTreeForMesh(n){var t=n[BVH_MESH_PROP];return t instanceof BVHMesh,t}function bindBvhTreeForMesh(n,t){var e;Object.assign(n,(e={},e[BVH_MESH_PROP]=t,e.raycast=overrideMeshRaycast,e))}var BVH_POINTS_PROP="__bvh_points__",originPointsRaycast=THREE__namespace.Points.prototype.raycast;function overridePointsRaycast(n,t){var e=getBvhTreeForPoints(this);e?raycastPoints(this,e,n,t):originPointsRaycast.call(this,n,t)}function getBvhTreeForPoints(n){var t=n[BVH_POINTS_PROP];return t instanceof BVHPoints,t}function bindBvhTreeForPoints(n,t){var e;Object.assign(n,(e={},e[BVH_POINTS_PROP]=t,e.raycast=overridePointsRaycast,e))}function generateBvhTree(n,t,e,r){var i=[];return n.traverse(function(o){(o instanceof THREE__namespace.Mesh||o instanceof THREE__namespace.Points)&&o.geometry instanceof THREE__namespace.BufferGeometry&&i.push(o)}),Promise.resolve().then(function(){for(var o=[],s=new Set,u=null,c=0;c<i.length;c++){var l=i[c],d=l.geometry;if(d instanceof THREE__namespace.BufferGeometry){var f=void 0;if(l instanceof THREE__namespace.Mesh?f="mesh":l instanceof THREE__namespace.Points&&(f="points"),!!f){var m=d.boundingBox,A=m?[m.min.x,m.min.y,m.min.z,m.max.x,m.max.y,m.max.z]:void 0,h={};for(var p in d.attributes){var y=d.attributes[p];y instanceof THREE__namespace.InterleavedBufferAttribute?(h[p]={array:y.data.array,stride:y.data.stride,offset:y.offset},u=y.data.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer)):(h[p]={array:y.array},u=y.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer))}var v=void 0,g=d.getIndex();g&&(g instanceof THREE__namespace.InterleavedBufferAttribute?(v={array:g.data.array,stride:g.data.stride,offset:g.offset},u=g.data.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer)):(v={array:g.array},u=g.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer)));var E={type:f,attributes:h,indices:v,maxItemPerNode:e,maxTreeDepth:r,extents:A};o.push(E)}}}return bvhWorkerPool.postMessage(o,Array.from(s))}).then(function(o){for(var s=0;s<i.length;s++){var u=i[s],c=u.geometry,l=o[s];if(c instanceof THREE__namespace.BufferGeometry){for(var d in l.attributes){var f=l.attributes[d].array,m=c.attributes[d];m instanceof THREE__namespace.InterleavedBufferAttribute?m.data.array=f:m.array=f}var A=c.getIndex();if(A&&l.indices){var f=l.indices.array;A instanceof THREE__namespace.InterleavedBufferAttribute?A.data.array=f:A.array=f}if(u instanceof THREE__namespace.Mesh){var h=new BVHMesh(l.attributes.position,l.indices);h.offsetArray=l.offsetArray,h.rootNodePacked=l.rootNodePacked,bindBvhTreeForMesh(u,h)}else if(u instanceof THREE__namespace.Points){var h=new BVHPoints(l.attributes.position,l.indices);h.offsetArray=l.offsetArray,h.rootNodePacked=l.rootNodePacked,bindBvhTreeForPoints(u,h)}}}return n})}var scratchIntersectionFaceA=new THREE__namespace.Vector3,scratchIntersectionFaceB=new THREE__namespace.Vector3,scratchIntersectionFaceC=new THREE__namespace.Vector3,TileNode=function(n){__extends(t,n);function t(e,r){r===void 0&&(r=noop$1);var i=n.call(this)||this;return i.contentObject=e,i.disposer=r,i.disposers=[r],i.add(e),i}return t.prototype.generateBvhTree=function(){return generateBvhTree(this,!0,200,10)},t.prototype.intersectRaycaster=function(e,r,i){var o=this;r===void 0&&(r=!0),i===void 0&&(i=[]);for(var s=this.children.slice(),u,c=[];u=s.pop();)if(u.visible){u.raycast(e,c);for(var l=0,d=u.children.length;l<d;l++)s.push(u.children[l])}return c.forEach(function(f){var m,A,h=0;if((f.object instanceof PBMMesh||f.object instanceof PBMPointCloud)&&f.face){var p=Array.isArray(f.object.material)?f.object.material[f.face.materialIndex]:f.object.material;if(p)if(p.defines.USE_VERTEX_FLOOR){var y=(m=f.object.geometry.attributes.position)===null||m===void 0?void 0:m.array,v=(A=f.object.geometry.attributes.floor)===null||A===void 0?void 0:A.array;if(y&&v){var g=scratchIntersectionFaceA.set(y[f.face.a*3],y[f.face.a*3+1],y[f.face.a*3+2]).applyMatrix4(o.matrixWorld),E=scratchIntersectionFaceB.set(y[f.face.b*3],y[f.face.b*3+1],y[f.face.b*3+2]).applyMatrix4(o.matrixWorld),b=scratchIntersectionFaceC.set(y[f.face.c*3],y[f.face.c*3+1],y[f.face.c*3+2]).applyMatrix4(o.matrixWorld),T=f.point.distanceTo(g),x=f.point.distanceTo(E),R=f.point.distanceTo(b);h=Math.round((T*v[f.face.a]+x*v[f.face.b]+R*v[f.face.c])/(T+x+R))}}else h=p.floor}f.floor=h}),r&&c.sort(function(f,m){return f.distance-m.distance}),i.push.apply(i,c),i},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var i=r[e];i()}this.disposers.length=0},t.prototype.clone=function(){return new t(this.contentObject,this.disposer)},t}(THREE__namespace.Group);function pathJoin(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(u){return(u!=null?u:"").trim()}).filter(function(u){return u.length>0&&!/^\/+$/.test(u)});for(var r=0;r<n.length;r++){var i=r===0,o=r===n.length-1,s=n[r];i||(s=s.replace(/^\.\//,"").replace(/^\/+/,"")),o||(s=s.replace(/\/+$/,"")),e.push(s)}return e.join("/")}function normalizeURL(n){var t,e=/^(http\:|https\:|file\:)?\/\/[^/]/.exec(n);if(!e)return n;var r=e[1]||"",i=n.slice(r.length+2),o=i.indexOf("#");o>=0&&(n.slice(o),i=n.slice(0,o));var s=i.indexOf("?");s>=0&&(n.slice(s),i=n.slice(0,s));for(var u=i.split("/"),c=u.shift(),l=(t=u.pop())!==null&&t!==void 0?t:"",d=[],f=0,m=u;f<m.length;f++){var A=m[f];if(!(A===""||A===".")){if(A===".."){d.pop();continue}d.push(A)}}return r+"//"+c+"/"+d.join("/")+"/"+l}function isAbsoluteURL(n){return n.indexOf("//")===0||/^[0-9a-z]+\:/i.test(n)}function normalizeTileHeader(n,t){if(n.content&&n.content.uri&&(isAbsoluteURL(n.content.uri)||(n.content.uri=normalizeURL(pathJoin(t,n.content.uri)))),n.transform){for(var e=!1,r=0;r<16;r++){var i=n.transform[r];if(typeof i!="number"||isNaN(i)||!isFinite(i)){e=!0;break}}if(n.transform[15]===0&&(e=!0),e)throw new Error("Invalid Tile Transform: "+JSON.stringify(n.transform))}if(n.children)for(var o=0,s=n.children;o<s.length;o++){var u=s[o];normalizeTileHeader(u,t)}return n}function normalizeTilesetHeader(n,t){return n.asset||(n.asset={}),n.rootMeta||(n.rootMeta={}),n.asset.overview&&(isAbsoluteURL(n.asset.overview.imageFile)||(n.asset.overview.imageFile=normalizeURL(pathJoin(t,n.asset.overview.imageFile))),isAbsoluteURL(n.asset.overview.worldFile)||(n.asset.overview.worldFile=normalizeURL(pathJoin(t,n.asset.overview.worldFile)))),normalizeTileHeader(n.root,t),n}function initTextures(n,t,e){for(var r,i,o=Promise.resolve(),s=n.slice(),u=function(){for(var c=[],l=0,d=void 0;d=s.shift();){c.push(d);var f=((r=d.image)===null||r===void 0?void 0:r.width)*((i=d.image)===null||i===void 0?void 0:i.height);if(!isNaN(f)&&isFinite(f)&&(l+=f),l>=e)break}o=o.then(function(){return new Promise(function(m){AnimationFrameLoop.shared.add(function(){for(var A=0,h=c;A<h.length;A++){var p=h[A];t.initTexture(p)}m()},!0)})}).catch(function(){})};s.length>0;)u();return o}function appendSearch(n,t){if(t===void 0&&(t=""),(t[0]==="?"||t[0]==="&")&&(t=t.slice(1)),!t)return n;var e=n.indexOf("#"),r="";return e>=0&&(r=n.slice(e),n=n.slice(0,e)),(n[n.length-1]==="?"||n[n.length-1]==="&")&&(n=n.slice(0,-1)),n.indexOf("?")>=0?"".concat(n,"&").concat(t).concat(r):"".concat(n,"?").concat(t).concat(r)}const pointCloudFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6--n\bv{t-rp@-[|znyH0r{qvs0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvsp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvsn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-sy|n-Sy||Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-]|v{`v rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-u|{Sy||V{qr\x07H0v{pyqr-Ip|zz|{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{K|vq-znv{56-\n--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5Sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--<<-JJJ-形状裁切-JJJ--0vs-qrsv{rq5b`Rl]\\V[al`UN]RlPV_PYR6----sy|n--J-?;=-7-tyl]|v{P||q;\x07-:->;=H----sy|n--J-?;=-7-tyl]|v{P||q;\b-:->;=H----sy|n-pp-J-7-8-7H----vs-5]|v{`v r-K-E;=-33-pp-K->;=6-\n------qvpnqH----\f--0r{qvs--<<-JJJJJJJJJJJJJ--0v{pyqr-Iy|tqr}uoslsntzr{K--<<-JJJ-颜色-JJJ--rpA-sv{nyP|y|-J-_TOa|Yv{rn5rpA5P|y|9-|}npv\b66H--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----0vs-qrsv{rq5b`Rl]\\V[alONPXlUVQQR[6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-d|yq]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------qvpnqH------\f----0ryvs-qrsv{rq5b`Rl]\\V[alONPXlQN_X6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-d|yq]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------sv{nyP|y|;\x07\b -J-sv{nyP|y|;\x07\b -7-=;EH------\f----0r{qvs--0r{qvs--tylSntP|y|-J-sv{nyP|y|H--<<-JJJJJJJJJJJ--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-KJ-=;=-33-no5Sy||-:-u|{Sy||V{qr\x076-KJ->;=6-\n----sy||\\}npv\b-J-=;>H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\bH--<<-JJJJJJJJJJJJJJ--tylSntP|y|;n-J-tylSntP|y|;n-7-z|qryNy}unH--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs--0vs-qrsv{rq5b`RlU^ldRVTUa6----sy|n-qvn{pr-J-?;=-7-yr{tu5tyl]|v{P||q;\x07\b-:-=;B6H----sy|n-rvtu-J-zn\x075=;=9->;=-:-qvn{pr6H----rvtu-J-}|5rvtu9->;B6H----tylSntP|y|;n-J-rvtuH----tylSntP|y|;\x07\b -J-tylSntP|y|;\x07\b -7-rvtuH--0r{qvs\f"),pointCloudVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("nvor-rp@-p|y|H0vs-qrsv{rq5b`Rl]\\V[alP\\Y\\_lNYaVabQR6--{vs|z-nz}yr?Q-tnqvr{ar\x07rH0r{qvs0vs-qrsv{rq5b`R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q]|vv|{H--<<传递nvor的p|y|到s里使用--<<动态调整}|v{`v r--sy|n-rny]|v{`v r-J-}|v{`pnyr-7-}v\x07ry_nv|H--0vs-qrsv{rq5b`Rl]\\V[al`VgRlTR\\ZRa_VP6----rny]|v{`v r-7J-tr|zrvpR|H----sy|n-urvtu-J->;=-<-}|wrpv|{Znv\x07h>jh>j-7-zv\x075>;=9-:z]|vv|{; 9-:}|wrpv|{Znv\x07h?jh@j6-7-?;=H----rny]|v{`v r-J-r|yv|{;\b-7-rny]|v{`v r-<-urvtuH--0ryvs-qrsv{rq5b`Rl]\\V[al`VgRlNaaR[bNaV\\[6----sy|n-urvtu-J->;=-<-}|wrpv|{Znv\x07h>jh>j-7-zv\x075>;=9-:z]|vv|{; 9-:}|wrpv|{Znv\x07h?jh@j6-7-?;=H----rny]|v{`v r-J-r|yv|{;\b-7-rny]|v{`v r-<-urvtuH--0r{qvs--tyl]|v{`v r-J-pynz}5rny]|v{`v r9-}|v{Zv{]v\x07ry-7-}v\x07ry_nv|9-}|v{Zn\x07]v\x07ry-7-}v\x07ry_nv|6H--]|v{`v r-J-tyl]|v{`v rH--0vs-qrsv{rq5b`Rl]\\V[alP\\Y\\_lNYaVabQR6----P|y|-J-trP|y|O\bUrvtu5tnqvr{ar\x07r9-d|yq]|vv|{6H--0ryr----P|y|-J-p|y|H--0r{qvs--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----[|zny-J-{|znyv r5zn@5z|qryZnv\x076-7-{|zny6H--0r{qvs--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--0vs-qrsv{rq5b`RlU^lQR]aU6----<<-sy|n-}|wSnp|-J-:=;B-7-r|yv|{;\b-<-5n{5s|-<-?;=6-7-z]|vv|{; 6H----<<-sy|n-_nqv-J-rny]|v{`v r-<-}|wSnp|H----sy|n-|vtv{nyQr}u-J-tyl]|vv|{;H----sy|n-nqwrqQr}u-J-|vtv{nyQr}u-8-=;>H----sy|n-nqw-J-nqwrqQr}u-<-|vtv{nyQr}uH----z]|vv|{;\x07\b -J-z]|vv|{;\x07\b -7-nqwH----tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K\f");var scratchVector4=new THREE__namespace.Vector4,shaderUniforms=Object.assign({pointScale:new THREE__namespace.Uniform(1),pointMinPixel:new THREE__namespace.Uniform(1),pointMaxPixel:new THREE__namespace.Uniform(1),opacity:new THREE__namespace.Uniform(1),gradientTexture:new THREE__namespace.Uniform(null),modelAlpha:new THREE__namespace.Uniform(0),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(null),geometricError:new THREE__namespace.Uniform(0),pixelRatio:new THREE__namespace.Uniform(1),resolution:new THREE__namespace.Uniform(new THREE__namespace.Vector2(512,512)),floor:new THREE__namespace.Uniform(0),brightness:new THREE__namespace.Uniform(1),modelBoundingMin:new THREE__namespace.Uniform(new THREE__namespace.Vector3),modelBoundingMax:new THREE__namespace.Uniform(new THREE__namespace.Vector3)},THREE__namespace.UniformsUtils.clone(THREE__namespace.UniformsLib.fog)),PBMPointCloudMaterial=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s,u,c,l,d,f,m,A,h,p,y,v,g,E,b,T,x,R,_=n.call(this,{vertexShader:pointCloudVertexShader,fragmentShader:pointCloudFragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(shaderUniforms),lights:!1,defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_FLOOR:!1,USE_VERTEX_MARK:!1,USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_POINT_NORMAL:!1,USE_POINT_SHAPE_CIRCLE:!1,USE_POINT_SIZE_ATTENUATION:!1,USE_POINT_SIZE_GEOMETRIC:!1,USE_POINT_BACK_HIDDEN:!1,USE_POINT_BACK_DARK:!1}})||this,M;return Object.defineProperties(_,{constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(S){this.uniforms.constantColor.value=S;var I=this.defines.USE_CONSTANT_COLOR,C=S!==null;I!==C&&(this.defines.USE_CONSTANT_COLOR=C,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(S){this.uniforms.opacity.value=S}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(S){this.uniforms.modelAlpha.value=S}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(S){this.uniforms.shownFloorIndex.value=S}},clippers:{get:function(){return M},set:function(S){M!==S&&(M=S,this.uniforms.clippers.value=(M||[]).map(function(I){var C=typeof I.floorIndex=="number"?I.floorIndex:-1,H=new THREE__namespace.Matrix4().getInverse(I.clippingBoxMatrix);return{matrixInverse:H,floorIndex:C}}),this.needsUpdate=!0)}},pointColor:{get:function(){return this.defines.USE_POINT_COLOR_ALTITUDE===!0?"ALTITUDE":"RGB"},set:function(S){var I=S==="ALTITUDE";this.defines.USE_POINT_COLOR_ALTITUDE!==I&&(this.defines.USE_POINT_COLOR_ALTITUDE=I,this.needsUpdate=!0)}},pointSize:{get:function(){return this.defines.USE_POINT_SIZE_GEOMETRIC===!0?"GEOMETRIC":this.defines.USE_POINT_SIZE_ATTENUATION===!0?"ATTENUATION":"FIXED"},set:function(S){var I=S==="ATTENUATION",C=S==="GEOMETRIC";this.defines.USE_POINT_SIZE_GEOMETRIC!==C&&(this.defines.USE_POINT_SIZE_GEOMETRIC=C,this.needsUpdate=!0),this.defines.USE_POINT_SIZE_ATTENUATION!==I&&(this.defines.USE_POINT_SIZE_ATTENUATION=I,this.needsUpdate=!0)}},pointShape:{get:function(){return this.defines.USE_POINT_SHAPE_CIRCLE===!0?"CIRCLE":"SQUARE"},set:function(S){var I=S==="CIRCLE";this.defines.USE_POINT_SHAPE_CIRCLE!==I&&(this.defines.USE_POINT_SHAPE_CIRCLE=I,this.needsUpdate=!0)}},pointScale:{get:function(){return this.uniforms.pointScale.value},set:function(S){this.uniforms.pointScale.value=S}},pointBack:{get:function(){return this.defines.USE_POINT_BACK_HIDDEN===!0?"HIDDEN":this.defines.USE_POINT_BACK_DARK===!0?"DARK":"VISIBLE"},set:function(S){var I=S==="HIDDEN",C=S==="DARK";this.defines.USE_POINT_BACK_HIDDEN!==I&&(this.defines.USE_POINT_BACK_HIDDEN=I,this.needsUpdate=!0),this.defines.USE_POINT_BACK_DARK!==C&&(this.defines.USE_POINT_BACK_DARK=C,this.needsUpdate=!0)}},pointMinPixel:{get:function(){return this.uniforms.pointMinPixel.value},set:function(S){this.uniforms.pointMinPixel.value=S}},pointMaxPixel:{get:function(){return this.uniforms.pointMaxPixel.value},set:function(S){this.uniforms.pointMaxPixel.value=S}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(S){S!==this.defines.USE_EDL&&(this.defines.USE_EDL=S,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(S){S!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=S,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(S){S!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=S,this.needsUpdate=!0)}},gradientTexture:{get:function(){return this.uniforms.gradientTexture.value},set:function(S){this.uniforms.gradientTexture.value=S}},floor:{get:function(){return this.uniforms.floor.value},set:function(S){this.uniforms.floor.value=S}},brightness:{get:function(){return this.uniforms.brightness.value},set:function(S){this.uniforms.brightness.value=S}}}),_.pano0=(r=e.pano0)!==null&&r!==void 0?r:defaultPbmParameters.pano0,_.pano1=(i=e.pano1)!==null&&i!==void 0?i:defaultPbmParameters.pano1,_.modelAlpha=(o=e.modelAlpha)!==null&&o!==void 0?o:defaultPbmParameters.modelAlpha,_.progress=(s=e.progress)!==null&&s!==void 0?s:defaultPbmParameters.progress,_.transition=(u=e.transition)!==null&&u!==void 0?u:defaultPbmParameters.transition,_.constantColor=(c=e.constantColor)!==null&&c!==void 0?c:defaultPbmParameters.constantColor,_.opacity=(l=e.opacity)!==null&&l!==void 0?l:defaultPbmParameters.opacity,_.shownFloorIndex=(d=e.shownFloorIndex)!==null&&d!==void 0?d:defaultPbmParameters.shownFloorIndex,_.clippers=(f=e.clippers)!==null&&f!==void 0?f:defaultPbmParameters.clippers,_.useEDL=(m=e.useEDL)!==null&&m!==void 0?m:defaultPbmParameters.useEDL,_.useHQWeight=(A=e.useHQWeight)!==null&&A!==void 0?A:defaultPbmParameters.useHQWeight,_.useHQDepth=(h=e.useHQDepth)!==null&&h!==void 0?h:defaultPbmParameters.useHQDepth,_.pointColor=(p=e.pointColor)!==null&&p!==void 0?p:defaultPbmParameters.pointColor,_.pointShape=(y=e.pointShape)!==null&&y!==void 0?y:defaultPbmParameters.pointShape,_.pointSize=(v=e.pointSize)!==null&&v!==void 0?v:defaultPbmParameters.pointSize,_.pointScale=(g=e.pointScale)!==null&&g!==void 0?g:defaultPbmParameters.pointScale,_.pointBack=(E=e.pointBack)!==null&&E!==void 0?E:defaultPbmParameters.pointBack,_.pointMinPixel=(b=e.pointMinPixel)!==null&&b!==void 0?b:defaultPbmParameters.pointMinPixel,_.pointMaxPixel=(T=e.pointMaxPixel)!==null&&T!==void 0?T:defaultPbmParameters.pointMaxPixel,_.gradientTexture=(x=e.gradientTexture)!==null&&x!==void 0?x:defaultPbmParameters.gradientTexture,_.brightness=(R=e.brightness)!==null&&R!==void 0?R:defaultPbmParameters.brightness,_.floor=0,_.transparent=!1,_}return t.prototype.onBeforeCompile=function(e,r){var i,o,s=String((o=(i=this.clippers)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,s),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,s)},t.prototype.update=function(e,r){if(r instanceof Camera)this.uniforms.pixelRatio.value=r.pixelRatio,this.uniforms.resolution.value.copy(r.resolution);else{this.uniforms.pixelRatio.value=e.getPixelRatio();var i=e.getViewport(scratchVector4);this.uniforms.resolution.value.set(i.z,i.w)}this.transparent=this.shownFloorIndex>-1||this.opacity<1||this.modelAlpha<1||this.brightness<1,this.useEDL&&(this.transparent=!1),this.useHQDepth&&(this.depthTest=!0,this.depthWrite=!0),this.useHQWeight?(this.depthWrite=!1,this.blending=THREE__namespace.CustomBlending,this.blendSrc=THREE__namespace.SrcAlphaFactor,this.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,this.blendDst=THREE__namespace.OneFactor,this.blendDstAlpha=THREE__namespace.OneFactor):(this.depthWrite=!0,this.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,this.blendEquation=THREE__namespace.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.opacity<1?(this.blending=THREE__namespace.AdditiveBlending,this.depthTest=!1):(this.blending=THREE__namespace.NormalBlending,this.depthTest=!0))},t.prototype.syncModel=function(e){var r="".concat(e.id,":").concat(e.materialVersion);r!==this.syncModelVersion&&(Object.assign(this,e.getMaterial()),this.uniforms.modelBoundingMax.value.copy(e.bounding.max),this.uniforms.modelBoundingMin.value.copy(e.bounding.min),this.syncModelVersion=r)},t.prototype.copy=function(e){return n.prototype.copy.call(this,this),this.pano0=e.pano0,this.pano1=e.pano1,this.progress=e.progress,this.transition=e.transition,this.shownFloorIndex=e.shownFloorIndex,this.brightness=e.brightness,this.clippers=e.clippers,this.constantColor=e.constantColor,this.modelAlpha=e.modelAlpha,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.pointColor=e.pointColor,this.pointSize=e.pointSize,this.pointShape=e.pointShape,this.pointScale=e.pointScale,this.pointBack=e.pointBack,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.gradientTexture=e.gradientTexture,this},t}(THREE__namespace.ShaderMaterial),SIZEOF_UINT32$1=4;function parseHeader(n,t,e){var r=new DataView(t);if(n.magic=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.byteLength=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version!==1)throw new Error("3D Tile Version ".concat(n.version," not supported"));return e}var _a$3,GL_TYPE;(function(n){n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.INT=5124]="INT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.DOUBLE=5130]="DOUBLE"})(GL_TYPE||(GL_TYPE={}));var GL_TYPE_TO_ARRAY_TYPE=(_a$3={},_a$3[GL_TYPE.DOUBLE]=Float64Array,_a$3[GL_TYPE.FLOAT]=Float32Array,_a$3[GL_TYPE.UNSIGNED_SHORT]=Uint16Array,_a$3[GL_TYPE.UNSIGNED_INT]=Uint32Array,_a$3[GL_TYPE.UNSIGNED_BYTE]=Uint8Array,_a$3[GL_TYPE.BYTE]=Int8Array,_a$3[GL_TYPE.SHORT]=Int16Array,_a$3[GL_TYPE.INT]=Int32Array,_a$3),NAME_TO_GL_TYPE={DOUBLE:GL_TYPE.DOUBLE,FLOAT:GL_TYPE.FLOAT,UNSIGNED_SHORT:GL_TYPE.UNSIGNED_SHORT,UNSIGNED_INT:GL_TYPE.UNSIGNED_INT,UNSIGNED_BYTE:GL_TYPE.UNSIGNED_BYTE,BYTE:GL_TYPE.BYTE,SHORT:GL_TYPE.SHORT,INT:GL_TYPE.INT};function getArrayType(n){var t=GL_TYPE_TO_ARRAY_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}function getByteSize(n){var t=getArrayType(n);return t.BYTES_PER_ELEMENT}function createTypedArray(n,t,e,r){e===void 0&&(e=0);var i=getArrayType(n);if(e%getByteSize(n)!==0){var o=r?t.slice(e,e+r*getByteSize(n)):t.slice(e);return new i(o)}else return new i(t,e,r!=null?r:(t.byteLength-e)/getByteSize(n))}function glTypeFromName(n){var t=NAME_TO_GL_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}var FeatureTable=function(){function n(t,e){this.featuresLength=0,this.cachedTypedArrays={},this.json=t,this.buffer=e;var r=this.getGlobalProperty("POINTS_LENGTH",GL_TYPE.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}return n.prototype.getExtension=function(t){return this.json.extensions&&this.json.extensions[t]},n.prototype.hasProperty=function(t){return!!this.json[t]},n.prototype.getGlobalProperty=function(t,e,r){var i=this.json[t];if(typeof i=="number"){var o=getArrayType(e);return new o([i])}else if(Array.isArray(i)){var o=getArrayType(e);return new o(i)}else if(i&&Number.isFinite(i.byteOffset))return this.getTypedArrayFromBinary(t,e,r,1,i.byteOffset);return null},n.prototype.getPropertyArray=function(t,e,r){var i=this.json[t];return i&&Number.isFinite(i.byteOffset)?("componentType"in i&&(e=glTypeFromName(i.componentType)),this.getTypedArrayFromBinary(t,e,r,this.featuresLength,i.byteOffset)):this.getTypedArrayFromArray(t,e,i)},n.prototype.getProperty=function(t,e,r,i,o){var s=this.json[t];if(!s)return null;var u=this.getPropertyArray(t,e,r);if(r===1)return o[0]=u[i],o;for(var c=0;c<r;++c)o[c]=u[r*i+c];return o},n.prototype.getTypedArrayFromBinary=function(t,e,r,i,o){var s=this.cachedTypedArrays,u=s[t];return u||(u=createTypedArray(e,this.buffer.buffer,this.buffer.byteOffset+o,i*r),s[t]=u),u},n.prototype.getTypedArrayFromArray=function(t,e,r){var i=this.cachedTypedArrays,o=i[t];return o||(o=createTypedArray(e,r),i[t]=o),o},n}(),SIZEOF_UINT32=4,DEPRECATION_WARNING="b3dm tile in legacy format.";function getStringFromArrayBuffer(n,t,e){var r=new TextDecoder("utf8"),i=new Uint8Array(n,t,e),o=r.decode(i);return o}function parseTable(n,t,e){return e=parseTablesHeader(n,t,e),e=parseFeatureTable(n,t,e),e=parseBatchTable(n,t,e),e}function parseTablesHeader(n,t,e){var r=new DataView(t),i=0;n.header=n.header||{};var o=r.getUint32(e,!0);e+=SIZEOF_UINT32;var s=r.getUint32(e,!0);e+=SIZEOF_UINT32;var u=r.getUint32(e,!0);e+=SIZEOF_UINT32;var c=r.getUint32(e,!0);return e+=SIZEOF_UINT32,u>=570425344?(e-=SIZEOF_UINT32*2,i=o,u=s,c=0,o=0,s=0,console.warn(DEPRECATION_WARNING)):c>=570425344&&(e-=SIZEOF_UINT32,i=u,u=o,c=s,o=0,s=0,console.warn(DEPRECATION_WARNING)),n.header.featureTableJsonByteLength=o,n.header.featureTableBinaryByteLength=s,n.header.batchTableJsonByteLength=u,n.header.batchTableBinaryByteLength=c,n.header.batchLength=i,e}function parseFeatureTable(n,t,e){var r=n.header||{},i=r.featureTableJsonByteLength,o=r.featureTableBinaryByteLength,s=r.batchLength;if(n.featureTableJson={BATCH_LENGTH:s||0},i&&i>0){var u=getStringFromArrayBuffer(t,e,i);n.featureTableJson=JSON.parse(u)}e+=i||0,n.featureTableBinary=new Uint8Array(t,e,o),e+=o||0,n.rtcCenter=[0,0,0];var c=new FeatureTable(n.featureTableJson,n.featureTableBinary);if(Array.isArray(c.json.RTC_CENTER)){var l=c.json.RTC_CENTER;n.rtcCenter[0]=l[0],n.rtcCenter[1]=l[1],n.rtcCenter[2]=l[2]}else{var l=c.getGlobalProperty("RTC_CENTER",GL_TYPE.FLOAT,3);l&&(n.rtcCenter[0]=l[0],n.rtcCenter[1]=l[1],n.rtcCenter[2]=l[2])}return e}function parseBatchTable(n,t,e){var r=n.header||{},i=r.batchTableJsonByteLength,o=r.batchTableBinaryByteLength;if(i&&i>0){var s=getStringFromArrayBuffer(t,e,i);n.batchTableJson=JSON.parse(s),e+=i,o&&o>0&&(n.batchTableBinary=new Uint8Array(t,e,o),n.batchTableBinary=new Uint8Array(n.batchTableBinary),e+=o)}return e}function sliceArrayBuffer(n,t,e){var r=e!==void 0?new Uint8Array(n).subarray(t,t+e):new Uint8Array(n).subarray(t),i=new Uint8Array(r);return i.buffer}function parseGlTFArrayBuffer(n,t,e){var r=n.byteLength-e;if(r===0)throw new Error("glTF byte length must be greater than 0.");return e%4!==0&&console.warn("".concat(n.type,": embedded glb is not aligned to a 4-byte boundary.")),n.gltfArrayBuffer=sliceArrayBuffer(t,e,r),n.byteLength}function decodeText(n){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(n);for(var t="",e=0,r=n.length;e<r;e++)t+=String.fromCharCode(n[e]);try{return decodeURIComponent(escape(t))}catch(i){return t}}var WEBGL_CONSTANTS={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},WEBGL_COMPONENT_TYPES={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},WEBGL_FILTERS={9728:THREE__namespace.NearestFilter,9729:THREE__namespace.LinearFilter,9984:THREE__namespace.NearestMipmapNearestFilter,9985:THREE__namespace.LinearMipmapNearestFilter,9986:THREE__namespace.NearestMipmapLinearFilter,9987:THREE__namespace.LinearMipmapLinearFilter},WEBGL_WRAPPINGS={33071:THREE__namespace.ClampToEdgeWrapping,33648:THREE__namespace.MirroredRepeatWrapping,10497:THREE__namespace.RepeatWrapping},WEBGL_TYPE_SIZES={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ATTRIBUTES={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},PATH_PROPERTIES={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},INTERPOLATION={CUBICSPLINE:void 0,LINEAR:THREE__namespace.InterpolateLinear,STEP:THREE__namespace.InterpolateDiscrete},ALPHA_MODES={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function values(n){var t=[];for(var e in n)t.push(n[e]);return t}function composeDsiposeSet(n){var t=Array.from(n);return function(){for(var e=0,r=t;e<r.length;e++){var i=r[e];typeof i.dispose=="function"&&i.dispose(),typeof i.close=="function"&&i.close()}}}var Parser=function(){function n(t,e,r){this.json=t,this.extensions=e,this.options=r,this.cache=new Map,this.disposeSet=new Set,this.textureSet=new Set,this.nodeNamesUsed={}}return n.prototype.dispose=function(){this.cache.clear(),this.disposeSet.forEach(function(t){typeof t.dispose=="function"&&t.dispose(),typeof t.close=="function"&&t.close()}),this.disposeSet.clear(),this.textureSet.clear(),this.extensions={},this.json={asset:{version:"unknown"}}},n.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],i=0,o=e.length;i<o;i++)for(var s=e[i].joints,u=0,c=s.length;u<c;u++)t[s[u]].isBone=!0;for(var l=0,d=t.length;l<d;l++){var f=t[l];f.mesh!==void 0&&f.skin!==void 0&&(r[f.mesh].isSkinnedMesh=!0)}},n.prototype.parse=function(){var t=this,e=this.json,r=this.extensions;this.markDefs();for(var i=0,o=values(r);i<o.length;i++){var s=o[i];s.markDefs(this)}return Promise.all(values(r).map(function(u){return u.prepare(t)})).then(function(){var u,c,l;return Promise.all([Promise.all(((u=e.scenes)!==null&&u!==void 0?u:[]).map(function(d,f){return t.loadScene(f)})),Promise.all(((c=e.animations)!==null&&c!==void 0?c:[]).map(function(d,f){return t.loadAnimation(f)})),Promise.all(((l=e.cameras)!==null&&l!==void 0?l:[]).map(function(d,f){return t.loadCamera(f)}))])}).then(function(u){var c=u[0],l=u[1],d=u[2],f={json:e,scene:c[e.scene||0],scenes:c,animations:l,cameras:d,textures:[],dispose:noop$1};return f}).then(function(u){return Promise.all(values(r).map(function(c){return c.emitResult(u,t)})).then(function(){return u})}).then(function(u){var c=Array.from(t.textureSet),l=composeDsiposeSet(t.disposeSet);return Object.assign(u,{textures:c,dispose:l}),t.textureSet.clear(),t.disposeSet.clear(),t.dispose(),u})},n.prototype.loadCamera=function(t){var e="camera:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadCamera(t,this),i)break}if(!i){var c=void 0,l=this.json.cameras[t],d=l[l.type];d?l.type==="perspective"?c=new THREE__namespace.PerspectiveCamera(THREE__namespace.MathUtils.radToDeg(d.yfov),d.aspectRatio||1,d.znear||1,d.zfar||2e6):l.type==="orthographic"?c=new THREE__namespace.OrthographicCamera(-d.xmag,d.xmag,d.ymag,-d.ymag,d.znear,d.zfar):(console.warn("glTF: Invalid camera type ".concat(l.type,".")),c=new THREE__namespace.Camera):(console.warn("glTF: Missing camera parameters."),c=new THREE__namespace.Camera),l.name&&(c.name=this.createUniqueName(l.name)),i=Promise.resolve(c)}return this.cache.set(e,i),i},n.prototype.loadSkin=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;var i,o=this.json.skins[t],s={joints:o.joints};return o.inverseBindMatrices===void 0?i=Promise.resolve(s):i=this.loadAccessor(o.inverseBindMatrices).then(function(u){return u&&(s.inverseBindMatrices=u),s}),this.cache.set(e,i),i},n.prototype.loadAnimation=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadAnimation(t,this),i)break}if(!i){for(var c=this.json,l=c.animations[t],d=[],f=[],m=[],A=[],h=[],p=0,y=l.channels.length;p<y;p++){var v=l.channels[p],g=l.samplers[v.sampler],E=v.target,b=E.node!==void 0?E.node:E.id,T=l.parameters!==void 0?l.parameters[g.input]:g.input,x=l.parameters!==void 0?l.parameters[g.output]:g.output;d.push(this.loadNode(b)),f.push(this.loadAccessor(T)),m.push(this.loadAccessor(x)),A.push(g),h.push(E)}i=Promise.all([Promise.all(d),Promise.all(f),Promise.all(m),Promise.all(A),Promise.all(h)]).then(function(R){for(var _=R[0],M=R[1],S=R[2],I=R[3],C=R[4],H=[],B=function(G,z){var D=_[G],U=M[G],K=S[G],Q=I[G],q=C[G];if(D===void 0)return"continue";D.updateMatrix(),D.matrixAutoUpdate=!0;var J=void 0;switch(PATH_PROPERTIES[q.path]){case PATH_PROPERTIES.weights:J=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:J=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:J=THREE__namespace.VectorKeyframeTrack;break}var W=D.name?D.name:D.uuid,re=Q.interpolation!==void 0?INTERPOLATION[Q.interpolation]:THREE__namespace.InterpolateLinear,j=[];PATH_PROPERTIES[q.path]===PATH_PROPERTIES.weights?D.traverse(function(se){se.morphTargetInfluences&&j.push(se.name?se.name:se.uuid)}):j.push(W);var te=K.array;if(K.normalized){for(var $=getNormalizedComponentScale(te.constructor),ne=new Float32Array(te.length),ee=0,fe=te.length;ee<fe;ee++)ne[ee]=te[ee]*$;te=ne}for(var ee=0,fe=j.length;ee<fe;ee++){var ie=new J(j[ee]+"."+PATH_PROPERTIES[q.path],U.array,te,re);H.push(ie)}},L=0,O=_.length;L<O;L++)B(L);var k=l.name?l.name:"animation_"+t;return new THREE__namespace.AnimationClip(k,void 0,H)})}return this.cache.set(e,i),i},n.prototype.loadBuffer=function(t){var e=this.json.buffers[t];if(e.type&&e.type!=="arraybuffer")throw new Error("glTF: "+e.type+" buffer type is not supported.");var r="buffer:"+t,i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var c=u[s];if(o=c.loadBuffer(t,this),o)break}if(!o){var l=this.json.buffers[t];o=this.options.fetcher.ajax(this.resolveResouce(l.uri),{responseType:"arraybuffer"}).then(function(d){return d.body})}return this.cache.set(r,o),o},n.prototype.loadBufferView=function(t){var e="bufferView:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadBufferView(t,this),i)break}if(!i){var c=this.json.bufferViews[t];i=this.loadBuffer(c.buffer).then(function(l){var d=c.byteLength||0,f=c.byteOffset||0;return l.slice(f,f+d)})}return this.cache.set(e,i),i},n.prototype.loadAccessor=function(t){var e=this,r="accessor:"+t,i=this.cache.get(r);if(i)return i;var o=null;if(!o){var s=this.json.accessors[t];if(s.bufferView===void 0&&s.sparse===void 0)o=Promise.resolve(null);else{var u=[];s.bufferView!==void 0?u.push(this.loadBufferView(s.bufferView)):u.push(Promise.resolve(null)),s.sparse!==void 0&&(u.push(this.loadBufferView(s.sparse.indices.bufferView)),u.push(this.loadBufferView(s.sparse.values.bufferView))),o=Promise.all(u).then(function(c){var l=c[0],d=WEBGL_TYPE_SIZES[s.type],f=WEBGL_COMPONENT_TYPES[s.componentType],m=f.BYTES_PER_ELEMENT,A=m*d,h=s.byteOffset||0,p=s.bufferView!==void 0?e.json.bufferViews[s.bufferView].byteStride:void 0,y=s.normalized===!0,v,g;if(p&&p!==A){var E=Math.floor(h/p),b="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+E+":"+s.count,T=e.cache.get(b);T||(v=new f(l,E*p,s.count*p/m),T=new THREE__namespace.InterleavedBuffer(v,p/m),e.cache.set(b,T)),g=new THREE__namespace.InterleavedBufferAttribute(T,d,h%p/m,y)}else l===null?v=new f(s.count*d):v=new f(l,h,s.count*d),g=new THREE__namespace.BufferAttribute(v,d,y);if(s.sparse!==void 0){var x=WEBGL_TYPE_SIZES.SCALAR,R=WEBGL_COMPONENT_TYPES[s.sparse.indices.componentType],_=s.sparse.indices.byteOffset||0,M=s.sparse.values.byteOffset||0,S=new R(c[1],_,s.sparse.count*x),I=new f(c[2],M,s.sparse.count*d);l!==null&&(g=new THREE__namespace.BufferAttribute(g.array.slice(),g.itemSize,g.normalized));for(var C=0,H=S.length;C<H;C++){var B=S[C];if(g.setX(B,I[C*d]),d>=2&&g.setY(B,I[C*d+1]),d>=3&&g.setZ(B,I[C*d+2]),d>=4&&g.setW(B,I[C*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}}return this.cache.set(r,o),o},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=values(this.extensions);e<r.length;e++){var i=r[e],o=i.createPrimitiveKey(t,this);if(o)return o}for(var s="",u=Object.keys(t.attributes).sort(),c=0,l=u.length;c<l;c++)s+=u[c]+":"+t.attributes[u[c]]+";";return t.indices+":"+s+":"+t.mode},n.prototype.loadGeometry=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadGeometry(t,this),r)break}return r||(r=this.addGeometryPrimitiveAttributes(new THREE__namespace.BufferGeometry,t)),r=r.then(function(u){return e.disposeSet.add(u),u}),r},n.prototype.loadImage=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadImage(t,this),r)break}if(!r){var u=this.json.images[t];if(u.bufferView!==void 0){var c=this.json.bufferViews[u.bufferView];r=this.loadBuffer(c.buffer).then(function(d){var f=c.byteOffset||0,m=c.byteLength||0,A=new Uint8Array(d,f,m),h=new Blob([A],{type:u.mimeType});return createImageBitmapLike(h)})}else if(u.uri){var l=this.resolveResouce(u.uri);r=this.options.fetcher.loadImage(l,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(d){return d.body})}else throw new Error("glTF: Invalid image defs.")}return r=r.then(function(d){return e.disposeSet.add(d),d}),r},n.prototype.loadMaterialAsMeshStandardMaterial=function(t){var e=this,r=[],i=new THREE__namespace.MeshStandardMaterial;if(i.color=new THREE__namespace.Color(1,1,1),i.opacity=1,Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="normal"}).length===0&&(i.flatShading=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(i.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;i.color.fromArray(u),i.opacity=u[3]}s.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(s.baseColorTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,i.map=d,e.disposeSet.add(d)})),i.metalness=s.metallicFactor!==void 0?s.metallicFactor:1,i.roughness=s.roughnessFactor!==void 0?s.roughnessFactor:1,s.metallicRoughnessTexture!==void 0&&r.push(this.createMaterialTexture(s.metallicRoughnessTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,i.metalnessMap=d,i.roughnessMap=d,e.disposeSet.add(d)})),o.doubleSided===!0&&(i.side=THREE__namespace.DoubleSide);var c=o.alphaMode||ALPHA_MODES.OPAQUE;if(c===ALPHA_MODES.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,c===ALPHA_MODES.MASK&&(i.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&(r.push(this.createMaterialTexture(o.normalTexture).then(function(d){i.normalMap=d,e.disposeSet.add(d)})),i.normalScale=new THREE__namespace.Vector2(1,1),o.normalTexture.scale!==void 0)){var l=o.normalTexture.scale;i.normalScale.set(l,l)}o.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(o.occlusionTexture).then(function(d){i.aoMap=d,e.disposeSet.add(d)})),o.occlusionTexture.strength!==void 0&&(i.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&(i.emissive=new THREE__namespace.Color().fromArray(o.emissiveFactor)),o.emissiveTexture!==void 0&&r.push(this.createMaterialTexture(o.emissiveTexture).then(function(d){i.emissiveMap=d,e.disposeSet.add(d)}))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterialAsLineBasicMaterial=function(t){var e=[],r=new THREE__namespace.LineBasicMaterial;if(r.color=new THREE__namespace.Color(1,1,1),r.opacity=1,Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="color"}).length>0&&(r.vertexColors=!0),Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="tangent"}).length===0&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),t.material!==void 0){var i=this.json.materials[t.material];i.name&&(r.name=i.name);var o=i.pbrMetallicRoughness||{};if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;r.color.fromArray(s),r.opacity=s[3]}i.doubleSided===!0&&(r.side=THREE__namespace.DoubleSide);var u=i.alphaMode||ALPHA_MODES.OPAQUE;u===ALPHA_MODES.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,u===ALPHA_MODES.MASK&&(r.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5))}return this.disposeSet.add(r),Promise.all(e).then(function(){return r})},n.prototype.loadMaterialAsPointsMaterial=function(t){var e=this,r=[],i=new THREE__namespace.PointsMaterial;if(i.color=new THREE__namespace.Color(1,1,1),i.opacity=1,i.sizeAttenuation=!1,Object.keys(t.attributes).filter(function(l){return ATTRIBUTES[l]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(l){return ATTRIBUTES[l]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(i.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;i.color.fromArray(u),i.opacity=u[3]}s.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(s.baseColorTexture).then(function(l){l.encoding=THREE__namespace.sRGBEncoding,i.map=l,e.disposeSet.add(l)})),o.doubleSided===!0&&(i.side=THREE__namespace.DoubleSide);var c=o.alphaMode||ALPHA_MODES.OPAQUE;c===ALPHA_MODES.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,c===ALPHA_MODES.MASK&&(i.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterial=function(t){var e,r=(e=t.mode)!==null&&e!==void 0?e:WEBGL_CONSTANTS.TRIANGLES,i="material:"+this.createPrimitiveKey(t),o=this.cache.get(i);if(o)return o;for(var s=null,u=0,c=values(this.extensions);u<c.length;u++){var l=c[u];if(s=l.loadMaterial(t,this),s)break}if(r===WEBGL_CONSTANTS.TRIANGLES||r===WEBGL_CONSTANTS.TRIANGLE_STRIP||r===WEBGL_CONSTANTS.TRIANGLE_FAN)s=this.loadMaterialAsMeshStandardMaterial(t);else if(r===WEBGL_CONSTANTS.LINES||r===WEBGL_CONSTANTS.LINE_STRIP||r===WEBGL_CONSTANTS.LINE_LOOP)s=this.loadMaterialAsLineBasicMaterial(t);else if(r===WEBGL_CONSTANTS.POINTS)s=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+r);return this.cache.set(i,s),s},n.prototype.loadTexture=function(t){var e=this,r="texture:"+t,i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var c=u[s];if(o=c.loadTexture(t,this),o)break}if(!o){var l=this.json.textures[t];o=this.loadImage(l.source).then(function(d){var f=new THREE__namespace.Texture(d);f.needsUpdate=!0,f.flipY=!1,l.name&&(f.name=l.name);var m=e.json.samplers||{},A=m[l.sampler]||{};return f.magFilter=WEBGL_FILTERS[A.magFilter]||THREE__namespace.LinearFilter,f.minFilter=WEBGL_FILTERS[A.minFilter]||THREE__namespace.LinearMipmapLinearFilter,f.wrapS=WEBGL_WRAPPINGS[A.wrapS]||THREE__namespace.RepeatWrapping,f.wrapT=WEBGL_WRAPPINGS[A.wrapT]||THREE__namespace.RepeatWrapping,f.onUpdate=function(){d.close()},f})}return o=o.then(function(d){return e.disposeSet.add(d),d}),this.cache.set(r,o),o},n.prototype.loadMesh=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadMesh(t,this),r)break}if(!r){var u=this.json.meshes[t],c=u.primitives,l=Promise.all(c.map(function(f){return e.loadGeometry(f)})),d=Promise.all(c.map(function(f){return e.loadMaterial(f)}));r=Promise.all([l,d]).then(function(f){for(var m=f[0],A=f[1],h=[],p=0;p<c.length;p++){var y=c[p],v=m[p],g=A[p],E=y.mode||WEBGL_CONSTANTS.TRIANGLES,b=void 0;if(E===WEBGL_CONSTANTS.TRIANGLES||E===WEBGL_CONSTANTS.TRIANGLE_STRIP||E===WEBGL_CONSTANTS.TRIANGLE_FAN)if(E===WEBGL_CONSTANTS.TRIANGLE_STRIP?v=e.toGeometryTrianglesDrawMode(v,THREE__namespace.TriangleStripDrawMode):E===WEBGL_CONSTANTS.TRIANGLE_FAN&&(v=e.toGeometryTrianglesDrawMode(v,THREE__namespace.TriangleFanDrawMode)),e.disposeSet.add(v),u.isSkinnedMesh){var T=new THREE__namespace.SkinnedMesh(v,g);v.attributes.skinWeight.normalized||T.normalizeSkinWeights(),b=T}else b=new THREE__namespace.Mesh(v,g);else if(E===WEBGL_CONSTANTS.POINTS)b=new THREE__namespace.Points(v,g);else if(E===WEBGL_CONSTANTS.LINES)b=new THREE__namespace.LineSegments(v,g);else if(E===WEBGL_CONSTANTS.LINE_STRIP)b=new THREE__namespace.Line(v,g);else if(E===WEBGL_CONSTANTS.LINE_LOOP)b=new THREE__namespace.LineLoop(v,g);else throw new Error("glTF: Primitive mode unsupported: "+E);if(Object.keys(v.morphAttributes).length>0){if(u.weights!==void 0)for(var x=0,R=u.weights.length;x<R;x++)b.morphTargetInfluences[x]=u.weights[x];if(u.extras&&Array.isArray(u.extras.targetNames)){var _=u.extras.targetNames;if(b.morphTargetInfluences.length===_.length){b.morphTargetDictionary={};for(var x=0,R=_.length;x<R;x++)b.morphTargetDictionary[_[x]]=x}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}b.name=e.createUniqueName(u.name||"mesh_"+t),h.push(b)}if(h.length===1)return h[0];for(var M=new THREE__namespace.Group,S=0,I=h;S<I.length;S++){var b=I[S];M.add(b)}return M})}return r},n.prototype.loadNodeAttachments=function(t){for(var e=[],r=0,i=values(this.extensions);r<i.length;r++){var o=i[r],s=o.loadNodeAttachments(t,this);s&&e.push(s)}return e},n.prototype.loadNode=function(t){var e="node:"+t,r=this.cache.get(e);if(r)return r;var i=this.json,o=i.nodes[t],s=o.name?this.createUniqueName(o.name):"",u=[];o.mesh!==void 0&&u.push(this.loadMesh(o.mesh).then(function(m){if(o.weights!==void 0){var A=o.weights;m.traverse(function(h){if(h instanceof THREE__namespace.Mesh||h instanceof THREE__namespace.Line||h instanceof THREE__namespace.Points)for(var p=0,y=A.length;p<y;p++)h.morphTargetInfluences[p]=A[p]})}return m})),o.camera!==void 0&&u.push(this.loadCamera(o.camera));for(var c=this.loadNodeAttachments(t),l=0,d=c;l<d.length;l++){var f=d[l];u.push(f)}return Promise.all(u).then(function(m){var A;if(o.isBone===!0?A=new THREE__namespace.Bone:m.length>1?A=new THREE__namespace.Group:m.length===1?A=m[0]:A=new THREE__namespace.Object3D,A!==m[0])for(var h=0,p=m.length;h<p;h++)A.add(m[h]);if(o.name&&(A.name=s),o.matrix!==void 0){var y=new THREE__namespace.Matrix4;y.fromArray(o.matrix),A.applyMatrix4(y)}else o.translation!==void 0&&A.position.fromArray(o.translation),o.rotation!==void 0&&A.quaternion.fromArray(o.rotation),o.scale!==void 0&&A.scale.fromArray(o.scale);return A})},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],i=new THREE__namespace.Group;r.name&&(i.name=this.createUniqueName(r.name));for(var o=r.nodes||[],s=[],u=0,c=o.length;u<c;u++)s.push(this.buildNodeHierarchy(o[u],i));return Promise.all(s).then(function(){return i})},n.prototype.createMaterialTexture=function(t){var e=this;return this.loadTexture(t.index).then(function(r){for(var i=0,o=values(e.extensions);i<o.length;i++){var s=o[i],u=s.extendTexture(r,t,e);u&&(r=u,e.disposeSet.add(r))}return e.textureSet.add(r),r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,i=e.attributes,o=[],s=function(T){var x=ATTRIBUTES[T]||T.toLowerCase();if(x in t.attributes)return"continue";o.push(u.loadAccessor(i[T]).then(function(R){R&&t.setAttribute(x,R)}))},u=this;for(var c in i)s(c);e.indices!==void 0&&!t.index&&o.push(this.loadAccessor(e.indices).then(function(T){T&&t.setIndex(T)}));var l=new THREE__namespace.Box3;if(i.POSITION!==void 0){var d=this.json.accessors[i.POSITION],f=d.min,m=d.max;if(f!==void 0&&m!==void 0){if(l.set(new THREE__namespace.Vector3(f[0],f[1],f[2]),new THREE__namespace.Vector3(m[0],m[1],m[2])),d.normalized){var A=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);l.min.multiplyScalar(A),l.max.multiplyScalar(A)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var h=e.targets;if(h!==void 0){for(var p=new THREE__namespace.Vector3,y=new THREE__namespace.Vector3,v=0,g=h.length;v<g;v++){var E=h[v];if(E.POSITION!==void 0){var d=this.json.accessors[E.POSITION],f=d.min,m=d.max;if(f!==void 0&&m!==void 0){if(y.setX(Math.max(Math.abs(f[0]),Math.abs(m[0]))),y.setY(Math.max(Math.abs(f[1]),Math.abs(m[1]))),y.setZ(Math.max(Math.abs(f[2]),Math.abs(m[2]))),d.normalized){var A=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);y.multiplyScalar(A)}p.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}l.expandByVector(p)}t.boundingBox=l;var b=new THREE__namespace.Sphere;return l.getCenter(b.center),b.radius=l.min.distanceTo(l.max)/2,t.boundingSphere=b,Promise.all(o).then(function(){if(t.attributes.uv&&!t.attributes.uv2&&r.options.copyUV2&&t.setAttribute("uv2",t.attributes.uv),e.targets){for(var T=!1,x=!1,R=0,_=e.targets.length;R<_;R++){var M=e.targets[R];if(M.POSITION!==void 0&&(T=!0),M.NORMAL!==void 0&&(x=!0),T&&x)break}if(!T&&!x)return t;var S=[];t.morphTargetsRelative=!0;for(var I=function(C,H){var B=e.targets[C];T?S.push(r.loadAccessor(B.POSITION).then(function(L){L&&(t.morphAttributes.position[C]=L)})):t.morphAttributes.position[C]=t.attributes.position,x?S.push(r.loadAccessor(B.NORMAL).then(function(L){L&&(t.morphAttributes.normal[C]=L)})):t.morphAttributes.normal[C]=t.attributes.normal},R=0,_=e.targets.length;R<_;R++)I(R,_);return Promise.all(S).then(function(){return t})}else return t})},n.prototype.buildNodeHierarchy=function(t,e){var r=this,i=this.json.nodes[t];return this.loadNode(t).then(function(o){if(i.skin===void 0)return o;var s;return r.loadSkin(i.skin).then(function(u){s=u;for(var c=[],l=0,d=s.joints.length;l<d;l++)c.push(r.loadNode(s.joints[l]));return Promise.all(c)}).then(function(u){return o.traverse(function(c){if(c instanceof THREE__namespace.SkinnedMesh){for(var l=[],d=[],f=0,m=u.length;f<m;f++){var A=u[f];if(A instanceof THREE__namespace.Bone){l.push(A);var h=new THREE__namespace.Matrix4;s.inverseBindMatrices!==void 0&&h.fromArray(s.inverseBindMatrices.array,f*16),d.push(h)}else console.warn('glTF: Joint "%s" could not be found.',s.joints[f])}c.bind(new THREE__namespace.Skeleton(l,d),c.matrixWorld)}}),o})}).then(function(o){e.add(o);var s=[];if(i.children)for(var u=i.children,c=0,l=u.length;c<l;c++){var d=u[c];s.push(r.buildNodeHierarchy(d,o))}return Promise.all(s).then(function(){return o})})},n.prototype.createUniqueName=function(t){for(var e=THREE__namespace.PropertyBinding.sanitizeNodeName(t||""),r=e,i=1;this.nodeNamesUsed[r];++i)r=e+"_"+i;return this.nodeNamesUsed[r]=!0,r},n.prototype.resolveResouce=function(t){return pathJoin(this.options.resourcePath,appendSearch(t,this.options.search))},n.prototype.toGeometryTrianglesDrawMode=function(t,e){var r=t.getIndex();if(r===null){var i=[],o=t.getAttribute("position");if(o!==void 0){for(var s=0;s<o.count;s++)i.push(s);t.setIndex(i),r=t.getIndex()}}if(r===null)return console.error("glTF: Undefined position attribute. Processing not possible."),t;var u=r.count-2,c=[];if(e===THREE__namespace.TriangleFanDrawMode)for(var s=1;s<=u;s++)c.push(r.getX(0)),c.push(r.getX(s)),c.push(r.getX(s+1));else for(var s=0;s<u;s++)s%2===0?(c.push(r.getX(s)),c.push(r.getX(s+1)),c.push(r.getX(s+2))):(c.push(r.getX(s+2)),c.push(r.getX(s+1)),c.push(r.getX(s)));c.length/3!==u&&console.error("glTF: Unable to generate correct amount of triangles.");var l=t.clone();return l.setIndex(c),this.disposeSet.add(l),l},n}();function getNormalizedComponentScale(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("glTF: Unsupported normalized accessor component type.")}}var BaseExtension=function(){function n(){}return n.prototype.markDefs=function(t){},n.prototype.prepare=function(t){},n.prototype.emitResult=function(t,e){},n.prototype.createPrimitiveKey=function(t,e){},n.prototype.extendTexture=function(t,e,r){return null},n.prototype.loadBuffer=function(t,e){return null},n.prototype.loadBufferView=function(t,e){return null},n.prototype.loadImage=function(t,e){return null},n.prototype.loadTexture=function(t,e){return null},n.prototype.loadGeometry=function(t,e){return null},n.prototype.loadMaterial=function(t,e){return null},n.prototype.loadMesh=function(t,e){return null},n.prototype.loadNodeAttachments=function(t,e){return null},n.prototype.loadCamera=function(t,e){return null},n.prototype.loadAnimation=function(t,e){return null},n}(),KHR_binary_glTF=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.header={magic:"",version:0,length:0},e.content="",e.body=null,e}return t.getMagic=function(e){return decodeText(new Uint8Array(e.slice(0,4)))},t.prototype.loadGlbBinary=function(e){var r=new DataView(e,0,t.HEADER_LENGTH);if(this.header={magic:t.getMagic(e),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==t.HEADER_MAGIC)throw new Error("glTF:KHR_binary_glTF: Unsupported.");if(this.header.version<2)throw new Error("glTF:KHR_binary_glTF: Legacy binary file detected.");for(var i=new DataView(e,t.HEADER_LENGTH),o=0,s=null,u=null;o<i.byteLength;){var c=i.getUint32(o,!0);if(o+=4,c!==0){var l=i.getUint32(o,!0);if(o+=4,l===t.CHUNK_TYPES.JSON){var d=new Uint8Array(e,t.HEADER_LENGTH+o,c);s=decodeText(d)}else if(l===t.CHUNK_TYPES.BIN){var f=t.HEADER_LENGTH+o;u=e.slice(f,f+c)}o+=c}}if(s===null)throw new Error("glTF:KHR_binary_glTF: JSON content not found.");this.content=s,this.body=u},t.prototype.loadBuffer=function(e,r){var i=r.json.buffers[e];return i.uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null},t.prototype.clear=function(){this.body=null,this.content=""},t.HEADER_MAGIC="glTF",t.HEADER_LENGTH=12,t.CHUNK_TYPES={JSON:1313821514,BIN:5130562},t}(BaseExtension),defaultDecoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},Draco=function(){function n(){this.decoderPath=defaultDecoderPath,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=""}return n.prototype.setDecoderPath=function(t){this.decoderPath=t},n.prototype.setDecoderConfig=function(t){return this.decoderConfig=t,this},n.prototype.setWorkerLimit=function(t){return this.workerLimit=t,this},n.prototype.decodeDracoFile=function(t,e,r,i){var o={attributeIDs:r||defaultAttributeIDs,attributeTypes:i||defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(t,o).then(e)},n.prototype.decodeGeometry=function(t,e){var r=this;e===void 0&&(e={attributeIDs:defaultAttributeIDs,attributeTypes:defaultAttributeTypes,useUniqueIDs:!1});for(var i in e.attributeTypes){var o=e.attributeTypes[i];o.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[i]=o.name)}var s,u=this.workerNextTaskID++,c=t.byteLength,l=this._getWorker(u,c).then(function(d){return s=d,new Promise(function(f,m){s._callbacks[u]={resolve:f,reject:m},s.postMessage({type:"decode",id:u,taskConfig:e,buffer:t},[t])})}).then(function(d){return r._createGeometry(d.geometry)});return l.catch(function(){return!0}).then(function(){s&&u&&r._releaseTask(s,u)}),l},n.prototype._createGeometry=function(t){var e=new THREE__namespace.BufferGeometry;t.index&&e.setIndex(new THREE__namespace.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var i=t.attributes[r],o=i.name,s=i.array,u=i.itemSize;e.setAttribute(o,new THREE__namespace.BufferAttribute(s,u))}return e},n.prototype._initDecoder=function(){var t=this;if(this.decoderPending)return this.decoderPending;var e=typeof WebAssembly!="object"||this.decoderConfig.type==="js";if(e){var r=ajax(this.decoderPath+"draco_decoder.js",{responseType:"text"}).then(function(o){return o.body});this.decoderPending=r.then(function(o){var s=["/* draco decoder */",o,"","/* worker */",DRACOWorker].join(`
417
+ `,cacheMaterials=[],cameraPX=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPX.up.set(0,-1,0),cameraPX.lookAt(new THREE__namespace.Vector3(1,0,0)),cameraPX.updateMatrix(),cameraPX.matrixAutoUpdate=!1;var cameraNX=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNX.up.set(0,-1,0),cameraNX.lookAt(new THREE__namespace.Vector3(-1,0,0)),cameraNX.updateMatrix(),cameraNX.matrixAutoUpdate=!1;var cameraPY=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPY.up.set(0,0,1),cameraPY.lookAt(new THREE__namespace.Vector3(0,1,0)),cameraPY.updateMatrix(),cameraPY.matrixAutoUpdate=!1;var cameraNY=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNY.up.set(0,0,-1),cameraNY.lookAt(new THREE__namespace.Vector3(0,-1,0)),cameraNY.updateMatrix(),cameraNY.matrixAutoUpdate=!1;var cameraPZ=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraPZ.up.set(0,-1,0),cameraPZ.lookAt(new THREE__namespace.Vector3(0,0,1)),cameraPZ.updateMatrix(),cameraPZ.matrixAutoUpdate=!1;var cameraNZ=new THREE__namespace.PerspectiveCamera(90,1,.1,2);cameraNZ.up.set(0,-1,0),cameraNZ.lookAt(new THREE__namespace.Vector3(0,0,-1)),cameraNZ.updateMatrix(),cameraNZ.matrixAutoUpdate=!1;var FACES={front:{camera:cameraPZ,index:4},back:{camera:cameraNZ,index:5},up:{camera:cameraPY,index:2},down:{camera:cameraNY,index:3},left:{camera:cameraNX,index:1},right:{camera:cameraPX,index:0}};function getMaterial(){var n=cacheMaterials.pop();return n||new THREE__namespace.ShaderMaterial({uniforms:{map:{value:null},flipY:{value:0}},vertexShader:PLANE_VERTEX_SHADER,fragmentShader:PLANE_FRAGMENT_SHADER,depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:THREE__namespace.NoBlending,lights:!1,toneMapped:!1,fog:!1})}function releaseMaterial(n){n.uniforms.map.value=null,cacheMaterials.push(n)}function renderTexturesToCubeRenderTarget(n,t,e){var r=new THREE__namespace.Scene;r.matrixAutoUpdate=!1;var i=new THREE__namespace.Group;i.scale.set(1,1,-1),r.add(i);for(var o=[],s=new Set,u=0,c=n;u<c.length;u++){var l=c[u];s.add(l.face);var d=getMaterial();o.push(d),d.uniforms.map.value=l.texture,d.uniforms.flipY.value=l.flipY?1:0;var f=new THREE__namespace.Group,m=new THREE__namespace.Mesh(PLAME_GEOMETRY,d);m.position.set(l.position.x+l.size.x/2-.5,1-(l.position.y+l.size.y/2)-.5,-.5),m.scale.set(l.size.x,l.size.y,1),f.quaternion.copy(QUATERNION[l.face]),f.add(m),i.add(f)}var A=e.autoClear,h=e.sortObjects,p=e.xr.enabled,y=t.texture.generateMipmaps;e.autoClear=!1,e.sortObjects=!1,e.xr.enabled=!1,t.texture.generateMipmaps=!1;var v=e.getRenderTarget(),g=0;s.forEach(function(T){++g===s.size&&(t.texture.generateMipmaps=y),e.setRenderTarget(t,FACES[T].index),e.render(r,FACES[T].camera)}),e.setRenderTarget(v),e.autoClear=A,e.sortObjects=h,e.xr.enabled=p;for(var E=0,b=o;E<b.length;E++){var d=b[E];releaseMaterial(d)}}var canUseNativeImageBitmap=function(){return!1}();function createImageBitmapLikeImage(n){n===void 0&&(n={});var t=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){n.onClose&&n.onClose.call(this),this.onerror=this.onload=this.close=noop$1,this.removeAttribute("src")}});return t}function createImageBitmapLike(n){return new Promise(function(t,e){var r=URL.createObjectURL(n),i=createImageBitmapLikeImage({onClose:function(){this.src===r&&URL.revokeObjectURL(r)}});i.onload=function(){i.src===r&&URL.revokeObjectURL(r),i.onload=i.onerror=noop$1,setTimeout(function(){t(i)},10)},i.onerror=function(){var o=i.src;i.onload=i.onerror=noop$1,i.close(),e(new Error("image load error: ".concat(o)))},i.decoding="async",i.src=r})}var canvasPool=[];function createCanvas(n,t){var e=canvasPool.shift();if(e)return e.width=n,e.height=t,e;var r=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),{close:function(){r.close=noop$1,canvasPool.push(r)}});return r}function poolImageToTexture(n,t){if(t&&(n.width>t.width||n.height>t.height)){var e=createCanvas(Math.min(n.width,t.width),Math.min(n.height,t.height)),r=e.getContext("2d");r.clearRect(0,0,e.width,e.height),r.drawImage(n,0,0,e.width,e.height),n.close();var i=new THREE__namespace.Texture(e);i.needsUpdate=!0,i.flipY=!0;var o=i.dispose;return i.dispose=function(){e.close(),o.call(i),i.dispose=o},i}else{var s=new THREE__namespace.Texture(n);s.needsUpdate=!0,typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?s.flipY=!1:s.flipY=!0;var u=s.dispose;return s.dispose=function(){n.close(),u.call(s),s.dispose=u},s}}function poolImagesToCubeTexture(n){var t=new THREE__namespace.CubeTexture(n);t.needsUpdate=!0,t.flipY=!1;var e=t.dispose;return t.dispose=function(){for(var r=0,i=n;r<i.length;r++){var o=i[r];o.close()}e.call(t),t.dispose=e},t}var FACE_ORDER=["right","left","up","down","front","back"],TileCubeTextureTarget=function(){function n(t,e,r,i,o){this.tileTree=e,this.tileSources=r,this.options=i,this.renderer=o,this.name="",this.needsRender=!1,this.maxRequest=n.DEFAULT_MAX_REQUEST,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.textures=[],this.baseCubeTexture=t}return Object.defineProperty(n.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(t){var e,r,i,o,s,u;if(t===null)throw new Error("cannot set cubeRenderTarget to null.");t.width!==this.options.textureSize&&t.setSize(this.options.textureSize,this.options.textureSize),t.texture.format=(e=this.options.format)!==null&&e!==void 0?e:THREE__namespace.RGBAFormat,t.texture.minFilter=(r=this.options.minFilter)!==null&&r!==void 0?r:THREE__namespace.LinearFilter,t.texture.magFilter=(i=this.options.magFilter)!==null&&i!==void 0?i:THREE__namespace.LinearFilter,t.texture.wrapS=(o=this.options.wrapS)!==null&&o!==void 0?o:THREE__namespace.ClampToEdgeWrapping,t.texture.wrapT=(s=this.options.wrapT)!==null&&s!==void 0?s:THREE__namespace.ClampToEdgeWrapping,t.texture.generateMipmaps=(u=this.options.generateMipmaps)!==null&&u!==void 0?u:!1,this.baseCubeTexture&&(renderCubeTextureToCubeRenderTarget(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&renderCubeTextureToCubeRenderTarget(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),n.prototype.requestTile=function(t){var e=this,r,i,o,s,u,c,l=this.tileSources.filter(function(p){return p.level===t.level})[0];if(!l){this.loadedCubeNodes.add(t);return}var d=l.size,f=Math.pow(2,t.level)*t.position.y,m=Math.pow(2,t.level)*t.position.x,A="".concat(((o=(i=(r=this.options.imageURL)===null||r===void 0?void 0:r.options)===null||i===void 0?void 0:i.key)!==null&&o!==void 0?o:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(f,".").concat(m),h=__assign(__assign({},(u=(s=this.options.imageURL)===null||s===void 0?void 0:s.options)!==null&&u!==void 0?u:{key:"unknown"}),{key:A,size:l.scale>=1?void 0:d*t.size*l.scale,quality:void 0,cut:[d*t.position.x,d*t.position.y,d*t.size,d*t.size]});this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(l[t.face],{imageURL:{transform:(c=this.options.imageURL)===null||c===void 0?void 0:c.transform,options:__assign({},h)},format:THREE__namespace.RGBAFormat,timeout:this.options.timeout,magFilter:this.options.magFilter,minFilter:this.options.minFilter,fetcher:this.options.fetcher}).then(function(p){if(e.disposed){p.body.dispose();return}e.textures.push({face:t.face,level:t.level,position:t.position,size:new THREE__namespace.Vector2(t.size,t.size),texture:p.body,flipY:!p.body.flipY}),e.loadedCubeNodes.add(t)}).catch(noop$1).then(function(){e.disposed||e.loadingCubeNodes.delete(t)})},n.prototype.update=function(t,e){var r=this;if(!this.disposed){var i=[];traverseTileCubeNode(this.tileTree,function(f){if(!(i.length>r.maxRequest-r.loadingCubeNodes.size)){if(r.loadingCubeNodes.has(f)||f.level>e||!t.intersectsBox(f.box))return!1;if(!r.loadedCubeNodes.has(f))return i.push(f),!1}});for(var o=0,s=i;o<s.length;o++){var u=s[o];this.requestTile(u)}if(this.cubeRenderTarget&&this.textures.length){renderTexturesToCubeRenderTarget(this.textures,this.cubeRenderTarget,this.renderer);for(var c=0,l=this.textures;c<l.length;c++){var d=l[c];d.texture.dispose()}this.textures.length=0,this.needsRender=!0}}},Object.defineProperty(n.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),n.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var t=0,e=this.textures;t<e.length;t++){var r=e[t];r.texture.dispose()}this.textures.length=0}},n.DEFAULT_MAX_REQUEST=3,n}(),TextureLoader=function(){function n(){}return n.prototype.loadTexture=function(t,e,r,i,o,s){var u,c,l,d,f,m,A;r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var h={};typeof e.flipY!="undefined"&&(h.flipY=e.flipY),typeof e.format!="undefined"&&(h.format=e.format),typeof e.encoding!="undefined"&&(h.encoding=e.encoding),h.generateMipmaps=(u=e.generateMipmaps)!==null&&u!==void 0?u:!1,h.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,h.magFilter=(l=e.magFilter)!==null&&l!==void 0?l:THREE__namespace.LinearFilter;var p=(f=(d=e.imageURL)===null||d===void 0?void 0:d.options)!==null&&f!==void 0?f:{key:"unknown"};t=applyImageURLOptions(t,(m=e.imageURL)===null||m===void 0?void 0:m.transform,p);var y=getProtocol(t),v=(A=e.viaAjax)!==null&&A!==void 0?A:canUseNativeImageBitmap,g=isJsonpSource(t),E=/^https?:/.test(y);if(g?v=!0:E||(v=!1),v){var b=null,T="blob";return e.fetcher.ajax(t,{timeout:e.timeout,responseType:T},void 0,void 0,o).then(function(_){return createImageBitmapLike(_.body)}).then(function(_){return poolImageToTexture(_,e.maxSize)}).then(function(_){return Object.assign(_,h),_}).then(function(_){var M={meta:b,body:_};return r(M),M}).catch(function(_){return i(_),Promise.reject(_)})}else{var x=null,R;return Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(_){return R=_,e.fetcher.loadImage(t,{timeout:e.timeout},void 0,void 0,o,_)}).then(function(_){return x=_.meta,poolImageToTexture(_.body,e.maxSize)}).then(function(_){return Object.assign(_,h),_}).then(function(_){var M={meta:x,body:_};return r(M),M}).catch(function(_){return R&&R.close(),i(_),Promise.reject(_)})}},n.prototype.loadCubeTexture=function(t,e,r,i,o,s){var u,c,l,d,f,m,A;r===void 0&&(r=noop$1),i===void 0&&(i=noop$1),o===void 0&&(o=noop$1);var h={};typeof e.format!="undefined"&&(h.format=e.format),h.generateMipmaps=(u=e.generateMipmaps)!==null&&u!==void 0?u:!1,h.minFilter=(c=e.minFilter)!==null&&c!==void 0?c:THREE__namespace.LinearFilter,h.magFilter=(l=e.magFilter)!==null&&l!==void 0?l:THREE__namespace.LinearFilter;for(var p=[t[FACE_ORDER[0]],t[FACE_ORDER[1]],t[FACE_ORDER[2]],t[FACE_ORDER[3]],t[FACE_ORDER[4]],t[FACE_ORDER[5]]],y=[],v=[0,0,0,0,0,0],g=[],E=function(T){var x=(f=(d=e.imageURL)===null||d===void 0?void 0:d.options)!==null&&f!==void 0?f:{key:"unknown"},R=applyImageURLOptions(p[T],(m=e.imageURL)===null||m===void 0?void 0:m.transform,__assign(__assign({},x),{key:x.key+"."+FACE_ORDER[T]})),_=getProtocol(R),M=function(O){v[T]=O,o(v.reduce(function(k,G){return k+G},0)/6)},S=(A=e.viaAjax)!==null&&A!==void 0?A:!1,I=/^https?:$/.test(_),C=isJsonpSource(R);if(C?S=!0:I||(S=!1),S){var H="blob",B=e.fetcher.ajax(R,{timeout:e.timeout,responseType:H},void 0,void 0,M).then(function(O){return g[T]=O.meta,createImageBitmapLike(O.body)});y.push(B)}else{var L,B=Promise.resolve().then(function(){return createImageBitmapLikeImage()}).then(function(k){return L=k,e.fetcher.loadImage(R,{timeout:e.timeout},void 0,void 0,M,k)}).then(function(k){return g[T]=k.meta,k.body}).catch(function(k){return L&&L.close(),Promise.reject(k)});y.push(B)}},b=0;b<6;b++)E(b);return Promise.all(y).then(function(T){return poolImagesToCubeTexture(T)}).then(function(T){return Object.assign(T,__assign({encoding:THREE__namespace.sRGBEncoding},h)),T}).then(function(T){var x={body:T,meta:g};return r(x),x}).catch(function(T){for(var x=0,R=y;x<R.length;x++){var _=R[x];_.then(function(M){return M.close()}).catch(noop$1)}return i(T),Promise.reject(T)})},n.prototype.loadTiledCubeTexture=function(t,e,r,i,o,s,u){var c=this;return i===void 0&&(i=noop$1),o===void 0&&(o=noop$1),s===void 0&&(s=noop$1),new Promise(function(l,d){var f,m;c.loadCubeTexture(t,{imageURL:{transform:(f=r.imageURL)===null||f===void 0?void 0:f.transform,options:(m=r.imageURL)===null||m===void 0?void 0:m.options},format:THREE__namespace.RGBAFormat,viaAjax:r.viaAjax,timeout:r.timeout,fetcher:r.fetcher,magFilter:r.magFilter,minFilter:r.minFilter,generateMipmaps:r.generateMipmaps},function(A){var h,p=A.meta,y=A.body,v=(h=r.tileMaxLevel)!==null&&h!==void 0?h:2,g=Math.max(1024*v,512),E=createTileCubeTree(v),b=new TileCubeTextureTarget(y,E,e,{textureSize:g,textureLoader:c,imageURL:r.imageURL,magFilter:r.magFilter,minFilter:r.minFilter,generateMipmaps:r.generateMipmaps,timeout:r.timeout,fetcher:r.fetcher},u),T={meta:p,body:b};i(T),l(T)},function(A){o(A),d(A)},s,u).catch(noop$1)})},n}();const meshNoneVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("n\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07K|vq-znv{56-\n--0v{pyqr-Ixv{onrlrr\x07K--0v{pyqr-Iortv{lrr\x07K--0v{pyqr-Iz|}untrlrr\x07K--0v{pyqr-Ixv{{v{tlrr\x07K--0v{pyqr-I}|wrplrr\x07K--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K\f"),meshNoneFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|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{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-?;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J--qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--tylSntP|y|;n-J-|}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K\f"),meshBasicVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6--nvor-sy|n-sy||H0ryr--{vs|z-sy|n-sy||H0r{qvsn\bv{t-sy|n-Sy||H0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs0vs-qrsv{rq5b`RlcR_aRelZN_X6--nvor-sy|n-znxH0r{qvsn\bv{t-sy|n-V_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-cvr]|vv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrr\x07K0v{pyqr-I?l}nlrr\x07K0v{pyqr-Ir{zn}l}nlrr\x07K0v{pyqr-Ip|y|l}nlrr\x07K0v{pyqr-Is|tl}nlrr\x07K0v{pyqr-Iz|}untrl}nlrr\x07K0v{pyqr-Ixv{{v{tl}nlrr\x07K0v{pyqr-Iy|tqr}uosl}nlrr\x07K0v{pyqr-Ipyv}}v{tl}yn{rl}nlrr\x07K|vq-znv{56-\n--0v{pyqr-Ilrr\x07K--0v{pyqr-I?lrr\x07K--0v{pyqr-Ip|y|lrr\x07K--0v{pyqr-Ixv{onrlrr\x07K--0vsqrs-b`RlR[cZN]--0v{pyqr-Iortv{{|znylrr\x07K--0v{pyqr-Iz|}u{|znylrr\x07K--0v{pyqr-Ixv{{|znylrr\x07K--0v{pyqr-Iqrsny{|znylrr\x07K--0r{qvs--0v{pyqr-Iortv{lrr\x07K--0v{pyqr-Iz|}untrlrr\x07K--0v{pyqr-Ixv{{v{tlrr\x07K--0v{pyqr-I}|wrplrr\x07K--0v{pyqr-Iy|tqr}uoslrr\x07K--0v{pyqr-Ipyv}}v{tl}yn{rlrr\x07K--cvr]|vv|{-J-:z]|vv|{;\x07\b H--Sy||-J-sy||H--d|yq]|vv|{-J-rpA5n{s|zrq9->;=6H--0vsqrs-b`RlV[`aN[PV[T----d|yq]|vv|{-J-v{n{prZnv\x07-7-d|yq]|vv|{H--0r{qvs--d|yq]|vv|{-J-z|qryZnv\x07-7-d|yq]|vv|{H--zn@-pnzrn_|nv|{Znv\x07-J-zn@5vrZnv\x07h=jh=j9-vrZnv\x07h>jh=j9-vrZnv\x07h?jh=j9-vrZnv\x07h=jh>j9-vrZnv\x07h>jh>j9-vrZnv\x07h?jh>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--V_||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----V_||sZnx-J-r}5no5znx-:->;=69-=;>6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Ir{zn}lrr\x07K--0v{pyqr-Is|tlrr\x07K\f"),meshBasicFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs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}lp|zz|{l}nlsntzr{K0v{pyqr-Ir{zn}l}nlsntzr{K0v{pyqr-Iporllrsyrpv|{lsntzr{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-I}rpynzn}l}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{Krp@- ||zcrp|5rp@-qvrpv|{9-rp@-rp|9-sy|n- ||z6-\n--sy|n-urn-J-q|5qvrpv|{9-rp|6H--rp@-q-J-qvrpv|{-7-urnH--rp@-}-J-rp|-:-qH--rp@-\0-J-}-7- ||zH--r{-{|znyv r5q-8-\x006H\f|vq-znv{56-\n--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----V_||sZnx-K-=;B-33----d|yq]|vv|{;\b-K-z|qryO|{qv{tZn\x07;\b-:-||sP]|tr-7-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6--6-\n----qvpnqH--\f--<<-JJJJJJJJJJJJJJ--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5Sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--rpA-qvssrP|y|-J-rpA5-qvssr9-|}npv\b-6H--0v{pyqr-Iy|tqr}uoslsntzr{K--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-6-6H--<<-nppzynv|{-5onxrq-v{qvrp-yvtuv{t-|{y\b6--0vsqrs-b`RlYVTUaZN]----rpA-yvtuZn}ar\x07ryJ-r\x07r?Q5-yvtuZn}9-b?-6H----rsyrprqYvtu;v{qvrpQvssr-8J-yvtuZn}ar\x07rya|Yv{rn5-yvtuZn}ar\x07ry-6;to-7-yvtuZn}V{r{v\bH--0ryr----rsyrprqYvtu;v{qvrpQvssr-8J-rp@5->;=-6H--0r{qvs--<<-z|qynv|{--0v{pyqr-In|zn}lsntzr{K--rsyrprqYvtu;v{qvrpQvssr-7J-qvssrP|y|;toH--rp@-|t|v{tYvtu-J-rsyrprqYvtu;v{qvrpQvssrH--0v{pyqr-Ir{zn}lsntzr{K--tylSntP|y|-J-rpA5-|t|v{tYvtu9-qvssrP|y|;n-6H--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;FF-33-no5Sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;>-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJ--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-?;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J-qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--<<-JJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs\f"),meshPhongVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-]U\\[T0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6--nvor-sy|n-sy||H0ryr--{vs|z-sy|n-sy||H0r{qvsn\bv{t-sy|n-Sy||H0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs0vs-qrsv{rq5b`RlcR_aRelZN_X6--nvor-sy|n-znxH0r{qvsn\bv{t-sy|n-V_||sZnxHn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-cvr]|vv|{H0vs{qrs-SYNal`UNQRQ--n\bv{t-rp@-[|znyH0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrr\x07K0v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>j9-vrZnv\x07h=jh?j9-vrZnv\x07h>jh?j9-vrZnv\x07h?jh?j6H--PnzrnQvrpv|{-J-{|znyv r5pnzrn_|nv|{Znv\x07-7-rp@5=;=9-=;=9-:>;=66H--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--V_||sZnx-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelZN_X6----V_||sZnx-J-r}5no5znx-:->;=69-=;>6H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Ir{zn}lrr\x07K--0v{pyqr-Iunq|zn}lrr\x07K--0v{pyqr-Is|tlrr\x07K\f"),meshPhongFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0qrsv{r-]U\\[T0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=6{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznv\x07H{vs|z-sy|n-}n{|=l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznv\x07H{vs|z-sy|n-}n{|>l ||zH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvsp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvs0vs-qrsv{rq5b`RlRQY6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-qH--rp@-\0-J-}-7- ||zH--r{-{|znyv r5q-8-\x006H\f|vq-znv{56-\n--<<-JJJ-顶部裁切-JJJ--sy|n-||sP]|tr-J-}|5pynz}5:PnzrnQvrpv|{;\b9-=;=9->;=69-@;=6H--vs-5----V_||sZnx-K-=;B-33----d|yq]|vv|{;\b-K-z|qryO|{qv{tZn\x07;\b-:-||sP]|tr-7-5z|qryO|{qv{tZn\x07;\b-:-z|qryO|{qv{tZv{;\b6--6-\n----qvpnqH--\f--<<-JJJJJJJJJJJJJJ--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5Sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--0v{pyqr-Ipyv}}v{tl}yn{rlsntzr{K--rpA-qvssrP|y|-J-rpA5-qvssr9-|}npv\b-6H--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-69-rp@5-=;=-6-6H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Iy|tqr}uoslsntzr{K--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--<<-nppzynv|{--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--<<-z|qynv|{--0v{pyqr-In|zn}lsntzr{K--rp@-|t|v{tYvtu-J-rsyrprqYvtu;qvrpQvssr-8-rsyrprqYvtu;v{qvrpQvssr-8-rsyrprqYvtu;qvrp`}rpyn-8-rsyrprqYvtu;v{qvrp`}rpyn-8-|nyRzvvr_nqvn{prH--0v{pyqr-Ir{zn}lsntzr{K--tylSntP|y|-J-rpA5-|t|v{tYvtu9-qvssrP|y|;n-6H--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;FF-33-no5Sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;>-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\b-7-ovtu{rH--<<-JJJJJJJJJJJJJJ--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--<<-JJJ-全景图-JJJ--rp@-}n{|=a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|=lznv\x07h@j;\x07\b 6H--}n{|=a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|=a|crr\x079-}n{|=l ||z6H--}n{|=a|crr\x07-J-}n{|=a|crr\x07-7-zn@5}n{|=lznv\x076H--rp@-}n{|>a|crr\x07-J-{|znyv r5d|yq]|vv|{;\x07\b -:-}n{|>lznv\x07h@j;\x07\b 6H--}n{|>a|crr\x07-J- ||zcrp|5PnzrnQvrpv|{9-}n{|>a|crr\x079-}n{|>l ||z6H--}n{|>a|crr\x07-J-}n{|>a|crr\x07-7-zn@5}n{|>lznv\x076H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-r\x07rPor5}n{|=lzn}9-}n{|=a|crr\x076H--rpA-}n{|>P|y|-J-r\x07rPor5}n{|>lzn}9-}n{|>a|crr\x076H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-r\x07rPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr\x076;H----}n{|>P|y|;n-J->;=-:-r\x07rPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr\x076;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv\x075}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv\x075}n{|P|y|9-}n{|>P|y|9-zn\x075=;=9-oynpx]|tr-:-?;=66H--0ryvs-qrsv{rq5b`Rl`]_RNQla_N[`VaV\\[6----rp?-prr{Pr{rP||q-J-r|yv|{-7-}v\x07ry_nv|-<-?;=H----sy|n-n{vv|{_nqv-J-qvn{pr5rp?5=;=9-=;=69-prr{Pr{rP||q6-7->;?H----sy|n-n{vv|{]|tr-J-qvn{pr5tylSntP||q;\x07\b9-prr{Pr{rP||q6-<-n{vv|{_nqvH----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-z||ur}5=;=9-=;?9-}|tr-:-n{vv|{]|tr66H--0ryr----}n{|P|y|-J-zv\x075}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--tylSntP|y|-J-zv\x075}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--<<-JJJJJJJJJJJJJJ--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0v{pyqr-Iqvurv{tlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs\f");function coordinatesToVector(n,t){var e=Math.abs(Math.cos(n.latitude)),r=-Math.sin(n.longitude)*e,i=-Math.sin(n.latitude),o=-Math.cos(n.longitude)*e;return t?t.set(r,i,o):new THREE__namespace.Vector3(r,i,o)}var DEFAULT_ASPECT=1,DEFAULT_NEAR=.1,DEFAULT_FAR=2e3,TAU$2=Math.PI*2,PI_2=Math.PI/2;function formatRad$1(n){return n>0&&n<=TAU$2?n:(n%TAU$2+TAU$2)%TAU$2}function matrixLerp(n,t,e,r){e=Math.pow(e,4);for(var i=0;i<16;i++)r.elements[i]=n.elements[i]+(t.elements[i]-n.elements[i])*e;return r}var Camera=function(n){__extends(t,n);function t(e,r,i,o,s,u,c){r===void 0&&(r=DEFAULT_ASPECT),i===void 0&&(i=DEFAULT_NEAR),o===void 0&&(o=DEFAULT_FAR),s===void 0&&(s=new THREE__namespace.Vector2),u===void 0&&(u=new THREE__namespace.Vector2(512,512)),c===void 0&&(c=1);var l=n.call(this)||this;l.fov=e,l.aspect=r,l.near=i,l.far=o,l.perspToOrtho=s,l.resolution=u,l.pixelRatio=c,l.needsRender=!0,l.refineModel=!0,l.pose={longitude:0,latitude:0,fov:e,distance:0,offset:new THREE__namespace.Vector3},l.computePose(),l.perspectiveCamera=new THREE__namespace.PerspectiveCamera(l.fov,l.aspect,.001,l.far);var d=Math.max(l.orthoDistance,.01)*Math.tan(.5*l.fov/180*Math.PI),f=-.5*l.aspect*2*d;return l.orthographicCamera=new THREE__namespace.OrthographicCamera(f,-f,d,-d,.001,l.far),l.computeProjectionMatrix(),l.lastValues={position:l.position.clone(),quaternion:l.quaternion.clone(),scale:l.scale.clone(),fov:l.fov,aspect:l.aspect,near:l.near,far:l.far,orthoDistance:l.orthoDistance,perspToOrtho:l.perspToOrtho.clone()},l.type=l.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera",l}return Object.defineProperty(t.prototype,"orthoDistance",{get:function(){return this.pose.distance>1?this.pose.distance:1+(this.pose.distance-1)*this.perspToOrtho.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.zoom:this.type==="PerspectiveCamera"?this.perspectiveCamera.zoom:1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.top:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.bottom:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.left:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.type==="OrthographicCamera"?this.orthographicCamera.right:0},enumerable:!1,configurable:!0}),t.prototype.getDirection=function(e){return coordinatesToVector(this.pose,e)},t.prototype.computePose=function(e){e===void 0&&(e=0),this.updateMatrix();var r=this.matrix.elements;return this.pose.latitude=Math.asin(clamp$1(r[9],-1,1)),Math.abs(r[9])<.9999999?this.pose.longitude=formatRad$1(Math.atan2(r[8],r[10])):this.pose.longitude=formatRad$1(Math.atan2(-r[2],r[0])),this.pose.fov=this.fov,this.pose.distance=e,this.pose.offset=new THREE__namespace.Vector3(-r[8],-r[9],-r[10]).setLength(this.pose.distance).add(this.position),this},t.prototype.setFromPose=function(e){var r,i,o,s,u,c=formatRad$1((r=e.longitude)!==null&&r!==void 0?r:this.pose.longitude),l=Math.max(-PI_2+1e-4,Math.min(PI_2-1e-4,(i=e.latitude)!==null&&i!==void 0?i:this.pose.latitude)),d=(o=e.fov)!==null&&o!==void 0?o:this.pose.fov,f=(s=e.distance)!==null&&s!==void 0?s:this.pose.distance,m=(u=e.offset)!==null&&u!==void 0?u:this.pose.offset,A=coordinatesToVector({longitude:c,latitude:l}).normalize();return this.position.set(0,0,0),this.lookAt(A),this.position.add(m).sub(A.clone().setLength(f)),this.fov!==d&&(this.fov=d,this.updateProjectionMatrix()),this.updateMatrixWorld(),this.pose.longitude=c,this.pose.latitude=l,this.pose.fov=d,this.pose.distance=f,this.pose.offset.copy(m),this.needsRender=!0,this},t.prototype.copyPose=function(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}},t.prototype.computeProjectionMatrix=function(){matrixLerp(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},t.prototype.setViewOffset=function(e,r,i,o,s,u){this.perspectiveCamera.setViewOffset(e,r,i,o,s,u),this.orthographicCamera.setViewOffset(e,r,i,o,s,u),this.computeProjectionMatrix()},t.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},t.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(t.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),t.prototype.updateTime=function(e,r){var i=!1;if((this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.aspect!==this.aspect)&&(this.perspectiveCamera.fov=this.fov,this.perspectiveCamera.near=this.near,this.perspectiveCamera.far=this.far,this.perspectiveCamera.aspect=this.aspect,this.perspectiveCamera.updateProjectionMatrix(),i=!0),!this.lastValues.position.equals(this.position)||!this.lastValues.quaternion.equals(this.quaternion)||!this.lastValues.scale.equals(this.scale)||!this.lastValues.perspToOrtho.equals(this.perspToOrtho)||this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.orthoDistance!==this.orthoDistance||this.lastValues.aspect!==this.aspect){var o=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),s=-.5*this.aspect*2*o;this.orthographicCamera.left=s,this.orthographicCamera.right=-s,this.orthographicCamera.top=o,this.orthographicCamera.bottom=-o,this.orthographicCamera.near=this.near,this.orthographicCamera.far=this.far,this.orthographicCamera.updateProjectionMatrix(),i=!0}i&&this.computeProjectionMatrix(),this.lastValues.position.copy(this.position),this.lastValues.quaternion.copy(this.quaternion),this.lastValues.scale.copy(this.scale),this.lastValues.fov=this.fov,this.lastValues.aspect=this.aspect,this.lastValues.near=this.near,this.lastValues.far=this.far,this.lastValues.orthoDistance=this.orthoDistance,this.lastValues.perspToOrtho.copy(this.perspToOrtho),this.type=this.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera"},Object.defineProperty(t.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e,r){return n.prototype.copy.call(this,e,r),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.perspToOrtho.copy(e.perspToOrtho),this.updateTime(now(),0),this},t}(THREE__namespace.Camera),scratchVector4$1=new THREE__namespace.Vector4,pbmUniforms={modelAlpha:new THREE__namespace.Uniform(0),progress:new THREE__namespace.Uniform(0),pano0_map:new THREE__namespace.Uniform(null),pano0_luminanceMap:new THREE__namespace.Uniform(null),pano0_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano0_zoom:new THREE__namespace.Uniform(1),pano1_map:new THREE__namespace.Uniform(null),pano1_luminanceMap:new THREE__namespace.Uniform(null),pano1_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano1_zoom:new THREE__namespace.Uniform(1),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(null),geometricError:new THREE__namespace.Uniform(0),pixelRatio:new THREE__namespace.Uniform(1),resolution:new THREE__namespace.Uniform(new THREE__namespace.Vector2(512,512)),floor:new THREE__namespace.Uniform(0),brightness:new THREE__namespace.Uniform(1),modelBoundingMin:new THREE__namespace.Uniform(new THREE__namespace.Vector3),modelBoundingMax:new THREE__namespace.Uniform(new THREE__namespace.Vector3)},shaderLib={none:{vertexShader:meshNoneVertexShader,fragmentShader:meshNoneFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms,{opacity:{value:1}},THREE__namespace.UniformsLib.fog]),lights:!1},basic:{vertexShader:meshBasicVertexShader,fragmentShader:meshBasicFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms,THREE__namespace.ShaderLib.basic.uniforms]),lights:!1},phong:{vertexShader:meshPhongVertexShader,fragmentShader:meshPhongFragmentShader,uniforms:THREE__namespace.UniformsUtils.merge([pbmUniforms,THREE__namespace.ShaderLib.phong.uniforms]),lights:!0}},PBMMeshMaterial=function(n){__extends(t,n);function t(e,r){e===void 0&&(e="basic"),r===void 0&&(r={});var i=this,o,s,u,c,l,d,f,m,A,h,p,y,v,g,E,b,T,x,R,_,M,S=shaderLib[e];i=n.call(this,{vertexShader:S.vertexShader,fragmentShader:S.fragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(S.uniforms),lights:S.lights,defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_FLOOR:!1,USE_VERTEX_MARK:!1,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_SPREAD_TRANSITION:!1,USE_POINT_NORMAL:!1,USE_POINT_CIRCLE:!1,USE_POINT_ADAPTIVE_SIZE:!1,USE_POINT_COLOR_ALTITUDE:!1}})||this,i.shaderType=e,i.color=new THREE__namespace.Color(16777215),i.map=null,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=null,i.aoMapIntensity=1,i.specularMap=null,i.specular=new THREE__namespace.Color(1118481),i.alphaMap=null,i.envMap=null,i.reflectivity=1,i.refractionRatio=.98,i.emissiveMap=null,i.emissive=new THREE__namespace.Color(0),i.emissiveIntensity=1,i.bumpMap=null,i.bumpScale=1,i.normalMap=null,i.normalMapType=THREE__namespace.TangentSpaceNormalMap,i.normalScale=new THREE__namespace.Vector2(1,1),i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.shininess=30;var I,C=null,H=null;return Object.defineProperties(i,{pano0:{get:function(){return C},set:function(B){if(C!==B){C=B,B===null?(this.uniforms.pano0_map.value=null,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity(),this.uniforms.pano0_zoom.value=1):(this.uniforms.pano0_map.value=B.map instanceof TileCubeTextureTarget?B.map.texture:B.map,this.uniforms.pano0_luminanceMap.value=B.luminanceMap instanceof TileCubeTextureTarget?B.luminanceMap.texture:B.luminanceMap,this.uniforms.pano0_matrix.value.copy(B.matrix),this.uniforms.pano0_zoom.value=B.zoom);var L=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,O=this.defines.USE_LUMINANCE;O!==L&&(this.defines.USE_LUMINANCE=L,this.needsUpdate=!0)}}},pano1:{get:function(){return H},set:function(B){if(H!==B){H=B,B===null?(this.uniforms.pano1_map.value=null,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity(),this.uniforms.pano1_zoom.value=1):(this.uniforms.pano1_map.value=B.map instanceof TileCubeTextureTarget?B.map.texture:B.map,this.uniforms.pano1_luminanceMap.value=B.luminanceMap instanceof TileCubeTextureTarget?B.luminanceMap.texture:B.luminanceMap,this.uniforms.pano1_matrix.value.copy(B.matrix),this.uniforms.pano1_zoom.value=B.zoom);var L=this.uniforms.pano0_luminanceMap.value!==null&&this.uniforms.pano1_luminanceMap.value!==null,O=this.defines.USE_LUMINANCE;O!==L&&(this.defines.USE_LUMINANCE=L,this.needsUpdate=!0)}}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(B){this.uniforms.modelAlpha.value=B}},progress:{get:function(){return this.uniforms.progress.value},set:function(B){this.uniforms.progress.value=B}},transition:{get:function(){return this.defines.USE_BLACK_TRANSITION?"BLACK":this.defines.USE_SPREAD_TRANSITION?"SPREAD":"FADE"},set:function(B){var L=this.defines.USE_BLACK_TRANSITION,O=this.defines.USE_SPREAD_TRANSITION;this.defines.USE_BLACK_TRANSITION=!1,this.defines.USE_SPREAD_TRANSITION=!1,this.defines["USE_".concat(B,"_TRANSITION")]=!0;var k=!1;L!==this.defines.USE_BLACK_TRANSITION&&(k=!0),O!==this.defines.USE_SPREAD_TRANSITION&&(k=!0),k&&(this.needsUpdate=!0)}},constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(B){this.uniforms.constantColor.value=B;var L=this.defines.USE_CONSTANT_COLOR,O=B!==null;L!==O&&(this.defines.USE_CONSTANT_COLOR=O,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(B){this.uniforms.opacity.value=B}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(B){this.uniforms.shownFloorIndex.value=B}},brightness:{get:function(){return this.uniforms.brightness.value},set:function(B){this.uniforms.brightness.value=B}},clippers:{get:function(){return I},set:function(B){I!==B&&(I=B,this.uniforms.clippers.value=(I||[]).map(function(L){var O=typeof L.floorIndex=="number"?L.floorIndex:-1,k=new THREE__namespace.Matrix4().getInverse(L.clippingBoxMatrix);return{matrixInverse:k,floorIndex:O}}),this.needsUpdate=!0)}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(B){B!==this.defines.USE_EDL&&(this.defines.USE_EDL=B,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(B){B!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=B,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(B){B!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=B,this.needsUpdate=!0)}},floor:{get:function(){return this.uniforms.floor.value},set:function(B){this.uniforms.floor.value=B}}}),i.pano0=(o=r.pano0)!==null&&o!==void 0?o:defaultPbmParameters.pano0,i.pano1=(s=r.pano1)!==null&&s!==void 0?s:defaultPbmParameters.pano1,i.modelAlpha=(u=r.modelAlpha)!==null&&u!==void 0?u:defaultPbmParameters.modelAlpha,i.progress=(c=r.progress)!==null&&c!==void 0?c:defaultPbmParameters.progress,i.transition=(l=r.transition)!==null&&l!==void 0?l:defaultPbmParameters.transition,i.constantColor=(d=r.constantColor)!==null&&d!==void 0?d:defaultPbmParameters.constantColor,i.opacity=(f=r.opacity)!==null&&f!==void 0?f:defaultPbmParameters.opacity,i.shownFloorIndex=(m=r.shownFloorIndex)!==null&&m!==void 0?m:defaultPbmParameters.shownFloorIndex,i.clippers=(A=r.clippers)!==null&&A!==void 0?A:defaultPbmParameters.clippers,i.useEDL=(h=r.useEDL)!==null&&h!==void 0?h:defaultPbmParameters.useEDL,i.useHQWeight=(p=r.useHQWeight)!==null&&p!==void 0?p:defaultPbmParameters.useHQWeight,i.useHQDepth=(y=r.useHQDepth)!==null&&y!==void 0?y:defaultPbmParameters.useHQDepth,i.pointSize=(v=r.pointSize)!==null&&v!==void 0?v:defaultPbmParameters.pointSize,i.pointColor=(g=r.pointColor)!==null&&g!==void 0?g:defaultPbmParameters.pointColor,i.pointShape=(E=r.pointShape)!==null&&E!==void 0?E:defaultPbmParameters.pointShape,i.pointScale=(b=r.pointScale)!==null&&b!==void 0?b:defaultPbmParameters.pointScale,i.pointBack=(T=r.pointBack)!==null&&T!==void 0?T:defaultPbmParameters.pointBack,i.pointMinPixel=(x=r.pointMinPixel)!==null&&x!==void 0?x:defaultPbmParameters.pointMinPixel,i.pointMaxPixel=(R=r.pointMaxPixel)!==null&&R!==void 0?R:defaultPbmParameters.pointMaxPixel,i.gradientTexture=(_=r.gradientTexture)!==null&&_!==void 0?_:defaultPbmParameters.gradientTexture,i.brightness=(M=r.brightness)!==null&&M!==void 0?M:defaultPbmParameters.brightness,i.floor=0,i.transparent=!0,i}return t.prototype.onBeforeCompile=function(e,r){var i,o,s=String((o=(i=this.clippers)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,s),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,s)},t.prototype.refreshUniforms=function(e){var r,i,o=this.uniforms;o.diffuse&&o.diffuse.value.copy(this.color),o.opacity&&(o.opacity.value=this.opacity),o.color&&o.diffuse.value.copy(this.color),o.emissive&&o.emissive.value.copy(this.emissive).multiplyScalar(this.emissiveIntensity),o.map&&(o.map.value=this.map),o.alphaMap&&(o.alphaMap.value=this.alphaMap),o.specularMap&&(o.specularMap.value=this.specularMap),o.envMap&&(o.envMap.value=this.envMap,o.flipEnvMap.value=!((r=this.envMap)===null||r===void 0)&&r.isCubeTexture?-1:1,o.reflectivity.value=this.reflectivity,o.refractionRatio.value=this.refractionRatio,o.maxMipLevel.value=this.envMap&&(i=e.properties.get(this.envMap).__maxMipLevel)!==null&&i!==void 0?i:0),o.lightMap&&(o.lightMap.value=this.lightMap,o.lightMapIntensity.value=this.lightMapIntensity),o.aoMap&&(o.aoMap.value=this.aoMap,o.aoMapIntensity.value=this.aoMapIntensity),o.specular&&o.specular.value.copy(this.specular),o.shininess&&(o.shininess.value=Math.max(this.shininess,1e-4)),o.emissiveMap&&(o.emissiveMap.value=this.emissiveMap),o.bumpMap&&(o.bumpMap.value=this.bumpMap,o.bumpScale.value=this.bumpScale,this.side===THREE__namespace.BackSide&&(o.bumpScale.value*=-1)),o.normalMap&&(o.normalMap.value=this.normalMap,o.normalScale.value.copy(this.normalScale),this.side===THREE__namespace.BackSide&&o.normalScale.value.negate()),o.displacementMap&&(o.displacementMap.value=this.displacementMap,o.displacementScale.value=this.displacementScale,o.displacementBias.value=this.displacementBias);var s;this.map?s=this.map:this.specularMap?s=this.specularMap:this.displacementMap?s=this.displacementMap:this.normalMap?s=this.normalMap:this.bumpMap?s=this.bumpMap:this.alphaMap?s=this.alphaMap:this.emissiveMap&&(s=this.emissiveMap),s!==void 0&&(s.matrixAutoUpdate===!0&&s.updateMatrix(),o.uvTransform.value.copy(s.matrix));var u;this.aoMap?u=this.aoMap:this.lightMap&&(u=this.lightMap),u!==void 0&&(u.matrixAutoUpdate===!0&&u.updateMatrix(),o.uv2Transform.value.copy(u.matrix))},t.prototype.update=function(e,r){if(this.refreshUniforms(e),this.transparent=!1,this.shownFloorIndex>-1&&(this.defines.USE_VERTEX_FLOOR?this.transparent=!0:this.transparent=this.shownFloorIndex!==this.floor),this.opacity<1&&(this.transparent=!0),this.alphaMap&&(this.transparent=!0),this.brightness<1&&(this.transparent=!0),this.blending=this.transparent?THREE__namespace.NormalBlending:THREE__namespace.NoBlending,r instanceof Camera)this.uniforms.pixelRatio.value=r.pixelRatio,this.uniforms.resolution.value.copy(r.resolution);else{this.uniforms.pixelRatio.value=e.getPixelRatio();var i=e.getViewport(scratchVector4$1);this.uniforms.resolution.value.set(i.z,i.w)}},t.prototype.syncModel=function(e){var r="".concat(e.id,":").concat(e.materialVersion);r!==this.syncModelVersion&&(Object.assign(this,e.getMaterial()),this.uniforms.modelBoundingMax.value.copy(e.bounding.max),this.uniforms.modelBoundingMin.value.copy(e.bounding.min),this.syncModelVersion=r)},t.prototype.copy=function(e){return n.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.specular.copy(e.specular),this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.emissiveMap=e.emissiveMap,this.emissive.copy(e.emissive),this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.shininess=e.shininess,this.pano0=e.pano0,this.pano1=e.pano1,this.modelAlpha=e.modelAlpha,this.progress=e.progress,this.transition=e.transition,this.opacity=e.opacity,this.constantColor=e.constantColor,this.shownFloorIndex=e.shownFloorIndex,this.brightness=e.brightness,this.clippers=e.clippers,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.pointColor=e.pointColor,this.pointSize=e.pointSize,this.pointShape=e.pointShape,this.pointScale=e.pointScale,this.pointBack=e.pointBack,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.gradientTexture=e.gradientTexture,this.floor=e.floor,this},t}(THREE__namespace.ShaderMaterial),InternalWebGLRenderer=function(n){__extends(t,n);function t(e){var r=e.preserveDrawingBuffer,i=r===void 0?!0:r,o=e.premultipliedAlpha,s=o===void 0?!0:o,u=e.stencil,c=u===void 0?!0:u,l=e.backgroundColor,d=l===void 0?1579548:l,f=e.backgroundAlpha,m=f===void 0?1:f,A=e.pixelRatio,h=A===void 0?1:A,p=e.antialias,y=e.webgl2,v=e.logarithmicDepthBuffer,g=e.precision,E=this,b={antialias:p,alpha:!0,depth:!0,preserveDrawingBuffer:i,stencil:c,premultipliedAlpha:s,powerPreference:"high-performance"},T={logarithmicDepthBuffer:v,precision:g};if(y){var x=document.createElement("canvas"),R=x.getContext("webgl2",b);R?E=n.call(this,__assign(__assign(__assign({},b),T),{antialias:!0,canvas:x,context:R}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),E=n.call(this,__assign(__assign({},b),T))||this)}else E=n.call(this,__assign(__assign({},b),T))||this;return E.setPixelRatio(h),E.setClearColor(d,m),E.outputEncoding=THREE__namespace.sRGBEncoding,E.autoClear=!0,E}return t}(THREE__namespace.WebGLRenderer),Scene=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.add=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.add.apply(this,e)},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.prototype.remove.apply(this,e)},t}(THREE__namespace.Scene),VolumePlaneIntersect;(function(n){n[n.Outside=-1]="Outside",n[n.Intersecting=0]="Intersecting",n[n.Inside=1]="Inside"})(VolumePlaneIntersect||(VolumePlaneIntersect={}));var EPSILON$2=1e-6,scratchVector=new THREE__namespace.Vector3,scratchMatrix4$4=new THREE__namespace.Matrix4,scratchXAxis=new THREE__namespace.Vector3,scratchYAxis=new THREE__namespace.Vector3,scratchZAxis=new THREE__namespace.Vector3,scratchSize=new THREE__namespace.Vector3,scratchBox3=new THREE__namespace.Box3,scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4Inverse$1=new THREE__namespace.Matrix4,scratchRay$1=new THREE__namespace.Ray,scratchObject3D=new THREE__namespace.Object3D,scratchFrustum=new THREE__namespace.Frustum;function quaternionFromMatrix3(n,t){var e=n.elements;return t.setFromRotationMatrix(scratchMatrix4$4.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1)),t}var CullingVolume=function(){function n(t){t===void 0&&(t=[]),this.planes=t}return Object.defineProperty(n,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),n.prototype.setFromFrustum=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.setFromCamera=function(t){return scratchMatrix4$4.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$4),this.setFromFrustum(scratchFrustum),this},n.prototype.applyMatrix4=function(t){for(var e=0,r=this.planes;e<r.length;e++){var i=r[e];i.applyMatrix4(t)}},n.prototype.copy=function(t){return this.planes=t.planes.map(function(e){return e.clone()}),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.computeVisibility=function(t){for(var e=VolumePlaneIntersect.Inside,r=0,i=this.planes;r<i.length;r++){var o=i[r],s=t.intersectPlane(o);switch(s){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:e=VolumePlaneIntersect.Intersecting;break}}return e},n.prototype.computeVisibilityWithPlaneMask=function(t,e){if(e===n.MASK_OUTSIDE||e===n.MASK_INSIDE)return e;for(var r=n.MASK_INSIDE,i=Math.min(32,this.planes.length),o=0;o<i;++o){var s=1<<o;if(e&s){var u=this.planes[o],c=t.intersectPlane(u);if(c===VolumePlaneIntersect.Outside)return n.MASK_OUTSIDE;c===VolumePlaneIntersect.Intersecting&&(r|=s)}}return r},n}(),BoxBoundingVolume=function(){function n(){this.type="box",this.center=new THREE__namespace.Vector3,this.halfSize=new THREE__namespace.Vector3,this.rotation=new THREE__namespace.Matrix3}return n.prototype.fromJson=function(t){var e=t.box;this.center.set(e[0],e[1],e[2]);var r=e[3],i=e[4],o=e[5],s=e[6],u=e[7],c=e[8],l=e[9],d=e[10],f=e[11],m=Math.sqrt(r*r+i*i+o*o),A=Math.sqrt(s*s+u*u+c*c),h=Math.sqrt(l*l+d*d+f*f);this.halfSize.set(m,A,h);var p=this.halfSize.toArray().reduce(function(y,v){return y+v},0);return(isNaN(p)||p<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([r/m,i/m,o/m,s/A,u/A,c/A,l/h,d/h,f/h]),isNaN(this.rotation.toArray().reduce(function(y,v){return y+v},0))&&this.rotation.identity(),this},n.prototype.toJson=function(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:__spreadArray(__spreadArray(__spreadArray(__spreadArray([],this.center.toArray(),!0),scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),!0),scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),!0),scratchZAxis.multiplyScalar(this.halfSize.z).toArray(),!0)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.applyMatrix4=function(t){return scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(t),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$4.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.scale),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.rotation.elements,r=t.x-this.center.x,i=t.y-this.center.y,o=t.z-this.center.z,s=0,u;return u=r*e[0]+i*e[1]+o*e[2],u<0&&(u=-u),u-=this.halfSize.x,u>0&&(s+=u*u),u=r*e[3]+i*e[4]+o*e[5],u<0&&(u=-u),u-=this.halfSize.y,u>0&&(s+=u*u),u=r*e[6]+i*e[7]+o*e[8],u<0&&(u=-u),u-=this.halfSize.z,u>0&&(s+=u*u),s},n.prototype.distanceToPoint=function(t){return Math.sqrt(this.distanceSquaredToPoint(t))},n.prototype.distanceToPlane=function(t){var e=t.projectPoint(this.center,new THREE__namespace.Vector3);return this.distanceToPoint(e)},n.prototype.getBoundingBox=function(t){return t.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),t.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),t.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),t.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),t},n.prototype.toGeometry=function(){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),e=new Float32Array(8*3);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(e,21);var r=new THREE__namespace.BufferGeometry;return r.setIndex(new THREE__namespace.BufferAttribute(t,1)),r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r},n.prototype.intersectPlane=function(t){var e=this.center,r=t.normal,i=this.rotation.elements,o=this.halfSize,s=r.x,u=r.y,c=r.z,l=Math.abs(s*i[0]*o.x+u*i[1]*o.x+c*i[2]*o.x)+Math.abs(s*i[3]*o.y+u*i[4]*o.y+c*i[5]*o.y)+Math.abs(s*i[6]*o.z+u*i[7]*o.z+c*i[8]*o.z),d=r.dot(e)+t.constant;return d<=-l?VolumePlaneIntersect.Outside:d>=l?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting},n.prototype.intersectRay=function(t,e){if(scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$4.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$4.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$4),scratchRay$1.copy(t).applyMatrix4(scratchMatrix4Inverse$1),scratchBox3.containsPoint(scratchRay$1.origin))return!0;var r=scratchRay$1.intersectBox(scratchBox3,scratchVector);return r?e!==void 0?r.applyMatrix4(scratchMatrix4$4).distanceTo(t.origin)<e:!0:!1},n}(),SphereBoundingVolume=function(){function n(){this.type="sphere",this.center=new THREE__namespace.Vector3,this.radius=-1}return n.prototype.fromJson=function(t){var e=t.sphere;return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],EPSILON$2),this},n.prototype.toJson=function(){return{sphere:__spreadArray(__spreadArray([],this.center.toArray(),!0),[this.radius],!1)}},n.prototype.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){return t.setFromCenterAndSize(this.center,scratchSize.set(1,1,1).multiplyScalar(this.radius*2)),t},n.prototype.toGeometry=function(){for(var t=32,e=new Float32Array(t*3*2*2),r=0;r<=t;r++){var i=0;i=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(i)*this.radius,e[r*6+1]=this.center.y+Math.sin(i)*this.radius,e[r*6+2]=this.center.z+0,i=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(i)*this.radius,e[r*6+4]=this.center.y+Math.sin(i)*this.radius,e[r*6+5]=this.center.z+0}for(var r=t;r<=t*2;r++){var i=0;i=r/t*Math.PI*2,e[r*6+0]=this.center.x+Math.cos(i)*this.radius,e[r*6+1]=this.center.y+0,e[r*6+2]=this.center.z+Math.sin(i)*this.radius,i=(r+1)/t*Math.PI*2,e[r*6+3]=this.center.x+Math.cos(i)*this.radius,e[r*6+4]=this.center.y+0,e[r*6+5]=this.center.z+Math.sin(i)*this.radius}var o=new THREE__namespace.BufferGeometry;return o.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o},n.prototype.applyMatrix4=function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},n.prototype.getCenter=function(t){return t.copy(this.center)},n.prototype.distanceSquaredToPoint=function(t){var e=this.distanceToPoint(t);return e*e},n.prototype.distanceToPoint=function(t){var e=this.center.distanceTo(t)-this.radius;return e<=0?0:e},n.prototype.distanceToPlane=function(t){var e=Math.abs(t.distanceToPoint(this.center));return Math.max(0,e-this.radius)},n.prototype.intersectPlane=function(t){var e=this.center,r=this.radius,i=t.normal,o=i.dot(e)+t.constant;return o<-r?VolumePlaneIntersect.Outside:o<r?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside},n.prototype.intersectRay=function(t,e){if(scratchSphere$1.set(this.center,this.radius),scratchSphere$1.containsPoint(t.origin))return!0;var r=t.intersectSphere(scratchSphere$1,scratchVector);return r?e!==void 0?t.origin.distanceTo(r)<e:!0:!1},n}(),RegionBoundingVolume=function(){function n(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return n.prototype.fromJson=function(t){var e=t.region;return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this},n.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},n.prototype.copy=function(t){return this.west=t.west,this.south=t.south,this.east=t.east,this.north=t.north,this.minHeight=t.minHeight,this.maxHeight=t.maxHeight,this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.getBoundingBox=function(t){throw new Error("not implemented")},n.prototype.toGeometry=function(){throw new Error("not implemented")},n.prototype.applyMatrix4=function(t){throw new Error("not implemented")},n.prototype.getCenter=function(t){throw new Error("not implemented")},n.prototype.distanceToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceSquaredToPoint=function(t){throw new Error("not implemented")},n.prototype.distanceToPlane=function(t){throw new Error("not implemented")},n.prototype.intersectPlane=function(t){throw new Error("not implemented")},n.prototype.intersectRay=function(t){throw new Error("not implemented")},n}();function makeBoundingVolume(n){if("box"in n)return new BoxBoundingVolume().fromJson(n);if("sphere"in n)return new SphereBoundingVolume().fromJson(n);if("region"in n)return new RegionBoundingVolume().fromJson(n);throw new Error("BoundingVolume ".concat(JSON.stringify(n)," never suppored."))}var debugMaterials=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(function(n){return new THREE__namespace.LineBasicMaterial({color:n,depthWrite:!1,depthTest:!1,transparent:!0})}),debugBoxGeometry=function(){var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(8*3);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);var e=new THREE__namespace.BufferGeometry;return e.setIndex(new THREE__namespace.BufferAttribute(n,1)),e.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),e.computeBoundingBox(),e.computeBoundingSphere(),e}(),debugSphereGeometry=function(){for(var n=32,t=new Float32Array(n*3*2*2),e=0;e<=n;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=Math.sin(r),t[e*6+2]=0,r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=Math.sin(r),t[e*6+5]=0}for(var e=n;e<=n*2;e++){var r=0;r=e/n*Math.PI*2,t[e*6+0]=Math.cos(r),t[e*6+1]=0,t[e*6+2]=Math.sin(r),r=(e+1)/n*Math.PI*2,t[e*6+3]=Math.cos(r),t[e*6+4]=0,t[e*6+5]=Math.sin(r)}var i=new THREE__namespace.BufferGeometry;return i.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),i.computeBoundingBox(),i.computeBoundingSphere(),i}();function createDebugBoundingMesh(n,t){if(n instanceof BoxBoundingVolume){var e=new THREE__namespace.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),quaternionFromMatrix3(n.rotation,e.quaternion),e.scale.set(n.halfSize.x,n.halfSize.y,n.halfSize.z),e.matrix.compose(e.position,e.quaternion,e.scale),e}else if(n instanceof SphereBoundingVolume){var e=new THREE__namespace.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return e.position.copy(n.center),e.scale.set(n.radius,n.radius,n.radius),e.matrix.compose(e.position,e.quaternion,e.scale),e}throw new Error("never")}var scratchVector3$5=new THREE__namespace.Vector3,Tile=function(){function n(t,e,r,i){var o=this,s,u,c,l;this.parent=null,this.floor=0,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=i!=null?i:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(s=e.refine)!==null&&s!==void 0?s:this.parent?this.parent.refine:"REPLACE",this.transform=new THREE__namespace.Matrix4,e.transform&&this.transform.fromArray(e.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof e.geometricError=="number"?this.geometricError=e.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(c=(u=this.parent)===null||u===void 0?void 0:u.geometricError)!==null&&c!==void 0?c:0,e.content&&e.content.uri?(this.content={uri:e.content.uri,loadState:"UNLOADED",byteLength:0},e.content.group!==void 0&&(this.content.group=e.content.group),e.content.boundingVolume&&(this.content.boundingVolume=makeBoundingVolume(e.content.boundingVolume).applyMatrix4(this.transform)),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type==="SCENEGRAPH"&&(this.levelOfContent=this.levelOfContent+1),e.boundingVolume&&(this.boundingVolume=makeBoundingVolume(e.boundingVolume).applyMatrix4(this.transform)),e.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(e.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(l=e.extras)!==null&&l!==void 0?l:{},typeof this.extras.floor!="number"&&i&&typeof i.extras.floor=="number"&&(this.extras.floor=i.extras.floor),typeof this.extras.floor=="number"&&(this.floor=this.extras.floor),this.boundingVolume&&(this.boundingVolumeDebugObject=createDebugBoundingMesh(this.boundingVolume,this.levelOfContent)),e.children?this.children=e.children.map(function(d,f){return new n("".concat(o.id,".").concat(f),d,r,o)}):this.children=[]}return n.prototype.traverse=function(t){t(this);for(var e=0,r=this.children;e<r.length;e++){var i=r[e];i.traverse(t)}},n.prototype.updateState=function(t){this.state.frameNumber=t.frameNumber;var e=this.tileset.transformIsIdentity?null:this.tileset.transform;if(this.boundingVolume){var r=e?this.boundingVolume.clone().applyMatrix4(e):this.boundingVolume;if(t.camera.type==="OrthographicCamera"){var i=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(t.camera.direction,t.camera.position);this.state.distanceToCamera=r.distanceToPlane(i)}else this.state.distanceToCamera=r.distanceToPoint(t.camera.position);var o=r.getCenter(scratchVector3$5).sub(t.camera.position);this.state.centerZDepth=t.camera.direction.dot(o);var s=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=t.cullingVolume.computeVisibilityWithPlaneMask(r,s),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=CullingVolume.MASK_INDETERMINATE,this.state.visible=!0;if(this.state.distanceToCamera<t.camera.near&&(this.state.distanceToCamera=t.camera.near),this.levelOfContent<=0&&(this.state.visible=!0),this.viewerRequestVolume){var u=e?this.viewerRequestVolume.clone().applyMatrix4(e):this.viewerRequestVolume;this.state.inRequestVolume=u.distanceSquaredToPoint(t.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(t,this.state.distanceToCamera,!1)},Object.defineProperty(n.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"siblingIndex",{get:function(){var t,e;return(e=(t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))!==null&&e!==void 0?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&this.type==="TILESET"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderContent",{get:function(){return this.type==="SCENEGRAPH"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentAvailable",{get:function(){var t;return this.hasRenderContent&&((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasUnloadedContent",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="UNLOADED"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasEmptyContent",{get:function(){return this.type==="EMPTY"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentReady",{get:function(){var t;return((t=this.content)===null||t===void 0?void 0:t.loadState)==="READY"||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),n.prototype.loadContent=function(){var t=this,e;if(this.hasEmptyContent||!(!((e=this.content)===null||e===void 0)&&e.uri))return Promise.resolve(!1);var r=this.content;return r.data?Promise.resolve(!0):(r.loadState="LOADING",this.tileset.requestScheduler.scheduleRequest(this.id,function(){return t.getPriority()}).then(function(i){return i?t.tileset.options.contentLoader(t).then(function(o){return i.done(),r.loadState=o?"READY":"UNLOADED",o}).catch(function(o){return r.loadState="FAILED",i.done(),Promise.reject(o)}):(r.loadState="UNLOADED",Promise.resolve(!1))}))},n.prototype.unloadContent=function(){return this.content&&(this.content.loadState="UNLOADED",this.content.byteLength=0),!0},n.prototype.getScreenSpaceError=function(t,e,r){var i=this.tileset.transformIsIdentity?1:this.tileset.transform.getMaxScaleOnAxis(),o=this.parent?this.parent.geometricError:this.tileset.geometricError,s=i*(r?o:this.geometricError);if(s===0)return 0;var u=Math.max(e,.001),c=s*t.height/(u*t.sseDenominator);return c},n.prototype.getPriority=function(){var t=this.refine==="ADD"||this.tileset.skipLevelOfDetail;if(t&&!this.state.visible||this.tileset.frameNumber-this.state.touchedFrameNumber>=1||this.content.loadState==="UNLOADED")return-1;var e=this.parent,r=e&&(!t||this.state.screenSpaceError===0),i=r?e.state.screenSpaceError:this.state.screenSpaceError,o=this.tileset.root?this.tileset.root.state.screenSpaceError:0,s=Math.max(o-i,0);return s},n}(),TileRequestScheduler=function(){function n(t){this.tileset=t,this.activeRequests=0,this.requestQueue=[],this.requestMap=new Map,this.deferred=null}return n.prototype.scheduleRequest=function(t,e){var r=this.requestMap.get(t);if(r)return r;var i={identiy:t,priority:0,getPriority:e,resolve:function(){}},o=new Promise(function(s){return i.resolve=s});return this.requestQueue.push(i),this.requestMap.set(t,o),this.issueNewRequests(),o},n.prototype.reset=function(){for(var t=0,e=this.requestQueue;t<e.length;t++){var r=e[t];r.resolve(null)}this.requestQueue.length=0,this.requestMap.clear(),this.activeRequests=0},n.prototype.issueRequest=function(t){var e=this,r=t.identiy,i=t.resolve,o=!1,s=function(){o||(o=!0,e.requestMap.delete(r),e.activeRequests--,e.issueNewRequests())};this.activeRequests++,i({done:s})},n.prototype.issueNewRequests=function(){var t=this;this.deferred||(this.deferred=setTimeout(function(){return t.issueNewRequestsAsync()},0))},n.prototype.issueNewRequestsAsync=function(){this.deferred=null;var t=Math.max(this.tileset.maxRequests-this.activeRequests,0);if(t!==0){this.updateAllRequests();for(var e=0;e<t;e++){var r=this.requestQueue.shift();if(r)this.issueRequest(r);else break}}},n.prototype.updateAllRequests=function(){for(var t=this.requestQueue,e=0;e<t.length;e++){var r=t[e];this.updateRequest(r)===!1&&(t.splice(e,1),this.requestMap.delete(r.identiy),e--)}t.sort(function(i,o){return i.priority-o.priority})},n.prototype.updateRequest=function(t){return t.priority=t.getPriority(t.identiy),t.priority<0?(t.resolve(null),!1):!0},n}(),CacheNode=function(){function n(t,e,r){this.item=t,this.previous=e,this.next=r}return n}(),CacheNodeList=function(){function n(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.add=function(t){var e=new CacheNode(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++,e},n.prototype.remove=function(t){t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,this._length--},n.prototype.splice=function(t,e){t!==e&&(this.remove(e),this.insert(t,e))},n.prototype.insert=function(t,e){var r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,this._length++},n.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},n}(),TileCache=function(){function n(){this.cacheNodeMap=new Map,this.list=new CacheNodeList,this.sentinel=this.list.add("sentinel")}return n.prototype.reset=function(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)},n.prototype.touch=function(t){var e=this.cacheNodeMap.get(t);e&&this.list.splice(this.sentinel,e)},n.prototype.add=function(t,e){if(!this.cacheNodeMap.has(t)){var r=this.list.add(t);this.cacheNodeMap.set(t,r),e&&e(t)}},n.prototype.unloadTile=function(t,e){var r=this.cacheNodeMap.get(t);r&&(this.list.remove(r),this.cacheNodeMap.delete(t),e&&e(t))},n.prototype.unloadTiles=function(t,e){for(var r=this.list.head;r!==this.sentinel&&t();){var i=r.item;r=r.next,this.unloadTile(i,e)}},n.prototype.toArray=function(){for(var t=[],e=0,r=this.list.toArray();e<r.length;e++){var i=r[e];i.item!=="sentinel"&&t.push(i.item)}return t},n}(),ManagedArray=function(){function n(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(n.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),n.prototype.get=function(t){return this.array[t]},n.prototype.set=function(t,e){t>=this.length&&(this._length=t+1),this.map.has(this.array[t])&&this.map.delete(this.array[t]),this.array[t]=e,this.map.set(e,t)},n.prototype.delete=function(t){var e=this.map.get(t);e!==void 0&&e>=0&&(this.array.splice(e,1),this.map.delete(t),this._length--)},n.prototype.push=function(t){if(!this.map.has(t)){var e=this._length++;this.array[e]=t,this.map.set(t,e)}},n.prototype.pop=function(){var t=this.array[--this._length];return this.map.delete(t),this.array[this._length]=void 0,t},n.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},n.prototype.find=function(t){return this.map.has(t)},n.prototype.peek=function(){return this.array[this._length-1]},n}(),TilesetBaseTraverser=function(){function n(t){this.tileset=t,this._canSelectTile=!0,this.root=null}return n.prototype.traverse=function(t,e,r){this.root=t,this.reset()},n.prototype.reset=function(){this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0},n.prototype.updateTile=function(t,e){this.updateTileVisibility(t,e),t.state.shouldSelect=!1,t.state.finalResolution=!0},n.prototype.selectTile=function(t,e){var r=t.contentAvailable&&this._canSelectTile;r&&(t.state.selectedFrameNumber=e.frameNumber,this.tileset.selectedTiles.push(t),this.tileset.needsRefinedTiles.add(t))},n.prototype.loadTile=function(t,e){t.hasUnloadedContent&&(t.state.requestedFrameNumber=e.frameNumber,this.tileset.requestedTiles.push(t)),this.tileset.needsRefinedTiles.add(t)},n.prototype.touchTile=function(t,e){this.tileset.cache.touch(t),t.state.touchedFrameNumber=e.frameNumber},n.prototype.canTraverse=function(t,e){return t.levelOfContent>=e.maxLevelOfDetail||t.children.length===0?!1:t.levelOfContent<=e.minLevelOfDetail||t.hasTilesetContent?!0:t.state.screenSpaceError>e.maxScreenSpaceError},n.prototype.updateTileVisibility=function(t,e){if(t.updateState(e),!(!t.state.visible||!t.state.inRequestVolume)){var r=t.children.length>0;if(t.hasTilesetContent&&r){var i=t.children[0];this.updateTileVisibility(i,e),t.state.visible=i.state.visible;return}if(this.meetsScreenSpaceErrorEarly(t,e)){t.state.visible=!1;return}var o=t.refine==="REPLACE";if(o&&r&&!this.anyChildrenVisible(t,e)){t.state.visible=!1;return}}},n.prototype.anyChildrenVisible=function(t,e){for(var r=!1,i=t.children,o=0,s=i;o<s.length;o++){var u=s[o];u.updateState(e),r=r||u.state.visible}return r},n.prototype.meetsScreenSpaceErrorEarly=function(t,e){var r=t.parent;return!r||r.refine!=="ADD"||r.levelOfContent<e.minLevelOfDetail?!1:r.levelOfContent>e.maxLevelOfDetail?!0:t.getScreenSpaceError(e,t.state.distanceToCamera,!0)<e.maxScreenSpaceError},n.prototype.sortTilesByDistanceToCamera=function(t){t.sort(function(e,r){return r.state.distanceToCamera===0&&e.state.distanceToCamera===0?r.state.centerZDepth-e.state.centerZDepth:r.state.distanceToCamera-e.state.distanceToCamera})},n}(),TilesetNormalTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r._traversalStack=new ManagedArray,r._emptyTraversalStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,i){i===void 0&&(i=[]),n.prototype.traverse.call(this,e,r,i);for(var o=0,s=i;o<s.length;o++){var u=s[o];this._traversalStack.reset(),this._emptyTraversalStack.reset(),u.camera.refine&&(this._canSelectTile=u.camera.visible,this.updateTile(e,u),this.executeTraversal(e,u))}this._traversalStack.reset(),this._emptyTraversalStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._emptyTraversalStack.reset()},t.prototype.executeTraversal=function(e,r){var i=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&i.push(e);i.length>0;){var o=i.pop(),s=o.parent,u=!s||s.state.shouldRefine,c=!1;this.canTraverse(o,r)&&(c=this.updateAndPushChildren(o,r,i)&&u);var l=!c&&u;o.hasRenderContent?o.refine==="ADD"?(this.loadTile(o,r),this.selectDesiredTile(o,r)):o.refine==="REPLACE"&&(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)):(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)),this.touchTile(o,r),o.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,i){for(var o=e.children,s=0,u=o;s<u.length;s++){var c=u[s];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(o);for(var l=e.refine==="REPLACE"&&e.hasRenderContent,d=!1,f=!0,m=0,A=o;m<A.length;m++){var c=A[m];if(c.state.visible&&c.state.inRequestVolume?(i.find(c)&&i.delete(c),i.push(c),d===!1&&(d=!0)):(l||this.tileset.loadSiblings)&&(this.loadTile(c,r),this.touchTile(c,r)),l){var h=void 0;c.state.inRequestVolume?c.hasRenderContent?h=c.contentAvailable:h=this.executeEmptyTraversal(c,r):h=!1,f=f&&h}}return d||(f=!1),f},t.prototype.selectDesiredTile=function(e,r){e.contentAvailable&&n.prototype.selectTile.call(this,e,r)},t.prototype.executeEmptyTraversal=function(e,r){var i=!0,o=this._emptyTraversalStack;for(o.push(e);o.length>0&&i;){var s=o.pop(),u=!s.hasRenderContent&&this.canTraverse(s,r);if(!u&&!s.contentAvailable&&(i=!1),this.updateTile(s,r),s.state.visible||(this.loadTile(s,r),this.touchTile(s,r)),u)for(var c=s.children,l=0,d=c;l<d.length;l++){var f=d[l];o.find(f)&&o.delete(f),o.push(f)}}return i},t}(TilesetBaseTraverser),TilesetSkipTraverser=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;return r.tileset=e,r.baseScreenSpaceError=1024,r.skipScreenSpaceErrorFactor=16,r.skipLevels=1,r._traversalStack=new ManagedArray,r._descendantTraversalStack=new ManagedArray,r._selectionTraversalStack=new ManagedArray,r._selectionTraversalancestorStack=new ManagedArray,r}return t.prototype.traverse=function(e,r,i){i===void 0&&(i=[]),n.prototype.traverse.call(this,e,r,i);for(var o=0,s=i;o<s.length;o++){var u=s[o];this._traversalStack.reset(),u.camera.refine&&(this._canSelectTile=u.camera.visible,this.updateTile(e,u),this.executeTraversal(e,u),this.traverseAndSelect(e,u))}this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),r.camera.refine&&(this._canSelectTile=r.camera.visible,this.updateTile(e,r),this.executeTraversal(e,r),this.traverseAndSelect(e,r))},t.prototype.reset=function(){n.prototype.reset.call(this),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()},t.prototype.executeTraversal=function(e,r){var i=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&i.push(e);i.length>0;){var o=i.pop();this.updateTileAncestorContentLinks(o,r);var s=o.parent,u=!s||s.state.shouldRefine,c=!1;this.canTraverse(o,r)&&(c=this.updateAndPushChildren(o,r,i)&&u);var l=!c&&u;o.hasRenderContent?o.refine==="ADD"?(this.loadTile(o,r),this.selectDesiredTile(o,r)):o.refine==="REPLACE"&&(this.inBaseTraversal(o,this.baseScreenSpaceError)?(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)):l?(this.loadTile(o,r),this.selectDesiredTile(o,r)):this.reachedSkippingThreshold(o)&&this.loadTile(o,r)):(this.loadTile(o,r),l&&this.selectDesiredTile(o,r)),this.touchTile(o,r),o.state.shouldRefine=c}},t.prototype.updateAndPushChildren=function(e,r,i){for(var o=e.children,s=0,u=o;s<u.length;s++){var c=u[s];this.updateTile(c,r)}this.sortTilesByDistanceToCamera(o);for(var l=!1,d=0,f=o;d<f.length;d++){var c=f[d];c.state.visible&&c.state.inRequestVolume?(i.push(c),l===!1&&(l=!0)):this.tileset.loadSiblings&&(this.loadTile(c,r),this.touchTile(c,r))}return l},t.prototype.selectDesiredTile=function(e,r){var i=e.contentAvailable?e:e.state.ancestorWithContentAvailable;i&&(i.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,r)},t.prototype.selectDescendants=function(e,r){var i=this._descendantTraversalStack;for(i.push(e);i.length>0;)for(var o=i.pop(),s=o.children,u=0,c=s;u<c.length;u++){var l=c[u];l.state.visible&&(l.contentAvailable?(this.updateTile(l,r),this.touchTile(l,r),this.selectTile(l,r)):i.push(l))}},t.prototype.reachedSkippingThreshold=function(e){var r=e.state.ancestorWithContent,i=r!==null&&e.state.screenSpaceError<r.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>r.levelOfContent+this.skipLevels;return i},t.prototype.updateTileAncestorContentLinks=function(e,r){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;var i=e.parent;if(i){var o=!(i.hasRenderContent&&i.hasUnloadedContent)||i.state.requestedFrameNumber===r.frameNumber;e.state.ancestorWithContent=o?i:i.state.ancestorWithContent,e.state.ancestorWithContentAvailable=i.contentAvailable?i:i.state.ancestorWithContentAvailable}},t.prototype.inBaseTraversal=function(e,r){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>r:e.state.screenSpaceError>r:!0},t.prototype.traverseAndSelect=function(e,r){var i=this._selectionTraversalStack,o=this._selectionTraversalancestorStack,s;for(i.push(e);i.length>0||o.length>0;){if(o.length>0){var u=o.peek();if(u.state.stackLength===i.length){o.pop(),u!==s&&(u.state.finalResolution=!1),this.selectTile(u,r);continue}}var c=i.pop();if(c){var l=this.canTraverse(c,r);if(c.state.shouldSelect)if(c.refine==="ADD")this.selectTile(c,r);else{if(c.state.selectionDepth=o.length,c.state.selectionDepth>0&&(c.tileset.hasMixedContent=!0),s=c,!l){this.selectTile(c,r);continue}o.push(c),c.state.stackLength=i.length}if(l)for(var d=0,f=c.children;d<f.length;d++){var m=f[d];m.state.visible&&i.push(m)}}}},t}(TilesetBaseTraverser),identityMatrix4=new THREE__namespace.Matrix4,Tileset=function(){function n(t,e,r){var i,o,s,u,c;this.id=t,this.transform=new THREE__namespace.Matrix4,this.transformIsIdentity=!0,this.hasMixedContent=!1,this.url=(i=r.url)!==null&&i!==void 0?i:"",this.referer=(o=r.referer)!==null&&o!==void 0?o:"",this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||"",gltfUpAxis:(s=e.asset.gltfUpAxis)!==null&&s!==void 0?s:"Y",overview:e.asset.overview},this.rootMeta=(u=e.rootMeta)!==null&&u!==void 0?u:{},this.properties=(c=e.properties)!==null&&c!==void 0?c:{},this.options=r,this.maxMemoryUsage=n.DEFAULT_MAX_MEMORY_USAGE,this.maxScreenSpaceError=n.DEFAULT_MAX_SCREEN_SPACE_ERROR,this.skipLevelOfDetail=n.DEFAULT_SKIP_LEVEL_OF_DETAIL,this.loadSiblings=n.DEFAULT_LOAD_SIBLINGS,this.maxRequests=n.DEFAULT_MAX_REQUESTS,this.requestedTiles=[],this.selectedTiles=[],this.needsRefinedTiles=new Set,this.cache=new TileCache,this.normalTraverser=new TilesetNormalTraverser(this),this.skipTraverser=new TilesetSkipTraverser(this),this.requestScheduler=new TileRequestScheduler(this),this.frameNumber=0,this.pendingCount=0,this.loadedTiles=new Set,this.memoryUsageInBytes=0,this.root=new Tile("".concat(this.id,".0"),e.root,this),this.geometricError=e.geometricError}return Object.defineProperty(n.prototype,"traverser",{get:function(){return this.skipLevelOfDetail?this.skipTraverser:this.normalTraverser},enumerable:!1,configurable:!0}),n.prototype.reset=function(){for(var t=this,e=[this.root],r;r=e.pop();){for(var i=0,o=r.children.length;i<o;i++)e.push(r.children[i]);this.cache.unloadTile(r,function(s){return t.unloadTile(s)})}this.cache.reset(),this.traverser.reset(),this.requestScheduler.reset(),this.loadedTiles.clear()},n.prototype.isLoaded=function(){return this.pendingCount===0&&this.frameNumber!==0},n.prototype.traverse=function(t,e){var r=this;e===void 0&&(e=[]),this.transformIsIdentity=this.transform.equals(identityMatrix4),this.traverser.traverse(this.root,t,e),this.requestedTiles.forEach(function(i){i.hasUnloadedContent&&r.loadTile(i)}),this.cache.unloadTiles(function(){var i=r.memoryUsageInBytes>r.maxMemoryUsage*1024*1024;return i},function(i){r.unloadTile(i),r.loadedTiles.delete(i)})},n.prototype.loadTile=function(t){var e=this;this.pendingCount++,t.loadContent().catch(function(r){return e.options.onTileError(t,r),!1}).then(function(r){var i;e.pendingCount--,r&&(!((i=t.content)===null||i===void 0)&&i.data&&(e.loadedTiles.add(t),e.cache.add(t,function(){e.memoryUsageInBytes+=t.contentByteLength})),e.options.onTileLoad(t))})},n.prototype.unloadTile=function(t){this.memoryUsageInBytes-=t.contentByteLength,this.options.onTileUnload(t),t.unloadContent()},n.DEFAULT_MAX_MEMORY_USAGE=16,n.DEFAULT_MAX_SCREEN_SPACE_ERROR=4,n.DEFAULT_SKIP_LEVEL_OF_DETAIL=!1,n.DEFAULT_LOAD_SIBLINGS=!1,n.DEFAULT_MAX_REQUESTS=6,n}(),BVHObject=function(){function n(t,e){this.position=t,this.indices=e}return n.prototype.getPositionCount=function(){var t,e,r=this.indices,i=this.position;return r?r.array.length/((t=r.stride)!==null&&t!==void 0?t:1):i.array.length/((e=i.stride)!==null&&e!==void 0?e:3)},n.prototype.getPositionByIndex=function(t,e){var r,i,o,s,u=this.indices,c=this.position,l=t;if(u){var d=u.array,f=(r=u.stride)!==null&&r!==void 0?r:1,m=(i=u.offset)!==null&&i!==void 0?i:0;l=d[t*f+m]}var A=c.array,h=(o=c.stride)!==null&&o!==void 0?o:3,p=(s=c.offset)!==null&&s!==void 0?s:0;return l=l*h+p,e.x=A[l],e.y=A[l+1],e.z=A[l+2],e},n.prototype.createTree=function(t,e,r){throw new Error("not implemented")},n.prototype.trianglesInSphere=function(t,e){throw new Error("not implemented")},n.prototype.intersectRay=function(t,e,r,i){throw new Error("not implemented")},n}(),BVHNode=function(){function n(t,e,r,i,o){this.id=t,this.extents=e,this.startIndex=r,this.endIndex=i,this.deepth=o}return n}(),BYTES_PER_NODE=6*4+4+4+2+2;function packBVHNode(n,t){for(var e=new ArrayBuffer(t*BYTES_PER_NODE),r=new Float32Array(e),i=new Uint32Array(e),o=new Uint16Array(e),s=[n],u,c;u=s.pop();)c=u.id*BYTES_PER_NODE/4,r[c]=u.extents[0],r[c+1]=u.extents[1],r[c+2]=u.extents[2],r[c+3]=u.extents[3],r[c+4]=u.extents[4],r[c+5]=u.extents[5],i[c+6]=u.startIndex,i[c+7]=u.endIndex,c=u.id*BYTES_PER_NODE/2,u.node0&&(o[c+16]=u.node0.id,s.push(u.node0)),u.node1&&(o[c+17]=u.node1.id,s.push(u.node1));return e}function intersectNodeBox(n,t,e,r,i,o,s,u,c){c===void 0&&(c=0),e=e-c,r=r-c,i=i-c,o=o+c,s=s+c,u=u+c;var l=0,d=0,f=0,m=0,A=0,h=0;return t.x>=0?(l=(e-n.x)*t.x,d=(o-n.x)*t.x):(l=(o-n.x)*t.x,d=(e-n.x)*t.x),t.y>=0?(f=(r-n.y)*t.y,m=(s-n.y)*t.y):(f=(s-n.y)*t.y,m=(r-n.y)*t.y),!(l>m||f>d||(f>l&&(l=f),m<d&&(d=m),t.z>=0?(A=(i-n.z)*t.z,h=(u-n.z)*t.z):(A=(u-n.z)*t.z,h=(i-n.z)*t.z),l>h||A>d)||(A>l&&(l=A),h<d&&(d=h),d<0))}var BVHVector3=function(){function n(t,e,r){this.x=t,this.y=e,this.z=r}return n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.cross=function(t){var e=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-e*t.z,this.z=e*t.y-r*t.x,this},n.prototype.crossVectors=function(t,e){var r=t.x,i=t.y,o=t.z,s=e.x,u=e.y,c=e.z;return this.x=i*c-o*u,this.y=o*s-r*c,this.z=r*u-i*s,this},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n}(),BVHIntersect=function(){function n(t,e,r){this.triangle=t,this.intersectionPoint=e,this.index=r}return n}(),EPSILON$1=1e-6,scratchVector3$4=new BVHVector3(0,0,0),scratchVector3A=new BVHVector3(0,0,0),scratchVector3B=new BVHVector3(0,0,0),scratchVector3C=new BVHVector3(0,0,0),BVHMesh=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,i){r=Math.min(r,16);var o=this.getPositionCount()/3,s=o>65535?new Uint32Array(o):new Uint16Array(o),u=new Float32Array(o*6),c=[],l=0,d=-1;if(i)for(var f=0,m=0,A=0,h=void 0,p=void 0,y=void 0,v=void 0,g=void 0,E=void 0,b=void 0;f<o;f+=1,m+=3,A+=6)s[f]=f,this.getPositionByIndex(m,scratchVector3A),this.getPositionByIndex(m+1,scratchVector3B),this.getPositionByIndex(m+2,scratchVector3C),h=v=scratchVector3A.x,b=scratchVector3B.x,b<h&&(h=b),b>v&&(v=b),b=scratchVector3C.x,b<h&&(h=b),b>v&&(v=b),p=g=scratchVector3A.y,b=scratchVector3B.y,b<p&&(p=b),b>g&&(g=b),b=scratchVector3C.y,b<p&&(p=b),b>g&&(g=b),y=E=scratchVector3A.z,b=scratchVector3B.z,b<y&&(y=b),b>E&&(E=b),b=scratchVector3C.z,b<y&&(y=b),b>E&&(E=b),u[A]=h,u[A+1]=p,u[A+2]=y,u[A+3]=v,u[A+4]=g,u[A+5]=E;else{for(var T=1/0,x=1/0,R=1/0,_=-1/0,M=-1/0,S=-1/0,f=0,m=0,A=0,h=void 0,p=void 0,y=void 0,v=void 0,g=void 0,E=void 0,b=void 0;f<o;f+=1,m+=3,A+=6)s[f]=f,this.getPositionByIndex(m,scratchVector3A),this.getPositionByIndex(m+1,scratchVector3B),this.getPositionByIndex(m+2,scratchVector3C),h=v=scratchVector3A.x,b=scratchVector3B.x,b<h&&(h=b),b>v&&(v=b),b=scratchVector3C.x,b<h&&(h=b),b>v&&(v=b),p=g=scratchVector3A.y,b=scratchVector3B.y,b<p&&(p=b),b>g&&(g=b),b=scratchVector3C.y,b<p&&(p=b),b>g&&(g=b),y=E=scratchVector3A.z,b=scratchVector3B.z,b<y&&(y=b),b>E&&(E=b),b=scratchVector3C.z,b<y&&(y=b),b>E&&(E=b),u[A]=h,u[A+1]=p,u[A+2]=y,u[A+3]=v,u[A+4]=g,u[A+5]=E,h<T&&(T=h),v>_&&(_=v),p<x&&(x=p),g>M&&(M=g),y<R&&(R=y),E>S&&(S=E);i=[T,x,R,_,M,S]}var I=new BVHNode(++d,i,0,o,0);c[l++]=I;var C=[],H=[0,1,2],B=function(O,k){return C[k]-C[O]};function L(O){var k=O.startIndex,G=O.endIndex,z=O.extents;C[0]=z[3]-z[0],C[1]=z[4]-z[1],C[2]=z[5]-z[2],H.sort(B);for(var D=0;D<3;D++){for(var U=H[D],K=z[U]+z[U+3],Q=k,q=G-1,J=-1,j=void 0;Q<=q;)J===-1?(j=s[Q],u[j*6+U]+u[j*6+U+3]<K?Q++:J=j):(j=s[q],u[j*6+U]+u[j*6+U+3]>=K||(s[Q]=j,s[q]=J,J=-1,Q++),q--);if(Q>k&&Q<G){var re=new BVHNode(++d,calcExtents(s,u,k,Q,EPSILON$1),k,Q,O.deepth+1);re.deepth<r&&re.endIndex-re.startIndex>e&&(c[l++]=re);var W=new BVHNode(++d,calcExtents(s,u,Q,G,EPSILON$1),Q,G,O.deepth+1);W.deepth<r&&W.endIndex-W.startIndex>e&&(c[l++]=W),O.node0=re,O.node1=W,O.startIndex=0,O.endIndex=0;break}}}for(;l;)L(c[--l]);return this.offsetArray=s,this.rootNodePacked=packBVHNode(I,d+1),c.length=0,this},t.prototype.trianglesInSphere=function(e,r){for(var i=this.offsetArray,o=this.rootNodePacked,s=new Float32Array(o),u=new Uint32Array(o),c=new Uint16Array(o),l=[0],d=[],f,m,A,h;(f=l.pop())!==void 0;){h=f*BYTES_PER_NODE/4;var p=clamp(e.x,s[h],s[h+3])-e.x,y=clamp(e.y,s[h+1],s[h+4])-e.y,v=clamp(e.z,s[h+2],s[h+5])-e.z;if(p*p+y*y+v*v<=r*r){for(var g=u[h+6];g<u[h+7];g++)d.push(i[g]);h=f*BYTES_PER_NODE/2,m=c[h+16],A=c[h+17],m&&l.push(m),A&&l.push(A)}}for(var E=d.length,b=new Float32Array(E*9),g=0;g<E;g++){var T=d[g];this.getPositionByIndex(T,scratchVector3$4),b[g*9]=scratchVector3$4.x,b[g*9+1]=scratchVector3$4.y,b[g*9+2]=scratchVector3$4.z,this.getPositionByIndex(T+1,scratchVector3$4),b[g*9+3]=scratchVector3$4.x,b[g*9+4]=scratchVector3$4.y,b[g*9+5]=scratchVector3$4.z,this.getPositionByIndex(T+2,scratchVector3$4),b[g*9+6]=scratchVector3$4.x,b[g*9+7]=scratchVector3$4.y,b[g*9+8]=scratchVector3$4.z}return b},t.prototype.intersectRay=function(e,r,i,o){for(var s=this.offsetArray,u=this.rootNodePacked,c=new Float32Array(u),l=new Uint32Array(u),d=new Uint16Array(u),f=new BVHVector3(1/r.x,1/r.y,1/r.z),m=[0],A,h,p,y;(A=m.pop())!==void 0;)if(y=A*BYTES_PER_NODE/4,intersectNodeBox(e,f,c[y],c[y+1],c[y+2],c[y+3],c[y+4],c[y+5])){for(var v=l[y+6],g=l[y+7],E=void 0,b=void 0,T=void 0,x=e.x,R=e.y,_=e.z,M=r.x,S=r.y,I=r.z,C=void 0,H=void 0,B=void 0,L=void 0,O=void 0,k=void 0,G=void 0,z=void 0,D=void 0,U=void 0,K=void 0,Q=void 0,q=void 0,J=void 0,j=void 0,re=void 0,W=void 0,te=void 0,$=void 0,ne=void 0,ee=void 0,fe=void 0,ie=void 0,se=void 0,Ae=void 0,he=void 0,me=void 0;v<g;v++){if(E=s[v],b=E*3,this.getPositionByIndex(b,scratchVector3$4),C=scratchVector3$4.x,H=scratchVector3$4.y,B=scratchVector3$4.z,this.getPositionByIndex(b+1,scratchVector3$4),L=scratchVector3$4.x,O=scratchVector3$4.y,k=scratchVector3$4.z,this.getPositionByIndex(b+2,scratchVector3$4),G=scratchVector3$4.x,z=scratchVector3$4.y,D=scratchVector3$4.z,U=L-C,K=O-H,Q=k-B,q=G-C,J=z-H,j=D-B,re=K*j-Q*J,W=Q*q-U*j,te=U*J-K*q,ie=M*re+S*W+I*te,ie>0)fe=1;else if(ie<0)fe=-1,ie=-ie;else continue;$=x-C,ne=R-H,ee=_-B,se=fe*(M*(ne*j-ee*J)+S*(ee*q-$*j)+I*($*J-ne*q)),!(se<0)&&(Ae=fe*(M*(K*ee-Q*ne)+S*(Q*$-U*ee)+I*(U*ne-K*$)),!(Ae<0)&&(se+Ae>ie||(he=-fe*($*re+ne*W+ee*te),!(he<0)&&(me=he/ie,o.push(new BVHIntersect([C,H,B,L,O,k,G,z,D],[x+M*me,R+S*me,_+I*me],E))))))}y=A*BYTES_PER_NODE/2,h=d[y+16],p=d[y+17],h&&m.push(h),p&&m.push(p)}return o},t}(BVHObject);function clamp(n,t,e){return n<t?t:n>e?e:n}function calcExtents(n,t,e,r,i){if(e>=r)return[0,0,0,0,0,0];for(var o=1/0,s=1/0,u=1/0,c=-1/0,l=-1/0,d=-1/0,f=e,m=void 0,A=void 0;f<r;f++)m=n[f]*6,A=t[m],A<o&&(o=A),A=t[m+1],A<s&&(s=A),A=t[m+2],A<u&&(u=A),A=t[m+3],A>c&&(c=A),A=t[m+4],A>l&&(l=A),A=t[m+5],A>d&&(d=A);return[o-i,s-i,u-i,c+i,l+i,d+i]}var EPSILON=1e-6,ORDER_AXISES=["x","y","z"],scratchVector3$3=new BVHVector3(0,0,0),BVHPoints=function(n){__extends(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.createTree=function(e,r,i){r=Math.min(r,16);var o=this.getPositionByIndex.bind(this),s=this.getPositionCount(),u=s>65535?new Uint32Array(s):new Uint16Array(s),c=[],l=0,d=-1;if(i)for(var f=0;f<s;f+=1)u[f]=f;else{o(0,scratchVector3$3);for(var m=scratchVector3$3.x,A=scratchVector3$3.y,h=scratchVector3$3.z,p=m,y=A,v=h,f=0,g=void 0,E=void 0,b=void 0;f<s;f+=1)u[f]=f,o(f,scratchVector3$3),g=scratchVector3$3.x,E=scratchVector3$3.y,b=scratchVector3$3.z,g<m?m=g:g>p&&(p=g),E<A?A=E:E>y&&(y=E),b<h?h=b:b>v&&(v=b);i=[m,A,h,p,y,v]}var T=new BVHNode(++d,i,0,s,0);c[l++]=T;var x=[],R=[0,1,2],_=function(S,I){return x[I]-x[S]};function M(S){var I=S.startIndex,C=S.endIndex,H=S.extents;x[0]=H[3]-H[0],x[1]=H[4]-H[1],x[2]=H[5]-H[2];for(var B=R.sort(_)[0],L=ORDER_AXISES[B],O=(H[B]+H[B+3])/2,k=I,G=C-1,z=-1,D;k<=G;)z===-1?(D=u[k],o(D,scratchVector3$3),scratchVector3$3[L]<O?k++:z=D):(D=u[G],o(D,scratchVector3$3),scratchVector3$3[L]>=O||(u[k]=D,u[G]=z,z=-1,k++),G--);if(k>I){var U=H.slice();U[B+3]=O+EPSILON;var K=new BVHNode(++d,U,I,k,S.deepth+1);K.deepth<r&&K.endIndex-K.startIndex>e&&(c[l++]=K),S.node0=K}if(C>k){var Q=H.slice();Q[B]=O-EPSILON;var q=new BVHNode(++d,Q,k,C,S.deepth+1);q.deepth<r&&q.endIndex-q.startIndex>e&&(c[l++]=q),S.node1=q}S.startIndex=0,S.endIndex=0}for(;l;)M(c[--l]);return this.offsetArray=u,this.rootNodePacked=packBVHNode(T,d+1),c.length=0,this},t.prototype.intersectRay=function(e,r,i,o){for(var s=this.offsetArray,u=this.rootNodePacked,c=new Float32Array(u),l=new Uint32Array(u),d=new Uint16Array(u),f=i*i,m=new BVHVector3(1/r.x,1/r.y,1/r.z),A=[0],h,p,y,v;(h=A.pop())!==void 0;)if(v=h*BYTES_PER_NODE/4,intersectNodeBox(e,m,c[v],c[v+1],c[v+2],c[v+3],c[v+4],c[v+5],i)){for(var g=l[v+6],E=l[v+7],b=void 0,T=void 0,x=void 0,R=void 0,_=void 0,M=void 0,S=void 0,I=void 0,C=void 0,H=void 0,B=void 0,L=void 0;g<E;g++)b=s[g],this.getPositionByIndex(b,scratchVector3$3),T=scratchVector3$3.x,x=scratchVector3$3.y,R=scratchVector3$3.z,_=e.x,M=e.y,S=e.z,I=r.x,C=r.y,H=r.z,B=I*(T-_)+C*(x-M)+H*(R-S),B>0&&(_+=I*B,M+=C*B,S+=H*B),I=T-_,C=x-M,H=R-S,B=I*I+C*C+H*H,B<=f&&o.push(new BVHIntersect([T,x,R,T,x,R,T,x,R],[_,M,S],b));v=h*BYTES_PER_NODE/2,p=d[v+16],y=d[v+17],p&&A.push(p),y&&A.push(y)}return o},t}(BVHObject);const encodedJs$1="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlcj1mdW5jdGlvbihlLHIpe3JldHVybiBlcj1PYmplY3Quc2V0UHJvdG90eXBlT2Z8fHtfX3Byb3RvX186W119aW5zdGFuY2VvZiBBcnJheSYmZnVuY3Rpb24odCxvKXt0Ll9fcHJvdG9fXz1vfXx8ZnVuY3Rpb24odCxvKXtmb3IodmFyIGYgaW4gbylPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobyxmKSYmKHRbZl09b1tmXSl9LGVyKGUscil9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VzaChuLm5vZGUwKSksbi5ub2RlMSYmKGRbcysxN109bi5ub2RlMS5pZCx2LnB1c2gobi5ub2RlMSkpO3JldHVybiB0fWZ1bmN0aW9uIGNyKGUscix0LG8sZixkLHYsbixzKXtzPT09dm9pZCAwJiYocz0wKSx0PXQtcyxvPW8tcyxmPWYtcyxkPWQrcyx2PXYrcyxuPW4rczt2YXIgdT0wLHc9MCx5PTAscD0wLGE9MCxoPTA7cmV0dXJuIHIueD49MD8odT0odC1lLngpKnIueCx3PShkLWUueCkqci54KToodT0oZC1lLngpKnIueCx3PSh0LWUueCkqci54KSxyLnk+PTA/KHk9KG8tZS55KSpyLnkscD0odi1lLnkpKnIueSk6KHk9KHYtZS55KSpyLnkscD0oby1lLnkpKnIueSksISh1PnB8fHk+d3x8KHk+dSYmKHU9eSkscDx3JiYodz1wKSxyLno+PTA/KGE9KGYtZS56KSpyLnosaD0obi1lLnopKnIueik6KGE9KG4tZS56KSpyLnosaD0oZi1lLnopKnIueiksdT5ofHxhPncpfHwoYT51JiYodT1hKSxoPHcmJih3PWgpLHc8MCkpfXZhciBZPWZ1bmN0aW9uKCl7ZnVuY3Rpb24gZShyLHQsbyl7dGhpcy54PXIsdGhpcy55PXQsdGhpcy56PW99cmV0dXJuIGUucHJvdG90eXBlLmNvcHk9ZnVuY3Rpb24ocil7cmV0dXJuIHRoaXMueD1yLngsdGhpcy55PXIueSx0aGlzLno9ci56LHRoaXN9LGUucHJvdG90eXBlLnNldD1mdW5jdGlvbihyLHQsbyl7cmV0dXJuIHRoaXMueD1yLHRoaXMueT10LHRoaXMuej1vLHRoaXN9LGUucHJvdG90eXBlLmZyb21BcnJheT1mdW5jdGlvbihyLHQpe3JldHVybiB0PT09dm9pZCAwJiYodD0wKSx0aGlzLng9clt0XSx0aGlzLnk9clt0KzFdLHRoaXMuej1yW3QrMl0sdGhpc30sZS5wcm90b3R5cGUudG9BcnJheT1mdW5jdGlvbihyLHQpe3JldHVybiByPT09dm9pZCAwJiYocj1bX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WJ1dGVzKXt2YXIgeT1zLmF0dHJpYnV0ZXNbd107eSYmeS5idWZmZXIgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlciYmby5hZGQoeS5idWZmZXIpfXU9cy5pbmRpY2VzLHUmJnUuYnVmZmVyIGluc3RhbmNlb2YgQXJyYXlCdWZmZXImJm8uYWRkKHUuYnVmZmVyKSx1PXMub2Zmc2V0QXJyYXksdSYmdS5idWZmZXIgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlciYmby5hZGQodS5idWZmZXIpLG8uYWRkKHMucm9vdE5vZGVQYWNrZWQpfXJldHVybntvdXRwdXQ6dCx0cmFuc2ZlcjpBcnJheS5mcm9tKG8pfX0pfSl9KSgpOwo=",decodeBase64$1=n=>Uint8Array.from(atob(n),t=>t.charCodeAt(0)),blob$2=typeof self!="undefined"&&self.Blob&&new Blob([decodeBase64$1(encodedJs$1)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$1(n){let t;try{if(t=blob$2&&(self.URL||self.webkitURL).createObjectURL(blob$2),!t)throw"";const e=new Worker(t,{name:n==null?void 0:n.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch(e){return new Worker("data:text/javascript;base64,"+encodedJs$1,{name:n==null?void 0:n.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var WorkerPool$1=function(){function n(t,e){this.pool=e,this.workerCreator=t,this.queue=[],this.workers=[],this.workersResolver=[],this.workerStatus=0}return n.prototype.initWorker=function(t){if(this.workerCreator&&!this.workers[t]){var e=this.workerCreator();e.addEventListener("message",this.onMessage.bind(this,t)),this.workers[t]=e}},n.prototype.getIdleWorker=function(){for(var t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1},n.prototype.onMessage=function(t,e){var r=this.workersResolver[t],i=r.resolve,o=r.reject;if(e.data&&"$$error"in e.data?o(e.data.$$error):i(e.data),this.queue.length){var s=this.queue.shift(),u=s.resolve,c=s.reject,l=s.input,d=s.transfer;this.workersResolver[t]={resolve:u,reject:c},this.workers[t].postMessage(l,d)}else this.workerStatus^=1<<t},n.prototype.postMessage=function(t,e){var r=this;return e===void 0&&(e=[]),new Promise(function(i,o){var s=r.getIdleWorker();s!==-1?(r.initWorker(s),r.workerStatus|=1<<s,r.workersResolver[s]={resolve:i,reject:o},r.workers[s].postMessage(t,e)):r.queue.push({resolve:i,reject:o,input:t,transfer:e})})},n.prototype.dispose=function(){this.workers.forEach(function(t){return t.terminate()}),this.workersResolver.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0},n}(),bvhWorkerPool=new WorkerPool$1(function(){return new WorkerWrapper$1},4),bvhMeshMap=new Map,scratchRay=new THREE__namespace.Ray,scratchNormalMatrix=new THREE__namespace.Matrix3,scratchInverseMatrix=new THREE__namespace.Matrix4,scratchIntersectionFaceA$1=new THREE__namespace.Vector3,scratchIntersectionFaceB$1=new THREE__namespace.Vector3,scratchIntersectionFaceC$1=new THREE__namespace.Vector3,scratchIntersectionTriangle=new THREE__namespace.Triangle;function raycastMesh(n,t,e,r){var i,o=n.matrixWorld;scratchInverseMatrix.getInverse(o),scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var s=t.intersectRay(scratchRay.origin,scratchRay.direction,0,[]),u=n.geometry,c=n.material,l=u.groups,d=u.index,f=0,m=s.length;f<m;f++){var A=s[f],h=A.triangle,p=A.index,y=A.intersectionPoint,v=new THREE__namespace.Vector3(y[0],y[1],y[2]).applyMatrix4(o),g=e.ray.origin.distanceTo(v);if(!(g<e.near||g>e.far)){var E=void 0;if(Array.isArray(c)){if(l)for(var b=p*3,T=0,x=l;T<x.length;T++){var R=x[T];if(b>=R.start&&b-R.start<R.count){E=c[(i=R.materialIndex)!==null&&i!==void 0?i:0];break}}}else E=c;if(E){var _=scratchIntersectionTriangle.set(scratchIntersectionFaceA$1.set(h[0],h[1],h[2]).applyMatrix4(o),scratchIntersectionFaceB$1.set(h[3],h[4],h[5]).applyMatrix4(o),scratchIntersectionFaceC$1.set(h[6],h[7],h[8]).applyMatrix4(o)).getNormal(new THREE__namespace.Vector3),M=p*3,S=new THREE__namespace.Face3(d?d.array[M]:M,d?d.array[M+1]:M+1,d?d.array[M+2]:M+2,_),I=e.ray.direction.dot(_);E.side===THREE__namespace.FrontSide&&I>=0||E.side===THREE__namespace.BackSide&&I<=0||r.push({distance:g,object:n,face:S,point:v,distanceToRay:0,faceIndex:p})}}}}function raycastPoints(n,t,e,r){var i,o,s=n.matrixWorld;scratchNormalMatrix.getNormalMatrix(s),scratchInverseMatrix.getInverse(s);var u=((o=(i=e.params.Points)===null||i===void 0?void 0:i.threshold)!==null&&o!==void 0?o:1)*scratchInverseMatrix.getMaxScaleOnAxis();scratchRay.copy(e.ray).applyMatrix4(scratchInverseMatrix);for(var c=t.intersectRay(scratchRay.origin,scratchRay.direction,u,[]),l=n.geometry,d=l.index,f=l.getAttribute("normal"),m=0,A=c.length;m<A;m++){var h=c[m],p=h.triangle,y=h.index,v=h.intersectionPoint,g=new THREE__namespace.Vector3(v[0],v[1],v[2]).applyMatrix4(s),E=e.ray.origin.distanceTo(g);if(!(E<e.near||E>e.far)){var b=scratchIntersectionFaceA$1.set(p[0],p[1],p[2]).applyMatrix4(s),T=d?d.array[y]:y,x=void 0;f instanceof THREE__namespace.BufferAttribute&&(x=new THREE__namespace.Vector3().fromBufferAttribute(f,T).applyNormalMatrix(scratchNormalMatrix));var R=new THREE__namespace.Face3(T,T,T,x);r.push({distance:E,object:n,face:R,point:g,distanceToRay:g.distanceTo(b),index:y})}}}var BVH_MESH_PROP="__bvh_mesh__",originMeshRaycast=THREE__namespace.Mesh.prototype.raycast;function overrideMeshRaycast(n,t){var e=getBvhTreeForMesh(this);e?raycastMesh(this,e,n,t):originMeshRaycast.call(this,n,t)}function getBvhTreeForMesh(n){var t=n[BVH_MESH_PROP];return t instanceof BVHMesh,t}function bindBvhTreeForMesh(n,t){var e;Object.assign(n,(e={},e[BVH_MESH_PROP]=t,e.raycast=overrideMeshRaycast,e))}var BVH_POINTS_PROP="__bvh_points__",originPointsRaycast=THREE__namespace.Points.prototype.raycast;function overridePointsRaycast(n,t){var e=getBvhTreeForPoints(this);e?raycastPoints(this,e,n,t):originPointsRaycast.call(this,n,t)}function getBvhTreeForPoints(n){var t=n[BVH_POINTS_PROP];return t instanceof BVHPoints,t}function bindBvhTreeForPoints(n,t){var e;Object.assign(n,(e={},e[BVH_POINTS_PROP]=t,e.raycast=overridePointsRaycast,e))}function generateBvhTree(n,t,e,r){var i=[];return n.traverse(function(o){(o instanceof THREE__namespace.Mesh||o instanceof THREE__namespace.Points)&&o.geometry instanceof THREE__namespace.BufferGeometry&&i.push(o)}),Promise.resolve().then(function(){for(var o=[],s=new Set,u=null,c=0;c<i.length;c++){var l=i[c],d=l.geometry;if(d instanceof THREE__namespace.BufferGeometry){var f=void 0;if(l instanceof THREE__namespace.Mesh?f="mesh":l instanceof THREE__namespace.Points&&(f="points"),!!f){var m=d.boundingBox,A=m?[m.min.x,m.min.y,m.min.z,m.max.x,m.max.y,m.max.z]:void 0,h={};for(var p in d.attributes){var y=d.attributes[p];y instanceof THREE__namespace.InterleavedBufferAttribute?(h[p]={array:y.data.array,stride:y.data.stride,offset:y.offset},u=y.data.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer)):(h[p]={array:y.array},u=y.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer))}var v=void 0,g=d.getIndex();g&&(g instanceof THREE__namespace.InterleavedBufferAttribute?(v={array:g.data.array,stride:g.data.stride,offset:g.offset},u=g.data.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer)):(v={array:g.array},u=g.array,u&&u.buffer instanceof ArrayBuffer&&s.add(u.buffer)));var E={type:f,attributes:h,indices:v,maxItemPerNode:e,maxTreeDepth:r,extents:A};o.push(E)}}}return bvhWorkerPool.postMessage(o,Array.from(s))}).then(function(o){for(var s=0;s<i.length;s++){var u=i[s],c=u.geometry,l=o[s];if(c instanceof THREE__namespace.BufferGeometry){for(var d in l.attributes){var f=l.attributes[d].array,m=c.attributes[d];m instanceof THREE__namespace.InterleavedBufferAttribute?m.data.array=f:m.array=f}var A=c.getIndex();if(A&&l.indices){var f=l.indices.array;A instanceof THREE__namespace.InterleavedBufferAttribute?A.data.array=f:A.array=f}if(u instanceof THREE__namespace.Mesh){var h=new BVHMesh(l.attributes.position,l.indices);h.offsetArray=l.offsetArray,h.rootNodePacked=l.rootNodePacked,bindBvhTreeForMesh(u,h)}else if(u instanceof THREE__namespace.Points){var h=new BVHPoints(l.attributes.position,l.indices);h.offsetArray=l.offsetArray,h.rootNodePacked=l.rootNodePacked,bindBvhTreeForPoints(u,h)}}}return n})}var scratchIntersectionFaceA=new THREE__namespace.Vector3,scratchIntersectionFaceB=new THREE__namespace.Vector3,scratchIntersectionFaceC=new THREE__namespace.Vector3,TileNode=function(n){__extends(t,n);function t(e,r){r===void 0&&(r=noop$1);var i=n.call(this)||this;return i.contentObject=e,i.disposer=r,i.disposers=[r],i.add(e),i}return t.prototype.generateBvhTree=function(){return generateBvhTree(this,!0,200,10)},t.prototype.intersectRaycaster=function(e,r,i){var o=this;r===void 0&&(r=!0),i===void 0&&(i=[]);for(var s=this.children.slice(),u,c=[];u=s.pop();)if(u.visible){u.raycast(e,c);for(var l=0,d=u.children.length;l<d;l++)s.push(u.children[l])}return c.forEach(function(f){var m,A,h=0;if((f.object instanceof PBMMesh||f.object instanceof PBMPointCloud)&&f.face){var p=Array.isArray(f.object.material)?f.object.material[f.face.materialIndex]:f.object.material;if(p)if(p.defines.USE_VERTEX_FLOOR){var y=(m=f.object.geometry.attributes.position)===null||m===void 0?void 0:m.array,v=(A=f.object.geometry.attributes.floor)===null||A===void 0?void 0:A.array;if(y&&v){var g=scratchIntersectionFaceA.set(y[f.face.a*3],y[f.face.a*3+1],y[f.face.a*3+2]).applyMatrix4(o.matrixWorld),E=scratchIntersectionFaceB.set(y[f.face.b*3],y[f.face.b*3+1],y[f.face.b*3+2]).applyMatrix4(o.matrixWorld),b=scratchIntersectionFaceC.set(y[f.face.c*3],y[f.face.c*3+1],y[f.face.c*3+2]).applyMatrix4(o.matrixWorld),T=f.point.distanceTo(g),x=f.point.distanceTo(E),R=f.point.distanceTo(b);h=Math.round((T*v[f.face.a]+x*v[f.face.b]+R*v[f.face.c])/(T+x+R))}}else h=p.floor}f.floor=h}),r&&c.sort(function(f,m){return f.distance-m.distance}),i.push.apply(i,c),i},t.prototype.dispose=function(){for(var e=0,r=this.disposers;e<r.length;e++){var i=r[e];i()}this.disposers.length=0},t.prototype.clone=function(){return new t(this.contentObject,this.disposer)},t}(THREE__namespace.Group);function pathJoin(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=[];n=n.map(function(u){return(u!=null?u:"").trim()}).filter(function(u){return u.length>0&&!/^\/+$/.test(u)});for(var r=0;r<n.length;r++){var i=r===0,o=r===n.length-1,s=n[r];i||(s=s.replace(/^\.\//,"").replace(/^\/+/,"")),o||(s=s.replace(/\/+$/,"")),e.push(s)}return e.join("/")}function normalizeURL(n){var t,e=/^(http\:|https\:|file\:)?\/\/[^/]/.exec(n);if(!e)return n;var r=e[1]||"",i=n.slice(r.length+2),o=i.indexOf("#");o>=0&&(n.slice(o),i=n.slice(0,o));var s=i.indexOf("?");s>=0&&(n.slice(s),i=n.slice(0,s));for(var u=i.split("/"),c=u.shift(),l=(t=u.pop())!==null&&t!==void 0?t:"",d=[],f=0,m=u;f<m.length;f++){var A=m[f];if(!(A===""||A===".")){if(A===".."){d.pop();continue}d.push(A)}}return r+"//"+c+"/"+d.join("/")+"/"+l}function isAbsoluteURL(n){return n.indexOf("//")===0||/^[0-9a-z]+\:/i.test(n)}function normalizeTileHeader(n,t,e){if(n.content&&n.content.uri&&(isAbsoluteURL(n.content.uri)||(n.content.uri=normalizeURL(pathJoin(t,n.content.uri)))),n.transform){for(var r=!1,i=0;i<16;i++){var o=n.transform[i];if(typeof o!="number"||isNaN(o)||!isFinite(o)){r=!0;break}}if(n.transform[15]===0&&(r=!0),r)throw new Error("Invalid Tile Transform: "+JSON.stringify(n.transform))}if(n.children)for(var s=0,u=n.children;s<u.length;s++){var c=u[s];normalizeTileHeader(c,t)}return n}function normalizeTilesetHeader(n,t){return n.asset||(n.asset={}),n.rootMeta||(n.rootMeta={}),n.asset.overview&&(isAbsoluteURL(n.asset.overview.imageFile)||(n.asset.overview.imageFile=normalizeURL(pathJoin(t,n.asset.overview.imageFile))),isAbsoluteURL(n.asset.overview.worldFile)||(n.asset.overview.worldFile=normalizeURL(pathJoin(t,n.asset.overview.worldFile)))),normalizeTileHeader(n.root,t),n}function initTextures(n,t,e){for(var r,i,o=Promise.resolve(),s=n.slice(),u=function(){for(var c=[],l=0,d=void 0;d=s.shift();){c.push(d);var f=((r=d.image)===null||r===void 0?void 0:r.width)*((i=d.image)===null||i===void 0?void 0:i.height);if(!isNaN(f)&&isFinite(f)&&(l+=f),l>=e)break}o=o.then(function(){return new Promise(function(m){AnimationFrameLoop.shared.add(function(){for(var A=0,h=c;A<h.length;A++){var p=h[A];t.initTexture(p)}m()},!0)})}).catch(function(){})};s.length>0;)u();return o}function appendSearch(n,t){if(t===void 0&&(t=""),(t[0]==="?"||t[0]==="&")&&(t=t.slice(1)),!t)return n;var e=n.indexOf("#"),r="";return e>=0&&(r=n.slice(e),n=n.slice(0,e)),(n[n.length-1]==="?"||n[n.length-1]==="&")&&(n=n.slice(0,-1)),n.indexOf("?")>=0?"".concat(n,"&").concat(t).concat(r):"".concat(n,"?").concat(t).concat(r)}const pointCloudFragmentShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6--n\bv{t-rp@-[|znyH0r{qvs0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvsp-Pyv}}r-\n--znA-znv\x07V{rrH--sy|n-sy||V{qr\x07H\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvsn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-sy|n-Sy||Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-]|v{`v rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-u|{Sy||V{qr\x07H0v{pyqr-Ip|zz|{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-Iy|tqr}uosl}nlsntzr{K0v{pyqr-Ipyv}}v{tl}yn{rl}nlsntzr{K|vq-znv{56-\n--<<-JJJ-前置裁切计算-JJJ--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znv\x07V{rr-7-d|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr\x07-I-=;=-\v\v-no5Sy||-:-pyv}}rh-v-j;sy||V{qr\x076-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<-JJJJJJJJJJJJJJJJ--<<-JJJ-形状裁切-JJJ--0vs-qrsv{rq5b`Rl]\\V[al`UN]RlPV_PYR6----sy|n--J-?;=-7-tyl]|v{P||q;\x07-:->;=H----sy|n--J-?;=-7-tyl]|v{P||q;\b-:->;=H----sy|n-pp-J-7-8-7H----vs-5]|v{`v r-K-E;=-33-pp-K->;=6-\n------qvpnqH----\f--0r{qvs--<<-JJJJJJJJJJJJJ--0v{pyqr-Iy|tqr}uoslsntzr{K--<<-JJJ-颜色-JJJ--rpA-sv{nyP|y|-J-_TOa|Yv{rn5rpA5P|y|9-|}npv\b66H--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----0vs-qrsv{rq5b`Rl]\\V[alONPXlUVQQR[6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-d|yq]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------qvpnqH------\f----0ryvs-qrsv{rq5b`Rl]\\V[alONPXlQN_X6------rp@-pnzrnQvrpv|{-J-{|znyv r5pnzrn]|vv|{-:-d|yq]|vv|{;\x07\b 6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------sv{nyP|y|;\x07\b -J-sv{nyP|y|;\x07\b -7-=;EH------\f----0r{qvs--0r{qvs--tylSntP|y|-J-sv{nyP|y|H--<<-JJJJJJJJJJJ--<<-JJJ-纯色-JJJ--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9-|}npv\b6H--0r{qvs--<<-JJJJJJJJJJJ--<<-JJJ-楼层显示-JJJ--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr\x07-K-:=;FF-33-no5Sy||-:-u|{Sy||V{qr\x076-K-=;FF6-\n----sy||\\}npv\b-J-=;>-7-zv{55>;=-8-PnzrnQvrpv|{;\b69->;=6H--\f--tylSntP|y|;n-J-tylSntP|y|;n-7-sy||\\}npv\bH--<<-JJJJJJJJJJJJJJ--tylSntP|y|;n-J-tylSntP|y|;n-7-z|qryNy}unH--0v{pyqr-I|{rzn}}v{tlsntzr{K--0v{pyqr-Ir{p|qv{tlsntzr{K--0v{pyqr-Is|tlsntzr{K--0v{pyqr-I}rzyv}yvrqlny}unlsntzr{K--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs--0vs-qrsv{rq5b`RlU^ldRVTUa6----sy|n-qvn{pr-J-?;=-7-yr{tu5tyl]|v{P||q;\x07\b-:-=;B6H----sy|n-rvtu-J-zn\x075=;=9->;=-:-qvn{pr6H----rvtu-J-}|5rvtu9->;B6H----tylSntP|y|;n-J-rvtuH----tylSntP|y|;\x07\b -J-tylSntP|y|;\x07\b -7-rvtuH--0r{qvs\f"),pointCloudVertexShader=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}("nvor-rp@-p|y|H0vs-qrsv{rq5b`Rl]\\V[alP\\Y\\_lNYaVabQR6--{vs|z-nz}yr?Q-tnqvr{ar\x07rH0r{qvs0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6--nvor-sy|n-sy||H0ryr--{vs|z-sy|n-sy||H0r{qvsn\bv{t-sy|n-Sy||H0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvs{vs|z-rp?-r|yv|{H{vs|z-sy|n-}v\x07ry_nv|H{vs|z-sy|n-}|v{`pnyrH{vs|z-sy|n-}|v{Zv{]v\x07ryH{vs|z-sy|n-}|v{Zn\x07]v\x07ryH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-tr|zrvpR|H{vs|z-rp@-z|qryO|{qv{tZn\x07H{vs|z-rp@-z|qryO|{qv{tZv{Hn\bv{t-rpA-d|yq]|vv|{Hn\bv{t-rp@-PnzrnQvrpv|{Hn\bv{t-rp@-P|y|Hn\bv{t-sy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vpR|H----sy|n-urvtu-J->;=-<-}|wrpv|{Znv\x07h>jh>j-7-zv\x075>;=9-:z]|vv|{; 9-:}|wrpv|{Znv\x07h?jh@j6-7-?;=H----rny]|v{`v r-J-r|yv|{;\b-7-rny]|v{`v r-<-urvtuH--0ryvs-qrsv{rq5b`Rl]\\V[al`VgRlNaaR[bNaV\\[6----sy|n-urvtu-J->;=-<-}|wrpv|{Znv\x07h>jh>j-7-zv\x075>;=9-:z]|vv|{; 9-:}|wrpv|{Znv\x07h?jh@j6-7-?;=H----rny]|v{`v r-J-r|yv|{;\b-7-rny]|v{`v r-<-urvtuH--0r{qvs--tyl]|v{`v r-J-pynz}5rny]|v{`v r9-}|v{Zv{]v\x07ry-7-}v\x07ry_nv|9-}|v{Zn\x07]v\x07ry-7-}v\x07ry_nv|6H--]|v{`v r-J-tyl]|v{`v rH--0vs-qrsv{rq5b`Rl]\\V[alP\\Y\\_lNYaVabQR6----P|y|-J-trP|y|O\bUrvtu5tnqvr{ar\x07r9-d|yq]|vv|{6H--0ryr----P|y|-J-p|y|H--0r{qvs--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----[|zny-J-{|znyv r5zn@5z|qryZnv\x076-7-{|zny6H--0r{qvs--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{; 6H--0r{qvs--0vs-qrsv{rq5b`RlU^lQR]aU6----<<-sy|n-}|wSnp|-J-:=;B-7-r|yv|{;\b-<-5n{5s|-<-?;=6-7-z]|vv|{; 6H----<<-sy|n-_nqv-J-rny]|v{`v r-<-}|wSnp|H----sy|n-|vtv{nyQr}u-J-tyl]|vv|{;H----sy|n-nqwrqQr}u-J-|vtv{nyQr}u-8-=;>H----sy|n-nqw-J-nqwrqQr}u-<-|vtv{nyQr}uH----z]|vv|{;\x07\b -J-z]|vv|{;\x07\b -7-nqwH----tyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H--0r{qvs--0v{pyqr-I|yq}|lrr\x07K--0v{pyqr-Is|tlrr\x07K\f");var scratchVector4=new THREE__namespace.Vector4,shaderUniforms=Object.assign({pointScale:new THREE__namespace.Uniform(1),pointMinPixel:new THREE__namespace.Uniform(1),pointMaxPixel:new THREE__namespace.Uniform(1),opacity:new THREE__namespace.Uniform(1),gradientTexture:new THREE__namespace.Uniform(null),modelAlpha:new THREE__namespace.Uniform(0),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(null),geometricError:new THREE__namespace.Uniform(0),pixelRatio:new THREE__namespace.Uniform(1),resolution:new THREE__namespace.Uniform(new THREE__namespace.Vector2(512,512)),floor:new THREE__namespace.Uniform(0),brightness:new THREE__namespace.Uniform(1),modelBoundingMin:new THREE__namespace.Uniform(new THREE__namespace.Vector3),modelBoundingMax:new THREE__namespace.Uniform(new THREE__namespace.Vector3)},THREE__namespace.UniformsUtils.clone(THREE__namespace.UniformsLib.fog)),PBMPointCloudMaterial=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s,u,c,l,d,f,m,A,h,p,y,v,g,E,b,T,x,R,_=n.call(this,{vertexShader:pointCloudVertexShader,fragmentShader:pointCloudFragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(shaderUniforms),lights:!1,defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_FLOOR:!1,USE_VERTEX_MARK:!1,USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_POINT_NORMAL:!1,USE_POINT_SHAPE_CIRCLE:!1,USE_POINT_SIZE_ATTENUATION:!1,USE_POINT_SIZE_GEOMETRIC:!1,USE_POINT_BACK_HIDDEN:!1,USE_POINT_BACK_DARK:!1}})||this,M;return Object.defineProperties(_,{constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(S){this.uniforms.constantColor.value=S;var I=this.defines.USE_CONSTANT_COLOR,C=S!==null;I!==C&&(this.defines.USE_CONSTANT_COLOR=C,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(S){this.uniforms.opacity.value=S}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(S){this.uniforms.modelAlpha.value=S}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(S){this.uniforms.shownFloorIndex.value=S}},clippers:{get:function(){return M},set:function(S){M!==S&&(M=S,this.uniforms.clippers.value=(M||[]).map(function(I){var C=typeof I.floorIndex=="number"?I.floorIndex:-1,H=new THREE__namespace.Matrix4().getInverse(I.clippingBoxMatrix);return{matrixInverse:H,floorIndex:C}}),this.needsUpdate=!0)}},pointColor:{get:function(){return this.defines.USE_POINT_COLOR_ALTITUDE===!0?"ALTITUDE":"RGB"},set:function(S){var I=S==="ALTITUDE";this.defines.USE_POINT_COLOR_ALTITUDE!==I&&(this.defines.USE_POINT_COLOR_ALTITUDE=I,this.needsUpdate=!0)}},pointSize:{get:function(){return this.defines.USE_POINT_SIZE_GEOMETRIC===!0?"GEOMETRIC":this.defines.USE_POINT_SIZE_ATTENUATION===!0?"ATTENUATION":"FIXED"},set:function(S){var I=S==="ATTENUATION",C=S==="GEOMETRIC";this.defines.USE_POINT_SIZE_GEOMETRIC!==C&&(this.defines.USE_POINT_SIZE_GEOMETRIC=C,this.needsUpdate=!0),this.defines.USE_POINT_SIZE_ATTENUATION!==I&&(this.defines.USE_POINT_SIZE_ATTENUATION=I,this.needsUpdate=!0)}},pointShape:{get:function(){return this.defines.USE_POINT_SHAPE_CIRCLE===!0?"CIRCLE":"SQUARE"},set:function(S){var I=S==="CIRCLE";this.defines.USE_POINT_SHAPE_CIRCLE!==I&&(this.defines.USE_POINT_SHAPE_CIRCLE=I,this.needsUpdate=!0)}},pointScale:{get:function(){return this.uniforms.pointScale.value},set:function(S){this.uniforms.pointScale.value=S}},pointBack:{get:function(){return this.defines.USE_POINT_BACK_HIDDEN===!0?"HIDDEN":this.defines.USE_POINT_BACK_DARK===!0?"DARK":"VISIBLE"},set:function(S){var I=S==="HIDDEN",C=S==="DARK";this.defines.USE_POINT_BACK_HIDDEN!==I&&(this.defines.USE_POINT_BACK_HIDDEN=I,this.needsUpdate=!0),this.defines.USE_POINT_BACK_DARK!==C&&(this.defines.USE_POINT_BACK_DARK=C,this.needsUpdate=!0)}},pointMinPixel:{get:function(){return this.uniforms.pointMinPixel.value},set:function(S){this.uniforms.pointMinPixel.value=S}},pointMaxPixel:{get:function(){return this.uniforms.pointMaxPixel.value},set:function(S){this.uniforms.pointMaxPixel.value=S}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(S){S!==this.defines.USE_EDL&&(this.defines.USE_EDL=S,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(S){S!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=S,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(S){S!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=S,this.needsUpdate=!0)}},gradientTexture:{get:function(){return this.uniforms.gradientTexture.value},set:function(S){this.uniforms.gradientTexture.value=S}},floor:{get:function(){return this.uniforms.floor.value},set:function(S){this.uniforms.floor.value=S}},brightness:{get:function(){return this.uniforms.brightness.value},set:function(S){this.uniforms.brightness.value=S}}}),_.pano0=(r=e.pano0)!==null&&r!==void 0?r:defaultPbmParameters.pano0,_.pano1=(i=e.pano1)!==null&&i!==void 0?i:defaultPbmParameters.pano1,_.modelAlpha=(o=e.modelAlpha)!==null&&o!==void 0?o:defaultPbmParameters.modelAlpha,_.progress=(s=e.progress)!==null&&s!==void 0?s:defaultPbmParameters.progress,_.transition=(u=e.transition)!==null&&u!==void 0?u:defaultPbmParameters.transition,_.constantColor=(c=e.constantColor)!==null&&c!==void 0?c:defaultPbmParameters.constantColor,_.opacity=(l=e.opacity)!==null&&l!==void 0?l:defaultPbmParameters.opacity,_.shownFloorIndex=(d=e.shownFloorIndex)!==null&&d!==void 0?d:defaultPbmParameters.shownFloorIndex,_.clippers=(f=e.clippers)!==null&&f!==void 0?f:defaultPbmParameters.clippers,_.useEDL=(m=e.useEDL)!==null&&m!==void 0?m:defaultPbmParameters.useEDL,_.useHQWeight=(A=e.useHQWeight)!==null&&A!==void 0?A:defaultPbmParameters.useHQWeight,_.useHQDepth=(h=e.useHQDepth)!==null&&h!==void 0?h:defaultPbmParameters.useHQDepth,_.pointColor=(p=e.pointColor)!==null&&p!==void 0?p:defaultPbmParameters.pointColor,_.pointShape=(y=e.pointShape)!==null&&y!==void 0?y:defaultPbmParameters.pointShape,_.pointSize=(v=e.pointSize)!==null&&v!==void 0?v:defaultPbmParameters.pointSize,_.pointScale=(g=e.pointScale)!==null&&g!==void 0?g:defaultPbmParameters.pointScale,_.pointBack=(E=e.pointBack)!==null&&E!==void 0?E:defaultPbmParameters.pointBack,_.pointMinPixel=(b=e.pointMinPixel)!==null&&b!==void 0?b:defaultPbmParameters.pointMinPixel,_.pointMaxPixel=(T=e.pointMaxPixel)!==null&&T!==void 0?T:defaultPbmParameters.pointMaxPixel,_.gradientTexture=(x=e.gradientTexture)!==null&&x!==void 0?x:defaultPbmParameters.gradientTexture,_.brightness=(R=e.brightness)!==null&&R!==void 0?R:defaultPbmParameters.brightness,_.floor=0,_.transparent=!0,_}return t.prototype.onBeforeCompile=function(e,r){var i,o,s=String((o=(i=this.clippers)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,s),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,s)},t.prototype.update=function(e,r){if(r instanceof Camera)this.uniforms.pixelRatio.value=r.pixelRatio,this.uniforms.resolution.value.copy(r.resolution);else{this.uniforms.pixelRatio.value=e.getPixelRatio();var i=e.getViewport(scratchVector4);this.uniforms.resolution.value.set(i.z,i.w)}this.transparent=this.shownFloorIndex>-1||this.opacity<1||this.modelAlpha<1||this.brightness<1,this.useEDL&&(this.transparent=!1),this.useHQDepth&&(this.depthTest=!0,this.depthWrite=!0),this.useHQWeight?(this.depthWrite=!1,this.blending=THREE__namespace.CustomBlending,this.blendSrc=THREE__namespace.SrcAlphaFactor,this.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,this.blendDst=THREE__namespace.OneFactor,this.blendDstAlpha=THREE__namespace.OneFactor):(this.depthWrite=!0,this.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,this.blendEquation=THREE__namespace.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.opacity<1?(this.blending=THREE__namespace.AdditiveBlending,this.depthTest=!1):(this.blending=THREE__namespace.NormalBlending,this.depthTest=!0))},t.prototype.syncModel=function(e){var r="".concat(e.id,":").concat(e.materialVersion);r!==this.syncModelVersion&&(Object.assign(this,e.getMaterial()),this.uniforms.modelBoundingMax.value.copy(e.bounding.max),this.uniforms.modelBoundingMin.value.copy(e.bounding.min),this.syncModelVersion=r)},t.prototype.copy=function(e){return n.prototype.copy.call(this,this),this.pano0=e.pano0,this.pano1=e.pano1,this.progress=e.progress,this.transition=e.transition,this.shownFloorIndex=e.shownFloorIndex,this.brightness=e.brightness,this.clippers=e.clippers,this.constantColor=e.constantColor,this.modelAlpha=e.modelAlpha,this.useEDL=e.useEDL,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.pointColor=e.pointColor,this.pointSize=e.pointSize,this.pointShape=e.pointShape,this.pointScale=e.pointScale,this.pointBack=e.pointBack,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.gradientTexture=e.gradientTexture,this},t}(THREE__namespace.ShaderMaterial),SIZEOF_UINT32$1=4;function parseHeader(n,t,e){var r=new DataView(t);if(n.magic=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.byteLength=r.getUint32(e,!0),e+=SIZEOF_UINT32$1,n.version!==1)throw new Error("3D Tile Version ".concat(n.version," not supported"));return e}var _a$3,GL_TYPE;(function(n){n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.INT=5124]="INT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.DOUBLE=5130]="DOUBLE"})(GL_TYPE||(GL_TYPE={}));var GL_TYPE_TO_ARRAY_TYPE=(_a$3={},_a$3[GL_TYPE.DOUBLE]=Float64Array,_a$3[GL_TYPE.FLOAT]=Float32Array,_a$3[GL_TYPE.UNSIGNED_SHORT]=Uint16Array,_a$3[GL_TYPE.UNSIGNED_INT]=Uint32Array,_a$3[GL_TYPE.UNSIGNED_BYTE]=Uint8Array,_a$3[GL_TYPE.BYTE]=Int8Array,_a$3[GL_TYPE.SHORT]=Int16Array,_a$3[GL_TYPE.INT]=Int32Array,_a$3),NAME_TO_GL_TYPE={DOUBLE:GL_TYPE.DOUBLE,FLOAT:GL_TYPE.FLOAT,UNSIGNED_SHORT:GL_TYPE.UNSIGNED_SHORT,UNSIGNED_INT:GL_TYPE.UNSIGNED_INT,UNSIGNED_BYTE:GL_TYPE.UNSIGNED_BYTE,BYTE:GL_TYPE.BYTE,SHORT:GL_TYPE.SHORT,INT:GL_TYPE.INT};function getArrayType(n){var t=GL_TYPE_TO_ARRAY_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}function getByteSize(n){var t=getArrayType(n);return t.BYTES_PER_ELEMENT}function createTypedArray(n,t,e,r){e===void 0&&(e=0);var i=getArrayType(n);if(e%getByteSize(n)!==0){var o=r?t.slice(e,e+r*getByteSize(n)):t.slice(e);return new i(o)}else return new i(t,e,r!=null?r:(t.byteLength-e)/getByteSize(n))}function glTypeFromName(n){var t=NAME_TO_GL_TYPE[n];if(!t)throw new Error("Failed to convert GL type");return t}var FeatureTable=function(){function n(t,e){this.featuresLength=0,this.cachedTypedArrays={},this.json=t,this.buffer=e;var r=this.getGlobalProperty("POINTS_LENGTH",GL_TYPE.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}return n.prototype.getExtension=function(t){return this.json.extensions&&this.json.extensions[t]},n.prototype.hasProperty=function(t){return!!this.json[t]},n.prototype.getGlobalProperty=function(t,e,r){var i=this.json[t];if(typeof i=="number"){var o=getArrayType(e);return new o([i])}else if(Array.isArray(i)){var o=getArrayType(e);return new o(i)}else if(i&&Number.isFinite(i.byteOffset))return this.getTypedArrayFromBinary(t,e,r,1,i.byteOffset);return null},n.prototype.getPropertyArray=function(t,e,r){var i=this.json[t];return i&&Number.isFinite(i.byteOffset)?("componentType"in i&&(e=glTypeFromName(i.componentType)),this.getTypedArrayFromBinary(t,e,r,this.featuresLength,i.byteOffset)):this.getTypedArrayFromArray(t,e,i)},n.prototype.getProperty=function(t,e,r,i,o){var s=this.json[t];if(!s)return null;var u=this.getPropertyArray(t,e,r);if(r===1)return o[0]=u[i],o;for(var c=0;c<r;++c)o[c]=u[r*i+c];return o},n.prototype.getTypedArrayFromBinary=function(t,e,r,i,o){var s=this.cachedTypedArrays,u=s[t];return u||(u=createTypedArray(e,this.buffer.buffer,this.buffer.byteOffset+o,i*r),s[t]=u),u},n.prototype.getTypedArrayFromArray=function(t,e,r){var i=this.cachedTypedArrays,o=i[t];return o||(o=createTypedArray(e,r),i[t]=o),o},n}(),SIZEOF_UINT32=4,DEPRECATION_WARNING="b3dm tile in legacy format.";function getStringFromArrayBuffer(n,t,e){var r=new TextDecoder("utf8"),i=new Uint8Array(n,t,e),o=r.decode(i);return o}function parseTable(n,t,e){return e=parseTablesHeader(n,t,e),e=parseFeatureTable(n,t,e),e=parseBatchTable(n,t,e),e}function parseTablesHeader(n,t,e){var r=new DataView(t),i=0;n.header=n.header||{};var o=r.getUint32(e,!0);e+=SIZEOF_UINT32;var s=r.getUint32(e,!0);e+=SIZEOF_UINT32;var u=r.getUint32(e,!0);e+=SIZEOF_UINT32;var c=r.getUint32(e,!0);return e+=SIZEOF_UINT32,u>=570425344?(e-=SIZEOF_UINT32*2,i=o,u=s,c=0,o=0,s=0,console.warn(DEPRECATION_WARNING)):c>=570425344&&(e-=SIZEOF_UINT32,i=u,u=o,c=s,o=0,s=0,console.warn(DEPRECATION_WARNING)),n.header.featureTableJsonByteLength=o,n.header.featureTableBinaryByteLength=s,n.header.batchTableJsonByteLength=u,n.header.batchTableBinaryByteLength=c,n.header.batchLength=i,e}function parseFeatureTable(n,t,e){var r=n.header||{},i=r.featureTableJsonByteLength,o=r.featureTableBinaryByteLength,s=r.batchLength;if(n.featureTableJson={BATCH_LENGTH:s||0},i&&i>0){var u=getStringFromArrayBuffer(t,e,i);n.featureTableJson=JSON.parse(u)}e+=i||0,n.featureTableBinary=new Uint8Array(t,e,o),e+=o||0,n.rtcCenter=[0,0,0];var c=new FeatureTable(n.featureTableJson,n.featureTableBinary);if(Array.isArray(c.json.RTC_CENTER)){var l=c.json.RTC_CENTER;n.rtcCenter[0]=l[0],n.rtcCenter[1]=l[1],n.rtcCenter[2]=l[2]}else{var l=c.getGlobalProperty("RTC_CENTER",GL_TYPE.FLOAT,3);l&&(n.rtcCenter[0]=l[0],n.rtcCenter[1]=l[1],n.rtcCenter[2]=l[2])}return e}function parseBatchTable(n,t,e){var r=n.header||{},i=r.batchTableJsonByteLength,o=r.batchTableBinaryByteLength;if(i&&i>0){var s=getStringFromArrayBuffer(t,e,i);n.batchTableJson=JSON.parse(s),e+=i,o&&o>0&&(n.batchTableBinary=new Uint8Array(t,e,o),n.batchTableBinary=new Uint8Array(n.batchTableBinary),e+=o)}return e}function sliceArrayBuffer(n,t,e){var r=e!==void 0?new Uint8Array(n).subarray(t,t+e):new Uint8Array(n).subarray(t),i=new Uint8Array(r);return i.buffer}function parseGlTFArrayBuffer(n,t,e){var r=n.byteLength-e;if(r===0)throw new Error("glTF byte length must be greater than 0.");return e%4!==0&&console.warn("".concat(n.type,": embedded glb is not aligned to a 4-byte boundary.")),n.gltfArrayBuffer=sliceArrayBuffer(t,e,r),n.byteLength}function decodeText(n){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(n);for(var t="",e=0,r=n.length;e<r;e++)t+=String.fromCharCode(n[e]);try{return decodeURIComponent(escape(t))}catch(i){return t}}var WEBGL_CONSTANTS={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},WEBGL_COMPONENT_TYPES={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},WEBGL_FILTERS={9728:THREE__namespace.NearestFilter,9729:THREE__namespace.LinearFilter,9984:THREE__namespace.NearestMipmapNearestFilter,9985:THREE__namespace.LinearMipmapNearestFilter,9986:THREE__namespace.NearestMipmapLinearFilter,9987:THREE__namespace.LinearMipmapLinearFilter},WEBGL_WRAPPINGS={33071:THREE__namespace.ClampToEdgeWrapping,33648:THREE__namespace.MirroredRepeatWrapping,10497:THREE__namespace.RepeatWrapping},WEBGL_TYPE_SIZES={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ATTRIBUTES={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},PATH_PROPERTIES={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},INTERPOLATION={CUBICSPLINE:void 0,LINEAR:THREE__namespace.InterpolateLinear,STEP:THREE__namespace.InterpolateDiscrete},ALPHA_MODES={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function values(n){var t=[];for(var e in n)t.push(n[e]);return t}function composeDsiposeSet(n){var t=Array.from(n);return function(){for(var e=0,r=t;e<r.length;e++){var i=r[e];typeof i.dispose=="function"&&i.dispose(),typeof i.close=="function"&&i.close()}}}var Parser=function(){function n(t,e,r){this.json=t,this.extensions=e,this.options=r,this.cache=new Map,this.disposeSet=new Set,this.textureSet=new Set,this.nodeNamesUsed={}}return n.prototype.dispose=function(){this.cache.clear(),this.disposeSet.forEach(function(t){typeof t.dispose=="function"&&t.dispose(),typeof t.close=="function"&&t.close()}),this.disposeSet.clear(),this.textureSet.clear(),this.extensions={},this.json={asset:{version:"unknown"}}},n.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],i=0,o=e.length;i<o;i++)for(var s=e[i].joints,u=0,c=s.length;u<c;u++)t[s[u]].isBone=!0;for(var l=0,d=t.length;l<d;l++){var f=t[l];f.mesh!==void 0&&f.skin!==void 0&&(r[f.mesh].isSkinnedMesh=!0)}},n.prototype.parse=function(){var t=this,e=this.json,r=this.extensions;this.markDefs();for(var i=0,o=values(r);i<o.length;i++){var s=o[i];s.markDefs(this)}return Promise.all(values(r).map(function(u){return u.prepare(t)})).then(function(){var u,c,l;return Promise.all([Promise.all(((u=e.scenes)!==null&&u!==void 0?u:[]).map(function(d,f){return t.loadScene(f)})),Promise.all(((c=e.animations)!==null&&c!==void 0?c:[]).map(function(d,f){return t.loadAnimation(f)})),Promise.all(((l=e.cameras)!==null&&l!==void 0?l:[]).map(function(d,f){return t.loadCamera(f)}))])}).then(function(u){var c=u[0],l=u[1],d=u[2],f={json:e,scene:c[e.scene||0],scenes:c,animations:l,cameras:d,textures:[],dispose:noop$1};return f}).then(function(u){return Promise.all(values(r).map(function(c){return c.emitResult(u,t)})).then(function(){return u})}).then(function(u){var c=Array.from(t.textureSet),l=composeDsiposeSet(t.disposeSet);return Object.assign(u,{textures:c,dispose:l}),t.textureSet.clear(),t.disposeSet.clear(),t.dispose(),u})},n.prototype.loadCamera=function(t){var e="camera:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadCamera(t,this),i)break}if(!i){var c=void 0,l=this.json.cameras[t],d=l[l.type];d?l.type==="perspective"?c=new THREE__namespace.PerspectiveCamera(THREE__namespace.MathUtils.radToDeg(d.yfov),d.aspectRatio||1,d.znear||1,d.zfar||2e6):l.type==="orthographic"?c=new THREE__namespace.OrthographicCamera(-d.xmag,d.xmag,d.ymag,-d.ymag,d.znear,d.zfar):(console.warn("glTF: Invalid camera type ".concat(l.type,".")),c=new THREE__namespace.Camera):(console.warn("glTF: Missing camera parameters."),c=new THREE__namespace.Camera),l.name&&(c.name=this.createUniqueName(l.name)),i=Promise.resolve(c)}return this.cache.set(e,i),i},n.prototype.loadSkin=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;var i,o=this.json.skins[t],s={joints:o.joints};return o.inverseBindMatrices===void 0?i=Promise.resolve(s):i=this.loadAccessor(o.inverseBindMatrices).then(function(u){return u&&(s.inverseBindMatrices=u),s}),this.cache.set(e,i),i},n.prototype.loadAnimation=function(t){var e="animation:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadAnimation(t,this),i)break}if(!i){for(var c=this.json,l=c.animations[t],d=[],f=[],m=[],A=[],h=[],p=0,y=l.channels.length;p<y;p++){var v=l.channels[p],g=l.samplers[v.sampler],E=v.target,b=E.node!==void 0?E.node:E.id,T=l.parameters!==void 0?l.parameters[g.input]:g.input,x=l.parameters!==void 0?l.parameters[g.output]:g.output;d.push(this.loadNode(b)),f.push(this.loadAccessor(T)),m.push(this.loadAccessor(x)),A.push(g),h.push(E)}i=Promise.all([Promise.all(d),Promise.all(f),Promise.all(m),Promise.all(A),Promise.all(h)]).then(function(R){for(var _=R[0],M=R[1],S=R[2],I=R[3],C=R[4],H=[],B=function(G,z){var D=_[G],U=M[G],K=S[G],Q=I[G],q=C[G];if(D===void 0)return"continue";D.updateMatrix(),D.matrixAutoUpdate=!0;var J=void 0;switch(PATH_PROPERTIES[q.path]){case PATH_PROPERTIES.weights:J=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:J=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:J=THREE__namespace.VectorKeyframeTrack;break}var j=D.name?D.name:D.uuid,re=Q.interpolation!==void 0?INTERPOLATION[Q.interpolation]:THREE__namespace.InterpolateLinear,W=[];PATH_PROPERTIES[q.path]===PATH_PROPERTIES.weights?D.traverse(function(se){se.morphTargetInfluences&&W.push(se.name?se.name:se.uuid)}):W.push(j);var te=K.array;if(K.normalized){for(var $=getNormalizedComponentScale(te.constructor),ne=new Float32Array(te.length),ee=0,fe=te.length;ee<fe;ee++)ne[ee]=te[ee]*$;te=ne}for(var ee=0,fe=W.length;ee<fe;ee++){var ie=new J(W[ee]+"."+PATH_PROPERTIES[q.path],U.array,te,re);H.push(ie)}},L=0,O=_.length;L<O;L++)B(L);var k=l.name?l.name:"animation_"+t;return new THREE__namespace.AnimationClip(k,void 0,H)})}return this.cache.set(e,i),i},n.prototype.loadBuffer=function(t){var e=this.json.buffers[t];if(e.type&&e.type!=="arraybuffer")throw new Error("glTF: "+e.type+" buffer type is not supported.");var r="buffer:"+t,i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var c=u[s];if(o=c.loadBuffer(t,this),o)break}if(!o){var l=this.json.buffers[t];o=this.options.fetcher.ajax(this.resolveResouce(l.uri),{responseType:"arraybuffer"}).then(function(d){return d.body})}return this.cache.set(r,o),o},n.prototype.loadBufferView=function(t){var e="bufferView:"+t,r=this.cache.get(e);if(r)return r;for(var i=null,o=0,s=values(this.extensions);o<s.length;o++){var u=s[o];if(i=u.loadBufferView(t,this),i)break}if(!i){var c=this.json.bufferViews[t];i=this.loadBuffer(c.buffer).then(function(l){var d=c.byteLength||0,f=c.byteOffset||0;return l.slice(f,f+d)})}return this.cache.set(e,i),i},n.prototype.loadAccessor=function(t){var e=this,r="accessor:"+t,i=this.cache.get(r);if(i)return i;var o=null;if(!o){var s=this.json.accessors[t];if(s.bufferView===void 0&&s.sparse===void 0)o=Promise.resolve(null);else{var u=[];s.bufferView!==void 0?u.push(this.loadBufferView(s.bufferView)):u.push(Promise.resolve(null)),s.sparse!==void 0&&(u.push(this.loadBufferView(s.sparse.indices.bufferView)),u.push(this.loadBufferView(s.sparse.values.bufferView))),o=Promise.all(u).then(function(c){var l=c[0],d=WEBGL_TYPE_SIZES[s.type],f=WEBGL_COMPONENT_TYPES[s.componentType],m=f.BYTES_PER_ELEMENT,A=m*d,h=s.byteOffset||0,p=s.bufferView!==void 0?e.json.bufferViews[s.bufferView].byteStride:void 0,y=s.normalized===!0,v,g;if(p&&p!==A){var E=Math.floor(h/p),b="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+E+":"+s.count,T=e.cache.get(b);T||(v=new f(l,E*p,s.count*p/m),T=new THREE__namespace.InterleavedBuffer(v,p/m),e.cache.set(b,T)),g=new THREE__namespace.InterleavedBufferAttribute(T,d,h%p/m,y)}else l===null?v=new f(s.count*d):v=new f(l,h,s.count*d),g=new THREE__namespace.BufferAttribute(v,d,y);if(s.sparse!==void 0){var x=WEBGL_TYPE_SIZES.SCALAR,R=WEBGL_COMPONENT_TYPES[s.sparse.indices.componentType],_=s.sparse.indices.byteOffset||0,M=s.sparse.values.byteOffset||0,S=new R(c[1],_,s.sparse.count*x),I=new f(c[2],M,s.sparse.count*d);l!==null&&(g=new THREE__namespace.BufferAttribute(g.array.slice(),g.itemSize,g.normalized));for(var C=0,H=S.length;C<H;C++){var B=S[C];if(g.setX(B,I[C*d]),d>=2&&g.setY(B,I[C*d+1]),d>=3&&g.setZ(B,I[C*d+2]),d>=4&&g.setW(B,I[C*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}}return this.cache.set(r,o),o},n.prototype.createPrimitiveKey=function(t){for(var e=0,r=values(this.extensions);e<r.length;e++){var i=r[e],o=i.createPrimitiveKey(t,this);if(o)return o}for(var s="",u=Object.keys(t.attributes).sort(),c=0,l=u.length;c<l;c++)s+=u[c]+":"+t.attributes[u[c]]+";";return t.indices+":"+s+":"+t.mode},n.prototype.loadGeometry=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadGeometry(t,this),r)break}return r||(r=this.addGeometryPrimitiveAttributes(new THREE__namespace.BufferGeometry,t)),r=r.then(function(u){return e.disposeSet.add(u),u}),r},n.prototype.loadImage=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadImage(t,this),r)break}if(!r){var u=this.json.images[t];if(u.bufferView!==void 0){var c=this.json.bufferViews[u.bufferView];r=this.loadBuffer(c.buffer).then(function(d){var f=c.byteOffset||0,m=c.byteLength||0,A=new Uint8Array(d,f,m),h=new Blob([A],{type:u.mimeType});return createImageBitmapLike(h)})}else if(u.uri){var l=this.resolveResouce(u.uri);r=this.options.fetcher.loadImage(l,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(function(d){return d.body})}else throw new Error("glTF: Invalid image defs.")}return r=r.then(function(d){return e.disposeSet.add(d),d}),r},n.prototype.loadMaterialAsMeshStandardMaterial=function(t){var e=this,r=[],i=new THREE__namespace.MeshStandardMaterial;if(i.color=new THREE__namespace.Color(1,1,1),i.opacity=1,Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="normal"}).length===0&&(i.flatShading=!0),Object.keys(t.attributes).filter(function(d){return ATTRIBUTES[d]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(i.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;i.color.fromArray(u),i.opacity=u[3]}s.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(s.baseColorTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,i.map=d,e.disposeSet.add(d)})),i.metalness=s.metallicFactor!==void 0?s.metallicFactor:1,i.roughness=s.roughnessFactor!==void 0?s.roughnessFactor:1,s.metallicRoughnessTexture!==void 0&&r.push(this.createMaterialTexture(s.metallicRoughnessTexture).then(function(d){d.encoding=THREE__namespace.sRGBEncoding,i.metalnessMap=d,i.roughnessMap=d,e.disposeSet.add(d)})),o.doubleSided===!0&&(i.side=THREE__namespace.DoubleSide);var c=o.alphaMode||ALPHA_MODES.OPAQUE;if(c===ALPHA_MODES.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,c===ALPHA_MODES.MASK&&(i.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&(r.push(this.createMaterialTexture(o.normalTexture).then(function(d){i.normalMap=d,e.disposeSet.add(d)})),i.normalScale=new THREE__namespace.Vector2(1,1),o.normalTexture.scale!==void 0)){var l=o.normalTexture.scale;i.normalScale.set(l,l)}o.occlusionTexture!==void 0&&(r.push(this.createMaterialTexture(o.occlusionTexture).then(function(d){i.aoMap=d,e.disposeSet.add(d)})),o.occlusionTexture.strength!==void 0&&(i.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&(i.emissive=new THREE__namespace.Color().fromArray(o.emissiveFactor)),o.emissiveTexture!==void 0&&r.push(this.createMaterialTexture(o.emissiveTexture).then(function(d){i.emissiveMap=d,e.disposeSet.add(d)}))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterialAsLineBasicMaterial=function(t){var e=[],r=new THREE__namespace.LineBasicMaterial;if(r.color=new THREE__namespace.Color(1,1,1),r.opacity=1,Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="color"}).length>0&&(r.vertexColors=!0),Object.keys(t.attributes).filter(function(c){return ATTRIBUTES[c]==="tangent"}).length===0&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),t.material!==void 0){var i=this.json.materials[t.material];i.name&&(r.name=i.name);var o=i.pbrMetallicRoughness||{};if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;r.color.fromArray(s),r.opacity=s[3]}i.doubleSided===!0&&(r.side=THREE__namespace.DoubleSide);var u=i.alphaMode||ALPHA_MODES.OPAQUE;u===ALPHA_MODES.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,u===ALPHA_MODES.MASK&&(r.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5))}return this.disposeSet.add(r),Promise.all(e).then(function(){return r})},n.prototype.loadMaterialAsPointsMaterial=function(t){var e=this,r=[],i=new THREE__namespace.PointsMaterial;if(i.color=new THREE__namespace.Color(1,1,1),i.opacity=1,i.sizeAttenuation=!1,Object.keys(t.attributes).filter(function(l){return ATTRIBUTES[l]==="color"}).length>0&&(i.vertexColors=!0),Object.keys(t.attributes).filter(function(l){return ATTRIBUTES[l]==="tangent"}).length===0&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),t.material!==void 0){var o=this.json.materials[t.material];o.name&&(i.name=o.name);var s=o.pbrMetallicRoughness||{};if(Array.isArray(s.baseColorFactor)){var u=s.baseColorFactor;i.color.fromArray(u),i.opacity=u[3]}s.baseColorTexture!==void 0&&r.push(this.createMaterialTexture(s.baseColorTexture).then(function(l){l.encoding=THREE__namespace.sRGBEncoding,i.map=l,e.disposeSet.add(l)})),o.doubleSided===!0&&(i.side=THREE__namespace.DoubleSide);var c=o.alphaMode||ALPHA_MODES.OPAQUE;c===ALPHA_MODES.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,c===ALPHA_MODES.MASK&&(i.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5))}return this.disposeSet.add(i),Promise.all(r).then(function(){return i})},n.prototype.loadMaterial=function(t){var e,r=(e=t.mode)!==null&&e!==void 0?e:WEBGL_CONSTANTS.TRIANGLES,i="material:"+this.createPrimitiveKey(t),o=this.cache.get(i);if(o)return o;for(var s=null,u=0,c=values(this.extensions);u<c.length;u++){var l=c[u];if(s=l.loadMaterial(t,this),s)break}if(r===WEBGL_CONSTANTS.TRIANGLES||r===WEBGL_CONSTANTS.TRIANGLE_STRIP||r===WEBGL_CONSTANTS.TRIANGLE_FAN)s=this.loadMaterialAsMeshStandardMaterial(t);else if(r===WEBGL_CONSTANTS.LINES||r===WEBGL_CONSTANTS.LINE_STRIP||r===WEBGL_CONSTANTS.LINE_LOOP)s=this.loadMaterialAsLineBasicMaterial(t);else if(r===WEBGL_CONSTANTS.POINTS)s=this.loadMaterialAsPointsMaterial(t);else throw new Error("glTF: Primitive mode unsupported: "+r);return this.cache.set(i,s),s},n.prototype.loadTexture=function(t){var e=this,r="texture:"+t,i=this.cache.get(r);if(i)return i;for(var o=null,s=0,u=values(this.extensions);s<u.length;s++){var c=u[s];if(o=c.loadTexture(t,this),o)break}if(!o){var l=this.json.textures[t];o=this.loadImage(l.source).then(function(d){var f=new THREE__namespace.Texture(d);f.needsUpdate=!0,f.flipY=!1,l.name&&(f.name=l.name);var m=e.json.samplers||{},A=m[l.sampler]||{};return f.magFilter=WEBGL_FILTERS[A.magFilter]||THREE__namespace.LinearFilter,f.minFilter=WEBGL_FILTERS[A.minFilter]||THREE__namespace.LinearMipmapLinearFilter,f.wrapS=WEBGL_WRAPPINGS[A.wrapS]||THREE__namespace.RepeatWrapping,f.wrapT=WEBGL_WRAPPINGS[A.wrapT]||THREE__namespace.RepeatWrapping,f.onUpdate=function(){d.close()},f})}return o=o.then(function(d){return e.disposeSet.add(d),d}),this.cache.set(r,o),o},n.prototype.loadMesh=function(t){for(var e=this,r=null,i=0,o=values(this.extensions);i<o.length;i++){var s=o[i];if(r=s.loadMesh(t,this),r)break}if(!r){var u=this.json.meshes[t],c=u.primitives,l=Promise.all(c.map(function(f){return e.loadGeometry(f)})),d=Promise.all(c.map(function(f){return e.loadMaterial(f)}));r=Promise.all([l,d]).then(function(f){for(var m=f[0],A=f[1],h=[],p=0;p<c.length;p++){var y=c[p],v=m[p],g=A[p],E=y.mode||WEBGL_CONSTANTS.TRIANGLES,b=void 0;if(E===WEBGL_CONSTANTS.TRIANGLES||E===WEBGL_CONSTANTS.TRIANGLE_STRIP||E===WEBGL_CONSTANTS.TRIANGLE_FAN)if(E===WEBGL_CONSTANTS.TRIANGLE_STRIP?v=e.toGeometryTrianglesDrawMode(v,THREE__namespace.TriangleStripDrawMode):E===WEBGL_CONSTANTS.TRIANGLE_FAN&&(v=e.toGeometryTrianglesDrawMode(v,THREE__namespace.TriangleFanDrawMode)),e.disposeSet.add(v),u.isSkinnedMesh){var T=new THREE__namespace.SkinnedMesh(v,g);v.attributes.skinWeight.normalized||T.normalizeSkinWeights(),b=T}else b=new THREE__namespace.Mesh(v,g);else if(E===WEBGL_CONSTANTS.POINTS)b=new THREE__namespace.Points(v,g);else if(E===WEBGL_CONSTANTS.LINES)b=new THREE__namespace.LineSegments(v,g);else if(E===WEBGL_CONSTANTS.LINE_STRIP)b=new THREE__namespace.Line(v,g);else if(E===WEBGL_CONSTANTS.LINE_LOOP)b=new THREE__namespace.LineLoop(v,g);else throw new Error("glTF: Primitive mode unsupported: "+E);if(Object.keys(v.morphAttributes).length>0){if(u.weights!==void 0)for(var x=0,R=u.weights.length;x<R;x++)b.morphTargetInfluences[x]=u.weights[x];if(u.extras&&Array.isArray(u.extras.targetNames)){var _=u.extras.targetNames;if(b.morphTargetInfluences.length===_.length){b.morphTargetDictionary={};for(var x=0,R=_.length;x<R;x++)b.morphTargetDictionary[_[x]]=x}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}b.name=e.createUniqueName(u.name||"mesh_"+t),h.push(b)}if(h.length===1)return h[0];for(var M=new THREE__namespace.Group,S=0,I=h;S<I.length;S++){var b=I[S];M.add(b)}return M})}return r},n.prototype.loadNodeAttachments=function(t){for(var e=[],r=0,i=values(this.extensions);r<i.length;r++){var o=i[r],s=o.loadNodeAttachments(t,this);s&&e.push(s)}return e},n.prototype.loadNode=function(t){var e="node:"+t,r=this.cache.get(e);if(r)return r;var i=this.json,o=i.nodes[t],s=o.name?this.createUniqueName(o.name):"",u=[];o.mesh!==void 0&&u.push(this.loadMesh(o.mesh).then(function(m){if(o.weights!==void 0){var A=o.weights;m.traverse(function(h){if(h instanceof THREE__namespace.Mesh||h instanceof THREE__namespace.Line||h instanceof THREE__namespace.Points)for(var p=0,y=A.length;p<y;p++)h.morphTargetInfluences[p]=A[p]})}return m})),o.camera!==void 0&&u.push(this.loadCamera(o.camera));for(var c=this.loadNodeAttachments(t),l=0,d=c;l<d.length;l++){var f=d[l];u.push(f)}return Promise.all(u).then(function(m){var A;if(o.isBone===!0?A=new THREE__namespace.Bone:m.length>1?A=new THREE__namespace.Group:m.length===1?A=m[0]:A=new THREE__namespace.Object3D,A!==m[0])for(var h=0,p=m.length;h<p;h++)A.add(m[h]);if(o.name&&(A.name=s),o.matrix!==void 0){var y=new THREE__namespace.Matrix4;y.fromArray(o.matrix),A.applyMatrix4(y)}else o.translation!==void 0&&A.position.fromArray(o.translation),o.rotation!==void 0&&A.quaternion.fromArray(o.rotation),o.scale!==void 0&&A.scale.fromArray(o.scale);return A})},n.prototype.loadScene=function(t){var e=this.json,r=e.scenes[t],i=new THREE__namespace.Group;r.name&&(i.name=this.createUniqueName(r.name));for(var o=r.nodes||[],s=[],u=0,c=o.length;u<c;u++)s.push(this.buildNodeHierarchy(o[u],i));return Promise.all(s).then(function(){return i})},n.prototype.createMaterialTexture=function(t){var e=this;return this.loadTexture(t.index).then(function(r){for(var i=0,o=values(e.extensions);i<o.length;i++){var s=o[i],u=s.extendTexture(r,t,e);u&&(r=u,e.disposeSet.add(r))}return e.textureSet.add(r),r})},n.prototype.addGeometryPrimitiveAttributes=function(t,e){var r=this,i=e.attributes,o=[],s=function(T){var x=ATTRIBUTES[T]||T.toLowerCase();if(x in t.attributes)return"continue";o.push(u.loadAccessor(i[T]).then(function(R){R&&t.setAttribute(x,R)}))},u=this;for(var c in i)s(c);e.indices!==void 0&&!t.index&&o.push(this.loadAccessor(e.indices).then(function(T){T&&t.setIndex(T)}));var l=new THREE__namespace.Box3;if(i.POSITION!==void 0){var d=this.json.accessors[i.POSITION],f=d.min,m=d.max;if(f!==void 0&&m!==void 0){if(l.set(new THREE__namespace.Vector3(f[0],f[1],f[2]),new THREE__namespace.Vector3(m[0],m[1],m[2])),d.normalized){var A=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);l.min.multiplyScalar(A),l.max.multiplyScalar(A)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var h=e.targets;if(h!==void 0){for(var p=new THREE__namespace.Vector3,y=new THREE__namespace.Vector3,v=0,g=h.length;v<g;v++){var E=h[v];if(E.POSITION!==void 0){var d=this.json.accessors[E.POSITION],f=d.min,m=d.max;if(f!==void 0&&m!==void 0){if(y.setX(Math.max(Math.abs(f[0]),Math.abs(m[0]))),y.setY(Math.max(Math.abs(f[1]),Math.abs(m[1]))),y.setZ(Math.max(Math.abs(f[2]),Math.abs(m[2]))),d.normalized){var A=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[d.componentType]);y.multiplyScalar(A)}p.max(y)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}l.expandByVector(p)}t.boundingBox=l;var b=new THREE__namespace.Sphere;return l.getCenter(b.center),b.radius=l.min.distanceTo(l.max)/2,t.boundingSphere=b,Promise.all(o).then(function(){if(t.attributes.uv&&!t.attributes.uv2&&r.options.copyUV2&&t.setAttribute("uv2",t.attributes.uv),e.targets){for(var T=!1,x=!1,R=0,_=e.targets.length;R<_;R++){var M=e.targets[R];if(M.POSITION!==void 0&&(T=!0),M.NORMAL!==void 0&&(x=!0),T&&x)break}if(!T&&!x)return t;var S=[];t.morphTargetsRelative=!0;for(var I=function(C,H){var B=e.targets[C];T?S.push(r.loadAccessor(B.POSITION).then(function(L){L&&(t.morphAttributes.position[C]=L)})):t.morphAttributes.position[C]=t.attributes.position,x?S.push(r.loadAccessor(B.NORMAL).then(function(L){L&&(t.morphAttributes.normal[C]=L)})):t.morphAttributes.normal[C]=t.attributes.normal},R=0,_=e.targets.length;R<_;R++)I(R,_);return Promise.all(S).then(function(){return t})}else return t})},n.prototype.buildNodeHierarchy=function(t,e){var r=this,i=this.json.nodes[t];return this.loadNode(t).then(function(o){if(i.skin===void 0)return o;var s;return r.loadSkin(i.skin).then(function(u){s=u;for(var c=[],l=0,d=s.joints.length;l<d;l++)c.push(r.loadNode(s.joints[l]));return Promise.all(c)}).then(function(u){return o.traverse(function(c){if(c instanceof THREE__namespace.SkinnedMesh){for(var l=[],d=[],f=0,m=u.length;f<m;f++){var A=u[f];if(A instanceof THREE__namespace.Bone){l.push(A);var h=new THREE__namespace.Matrix4;s.inverseBindMatrices!==void 0&&h.fromArray(s.inverseBindMatrices.array,f*16),d.push(h)}else console.warn('glTF: Joint "%s" could not be found.',s.joints[f])}c.bind(new THREE__namespace.Skeleton(l,d),c.matrixWorld)}}),o})}).then(function(o){e.add(o);var s=[];if(i.children)for(var u=i.children,c=0,l=u.length;c<l;c++){var d=u[c];s.push(r.buildNodeHierarchy(d,o))}return Promise.all(s).then(function(){return o})})},n.prototype.createUniqueName=function(t){for(var e=THREE__namespace.PropertyBinding.sanitizeNodeName(t||""),r=e,i=1;this.nodeNamesUsed[r];++i)r=e+"_"+i;return this.nodeNamesUsed[r]=!0,r},n.prototype.resolveResouce=function(t){return pathJoin(this.options.resourcePath,appendSearch(t,this.options.search))},n.prototype.toGeometryTrianglesDrawMode=function(t,e){var r=t.getIndex();if(r===null){var i=[],o=t.getAttribute("position");if(o!==void 0){for(var s=0;s<o.count;s++)i.push(s);t.setIndex(i),r=t.getIndex()}}if(r===null)return console.error("glTF: Undefined position attribute. Processing not possible."),t;var u=r.count-2,c=[];if(e===THREE__namespace.TriangleFanDrawMode)for(var s=1;s<=u;s++)c.push(r.getX(0)),c.push(r.getX(s)),c.push(r.getX(s+1));else for(var s=0;s<u;s++)s%2===0?(c.push(r.getX(s)),c.push(r.getX(s+1)),c.push(r.getX(s+2))):(c.push(r.getX(s+2)),c.push(r.getX(s+1)),c.push(r.getX(s)));c.length/3!==u&&console.error("glTF: Unable to generate correct amount of triangles.");var l=t.clone();return l.setIndex(c),this.disposeSet.add(l),l},n}();function getNormalizedComponentScale(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("glTF: Unsupported normalized accessor component type.")}}var BaseExtension=function(){function n(){}return n.prototype.markDefs=function(t){},n.prototype.prepare=function(t){},n.prototype.emitResult=function(t,e){},n.prototype.createPrimitiveKey=function(t,e){},n.prototype.extendTexture=function(t,e,r){return null},n.prototype.loadBuffer=function(t,e){return null},n.prototype.loadBufferView=function(t,e){return null},n.prototype.loadImage=function(t,e){return null},n.prototype.loadTexture=function(t,e){return null},n.prototype.loadGeometry=function(t,e){return null},n.prototype.loadMaterial=function(t,e){return null},n.prototype.loadMesh=function(t,e){return null},n.prototype.loadNodeAttachments=function(t,e){return null},n.prototype.loadCamera=function(t,e){return null},n.prototype.loadAnimation=function(t,e){return null},n}(),KHR_binary_glTF=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.header={magic:"",version:0,length:0},e.content="",e.body=null,e}return t.getMagic=function(e){return decodeText(new Uint8Array(e.slice(0,4)))},t.prototype.loadGlbBinary=function(e){var r=new DataView(e,0,t.HEADER_LENGTH);if(this.header={magic:t.getMagic(e),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==t.HEADER_MAGIC)throw new Error("glTF:KHR_binary_glTF: Unsupported.");if(this.header.version<2)throw new Error("glTF:KHR_binary_glTF: Legacy binary file detected.");for(var i=new DataView(e,t.HEADER_LENGTH),o=0,s=null,u=null;o<i.byteLength;){var c=i.getUint32(o,!0);if(o+=4,c!==0){var l=i.getUint32(o,!0);if(o+=4,l===t.CHUNK_TYPES.JSON){var d=new Uint8Array(e,t.HEADER_LENGTH+o,c);s=decodeText(d)}else if(l===t.CHUNK_TYPES.BIN){var f=t.HEADER_LENGTH+o;u=e.slice(f,f+c)}o+=c}}if(s===null)throw new Error("glTF:KHR_binary_glTF: JSON content not found.");this.content=s,this.body=u},t.prototype.loadBuffer=function(e,r){var i=r.json.buffers[e];return i.uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null},t.prototype.clear=function(){this.body=null,this.content=""},t.HEADER_MAGIC="glTF",t.HEADER_LENGTH=12,t.CHUNK_TYPES={JSON:1313821514,BIN:5130562},t}(BaseExtension),defaultDecoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},Draco=function(){function n(){this.decoderPath=defaultDecoderPath,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=""}return n.prototype.setDecoderPath=function(t){this.decoderPath=t},n.prototype.setDecoderConfig=function(t){return this.decoderConfig=t,this},n.prototype.setWorkerLimit=function(t){return this.workerLimit=t,this},n.prototype.decodeDracoFile=function(t,e,r,i){var o={attributeIDs:r||defaultAttributeIDs,attributeTypes:i||defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(t,o).then(e)},n.prototype.decodeGeometry=function(t,e){var r=this;e===void 0&&(e={attributeIDs:defaultAttributeIDs,attributeTypes:defaultAttributeTypes,useUniqueIDs:!1});for(var i in e.attributeTypes){var o=e.attributeTypes[i];o.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[i]=o.name)}var s,u=this.workerNextTaskID++,c=t.byteLength,l=this._getWorker(u,c).then(function(d){return s=d,new Promise(function(f,m){s._callbacks[u]={resolve:f,reject:m},s.postMessage({type:"decode",id:u,taskConfig:e,buffer:t},[t])})}).then(function(d){return r._createGeometry(d.geometry)});return l.catch(function(){return!0}).then(function(){s&&u&&r._releaseTask(s,u)}),l},n.prototype._createGeometry=function(t){var e=new THREE__namespace.BufferGeometry;t.index&&e.setIndex(new THREE__namespace.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var i=t.attributes[r],o=i.name,s=i.array,u=i.itemSize;e.setAttribute(o,new THREE__namespace.BufferAttribute(s,u))}return e},n.prototype._initDecoder=function(){var t=this;if(this.decoderPending)return this.decoderPending;var e=typeof WebAssembly!="object"||this.decoderConfig.type==="js";if(e){var r=ajax(this.decoderPath+"draco_decoder.js",{responseType:"text"}).then(function(o){return o.body});this.decoderPending=r.then(function(o){var s=["/* draco decoder */",o,"","/* worker */",DRACOWorker].join(`
418
418
  `);t.workerSourceURL=URL.createObjectURL(new Blob([s]))})}else{var r=ajax(this.decoderPath+"draco_wasm_wrapper.js",{responseType:"text"}).then(function(s){return s.body}),i=ajax(this.decoderPath+"draco_decoder.wasm",{responseType:"arraybuffer"}).then(function(s){return s.body});this.decoderPending=Promise.all([r,i]).then(function(s){var u=s[0],c=s[1];t.decoderConfig.wasmBinary=c;var l=["/* draco decoder */",u,"","/* worker */",DRACOWorker].join(`
419
419
  `);t.workerSourceURL=URL.createObjectURL(new Blob([l]))})}return this.decoderPending},n.prototype._getWorker=function(t,e){var r=this;return this._initDecoder().then(function(){if(r.workerPool.length<r.workerLimit){var i=new Worker(r.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:r.decoderConfig}),i.onmessage=function(s){var u=s.data;switch(u.type){case"decode":i._callbacks[u.id].resolve(u);break;case"error":i._callbacks[u.id].reject(u);break;default:console.error('DRACO: Unexpected message, "'+u.type+'"')}},r.workerPool.push(i)}else r.workerPool.sort(function(s,u){return s._taskLoad>u._taskLoad?-1:1});var o=r.workerPool[r.workerPool.length-1];return o._taskCosts[t]=e,o._taskLoad+=e,o})},n.prototype._releaseTask=function(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]},n.prototype.dispose=function(){for(var t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this},n}(),draco=new Draco,DRACOWorker=`
420
420
  let decoderConfig;
@@ -925,11 +925,11 @@ self.onmessage = function(event) {
925
925
  }
926
926
  postMessage({ id: packet.id, error: "type never matched." });
927
927
  };
928
- `),support=typeof Worker!="undefined"&&typeof Blob!="undefined",lzmaWorkerURL="";if(support)try{var blob=new Blob([lzmaWorkerSource],{type:"text/javascript"});lzmaWorkerURL=URL.createObjectURL(blob)}catch(n){}var LZMAWorker=function(){function n(){var t=this;if(!support)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var e=this.worker=new Worker(lzmaWorkerURL);e.onmessage=function(r){var i=r.data,o=i.id,s=i.result,u=i.error,c=t.getKey(o);t.requests[c]&&(u?t.requests[c](new Error(u)):t.requests[c](null,s),delete t.requests[c])},e.onerror=function(r){return console.error(r)}}return n.prototype.getKey=function(t){return"key_"+String(t)},n.prototype.decompress=function(t,e){var r=++this.callCounter;this.requests[this.getKey(r)]=e,this.worker.postMessage({type:"decompress",id:r,data:t},[t.buffer])},n.prototype.terminate=function(){this.worker.terminate()},n.support=support,n}();function readUint32(n){return Array.prototype.reduce.call(n,function(t,e,r){return t|e<<r*8},0)}function binaryArrays(n){for(var t=[],e=n.length,r=function(s){var u={data:n[s],offset:0,readByte:function(){return this.data[this.offset++]}},c=u.data.length,l={data:[],offset:0,writeByte:function(f){var m=Math.floor(this.offset/c);this.data[m]||(this.data[m]=new Uint8Array(c)),this.data[m][this.offset%c]=f,this.offset++}};LZMA.decompressFile(u,l),i=new Uint8Array(l.offset);for(var d=0;d<l.offset;d++)i[d]=l.data[Math.floor(d/c)][d%c];t.push(i)},i,o=0;o<e;o++)r(o);return t}function binaryArraysWithWorker(n){for(var t=[],e=n.length,r=function(o){t.push(new Promise(function(s,u){var c=new LZMAWorker;c.decompress(n[o],function(l,d){if(c.terminate(),l)return u(l);s(d)})}))},i=0;i<e;i++)r(i);return Promise.all(t)}function lzma(n){var t=new Uint8Array(n),e=readUint32(t.slice(0,4));if(e>10)return Promise.reject(new Error("LZMA got too many sub chunks."));for(var r=[],i=[],o=4+e*4,s=0;s<e;s++)i[s]=readUint32(t.slice(4+s*4,8+s*4)),s===e-1?r[s]=t.subarray(o,o+i[s]):r[s]=t.slice(o,o+i[s]),o+=i[s];return LZMAWorker.support?binaryArraysWithWorker(r):Promise.resolve(binaryArrays(r))}var dequeuing=!1,queue=[];function dequeue(n){if(n===void 0&&(n=!1),!(!n&&dequeuing)){dequeuing=!0;var t=queue.shift();if(t){try{t()}catch(e){}AnimationFrameLoop.shared.add(function(){return dequeue(!0)},!0,2,-100)}else dequeuing=!1}}function delay(n){return new Promise(function(t,e){var r=function(){try{t(n())}catch(i){e(i)}};queue.push(r),AnimationFrameLoop.shared.add(function(){return dequeue()},!0,2,-100)})}function pick(n,t){for(var e={},r=0,i=t;r<i.length;r++){var o=i[r];o in n&&(e[o]=n[o])}return e}function omit(n,t){for(var e=__assign({},n),r=0,i=t;r<i.length;r++){var o=i[r];o in e&&delete e[o]}return e}var commonjsGlobal=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},indexMinimal={},minimal$1={},aspromise=asPromise;function asPromise(n,t){for(var e=new Array(arguments.length-1),r=0,i=2,o=!0;i<arguments.length;)e[r++]=arguments[i++];return new Promise(function(u,c){e[r]=function(d){if(o)if(o=!1,d)c(d);else{for(var f=new Array(arguments.length-1),m=0;m<f.length;)f[m++]=arguments[m];u.apply(null,f)}};try{n.apply(t||null,e)}catch(l){o&&(o=!1,c(l))}})}var base64$1={};(function(n){var t=n;t.length=function(u){var c=u.length;if(!c)return 0;for(var l=0;--c%4>1&&u.charAt(c)==="=";)++l;return Math.ceil(u.length*3)/4-l};for(var e=new Array(64),r=new Array(123),i=0;i<64;)r[e[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;t.encode=function(u,c,l){for(var d=null,f=[],m=0,A=0,h;c<l;){var p=u[c++];switch(A){case 0:f[m++]=e[p>>2],h=(p&3)<<4,A=1;break;case 1:f[m++]=e[h|p>>4],h=(p&15)<<2,A=2;break;case 2:f[m++]=e[h|p>>6],f[m++]=e[p&63],A=0;break}m>8191&&((d||(d=[])).push(String.fromCharCode.apply(String,f)),m=0)}return A&&(f[m++]=e[h],f[m++]=61,A===1&&(f[m++]=61)),d?(m&&d.push(String.fromCharCode.apply(String,f.slice(0,m))),d.join("")):String.fromCharCode.apply(String,f.slice(0,m))};var o="invalid encoding";t.decode=function(u,c,l){for(var d=l,f=0,m,A=0;A<u.length;){var h=u.charCodeAt(A++);if(h===61&&f>1)break;if((h=r[h])===void 0)throw Error(o);switch(f){case 0:m=h,f=1;break;case 1:c[l++]=m<<2|(h&48)>>4,m=h,f=2;break;case 2:c[l++]=(m&15)<<4|(h&60)>>2,m=h,f=3;break;case 3:c[l++]=(m&3)<<6|h,f=0;break}}if(f===1)throw Error(o);return l-d},t.test=function(u){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(u)}})(base64$1);var eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(t,e,r){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:r||this}),this},EventEmitter.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var r=this._listeners[t],i=0;i<r.length;)r[i].fn===e?r.splice(i,1):++i;return this},EventEmitter.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var r=[],i=1;i<arguments.length;)r.push(arguments[i++]);for(i=0;i<e.length;)e[i].fn.apply(e[i++].ctx,r)}return this};var float=factory(factory);function factory(n){return typeof Float32Array!="undefined"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),r=e[3]===128;function i(c,l,d){t[0]=c,l[d]=e[0],l[d+1]=e[1],l[d+2]=e[2],l[d+3]=e[3]}function o(c,l,d){t[0]=c,l[d]=e[3],l[d+1]=e[2],l[d+2]=e[1],l[d+3]=e[0]}n.writeFloatLE=r?i:o,n.writeFloatBE=r?o:i;function s(c,l){return e[0]=c[l],e[1]=c[l+1],e[2]=c[l+2],e[3]=c[l+3],t[0]}function u(c,l){return e[3]=c[l],e[2]=c[l+1],e[1]=c[l+2],e[0]=c[l+3],t[0]}n.readFloatLE=r?s:u,n.readFloatBE=r?u:s}():function(){function t(r,i,o,s){var u=i<0?1:0;if(u&&(i=-i),i===0)r(1/i>0?0:2147483648,o,s);else if(isNaN(i))r(2143289344,o,s);else if(i>34028234663852886e22)r((u<<31|2139095040)>>>0,o,s);else if(i<11754943508222875e-54)r((u<<31|Math.round(i/1401298464324817e-60))>>>0,o,s);else{var c=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-c)*8388608)&8388607;r((u<<31|c+127<<23|l)>>>0,o,s)}}n.writeFloatLE=t.bind(null,writeUintLE),n.writeFloatBE=t.bind(null,writeUintBE);function e(r,i,o){var s=r(i,o),u=(s>>31)*2+1,c=s>>>23&255,l=s&8388607;return c===255?l?NaN:u*(1/0):c===0?u*1401298464324817e-60*l:u*Math.pow(2,c-150)*(l+8388608)}n.readFloatLE=e.bind(null,readUintLE),n.readFloatBE=e.bind(null,readUintBE)}(),typeof Float64Array!="undefined"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),r=e[7]===128;function i(c,l,d){t[0]=c,l[d]=e[0],l[d+1]=e[1],l[d+2]=e[2],l[d+3]=e[3],l[d+4]=e[4],l[d+5]=e[5],l[d+6]=e[6],l[d+7]=e[7]}function o(c,l,d){t[0]=c,l[d]=e[7],l[d+1]=e[6],l[d+2]=e[5],l[d+3]=e[4],l[d+4]=e[3],l[d+5]=e[2],l[d+6]=e[1],l[d+7]=e[0]}n.writeDoubleLE=r?i:o,n.writeDoubleBE=r?o:i;function s(c,l){return e[0]=c[l],e[1]=c[l+1],e[2]=c[l+2],e[3]=c[l+3],e[4]=c[l+4],e[5]=c[l+5],e[6]=c[l+6],e[7]=c[l+7],t[0]}function u(c,l){return e[7]=c[l],e[6]=c[l+1],e[5]=c[l+2],e[4]=c[l+3],e[3]=c[l+4],e[2]=c[l+5],e[1]=c[l+6],e[0]=c[l+7],t[0]}n.readDoubleLE=r?s:u,n.readDoubleBE=r?u:s}():function(){function t(r,i,o,s,u,c){var l=s<0?1:0;if(l&&(s=-s),s===0)r(0,u,c+i),r(1/s>0?0:2147483648,u,c+o);else if(isNaN(s))r(0,u,c+i),r(2146959360,u,c+o);else if(s>17976931348623157e292)r(0,u,c+i),r((l<<31|2146435072)>>>0,u,c+o);else{var d;if(s<22250738585072014e-324)d=s/5e-324,r(d>>>0,u,c+i),r((l<<31|d/4294967296)>>>0,u,c+o);else{var f=Math.floor(Math.log(s)/Math.LN2);f===1024&&(f=1023),d=s*Math.pow(2,-f),r(d*4503599627370496>>>0,u,c+i),r((l<<31|f+1023<<20|d*1048576&1048575)>>>0,u,c+o)}}}n.writeDoubleLE=t.bind(null,writeUintLE,0,4),n.writeDoubleBE=t.bind(null,writeUintBE,4,0);function e(r,i,o,s,u){var c=r(s,u+i),l=r(s,u+o),d=(l>>31)*2+1,f=l>>>20&2047,m=4294967296*(l&1048575)+c;return f===2047?m?NaN:d*(1/0):f===0?d*5e-324*m:d*Math.pow(2,f-1075)*(m+4503599627370496)}n.readDoubleLE=e.bind(null,readUintLE,0,4),n.readDoubleBE=e.bind(null,readUintBE,4,0)}(),n}function writeUintLE(n,t,e){t[e]=n&255,t[e+1]=n>>>8&255,t[e+2]=n>>>16&255,t[e+3]=n>>>24}function writeUintBE(n,t,e){t[e]=n>>>24,t[e+1]=n>>>16&255,t[e+2]=n>>>8&255,t[e+3]=n&255}function readUintLE(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0}function readUintBE(n,t){return(n[t]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3])>>>0}var inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(n){}return null}var utf8$2={};(function(n){var t=n;t.length=function(r){for(var i=0,o=0,s=0;s<r.length;++s)o=r.charCodeAt(s),o<128?i+=1:o<2048?i+=2:(o&64512)===55296&&(r.charCodeAt(s+1)&64512)===56320?(++s,i+=4):i+=3;return i},t.read=function(r,i,o){var s=o-i;if(s<1)return"";for(var u=null,c=[],l=0,d;i<o;)d=r[i++],d<128?c[l++]=d:d>191&&d<224?c[l++]=(d&31)<<6|r[i++]&63:d>239&&d<365?(d=((d&7)<<18|(r[i++]&63)<<12|(r[i++]&63)<<6|r[i++]&63)-65536,c[l++]=55296+(d>>10),c[l++]=56320+(d&1023)):c[l++]=(d&15)<<12|(r[i++]&63)<<6|r[i++]&63,l>8191&&((u||(u=[])).push(String.fromCharCode.apply(String,c)),l=0);return u?(l&&u.push(String.fromCharCode.apply(String,c.slice(0,l))),u.join("")):String.fromCharCode.apply(String,c.slice(0,l))},t.write=function(r,i,o){for(var s=o,u,c,l=0;l<r.length;++l)u=r.charCodeAt(l),u<128?i[o++]=u:u<2048?(i[o++]=u>>6|192,i[o++]=u&63|128):(u&64512)===55296&&((c=r.charCodeAt(l+1))&64512)===56320?(u=65536+((u&1023)<<10)+(c&1023),++l,i[o++]=u>>18|240,i[o++]=u>>12&63|128,i[o++]=u>>6&63|128,i[o++]=u&63|128):(i[o++]=u>>12|224,i[o++]=u>>6&63|128,i[o++]=u&63|128);return o-s}})(utf8$2);var pool_1=pool;function pool(n,t,e){var r=e||8192,i=r>>>1,o=null,s=r;return function(c){if(c<1||c>i)return n(c);s+c>r&&(o=n(r),s=0);var l=t.call(o,s,s+=c);return s&7&&(s=(s|7)+1),l}}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var n=requireMinimal();function t(o,s){this.lo=o>>>0,this.hi=s>>>0}var e=t.zero=new t(0,0);e.toNumber=function(){return 0},e.zzEncode=e.zzDecode=function(){return this},e.length=function(){return 1};var r=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(s){if(s===0)return e;var u=s<0;u&&(s=-s);var c=s>>>0,l=(s-c)/4294967296>>>0;return u&&(l=~l>>>0,c=~c>>>0,++c>4294967295&&(c=0,++l>4294967295&&(l=0))),new t(c,l)},t.from=function(s){if(typeof s=="number")return t.fromNumber(s);if(n.isString(s))if(n.Long)s=n.Long.fromString(s);else return t.fromNumber(parseInt(s,10));return s.low||s.high?new t(s.low>>>0,s.high>>>0):e},t.prototype.toNumber=function(s){if(!s&&this.hi>>>31){var u=~this.lo+1>>>0,c=~this.hi>>>0;return u||(c=c+1>>>0),-(u+c*4294967296)}return this.lo+this.hi*4294967296},t.prototype.toLong=function(s){return n.Long?new n.Long(this.lo|0,this.hi|0,!!s):{low:this.lo|0,high:this.hi|0,unsigned:!!s}};var i=String.prototype.charCodeAt;return t.fromHash=function(s){return s===r?e:new t((i.call(s,0)|i.call(s,1)<<8|i.call(s,2)<<16|i.call(s,3)<<24)>>>0,(i.call(s,4)|i.call(s,5)<<8|i.call(s,6)<<16|i.call(s,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var s=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^s)>>>0,this.lo=(this.lo<<1^s)>>>0,this},t.prototype.zzDecode=function(){var s=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^s)>>>0,this.hi=(this.hi>>>1^s)>>>0,this},t.prototype.length=function(){var s=this.lo,u=(this.lo>>>28|this.hi<<4)>>>0,c=this.hi>>>24;return c===0?u===0?s<16384?s<128?1:2:s<2097152?3:4:u<16384?u<128?5:6:u<2097152?7:8:c<128?9:10},longbits}var hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(n){var t=n;t.asPromise=aspromise,t.base64=base64$1,t.EventEmitter=eventemitter,t.float=float,t.inquire=inquire_1,t.utf8=utf8$2,t.pool=pool_1,t.LongBits=requireLongbits(),t.isNode=!!(typeof commonjsGlobal!="undefined"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),t.global=t.isNode&&commonjsGlobal||typeof window!="undefined"&&window||typeof self!="undefined"&&self||commonjsGlobal,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(o){return typeof o=="number"&&isFinite(o)&&Math.floor(o)===o},t.isString=function(o){return typeof o=="string"||o instanceof String},t.isObject=function(o){return o&&typeof o=="object"},t.isset=t.isSet=function(o,s){var u=o[s];return u!=null&&o.hasOwnProperty(s)?typeof u!="object"||(Array.isArray(u)?u.length:Object.keys(u).length)>0:!1},t.Buffer=function(){try{var i=t.inquire("buffer").Buffer;return i.prototype.utf8Write?i:null}catch(o){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(o){return typeof o=="number"?t.Buffer?t._Buffer_allocUnsafe(o):new t.Array(o):t.Buffer?t._Buffer_from(o):typeof Uint8Array=="undefined"?o:new Uint8Array(o)},t.Array=typeof Uint8Array!="undefined"?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(o){return o?t.LongBits.from(o).toHash():t.LongBits.zeroHash},t.longFromHash=function(o,s){var u=t.LongBits.fromHash(o);return t.Long?t.Long.fromBits(u.lo,u.hi,s):u.toNumber(!!s)};function e(i,o,s){for(var u=Object.keys(o),c=0;c<u.length;++c)(i[u[c]]===void 0||!s)&&(i[u[c]]=o[u[c]]);return i}t.merge=e,t.lcFirst=function(o){return o.charAt(0).toLowerCase()+o.substring(1)};function r(i){function o(s,u){if(!(this instanceof o))return new o(s,u);Object.defineProperty(this,"message",{get:function(){return s}}),Error.captureStackTrace?Error.captureStackTrace(this,o):Object.defineProperty(this,"stack",{value:new Error().stack||""}),u&&e(this,u)}return o.prototype=Object.create(Error.prototype,{constructor:{value:o,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return i},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),o}t.newError=r,t.ProtocolError=r("ProtocolError"),t.oneOfGetter=function(o){for(var s={},u=0;u<o.length;++u)s[o[u]]=1;return function(){for(var c=Object.keys(this),l=c.length-1;l>-1;--l)if(s[c[l]]===1&&this[c[l]]!==void 0&&this[c[l]]!==null)return c[l]}},t.oneOfSetter=function(o){return function(s){for(var u=0;u<o.length;++u)o[u]!==s&&delete this[o[u]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var i=t.Buffer;if(!i){t._Buffer_from=t._Buffer_allocUnsafe=null;return}t._Buffer_from=i.from!==Uint8Array.from&&i.from||function(s,u){return new i(s,u)},t._Buffer_allocUnsafe=i.allocUnsafe||function(s){return new i(s)}}}(minimal$1)),minimal$1}var writer=Writer$1,util$4=requireMinimal(),BufferWriter$1,LongBits$1=util$4.LongBits,base64=util$4.base64,utf8$1=util$4.utf8;function Op(n,t,e){this.fn=n,this.len=t,this.next=void 0,this.val=e}function noop(){}function State(n){this.head=n.head,this.tail=n.tail,this.len=n.len,this.next=n.states}function Writer$1(){this.len=0,this.head=new Op(noop,0,0),this.tail=this.head,this.states=null}var create$1=function n(){return util$4.Buffer?function(){return(Writer$1.create=function(){return new BufferWriter$1})()}:function(){return new Writer$1}};Writer$1.create=create$1(),Writer$1.alloc=function n(t){return new util$4.Array(t)},util$4.Array!==Array&&(Writer$1.alloc=util$4.pool(Writer$1.alloc,util$4.Array.prototype.subarray)),Writer$1.prototype._push=function n(t,e,r){return this.tail=this.tail.next=new Op(t,e,r),this.len+=e,this};function writeByte(n,t,e){t[e]=n&255}function writeVarint32(n,t,e){for(;n>127;)t[e++]=n&127|128,n>>>=7;t[e]=n}function VarintOp(n,t){this.len=n,this.next=void 0,this.val=t}VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer$1.prototype.uint32=function n(t){return this.len+=(this.tail=this.tail.next=new VarintOp((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},Writer$1.prototype.int32=function n(t){return t<0?this._push(writeVarint64,10,LongBits$1.fromNumber(t)):this.uint32(t)},Writer$1.prototype.sint32=function n(t){return this.uint32((t<<1^t>>31)>>>0)};function writeVarint64(n,t,e){for(;n.hi;)t[e++]=n.lo&127|128,n.lo=(n.lo>>>7|n.hi<<25)>>>0,n.hi>>>=7;for(;n.lo>127;)t[e++]=n.lo&127|128,n.lo=n.lo>>>7;t[e++]=n.lo}Writer$1.prototype.uint64=function n(t){var e=LongBits$1.from(t);return this._push(writeVarint64,e.length(),e)},Writer$1.prototype.int64=Writer$1.prototype.uint64,Writer$1.prototype.sint64=function n(t){var e=LongBits$1.from(t).zzEncode();return this._push(writeVarint64,e.length(),e)},Writer$1.prototype.bool=function n(t){return this._push(writeByte,1,t?1:0)};function writeFixed32(n,t,e){t[e]=n&255,t[e+1]=n>>>8&255,t[e+2]=n>>>16&255,t[e+3]=n>>>24}Writer$1.prototype.fixed32=function n(t){return this._push(writeFixed32,4,t>>>0)},Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32,Writer$1.prototype.fixed64=function n(t){var e=LongBits$1.from(t);return this._push(writeFixed32,4,e.lo)._push(writeFixed32,4,e.hi)},Writer$1.prototype.sfixed64=Writer$1.prototype.fixed64,Writer$1.prototype.float=function n(t){return this._push(util$4.float.writeFloatLE,4,t)},Writer$1.prototype.double=function n(t){return this._push(util$4.float.writeDoubleLE,8,t)};var writeBytes=util$4.Array.prototype.set?function n(t,e,r){e.set(t,r)}:function n(t,e,r){for(var i=0;i<t.length;++i)e[r+i]=t[i]};Writer$1.prototype.bytes=function n(t){var e=t.length>>>0;if(!e)return this._push(writeByte,1,0);if(util$4.isString(t)){var r=Writer$1.alloc(e=base64.length(t));base64.decode(t,r,0),t=r}return this.uint32(e)._push(writeBytes,e,t)},Writer$1.prototype.string=function n(t){var e=utf8$1.length(t);return e?this.uint32(e)._push(utf8$1.write,e,t):this._push(writeByte,1,0)},Writer$1.prototype.fork=function n(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer$1.prototype.reset=function n(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer$1.prototype.ldelim=function n(){var t=this.head,e=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=t.next,this.tail=e,this.len+=r),this},Writer$1.prototype.finish=function n(){for(var t=this.head.next,e=this.constructor.alloc(this.len),r=0;t;)t.fn(t.val,e,r),r+=t.len,t=t.next;return e},Writer$1._configure=function(n){BufferWriter$1=n,Writer$1.create=create$1(),BufferWriter$1._configure()};var writer_buffer=BufferWriter,Writer=writer;(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util$3=requireMinimal();function BufferWriter(){Writer.call(this)}BufferWriter._configure=function(){BufferWriter.alloc=util$3._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util$3.Buffer&&util$3.Buffer.prototype instanceof Uint8Array&&util$3.Buffer.prototype.set.name==="set"?function(t,e,r){e.set(t,r)}:function(t,e,r){if(t.copy)t.copy(e,r,0,t.length);else for(var i=0;i<t.length;)e[r++]=t[i++]}},BufferWriter.prototype.bytes=function n(t){util$3.isString(t)&&(t=util$3._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(BufferWriter.writeBytesBuffer,e,t),this};function writeStringBuffer(n,t,e){n.length<40?util$3.utf8.write(n,t,e):t.utf8Write?t.utf8Write(n,e):t.write(n,e)}BufferWriter.prototype.string=function n(t){var e=util$3.Buffer.byteLength(t);return this.uint32(e),e&&this._push(writeStringBuffer,e,t),this},BufferWriter._configure();var reader=Reader$1,util$2=requireMinimal(),BufferReader$1,LongBits=util$2.LongBits,utf8=util$2.utf8;function indexOutOfRange(n,t){return RangeError("index out of range: "+n.pos+" + "+(t||1)+" > "+n.len)}function Reader$1(n){this.buf=n,this.pos=0,this.len=n.length}var create_array=typeof Uint8Array!="undefined"?function n(t){if(t instanceof Uint8Array||Array.isArray(t))return new Reader$1(t);throw Error("illegal buffer")}:function n(t){if(Array.isArray(t))return new Reader$1(t);throw Error("illegal buffer")},create=function n(){return util$2.Buffer?function(e){return(Reader$1.create=function(i){return util$2.Buffer.isBuffer(i)?new BufferReader$1(i):create_array(i)})(e)}:create_array};Reader$1.create=create(),Reader$1.prototype._slice=util$2.Array.prototype.subarray||util$2.Array.prototype.slice,Reader$1.prototype.uint32=function n(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return t}}(),Reader$1.prototype.int32=function n(){return this.uint32()|0},Reader$1.prototype.sint32=function n(){var t=this.uint32();return t>>>1^-(t&1)|0};function readLongVarint(){var n=new LongBits(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(n.lo=(n.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return n;if(n.lo=(n.lo|(this.buf[this.pos]&127)<<28)>>>0,n.hi=(n.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return n;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(n.lo=(n.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return n}return n.lo=(n.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,n}if(this.len-this.pos>4){for(;t<5;++t)if(n.hi=(n.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return n}else for(;t<5;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(n.hi=(n.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return n}throw Error("invalid varint encoding")}Reader$1.prototype.bool=function n(){return this.uint32()!==0};function readFixed32_end(n,t){return(n[t-4]|n[t-3]<<8|n[t-2]<<16|n[t-1]<<24)>>>0}Reader$1.prototype.fixed32=function n(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader$1.prototype.sfixed32=function n(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)|0};function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader$1.prototype.float=function n(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var t=util$2.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},Reader$1.prototype.double=function n(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var t=util$2.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},Reader$1.prototype.bytes=function n(){var t=this.uint32(),e=this.pos,r=this.pos+t;if(r>this.len)throw indexOutOfRange(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(e,r);if(e===r){var i=util$2.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,e,r)},Reader$1.prototype.string=function n(){var t=this.bytes();return utf8.read(t,0,t.length)},Reader$1.prototype.skip=function n(t){if(typeof t=="number"){if(this.pos+t>this.len)throw indexOutOfRange(this,t);this.pos+=t}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this},Reader$1.prototype.skipType=function(n){switch(n){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(n=this.uint32()&7)!==4;)this.skipType(n);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+n+" at offset "+this.pos)}return this},Reader$1._configure=function(n){BufferReader$1=n,Reader$1.create=create(),BufferReader$1._configure();var t=util$2.Long?"toLong":"toNumber";util$2.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[t](!1)},uint64:function(){return readLongVarint.call(this)[t](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[t](!1)},fixed64:function(){return readFixed64.call(this)[t](!0)},sfixed64:function(){return readFixed64.call(this)[t](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$1=requireMinimal();function BufferReader(n){Reader.call(this,n)}BufferReader._configure=function(){util$1.Buffer&&(BufferReader.prototype._slice=util$1.Buffer.prototype.slice)},BufferReader.prototype.string=function n(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},BufferReader._configure();var rpc={},service=Service,util=requireMinimal();(Service.prototype=Object.create(util.EventEmitter.prototype)).constructor=Service;function Service(n,t,e){if(typeof n!="function")throw TypeError("rpcImpl must be a function");util.EventEmitter.call(this),this.rpcImpl=n,this.requestDelimited=!!t,this.responseDelimited=!!e}Service.prototype.rpcCall=function n(t,e,r,i,o){if(!i)throw TypeError("request must be specified");var s=this;if(!o)return util.asPromise(n,s,t,e,r,i);if(!s.rpcImpl){setTimeout(function(){o(Error("already ended"))},0);return}try{return s.rpcImpl(t,e[s.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(c,l){if(c)return s.emit("error",c,t),o(c);if(l===null){s.end(!0);return}if(!(l instanceof r))try{l=r[s.responseDelimited?"decodeDelimited":"decode"](l)}catch(d){return s.emit("error",d,t),o(d)}return s.emit("data",l,t),o(null,l)})}catch(u){s.emit("error",u,t),setTimeout(function(){o(u)},0);return}},Service.prototype.end=function n(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},function(n){var t=n;t.Service=service}(rpc);var roots={};(function(n){var t=n;t.build="minimal",t.Writer=writer,t.BufferWriter=writer_buffer,t.Reader=reader,t.BufferReader=reader_buffer,t.util=requireMinimal(),t.rpc=rpc,t.roots=roots,t.configure=e;function e(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}e()})(indexMinimal);var minimal=indexMinimal;const $Reader$1=minimal.Reader,$util$1=minimal.util,$root$1=minimal.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]||(minimal.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]={}),Model$2=$root$1.Model=(()=>{function n(t){if(this.chunks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.chunks=$util$1.emptyArray,n.prototype.createAt=$util$1.Long?$util$1.Long.fromBits(0,0,!0):0,n.prototype.description="",n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root$1.Model;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.chunks&&o.chunks.length||(o.chunks=[]),o.chunks.push($root$1.Chunk.decode(e,e.uint32()));break}case 2:{o.createAt=e.uint64();break}case 3:{o.description=e.string();break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Model"},n})();$root$1.Chunk=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.vertices=null,n.prototype.faces=null,n.prototype.name="",n.prototype.texture="",n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root$1.Chunk;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.vertices=$root$1.Vertices.decode(e,e.uint32());break}case 2:{o.faces=$root$1.Faces.decode(e,e.uint32());break}case 3:{o.name=e.string();break}case 4:{o.texture=e.string();break}default:e.skipType(s&7);break}}if(!o.hasOwnProperty("vertices"))throw $util$1.ProtocolError("missing required 'vertices'",{instance:o});if(!o.hasOwnProperty("faces"))throw $util$1.ProtocolError("missing required 'faces'",{instance:o});if(!o.hasOwnProperty("name"))throw $util$1.ProtocolError("missing required 'name'",{instance:o});return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Chunk"},n})(),$root$1.Vertices=(()=>{function n(t){if(this.xyz=[],this.uvs=[],this.marks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.xyz=$util$1.emptyArray,n.prototype.uvs=$util$1.emptyArray,n.prototype.marks=$util$1.emptyArray,n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root$1.Vertices;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.xyz&&o.xyz.length||(o.xyz=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.xyz.push(e.float())}else o.xyz.push(e.float());break}case 2:{if(o.uvs&&o.uvs.length||(o.uvs=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.uvs.push(e.float())}else o.uvs.push(e.float());break}case 3:{if(o.marks&&o.marks.length||(o.marks=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.marks.push(e.int32())}else o.marks.push(e.int32());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Vertices"},n})(),$root$1.Faces=(()=>{function n(t){if(this.indices=[],this.normals=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.indices=$util$1.emptyArray,n.prototype.normals=$util$1.emptyArray,n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root$1.Faces;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.indices&&o.indices.length||(o.indices=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.indices.push(e.uint32())}else o.indices.push(e.uint32());break}case 2:{if(o.normals&&o.normals.length||(o.normals=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.normals.push(e.float())}else o.normals.push(e.float());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Faces"},n})(),$root$1.VertexMark=(()=>{const n={},t=Object.create(n);return t[n[0]="VERTEX_MARK_UNSPECIFIED"]=0,t[n[1]="VERTEX_MARK_ROOF"]=1,t})();function loadPbm(n,t){var e,r,i,o={byteLength:0},s=autoRestImageOptionsByTextureLength((e=t.textureOptions)!==null&&e!==void 0?e:{},(i=(r=t.textureArray)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0),u={};if(t.textureArray)for(var c=0,l=t.textureArray;c<l.length;c++){var d=l[c];u[d]=loadTexture$1(d,s,t.fetcher)}return Promise.resolve().then(function(){return t.fetcher.ajax(n,{responseType:"arraybuffer"})}).then(function(f){return o.byteLength=f.body.byteLength,delay(function(){var m=new Uint8Array(f.body);return Model$2.decode(m)})}).then(function(f){return delay(function(){var m,A;return parse$2(f,(m=t.textureBaseUri)!==null&&m!==void 0?m:function(){var h=n.lastIndexOf("/");if(h>=0){var p=n.slice(0,h)+"/";return/\/model\/$/.test(p)&&(p=p.replace(/\/model\/$/,"/materials/")),p}return""}(),((A=t.textureArray)!==null&&A!==void 0?A:[]).slice(),s,u,t.fetcher)})}).then(function(f){var m=new THREE__namespace.Group;m.matrixAutoUpdate=!1,m.matrix.compose(m.position,m.quaternion,m.scale),m.name=n;for(var A=0,h=f.objects;A<h.length;A++){var p=h[A];m.add(p)}return{type:"pbm",uri:n,byteLength:o.byteLength,scene:m,textures:f.textures,dispose:function(){return f.dispose()}}})}function parseFloorName(n){var t=n.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function parseChunkName(n){var t=n.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function parseSubName(n){var t=n.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}function chunkOrder(n){var t=parseFloorName(n.name),e=parseChunkName(n.name),r=parseSubName(n.name);return t*1e6+e*1e3+r}function parsePBMModel(n){for(var t,e,r,i=typeof n.createAt=="number"?n.createAt:0,o=(t=n.description)!==null&&t!==void 0?t:"",s=[],u=!0,c=!0,l=0,d=n.chunks;l<d.length;l++){var f=d[l];if(!f.vertices.marks||f.vertices.marks.length===0){c=!1;break}}for(var m=0,A=n.chunks;m<A.length;m++){var f=A[m];if(!f.faces.normals||f.faces.normals.length===0){u=!1;break}}for(var h=n.chunks.sort(function(ie,se){return chunkOrder(ie)-chunkOrder(se)}),p=[],y=0,v=h;y<v.length;y++){var f=v[y],g=parseFloorName(f.name);p[g]||(p[g]=[]),p[g].push(f)}for(var E=0;E<p.length;E++){var b=p[E];if(b)if(u){for(var T=0,x=0;x<b.length;x++){var f=b[x];T+=f.faces.indices.length}for(var R=new Float32Array(T*3),_=new Float32Array(T*2),M=new Float32Array(T*3),S=c?new Float32Array(T):void 0,I=[],C=[1/0,1/0,1/0,-1/0,-1/0,-1/0],H=0,B=0;B<b.length;B++){for(var L=[1/0,1/0,1/0,-1/0,-1/0,-1/0],f=b[B],O=f.vertices.xyz,k=f.vertices.uvs,G=f.faces.indices,z=f.faces.normals,D=f.vertices.marks,U=G.length,x=0;x<U;x++){var K=G[x],Q=R[H*3+x*3]=O[K*3],q=R[H*3+x*3+1]=O[K*3+1],J=R[H*3+x*3+2]=O[K*3+2];S&&(S[H+x]=D[K]),_[H*2+x*2]=k[K*2],_[H*2+x*2+1]=k[K*2+1];var W=Math.floor(x/3)*3;M[H*3+x*3]=z[W],M[H*3+x*3+1]=z[W+1],M[H*3+x*3+2]=z[W+2],Q<L[0]&&(L[0]=Q),q<L[1]&&(L[1]=q),J<L[2]&&(L[2]=J),Q>L[3]&&(L[3]=Q),q>L[4]&&(L[4]=q),J>L[5]&&(L[5]=J)}L[0]<C[0]&&(C[0]=L[0]),L[1]<C[1]&&(C[1]=L[1]),L[2]<C[2]&&(C[2]=L[2]),L[3]>C[3]&&(C[3]=L[3]),L[4]>C[4]&&(C[4]=L[4]),L[5]>C[5]&&(C[5]=L[5]),I.push({materialIndex:B,name:f.name,chunkName:parseChunkName(f.name),start:H,count:f.faces.indices.length,texture:(e=f.texture)!==null&&e!==void 0?e:void 0}),H+=U}var re={createAt:i,description:o,vertices:R,uvs:_,normals:M,masks:S,indices:null,floorIndex:E,groups:I,extents:C};s.push(re)}else{for(var T=0,j=0,x=0;x<b.length;x++){var f=b[x];j+=f.vertices.xyz.length/3,T+=f.faces.indices.length}for(var R=new Float32Array(j*3),_=new Float32Array(j*2),M=void 0,te=new Float32Array(j),$=new Uint32Array(T),S=c?new Float32Array(T):void 0,I=[],C=[1/0,1/0,1/0,-1/0,-1/0,-1/0],ne=0,H=0,B=0;B<b.length;B++){for(var L=[1/0,1/0,1/0,-1/0,-1/0,-1/0],f=b[B],O=f.vertices.xyz,ee=f.vertices.marks,k=f.vertices.uvs,G=f.faces.indices,fe=O.length/3,U=G.length,x=0;x<fe;x++){var Q=R[H*3+x*3]=O[x*3],q=R[H*3+x*3+1]=O[x*3+1],J=R[H*3+x*3+2]=O[x*3+2];S&&(S[H+x]=ee[x]),_[H*2+x*2]=k[x*2],_[H*2+x*2+1]=k[x*2+1],te[H+x]=E,Q<L[0]&&(L[0]=Q),q<L[1]&&(L[1]=q),J<L[2]&&(L[2]=J),Q>L[3]&&(L[3]=Q),q>L[4]&&(L[4]=q),J>L[5]&&(L[5]=J)}L[0]<C[0]&&(C[0]=L[0]),L[1]<C[1]&&(C[1]=L[1]),L[2]<C[2]&&(C[2]=L[2]),L[3]>C[3]&&(C[3]=L[3]),L[4]>C[4]&&(C[4]=L[4]),L[5]>C[5]&&(C[5]=L[5]);for(var x=0;x<U;x++)$[ne+x]=H+G[x];I.push({materialIndex:B,name:f.name,chunkName:parseChunkName(f.name),start:ne,count:f.faces.indices.length,texture:(r=f.texture)!==null&&r!==void 0?r:void 0}),H+=fe,ne+=U}var re={createAt:i,description:o,vertices:R,uvs:_,normals:M,masks:S,indices:$,floorIndex:E,groups:I,extents:C};s.push(re)}}return s}function loadTexture$1(n,t,e){var r=__assign({key:"texture.pbm"},pick(t,["format","quality","size","sharpen","mappings"])),i=new TextureLoader,o=i.loadTexture(n,{imageURL:{transform:t.transform,options:r},encoding:THREE__namespace.sRGBEncoding,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping,minFilter:THREE__namespace.LinearFilter,maxSize:typeof r.size=="number"?new THREE__namespace.Vector2(r.size,r.size):void 0,fetcher:e}).then(function(s){var u=s.body;return u.needsUpdate=!0,u});return Object.assign(o,{url:n,textureOptions:t})}function parse$2(n,t,e,r,i,o){i===void 0&&(i={});for(var s=parsePBMModel(n),u=0,c="",l=[],d={},f=new Set,m=0,A=s;m<A.length;m++){var h=A[m],p=h.createAt,y=h.description,v=h.vertices,g=h.masks,E=h.uvs,b=h.normals,T=h.indices,x=h.floorIndex,R=h.groups,_=h.extents,M=new THREE__namespace.Box3;M.min.x=_[0],M.min.y=_[1],M.min.z=_[2],M.max.x=_[3],M.max.y=_[4],M.max.z=_[5];var S=new THREE__namespace.BufferGeometry;S.setAttribute("position",new THREE__namespace.BufferAttribute(v,3)),S.setAttribute("uv",new THREE__namespace.BufferAttribute(E,2)),b&&S.setAttribute("normal",new THREE__namespace.BufferAttribute(b,3)),g&&S.setAttribute("mask",new THREE__namespace.BufferAttribute(g,1)),T&&S.setIndex(new THREE__namespace.BufferAttribute(T,1)),S.boundingBox=M,S.boundingSphere=M.getBoundingSphere(new THREE__namespace.Sphere);for(var I=0,C=R;I<C.length;I++){var H=C[I];S.addGroup(H.start,H.count,H.materialIndex)}f.add(S);for(var B=[],L=0,O=R;L<O.length;L++){var H=O[L],k=e[H.chunkName]||(H.texture?pathJoin(t||"",H.texture):void 0),G=new PBMMeshMaterial("basic");G.defines.USE_VERTEX_FLOOR=!1,G.floor=x,S.attributes.normal===void 0&&(G.flatShading=!0),S.attributes.mask&&(G.defines.USE_VERTEX_MARK=!0),B.push(G),k?d[k]?d[k].push(G):d[k]=[G]:G.color=new THREE__namespace.Color(16777215),f.add(G)}var z=new PBMMesh(S,B);z.name="model_floor_"+x,z.userData.createAt=p,z.userData.description=y,z.matrix.compose(z.position,z.quaternion,z.scale),z.matrixAutoUpdate=!1,z.frustumCulled=!1,u=p,c=y,l.push(z)}var D=function(U){U=autoRestImageOptionsByTextureLength(U,e.length);for(var K=[],Q=function(re){var j=null;re in i&&(j=i[re]),j||(j=loadTexture$1(re,U,o)),K.push(j.then(function(te){for(var $=0,ne=d[re];$<ne.length;$++){var ee=ne[$];ee.map&&(f.delete(ee.map),ee.map.dispose()),ee.map=te,f.add(te)}return te}).catch(function(){for(var te=0,$=d[re];te<$.length;te++){var ne=$[te];ne.map&&(f.delete(ne.map),ne.map.dispose()),ne.map=null,ne.color=new THREE__namespace.Color(16777215)}return null}))},q=0,J=Object.keys(d);q<J.length;q++){var W=J[q];Q(W)}for(var W in i)delete i[W];return Promise.all(K).then(function(re){return re.filter(function(j){return j})})};return D(r).then(function(U){return{createAt:u,description:c,objects:l,textures:U,dispose:function(){f.forEach(function(K){K.dispose()}),f.clear()}}})}function autoRestImageOptionsByTextureLength(n,t){return n=Object.assign({},n),n.autoResize!==!1&&(t>96?n.size=Math.min(n.size||1/0,100):t>48?n.size=Math.min(n.size||1/0,200):t>24?n.size=Math.min(n.size||1/0,400):t>22?n.size=Math.min(n.size||1/0,800):t>5&&(n.size=Math.min(n.size||1/0,1024))),n}function loadAt3d(n,t){var e,r,i,o={byteLength:0},s=autoRestImageOptionsByTextureLength((e=t.textureOptions)!==null&&e!==void 0?e:{},(i=(r=t.textureArray)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0),u={};if(t.textureArray)for(var c=0,l=t.textureArray;c<l.length;c++){var d=l[c];u[d]=loadTexture$1(d,s,t.fetcher)}return Promise.resolve().then(function(){return t.fetcher.ajax(n,{responseType:"arraybuffer"})}).then(function(f){return lzma(f.body)}).then(function(f){return delay(function(){for(var m,A={chunks:[],createAt:void 0,description:void 0},h=0,p=f;h<p.length;h++){var y=p[h],v=Model$2.decode(y);v.chunks.length&&((m=A.chunks).push.apply(m,v.chunks),A.createAt=v.createAt,A.description=v.description)}return A})}).then(function(f){return delay(function(){var m,A,h;return parse$2(f,(m=t.textureBaseUri)!==null&&m!==void 0?m:function(){var p=n.lastIndexOf("/");if(p>=0){var y=n.slice(0,p)+"/";return/\/model\/$/.test(y)&&(y=y.replace(/\/model\/$/,"/materials/")),y}return""}(),((A=t.textureArray)!==null&&A!==void 0?A:[]).slice(),(h=t.textureOptions)!==null&&h!==void 0?h:{},u,t.fetcher)})}).then(function(f){var m=new THREE__namespace.Group;m.name=n;for(var A=0,h=f.objects;A<h.length;A++){var p=h[A];m.add(p)}return{type:"at3d",uri:n,byteLength:o.byteLength,scene:m,textures:f.textures,dispose:function(){return f.dispose()}}})}const $Reader=minimal.Reader,$util=minimal.util,$root=minimal.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]||(minimal.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]={}),Model$1=$root.Model=(()=>{function n(t){if(this.meshes=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.meshes=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Model;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.meshes&&o.meshes.length||(o.meshes=[]),o.meshes.push($root.Mesh.decode(e,e.uint32()));break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Model"},n})();$root.Mesh=(()=>{function n(t){if(this.chunks=[],this.matrix=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.name="",n.prototype.chunks=$util.emptyArray,n.prototype.matrix=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Mesh;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.name=e.string();break}case 2:{o.chunks&&o.chunks.length||(o.chunks=[]),o.chunks.push($root.Chunk.decode(e,e.uint32()));break}case 3:{o.matrix&&o.matrix.length||(o.matrix=[]),o.matrix.push($root.Matrix.decode(e,e.uint32()));break}default:e.skipType(s&7);break}}if(!o.hasOwnProperty("name"))throw $util.ProtocolError("missing required 'name'",{instance:o});return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Mesh"},n})(),$root.Matrix=(()=>{function n(t){if(this.elements=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.elements=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Matrix;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.elements&&o.elements.length||(o.elements=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.elements.push(e.float())}else o.elements.push(e.float());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Matrix"},n})(),$root.Chunk=(()=>{function n(t){if(this.material=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.geometry=null,n.prototype.material=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Chunk;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 2:{o.geometry=$root.Geometry.decode(e,e.uint32());break}case 3:{o.material&&o.material.length||(o.material=[]),o.material.push($root.Material.decode(e,e.uint32()));break}default:e.skipType(s&7);break}}if(!o.hasOwnProperty("geometry"))throw $util.ProtocolError("missing required 'geometry'",{instance:o});return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Chunk"},n})(),$root.Geometry=(()=>{function n(t){if(this.groups=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.position=null,n.prototype.uv=null,n.prototype.uv2=null,n.prototype.normal=null,n.prototype.groups=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Geometry;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.position=$root.Position.decode(e,e.uint32());break}case 2:{o.uv=$root.UV.decode(e,e.uint32());break}case 3:{o.uv2=$root.UV.decode(e,e.uint32());break}case 4:{o.normal=$root.Normal.decode(e,e.uint32());break}case 5:{o.groups&&o.groups.length||(o.groups=[]),o.groups.push($root.Group.decode(e,e.uint32()));break}default:e.skipType(s&7);break}}if(!o.hasOwnProperty("position"))throw $util.ProtocolError("missing required 'position'",{instance:o});if(!o.hasOwnProperty("normal"))throw $util.ProtocolError("missing required 'normal'",{instance:o});return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Geometry"},n})(),$root.Position=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Position;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.array&&o.array.length||(o.array=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.array.push(e.float())}else o.array.push(e.float());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Position"},n})(),$root.UV=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.UV;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.array&&o.array.length||(o.array=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.array.push(e.float())}else o.array.push(e.float());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/UV"},n})(),$root.Normal=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Normal;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.array&&o.array.length||(o.array=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.array.push(e.float())}else o.array.push(e.float());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Normal"},n})(),$root.Group=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.start=0,n.prototype.count=0,n.prototype.materialIndex=0,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Group;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.start=e.uint32();break}case 2:{o.count=e.uint32();break}case 3:{o.materialIndex=e.uint32();break}default:e.skipType(s&7);break}}if(!o.hasOwnProperty("start"))throw $util.ProtocolError("missing required 'start'",{instance:o});if(!o.hasOwnProperty("count"))throw $util.ProtocolError("missing required 'count'",{instance:o});if(!o.hasOwnProperty("materialIndex"))throw $util.ProtocolError("missing required 'materialIndex'",{instance:o});return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Group"},n})(),$root.Material=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.kd=null,n.prototype.ks=null,n.prototype.ke=null,n.prototype.mapkd="",n.prototype.mapks="",n.prototype.mapke="",n.prototype.norm="",n.prototype.mapbump="",n.prototype.bump="",n.prototype.mapd="",n.prototype.ns=0,n.prototype.d=0,n.prototype.tr=0,n.prototype.mapkdrepeat="",n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Material;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.kd=$root.Color.decode(e,e.uint32());break}case 2:{o.ks=$root.Color.decode(e,e.uint32());break}case 3:{o.ke=$root.Color.decode(e,e.uint32());break}case 4:{o.mapkd=e.string();break}case 5:{o.mapks=e.string();break}case 6:{o.mapke=e.string();break}case 7:{o.norm=e.string();break}case 8:{o.mapbump=e.string();break}case 9:{o.bump=e.string();break}case 10:{o.mapd=e.string();break}case 11:{o.ns=e.float();break}case 12:{o.d=e.float();break}case 13:{o.tr=e.float();break}case 14:{o.mapkdrepeat=e.string();break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Material"},n})(),$root.Color=(()=>{function n(t){if(this.rgb=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.rgb=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Color;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.rgb&&o.rgb.length||(o.rgb=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.rgb.push(e.float())}else o.rgb.push(e.float());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Color"},n})();function loadDome(n,t){var e={byteLength:0};return Promise.resolve().then(function(){return t.fetcher.ajax(n,{responseType:"arraybuffer"})}).then(function(r){return e.byteLength=r.body.byteLength,parse$1(new Uint8Array(r.body),t.textureBaseUri||"",t.textureOptions,t.fetcher)}).then(function(r){var i=new THREE__namespace.Group;i.matrixAutoUpdate=!1,i.matrix.compose(i.position,i.quaternion,i.scale),i.name=n;for(var o=0,s=r.objects;o<s.length;o++){var u=s[o];i.add(u)}return{type:"dome",uri:n,byteLength:e.byteLength,scene:i,textures:r.textures,dispose:function(){return r.dispose()}}})}function flipBufferGeometryNormals(n){for(var t=[0,0,0],e=0;e<n.attributes.normal.array.length/9;e++)t[0]=n.attributes.normal.array[e*9],t[1]=n.attributes.normal.array[e*9+1],t[2]=n.attributes.normal.array[e*9+2],n.attributes.normal.array[e*9]=n.attributes.normal.array[e*9+6],n.attributes.normal.array[e*9+1]=n.attributes.normal.array[e*9+7],n.attributes.normal.array[e*9+2]=n.attributes.normal.array[e*9+8],n.attributes.normal.array[e*9+6]=t[0],n.attributes.normal.array[e*9+7]=t[1],n.attributes.normal.array[e*9+8]=t[2];for(var e=0;e<n.attributes.position.array.length/9;e++)t[0]=n.attributes.position.array[e*9],t[1]=n.attributes.position.array[e*9+1],t[2]=n.attributes.position.array[e*9+2],n.attributes.position.array[e*9]=n.attributes.position.array[e*9+6],n.attributes.position.array[e*9+1]=n.attributes.position.array[e*9+7],n.attributes.position.array[e*9+2]=n.attributes.position.array[e*9+8],n.attributes.position.array[e*9+6]=t[0],n.attributes.position.array[e*9+7]=t[1],n.attributes.position.array[e*9+8]=t[2];for(var e=0;e<n.attributes.uv.array.length/6;e++)t[0]=n.attributes.uv.array[e*6],t[1]=n.attributes.uv.array[e*6+1],n.attributes.uv.array[e*6]=n.attributes.uv.array[e*6+4],n.attributes.uv.array[e*6+1]=n.attributes.uv.array[e*6+5],n.attributes.uv.array[e*6+4]=t[0],n.attributes.uv.array[e*6+5]=t[1];n.attributes.normal.needsUpdate=!0,n.attributes.position.needsUpdate=!0,n.attributes.uv.needsUpdate=!0}function parseGeometry(n){var t=n.position,e=n.normal,r=n.uv,i=n.uv2,o=n.groups,s=new THREE__namespace.BufferGeometry;s.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(t.array),3)),e&&s.setAttribute("normal",new THREE__namespace.BufferAttribute(new Float32Array(e.array),3)),r&&s.setAttribute("uv",new THREE__namespace.BufferAttribute(new Float32Array(r.array),2)),i&&s.setAttribute("uv2",new THREE__namespace.BufferAttribute(new Float32Array(i.array),2));for(var u=0,c=o;u<c.length;u++){var l=c[u];s.addGroup(l.start,l.count,l.materialIndex)}return s}function loadTexture(n,t,e,r,i,o,s){if(s.hasOwnProperty(n))return s[n];n=n.split("?")[0],isAbsoluteURL(n)||(n=pathJoin(t,n)),n=n.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/"),n.indexOf("//")===0&&(n="https:"+n);var u=__assign({key:"texture.dome",size:64},pick(e,["quality","format","sharpen","mappings"])),c=s[n]=i.loadTexture(n,{imageURL:{transform:e.transform,options:u},wrapS:THREE__namespace.RepeatWrapping,wrapT:THREE__namespace.RepeatWrapping,fetcher:o}).then(function(l){var d=l.body;return r&&d.repeat.copy(r),d.needsUpdate=!0,d.updateMatrix(),d});return c}function parseMaterial(n,t,e,r,i,o,s,u){var c=[],l=new PBMMeshMaterial("phong");if(s.add(l),n.kd&&(l.color=new THREE__namespace.Color().fromArray(n.kd.rgb).convertLinearToSRGB()),n.mapkd){var d=null;if(n.mapkdrepeat){var f=n.mapkdrepeat.split(/\s+/).map(function(p){return Number(p)}),m=f[0],A=f[1];d=new THREE__namespace.Vector2(m,A)}c.push(loadTexture(n.mapkd,t,e,d,r,i,o).then(function(p){p.encoding=THREE__namespace.sRGBEncoding,l.map=p,s.add(p),u.add(p),l.needsUpdate=!0}).catch(noop$1))}if(n.ks&&(l.specular=new THREE__namespace.Color().fromArray(n.ks.rgb).convertLinearToSRGB()),n.mapks&&c.push(loadTexture(n.mapks,t,e,null,r,i,o).then(function(p){l.specularMap=p,s.add(p),u.add(p)}).catch(noop$1)),n.ke&&(l.emissive=new THREE__namespace.Color().fromArray(n.ke.rgb).convertLinearToSRGB()),n.mapke&&c.push(loadTexture(n.mapke,t,e,null,r,i,o).then(function(p){p.encoding=THREE__namespace.sRGBEncoding,l.emissiveMap=p,s.add(p),u.add(p)}).catch(noop$1)),n.norm&&c.push(loadTexture(n.norm,t,e,null,r,i,o).then(function(p){l.normalMap=p,s.add(p),u.add(p)}).catch(noop$1)),n.mapbump&&c.push(loadTexture(n.mapbump,t,e,null,r,i,o).then(function(p){l.bumpMap=p,s.add(p),u.add(p)}).catch(noop$1)),n.bump&&c.push(loadTexture(n.bump,t,e,null,r,i,o).then(function(p){l.bumpMap=p,s.add(p),u.add(p)}).catch(noop$1)),typeof n.ns=="number"&&(l.shininess=n.ns),typeof n.d=="number"){var h=n.d;h>0&&h<1&&(l.opacity=h)}return l.floor=0,l.defines.USE_VERTEX_FLOOR=!1,{material:l,textureReady:Promise.all(c).then(noop$1)}}function fromProtoBuf(n){return Model$1.decode(n).meshes}function parse$1(n,t,e,r){for(var i=[],o=[],s=new Set,u=fromProtoBuf(n),c=new TextureLoader,l=new THREE__namespace.Matrix4,d=new THREE__namespace.Vector3,f=new THREE__namespace.Quaternion,m=new THREE__namespace.Vector3,A={},h=new Set,p=0,y=u;p<y.length;p++){var v=y[p],g=v.name,E=v.chunks,b=v.matrix;if(!(g==="Ceiling"||g==="CeilingDrop"))for(var T=0,x=b;T<x.length;T++){var R=x[T];l.elements=R.elements;for(var _=new THREE__namespace.Group,M=0;M<E.length;M++){var S=parseGeometry(E[M].geometry);S.applyMatrix4(l),l.decompose(d,f,m),m.x*m.y*m.z<0&&S.attributes.normal&&S.attributes.position&&S.attributes.uv&&flipBufferGeometryNormals(S),s.add(S);for(var I=[],C=0,H=E[M].material;C<H.length;C++){var B=H[C],L=parseMaterial(B,t||"",e,c,r,A,s,h),O=L.material,k=L.textureReady;o.push(k),I.push(O)}var G=new PBMMesh(S,I);G.name="chunk_"+M,G.matrix.compose(G.position,G.quaternion,G.scale),G.matrixAutoUpdate=!1,G.frustumCulled=!1,_.add(G)}_.name=g,i.push(_)}}return Promise.all(o).catch(noop$1).then(function(){return{createAt:0,description:"",objects:i,textures:Array.from(h),dispose:function(){s.forEach(function(z){z.dispose()}),s.clear()}}})}function loadDomez(n,t){var e={byteLength:0};return Promise.resolve().then(function(){return t.fetcher.ajax(n,{responseType:"arraybuffer"})}).then(function(r){return e.byteLength=r.body.byteLength,lzma(r.body)}).then(function(r){var i=r.reduce(function(u,c){return u+c.length},0),o=new Uint8Array(i),s=0;return r.forEach(function(u){o.set(u,s),s+=u.length}),o}).then(function(r){return parse$1(r,t.textureBaseUri||"",t.textureOptions,t.fetcher)}).then(function(r){var i=new THREE__namespace.Group;i.name=n;for(var o=0,s=r.objects;o<s.length;o++){var u=s[o];i.add(u)}return{type:"domez",uri:n,byteLength:e.byteLength,scene:i,textures:r.textures,dispose:function(){return r.dispose()}}})}var ROTATE_X_MATRIX=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);function loadGlb(n,t){var e=0;return Promise.resolve().then(function(){return t.fetcher.ajax(n,{responseType:"arraybuffer"}).then(function(r){return e=r.body.byteLength,r.body})}).then(function(r){var i;return parseGltf(r,{copyUV2:!1,addonExtensions:["PBM_mesh"],resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(i=n.split("?")[1])!==null&&i!==void 0?i:"",fetcher:t.fetcher})}).then(function(r){var i=new THREE__namespace.Matrix4;if(t.upAxis!=="Z"&&i.premultiply(ROTATE_X_MATRIX),r.CESIUM_RTC){var o=new THREE__namespace.Matrix4().setPosition(r.CESIUM_RTC.center);i.premultiply(o)}var s=r.scene;return s.applyMatrix4(i),{type:"glb",uri:n,byteLength:e,scene:s,textures:r.textures,dispose:function(){return r.dispose()}}})}var scratchVector3$2=new THREE__namespace.Vector3,scratchMatrix4$3=new THREE__namespace.Matrix4;function attachTileAttributes(n,t){n.name=t.id;var e=t.tileset.properties.floorInfo;n.traverse(function(r){if("floor"in t.extras){if(r instanceof THREE__namespace.Mesh||r instanceof THREE__namespace.Points)for(var i=Array.isArray(r.material)?r.material:r.material?[r.material]:[],o=0,s=i;o<s.length;o++){var u=s[o];(u instanceof PBMMeshMaterial||u instanceof PBMPointCloudMaterial)&&(u.floor=t.extras.floor)}}else if((r instanceof PBMMesh||r instanceof PBMPointCloud)&&e){var c=r.geometry.index,l=r.geometry.getAttribute("position"),d=0,f=new Float32Array(l.count);if(e)if(c){for(var m=0,A=c.count,h=0;h<A;h++){var b=c.array[h];scratchVector3$2.set(l.array[b*3+0],l.array[b*3+1],l.array[b*3+2]),scratchVector3$2.applyMatrix4(r.matrixWorld);var p=scratchVector3$2.y;f[b]=0;for(var y=0;y<e.length;y++){var T=e[y],g=T.ground,E=T.height;if(p<g+E){f[b]=y;break}}m+=f[b]}d=m/A}else{for(var m=0,A=l.count,h=0;h<A;h++){scratchVector3$2.set(l.array[h*3+0],l.array[h*3+1],l.array[h*3+2]),scratchVector3$2.applyMatrix4(r.matrixWorld);var p=scratchVector3$2.y;f[h]=0;for(var y=0;y<e.length;y++){var v=e[y],g=v.ground,E=v.height;if(p<g+E){f[h]=y;break}}m+=f[h]}d=m/A}t.floor=d,r.geometry.setAttribute("floor",new THREE__namespace.BufferAttribute(f,1)),Array.isArray(r.material)?r.material.forEach(function(x){x.defines.USE_VERTEX_FLOOR=!0,x.needsUpdate=!0}):(r.material.defines.USE_VERTEX_FLOOR=!0,r.material.needsUpdate=!0)}})}function loadTileContentData(n,t){if(!n.content)return Promise.resolve(null);var e=n.content,r=appendSearch(e.uri,t.search);if(n.type==="TILESET"){var i=imageURL(r,{key:"model.".concat(n.siblingIndex)});return t.fetcher.ajax(i,{responseType:"text"}).then(function(o){return o.body}).then(function(o){var s=r.slice(0,r.lastIndexOf("/")+1);return normalizeTilesetHeader(JSON.parse(o),s)}).then(function(o){n.children.length===0&&(n.children=[new Tile("".concat(n.id,".0"),o.root,n.tileset,n)])}).then(function(){return null})}return n.type==="SCENEGRAPH"?Promise.resolve().then(function(){var o,s,u,c,l,d,f,m,A,h,p="",y=r.split("#"),v=y[0],g=y[1],E=(g||v).split("?")[0].match(/\.([0-9a-zA-Z]+)$/);if(E&&(p=E[1]),p==="b3dm"){var b=imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadB3dm(b,{upAxis:n.tileset.asset.gltfUpAxis,fetcher:t.fetcher}).then(function(T){return T.scene.applyMatrix4(n.transform),T.scene.updateWorldMatrix(!1,!0),T.scene.matrixAutoUpdate=!1,attachTileAttributes(T.scene,n),T})}if(p==="pnts"){var b=imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadPnts(b,{fetcher:t.fetcher,computeBoundingBox:!1}).then(function(x){if(x.scene.applyMatrix4(n.transform),x.scene.updateWorldMatrix(!1,!0),x.scene.matrixAutoUpdate=!1,n.boundingVolume){var R=n.boundingVolume;x.scene.traverse(function(_){if(_ instanceof PBMPointCloud){scratchMatrix4$3.getInverse(_.matrixWorld);var M=new THREE__namespace.Box3;R.getBoundingBox(M),M.applyMatrix4(scratchMatrix4$3),_.geometry.boundingBox=M}})}return x})}if(p==="glb"){var b=imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadGlb(b,{upAxis:n.tileset.asset.gltfUpAxis,fetcher:t.fetcher}).then(function(x){return x.scene.applyMatrix4(n.transform),x.scene.updateWorldMatrix(!1,!0),x.scene.matrixAutoUpdate=!1,attachTileAttributes(x.scene,n),x})}if(p==="at3d"){var b=n.extras.at3d?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadAt3d(b,{textureBaseUri:(o=n.extras.at3d)===null||o===void 0?void 0:o.textureBaseUri,textureArray:(s=n.extras.at3d)===null||s===void 0?void 0:s.textureArray,textureOptions:(u=n.extras.at3d)===null||u===void 0?void 0:u.textureOptions,fetcher:t.fetcher}).then(function(x){return x.scene.applyMatrix4(n.transform),x.scene.updateWorldMatrix(!1,!0),x.scene.matrixAutoUpdate=!1,x})}if(p==="pbm"){var b=n.extras.pbm?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadPbm(b,{textureBaseUri:(c=n.extras.pbm)===null||c===void 0?void 0:c.textureBaseUri,textureArray:(l=n.extras.pbm)===null||l===void 0?void 0:l.textureArray,textureOptions:(d=n.extras.pbm)===null||d===void 0?void 0:d.textureOptions,fetcher:t.fetcher}).then(function(x){return x.scene.applyMatrix4(n.transform),x.scene.updateWorldMatrix(!1,!0),x.scene.matrixAutoUpdate=!1,x})}if(p==="dome"){var b=n.extras.dome?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadDome(b,{textureBaseUri:(f=n.extras.dome)===null||f===void 0?void 0:f.textureBaseUri,textureOptions:(m=n.extras.dome)===null||m===void 0?void 0:m.textureOptions,fetcher:t.fetcher}).then(function(x){return x.scene.applyMatrix4(n.transform),x.scene.updateWorldMatrix(!1,!0),x.scene.matrixAutoUpdate=!1,x})}if(p==="domez"){var b=n.extras.domez?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadDomez(b,{textureBaseUri:(A=n.extras.domez)===null||A===void 0?void 0:A.textureBaseUri,textureOptions:(h=n.extras.domez)===null||h===void 0?void 0:h.textureOptions,fetcher:t.fetcher}).then(function(x){return x.scene.applyMatrix4(n.transform),x.scene.updateWorldMatrix(!1,!0),x.scene.matrixAutoUpdate=!1,x})}return null}).then(function(o){if(!o)return Promise.resolve(null);o.scene.traverse(function(u){if(u instanceof PBMPointCloud)u.material.uniforms.geometricError.value=n.geometricError;else if(u instanceof PBMMesh)for(var c=0,l=u.material;c<l.length;c++){var d=l[c];d.uniforms.geometricError.value=n.geometricError}});var s={type:o.type,uri:o.uri,byteLength:o.byteLength,object:new TileNode(o.scene,o.dispose)};return s.object.name=n.id,Promise.resolve().then(function(){return Promise.all([s.object.generateBvhTree(),t.renderer&&o.textures.length<16?initTextures(o.textures,t.renderer,1024*1024):null])}).then(function(){return s}).catch(function(u){return unloadTileContentData(s),Promise.reject(u)})}):Promise.resolve(null)}function unloadTileContentData(n){n&&n.object.dispose()}function jsonStableStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",i=n.length-1,o=0;o<i;o++)r+=jsonStableStrinfiy_(n[o],!1)+",";return i>-1&&(r+=jsonStableStrinfiy_(n[o],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableStrinfiy_(n.toJSON(),t);for(var s=Object.keys(n).sort(),u=s.length,r="",o=0;o<u;){var c=s[o],l=jsonStableStrinfiy_(n[c],!0);l!==void 0&&(o&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+l),o++}return"{"+r+"}"}switch(e){case"function":return JSON.stringify(n.toString());case"undefined":return t?void 0:null;case"number":return n;default:return isFinite(n)?n:null}}function jsonHash(n){return"hash::".concat(jsonStableStrinfiy_(n,!1))}var scratchVector3$1=new THREE__namespace.Vector3,scratchMatrix3=new THREE__namespace.Matrix3,scratchMatrix4$2=new THREE__namespace.Matrix4,a=6378137,invF=298.257223563;function ecefToLla(n){for(var t=a-a/invF,e=(a*a-t*t)/(a*a),r=Math.sqrt(n.x*n.x+n.y*n.y),i=1e-12,o=1e3,s=0,u=Math.atan2(n.z,r),c=0;s++<o;){var l=Math.sin(u),d=a/Math.sqrt(1-e*l*l);c=r/Math.cos(u)-d;var f=Math.atan2(n.z/(d*(1-e)+c),r/(d+c));if(isNaN(f))break;var m=Math.abs(f-u);if(m<i)break;u=f}return n.set(u,Math.atan2(n.y,n.x),c)}function llaToEcef(n){var t=n.x,e=n.y,r=n.z,i=a-a/invF,o=(a*a-i*i)/(a*a),s=Math.sin(t),u=Math.cos(t),c=Math.sin(e),l=Math.cos(e),d=a/Math.sqrt(1-o*s*s),f=(d+r)*u*l,m=(d+r)*u*c,A=(i*i/(a*a)*d+r)*s;return n.set(f,m,A)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$1.copy(n)),r=e.x,i=e.y,o=e.z,s=Math.sin(r),u=Math.sin(i),c=Math.cos(r),l=Math.cos(i);t.fromArray([-u,-s*l,c*l,0,+l,-s*u,c*u,0,0,c,s,0,0,0,0,1]);var d=scratchMatrix3.setFromMatrix4(t),f=scratchVector3$1.copy(n).applyMatrix3(d).multiplyScalar(-1);t.setPosition(f);var m=scratchMatrix4$2.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,o,1]);return t.premultiply(m),t}var StencilConstants={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15},SKIP_BACKFACE_MATERIAL=function(){var n=new THREE__namespace.MeshBasicMaterial;return n.side=THREE__namespace.BackSide,n.color.setHex(16711935),n.colorWrite=!1,n.stencilWrite=!0,n.polygonOffset=!0,n.polygonOffsetFactor=2,n.polygonOffsetUnits=2,n.stencilRef=StencilConstants.TILE_MASK,n.stencilFunc=THREE__namespace.AlwaysStencilFunc,n.stencilFuncMask=StencilConstants.TILE_MASK,n.stencilZPass=THREE__namespace.ReplaceStencilOp,n.stencilWriteMask=StencilConstants.TILE_MASK,n}(),SKIP_BACKFACE_TRANSPARENT_MATERIAL=function(){var n=new THREE__namespace.MeshBasicMaterial;return n.visible=!1,n}(),CLEAR_STENCIL_GEOMETRY=new THREE__namespace.BufferGeometry,CLEAR_STENCIL_MATERIAL=new THREE__namespace.MeshBasicMaterial,Tile3DModel=function(n){__extends(t,n);function t(e,r,i){var o,s,u,c=n.call(this)||this;return c.modelIndex=0,c.debug=!1,c.name=i.name,c.type=i.type,c.upAxis=i.upAxis,c.model=e,c.fetcher=i.fetcher,c.search=(o=i.search)!==null&&o!==void 0?o:"",c.groundHeight=i.groundHeight,c.coordinateTransform=i.coordinateTransform,c.unloadTileQueue=[],c.boundingBox=new THREE__namespace.Box3,c.idle=!1,c.minLevelOfDetail=t.DEFAULT_MIN_LEVEL_OF_DETAIL,c.maxLevelOfDetail=t.DEFAULT_MAX_LEVEL_OF_DETAIL,c.needsRefined=!0,c.refined=!1,c.refineProgress=[0,0],c.loaded=!1,c.disposed=!1,c.needsRender=!0,c.lastRenderHash="",c.matrixAutoUpdate=!1,c.cacheCameras=[],c.clearStencilObject=new THREE__namespace.Mesh(CLEAR_STENCIL_GEOMETRY,CLEAR_STENCIL_MATERIAL),c.clearStencilObject.frustumCulled=!1,c.clearStencilObject.onAfterRender=function(l){return l.clearStencil()},c.tileset=new Tileset((u=(s=c.model.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",r,{referer:i.referer,contentLoader:function(l){return c.loadContent(l)},onTileLoad:function(){},onTileUnload:function(l){c.unloadTileQueue.push(l)},onTileError:function(l,d){i.onError&&i.onError(Object.assign(d,{error:d})),console.error("Tile error",l.id,d)}}),c.tileset.root.boundingVolume&&c.tileset.root.boundingVolume.getBoundingBox(c.boundingBox),c}return t.prototype.getRenderHash=function(){return jsonHash([this.tileset.id,this.tileset.skipLevelOfDetail,this.tileset.selectedTiles.map(function(e){return e.id}),this.debug])},Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){return this.tileset.maxMemoryUsage},set:function(e){this.tileset.maxMemoryUsage=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRequests",{get:function(){return this.tileset.maxRequests},set:function(e){this.tileset.maxRequests=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipLevelOfDetail",{get:function(){return this.tileset.skipLevelOfDetail},set:function(e){this.tileset.skipLevelOfDetail=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadSiblings",{get:function(){return this.tileset.loadSiblings},set:function(e){this.tileset.loadSiblings=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){return this.tileset.maxScreenSpaceError},set:function(e){this.tileset.maxScreenSpaceError=e},enumerable:!1,configurable:!0}),t.prototype.localToEnu=function(e){return e.applyMatrix4(this.coordinateTransform.localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(this.coordinateTransform.enuToLocalMatrix)},t.prototype.localToEcef=function(e){return e.applyMatrix4(this.coordinateTransform.localToEcefMatrix)},t.prototype.ecefToLocal=function(e){return e.applyMatrix4(this.coordinateTransform.ecefToLocalMatrix)},t.prototype.localToLla=function(e){return ecefToLla(this.localToEcef(e))},t.prototype.llaToLocal=function(e){return this.ecefToLocal(llaToEcef(e))},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},t.prototype.worldToEcef=function(e){return this.localToEcef(this.worldToLocal(e))},t.prototype.ecefToWorld=function(e){return this.localToWorld(this.ecefToLocal(e))},t.prototype.worldToLla=function(e){return this.localToLla(this.worldToLocal(e))},t.prototype.llaToWorld=function(e){return this.localToWorld(this.llaToLocal(e))},t.prototype.loadContent=function(e){var r=this;return loadTileContentData(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(i){return e.type==="TILESET"?!0:i&&e.type==="SCENEGRAPH"?r.disposed||!e.content?(unloadTileContentData(i),!1):(e.content.data=i,e.content.byteLength=i.byteLength,e.content.data&&(e.content.data.object.traverse(function(o){(o instanceof PBMPointCloud||o instanceof PBMMesh)&&(o.model=r.model)}),r.boundingBox.expandByObject(e.content.data.object)),!0):!1})},t.prototype.unloadContent=function(e){e.content&&(e.content.byteLength=0,unloadTileContentData(e.content.data),e.content.data=void 0)},t.prototype.loadAllTilesets=function(){var e=this,r=function(i){var o=[];return e.tileset.root.traverse(function(s){var u;s.type==="TILESET"&&((u=s.content)===null||u===void 0?void 0:u.loadState)!=="READY"&&o.push(s)}),Promise.all(o.map(function(s){return e.loadContent(s).then(function(){return r()})})).then(function(){})};return r(this.tileset.root)},t.prototype.intersectRaycaster=function(e,r,i){var o=this;r===void 0&&(r=!0),i===void 0&&(i=[]);for(var s=[this.tileset.root],u=this.tileset.transform,c=this.tileset.transformIsIdentity,l,d=[];l=s.pop();){var f=void 0;if(l.boundingVolume){var m=c?l.boundingVolume:l.boundingVolume.clone().applyMatrix4(u);f=m.intersectRay(e.ray,e.far)}else f=!0;if(f){for(var A=0,h=l.children.length;A<h;A++)s.push(l.children[A]);l.selected&&l.content&&l.content.data&&l.content.data.object.visible&&l.content.data.object.intersectRaycaster(e,!1,d)}}return this.model.shownFloorIndex>=0&&(d=d.filter(function(p){return p.floor===o.model.shownFloorIndex})),r&&d.sort(function(p,y){return p.distance-y.distance}),d.map(function(p){p.model=o.model,p.viewLayer=o.viewLayer}),i.push.apply(i,d),i},t.prototype.cloneSkipBackfaceObject=function(e){var r;e instanceof THREE__namespace.Mesh?r=new THREE__namespace.Mesh(e.geometry,Array.isArray(e.material)?e.material.map(function(u){return u.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL}):e.material&&e.material.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL):e instanceof THREE__namespace.Group?r=new THREE__namespace.Group:r=new THREE__namespace.Object3D,r.copy(e,!1);for(var i=0,o=e.children;i<o.length;i++){var s=o[i];r.add(this.cloneSkipBackfaceObject(s))}return r},t.prototype.update=function(e,r){var i=this,o,s;this.renderer=e,this.tileset.transform.equals(this.matrixWorld)||this.tileset.transform.copy(this.matrixWorld),this.tileset.cache.reset(),this.tileset.frameNumber++;var u=this.visible,c=Math.max(this.maxLevelOfDetail,0),l=Math.min(this.minLevelOfDetail,c),d=Math.max(l,0),f={camera:{type:r.type,position:new THREE__namespace.Vector3().copy(r.position),direction:r.getDirection(new THREE__namespace.Vector3),near:r.near,far:r.far,up:new THREE__namespace.Vector3().copy(r.up),visible:r.visible,refine:r.refineModel},minLevelOfDetail:l,maxLevelOfDetail:u&&!this.idle&&this.loaded?c:d,maxScreenSpaceError:this.maxScreenSpaceError,height:r.resolution.height,pixelRatio:r.pixelRatio,frameNumber:this.tileset.frameNumber,sseDenominator:2*Math.tan(.5*r.fov/180*Math.PI),cullingVolume:new CullingVolume().setFromCamera(r)},m=this.cacheCameras.map(function(C){return __assign(__assign({},f),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(C.position),direction:C.getWorldDirection(new THREE__namespace.Vector3),near:r.near,far:r.far,up:new THREE__namespace.Vector3().copy(C.up),visible:C.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(C)})});this.tileset.traverse(f,m),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(function(C){if(i.refineProgress[1]++,C.content&&C.state.visible){var H=C.content.loadState;if(H==="UNLOADED"||H==="LOADING"){i.refined=!1;return}}i.refineProgress[0]++}),this.loaded===!1&&this.tileset.needsRefinedTiles.size>0&&(this.loaded=!0,this.tileset.needsRefinedTiles.forEach(function(C){if(i.loaded!==!1){if(i.tileset.skipLevelOfDetail){if(C.state.finalResolution&&C.content){var H=C.state.ancestorWithContentAvailable,B=H&&H.content?H.content:C.content,L=B.loadState;(L==="UNLOADED"||L==="LOADING")&&(i.loaded=!1)}}else if(C.state.visible&&C.content&&C.levelOfContent<=0){var L=C.content.loadState;(L==="UNLOADED"||L==="LOADING")&&(i.loaded=!1)}}}),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++));for(var A;A=this.unloadTileQueue.pop();)this.unloadContent(A);this.remove.apply(this,this.children);var h=[],p=[],y=[];this.tileset.skipLevelOfDetail||this.tileset.selectedTiles.sort(function(C,H){return C.floor-H.floor});for(var v=function(C){g.debug&&C.boundingVolumeDebugObject&&p.push(C.boundingVolumeDebugObject);var H=(s=(o=C.content)===null||o===void 0?void 0:o.data)===null||s===void 0?void 0:s.object;if(!H)return"continue";if(g.tileset.skipLevelOfDetail&&g.tileset.hasMixedContent&&!C.state.finalResolution){var B=g.cloneSkipBackfaceObject(H);h.push(B)}var L=C.state.selectionDepth,O=StencilConstants.TILE_MASK|L<<StencilConstants.SKIP_LOD_BIT_SHIFT,k=THREE__namespace.GreaterEqualStencilFunc,G=StencilConstants.SKIP_LOD_MASK,z=THREE__namespace.ReplaceStencilOp,D=StencilConstants.TILE_MASK|StencilConstants.SKIP_LOD_MASK;H.traverse(function(U){if(U instanceof THREE__namespace.Mesh)for(var K=Array.isArray(U.material)?U.material:U.material?[U.material]:[],Q=0,q=K;Q<q.length;Q++){var J=q[Q];i.tileset.hasMixedContent&&i.tileset.skipLevelOfDetail?(J.stencilWrite=!0,J.stencilRef=O,J.stencilFunc=k,J.stencilFuncMask=G,J.stencilZPass=z,J.stencilWriteMask=D):(J.stencilWrite=!1,J.stencilRef=StencilConstants.TILE_MASK,J.stencilFunc=THREE__namespace.AlwaysStencilFunc,J.stencilFuncMask=StencilConstants.TILE_MASK,J.stencilZPass=THREE__namespace.ReplaceStencilOp,J.stencilWriteMask=StencilConstants.TILE_MASK)}}),y.push(H)},g=this,E=0,b=this.tileset.selectedTiles;E<b.length;E++){var T=b[E];v(T)}var x=[];this.tileset.skipLevelOfDetail&&x.push.apply(x,h),x.push.apply(x,y),this.tileset.skipLevelOfDetail&&x.push(this.clearStencilObject),this.debug&&x.push.apply(x,p);for(var R=this.modelIndex*1e4,_=function(C){var H=x[C],B=C+R;H.traverse(function(L){(L instanceof THREE__namespace.Mesh||L instanceof THREE__namespace.Line||L instanceof THREE__namespace.Points)&&(L.renderOrder=B)}),M.add(H)},M=this,S=0;S<x.length;S++)_(S);var I=this.getRenderHash();this.lastRenderHash!==I&&(this.needsRender=!0,this.lastRenderHash=I)},t.prototype.dispose=function(){this.disposed=!0,this.viewLayer=void 0,this.tileset.reset();for(var e;e=this.unloadTileQueue.pop();)this.unloadContent(e)},t.DEFAULT_MIN_LEVEL_OF_DETAIL=0,t.DEFAULT_MAX_LEVEL_OF_DETAIL=20,t.DEFAULT_MAX_MEMORY_USAGE=16,t.DEFAULT_MAX_SCREEN_SPACE_ERROR=Tileset.DEFAULT_MAX_SCREEN_SPACE_ERROR,t.DEFAULT_SKIP_LEVEL_OF_DETAIL=Tileset.DEFAULT_SKIP_LEVEL_OF_DETAIL,t.DEFAULT_LOAD_SIBLINGS=Tileset.DEFAULT_LOAD_SIBLINGS,t.DEFAULT_MAX_REQUESTS=Tileset.DEFAULT_MAX_REQUESTS,t}(THREE__namespace.Object3D);function headingToLongitude(n){return-((n-.25)*360+90)/180*Math.PI}function equal(n,t){if(n===t)return!0;if(n&&t&&typeof n=="object"&&typeof t=="object"){if(n.constructor!==t.constructor)return!1;var e,r,i;if(Array.isArray(n)){if(e=n.length,e!=t.length)return!1;for(r=e;r--!==0;)if(!equal(n[r],t[r]))return!1;return!0}if(n.constructor===RegExp)return n.source===t.source&&n.flags===t.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===t.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===t.toString();if(i=Object.keys(n),e=i.length,e!==Object.keys(t).length)return!1;for(r=e;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=e;r--!==0;){var o=i[r];if(!equal(n[o],t[o]))return!1}return!0}return n!==n&&t!==t}function isNumber(n){return typeof n=="number"}var error_invalid_input=function(){return new Error("Invalid input.")},error_invalid_certificate=function(){return new Error("Invalid certificate.")},error_invalid_signature=function(){return new Error("Invalid signature.")},error_date_expired=function(n){return new Error("date(".concat(n.toString(),") expired."))},error_host_not_allowed=function(n){return new Error("host(".concat(JSON.stringify(n),") is not allowed."))};function ObjectOmit(n,t){for(var e={},r=0,i=Object.keys(n);r<i.length;r++){var o=i[r];t.indexOf(o)===-1&&(e[o]=n[o])}return e}function jsonStableNoneNumberStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",i=n.length-1,o=0;o<i;o++)r+=jsonStableNoneNumberStrinfiy_(n[o],!1)+",";return i>-1&&(r+=jsonStableNoneNumberStrinfiy_(n[o],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableNoneNumberStrinfiy_(n.toJSON(),t);for(var s=Object.keys(n).sort(),u=s.length,r="",o=0;o<u;){var c=s[o],l=jsonStableNoneNumberStrinfiy_(n[c],!0);l!==void 0&&(o&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+l),o++}return"{"+r+"}"}switch(e){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(n)?n:null}}function jsonStableNoneNumberStrinfiy(n){return String(jsonStableNoneNumberStrinfiy_(n,!1))}function verify(n){var t,e,r;if(Array.isArray(n)){var i=void 0,o,s;if(n.length<=0)return error_invalid_input();for(var u=function(T){var x=verify(n[T]);if(x instanceof Error)return{value:x};if(!i)i=x.issuer;else if(i!==x.issuer)return{value:error_invalid_certificate()};o?x.expire.getTime()<o.getTime()&&(o=x.expire):o=x.expire,s?s=s.filter(function(R){return x.allowHosts.indexOf(R)!==-1}):s=x.allowHosts},c=0;c<n.length;c++){var l=u(c);if(typeof l=="object")return l.value}return deepFreeze({issuer:i,expire:o,allowHosts:s})}var d=JSON.parse(n),f=typeof location!="undefined"?location.hostname:"",m=Date.now();if(typeof d!="object")return error_invalid_input();var A=new Date(typeof d.expire_at=="string"&&/^\d+$/.test(d.expire_at)?Number(d.expire_at):d.expire_at),h=Array.isArray(d.allow_hosts)?d.allow_hosts:[];if(f.length===0||isIPDomain(f)||BUILDIN_ALLOW_HOST.filter(function(T){return matchDomain(T,f)}).length>0){var p=String((t=d.certificate)!==null&&t!==void 0?t:"");if(p){var y=new X509;return y.readCertPEM(p),deepFreeze({issuer:y.getSubjectString(),expire:A,allowHosts:h})}return deepFreeze({issuer:"none",expire:A,allowHosts:h})}var v=String((e=d.certificate)!==null&&e!==void 0?e:"");if(!v)return error_invalid_certificate();var g=new X509;g.readCertPEM(v);var E=String((r=d._signature)!==null&&r!==void 0?r:"");if(!E)return error_invalid_signature();var b=jsonStableNoneNumberStrinfiy(ObjectOmit(d,["_signature"]));return verifyMessage(b,E,g)===!1?error_invalid_signature():m<A.getTime()?h.filter(function(T){return matchDomain(T,f)}).length===0?error_host_not_allowed(f):deepFreeze({issuer:g.getSubjectString(),expire:A,allowHosts:h}):error_date_expired(A)}var scratchMatrix4$1=new THREE__namespace.Matrix4,workRawMapping=new WeakMap,Work=function(){function n(t,e){this.name="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={work:this},this.observers=[],this.issuer="none",this.raw={works:[""],options:""},this.transform=new THREE__namespace.Matrix4;{var r=this;this.options={get transform(){return r.transform},set transform(o){r.transform.copy(o)}}}var i=parse(t,e,this);if(i instanceof Error)throw new Error("[PARSE FAILED]: "+i.message+`
928
+ `),support=typeof Worker!="undefined"&&typeof Blob!="undefined",lzmaWorkerURL="";if(support)try{var blob=new Blob([lzmaWorkerSource],{type:"text/javascript"});lzmaWorkerURL=URL.createObjectURL(blob)}catch(n){}var LZMAWorker=function(){function n(){var t=this;if(!support)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var e=this.worker=new Worker(lzmaWorkerURL);e.onmessage=function(r){var i=r.data,o=i.id,s=i.result,u=i.error,c=t.getKey(o);t.requests[c]&&(u?t.requests[c](new Error(u)):t.requests[c](null,s),delete t.requests[c])},e.onerror=function(r){return console.error(r)}}return n.prototype.getKey=function(t){return"key_"+String(t)},n.prototype.decompress=function(t,e){var r=++this.callCounter;this.requests[this.getKey(r)]=e,this.worker.postMessage({type:"decompress",id:r,data:t},[t.buffer])},n.prototype.terminate=function(){this.worker.terminate()},n.support=support,n}();function readUint32(n){return Array.prototype.reduce.call(n,function(t,e,r){return t|e<<r*8},0)}function binaryArrays(n){for(var t=[],e=n.length,r=function(s){var u={data:n[s],offset:0,readByte:function(){return this.data[this.offset++]}},c=u.data.length,l={data:[],offset:0,writeByte:function(f){var m=Math.floor(this.offset/c);this.data[m]||(this.data[m]=new Uint8Array(c)),this.data[m][this.offset%c]=f,this.offset++}};LZMA.decompressFile(u,l),i=new Uint8Array(l.offset);for(var d=0;d<l.offset;d++)i[d]=l.data[Math.floor(d/c)][d%c];t.push(i)},i,o=0;o<e;o++)r(o);return t}function binaryArraysWithWorker(n){for(var t=[],e=n.length,r=function(o){t.push(new Promise(function(s,u){var c=new LZMAWorker;c.decompress(n[o],function(l,d){if(c.terminate(),l)return u(l);s(d)})}))},i=0;i<e;i++)r(i);return Promise.all(t)}function lzma(n){var t=new Uint8Array(n),e=readUint32(t.slice(0,4));if(e>10)return Promise.reject(new Error("LZMA got too many sub chunks."));for(var r=[],i=[],o=4+e*4,s=0;s<e;s++)i[s]=readUint32(t.slice(4+s*4,8+s*4)),s===e-1?r[s]=t.subarray(o,o+i[s]):r[s]=t.slice(o,o+i[s]),o+=i[s];return LZMAWorker.support?binaryArraysWithWorker(r):Promise.resolve(binaryArrays(r))}var dequeuing=!1,queue=[];function dequeue(n){if(n===void 0&&(n=!1),!(!n&&dequeuing)){dequeuing=!0;var t=queue.shift();if(t){try{t()}catch(e){}AnimationFrameLoop.shared.add(function(){return dequeue(!0)},!0,2,-100)}else dequeuing=!1}}function delay(n){return new Promise(function(t,e){var r=function(){try{t(n())}catch(i){e(i)}};queue.push(r),AnimationFrameLoop.shared.add(function(){return dequeue()},!0,2,-100)})}function pick(n,t){for(var e={},r=0,i=t;r<i.length;r++){var o=i[r];o in n&&(e[o]=n[o])}return e}function omit(n,t){for(var e=__assign({},n),r=0,i=t;r<i.length;r++){var o=i[r];o in e&&delete e[o]}return e}var commonjsGlobal=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},indexMinimal={},minimal$1={},aspromise=asPromise;function asPromise(n,t){for(var e=new Array(arguments.length-1),r=0,i=2,o=!0;i<arguments.length;)e[r++]=arguments[i++];return new Promise(function(u,c){e[r]=function(d){if(o)if(o=!1,d)c(d);else{for(var f=new Array(arguments.length-1),m=0;m<f.length;)f[m++]=arguments[m];u.apply(null,f)}};try{n.apply(t||null,e)}catch(l){o&&(o=!1,c(l))}})}var base64$1={};(function(n){var t=n;t.length=function(u){var c=u.length;if(!c)return 0;for(var l=0;--c%4>1&&u.charAt(c)==="=";)++l;return Math.ceil(u.length*3)/4-l};for(var e=new Array(64),r=new Array(123),i=0;i<64;)r[e[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;t.encode=function(u,c,l){for(var d=null,f=[],m=0,A=0,h;c<l;){var p=u[c++];switch(A){case 0:f[m++]=e[p>>2],h=(p&3)<<4,A=1;break;case 1:f[m++]=e[h|p>>4],h=(p&15)<<2,A=2;break;case 2:f[m++]=e[h|p>>6],f[m++]=e[p&63],A=0;break}m>8191&&((d||(d=[])).push(String.fromCharCode.apply(String,f)),m=0)}return A&&(f[m++]=e[h],f[m++]=61,A===1&&(f[m++]=61)),d?(m&&d.push(String.fromCharCode.apply(String,f.slice(0,m))),d.join("")):String.fromCharCode.apply(String,f.slice(0,m))};var o="invalid encoding";t.decode=function(u,c,l){for(var d=l,f=0,m,A=0;A<u.length;){var h=u.charCodeAt(A++);if(h===61&&f>1)break;if((h=r[h])===void 0)throw Error(o);switch(f){case 0:m=h,f=1;break;case 1:c[l++]=m<<2|(h&48)>>4,m=h,f=2;break;case 2:c[l++]=(m&15)<<4|(h&60)>>2,m=h,f=3;break;case 3:c[l++]=(m&3)<<6|h,f=0;break}}if(f===1)throw Error(o);return l-d},t.test=function(u){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(u)}})(base64$1);var eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(t,e,r){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:r||this}),this},EventEmitter.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var r=this._listeners[t],i=0;i<r.length;)r[i].fn===e?r.splice(i,1):++i;return this},EventEmitter.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var r=[],i=1;i<arguments.length;)r.push(arguments[i++]);for(i=0;i<e.length;)e[i].fn.apply(e[i++].ctx,r)}return this};var float=factory(factory);function factory(n){return typeof Float32Array!="undefined"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),r=e[3]===128;function i(c,l,d){t[0]=c,l[d]=e[0],l[d+1]=e[1],l[d+2]=e[2],l[d+3]=e[3]}function o(c,l,d){t[0]=c,l[d]=e[3],l[d+1]=e[2],l[d+2]=e[1],l[d+3]=e[0]}n.writeFloatLE=r?i:o,n.writeFloatBE=r?o:i;function s(c,l){return e[0]=c[l],e[1]=c[l+1],e[2]=c[l+2],e[3]=c[l+3],t[0]}function u(c,l){return e[3]=c[l],e[2]=c[l+1],e[1]=c[l+2],e[0]=c[l+3],t[0]}n.readFloatLE=r?s:u,n.readFloatBE=r?u:s}():function(){function t(r,i,o,s){var u=i<0?1:0;if(u&&(i=-i),i===0)r(1/i>0?0:2147483648,o,s);else if(isNaN(i))r(2143289344,o,s);else if(i>34028234663852886e22)r((u<<31|2139095040)>>>0,o,s);else if(i<11754943508222875e-54)r((u<<31|Math.round(i/1401298464324817e-60))>>>0,o,s);else{var c=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-c)*8388608)&8388607;r((u<<31|c+127<<23|l)>>>0,o,s)}}n.writeFloatLE=t.bind(null,writeUintLE),n.writeFloatBE=t.bind(null,writeUintBE);function e(r,i,o){var s=r(i,o),u=(s>>31)*2+1,c=s>>>23&255,l=s&8388607;return c===255?l?NaN:u*(1/0):c===0?u*1401298464324817e-60*l:u*Math.pow(2,c-150)*(l+8388608)}n.readFloatLE=e.bind(null,readUintLE),n.readFloatBE=e.bind(null,readUintBE)}(),typeof Float64Array!="undefined"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),r=e[7]===128;function i(c,l,d){t[0]=c,l[d]=e[0],l[d+1]=e[1],l[d+2]=e[2],l[d+3]=e[3],l[d+4]=e[4],l[d+5]=e[5],l[d+6]=e[6],l[d+7]=e[7]}function o(c,l,d){t[0]=c,l[d]=e[7],l[d+1]=e[6],l[d+2]=e[5],l[d+3]=e[4],l[d+4]=e[3],l[d+5]=e[2],l[d+6]=e[1],l[d+7]=e[0]}n.writeDoubleLE=r?i:o,n.writeDoubleBE=r?o:i;function s(c,l){return e[0]=c[l],e[1]=c[l+1],e[2]=c[l+2],e[3]=c[l+3],e[4]=c[l+4],e[5]=c[l+5],e[6]=c[l+6],e[7]=c[l+7],t[0]}function u(c,l){return e[7]=c[l],e[6]=c[l+1],e[5]=c[l+2],e[4]=c[l+3],e[3]=c[l+4],e[2]=c[l+5],e[1]=c[l+6],e[0]=c[l+7],t[0]}n.readDoubleLE=r?s:u,n.readDoubleBE=r?u:s}():function(){function t(r,i,o,s,u,c){var l=s<0?1:0;if(l&&(s=-s),s===0)r(0,u,c+i),r(1/s>0?0:2147483648,u,c+o);else if(isNaN(s))r(0,u,c+i),r(2146959360,u,c+o);else if(s>17976931348623157e292)r(0,u,c+i),r((l<<31|2146435072)>>>0,u,c+o);else{var d;if(s<22250738585072014e-324)d=s/5e-324,r(d>>>0,u,c+i),r((l<<31|d/4294967296)>>>0,u,c+o);else{var f=Math.floor(Math.log(s)/Math.LN2);f===1024&&(f=1023),d=s*Math.pow(2,-f),r(d*4503599627370496>>>0,u,c+i),r((l<<31|f+1023<<20|d*1048576&1048575)>>>0,u,c+o)}}}n.writeDoubleLE=t.bind(null,writeUintLE,0,4),n.writeDoubleBE=t.bind(null,writeUintBE,4,0);function e(r,i,o,s,u){var c=r(s,u+i),l=r(s,u+o),d=(l>>31)*2+1,f=l>>>20&2047,m=4294967296*(l&1048575)+c;return f===2047?m?NaN:d*(1/0):f===0?d*5e-324*m:d*Math.pow(2,f-1075)*(m+4503599627370496)}n.readDoubleLE=e.bind(null,readUintLE,0,4),n.readDoubleBE=e.bind(null,readUintBE,4,0)}(),n}function writeUintLE(n,t,e){t[e]=n&255,t[e+1]=n>>>8&255,t[e+2]=n>>>16&255,t[e+3]=n>>>24}function writeUintBE(n,t,e){t[e]=n>>>24,t[e+1]=n>>>16&255,t[e+2]=n>>>8&255,t[e+3]=n&255}function readUintLE(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0}function readUintBE(n,t){return(n[t]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3])>>>0}var inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(n){}return null}var utf8$2={};(function(n){var t=n;t.length=function(r){for(var i=0,o=0,s=0;s<r.length;++s)o=r.charCodeAt(s),o<128?i+=1:o<2048?i+=2:(o&64512)===55296&&(r.charCodeAt(s+1)&64512)===56320?(++s,i+=4):i+=3;return i},t.read=function(r,i,o){var s=o-i;if(s<1)return"";for(var u=null,c=[],l=0,d;i<o;)d=r[i++],d<128?c[l++]=d:d>191&&d<224?c[l++]=(d&31)<<6|r[i++]&63:d>239&&d<365?(d=((d&7)<<18|(r[i++]&63)<<12|(r[i++]&63)<<6|r[i++]&63)-65536,c[l++]=55296+(d>>10),c[l++]=56320+(d&1023)):c[l++]=(d&15)<<12|(r[i++]&63)<<6|r[i++]&63,l>8191&&((u||(u=[])).push(String.fromCharCode.apply(String,c)),l=0);return u?(l&&u.push(String.fromCharCode.apply(String,c.slice(0,l))),u.join("")):String.fromCharCode.apply(String,c.slice(0,l))},t.write=function(r,i,o){for(var s=o,u,c,l=0;l<r.length;++l)u=r.charCodeAt(l),u<128?i[o++]=u:u<2048?(i[o++]=u>>6|192,i[o++]=u&63|128):(u&64512)===55296&&((c=r.charCodeAt(l+1))&64512)===56320?(u=65536+((u&1023)<<10)+(c&1023),++l,i[o++]=u>>18|240,i[o++]=u>>12&63|128,i[o++]=u>>6&63|128,i[o++]=u&63|128):(i[o++]=u>>12|224,i[o++]=u>>6&63|128,i[o++]=u&63|128);return o-s}})(utf8$2);var pool_1=pool;function pool(n,t,e){var r=e||8192,i=r>>>1,o=null,s=r;return function(c){if(c<1||c>i)return n(c);s+c>r&&(o=n(r),s=0);var l=t.call(o,s,s+=c);return s&7&&(s=(s|7)+1),l}}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var n=requireMinimal();function t(o,s){this.lo=o>>>0,this.hi=s>>>0}var e=t.zero=new t(0,0);e.toNumber=function(){return 0},e.zzEncode=e.zzDecode=function(){return this},e.length=function(){return 1};var r=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(s){if(s===0)return e;var u=s<0;u&&(s=-s);var c=s>>>0,l=(s-c)/4294967296>>>0;return u&&(l=~l>>>0,c=~c>>>0,++c>4294967295&&(c=0,++l>4294967295&&(l=0))),new t(c,l)},t.from=function(s){if(typeof s=="number")return t.fromNumber(s);if(n.isString(s))if(n.Long)s=n.Long.fromString(s);else return t.fromNumber(parseInt(s,10));return s.low||s.high?new t(s.low>>>0,s.high>>>0):e},t.prototype.toNumber=function(s){if(!s&&this.hi>>>31){var u=~this.lo+1>>>0,c=~this.hi>>>0;return u||(c=c+1>>>0),-(u+c*4294967296)}return this.lo+this.hi*4294967296},t.prototype.toLong=function(s){return n.Long?new n.Long(this.lo|0,this.hi|0,!!s):{low:this.lo|0,high:this.hi|0,unsigned:!!s}};var i=String.prototype.charCodeAt;return t.fromHash=function(s){return s===r?e:new t((i.call(s,0)|i.call(s,1)<<8|i.call(s,2)<<16|i.call(s,3)<<24)>>>0,(i.call(s,4)|i.call(s,5)<<8|i.call(s,6)<<16|i.call(s,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var s=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^s)>>>0,this.lo=(this.lo<<1^s)>>>0,this},t.prototype.zzDecode=function(){var s=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^s)>>>0,this.hi=(this.hi>>>1^s)>>>0,this},t.prototype.length=function(){var s=this.lo,u=(this.lo>>>28|this.hi<<4)>>>0,c=this.hi>>>24;return c===0?u===0?s<16384?s<128?1:2:s<2097152?3:4:u<16384?u<128?5:6:u<2097152?7:8:c<128?9:10},longbits}var hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(n){var t=n;t.asPromise=aspromise,t.base64=base64$1,t.EventEmitter=eventemitter,t.float=float,t.inquire=inquire_1,t.utf8=utf8$2,t.pool=pool_1,t.LongBits=requireLongbits(),t.isNode=!!(typeof commonjsGlobal!="undefined"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),t.global=t.isNode&&commonjsGlobal||typeof window!="undefined"&&window||typeof self!="undefined"&&self||commonjsGlobal,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(o){return typeof o=="number"&&isFinite(o)&&Math.floor(o)===o},t.isString=function(o){return typeof o=="string"||o instanceof String},t.isObject=function(o){return o&&typeof o=="object"},t.isset=t.isSet=function(o,s){var u=o[s];return u!=null&&o.hasOwnProperty(s)?typeof u!="object"||(Array.isArray(u)?u.length:Object.keys(u).length)>0:!1},t.Buffer=function(){try{var i=t.inquire("buffer").Buffer;return i.prototype.utf8Write?i:null}catch(o){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(o){return typeof o=="number"?t.Buffer?t._Buffer_allocUnsafe(o):new t.Array(o):t.Buffer?t._Buffer_from(o):typeof Uint8Array=="undefined"?o:new Uint8Array(o)},t.Array=typeof Uint8Array!="undefined"?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(o){return o?t.LongBits.from(o).toHash():t.LongBits.zeroHash},t.longFromHash=function(o,s){var u=t.LongBits.fromHash(o);return t.Long?t.Long.fromBits(u.lo,u.hi,s):u.toNumber(!!s)};function e(i,o,s){for(var u=Object.keys(o),c=0;c<u.length;++c)(i[u[c]]===void 0||!s)&&(i[u[c]]=o[u[c]]);return i}t.merge=e,t.lcFirst=function(o){return o.charAt(0).toLowerCase()+o.substring(1)};function r(i){function o(s,u){if(!(this instanceof o))return new o(s,u);Object.defineProperty(this,"message",{get:function(){return s}}),Error.captureStackTrace?Error.captureStackTrace(this,o):Object.defineProperty(this,"stack",{value:new Error().stack||""}),u&&e(this,u)}return o.prototype=Object.create(Error.prototype,{constructor:{value:o,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return i},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),o}t.newError=r,t.ProtocolError=r("ProtocolError"),t.oneOfGetter=function(o){for(var s={},u=0;u<o.length;++u)s[o[u]]=1;return function(){for(var c=Object.keys(this),l=c.length-1;l>-1;--l)if(s[c[l]]===1&&this[c[l]]!==void 0&&this[c[l]]!==null)return c[l]}},t.oneOfSetter=function(o){return function(s){for(var u=0;u<o.length;++u)o[u]!==s&&delete this[o[u]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var i=t.Buffer;if(!i){t._Buffer_from=t._Buffer_allocUnsafe=null;return}t._Buffer_from=i.from!==Uint8Array.from&&i.from||function(s,u){return new i(s,u)},t._Buffer_allocUnsafe=i.allocUnsafe||function(s){return new i(s)}}}(minimal$1)),minimal$1}var writer=Writer$1,util$4=requireMinimal(),BufferWriter$1,LongBits$1=util$4.LongBits,base64=util$4.base64,utf8$1=util$4.utf8;function Op(n,t,e){this.fn=n,this.len=t,this.next=void 0,this.val=e}function noop(){}function State(n){this.head=n.head,this.tail=n.tail,this.len=n.len,this.next=n.states}function Writer$1(){this.len=0,this.head=new Op(noop,0,0),this.tail=this.head,this.states=null}var create$1=function n(){return util$4.Buffer?function(){return(Writer$1.create=function(){return new BufferWriter$1})()}:function(){return new Writer$1}};Writer$1.create=create$1(),Writer$1.alloc=function n(t){return new util$4.Array(t)},util$4.Array!==Array&&(Writer$1.alloc=util$4.pool(Writer$1.alloc,util$4.Array.prototype.subarray)),Writer$1.prototype._push=function n(t,e,r){return this.tail=this.tail.next=new Op(t,e,r),this.len+=e,this};function writeByte(n,t,e){t[e]=n&255}function writeVarint32(n,t,e){for(;n>127;)t[e++]=n&127|128,n>>>=7;t[e]=n}function VarintOp(n,t){this.len=n,this.next=void 0,this.val=t}VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer$1.prototype.uint32=function n(t){return this.len+=(this.tail=this.tail.next=new VarintOp((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},Writer$1.prototype.int32=function n(t){return t<0?this._push(writeVarint64,10,LongBits$1.fromNumber(t)):this.uint32(t)},Writer$1.prototype.sint32=function n(t){return this.uint32((t<<1^t>>31)>>>0)};function writeVarint64(n,t,e){for(;n.hi;)t[e++]=n.lo&127|128,n.lo=(n.lo>>>7|n.hi<<25)>>>0,n.hi>>>=7;for(;n.lo>127;)t[e++]=n.lo&127|128,n.lo=n.lo>>>7;t[e++]=n.lo}Writer$1.prototype.uint64=function n(t){var e=LongBits$1.from(t);return this._push(writeVarint64,e.length(),e)},Writer$1.prototype.int64=Writer$1.prototype.uint64,Writer$1.prototype.sint64=function n(t){var e=LongBits$1.from(t).zzEncode();return this._push(writeVarint64,e.length(),e)},Writer$1.prototype.bool=function n(t){return this._push(writeByte,1,t?1:0)};function writeFixed32(n,t,e){t[e]=n&255,t[e+1]=n>>>8&255,t[e+2]=n>>>16&255,t[e+3]=n>>>24}Writer$1.prototype.fixed32=function n(t){return this._push(writeFixed32,4,t>>>0)},Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32,Writer$1.prototype.fixed64=function n(t){var e=LongBits$1.from(t);return this._push(writeFixed32,4,e.lo)._push(writeFixed32,4,e.hi)},Writer$1.prototype.sfixed64=Writer$1.prototype.fixed64,Writer$1.prototype.float=function n(t){return this._push(util$4.float.writeFloatLE,4,t)},Writer$1.prototype.double=function n(t){return this._push(util$4.float.writeDoubleLE,8,t)};var writeBytes=util$4.Array.prototype.set?function n(t,e,r){e.set(t,r)}:function n(t,e,r){for(var i=0;i<t.length;++i)e[r+i]=t[i]};Writer$1.prototype.bytes=function n(t){var e=t.length>>>0;if(!e)return this._push(writeByte,1,0);if(util$4.isString(t)){var r=Writer$1.alloc(e=base64.length(t));base64.decode(t,r,0),t=r}return this.uint32(e)._push(writeBytes,e,t)},Writer$1.prototype.string=function n(t){var e=utf8$1.length(t);return e?this.uint32(e)._push(utf8$1.write,e,t):this._push(writeByte,1,0)},Writer$1.prototype.fork=function n(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer$1.prototype.reset=function n(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer$1.prototype.ldelim=function n(){var t=this.head,e=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=t.next,this.tail=e,this.len+=r),this},Writer$1.prototype.finish=function n(){for(var t=this.head.next,e=this.constructor.alloc(this.len),r=0;t;)t.fn(t.val,e,r),r+=t.len,t=t.next;return e},Writer$1._configure=function(n){BufferWriter$1=n,Writer$1.create=create$1(),BufferWriter$1._configure()};var writer_buffer=BufferWriter,Writer=writer;(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util$3=requireMinimal();function BufferWriter(){Writer.call(this)}BufferWriter._configure=function(){BufferWriter.alloc=util$3._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util$3.Buffer&&util$3.Buffer.prototype instanceof Uint8Array&&util$3.Buffer.prototype.set.name==="set"?function(t,e,r){e.set(t,r)}:function(t,e,r){if(t.copy)t.copy(e,r,0,t.length);else for(var i=0;i<t.length;)e[r++]=t[i++]}},BufferWriter.prototype.bytes=function n(t){util$3.isString(t)&&(t=util$3._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(BufferWriter.writeBytesBuffer,e,t),this};function writeStringBuffer(n,t,e){n.length<40?util$3.utf8.write(n,t,e):t.utf8Write?t.utf8Write(n,e):t.write(n,e)}BufferWriter.prototype.string=function n(t){var e=util$3.Buffer.byteLength(t);return this.uint32(e),e&&this._push(writeStringBuffer,e,t),this},BufferWriter._configure();var reader=Reader$1,util$2=requireMinimal(),BufferReader$1,LongBits=util$2.LongBits,utf8=util$2.utf8;function indexOutOfRange(n,t){return RangeError("index out of range: "+n.pos+" + "+(t||1)+" > "+n.len)}function Reader$1(n){this.buf=n,this.pos=0,this.len=n.length}var create_array=typeof Uint8Array!="undefined"?function n(t){if(t instanceof Uint8Array||Array.isArray(t))return new Reader$1(t);throw Error("illegal buffer")}:function n(t){if(Array.isArray(t))return new Reader$1(t);throw Error("illegal buffer")},create=function n(){return util$2.Buffer?function(e){return(Reader$1.create=function(i){return util$2.Buffer.isBuffer(i)?new BufferReader$1(i):create_array(i)})(e)}:create_array};Reader$1.create=create(),Reader$1.prototype._slice=util$2.Array.prototype.subarray||util$2.Array.prototype.slice,Reader$1.prototype.uint32=function n(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return t}}(),Reader$1.prototype.int32=function n(){return this.uint32()|0},Reader$1.prototype.sint32=function n(){var t=this.uint32();return t>>>1^-(t&1)|0};function readLongVarint(){var n=new LongBits(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(n.lo=(n.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return n;if(n.lo=(n.lo|(this.buf[this.pos]&127)<<28)>>>0,n.hi=(n.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return n;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(n.lo=(n.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return n}return n.lo=(n.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,n}if(this.len-this.pos>4){for(;t<5;++t)if(n.hi=(n.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return n}else for(;t<5;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(n.hi=(n.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return n}throw Error("invalid varint encoding")}Reader$1.prototype.bool=function n(){return this.uint32()!==0};function readFixed32_end(n,t){return(n[t-4]|n[t-3]<<8|n[t-2]<<16|n[t-1]<<24)>>>0}Reader$1.prototype.fixed32=function n(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader$1.prototype.sfixed32=function n(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)|0};function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader$1.prototype.float=function n(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var t=util$2.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},Reader$1.prototype.double=function n(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var t=util$2.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},Reader$1.prototype.bytes=function n(){var t=this.uint32(),e=this.pos,r=this.pos+t;if(r>this.len)throw indexOutOfRange(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(e,r);if(e===r){var i=util$2.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,e,r)},Reader$1.prototype.string=function n(){var t=this.bytes();return utf8.read(t,0,t.length)},Reader$1.prototype.skip=function n(t){if(typeof t=="number"){if(this.pos+t>this.len)throw indexOutOfRange(this,t);this.pos+=t}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this},Reader$1.prototype.skipType=function(n){switch(n){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(n=this.uint32()&7)!==4;)this.skipType(n);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+n+" at offset "+this.pos)}return this},Reader$1._configure=function(n){BufferReader$1=n,Reader$1.create=create(),BufferReader$1._configure();var t=util$2.Long?"toLong":"toNumber";util$2.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[t](!1)},uint64:function(){return readLongVarint.call(this)[t](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[t](!1)},fixed64:function(){return readFixed64.call(this)[t](!0)},sfixed64:function(){return readFixed64.call(this)[t](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$1=requireMinimal();function BufferReader(n){Reader.call(this,n)}BufferReader._configure=function(){util$1.Buffer&&(BufferReader.prototype._slice=util$1.Buffer.prototype.slice)},BufferReader.prototype.string=function n(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},BufferReader._configure();var rpc={},service=Service,util=requireMinimal();(Service.prototype=Object.create(util.EventEmitter.prototype)).constructor=Service;function Service(n,t,e){if(typeof n!="function")throw TypeError("rpcImpl must be a function");util.EventEmitter.call(this),this.rpcImpl=n,this.requestDelimited=!!t,this.responseDelimited=!!e}Service.prototype.rpcCall=function n(t,e,r,i,o){if(!i)throw TypeError("request must be specified");var s=this;if(!o)return util.asPromise(n,s,t,e,r,i);if(!s.rpcImpl){setTimeout(function(){o(Error("already ended"))},0);return}try{return s.rpcImpl(t,e[s.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(c,l){if(c)return s.emit("error",c,t),o(c);if(l===null){s.end(!0);return}if(!(l instanceof r))try{l=r[s.responseDelimited?"decodeDelimited":"decode"](l)}catch(d){return s.emit("error",d,t),o(d)}return s.emit("data",l,t),o(null,l)})}catch(u){s.emit("error",u,t),setTimeout(function(){o(u)},0);return}},Service.prototype.end=function n(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},function(n){var t=n;t.Service=service}(rpc);var roots={};(function(n){var t=n;t.build="minimal",t.Writer=writer,t.BufferWriter=writer_buffer,t.Reader=reader,t.BufferReader=reader_buffer,t.util=requireMinimal(),t.rpc=rpc,t.roots=roots,t.configure=e;function e(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}e()})(indexMinimal);var minimal=indexMinimal;const $Reader$1=minimal.Reader,$util$1=minimal.util,$root$1=minimal.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]||(minimal.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]={}),Model$2=$root$1.Model=(()=>{function n(t){if(this.chunks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.chunks=$util$1.emptyArray,n.prototype.createAt=$util$1.Long?$util$1.Long.fromBits(0,0,!0):0,n.prototype.description="",n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root$1.Model;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.chunks&&o.chunks.length||(o.chunks=[]),o.chunks.push($root$1.Chunk.decode(e,e.uint32()));break}case 2:{o.createAt=e.uint64();break}case 3:{o.description=e.string();break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Model"},n})();$root$1.Chunk=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.vertices=null,n.prototype.faces=null,n.prototype.name="",n.prototype.texture="",n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root$1.Chunk;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.vertices=$root$1.Vertices.decode(e,e.uint32());break}case 2:{o.faces=$root$1.Faces.decode(e,e.uint32());break}case 3:{o.name=e.string();break}case 4:{o.texture=e.string();break}default:e.skipType(s&7);break}}if(!o.hasOwnProperty("vertices"))throw $util$1.ProtocolError("missing required 'vertices'",{instance:o});if(!o.hasOwnProperty("faces"))throw $util$1.ProtocolError("missing required 'faces'",{instance:o});if(!o.hasOwnProperty("name"))throw $util$1.ProtocolError("missing required 'name'",{instance:o});return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Chunk"},n})(),$root$1.Vertices=(()=>{function n(t){if(this.xyz=[],this.uvs=[],this.marks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.xyz=$util$1.emptyArray,n.prototype.uvs=$util$1.emptyArray,n.prototype.marks=$util$1.emptyArray,n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root$1.Vertices;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.xyz&&o.xyz.length||(o.xyz=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.xyz.push(e.float())}else o.xyz.push(e.float());break}case 2:{if(o.uvs&&o.uvs.length||(o.uvs=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.uvs.push(e.float())}else o.uvs.push(e.float());break}case 3:{if(o.marks&&o.marks.length||(o.marks=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.marks.push(e.int32())}else o.marks.push(e.int32());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Vertices"},n})(),$root$1.Faces=(()=>{function n(t){if(this.indices=[],this.normals=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.indices=$util$1.emptyArray,n.prototype.normals=$util$1.emptyArray,n.decode=function(e,r){e instanceof $Reader$1||(e=$Reader$1.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root$1.Faces;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.indices&&o.indices.length||(o.indices=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.indices.push(e.uint32())}else o.indices.push(e.uint32());break}case 2:{if(o.normals&&o.normals.length||(o.normals=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.normals.push(e.float())}else o.normals.push(e.float());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Faces"},n})(),$root$1.VertexMark=(()=>{const n={},t=Object.create(n);return t[n[0]="VERTEX_MARK_UNSPECIFIED"]=0,t[n[1]="VERTEX_MARK_ROOF"]=1,t})();function loadPbm(n,t){var e,r,i,o={byteLength:0},s=autoRestImageOptionsByTextureLength((e=t.textureOptions)!==null&&e!==void 0?e:{},(i=(r=t.textureArray)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0),u={};if(t.textureArray)for(var c=0,l=t.textureArray;c<l.length;c++){var d=l[c];u[d]=loadTexture$1(d,s,t.fetcher)}return Promise.resolve().then(function(){return t.fetcher.ajax(n,{responseType:"arraybuffer"})}).then(function(f){return o.byteLength=f.body.byteLength,delay(function(){var m=new Uint8Array(f.body);return Model$2.decode(m)})}).then(function(f){return delay(function(){var m,A;return parse$2(f,(m=t.textureBaseUri)!==null&&m!==void 0?m:function(){var h=n.lastIndexOf("/");if(h>=0){var p=n.slice(0,h)+"/";return/\/model\/$/.test(p)&&(p=p.replace(/\/model\/$/,"/materials/")),p}return""}(),((A=t.textureArray)!==null&&A!==void 0?A:[]).slice(),s,u,t.fetcher)})}).then(function(f){var m=new THREE__namespace.Group;m.matrixAutoUpdate=!1,m.matrix.compose(m.position,m.quaternion,m.scale),m.name=n;for(var A=0,h=f.objects;A<h.length;A++){var p=h[A];m.add(p)}return{type:"pbm",uri:n,byteLength:o.byteLength,scene:m,textures:f.textures,dispose:function(){return f.dispose()}}})}function parseFloorName(n){var t=n.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function parseChunkName(n){var t=n.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function parseSubName(n){var t=n.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}function chunkOrder(n){var t=parseFloorName(n.name),e=parseChunkName(n.name),r=parseSubName(n.name);return t*1e6+e*1e3+r}function parsePBMModel(n){for(var t,e,r,i=typeof n.createAt=="number"?n.createAt:0,o=(t=n.description)!==null&&t!==void 0?t:"",s=[],u=!0,c=!0,l=0,d=n.chunks;l<d.length;l++){var f=d[l];if(!f.vertices.marks||f.vertices.marks.length===0){c=!1;break}}for(var m=0,A=n.chunks;m<A.length;m++){var f=A[m];if(!f.faces.normals||f.faces.normals.length===0){u=!1;break}}for(var h=n.chunks.sort(function(ie,se){return chunkOrder(ie)-chunkOrder(se)}),p=[],y=0,v=h;y<v.length;y++){var f=v[y],g=parseFloorName(f.name);p[g]||(p[g]=[]),p[g].push(f)}for(var E=0;E<p.length;E++){var b=p[E];if(b)if(u){for(var T=0,x=0;x<b.length;x++){var f=b[x];T+=f.faces.indices.length}for(var R=new Float32Array(T*3),_=new Float32Array(T*2),M=new Float32Array(T*3),S=c?new Float32Array(T):void 0,I=[],C=[1/0,1/0,1/0,-1/0,-1/0,-1/0],H=0,B=0;B<b.length;B++){for(var L=[1/0,1/0,1/0,-1/0,-1/0,-1/0],f=b[B],O=f.vertices.xyz,k=f.vertices.uvs,G=f.faces.indices,z=f.faces.normals,D=f.vertices.marks,U=G.length,x=0;x<U;x++){var K=G[x],Q=R[H*3+x*3]=O[K*3],q=R[H*3+x*3+1]=O[K*3+1],J=R[H*3+x*3+2]=O[K*3+2];S&&(S[H+x]=D[K]),_[H*2+x*2]=k[K*2],_[H*2+x*2+1]=k[K*2+1];var j=Math.floor(x/3)*3;M[H*3+x*3]=z[j],M[H*3+x*3+1]=z[j+1],M[H*3+x*3+2]=z[j+2],Q<L[0]&&(L[0]=Q),q<L[1]&&(L[1]=q),J<L[2]&&(L[2]=J),Q>L[3]&&(L[3]=Q),q>L[4]&&(L[4]=q),J>L[5]&&(L[5]=J)}L[0]<C[0]&&(C[0]=L[0]),L[1]<C[1]&&(C[1]=L[1]),L[2]<C[2]&&(C[2]=L[2]),L[3]>C[3]&&(C[3]=L[3]),L[4]>C[4]&&(C[4]=L[4]),L[5]>C[5]&&(C[5]=L[5]),I.push({materialIndex:B,name:f.name,chunkName:parseChunkName(f.name),start:H,count:f.faces.indices.length,texture:(e=f.texture)!==null&&e!==void 0?e:void 0}),H+=U}var re={createAt:i,description:o,vertices:R,uvs:_,normals:M,masks:S,indices:null,floorIndex:E,groups:I,extents:C};s.push(re)}else{for(var T=0,W=0,x=0;x<b.length;x++){var f=b[x];W+=f.vertices.xyz.length/3,T+=f.faces.indices.length}for(var R=new Float32Array(W*3),_=new Float32Array(W*2),M=void 0,te=new Float32Array(W),$=new Uint32Array(T),S=c?new Float32Array(T):void 0,I=[],C=[1/0,1/0,1/0,-1/0,-1/0,-1/0],ne=0,H=0,B=0;B<b.length;B++){for(var L=[1/0,1/0,1/0,-1/0,-1/0,-1/0],f=b[B],O=f.vertices.xyz,ee=f.vertices.marks,k=f.vertices.uvs,G=f.faces.indices,fe=O.length/3,U=G.length,x=0;x<fe;x++){var Q=R[H*3+x*3]=O[x*3],q=R[H*3+x*3+1]=O[x*3+1],J=R[H*3+x*3+2]=O[x*3+2];S&&(S[H+x]=ee[x]),_[H*2+x*2]=k[x*2],_[H*2+x*2+1]=k[x*2+1],te[H+x]=E,Q<L[0]&&(L[0]=Q),q<L[1]&&(L[1]=q),J<L[2]&&(L[2]=J),Q>L[3]&&(L[3]=Q),q>L[4]&&(L[4]=q),J>L[5]&&(L[5]=J)}L[0]<C[0]&&(C[0]=L[0]),L[1]<C[1]&&(C[1]=L[1]),L[2]<C[2]&&(C[2]=L[2]),L[3]>C[3]&&(C[3]=L[3]),L[4]>C[4]&&(C[4]=L[4]),L[5]>C[5]&&(C[5]=L[5]);for(var x=0;x<U;x++)$[ne+x]=H+G[x];I.push({materialIndex:B,name:f.name,chunkName:parseChunkName(f.name),start:ne,count:f.faces.indices.length,texture:(r=f.texture)!==null&&r!==void 0?r:void 0}),H+=fe,ne+=U}var re={createAt:i,description:o,vertices:R,uvs:_,normals:M,masks:S,indices:$,floorIndex:E,groups:I,extents:C};s.push(re)}}return s}function loadTexture$1(n,t,e){var r=__assign({key:"texture.pbm"},pick(t,["format","quality","size","sharpen","mappings"])),i=new TextureLoader,o=i.loadTexture(n,{imageURL:{transform:t.transform,options:r},encoding:THREE__namespace.sRGBEncoding,wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping,minFilter:THREE__namespace.LinearFilter,maxSize:typeof r.size=="number"?new THREE__namespace.Vector2(r.size,r.size):void 0,fetcher:e}).then(function(s){var u=s.body;return u.needsUpdate=!0,u});return Object.assign(o,{url:n,textureOptions:t})}function parse$2(n,t,e,r,i,o){i===void 0&&(i={});for(var s=parsePBMModel(n),u=0,c="",l=[],d={},f=new Set,m=0,A=s;m<A.length;m++){var h=A[m],p=h.createAt,y=h.description,v=h.vertices,g=h.masks,E=h.uvs,b=h.normals,T=h.indices,x=h.floorIndex,R=h.groups,_=h.extents,M=new THREE__namespace.Box3;M.min.x=_[0],M.min.y=_[1],M.min.z=_[2],M.max.x=_[3],M.max.y=_[4],M.max.z=_[5];var S=new THREE__namespace.BufferGeometry;S.setAttribute("position",new THREE__namespace.BufferAttribute(v,3)),S.setAttribute("uv",new THREE__namespace.BufferAttribute(E,2)),b&&S.setAttribute("normal",new THREE__namespace.BufferAttribute(b,3)),g&&S.setAttribute("mask",new THREE__namespace.BufferAttribute(g,1)),T&&S.setIndex(new THREE__namespace.BufferAttribute(T,1)),S.boundingBox=M,S.boundingSphere=M.getBoundingSphere(new THREE__namespace.Sphere);for(var I=0,C=R;I<C.length;I++){var H=C[I];S.addGroup(H.start,H.count,H.materialIndex)}f.add(S);for(var B=[],L=0,O=R;L<O.length;L++){var H=O[L],k=e[H.chunkName]||(H.texture?pathJoin(t||"",H.texture):void 0),G=new PBMMeshMaterial("basic");G.defines.USE_VERTEX_FLOOR=!1,G.floor=x,S.attributes.normal===void 0&&(G.flatShading=!0),S.attributes.mask&&(G.defines.USE_VERTEX_MARK=!0),B.push(G),k?d[k]?d[k].push(G):d[k]=[G]:G.color=new THREE__namespace.Color(16777215),f.add(G)}var z=new PBMMesh(S,B);z.name="model_floor_"+x,z.userData.createAt=p,z.userData.description=y,z.matrix.compose(z.position,z.quaternion,z.scale),z.matrixAutoUpdate=!1,z.frustumCulled=!1,u=p,c=y,l.push(z)}var D=function(U){U=autoRestImageOptionsByTextureLength(U,e.length);for(var K=[],Q=function(re){var W=null;re in i&&(W=i[re]),W||(W=loadTexture$1(re,U,o)),K.push(W.then(function(te){for(var $=0,ne=d[re];$<ne.length;$++){var ee=ne[$];ee.map&&(f.delete(ee.map),ee.map.dispose()),ee.map=te,f.add(te)}return te}).catch(function(){for(var te=0,$=d[re];te<$.length;te++){var ne=$[te];ne.map&&(f.delete(ne.map),ne.map.dispose()),ne.map=null,ne.color=new THREE__namespace.Color(16777215)}return null}))},q=0,J=Object.keys(d);q<J.length;q++){var j=J[q];Q(j)}for(var j in i)delete i[j];return Promise.all(K).then(function(re){return re.filter(function(W){return W})})};return D(r).then(function(U){return{createAt:u,description:c,objects:l,textures:U,dispose:function(){f.forEach(function(K){K.dispose()}),f.clear()}}})}function autoRestImageOptionsByTextureLength(n,t){return n=Object.assign({},n),n.autoResize!==!1&&(t>96?n.size=Math.min(n.size||1/0,100):t>48?n.size=Math.min(n.size||1/0,200):t>24?n.size=Math.min(n.size||1/0,400):t>22?n.size=Math.min(n.size||1/0,800):t>5&&(n.size=Math.min(n.size||1/0,1024))),n}function loadAt3d(n,t){var e,r,i,o={byteLength:0},s=autoRestImageOptionsByTextureLength((e=t.textureOptions)!==null&&e!==void 0?e:{},(i=(r=t.textureArray)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0),u={};if(t.textureArray)for(var c=0,l=t.textureArray;c<l.length;c++){var d=l[c];u[d]=loadTexture$1(d,s,t.fetcher)}return Promise.resolve().then(function(){return t.fetcher.ajax(n,{responseType:"arraybuffer"})}).then(function(f){return lzma(f.body)}).then(function(f){return delay(function(){for(var m,A={chunks:[],createAt:void 0,description:void 0},h=0,p=f;h<p.length;h++){var y=p[h],v=Model$2.decode(y);v.chunks.length&&((m=A.chunks).push.apply(m,v.chunks),A.createAt=v.createAt,A.description=v.description)}return A})}).then(function(f){return delay(function(){var m,A,h;return parse$2(f,(m=t.textureBaseUri)!==null&&m!==void 0?m:function(){var p=n.lastIndexOf("/");if(p>=0){var y=n.slice(0,p)+"/";return/\/model\/$/.test(y)&&(y=y.replace(/\/model\/$/,"/materials/")),y}return""}(),((A=t.textureArray)!==null&&A!==void 0?A:[]).slice(),(h=t.textureOptions)!==null&&h!==void 0?h:{},u,t.fetcher)})}).then(function(f){var m=new THREE__namespace.Group;m.name=n;for(var A=0,h=f.objects;A<h.length;A++){var p=h[A];m.add(p)}return{type:"at3d",uri:n,byteLength:o.byteLength,scene:m,textures:f.textures,dispose:function(){return f.dispose()}}})}const $Reader=minimal.Reader,$util=minimal.util,$root=minimal.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]||(minimal.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]={}),Model$1=$root.Model=(()=>{function n(t){if(this.meshes=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.meshes=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Model;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.meshes&&o.meshes.length||(o.meshes=[]),o.meshes.push($root.Mesh.decode(e,e.uint32()));break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Model"},n})();$root.Mesh=(()=>{function n(t){if(this.chunks=[],this.matrix=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.name="",n.prototype.chunks=$util.emptyArray,n.prototype.matrix=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Mesh;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.name=e.string();break}case 2:{o.chunks&&o.chunks.length||(o.chunks=[]),o.chunks.push($root.Chunk.decode(e,e.uint32()));break}case 3:{o.matrix&&o.matrix.length||(o.matrix=[]),o.matrix.push($root.Matrix.decode(e,e.uint32()));break}default:e.skipType(s&7);break}}if(!o.hasOwnProperty("name"))throw $util.ProtocolError("missing required 'name'",{instance:o});return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Mesh"},n})(),$root.Matrix=(()=>{function n(t){if(this.elements=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.elements=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Matrix;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.elements&&o.elements.length||(o.elements=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.elements.push(e.float())}else o.elements.push(e.float());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Matrix"},n})(),$root.Chunk=(()=>{function n(t){if(this.material=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.geometry=null,n.prototype.material=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Chunk;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 2:{o.geometry=$root.Geometry.decode(e,e.uint32());break}case 3:{o.material&&o.material.length||(o.material=[]),o.material.push($root.Material.decode(e,e.uint32()));break}default:e.skipType(s&7);break}}if(!o.hasOwnProperty("geometry"))throw $util.ProtocolError("missing required 'geometry'",{instance:o});return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Chunk"},n})(),$root.Geometry=(()=>{function n(t){if(this.groups=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.position=null,n.prototype.uv=null,n.prototype.uv2=null,n.prototype.normal=null,n.prototype.groups=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Geometry;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.position=$root.Position.decode(e,e.uint32());break}case 2:{o.uv=$root.UV.decode(e,e.uint32());break}case 3:{o.uv2=$root.UV.decode(e,e.uint32());break}case 4:{o.normal=$root.Normal.decode(e,e.uint32());break}case 5:{o.groups&&o.groups.length||(o.groups=[]),o.groups.push($root.Group.decode(e,e.uint32()));break}default:e.skipType(s&7);break}}if(!o.hasOwnProperty("position"))throw $util.ProtocolError("missing required 'position'",{instance:o});if(!o.hasOwnProperty("normal"))throw $util.ProtocolError("missing required 'normal'",{instance:o});return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Geometry"},n})(),$root.Position=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Position;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.array&&o.array.length||(o.array=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.array.push(e.float())}else o.array.push(e.float());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Position"},n})(),$root.UV=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.UV;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.array&&o.array.length||(o.array=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.array.push(e.float())}else o.array.push(e.float());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/UV"},n})(),$root.Normal=(()=>{function n(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.array=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Normal;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.array&&o.array.length||(o.array=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.array.push(e.float())}else o.array.push(e.float());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Normal"},n})(),$root.Group=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.start=0,n.prototype.count=0,n.prototype.materialIndex=0,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Group;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.start=e.uint32();break}case 2:{o.count=e.uint32();break}case 3:{o.materialIndex=e.uint32();break}default:e.skipType(s&7);break}}if(!o.hasOwnProperty("start"))throw $util.ProtocolError("missing required 'start'",{instance:o});if(!o.hasOwnProperty("count"))throw $util.ProtocolError("missing required 'count'",{instance:o});if(!o.hasOwnProperty("materialIndex"))throw $util.ProtocolError("missing required 'materialIndex'",{instance:o});return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Group"},n})(),$root.Material=(()=>{function n(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.kd=null,n.prototype.ks=null,n.prototype.ke=null,n.prototype.mapkd="",n.prototype.mapks="",n.prototype.mapke="",n.prototype.norm="",n.prototype.mapbump="",n.prototype.bump="",n.prototype.mapd="",n.prototype.ns=0,n.prototype.d=0,n.prototype.tr=0,n.prototype.mapkdrepeat="",n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Material;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{o.kd=$root.Color.decode(e,e.uint32());break}case 2:{o.ks=$root.Color.decode(e,e.uint32());break}case 3:{o.ke=$root.Color.decode(e,e.uint32());break}case 4:{o.mapkd=e.string();break}case 5:{o.mapks=e.string();break}case 6:{o.mapke=e.string();break}case 7:{o.norm=e.string();break}case 8:{o.mapbump=e.string();break}case 9:{o.bump=e.string();break}case 10:{o.mapd=e.string();break}case 11:{o.ns=e.float();break}case 12:{o.d=e.float();break}case 13:{o.tr=e.float();break}case 14:{o.mapkdrepeat=e.string();break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Material"},n})(),$root.Color=(()=>{function n(t){if(this.rgb=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return n.prototype.rgb=$util.emptyArray,n.decode=function(e,r){e instanceof $Reader||(e=$Reader.create(e));let i=r===void 0?e.len:e.pos+r,o=new $root.Color;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:{if(o.rgb&&o.rgb.length||(o.rgb=[]),(s&7)===2){let u=e.uint32()+e.pos;for(;e.pos<u;)o.rgb.push(e.float())}else o.rgb.push(e.float());break}default:e.skipType(s&7);break}}return o},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/Color"},n})();function loadDome(n,t){var e={byteLength:0};return Promise.resolve().then(function(){return t.fetcher.ajax(n,{responseType:"arraybuffer"})}).then(function(r){return e.byteLength=r.body.byteLength,parse$1(new Uint8Array(r.body),t.textureBaseUri||"",t.textureOptions,t.fetcher)}).then(function(r){var i=new THREE__namespace.Group;i.matrixAutoUpdate=!1,i.matrix.compose(i.position,i.quaternion,i.scale),i.name=n;for(var o=0,s=r.objects;o<s.length;o++){var u=s[o];i.add(u)}return{type:"dome",uri:n,byteLength:e.byteLength,scene:i,textures:r.textures,dispose:function(){return r.dispose()}}})}function flipBufferGeometryNormals(n){for(var t=[0,0,0],e=0;e<n.attributes.normal.array.length/9;e++)t[0]=n.attributes.normal.array[e*9],t[1]=n.attributes.normal.array[e*9+1],t[2]=n.attributes.normal.array[e*9+2],n.attributes.normal.array[e*9]=n.attributes.normal.array[e*9+6],n.attributes.normal.array[e*9+1]=n.attributes.normal.array[e*9+7],n.attributes.normal.array[e*9+2]=n.attributes.normal.array[e*9+8],n.attributes.normal.array[e*9+6]=t[0],n.attributes.normal.array[e*9+7]=t[1],n.attributes.normal.array[e*9+8]=t[2];for(var e=0;e<n.attributes.position.array.length/9;e++)t[0]=n.attributes.position.array[e*9],t[1]=n.attributes.position.array[e*9+1],t[2]=n.attributes.position.array[e*9+2],n.attributes.position.array[e*9]=n.attributes.position.array[e*9+6],n.attributes.position.array[e*9+1]=n.attributes.position.array[e*9+7],n.attributes.position.array[e*9+2]=n.attributes.position.array[e*9+8],n.attributes.position.array[e*9+6]=t[0],n.attributes.position.array[e*9+7]=t[1],n.attributes.position.array[e*9+8]=t[2];for(var e=0;e<n.attributes.uv.array.length/6;e++)t[0]=n.attributes.uv.array[e*6],t[1]=n.attributes.uv.array[e*6+1],n.attributes.uv.array[e*6]=n.attributes.uv.array[e*6+4],n.attributes.uv.array[e*6+1]=n.attributes.uv.array[e*6+5],n.attributes.uv.array[e*6+4]=t[0],n.attributes.uv.array[e*6+5]=t[1];n.attributes.normal.needsUpdate=!0,n.attributes.position.needsUpdate=!0,n.attributes.uv.needsUpdate=!0}function parseGeometry(n){var t=n.position,e=n.normal,r=n.uv,i=n.uv2,o=n.groups,s=new THREE__namespace.BufferGeometry;s.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(t.array),3)),e&&s.setAttribute("normal",new THREE__namespace.BufferAttribute(new Float32Array(e.array),3)),r&&s.setAttribute("uv",new THREE__namespace.BufferAttribute(new Float32Array(r.array),2)),i&&s.setAttribute("uv2",new THREE__namespace.BufferAttribute(new Float32Array(i.array),2));for(var u=0,c=o;u<c.length;u++){var l=c[u];s.addGroup(l.start,l.count,l.materialIndex)}return s}function loadTexture(n,t,e,r,i,o,s){if(s.hasOwnProperty(n))return s[n];n=n.split("?")[0],isAbsoluteURL(n)||(n=pathJoin(t,n)),n=n.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/"),n.indexOf("//")===0&&(n="https:"+n);var u=__assign({key:"texture.dome",size:64},pick(e,["quality","format","sharpen","mappings"])),c=s[n]=i.loadTexture(n,{imageURL:{transform:e.transform,options:u},wrapS:THREE__namespace.RepeatWrapping,wrapT:THREE__namespace.RepeatWrapping,fetcher:o}).then(function(l){var d=l.body;return r&&d.repeat.copy(r),d.needsUpdate=!0,d.updateMatrix(),d});return c}function parseMaterial(n,t,e,r,i,o,s,u){var c=[],l=new PBMMeshMaterial("phong");if(s.add(l),n.kd&&(l.color=new THREE__namespace.Color().fromArray(n.kd.rgb).convertLinearToSRGB()),n.mapkd){var d=null;if(n.mapkdrepeat){var f=n.mapkdrepeat.split(/\s+/).map(function(p){return Number(p)}),m=f[0],A=f[1];d=new THREE__namespace.Vector2(m,A)}c.push(loadTexture(n.mapkd,t,e,d,r,i,o).then(function(p){p.encoding=THREE__namespace.sRGBEncoding,l.map=p,s.add(p),u.add(p),l.needsUpdate=!0}).catch(noop$1))}if(n.ks&&(l.specular=new THREE__namespace.Color().fromArray(n.ks.rgb).convertLinearToSRGB()),n.mapks&&c.push(loadTexture(n.mapks,t,e,null,r,i,o).then(function(p){l.specularMap=p,s.add(p),u.add(p)}).catch(noop$1)),n.ke&&(l.emissive=new THREE__namespace.Color().fromArray(n.ke.rgb).convertLinearToSRGB()),n.mapke&&c.push(loadTexture(n.mapke,t,e,null,r,i,o).then(function(p){p.encoding=THREE__namespace.sRGBEncoding,l.emissiveMap=p,s.add(p),u.add(p)}).catch(noop$1)),n.norm&&c.push(loadTexture(n.norm,t,e,null,r,i,o).then(function(p){l.normalMap=p,s.add(p),u.add(p)}).catch(noop$1)),n.mapbump&&c.push(loadTexture(n.mapbump,t,e,null,r,i,o).then(function(p){l.bumpMap=p,s.add(p),u.add(p)}).catch(noop$1)),n.bump&&c.push(loadTexture(n.bump,t,e,null,r,i,o).then(function(p){l.bumpMap=p,s.add(p),u.add(p)}).catch(noop$1)),typeof n.ns=="number"&&(l.shininess=n.ns),typeof n.d=="number"){var h=n.d;h>0&&h<1&&(l.opacity=h)}return l.floor=0,l.defines.USE_VERTEX_FLOOR=!1,{material:l,textureReady:Promise.all(c).then(noop$1)}}function fromProtoBuf(n){return Model$1.decode(n).meshes}function parse$1(n,t,e,r){for(var i=[],o=[],s=new Set,u=fromProtoBuf(n),c=new TextureLoader,l=new THREE__namespace.Matrix4,d=new THREE__namespace.Vector3,f=new THREE__namespace.Quaternion,m=new THREE__namespace.Vector3,A={},h=new Set,p=0,y=u;p<y.length;p++){var v=y[p],g=v.name,E=v.chunks,b=v.matrix;if(!(g==="Ceiling"||g==="CeilingDrop"))for(var T=0,x=b;T<x.length;T++){var R=x[T];l.elements=R.elements;for(var _=new THREE__namespace.Group,M=0;M<E.length;M++){var S=parseGeometry(E[M].geometry);S.applyMatrix4(l),l.decompose(d,f,m),m.x*m.y*m.z<0&&S.attributes.normal&&S.attributes.position&&S.attributes.uv&&flipBufferGeometryNormals(S),s.add(S);for(var I=[],C=0,H=E[M].material;C<H.length;C++){var B=H[C],L=parseMaterial(B,t||"",e,c,r,A,s,h),O=L.material,k=L.textureReady;o.push(k),I.push(O)}var G=new PBMMesh(S,I);G.name="chunk_"+M,G.matrix.compose(G.position,G.quaternion,G.scale),G.matrixAutoUpdate=!1,G.frustumCulled=!1,_.add(G)}_.name=g,i.push(_)}}return Promise.all(o).catch(noop$1).then(function(){return{createAt:0,description:"",objects:i,textures:Array.from(h),dispose:function(){s.forEach(function(z){z.dispose()}),s.clear()}}})}function loadDomez(n,t){var e={byteLength:0};return Promise.resolve().then(function(){return t.fetcher.ajax(n,{responseType:"arraybuffer"})}).then(function(r){return e.byteLength=r.body.byteLength,lzma(r.body)}).then(function(r){var i=r.reduce(function(u,c){return u+c.length},0),o=new Uint8Array(i),s=0;return r.forEach(function(u){o.set(u,s),s+=u.length}),o}).then(function(r){return parse$1(r,t.textureBaseUri||"",t.textureOptions,t.fetcher)}).then(function(r){var i=new THREE__namespace.Group;i.name=n;for(var o=0,s=r.objects;o<s.length;o++){var u=s[o];i.add(u)}return{type:"domez",uri:n,byteLength:e.byteLength,scene:i,textures:r.textures,dispose:function(){return r.dispose()}}})}var ROTATE_X_MATRIX=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);function loadGlb(n,t){var e=0;return Promise.resolve().then(function(){return t.fetcher.ajax(n,{responseType:"arraybuffer"}).then(function(r){return e=r.body.byteLength,r.body})}).then(function(r){var i;return parseGltf(r,{copyUV2:!1,addonExtensions:["PBM_mesh"],resourcePath:n.slice(0,n.lastIndexOf("/")+1),search:(i=n.split("?")[1])!==null&&i!==void 0?i:"",fetcher:t.fetcher})}).then(function(r){var i=new THREE__namespace.Matrix4;if(t.upAxis!=="Z"&&i.premultiply(ROTATE_X_MATRIX),r.CESIUM_RTC){var o=new THREE__namespace.Matrix4().setPosition(r.CESIUM_RTC.center);i.premultiply(o)}var s=r.scene;return s.applyMatrix4(i),{type:"glb",uri:n,byteLength:e,scene:s,textures:r.textures,dispose:function(){return r.dispose()}}})}var scratchVector3$2=new THREE__namespace.Vector3,scratchMatrix4$3=new THREE__namespace.Matrix4;function attachTileAttributes(n,t){n.name=t.id;var e=t.tileset.properties.floorInfo;n.traverse(function(r){if("floor"in t.extras){if(r instanceof THREE__namespace.Mesh||r instanceof THREE__namespace.Points)for(var i=Array.isArray(r.material)?r.material:r.material?[r.material]:[],o=0,s=i;o<s.length;o++){var u=s[o];(u instanceof PBMMeshMaterial||u instanceof PBMPointCloudMaterial)&&(u.floor=t.extras.floor)}}else if(!(r instanceof PBMPointCloud)){if(r instanceof PBMMesh&&e){var c=r.geometry.index,l=r.geometry.getAttribute("position"),d=0,f=new Float32Array(l.count);if(e)if(c){for(var m=0,A=c.count,h=0;h<A;h++){var b=c.array[h];scratchVector3$2.set(l.array[b*3+0],l.array[b*3+1],l.array[b*3+2]),scratchVector3$2.applyMatrix4(r.matrixWorld);var p=scratchVector3$2.y;f[b]=0;for(var y=0;y<e.length;y++){var T=e[y],g=T.ground,E=T.height;if(p<g+E){f[b]=y;break}}m+=f[b]}d=m/A}else{for(var m=0,A=l.count,h=0;h<A;h++){scratchVector3$2.set(l.array[h*3+0],l.array[h*3+1],l.array[h*3+2]),scratchVector3$2.applyMatrix4(r.matrixWorld);var p=scratchVector3$2.y;f[h]=0;for(var y=0;y<e.length;y++){var v=e[y],g=v.ground,E=v.height;if(p<g+E){f[h]=y;break}}m+=f[h]}d=m/A}t.floor=d,r.geometry.setAttribute("floor",new THREE__namespace.BufferAttribute(f,1)),r.material.forEach(function(x){x.defines.USE_VERTEX_FLOOR=!0,x.needsUpdate=!0})}}})}function loadTileContentData(n,t){if(!n.content)return Promise.resolve(null);var e=n.content,r=appendSearch(e.uri,t.search);if(n.type==="TILESET"){var i=imageURL(r,{key:"model.".concat(n.siblingIndex)});return t.fetcher.ajax(i,{responseType:"text"}).then(function(o){return o.body}).then(function(o){var s=r.slice(0,r.lastIndexOf("/")+1);return normalizeTilesetHeader(JSON.parse(o),s)}).then(function(o){n.children.length===0&&(n.children=[new Tile("".concat(n.id,".0"),o.root,n.tileset,n)])}).then(function(){return null})}return n.type==="SCENEGRAPH"?Promise.resolve().then(function(){var o,s,u,c,l,d,f,m,A,h,p="",y=r.split("#"),v=y[0],g=y[1],E=(g||v).split("?")[0].match(/\.([0-9a-zA-Z]+)$/);if(E&&(p=E[1]),p==="b3dm"){var b=imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadB3dm(b,{upAxis:n.tileset.asset.gltfUpAxis,fetcher:t.fetcher}).then(function(T){return T.scene.applyMatrix4(n.transform),T.scene.updateWorldMatrix(!1,!0),T.scene.matrixAutoUpdate=!1,attachTileAttributes(T.scene,n),T})}if(p==="pnts"){var b=imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadPnts(b,{fetcher:t.fetcher,computeBoundingBox:!1}).then(function(x){if(x.scene.applyMatrix4(n.transform),x.scene.updateWorldMatrix(!1,!0),x.scene.matrixAutoUpdate=!1,n.boundingVolume){var R=n.boundingVolume;x.scene.traverse(function(_){if(_ instanceof PBMPointCloud){scratchMatrix4$3.getInverse(_.matrixWorld);var M=new THREE__namespace.Box3;R.getBoundingBox(M),M.applyMatrix4(scratchMatrix4$3),_.geometry.boundingBox=M}})}return attachTileAttributes(x.scene,n),x})}if(p==="glb"){var b=imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadGlb(b,{upAxis:n.tileset.asset.gltfUpAxis,fetcher:t.fetcher}).then(function(x){return x.scene.applyMatrix4(n.transform),x.scene.updateWorldMatrix(!1,!0),x.scene.matrixAutoUpdate=!1,attachTileAttributes(x.scene,n),x})}if(p==="at3d"){var b=n.extras.at3d?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadAt3d(b,{textureBaseUri:(o=n.extras.at3d)===null||o===void 0?void 0:o.textureBaseUri,textureArray:(s=n.extras.at3d)===null||s===void 0?void 0:s.textureArray,textureOptions:(u=n.extras.at3d)===null||u===void 0?void 0:u.textureOptions,fetcher:t.fetcher}).then(function(x){return x.scene.applyMatrix4(n.transform),x.scene.updateWorldMatrix(!1,!0),x.scene.matrixAutoUpdate=!1,x})}if(p==="pbm"){var b=n.extras.pbm?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadPbm(b,{textureBaseUri:(c=n.extras.pbm)===null||c===void 0?void 0:c.textureBaseUri,textureArray:(l=n.extras.pbm)===null||l===void 0?void 0:l.textureArray,textureOptions:(d=n.extras.pbm)===null||d===void 0?void 0:d.textureOptions,fetcher:t.fetcher}).then(function(x){return x.scene.applyMatrix4(n.transform),x.scene.updateWorldMatrix(!1,!0),x.scene.matrixAutoUpdate=!1,x})}if(p==="dome"){var b=n.extras.dome?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadDome(b,{textureBaseUri:(f=n.extras.dome)===null||f===void 0?void 0:f.textureBaseUri,textureOptions:(m=n.extras.dome)===null||m===void 0?void 0:m.textureOptions,fetcher:t.fetcher}).then(function(x){return x.scene.applyMatrix4(n.transform),x.scene.updateWorldMatrix(!1,!0),x.scene.matrixAutoUpdate=!1,x})}if(p==="domez"){var b=n.extras.domez?r:imageURL(r,{key:"model.".concat(n.siblingIndex)});return loadDomez(b,{textureBaseUri:(A=n.extras.domez)===null||A===void 0?void 0:A.textureBaseUri,textureOptions:(h=n.extras.domez)===null||h===void 0?void 0:h.textureOptions,fetcher:t.fetcher}).then(function(x){return x.scene.applyMatrix4(n.transform),x.scene.updateWorldMatrix(!1,!0),x.scene.matrixAutoUpdate=!1,x})}return null}).then(function(o){if(!o)return Promise.resolve(null);o.scene.traverse(function(u){if(u instanceof PBMPointCloud)u.material.uniforms.geometricError.value=n.geometricError;else if(u instanceof PBMMesh)for(var c=0,l=u.material;c<l.length;c++){var d=l[c];d.uniforms.geometricError.value=n.geometricError}});var s={type:o.type,uri:o.uri,byteLength:o.byteLength,object:new TileNode(o.scene,o.dispose)};return s.object.name=n.id,Promise.resolve().then(function(){return Promise.all([s.object.generateBvhTree(),t.renderer&&o.textures.length<16?initTextures(o.textures,t.renderer,1024*1024):null])}).then(function(){return s}).catch(function(u){return unloadTileContentData(s),Promise.reject(u)})}):Promise.resolve(null)}function unloadTileContentData(n){n&&n.object.dispose()}function jsonStableStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",i=n.length-1,o=0;o<i;o++)r+=jsonStableStrinfiy_(n[o],!1)+",";return i>-1&&(r+=jsonStableStrinfiy_(n[o],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableStrinfiy_(n.toJSON(),t);for(var s=Object.keys(n).sort(),u=s.length,r="",o=0;o<u;){var c=s[o],l=jsonStableStrinfiy_(n[c],!0);l!==void 0&&(o&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+l),o++}return"{"+r+"}"}switch(e){case"function":return JSON.stringify(n.toString());case"undefined":return t?void 0:null;case"number":return n;default:return isFinite(n)?n:null}}function jsonHash(n){return"hash::".concat(jsonStableStrinfiy_(n,!1))}var scratchVector3$1=new THREE__namespace.Vector3,scratchMatrix3=new THREE__namespace.Matrix3,scratchMatrix4$2=new THREE__namespace.Matrix4,a=6378137,invF=298.257223563;function ecefToLla(n){for(var t=a-a/invF,e=(a*a-t*t)/(a*a),r=Math.sqrt(n.x*n.x+n.y*n.y),i=1e-12,o=1e3,s=0,u=Math.atan2(n.z,r),c=0;s++<o;){var l=Math.sin(u),d=a/Math.sqrt(1-e*l*l);c=r/Math.cos(u)-d;var f=Math.atan2(n.z/(d*(1-e)+c),r/(d+c));if(isNaN(f))break;var m=Math.abs(f-u);if(m<i)break;u=f}return n.set(u,Math.atan2(n.y,n.x),c)}function llaToEcef(n){var t=n.x,e=n.y,r=n.z,i=a-a/invF,o=(a*a-i*i)/(a*a),s=Math.sin(t),u=Math.cos(t),c=Math.sin(e),l=Math.cos(e),d=a/Math.sqrt(1-o*s*s),f=(d+r)*u*l,m=(d+r)*u*c,A=(i*i/(a*a)*d+r)*s;return n.set(f,m,A)}function getEcefToEnuMatrix(n,t){var e=ecefToLla(scratchVector3$1.copy(n)),r=e.x,i=e.y,o=e.z,s=Math.sin(r),u=Math.sin(i),c=Math.cos(r),l=Math.cos(i);t.fromArray([-u,-s*l,c*l,0,+l,-s*u,c*u,0,0,c,s,0,0,0,0,1]);var d=scratchMatrix3.setFromMatrix4(t),f=scratchVector3$1.copy(n).applyMatrix3(d).multiplyScalar(-1);t.setPosition(f);var m=scratchMatrix4$2.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,o,1]);return t.premultiply(m),t}var StencilConstants={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15},SKIP_BACKFACE_MATERIAL=function(){var n=new THREE__namespace.MeshBasicMaterial;return n.side=THREE__namespace.BackSide,n.color.setHex(16711935),n.colorWrite=!1,n.stencilWrite=!0,n.polygonOffset=!0,n.polygonOffsetFactor=2,n.polygonOffsetUnits=2,n.stencilRef=StencilConstants.TILE_MASK,n.stencilFunc=THREE__namespace.AlwaysStencilFunc,n.stencilFuncMask=StencilConstants.TILE_MASK,n.stencilZPass=THREE__namespace.ReplaceStencilOp,n.stencilWriteMask=StencilConstants.TILE_MASK,n}(),SKIP_BACKFACE_TRANSPARENT_MATERIAL=function(){var n=new THREE__namespace.MeshBasicMaterial;return n.visible=!1,n}(),CLEAR_STENCIL_GEOMETRY=new THREE__namespace.BufferGeometry,CLEAR_STENCIL_MATERIAL=new THREE__namespace.MeshBasicMaterial,Tile3DModel=function(n){__extends(t,n);function t(e,r,i){var o,s,u,c=n.call(this)||this;return c.modelIndex=0,c.debug=!1,c.name=i.name,c.type=i.type,c.upAxis=i.upAxis,c.model=e,c.fetcher=i.fetcher,c.search=(o=i.search)!==null&&o!==void 0?o:"",c.groundHeight=i.groundHeight,c.coordinateTransform=i.coordinateTransform,c.unloadTileQueue=[],c.boundingBox=new THREE__namespace.Box3,c.idle=!1,c.minLevelOfDetail=t.DEFAULT_MIN_LEVEL_OF_DETAIL,c.maxLevelOfDetail=t.DEFAULT_MAX_LEVEL_OF_DETAIL,c.needsRefined=!0,c.refined=!1,c.refineProgress=[0,0],c.loaded=!1,c.disposed=!1,c.needsRender=!0,c.lastRenderHash="",c.matrixAutoUpdate=!1,c.cacheCameras=[],c.clearStencilObject=new THREE__namespace.Mesh(CLEAR_STENCIL_GEOMETRY,CLEAR_STENCIL_MATERIAL),c.clearStencilObject.frustumCulled=!1,c.clearStencilObject.onAfterRender=function(l){return l.clearStencil()},c.tileset=new Tileset((u=(s=c.model.work)===null||s===void 0?void 0:s.workCode)!==null&&u!==void 0?u:"",r,{referer:i.referer,contentLoader:function(l){return c.loadContent(l)},onTileLoad:function(){},onTileUnload:function(l){c.unloadTileQueue.push(l)},onTileError:function(l,d){i.onError&&i.onError(Object.assign(d,{error:d})),console.error("Tile error",l.id,d)}}),c.tileset.root.boundingVolume&&c.tileset.root.boundingVolume.getBoundingBox(c.boundingBox),c}return t.prototype.getRenderHash=function(){return jsonHash([this.tileset.id,this.tileset.skipLevelOfDetail,this.tileset.selectedTiles.map(function(e){return e.id}),this.debug])},Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){return this.tileset.maxMemoryUsage},set:function(e){this.tileset.maxMemoryUsage=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRequests",{get:function(){return this.tileset.maxRequests},set:function(e){this.tileset.maxRequests=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipLevelOfDetail",{get:function(){return this.tileset.skipLevelOfDetail},set:function(e){this.tileset.skipLevelOfDetail=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadSiblings",{get:function(){return this.tileset.loadSiblings},set:function(e){this.tileset.loadSiblings=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){return this.tileset.maxScreenSpaceError},set:function(e){this.tileset.maxScreenSpaceError=e},enumerable:!1,configurable:!0}),t.prototype.localToEnu=function(e){return e.applyMatrix4(this.coordinateTransform.localToEnuMatrix)},t.prototype.enuToLocal=function(e){return e.applyMatrix4(this.coordinateTransform.enuToLocalMatrix)},t.prototype.localToEcef=function(e){return e.applyMatrix4(this.coordinateTransform.localToEcefMatrix)},t.prototype.ecefToLocal=function(e){return e.applyMatrix4(this.coordinateTransform.ecefToLocalMatrix)},t.prototype.localToLla=function(e){return ecefToLla(this.localToEcef(e))},t.prototype.llaToLocal=function(e){return this.ecefToLocal(llaToEcef(e))},t.prototype.worldToEnu=function(e){return this.localToEnu(this.worldToLocal(e))},t.prototype.enuToWorld=function(e){return this.localToWorld(this.enuToLocal(e))},t.prototype.worldToEcef=function(e){return this.localToEcef(this.worldToLocal(e))},t.prototype.ecefToWorld=function(e){return this.localToWorld(this.ecefToLocal(e))},t.prototype.worldToLla=function(e){return this.localToLla(this.worldToLocal(e))},t.prototype.llaToWorld=function(e){return this.localToWorld(this.llaToLocal(e))},t.prototype.loadContent=function(e){var r=this;return loadTileContentData(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(function(i){return e.type==="TILESET"?!0:i&&e.type==="SCENEGRAPH"?r.disposed||!e.content?(unloadTileContentData(i),!1):(e.content.data=i,e.content.byteLength=i.byteLength,e.content.data&&(e.content.data.object.traverse(function(o){(o instanceof PBMPointCloud||o instanceof PBMMesh)&&(o.model=r.model)}),r.boundingBox.expandByObject(e.content.data.object)),!0):!1})},t.prototype.unloadContent=function(e){e.content&&(e.content.byteLength=0,unloadTileContentData(e.content.data),e.content.data=void 0)},t.prototype.loadAllTilesets=function(){var e=this,r=function(i){var o=[];return e.tileset.root.traverse(function(s){var u;s.type==="TILESET"&&((u=s.content)===null||u===void 0?void 0:u.loadState)!=="READY"&&o.push(s)}),Promise.all(o.map(function(s){return e.loadContent(s).then(function(){return r()})})).then(function(){})};return r(this.tileset.root)},t.prototype.intersectRaycaster=function(e,r,i){var o=this;r===void 0&&(r=!0),i===void 0&&(i=[]);for(var s=[this.tileset.root],u=this.tileset.transform,c=this.tileset.transformIsIdentity,l,d=[];l=s.pop();){var f=void 0;if(l.boundingVolume){var m=c?l.boundingVolume:l.boundingVolume.clone().applyMatrix4(u);f=m.intersectRay(e.ray,e.far)}else f=!0;if(f){for(var A=0,h=l.children.length;A<h;A++)s.push(l.children[A]);l.selected&&l.content&&l.content.data&&l.content.data.object.visible&&l.content.data.object.intersectRaycaster(e,!1,d)}}return this.model.shownFloorIndex>=0&&(d=d.filter(function(p){return p.floor===o.model.shownFloorIndex})),r&&d.sort(function(p,y){return p.distance-y.distance}),d.map(function(p){p.model=o.model,p.viewLayer=o.viewLayer}),i.push.apply(i,d),i},t.prototype.cloneSkipBackfaceObject=function(e){var r;e instanceof THREE__namespace.Mesh?r=new THREE__namespace.Mesh(e.geometry,Array.isArray(e.material)?e.material.map(function(u){return u.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL}):e.material&&e.material.transparent?SKIP_BACKFACE_TRANSPARENT_MATERIAL:SKIP_BACKFACE_MATERIAL):e instanceof THREE__namespace.Group?r=new THREE__namespace.Group:r=new THREE__namespace.Object3D,r.copy(e,!1);for(var i=0,o=e.children;i<o.length;i++){var s=o[i];r.add(this.cloneSkipBackfaceObject(s))}return r},t.prototype.update=function(e,r){var i=this,o,s;this.renderer=e,this.tileset.transform.equals(this.matrixWorld)||this.tileset.transform.copy(this.matrixWorld),this.tileset.cache.reset(),this.tileset.frameNumber++;var u=this.visible,c=Math.max(this.maxLevelOfDetail,0),l=Math.min(this.minLevelOfDetail,c),d=Math.max(l,0),f={camera:{type:r.type,position:new THREE__namespace.Vector3().copy(r.position),direction:r.getDirection(new THREE__namespace.Vector3),near:r.near,far:r.far,up:new THREE__namespace.Vector3().copy(r.up),visible:r.visible,refine:r.refineModel},minLevelOfDetail:l,maxLevelOfDetail:u&&!this.idle&&this.loaded?c:d,maxScreenSpaceError:this.maxScreenSpaceError,height:r.resolution.height,pixelRatio:r.pixelRatio,frameNumber:this.tileset.frameNumber,sseDenominator:2*Math.tan(.5*r.fov/180*Math.PI),cullingVolume:new CullingVolume().setFromCamera(r)},m=this.cacheCameras.map(function(C){return __assign(__assign({},f),{camera:{type:r.type,position:new THREE__namespace.Vector3().copy(C.position),direction:C.getWorldDirection(new THREE__namespace.Vector3),near:r.near,far:r.far,up:new THREE__namespace.Vector3().copy(C.up),visible:C.visible,refine:!0},cullingVolume:new CullingVolume().setFromCamera(C)})});this.tileset.traverse(f,m),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(function(C){if(i.refineProgress[1]++,C.content&&C.state.visible){var H=C.content.loadState;if(H==="UNLOADED"||H==="LOADING"){i.refined=!1;return}}i.refineProgress[0]++}),this.loaded===!1&&this.tileset.needsRefinedTiles.size>0&&(this.loaded=!0,this.tileset.needsRefinedTiles.forEach(function(C){if(i.loaded!==!1){if(i.tileset.skipLevelOfDetail){if(C.state.finalResolution&&C.content){var H=C.state.ancestorWithContentAvailable,B=H&&H.content?H.content:C.content,L=B.loadState;(L==="UNLOADED"||L==="LOADING")&&(i.loaded=!1)}}else if(C.state.visible&&C.content&&C.levelOfContent<=0){var L=C.content.loadState;(L==="UNLOADED"||L==="LOADING")&&(i.loaded=!1)}}}),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++));for(var A;A=this.unloadTileQueue.pop();)this.unloadContent(A);this.remove.apply(this,this.children);var h=[],p=[],y=[];this.tileset.skipLevelOfDetail||this.tileset.selectedTiles.sort(function(C,H){return C.floor-H.floor});for(var v=function(C){g.debug&&C.boundingVolumeDebugObject&&p.push(C.boundingVolumeDebugObject);var H=(s=(o=C.content)===null||o===void 0?void 0:o.data)===null||s===void 0?void 0:s.object;if(!H)return"continue";if(g.tileset.skipLevelOfDetail&&g.tileset.hasMixedContent&&!C.state.finalResolution){var B=g.cloneSkipBackfaceObject(H);h.push(B)}var L=C.state.selectionDepth,O=StencilConstants.TILE_MASK|L<<StencilConstants.SKIP_LOD_BIT_SHIFT,k=THREE__namespace.GreaterEqualStencilFunc,G=StencilConstants.SKIP_LOD_MASK,z=THREE__namespace.ReplaceStencilOp,D=StencilConstants.TILE_MASK|StencilConstants.SKIP_LOD_MASK;H.traverse(function(U){if(U instanceof THREE__namespace.Mesh)for(var K=Array.isArray(U.material)?U.material:U.material?[U.material]:[],Q=0,q=K;Q<q.length;Q++){var J=q[Q];i.tileset.hasMixedContent&&i.tileset.skipLevelOfDetail?(J.stencilWrite=!0,J.stencilRef=O,J.stencilFunc=k,J.stencilFuncMask=G,J.stencilZPass=z,J.stencilWriteMask=D):(J.stencilWrite=!1,J.stencilRef=StencilConstants.TILE_MASK,J.stencilFunc=THREE__namespace.AlwaysStencilFunc,J.stencilFuncMask=StencilConstants.TILE_MASK,J.stencilZPass=THREE__namespace.ReplaceStencilOp,J.stencilWriteMask=StencilConstants.TILE_MASK)}}),y.push(H)},g=this,E=0,b=this.tileset.selectedTiles;E<b.length;E++){var T=b[E];v(T)}var x=[];this.tileset.skipLevelOfDetail&&x.push.apply(x,h),x.push.apply(x,y),this.tileset.skipLevelOfDetail&&x.push(this.clearStencilObject),this.debug&&x.push.apply(x,p);for(var R=this.modelIndex*1e4,_=function(C){var H=x[C],B=C+R;H.traverse(function(L){(L instanceof THREE__namespace.Mesh||L instanceof THREE__namespace.Line||L instanceof THREE__namespace.Points)&&(L.renderOrder=B)}),M.add(H)},M=this,S=0;S<x.length;S++)_(S);var I=this.getRenderHash();this.lastRenderHash!==I&&(this.needsRender=!0,this.lastRenderHash=I)},t.prototype.dispose=function(){this.disposed=!0,this.viewLayer=void 0,this.tileset.reset();for(var e;e=this.unloadTileQueue.pop();)this.unloadContent(e)},t.DEFAULT_MIN_LEVEL_OF_DETAIL=0,t.DEFAULT_MAX_LEVEL_OF_DETAIL=20,t.DEFAULT_MAX_MEMORY_USAGE=16,t.DEFAULT_MAX_SCREEN_SPACE_ERROR=Tileset.DEFAULT_MAX_SCREEN_SPACE_ERROR,t.DEFAULT_SKIP_LEVEL_OF_DETAIL=Tileset.DEFAULT_SKIP_LEVEL_OF_DETAIL,t.DEFAULT_LOAD_SIBLINGS=Tileset.DEFAULT_LOAD_SIBLINGS,t.DEFAULT_MAX_REQUESTS=Tileset.DEFAULT_MAX_REQUESTS,t}(THREE__namespace.Object3D);function headingToLongitude(n){return-((n-.25)*360+90)/180*Math.PI}function equal(n,t){if(n===t)return!0;if(n&&t&&typeof n=="object"&&typeof t=="object"){if(n.constructor!==t.constructor)return!1;var e,r,i;if(Array.isArray(n)){if(e=n.length,e!=t.length)return!1;for(r=e;r--!==0;)if(!equal(n[r],t[r]))return!1;return!0}if(n.constructor===RegExp)return n.source===t.source&&n.flags===t.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===t.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===t.toString();if(i=Object.keys(n),e=i.length,e!==Object.keys(t).length)return!1;for(r=e;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=e;r--!==0;){var o=i[r];if(!equal(n[o],t[o]))return!1}return!0}return n!==n&&t!==t}function isNumber(n){return typeof n=="number"}var error_invalid_input=function(){return new Error("Invalid input.")},error_invalid_certificate=function(){return new Error("Invalid certificate.")},error_invalid_signature=function(){return new Error("Invalid signature.")},error_date_expired=function(n){return new Error("date(".concat(n.toString(),") expired."))},error_host_not_allowed=function(n){return new Error("host(".concat(JSON.stringify(n),") is not allowed."))};function ObjectOmit(n,t){for(var e={},r=0,i=Object.keys(n);r<i.length;r++){var o=i[r];t.indexOf(o)===-1&&(e[o]=n[o])}return e}function jsonStableNoneNumberStrinfiy_(n,t){t===void 0&&(t=!1);var e=typeof n;if(e==="string")return JSON.stringify(n);if(n===!0)return"true";if(n===!1)return"false";if(n===null)return"null";if(n instanceof Array){for(var r="[",i=n.length-1,o=0;o<i;o++)r+=jsonStableNoneNumberStrinfiy_(n[o],!1)+",";return i>-1&&(r+=jsonStableNoneNumberStrinfiy_(n[o],!1)),r+"]"}if(n instanceof Object){if(typeof n.toJSON=="function")return jsonStableNoneNumberStrinfiy_(n.toJSON(),t);for(var s=Object.keys(n).sort(),u=s.length,r="",o=0;o<u;){var c=s[o],l=jsonStableNoneNumberStrinfiy_(n[c],!0);l!==void 0&&(o&&r!==""&&(r+=","),r+=JSON.stringify(c)+":"+l),o++}return"{"+r+"}"}switch(e){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(n)?n:null}}function jsonStableNoneNumberStrinfiy(n){return String(jsonStableNoneNumberStrinfiy_(n,!1))}function verify(n){var t,e,r;if(Array.isArray(n)){var i=void 0,o,s;if(n.length<=0)return error_invalid_input();for(var u=function(T){var x=verify(n[T]);if(x instanceof Error)return{value:x};if(!i)i=x.issuer;else if(i!==x.issuer)return{value:error_invalid_certificate()};o?x.expire.getTime()<o.getTime()&&(o=x.expire):o=x.expire,s?s=s.filter(function(R){return x.allowHosts.indexOf(R)!==-1}):s=x.allowHosts},c=0;c<n.length;c++){var l=u(c);if(typeof l=="object")return l.value}return deepFreeze({issuer:i,expire:o,allowHosts:s})}var d=JSON.parse(n),f=typeof location!="undefined"?location.hostname:"",m=Date.now();if(typeof d!="object")return error_invalid_input();var A=new Date(typeof d.expire_at=="string"&&/^\d+$/.test(d.expire_at)?Number(d.expire_at):d.expire_at),h=Array.isArray(d.allow_hosts)?d.allow_hosts:[];if(f.length===0||isIPDomain(f)||BUILDIN_ALLOW_HOST.filter(function(T){return matchDomain(T,f)}).length>0){var p=String((t=d.certificate)!==null&&t!==void 0?t:"");if(p){var y=new X509;return y.readCertPEM(p),deepFreeze({issuer:y.getSubjectString(),expire:A,allowHosts:h})}return deepFreeze({issuer:"none",expire:A,allowHosts:h})}var v=String((e=d.certificate)!==null&&e!==void 0?e:"");if(!v)return error_invalid_certificate();var g=new X509;g.readCertPEM(v);var E=String((r=d._signature)!==null&&r!==void 0?r:"");if(!E)return error_invalid_signature();var b=jsonStableNoneNumberStrinfiy(ObjectOmit(d,["_signature"]));return verifyMessage(b,E,g)===!1?error_invalid_signature():m<A.getTime()?h.filter(function(T){return matchDomain(T,f)}).length===0?error_host_not_allowed(f):deepFreeze({issuer:g.getSubjectString(),expire:A,allowHosts:h}):error_date_expired(A)}var scratchMatrix4$1=new THREE__namespace.Matrix4,workRawMapping=new WeakMap,Work=function(){function n(t,e){this.name="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={work:this},this.observers=[],this.issuer="none",this.raw={works:[""],options:""},this.transform=new THREE__namespace.Matrix4;{var r=this;this.options={get transform(){return r.transform},set transform(o){r.transform.copy(o)}}}var i=parse(t,e,this);if(i instanceof Error)throw new Error("[PARSE FAILED]: "+i.message+`
929
929
  Error work input:
930
- `+JSON.stringify(t))}return n.prototype.toJSON=function(){return this.raw},n.parse=parseWork,n}();function getType(n){return n==null?"null":Array.isArray(n)?"array":typeof n=="object"?"dict":"value"}function deepMerge(n,t){var e=getType(n),r=getType(t);if(r==="null")return n;if(r==="value")return t;if(r!==e)return JSON.parse(JSON.stringify(t));if(r==="array")for(var i=0;i<t.length;i++)n[i]=deepMerge(n[i],t[i]);else if(r==="dict")for(var o in t)n[o]=deepMerge(n[o],t[o]);return n}function startWithString(n,t){return n.indexOf(t)===0}function urlWithParseOptions(n,t,e,r){var i,o=t;if(r.jsonp===!0){o=t.replace(/([\?\#].*)?$/i,"");var s=sha256("".concat(o)).slice(0,7);o="".concat(o,".").concat(s,".jsonp")}if(r.shortPath===!0){var u=o.replace(n,"").split("."),c=(i=u.shift())!==null&&i!==void 0?i:"",l=u.join(".");o=pathJoin(n,sha256(c))+(l?"."+l:"")}var d=o.replace(n,"");return r.baseURL&&(o=pathJoin(r.baseURL,d)),r.traverseResource&&r.traverseResource({origin:t,absolute:o,relative:d,type:e}),o}function panoURL(n,t,e,r,i){var o=e;return isAbsoluteURL(e)||(t&&(t=pathJoin(t,String(r))),o=pathJoin(t,o)),isAbsoluteURL(o)||(o=pathJoin(n,o)),startWithString(o,n)||console.warn("".concat(o," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,o,"panorama",i)}function fileURL(n,t,e){var r=t;return isAbsoluteURL(r)||(r=pathJoin(n,t)),startWithString(r,n)||console.warn("".concat(r," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,r,"model",e)}function textureURL$1(n,t,e,r){var i=t;return isAbsoluteURL(i)||(i=pathJoin(e,i)),isAbsoluteURL(i)||(i=pathJoin(n,i)),startWithString(i,n)||console.warn("".concat(i," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,i,"texture",r)}var getTileLevel=function(n){for(var t=0;t<10;t++){var e=512*Math.pow(2,t);if(e>=n)return t}return null},sortTile=function(n){n=n.slice().sort(function(s,u){return s.level-u.level});for(var t=[],e=0,r=n;e<r.length;e++){var i=r[e];if(t.length===0){t.push(i);continue}var o=t[t.length-1];if(i.level>o.level){t.push(i);continue}if(i.size>o.size){t[t.length-1]=i;continue}}return t};function parse(n,t,e){for(var r,i,o,s,u,c,l,d,f,m,A,h,p,y,v,g,E,b,T,x=JSON.stringify(t),R=[],_=0,M=[].concat(n);_<M.length;_++){var S=M[_];S instanceof Work?R.push.apply(R,S.raw.works):typeof S=="string"?R.push(S):R.push(JSON.stringify(S))}var I=verify(R);if(I instanceof Error)return I;Array.isArray(t.transform)?e.transform.fromArray(t.transform):t.transform&&e.transform.copy(t.transform),n=R.map(function(Z){return JSON.parse(Z)}).reduce(function(Z,Y){return deepMerge(Z,Y)}),Object.defineProperty(e,"raw",{configurable:!1,get:function(){return{works:R,options:x}}});{var C;if(t.workCode&&(typeof t.workCode=="string"?C=t.workCode:typeof t.workCode=="function"&&(C=t.workCode(n))),typeof C=="undefined"&&(C=String(n.resource_code||n.basic_code||n.vr_code||n.code||n.project_id||n.work_code||n.workCode)),typeof C=="undefined")return new Error("WorkCode never matched.");Object.defineProperty(e,"workCode",{configurable:!1,get:function(){return C}})}{var H=String(n.name);Object.defineProperty(e,"name",{configurable:!1,get:function(){return H}})}if(I instanceof Error)return I;Object.defineProperty(e,"issuer",{configurable:!1,get:function(){return I.issuer}}),Object.defineProperty(e,"expire",{configurable:!1,get:function(){return I.expire}}),Object.defineProperty(e,"allowHosts",{configurable:!1,get:function(){return I.allowHosts}});var B=(r=n.base_url)!==null&&r!==void 0?r:"";if(B&&B[B.length-1]!=="/"&&(B+="/"),I instanceof Error)return I;if(n.model){var L={work:e,layers:[]},O;n.model.file?O=fileURL(B,n.model.file,t):n.model.file_url&&(O=fileURL(B,n.model.file_url,t)),Object.defineProperty(L,"file",{configurable:!1,get:function(){return O}});var k;n.model.textureBase?k=textureURL$1(B,"",n.model.textureBase,t):n.model.material_base_url?k=textureURL$1(B,"",n.model.material_base_url,t):L.file&&(k=L.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),Object.defineProperty(L,"textureBase",{configurable:!1,get:function(){return k}});var G;Array.isArray(n.model.textures)?(G=n.model.textures.map(function(Z){var Y,N;return textureURL$1(B,Z,(N=(Y=n.model.textureBase)!==null&&Y!==void 0?Y:n.model.material_base_url)!==null&&N!==void 0?N:"",t)}),Object.freeze(G)):Array.isArray(n.model.material_textures)&&(G=n.model.material_textures.map(function(Z){var Y,N;return textureURL$1(B,Z,(N=(Y=n.model.textureBase)!==null&&Y!==void 0?Y:n.model.material_base_url)!==null&&N!==void 0?N:"",t)}),Object.freeze(G)),Object.defineProperty(L,"textures",{configurable:!1,get:function(){return G}});var z=[];if(Array.isArray(n.model.tiles))for(var D=0,U=n.model.tiles;D<U.length;D++){var K=U[D];K&&(K.tileset||K.tileset_url)&&z.push(Object.freeze({type:(i=K.type)!==null&&i!==void 0?i:"mesh",name:(o=K.name)!==null&&o!==void 0?o:"",upAxis:(u=(s=K.upAxis)!==null&&s!==void 0?s:K.up_axis)!==null&&u!==void 0?u:"-Y",tileset:fileURL(B,K.tileset||K.tileset_url,t)}))}else n.model.tiles&&(n.model.tiles.tileset||n.model.tiles.tileset_url)&&z.push(Object.freeze({type:(c=n.model.tiles.type)!==null&&c!==void 0?c:"mesh",name:(l=n.model.tiles.name)!==null&&l!==void 0?l:"lod",upAxis:(f=(d=n.model.tiles.upAxis)!==null&&d!==void 0?d:n.model.tiles.up_axis)!==null&&f!==void 0?f:"-Y",tileset:fileURL(B,n.model.tiles.tileset||n.model.tiles.tileset_url,t)}));if(Array.isArray(n.model.layers))for(var Q=0,q=n.model.layers;Q<q.length;Q++){var J=q[Q];J&&(J.tileset||J.tileset_url)&&z.push(Object.freeze({type:(m=J.type)!==null&&m!==void 0?m:"mesh",name:(A=J.name)!==null&&A!==void 0?A:"",upAxis:(h=J.upAxis)!==null&&h!==void 0?h:J.up_axis,tileset:fileURL(B,J.tileset||J.tileset_url,t)}))}Object.freeze(z),Object.defineProperty(L,"layers",{configurable:!1,get:function(){return z}}),Object.defineProperty(e,"model",{configurable:!1,get:function(){if(L.file||L.layers.length)return L}})}if(I instanceof Error)return I;var W=new Set,re=new Set;{var j=[];if(n.observers&&Array.isArray(n.observers)){var te=[];n.panorama&&(Array.isArray(n.panorama)?te=n.panorama:Array.isArray(n.panorama.list)?te=n.panorama.list:Array.isArray(n.panorama.info)&&(te=n.panorama.info));for(var $=function(Z){var Y={},N=n.observers[Z];if(!N)return"break";var Ee=te[Z];if(!Ee)return"break";N=Object.assign({},N,Ee,{active:N.active!==!1&&Ee.active!==!1}),Object.defineProperty(Y,"work",{configurable:!1,get:function(){return e}}),Object.defineProperty(Y,"index",{configurable:!1,get:function(){return Z}}),re.add(Z),Object.defineProperty(Y,"panoIndex",{configurable:!1,get:function(){return Z}});var ge=panoStringify({workCode:e.workCode,panoIndex:Z});W.add(ge),Object.defineProperty(Y,"panoId",{configurable:!1,get:function(){return ge}});var ve=Object.freeze({workCode:e.workCode,panoIndex:Z});Object.defineProperty(Y,"pano",{configurable:!1,get:function(){return ve}});var xe=N.active!==!1;Object.defineProperty(Y,"active",{configurable:!1,get:function(){return xe}});var de=N.loadable===!0;Object.defineProperty(Y,"loadable",{configurable:!1,get:function(){return de}});var ce=N.derived_id;Object.defineProperty(Y,"derivedId",{configurable:!1,get:function(){return ce}});var le=N.derived_id_str;Object.defineProperty(Y,"derivedIdStr",{configurable:!1,get:function(){return le}});var ue=(b=(g=(y=(p=n.panorama)===null||p===void 0?void 0:p.pano_high_cube_base_url)!==null&&y!==void 0?y:(v=n.panorama)===null||v===void 0?void 0:v.pano_cube_base_url)!==null&&g!==void 0?g:(E=n.panorama)===null||E===void 0?void 0:E.base_url)!==null&&b!==void 0?b:"",oe={up:panoURL(B,ue,N.images?N.images.up:N.up,Z,t),down:panoURL(B,ue,N.images?N.images.down:N.down,Z,t),right:panoURL(B,ue,N.images?N.images.right:N.right,Z,t),left:panoURL(B,ue,N.images?N.images.left:N.left,Z,t),front:panoURL(B,ue,N.images?N.images.front:N.front,Z,t),back:panoURL(B,ue,N.images?N.images.back:N.back,Z,t)};if(N.size_list)oe.sizeList=N.size_list.slice();else{var Te=getImageSizeFromURL(oe.up);if(Te&&(oe.sizeList=[Te],N.tiles))for(var Re=N.tiles.slice().sort(function(_e,Pe){return _e-Pe}).map(function(_e){return 512*Math.pow(2,_e)}),Ie=0,lt=Re;Ie<lt.length;Ie++){var ye=lt[Ie];ye>Te&&oe.sizeList.push(ye)}}var we=N.images?N.images.luminance:N.luminance;we&&(oe.luminance=Object.freeze({up:panoURL(B,ue,we.up,Z,t),down:panoURL(B,ue,we.down,Z,t),right:panoURL(B,ue,we.right,Z,t),left:panoURL(B,ue,we.left,Z,t),front:panoURL(B,ue,we.front,Z,t),back:panoURL(B,ue,we.back,Z,t)}));var Be=void 0;if(N.images)Be=N.images.tiles;else if(Array.isArray(N.size_list)){var Je=N.size_list.slice().sort(function(_e,Pe){return _e-Pe});if(Je[0]){var ht=getTileLevel(Je[0]);if(ht)for(var Xe=ht-1;Xe>=0;Xe--)Je.unshift(512*Math.pow(2,Xe));Be=Je}}else Array.isArray(N.tiles)&&(Be=N.tiles.slice(),typeof Be[0]=="number"&&(Be=Be.sort(function(_e,Pe){return _e-Pe}).map(function(_e){return 512*Math.pow(2,_e)})));if(Be){for(var Ve=[],We=0,it=Be;We<it.length;We++){var ye=it[We];if(typeof ye=="number"){var Ue=getTileLevel(ye);if(typeof Ue!="number")continue;var je=getImageSizeFromURL(oe.front);if(!je)continue;if(ye>je){var ze=replaceImageSize(oe.up,ye),He=replaceImageSize(oe.down,ye),be=replaceImageSize(oe.right,ye),$e=replaceImageSize(oe.left,ye),Fe=replaceImageSize(oe.front,ye),et=replaceImageSize(oe.back,ye);Ve.push(Object.freeze({level:Ue,size:ye,scale:1,up:ze,down:He,right:be,left:$e,front:Fe,back:et}))}else{var ze=oe.up,He=oe.down,be=oe.right,$e=oe.left,Fe=oe.front,et=oe.back;Ve.push(Object.freeze({level:Ue,size:je,scale:ye/je,up:ze,down:He,right:be,left:$e,front:Fe,back:et}))}}else{var Ue=ye.level;if(typeof Ue!="number")continue;var Te=ye.size;if(typeof Te!="number")continue;var ze=panoURL(B,ue,ye.up,Z,t),He=panoURL(B,ue,ye.down,Z,t),be=panoURL(B,ue,ye.right,Z,t),$e=panoURL(B,ue,ye.left,Z,t),Fe=panoURL(B,ue,ye.front,Z,t),et=panoURL(B,ue,ye.back,Z,t);Ve.push(Object.freeze({level:Ue,size:Te,scale:(T=ye.scale)!==null&&T!==void 0?T:1,up:ze,down:He,right:be,left:$e,front:Fe,back:et}))}}Ve=sortTile(Ve),Object.freeze(Ve),Object.defineProperty(oe,"tiles",{configurable:!1,get:function(){return Ve}})}Object.freeze(oe),Object.defineProperty(Y,"images",{configurable:!1,get:function(){return oe}});var tt=new THREE__namespace.Vector3;if(N.position instanceof THREE__namespace.Vector3)tt.copy(N.position);else if(Array.isArray(N.position))tt.fromArray(N.position);else return"break";Object.freeze(tt),Object.defineProperty(Y,"position",{configurable:!1,get:function(){return tt}});var Qe=new THREE__namespace.Vector3;if(N.standingPosition instanceof THREE__namespace.Vector3)Qe.copy(N.standingPosition);else if(Array.isArray(N.standingPosition))Qe.fromArray(N.standingPosition);else if(N.standing_position instanceof THREE__namespace.Vector3)Qe.copy(N.standing_position);else if(Array.isArray(N.standing_position))Qe.fromArray(N.standing_position);else return"break";Object.freeze(Qe),Object.defineProperty(Y,"standingPosition",{configurable:!1,get:function(){return Qe}});var Ne=new THREE__namespace.Quaternion;if(N.quaternion instanceof THREE__namespace.Quaternion)Ne.copy(N.quaternion);else if(Array.isArray(N.quaternion))Ne.fromArray(N.quaternion);else if(N.quaternion){var rt=N.quaternion,ot=rt.x,pt=rt.y,ct=rt.z,dt=rt.w;Ne.set(ot,pt,ct,dt)}else return"break";Object.freeze(Ne),Object.defineProperty(Y,"quaternion",{configurable:!1,get:function(){return Ne}});var Ge=0;isNumber(N.floorIndex)?Ge=N.floorIndex:isNumber(N.floor_index)?Ge=N.floor_index:isNumber(N.floor)&&(Ge=N.floor),Object.defineProperty(Y,"floorIndex",{configurable:!1,get:function(){return Ge}});var Me;N.video&&(Me={},typeof N.video.source=="string"&&(Me.source=N.video.source),N.video.matrix instanceof THREE__namespace.Matrix4?Me.matrix=N.video.matrix.clone():Array.isArray(N.video.matrix)&&(Me.matrix=new THREE__namespace.Matrix4().fromArray(N.video.matrix)),N.video.size instanceof THREE__namespace.Vector2?Me.size=N.video.size.clone():Array.isArray(N.video.size)&&(Me.size=new THREE__namespace.Vector2().fromArray(N.video.size)),Me.source&&Me.matrix&&Me.size&&(Y.video=Me)),Object.freeze(Me),Object.defineProperty(Y,"video",{configurable:!1,get:function(){return Me}}),Array.isArray(N.accessibleNodes)?(Y.accessibleNodes=N.accessibleNodes.slice(),Y.accessibleIds=N.accessibleNodes.map(function(_e){return panoStringify({workCode:e.workCode,panoIndex:_e})})):Array.isArray(N.accessible_nodes)&&(Y.accessibleNodes=N.accessible_nodes.slice(),Y.accessibleIds=N.accessible_nodes.map(function(_e){return panoStringify({workCode:e.workCode,panoIndex:_e})})),Array.isArray(N.visibleNodes)?(Y.visibleNodes=N.visibleNodes.slice(),Y.visibleIds=N.visibleNodes.map(function(_e){return panoStringify({workCode:e.workCode,panoIndex:_e})})):Array.isArray(N.visible_nodes)&&(Y.visibleNodes=N.visible_nodes.slice(),Y.visibleIds=N.visible_nodes.map(function(_e){return panoStringify({workCode:e.workCode,panoIndex:_e})})),j[Z]=Y},ne=0;ne<n.observers.length;ne++){var ee=$(ne);if(ee==="break")break}}for(var fe=function(Z){if(Z.accessibleIds){var Ee=Z.accessibleIds.filter(function(ue){return W.has(ue)});Object.freeze(Ee),Object.defineProperty(Z,"accessibleIds",{configurable:!1,get:function(){return Ee}})}else{for(var Y=[],N=0;N<j.length;N++)j[N]!==Z&&(Math.abs(j[N].position.y-Z.position.y)>3||j[N].position.distanceTo(Z.position)>10||Y.push(j[N].panoId));Object.freeze(Y),Object.defineProperty(Z,"accessibleIds",{configurable:!1,get:function(){return Y}})}if(Z.accessibleNodes){var ve=Z.accessibleNodes.filter(function(ue){return re.has(ue)});Object.freeze(ve),Object.defineProperty(Z,"accessibleNodes",{configurable:!1,get:function(){return ve}})}else{for(var ge=[],N=0;N<j.length;N++)j[N]!==Z&&(Math.abs(j[N].position.y-Z.position.y)>3||j[N].position.distanceTo(Z.position)>10||ge.push(j[N].panoIndex));Object.freeze(ge),Object.defineProperty(Z,"accessibleNodes",{configurable:!1,get:function(){return ge}})}if(Z.visibleIds){var de=Z.visibleIds.filter(function(ue){return W.has(ue)});Object.freeze(de),Object.defineProperty(Z,"visibleIds",{configurable:!1,get:function(){return de}})}else{var xe=Z.accessibleIds.slice();Object.freeze(xe),Object.defineProperty(Z,"visibleIds",{configurable:!1,get:function(){return xe}})}if(Z.visibleNodes){var le=Z.visibleNodes.filter(function(ue){return re.has(ue)});Object.freeze(le),Object.defineProperty(Z,"visibleNodes",{configurable:!1,get:function(){return le}})}else{var ce=Z.accessibleNodes.slice();Object.freeze(ce),Object.defineProperty(Z,"visibleNodes",{configurable:!1,get:function(){return ce}})}},ie=0,se=j;ie<se.length;ie++){var Ae=se[ie];fe(Ae)}Object.freeze(j),Object.defineProperty(e,"observers",{configurable:!1,get:function(){return j}})}if(I instanceof Error)return I;if(n.initial){if((n.initial.mode==="Panorama"&&e.observers.length===0||n.initial.mode==="Floorplan"||n.initial.mode==="Topview"||n.initial.mode==="Model"||n.initial.mode==="Mapview"||n.initial.mode==="DepthPanorama")&&(e.initial.mode=n.initial.mode),isNumber(n.initial.latitude)&&(e.initial.latitude=n.initial.latitude),isNumber(n.initial.longitude)?e.initial.longitude=n.initial.longitude:isNumber(n.initial.heading)&&(e.initial.longitude=headingToLongitude(n.initial.heading)),isNumber(n.initial.fov)&&(e.initial.fov=n.initial.fov),e.observers.length>0){var he=void 0;isNumber(n.initial.panoIndex)?he=n.initial.panoIndex:isNumber(n.initial.pano_index)?he=n.initial.pano_index:isNumber(n.initial.pano)&&(he=n.initial.pano),typeof he=="number"&&(he=clamp$1(he,0,e.observers.length-1),e.initial.panoIndex=he)}if(isNumber(n.initial.distance)&&(e.initial.distance=n.initial.distance),Array.isArray(n.initial.offset)){var me=[0,0,0].map(function(Z,Y){var N=Number(n.initial.offset[Y]);return isNaN(N)||!isFinite(N)?0:N});e.initial.offset=new THREE__namespace.Vector3().fromArray(me)}!e.initial.mode&&typeof e.initial.panoIndex=="number"&&(e.initial.mode="Panorama")}return I instanceof Error?I:(workRawMapping.set(e,{works:R,options:x}),e)}function parseWork(n,t){typeof n=="string"&&n.trim()[0]==="{"&&(n=JSON.parse(n));var e=workRawMapping.get(n);if(e){if(t&&!equal(JSON.parse(e.options),t))throw new Error("[PARSE FAILED]: work is parsed with different options.");return n}else try{return new Work(n,t!=null?t:{})}catch(r){throw new Error("[PARSE FAILED]: "+r.message+`
930
+ `+JSON.stringify(t))}return n.prototype.toJSON=function(){return this.raw},n.parse=parseWork,n}();function getType(n){return n==null?"null":Array.isArray(n)?"array":typeof n=="object"?"dict":"value"}function deepMerge(n,t){var e=getType(n),r=getType(t);if(r==="null")return n;if(r==="value")return t;if(r!==e)return JSON.parse(JSON.stringify(t));if(r==="array")for(var i=0;i<t.length;i++)n[i]=deepMerge(n[i],t[i]);else if(r==="dict")for(var o in t)n[o]=deepMerge(n[o],t[o]);return n}function startWithString(n,t){return n.indexOf(t)===0}function urlWithParseOptions(n,t,e,r){var i,o=t;if(r.jsonp===!0){o=t.replace(/([\?\#].*)?$/i,"");var s=sha256("".concat(o)).slice(0,7);o="".concat(o,".").concat(s,".jsonp")}if(r.shortPath===!0){var u=o.replace(n,"").split("."),c=(i=u.shift())!==null&&i!==void 0?i:"",l=u.join(".");o=pathJoin(n,sha256(c))+(l?"."+l:"")}var d=o.replace(n,"");return r.baseURL&&(o=pathJoin(r.baseURL,d)),r.traverseResource&&r.traverseResource({origin:t,absolute:o,relative:d,type:e}),o}function panoURL(n,t,e,r,i){var o=e;return isAbsoluteURL(e)||(t&&(t=pathJoin(t,String(r))),o=pathJoin(t,o)),isAbsoluteURL(o)||(o=pathJoin(n,o)),startWithString(o,n)||console.warn("".concat(o," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,o,"panorama",i)}function fileURL(n,t,e){var r=t;return isAbsoluteURL(r)||(r=pathJoin(n,t)),startWithString(r,n)||console.warn("".concat(r," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,r,"model",e)}function textureURL$1(n,t,e,r){var i=t;return isAbsoluteURL(i)||(i=pathJoin(e,i)),isAbsoluteURL(i)||(i=pathJoin(n,i)),startWithString(i,n)||console.warn("".concat(i," is not start with base_url(").concat(n,").")),urlWithParseOptions(n,i,"texture",r)}var getTileLevel=function(n){for(var t=10;t>=0;t--){var e=512*Math.pow(2,t);if(e<=n)return t}return null},sortTile=function(n){n=n.slice().sort(function(s,u){return s.level-u.level});for(var t=[],e=0,r=n;e<r.length;e++){var i=r[e];if(t.length===0){t.push(i);continue}var o=t[t.length-1];if(i.level>o.level){t.push(i);continue}if(i.size>o.size){t[t.length-1]=i;continue}}return t};function parse(n,t,e){for(var r,i,o,s,u,c,l,d,f,m,A,h,p,y,v,g,E,b,T,x=JSON.stringify(t),R=[],_=0,M=[].concat(n);_<M.length;_++){var S=M[_];S instanceof Work?R.push.apply(R,S.raw.works):typeof S=="string"?R.push(S):R.push(JSON.stringify(S))}var I=verify(R);if(I instanceof Error)return I;Array.isArray(t.transform)?e.transform.fromArray(t.transform):t.transform&&e.transform.copy(t.transform),n=R.map(function(Z){return JSON.parse(Z)}).reduce(function(Z,Y){return deepMerge(Z,Y)}),Object.defineProperty(e,"raw",{configurable:!1,get:function(){return{works:R,options:x}}});{var C;if(t.workCode&&(typeof t.workCode=="string"?C=t.workCode:typeof t.workCode=="function"&&(C=t.workCode(n))),typeof C=="undefined"&&(C=String(n.resource_code||n.basic_code||n.vr_code||n.code||n.project_id||n.work_code||n.workCode)),typeof C=="undefined")return new Error("WorkCode never matched.");Object.defineProperty(e,"workCode",{configurable:!1,get:function(){return C}})}{var H=String(n.name);Object.defineProperty(e,"name",{configurable:!1,get:function(){return H}})}if(I instanceof Error)return I;Object.defineProperty(e,"issuer",{configurable:!1,get:function(){return I.issuer}}),Object.defineProperty(e,"expire",{configurable:!1,get:function(){return I.expire}}),Object.defineProperty(e,"allowHosts",{configurable:!1,get:function(){return I.allowHosts}});var B=(r=n.base_url)!==null&&r!==void 0?r:"";if(B&&B[B.length-1]!=="/"&&(B+="/"),I instanceof Error)return I;if(n.model){var L={work:e,layers:[]},O;n.model.file?O=fileURL(B,n.model.file,t):n.model.file_url&&(O=fileURL(B,n.model.file_url,t)),Object.defineProperty(L,"file",{configurable:!1,get:function(){return O}});var k;n.model.textureBase?k=textureURL$1(B,"",n.model.textureBase,t):n.model.material_base_url?k=textureURL$1(B,"",n.model.material_base_url,t):L.file&&(k=L.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),Object.defineProperty(L,"textureBase",{configurable:!1,get:function(){return k}});var G;Array.isArray(n.model.textures)?(G=n.model.textures.map(function(Z){var Y,N;return textureURL$1(B,Z,(N=(Y=n.model.textureBase)!==null&&Y!==void 0?Y:n.model.material_base_url)!==null&&N!==void 0?N:"",t)}),Object.freeze(G)):Array.isArray(n.model.material_textures)&&(G=n.model.material_textures.map(function(Z){var Y,N;return textureURL$1(B,Z,(N=(Y=n.model.textureBase)!==null&&Y!==void 0?Y:n.model.material_base_url)!==null&&N!==void 0?N:"",t)}),Object.freeze(G)),Object.defineProperty(L,"textures",{configurable:!1,get:function(){return G}});var z=[];if(Array.isArray(n.model.tiles))for(var D=0,U=n.model.tiles;D<U.length;D++){var K=U[D];K&&(K.tileset||K.tileset_url)&&z.push(Object.freeze({type:(i=K.type)!==null&&i!==void 0?i:"mesh",name:(o=K.name)!==null&&o!==void 0?o:"",upAxis:(u=(s=K.upAxis)!==null&&s!==void 0?s:K.up_axis)!==null&&u!==void 0?u:"-Y",tileset:fileURL(B,K.tileset||K.tileset_url,t)}))}else n.model.tiles&&(n.model.tiles.tileset||n.model.tiles.tileset_url)&&z.push(Object.freeze({type:(c=n.model.tiles.type)!==null&&c!==void 0?c:"mesh",name:(l=n.model.tiles.name)!==null&&l!==void 0?l:"lod",upAxis:(f=(d=n.model.tiles.upAxis)!==null&&d!==void 0?d:n.model.tiles.up_axis)!==null&&f!==void 0?f:"-Y",tileset:fileURL(B,n.model.tiles.tileset||n.model.tiles.tileset_url,t)}));if(Array.isArray(n.model.layers))for(var Q=0,q=n.model.layers;Q<q.length;Q++){var J=q[Q];J&&(J.tileset||J.tileset_url)&&z.push(Object.freeze({type:(m=J.type)!==null&&m!==void 0?m:"mesh",name:(A=J.name)!==null&&A!==void 0?A:"",upAxis:(h=J.upAxis)!==null&&h!==void 0?h:J.up_axis,tileset:fileURL(B,J.tileset||J.tileset_url,t)}))}Object.freeze(z),Object.defineProperty(L,"layers",{configurable:!1,get:function(){return z}}),Object.defineProperty(e,"model",{configurable:!1,get:function(){if(L.file||L.layers.length)return L}})}if(I instanceof Error)return I;var j=new Set,re=new Set;{var W=[];if(n.observers&&Array.isArray(n.observers)){var te=[];n.panorama&&(Array.isArray(n.panorama)?te=n.panorama:Array.isArray(n.panorama.list)?te=n.panorama.list:Array.isArray(n.panorama.info)&&(te=n.panorama.info));for(var $=function(Z){var Y={},N=n.observers[Z];if(!N)return"break";var Ee=te[Z];if(!Ee)return"break";N=Object.assign({},N,Ee,{active:N.active!==!1&&Ee.active!==!1}),Object.defineProperty(Y,"work",{configurable:!1,get:function(){return e}}),Object.defineProperty(Y,"index",{configurable:!1,get:function(){return Z}}),re.add(Z),Object.defineProperty(Y,"panoIndex",{configurable:!1,get:function(){return Z}});var ge=panoStringify({workCode:e.workCode,panoIndex:Z});j.add(ge),Object.defineProperty(Y,"panoId",{configurable:!1,get:function(){return ge}});var ve=Object.freeze({workCode:e.workCode,panoIndex:Z});Object.defineProperty(Y,"pano",{configurable:!1,get:function(){return ve}});var xe=N.active!==!1;Object.defineProperty(Y,"active",{configurable:!1,get:function(){return xe}});var de=N.loadable===!0;Object.defineProperty(Y,"loadable",{configurable:!1,get:function(){return de}});var ce=N.derived_id;Object.defineProperty(Y,"derivedId",{configurable:!1,get:function(){return ce}});var le=N.derived_id_str;Object.defineProperty(Y,"derivedIdStr",{configurable:!1,get:function(){return le}});var ue=(b=(g=(y=(p=n.panorama)===null||p===void 0?void 0:p.pano_high_cube_base_url)!==null&&y!==void 0?y:(v=n.panorama)===null||v===void 0?void 0:v.pano_cube_base_url)!==null&&g!==void 0?g:(E=n.panorama)===null||E===void 0?void 0:E.base_url)!==null&&b!==void 0?b:"",oe={up:panoURL(B,ue,N.images?N.images.up:N.up,Z,t),down:panoURL(B,ue,N.images?N.images.down:N.down,Z,t),right:panoURL(B,ue,N.images?N.images.right:N.right,Z,t),left:panoURL(B,ue,N.images?N.images.left:N.left,Z,t),front:panoURL(B,ue,N.images?N.images.front:N.front,Z,t),back:panoURL(B,ue,N.images?N.images.back:N.back,Z,t)};if(N.size_list)oe.sizeList=N.size_list.slice();else{var Te=getImageSizeFromURL(oe.up);if(Te&&(oe.sizeList=[Te],N.tiles))for(var Re=N.tiles.slice().sort(function(_e,Pe){return _e-Pe}).map(function(_e){return 512*Math.pow(2,_e)}),Ie=0,lt=Re;Ie<lt.length;Ie++){var ye=lt[Ie];ye>Te&&oe.sizeList.push(ye)}}var we=N.images?N.images.luminance:N.luminance;we&&(oe.luminance=Object.freeze({up:panoURL(B,ue,we.up,Z,t),down:panoURL(B,ue,we.down,Z,t),right:panoURL(B,ue,we.right,Z,t),left:panoURL(B,ue,we.left,Z,t),front:panoURL(B,ue,we.front,Z,t),back:panoURL(B,ue,we.back,Z,t)}));var Be=void 0;if(N.images)Be=N.images.tiles;else if(Array.isArray(N.size_list)){var Je=N.size_list.slice().sort(function(_e,Pe){return _e-Pe});if(Je[0]){var ht=getTileLevel(Je[0]);if(ht)for(var Xe=ht-1;Xe>=0;Xe--)Je.unshift(512*Math.pow(2,Xe));Be=Je}}else Array.isArray(N.tiles)&&(Be=N.tiles.slice(),typeof Be[0]=="number"&&(Be=Be.sort(function(_e,Pe){return _e-Pe}).map(function(_e){return 512*Math.pow(2,_e)})));if(Be){for(var Ve=[],je=0,it=Be;je<it.length;je++){var ye=it[je];if(typeof ye=="number"){var Ue=getTileLevel(ye);if(typeof Ue!="number")continue;var We=getImageSizeFromURL(oe.front);if(!We)continue;if(ye>We){var ze=replaceImageSize(oe.up,ye),He=replaceImageSize(oe.down,ye),be=replaceImageSize(oe.right,ye),$e=replaceImageSize(oe.left,ye),Fe=replaceImageSize(oe.front,ye),et=replaceImageSize(oe.back,ye);Ve.push(Object.freeze({level:Ue,size:ye,scale:1,up:ze,down:He,right:be,left:$e,front:Fe,back:et}))}else{var ze=oe.up,He=oe.down,be=oe.right,$e=oe.left,Fe=oe.front,et=oe.back;Ve.push(Object.freeze({level:Ue,size:We,scale:ye/We,up:ze,down:He,right:be,left:$e,front:Fe,back:et}))}}else{var Ue=ye.level;if(typeof Ue!="number")continue;var Te=ye.size;if(typeof Te!="number")continue;var ze=panoURL(B,ue,ye.up,Z,t),He=panoURL(B,ue,ye.down,Z,t),be=panoURL(B,ue,ye.right,Z,t),$e=panoURL(B,ue,ye.left,Z,t),Fe=panoURL(B,ue,ye.front,Z,t),et=panoURL(B,ue,ye.back,Z,t);Ve.push(Object.freeze({level:Ue,size:Te,scale:(T=ye.scale)!==null&&T!==void 0?T:1,up:ze,down:He,right:be,left:$e,front:Fe,back:et}))}}Ve=sortTile(Ve),Object.freeze(Ve),Object.defineProperty(oe,"tiles",{configurable:!1,get:function(){return Ve}})}Object.freeze(oe),Object.defineProperty(Y,"images",{configurable:!1,get:function(){return oe}});var tt=new THREE__namespace.Vector3;if(N.position instanceof THREE__namespace.Vector3)tt.copy(N.position);else if(Array.isArray(N.position))tt.fromArray(N.position);else return"break";Object.freeze(tt),Object.defineProperty(Y,"position",{configurable:!1,get:function(){return tt}});var Qe=new THREE__namespace.Vector3;if(N.standingPosition instanceof THREE__namespace.Vector3)Qe.copy(N.standingPosition);else if(Array.isArray(N.standingPosition))Qe.fromArray(N.standingPosition);else if(N.standing_position instanceof THREE__namespace.Vector3)Qe.copy(N.standing_position);else if(Array.isArray(N.standing_position))Qe.fromArray(N.standing_position);else return"break";Object.freeze(Qe),Object.defineProperty(Y,"standingPosition",{configurable:!1,get:function(){return Qe}});var Ne=new THREE__namespace.Quaternion;if(N.quaternion instanceof THREE__namespace.Quaternion)Ne.copy(N.quaternion);else if(Array.isArray(N.quaternion))Ne.fromArray(N.quaternion);else if(N.quaternion){var rt=N.quaternion,ot=rt.x,pt=rt.y,ct=rt.z,dt=rt.w;Ne.set(ot,pt,ct,dt)}else return"break";Object.freeze(Ne),Object.defineProperty(Y,"quaternion",{configurable:!1,get:function(){return Ne}});var Ge=0;isNumber(N.floorIndex)?Ge=N.floorIndex:isNumber(N.floor_index)?Ge=N.floor_index:isNumber(N.floor)&&(Ge=N.floor),Object.defineProperty(Y,"floorIndex",{configurable:!1,get:function(){return Ge}});var Me;N.video&&(Me={},typeof N.video.source=="string"&&(Me.source=N.video.source),N.video.matrix instanceof THREE__namespace.Matrix4?Me.matrix=N.video.matrix.clone():Array.isArray(N.video.matrix)&&(Me.matrix=new THREE__namespace.Matrix4().fromArray(N.video.matrix)),N.video.size instanceof THREE__namespace.Vector2?Me.size=N.video.size.clone():Array.isArray(N.video.size)&&(Me.size=new THREE__namespace.Vector2().fromArray(N.video.size)),Me.source&&Me.matrix&&Me.size&&(Y.video=Me)),Object.freeze(Me),Object.defineProperty(Y,"video",{configurable:!1,get:function(){return Me}}),Array.isArray(N.accessibleNodes)?(Y.accessibleNodes=N.accessibleNodes.slice(),Y.accessibleIds=N.accessibleNodes.map(function(_e){return panoStringify({workCode:e.workCode,panoIndex:_e})})):Array.isArray(N.accessible_nodes)&&(Y.accessibleNodes=N.accessible_nodes.slice(),Y.accessibleIds=N.accessible_nodes.map(function(_e){return panoStringify({workCode:e.workCode,panoIndex:_e})})),Array.isArray(N.visibleNodes)?(Y.visibleNodes=N.visibleNodes.slice(),Y.visibleIds=N.visibleNodes.map(function(_e){return panoStringify({workCode:e.workCode,panoIndex:_e})})):Array.isArray(N.visible_nodes)&&(Y.visibleNodes=N.visible_nodes.slice(),Y.visibleIds=N.visible_nodes.map(function(_e){return panoStringify({workCode:e.workCode,panoIndex:_e})})),W[Z]=Y},ne=0;ne<n.observers.length;ne++){var ee=$(ne);if(ee==="break")break}}for(var fe=function(Z){if(Z.accessibleIds){var Ee=Z.accessibleIds.filter(function(ue){return j.has(ue)});Object.freeze(Ee),Object.defineProperty(Z,"accessibleIds",{configurable:!1,get:function(){return Ee}})}else{for(var Y=[],N=0;N<W.length;N++)W[N]!==Z&&(Math.abs(W[N].position.y-Z.position.y)>3||W[N].position.distanceTo(Z.position)>10||Y.push(W[N].panoId));Object.freeze(Y),Object.defineProperty(Z,"accessibleIds",{configurable:!1,get:function(){return Y}})}if(Z.accessibleNodes){var ve=Z.accessibleNodes.filter(function(ue){return re.has(ue)});Object.freeze(ve),Object.defineProperty(Z,"accessibleNodes",{configurable:!1,get:function(){return ve}})}else{for(var ge=[],N=0;N<W.length;N++)W[N]!==Z&&(Math.abs(W[N].position.y-Z.position.y)>3||W[N].position.distanceTo(Z.position)>10||ge.push(W[N].panoIndex));Object.freeze(ge),Object.defineProperty(Z,"accessibleNodes",{configurable:!1,get:function(){return ge}})}if(Z.visibleIds){var de=Z.visibleIds.filter(function(ue){return j.has(ue)});Object.freeze(de),Object.defineProperty(Z,"visibleIds",{configurable:!1,get:function(){return de}})}else{var xe=Z.accessibleIds.slice();Object.freeze(xe),Object.defineProperty(Z,"visibleIds",{configurable:!1,get:function(){return xe}})}if(Z.visibleNodes){var le=Z.visibleNodes.filter(function(ue){return re.has(ue)});Object.freeze(le),Object.defineProperty(Z,"visibleNodes",{configurable:!1,get:function(){return le}})}else{var ce=Z.accessibleNodes.slice();Object.freeze(ce),Object.defineProperty(Z,"visibleNodes",{configurable:!1,get:function(){return ce}})}},ie=0,se=W;ie<se.length;ie++){var Ae=se[ie];fe(Ae)}Object.freeze(W),Object.defineProperty(e,"observers",{configurable:!1,get:function(){return W}})}if(I instanceof Error)return I;if(n.initial){if((n.initial.mode==="Panorama"&&e.observers.length===0||n.initial.mode==="Floorplan"||n.initial.mode==="Topview"||n.initial.mode==="Model"||n.initial.mode==="Mapview"||n.initial.mode==="DepthPanorama")&&(e.initial.mode=n.initial.mode),isNumber(n.initial.latitude)&&(e.initial.latitude=n.initial.latitude),isNumber(n.initial.longitude)?e.initial.longitude=n.initial.longitude:isNumber(n.initial.heading)&&(e.initial.longitude=headingToLongitude(n.initial.heading)),isNumber(n.initial.fov)&&(e.initial.fov=n.initial.fov),e.observers.length>0){var he=void 0;isNumber(n.initial.panoIndex)?he=n.initial.panoIndex:isNumber(n.initial.pano_index)?he=n.initial.pano_index:isNumber(n.initial.pano)&&(he=n.initial.pano),typeof he=="number"&&(he=clamp$1(he,0,e.observers.length-1),e.initial.panoIndex=he)}if(isNumber(n.initial.distance)&&(e.initial.distance=n.initial.distance),Array.isArray(n.initial.offset)){var me=[0,0,0].map(function(Z,Y){var N=Number(n.initial.offset[Y]);return isNaN(N)||!isFinite(N)?0:N});e.initial.offset=new THREE__namespace.Vector3().fromArray(me)}!e.initial.mode&&typeof e.initial.panoIndex=="number"&&(e.initial.mode="Panorama")}return I instanceof Error?I:(workRawMapping.set(e,{works:R,options:x}),e)}function parseWork(n,t){typeof n=="string"&&n.trim()[0]==="{"&&(n=JSON.parse(n));var e=workRawMapping.get(n);if(e){if(t&&!equal(JSON.parse(e.options),t))throw new Error("[PARSE FAILED]: work is parsed with different options.");return n}else try{return new Work(n,t!=null?t:{})}catch(r){throw new Error("[PARSE FAILED]: "+r.message+`
931
931
  Error work input:
932
- `+JSON.stringify(n))}}function createWorks(n){for(var t={},e=[],r={},i=0,o=n;i<o.length;i++){var s=o[i],u=t[s.workCode];u||(u=t[s.workCode]=new THREE__namespace.Matrix4().copy(s.options.transform));for(var c=0,l=s.observers;c<l.length;c++){var d=l[c],f={isResolved:!0,active:d.active,accessibleIds:d.accessibleIds,visibleIds:d.visibleIds,accessibleNodes:d.accessibleNodes,visibleNodes:d.visibleNodes,floorIndex:d.floorIndex,images:d.images,index:d.index,panoIndex:d.panoIndex,loadable:d.loadable,panoId:d.panoId,pano:d.pano,work:d.work,derivedId:d.derivedId,video:d.video,position:new THREE__namespace.Vector3().copy(d.position).applyMatrix4(u),standingPosition:new THREE__namespace.Vector3().copy(d.standingPosition).applyMatrix4(u),quaternion:new THREE__namespace.Quaternion().setFromRotationMatrix(scratchMatrix4$1.makeRotationFromQuaternion(d.quaternion).premultiply(u))};Object.freeze(f),e.push(f),r[f.panoId]=f}}Object.freeze(e);for(var m=n.slice(),A={},h=0,p=m;h<p.length;h++){var s=p[h];A[s.workCode]=s}return Object.freeze(Object.assign(m,{get initial(){return m.length>0?m[0].initial:{work:{}}},get resolvedObservers(){return e},getWork:function(y){return A[y]},getResolvedObserver:function(y){var v,g;return isPanoId(y)?r[y]:typeof y=="number"?r[panoStringify({workCode:(g=(v=n[0])===null||v===void 0?void 0:v.workCode)!==null&&g!==void 0?g:"",panoIndex:y})]:r[panoStringify(y)]},update:function(){for(var y={},v=0,g=m;v<g.length;v++){var E=g[v],b=E.options.transform,T=t[E.workCode];T?T.equals(b)||(T.copy(b),y[E.workCode]=!0):(t[E.workCode]=new THREE__namespace.Matrix4().copy(b),y[E.workCode]=!0)}for(var x=0,R=e;x<R.length;x++){var _=R[x];if(y[_.work.workCode]===!0){var M=_.work.observers[_.index],S=_.work.options.transform;_.position.copy(M.position).applyMatrix4(S),_.standingPosition.copy(M.standingPosition).applyMatrix4(S),_.quaternion.setFromRotationMatrix(scratchMatrix4$1.makeRotationFromQuaternion(M.quaternion).premultiply(S))}}}}))}var fetcherMap=new Map;function getFetcher(n){var t=fetcherMap.get(n);if(t)return t;throw new Error("fetcher never registered.")}function registerFetcher(n,t){return fetcherMap.set(n,t)}var BufferGeometryUtils={computeTangents:function(n){var t=n.index,e=n.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");return}var r=t.array,i=e.position.array,o=e.normal.array,s=e.uv.array,u=i.length/3;e.tangent===void 0&&n.setAttribute("tangent",new THREE__namespace.BufferAttribute(new Float32Array(4*u),4));for(var c=e.tangent.array,l=[],d=[],f=0;f<u;f++)l[f]=new THREE__namespace.Vector3,d[f]=new THREE__namespace.Vector3;var m=new THREE__namespace.Vector3,A=new THREE__namespace.Vector3,h=new THREE__namespace.Vector3,p=new THREE__namespace.Vector2,y=new THREE__namespace.Vector2,v=new THREE__namespace.Vector2,g=new THREE__namespace.Vector3,E=new THREE__namespace.Vector3;function b(D,U,K){m.fromArray(i,D*3),A.fromArray(i,U*3),h.fromArray(i,K*3),p.fromArray(s,D*2),y.fromArray(s,U*2),v.fromArray(s,K*2);var Q=A.x-m.x,q=h.x-m.x,J=A.y-m.y,W=h.y-m.y,re=A.z-m.z,j=h.z-m.z,te=y.x-p.x,$=v.x-p.x,ne=y.y-p.y,ee=v.y-p.y,fe=1/(te*ee-$*ne);g.set((ee*Q-ne*q)*fe,(ee*J-ne*W)*fe,(ee*re-ne*j)*fe),E.set((te*q-$*Q)*fe,(te*W-$*J)*fe,(te*j-$*re)*fe),l[D].add(g),l[U].add(g),l[K].add(g),d[D].add(E),d[U].add(E),d[K].add(E)}var T=n.groups;T.length===0&&(T=[{start:0,count:r.length}]);for(var f=0,x=T.length;f<x;++f)for(var R=T[f],_=R.start,M=R.count,S=_,I=_+M;S<I;S+=3)b(r[S+0],r[S+1],r[S+2]);var C=new THREE__namespace.Vector3,H=new THREE__namespace.Vector3,B=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3,O,k,G;function z(D){B.fromArray(o,D*3),L.copy(B),k=l[D],C.copy(k),C.sub(B.multiplyScalar(B.dot(k))).normalize(),H.crossVectors(L,k),G=H.dot(d[D]),O=G<0?-1:1,c[D*4]=C.x,c[D*4+1]=C.y,c[D*4+2]=C.z,c[D*4+3]=O}for(var f=0,x=T.length;f<x;++f)for(var R=T[f],_=R.start,M=R.count,S=_,I=_+M;S<I;S+=3)z(r[S+0]),z(r[S+1]),z(r[S+2])},mergeBufferGeometries:function(n,t){for(var e=n[0].index!==null,r=new Set(Object.keys(n[0].attributes)),i=new Set(Object.keys(n[0].morphAttributes)),o={},s={},u=new THREE__namespace.BufferGeometry,c=0,l=0;l<n.length;++l){var d=n[l];if(e!==(d.index!==null))return null;for(var f in d.attributes){if(!r.has(f))return null;o[f]===void 0&&(o[f]=[]),o[f].push(d.attributes[f])}for(var f in d.morphAttributes){if(!i.has(f))return null;s[f]===void 0&&(s[f]=[]),s[f].push(d.morphAttributes[f])}if(u.userData.mergedUserData=u.userData.mergedUserData||[],u.userData.mergedUserData.push(d.userData),t){var m;if(e)m=d.index.count;else if(d.attributes.position!==void 0)m=d.attributes.position.count;else return null;u.addGroup(c,m,l),c+=m}}if(e){for(var A=0,h=[],l=0;l<n.length;++l){for(var p=n[l].index,y=0;y<p.count;++y)h.push(p.getX(y)+A);A+=n[l].attributes.position.count}u.setIndex(h)}for(var f in o){var v=this.mergeBufferAttributes(o[f]);if(!v)return null;u.setAttribute(f,v)}for(var f in s){var g=s[f][0].length;if(g===0)break;u.morphAttributes=u.morphAttributes||{},u.morphAttributes[f]=[];for(var l=0;l<g;++l){for(var E=[],y=0;y<s[f].length;++y)E.push(s[f][y][l]);var b=this.mergeBufferAttributes(E);if(!b)return null;u.morphAttributes[f].push(b)}}return u},mergeBufferAttributes:function(n){for(var t,e,r,i=0,o=0;o<n.length;++o){var s=n[o];if(s.isInterleavedBufferAttribute||(t===void 0&&(t=s.array.constructor),t!==s.array.constructor)||(e===void 0&&(e=s.itemSize),e!==s.itemSize)||(r===void 0&&(r=s.normalized),r!==s.normalized))return null;i+=s.array.length}for(var u=new t(i),c=0,o=0;o<n.length;++o)u.set(n[o].array,c),c+=n[o].array.length;return new THREE__namespace.BufferAttribute(u,e,r)},interleaveAttributes:function(n){for(var t,e=0,r=0,i=0,o=n.length;i<o;++i){var s=n[i];if(t===void 0&&(t=s.array.constructor),t!==s.array.constructor)return console.warn("AttributeBuffers of different types cannot be interleaved"),null;e+=s.array.length,r+=s.itemSize}for(var u=new THREE__namespace.InterleavedBuffer(new t(e),r),c=0,l=[],d=["getX","getY","getZ","getW"],f=["setX","setY","setZ","setW"],m=0,o=n.length;m<o;m++){var s=n[m],A=s.itemSize,h=s.count,p=new THREE__namespace.InterleavedBufferAttribute(u,A,c,s.normalized);l.push(p),c+=A;for(var y=0;y<h;y++)for(var v=0;v<A;v++)p[f[v]](y,s[d[v]](y))}return l},estimateBytesUsed:function(n){var t=0;for(var e in n.attributes){var r=n.getAttribute(e);t+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}var i=n.getIndex();return t+=i?i.count*i.itemSize*i.array.BYTES_PER_ELEMENT:0,t},mergeVertices:function(n,t){t===void 0&&(t=1e-4),t=Math.max(t,Number.EPSILON);for(var e={},r=n.getIndex(),i=n.getAttribute("position"),o=r?r.count:i.count,s=0,u=Object.keys(n.attributes),c={},l={},d=[],f=["getX","getY","getZ","getW"],m=0,A=u.length;m<A;m++){var h=u[m];c[h]=[];var p=n.morphAttributes[h];p&&(l[h]=new Array(p.length).fill().map(function(){return[]}))}for(var y=Math.log10(1/t),v=Math.pow(10,y),m=0;m<o;m++){for(var g=r?r.getX(m):m,E="",b=0,A=u.length;b<A;b++)for(var h=u[b],T=n.getAttribute(h),x=T.itemSize,R=0;R<x;R++)E+="".concat(~~(T[f[R]](g)*v),",");if(E in e)d.push(e[E]);else{for(var b=0,A=u.length;b<A;b++)for(var h=u[b],T=n.getAttribute(h),p=n.morphAttributes[h],x=T.itemSize,_=c[h],M=l[h],R=0;R<x;R++){var S=f[R];if(_.push(T[S](g)),p)for(var I=0,C=p.length;I<C;I++)M[I].push(p[I][S](g))}e[E]=s,d.push(s),s++}}for(var H=n.clone(),m=0,A=u.length;m<A;m++){var h=u[m],B=n.getAttribute(h),L=new B.array.constructor(c[h]),T=new THREE__namespace.BufferAttribute(L,B.itemSize,B.normalized);if(H.setAttribute(h,T),h in l)for(var b=0;b<l[h].length;b++){var O=n.morphAttributes[h][b],L=new O.array.constructor(l[h][b]),k=new THREE__namespace.BufferAttribute(L,O.itemSize,O.normalized);H.morphAttributes[h][b]=k}}return H.setIndex(d),H}};function isThirdPersonMode(n){switch(n){case"Floorplan":return!0;case"Mapview":return!0;default:return!1}}function isFristPersonMode(n){switch(n){case"Panorama":return!0;case"VRPanorama":return!0;case"XRPanorama":return!0;case"Model":return!0;default:return!1}}var scratchVector3=new THREE__namespace.Vector3,scratchSphere=new THREE__namespace.Sphere,scratchMatrix4=new THREE__namespace.Matrix4,scratchMatrix4Inverse=new THREE__namespace.Matrix4,scratchBoundingBox=new THREE__namespace.Box3,ROTATE_X_90_MATRIX=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),ROTATE_X_90_MATRIX_INVERSE=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),DEFAULT_BOUNDING=new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5));function getEcefToEnuMatrixFromUpAxis(n,t,e){switch(n){case"Z":break;case"Y":e.copy(ROTATE_X_90_MATRIX_INVERSE);break;case"-Y":e.copy(ROTATE_X_90_MATRIX);break;case"WGS84":case"GCJ02":case"BD09":getEcefToEnuMatrix(t,e);break;default:e.identity();break}return e}function getExt(n){var t=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(n);if(t){var e=String(t[1]).trim().split(".").slice(1).reverse()[0];if(e)return e}return""}var ModelViewLayer=function(){function n(t,e){this.scene=t,this.error=e,t.viewLayer=this}return Object.defineProperty(n.prototype,"name",{get:function(){return this.scene.name},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"type",{get:function(){return this.scene.type},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"upAxis",{get:function(){return this.scene.upAxis},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"groundHeight",{get:function(){return this.scene.groundHeight},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"model",{get:function(){return this.scene.model},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"coordinates",{get:function(){scratchVector3.setScalar(0);var t=this.scene.localToLla(scratchVector3),e=t.x,r=t.y;return[e,r].map(function(i){return(i/Math.PI*180).toFixed(6)}).join(",")},enumerable:!1,configurable:!0}),n.prototype.getTransformMatrix4=function(t){return t===void 0&&(t=new THREE__namespace.Matrix4),t.copy(this.scene.coordinateTransform.ecefToLocalMatrix),this.scene&&t.premultiply(this.scene.matrixWorld),t},n.prototype.coordinatesToWorldPoint=function(t){var e=new THREE__namespace.Vector3(t.latitude,t.longitude,t.altitude);return this.scene.llaToWorld(e)},n.prototype.worldPointToCoordinates=function(t){return scratchVector3.copy(t),this.scene.worldToLla(scratchVector3),{latitude:scratchVector3.x,longitude:scratchVector3.y,altitude:scratchVector3.z}},n}(),Model=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s=n.call(this)||this;return s.name="",s.onError=(r=e.onError)!==null&&r!==void 0?r:noop$1,s.onShownFloorChange=(i=e.onShownFloorChange)!==null&&i!==void 0?i:noop$1,s.onLoad=(o=e.onLoad)!==null&&o!==void 0?o:noop$1,s.work=null,s.viewLayers=[],s.bounding=new THREE__namespace.Box3(new THREE__namespace.Vector3,new THREE__namespace.Vector3),s.floorLength=0,s.textureOptions={},s.refined=!1,s.refineProgress=[0,0],s.loaded=!1,s.matrixAutoUpdate=!1,s.needsRender=!0,s.autoRefine=!0,s.materialVersion=0,s.materialParameters=__assign({},defaultPbmParameters),s.cacheCameras=[],s.disposed=!1,s}return Object.defineProperty(t.prototype,"empty",{get:function(){return this.viewLayers.length===0},enumerable:!1,configurable:!0}),t.prototype.getMaterial=function(){return __assign({},this.materialParameters)},t.prototype.setMaterial=function(e){var r=this.materialParameters.shownFloorIndex,i=updatePBMParameters(this.materialParameters,e);if(i){var o=this.materialParameters.shownFloorIndex;r!==o&&this.onShownFloorChange(o),this.materialVersion++,this.needsRender=!0}},Object.defineProperty(t.prototype,"brightness",{get:function(){return this.materialParameters.brightness},set:function(e){this.setMaterial({brightness:typeof e=="number"?e:1})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shownFloorIndex",{get:function(){return this.materialParameters.shownFloorIndex},set:function(e){this.setMaterial({shownFloorIndex:e})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shownFloor",{get:function(){return this.shownFloorIndex===-1?null:this.shownFloorIndex},set:function(e){this.shownFloorIndex=e===null?-1:e},enumerable:!1,configurable:!0}),t.prototype.show=function(e){this.shownFloor=e!=null?e:null},Object.defineProperty(t.prototype,"clippers",{get:function(){return this.materialParameters.clippers},set:function(e){this.setMaterial({clippers:e})},enumerable:!1,configurable:!0}),t.prototype.getEdgesBySphere=function(e,r){r===void 0&&(r=30/180*Math.PI);for(var i=Math.cos(r),o=[],s=0,u=this.children;s<u.length;s++){var c=u[s];c instanceof Tile3DModel&&c.tileset.selectedTiles.forEach(function(l){var d,f,m;if(!(l.boundingVolume&&l.boundingVolume.distanceToPoint(e.center)>e.radius)){var A=(f=(d=l.content)===null||d===void 0?void 0:d.data)===null||f===void 0?void 0:f.object;if(A&&A.visible){var h=[];if(A.traverseVisible(function(K){if(K instanceof THREE__namespace.Mesh){var Q=bvhMeshMap.get(K);if(Q){scratchMatrix4.copy(K.matrixWorld),scratchMatrix4Inverse.getInverse(scratchMatrix4),scratchSphere.copy(e).applyMatrix4(scratchMatrix4Inverse);var q=Q.trianglesInSphere(scratchSphere.center,scratchSphere.radius),J=new THREE__namespace.BufferGeometry;J.setAttribute("position",new THREE__namespace.BufferAttribute(q,3)),J.applyMatrix4(K.matrixWorld),J=BufferGeometryUtils.mergeVertices(J,.01),h.push(J)}}}),h.length===0)return;for(var p=["a","b","c"],y=BufferGeometryUtils.mergeBufferGeometries(h,!1),v=y.getAttribute("position").array,g=((m=y.getIndex())===null||m===void 0?void 0:m.array)||[],E=[],b=[],T=0,x=v.length;T<x;T+=3){var R=new THREE__namespace.Vector3(v[T],v[T+1],v[T+2]);E.push(R)}for(var T=0,x=g.length;T<x;T+=3){var _=g[T],M=g[T+1],S=g[T+2],I=new THREE__namespace.Vector3().crossVectors(E[M].clone().sub(E[_]),E[S].clone().sub(E[_])).normalize();b.push({a:_,b:M,c:S,normal:I})}for(var C={},T=0,x=b.length;T<x;T++)for(var H=b[T],B=0;B<3;B++){var L=H[p[B]],O=H[p[(B+1)%3]],k=[Math.min(L,O),Math.max(L,O)],G=k[0]+"-"+k[1];C[G]===void 0?C[G]={index1:k[0],index2:k[1],face1:T}:C[G].face2=T}for(var G in C){var z=C[G];if(z.face2===void 0||b[z.face1].normal.dot(b[z.face2].normal)<=i){var D=E[z.index1],U=E[z.index2];o.push(new THREE__namespace.Line3(D,U))}}E.length=0,b.length=0}}})}return o},t.prototype.intersectRaycaster=function(e,r,i){r===void 0&&(r=null),i===void 0&&(i=!0);for(var o=[],s=0,u=this.children.length;s<u;s++){var c=this.children[s];c.visible&&c instanceof Tile3DModel&&c.intersectRaycaster(e,!1,o)}return r!=null&&(o=o.filter(function(l){return l.floor===r})),this.getMaterial().pointBack==="HIDDEN"&&(o=o.filter(function(l){return!(l.object instanceof PBMPointCloud&&l.face&&l.face.normal.angleTo(e.ray.direction)<Math.PI/2)})),i&&o.sort(function(l,d){return l.distance-d.distance}),o},t.prototype.load=function(e,r){var i,o=this,s,u,c,l;if(r===void 0&&(r={}),this.work=e,this.name=this.work.workCode,!e.model)return Promise.resolve();for(var d=e.model,f=0,m=0,A=e.observers;m<A.length;m++){var h=A[m];f=Math.max(f,h.floorIndex)}this.floorLength=f+1;for(var p=!1,y=[],v=function(z){var D=z.tileset,U=z.upAxis,K=z.name,Q=z.type;Q==="mesh"&&(p=!0);var q=D.split("#"),J=q[0],W=q[1],re=(s=(W||J).split("?")[1])!==null&&s!==void 0?s:"",j=getFetcher(e).ajax(D,{responseType:"text"}).then(function(te){var $,ne,ee,fe=D?D.slice(0,D.lastIndexOf("/")+1):"",ie=normalizeTilesetHeader(JSON.parse(te.body),fe),se=ie.root,Ae=ie.rootMeta,he=Ae===void 0?{}:Ae;he.upAxis&&he.upAxis!==U&&(U=he.upAxis),"lodVersion"in ie&&(U="-Y","floorInfo"in ie&&(ie.properties=ie.properties||{},ie.properties.floorInfo=ie.floorInfo.map(function(le){return{ground:-le.ground,height:le.height}}),delete ie.floorInfo),ie.asset.tilesetVersion=String(ie.lodVersion),delete ie.lodVersion);var me=se.boundingVolume?makeBoundingVolume(se.boundingVolume):void 0;me&&se.transform&&me.applyMatrix4(scratchMatrix4.fromArray(se.transform));var Z=null,Y=new THREE__namespace.Matrix4,N=new THREE__namespace.Matrix4;he.coordinate?(Z=he.coordinate.ground_height,Y.fromArray(he.coordinate.pose_ecef_to_enu),N.fromArray(he.coordinate.pose_enu_to_ecef)):(me?me.getCenter(scratchVector3):scratchVector3.setScalar(0),getEcefToEnuMatrixFromUpAxis(U,scratchVector3,Y),N.getInverse(Y));var Ee=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),ge=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE),ve=new THREE__namespace.Matrix4().premultiply(Y).premultiply(Ee),xe=new THREE__namespace.Matrix4().getInverse(ve);ie.root={refine:($=se.refine)!==null&&$!==void 0?$:"REPLACE",geometricError:se.geometricError,transform:ve.toArray(),boundingVolume:me?me.toJson():void 0,viewerRequestVolume:!((ne=r["3d-tiles"])===null||ne===void 0)&&ne.viewerRequestVolume?(ee=r["3d-tiles"])===null||ee===void 0?void 0:ee.viewerRequestVolume.toJson():void 0,children:[se]};var de=new Tile3DModel(o,ie,{name:K,type:Q,upAxis:U,url:D,referer:D,search:re,fetcher:getFetcher(e),groundHeight:Z,coordinateTransform:{localToEnuMatrix:ge,enuToLocalMatrix:Ee,enuToEcefMatrix:N,ecefToEnuMatrix:Y,localToEcefMatrix:xe,ecefToLocalMatrix:ve}});if(de.matrix.copy(e.transform),de.matrix.decompose(de.position,de.quaternion,de.scale),de.matrixWorldNeedsUpdate=!0,r["3d-tiles"]){var ce=r["3d-tiles"];typeof ce.debug!="undefined"&&(de.debug=ce.debug),typeof ce.minLevelOfDetail!="undefined"&&(de.minLevelOfDetail=ce.minLevelOfDetail),typeof ce.maxLevelOfDetail!="undefined"&&(de.maxLevelOfDetail=ce.maxLevelOfDetail),typeof ce.skipLevelOfDetail!="undefined"&&(de.skipLevelOfDetail=ce.skipLevelOfDetail),typeof ce.loadSiblings!="undefined"&&(de.loadSiblings=ce.loadSiblings),typeof ce.maxMemoryUsage!="undefined"&&(de.maxMemoryUsage=ce.maxMemoryUsage),typeof ce.maxRequests!="undefined"&&(de.maxRequests=ce.maxRequests),typeof ce.maxScreenSpaceError!="undefined"&&(de.maxScreenSpaceError=ce.maxScreenSpaceError)}return new ModelViewLayer(de,null)});y.push(j.catch(function(te){o.onError(te);var $=new THREE__namespace.Matrix4,ne=new THREE__namespace.Matrix4,ee=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),fe=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE),ie=new THREE__namespace.Matrix4().premultiply($).premultiply(ee),se=new THREE__namespace.Matrix4().getInverse(ie),Ae=D?D.slice(0,D.lastIndexOf("/")+1):"",he=normalizeTilesetHeader({asset:{version:"0.0"},geometricError:0,root:{geometricError:0}},Ae),me=new Tile3DModel(o,he,{name:K,type:Q,upAxis:U,url:D,referer:D,search:re,fetcher:getFetcher(e),groundHeight:null,coordinateTransform:{localToEnuMatrix:fe,enuToLocalMatrix:ee,enuToEcefMatrix:ne,ecefToEnuMatrix:$,localToEcefMatrix:se,ecefToLocalMatrix:ie},onError:o.onError});return new ModelViewLayer(me,te)}))},g=0,E=d.layers;g<E.length;g++){var b=E[g];v(b)}if(!p&&d.file){var T=d.file,x=d.textureBase,R=d.textures,_=getExt(T)||"at3d",M=_==="at3d"||_==="pbm"?"Z":"Y",S=new THREE__namespace.Matrix4,I=new THREE__namespace.Matrix4,C=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),H=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE);getEcefToEnuMatrixFromUpAxis(M,scratchVector3.setScalar(0),S),I.getInverse(S);var B=new THREE__namespace.Matrix4().premultiply(S).premultiply(C),L=new THREE__namespace.Matrix4().getInverse(B),O=normalizeTilesetHeader({asset:{gltfUpAxis:"Z",version:"0.0"},geometricError:0,root:{refine:"REPLACE",geometricError:0,transform:B.toArray(),viewerRequestVolume:!((u=r["3d-tiles"])===null||u===void 0)&&u.viewerRequestVolume?(c=r["3d-tiles"])===null||c===void 0?void 0:c.viewerRequestVolume.toJson():void 0,content:{uri:T},extras:(i={},i[_]={textureBaseUri:x,textureArray:R,textureOptions:(l=r.textureOptions)!==null&&l!==void 0?l:{}},i)}},""),k=new Tile3DModel(this,O,{name:"fallback",type:"mesh",upAxis:M,url:"",referer:T,fetcher:getFetcher(e),groundHeight:null,coordinateTransform:{localToEnuMatrix:H,enuToLocalMatrix:C,enuToEcefMatrix:I,ecefToEnuMatrix:S,localToEcefMatrix:L,ecefToLocalMatrix:B},onError:this.onError});k.matrix.copy(e.transform),k.matrix.decompose(k.position,k.quaternion,k.scale),k.matrixWorldNeedsUpdate=!0;var G=new ModelViewLayer(k,null);y.push(Promise.resolve(G))}return Promise.all(y).then(function(z){for(var D,U=[],K=[],Q=[],q=0,J=z;q<J.length;q++){var W=J[q];if(o.viewLayers.push(W),o.disposed){W.scene.dispose();continue}switch(o.add(W.scene),W.scene.visible=!1,W.scene.type){case"mesh":U.push(W.scene);break;case"point_cloud":K.push(W.scene);break;default:Q.push(W.scene);break}}U.length?U[0].visible=!0:K.length?K[0].visible=!0:Q.length&&(Q[0].visible=!0);var re=(D=r["3d-tiles"])===null||D===void 0?void 0:D.showLayers;if(typeof re=="boolean")for(var j=0,te=z;j<te.length;j++){var W=te[j];W.scene&&(W.scene.visible=re)}else if(Array.isArray(re))for(var $=0,ne=z;$<ne.length;$++){var W=ne[$];W.scene&&(W.scene.visible=re.indexOf(W.scene.name)!==-1)}})},t.prototype.update=function(e,r,i){if(this.children.length){var o=this.loaded;this.refined=this.work!==null,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=this.work!==null,this.bounding.makeEmpty();for(var s=0,u=this.viewLayers;s<u.length;s++){var c=u[s],l=c.scene;l&&(this.work&&(l.idle=this.materialParameters.modelAlpha<=0,l.cacheCameras=this.cacheCameras,this.autoRefine===!1?l.needsRefined=!1:isFristPersonMode(i)?l.needsRefined=this.materialParameters.modelAlpha===0||this.materialParameters.modelAlpha===1:l.needsRefined=!0,this.work.transform.equals(l.matrix)||(l.matrix.copy(this.work.transform),l.matrix.decompose(l.position,l.quaternion,l.scale),l.matrixWorldNeedsUpdate=!0)),l.update(e,r),l.boundingBox.isEmpty()||(scratchBoundingBox.copy(l.boundingBox).applyMatrix4(l.matrix),this.bounding.union(scratchBoundingBox)),l.needsRender===!0&&(l.needsRender=!1,this.needsRender=!0),l.refined===!1&&(this.refined=!1),this.refineProgress[0]+=l.refineProgress[0],this.refineProgress[1]+=l.refineProgress[1],l.loaded===!1&&(this.loaded=!1))}this.bounding.isEmpty()&&this.bounding.copy(DEFAULT_BOUNDING),o===!1&&this.loaded===!0&&this.onLoad()}else this.work&&!this.work.model?(this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=!0):(this.refined=!1,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=!1),this.bounding.set(new THREE__namespace.Vector3,new THREE__namespace.Vector3)},t.prototype.dispose=function(){this.disposed=!0;for(var e;e=this.children[0];)e instanceof Tile3DModel&&e.dispose(),this.remove(e)},t}(THREE__namespace.Object3D);function createModels(){var n=new THREE__namespace.Box3,t=omit(defaultPbmParameters,["clippers","shownFloorIndex","brightness"]),e=Object.assign([],{bounding:n,needsRender:!1,refined:!1,refineProgress:[0,0],loaded:!1,materialVersion:0,cacheCameras:[],autoUpdate:!0,intersectRaycaster:function(r,i,o){o===void 0&&(o=!0);var s;if(e.length===1)s=e[0].intersectRaycaster(r,i,o);else if(e.length===0)s=[];else{s=[];for(var u=0,c=e;u<c.length;u++){var l=c[u];if(l.visible){var d=l.intersectRaycaster(r,i,!1);d.length&&s.push.apply(s,d)}}o&&s.sort(function(f,m){return f.distance-m.distance})}return s},setMaterial:function(r){var i=updatePBMParameters(t,r);i&&(e.materialVersion++,e.needsRender=!0)},getMaterial:function(){return __assign({},t)},resetBrightness:function(){for(var r=0,i=e;r<i.length;r++){var o=i[r];o.setMaterial({brightness:1})}},update:function(r,i,o){if(e.autoUpdate!==!1){e.refined=e.length>0,e.loaded=e.length>0,e.refineProgress[0]=0,e.refineProgress[1]=0,n.makeEmpty();for(var s=0,u=e.cacheCameras;s<u.length;s++){var c=u[s];c.updateMatrixWorld(!0),c.updateProjectionMatrix()}for(var l=0,d=0,f=e;d<f.length;d++){for(var m=f[d],A=0,h=m.viewLayers;A<h.length;A++){var p=h[A];p.scene.modelIndex=l++}m.setMaterial(t),m.cacheCameras=e.cacheCameras,m.update(r,i,o),m.needsRender===!0&&(e.needsRender=!0,m.needsRender=!1),m.refined===!1&&(e.refined=!1),e.refineProgress[0]+=m.refineProgress[0],e.refineProgress[1]+=m.refineProgress[1],m.loaded===!1&&(e.loaded=!1),n.union(m.bounding)}n.isEmpty()&&n.copy(DEFAULT_BOUNDING)}}});return e}function mixNumber(n,t,e){return n+(t-n)*e}function value(n,t,e,r){var i=(t*e+2*n)/Math.pow(e,3),o=-(2*t*e+3*n)/Math.pow(e,2),s=t,u=n;return i*Math.pow(r,3)+o*Math.pow(r,2)+s*r+u}function velocity(n,t,e,r){var i=(t*e+2*n)/Math.pow(e,3),o=-(2*t*e+3*n)/Math.pow(e,2),s=t;return 3*i*Math.pow(r,2)+2*o*r+s}function mixCircle(n,t,e,r){var i=r[1]-r[0];return n=circleValue(n,r),t=circleValue(t,r),t-n>i/2?mixNumber(n+i,t,e):n-t>i/2?mixNumber(n-i,t,e):mixNumber(n,t,e)}function circleValue(n,t){var e=t[1]-t[0];return n<t[0]?circleValue(n+e,t):n>=t[1]?circleValue(n-e,t):n}function mixValue(n,t,e,r){return r?mixCircle(n,t,e,r):mixNumber(n,t,e)}var Motion=function(){function n(t){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=now(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(var e in t){var r=t[e];typeof r=="number"?(this.value[e]=r,this.config[e]={circle:!1}):(this.value[e]=r.value,this.config[e]={circle:r.circle})}this.keyframes=[{progress:0,value:__assign({},this.value)},{progress:1,value:__assign({},this.value)}]}return n.prototype.getProgress=function(t){var e=t-this.startTime;return e<0?0:e>=this.duration?1:1-value(1,this.startVelocity,this.duration,e)},n.prototype.getValue=function(t){for(var e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>t){var r=this.keyframes[e-1],i=this.keyframes[e],o={};for(var s in this.config){var u=(t-r.progress)/(i.progress-r.progress);o[s]=mixValue(r.value[s],i.value[s],u,this.config[s].circle)}return o}return __assign({},this.keyframes[this.keyframes.length-1].value)},n.prototype.getProgressVelocity=function(t){var e=t-this.startTime;return e>=this.duration?0:velocity(1,this.startVelocity,this.duration,e)},n.prototype.update=function(t){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(t))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},n.prototype.getKeyFrameSegment=function(t){for(var e=this.getProgress(t),r=1;r<this.keyframes.length;r++)if(this.keyframes[r].progress>e)return[this.keyframes[r-1],this.keyframes[r]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},n.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},n.prototype.set=function(t,e,r,i){var o;r===void 0&&(r=0),isNaN(e)&&(e=0),isNaN(r)&&(r=0),i=i!=null?i:now();var s=this.getProgress(i),u=this.getValue(s),c={};for(var l in this.config)c[l]=(o=t[l])!==null&&o!==void 0?o:u[l];var d=[{progress:0,value:u},{progress:1,value:c}];return this.setKeyframes(d,e,r,i)},n.prototype.setKeyframes=function(t,e,r,i){var o=this;if(r===void 0&&(r=0),t.length<2)throw new Error("keyframes invalid.");return isNaN(e)&&(e=0),isNaN(r)&&(r=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise(function(s,u){i=i!=null?i:now(),o.progress=0,o.ended=!1,o.startTime=i,o.startVelocity=r,o.keyframes=t,o.duration=e,e===0?(o.progress=1,o.value=__assign({},t[t.length-1].value)):o.value=__assign({},t[0].value),o.callbacks=[s,u]})},n.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},n}(),easeOut$2=function(n){return n*(2-n)},sharedGeometry2$2=function(){var n=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),t=new Float32Array([1,0,0,0,1,1,0,1]),e=new Uint8Array([0,2,1,2,3,1]),r=new THREE__namespace.BufferGeometry;return r.setAttribute("position",new THREE__namespace.BufferAttribute(n,3)),r.setAttribute("uv",new THREE__namespace.BufferAttribute(t,2)),r.setIndex(new THREE__namespace.BufferAttribute(e,1)),r}(),vertexShader$4=`
932
+ `+JSON.stringify(n))}}function createWorks(n){for(var t={},e=[],r={},i=0,o=n;i<o.length;i++){var s=o[i],u=t[s.workCode];u||(u=t[s.workCode]=new THREE__namespace.Matrix4().copy(s.options.transform));for(var c=0,l=s.observers;c<l.length;c++){var d=l[c],f={isResolved:!0,active:d.active,accessibleIds:d.accessibleIds,visibleIds:d.visibleIds,accessibleNodes:d.accessibleNodes,visibleNodes:d.visibleNodes,floorIndex:d.floorIndex,images:d.images,index:d.index,panoIndex:d.panoIndex,loadable:d.loadable,panoId:d.panoId,pano:d.pano,work:d.work,derivedId:d.derivedId,video:d.video,position:new THREE__namespace.Vector3().copy(d.position).applyMatrix4(u),standingPosition:new THREE__namespace.Vector3().copy(d.standingPosition).applyMatrix4(u),quaternion:new THREE__namespace.Quaternion().setFromRotationMatrix(scratchMatrix4$1.makeRotationFromQuaternion(d.quaternion).premultiply(u))};Object.freeze(f),e.push(f),r[f.panoId]=f}}Object.freeze(e);for(var m=n.slice(),A={},h=0,p=m;h<p.length;h++){var s=p[h];A[s.workCode]=s}return Object.freeze(Object.assign(m,{get initial(){return m.length>0?m[0].initial:{work:{}}},get resolvedObservers(){return e},getWork:function(y){return A[y]},getResolvedObserver:function(y){var v,g;return isPanoId(y)?r[y]:typeof y=="number"?r[panoStringify({workCode:(g=(v=n[0])===null||v===void 0?void 0:v.workCode)!==null&&g!==void 0?g:"",panoIndex:y})]:r[panoStringify(y)]},update:function(){for(var y={},v=0,g=m;v<g.length;v++){var E=g[v],b=E.options.transform,T=t[E.workCode];T?T.equals(b)||(T.copy(b),y[E.workCode]=!0):(t[E.workCode]=new THREE__namespace.Matrix4().copy(b),y[E.workCode]=!0)}for(var x=0,R=e;x<R.length;x++){var _=R[x];if(y[_.work.workCode]===!0){var M=_.work.observers[_.index],S=_.work.options.transform;_.position.copy(M.position).applyMatrix4(S),_.standingPosition.copy(M.standingPosition).applyMatrix4(S),_.quaternion.setFromRotationMatrix(scratchMatrix4$1.makeRotationFromQuaternion(M.quaternion).premultiply(S))}}}}))}var fetcherMap=new Map;function getFetcher(n){var t=fetcherMap.get(n);if(t)return t;throw new Error("fetcher never registered.")}function registerFetcher(n,t){return fetcherMap.set(n,t)}var BufferGeometryUtils={computeTangents:function(n){var t=n.index,e=n.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");return}var r=t.array,i=e.position.array,o=e.normal.array,s=e.uv.array,u=i.length/3;e.tangent===void 0&&n.setAttribute("tangent",new THREE__namespace.BufferAttribute(new Float32Array(4*u),4));for(var c=e.tangent.array,l=[],d=[],f=0;f<u;f++)l[f]=new THREE__namespace.Vector3,d[f]=new THREE__namespace.Vector3;var m=new THREE__namespace.Vector3,A=new THREE__namespace.Vector3,h=new THREE__namespace.Vector3,p=new THREE__namespace.Vector2,y=new THREE__namespace.Vector2,v=new THREE__namespace.Vector2,g=new THREE__namespace.Vector3,E=new THREE__namespace.Vector3;function b(D,U,K){m.fromArray(i,D*3),A.fromArray(i,U*3),h.fromArray(i,K*3),p.fromArray(s,D*2),y.fromArray(s,U*2),v.fromArray(s,K*2);var Q=A.x-m.x,q=h.x-m.x,J=A.y-m.y,j=h.y-m.y,re=A.z-m.z,W=h.z-m.z,te=y.x-p.x,$=v.x-p.x,ne=y.y-p.y,ee=v.y-p.y,fe=1/(te*ee-$*ne);g.set((ee*Q-ne*q)*fe,(ee*J-ne*j)*fe,(ee*re-ne*W)*fe),E.set((te*q-$*Q)*fe,(te*j-$*J)*fe,(te*W-$*re)*fe),l[D].add(g),l[U].add(g),l[K].add(g),d[D].add(E),d[U].add(E),d[K].add(E)}var T=n.groups;T.length===0&&(T=[{start:0,count:r.length}]);for(var f=0,x=T.length;f<x;++f)for(var R=T[f],_=R.start,M=R.count,S=_,I=_+M;S<I;S+=3)b(r[S+0],r[S+1],r[S+2]);var C=new THREE__namespace.Vector3,H=new THREE__namespace.Vector3,B=new THREE__namespace.Vector3,L=new THREE__namespace.Vector3,O,k,G;function z(D){B.fromArray(o,D*3),L.copy(B),k=l[D],C.copy(k),C.sub(B.multiplyScalar(B.dot(k))).normalize(),H.crossVectors(L,k),G=H.dot(d[D]),O=G<0?-1:1,c[D*4]=C.x,c[D*4+1]=C.y,c[D*4+2]=C.z,c[D*4+3]=O}for(var f=0,x=T.length;f<x;++f)for(var R=T[f],_=R.start,M=R.count,S=_,I=_+M;S<I;S+=3)z(r[S+0]),z(r[S+1]),z(r[S+2])},mergeBufferGeometries:function(n,t){for(var e=n[0].index!==null,r=new Set(Object.keys(n[0].attributes)),i=new Set(Object.keys(n[0].morphAttributes)),o={},s={},u=new THREE__namespace.BufferGeometry,c=0,l=0;l<n.length;++l){var d=n[l];if(e!==(d.index!==null))return null;for(var f in d.attributes){if(!r.has(f))return null;o[f]===void 0&&(o[f]=[]),o[f].push(d.attributes[f])}for(var f in d.morphAttributes){if(!i.has(f))return null;s[f]===void 0&&(s[f]=[]),s[f].push(d.morphAttributes[f])}if(u.userData.mergedUserData=u.userData.mergedUserData||[],u.userData.mergedUserData.push(d.userData),t){var m;if(e)m=d.index.count;else if(d.attributes.position!==void 0)m=d.attributes.position.count;else return null;u.addGroup(c,m,l),c+=m}}if(e){for(var A=0,h=[],l=0;l<n.length;++l){for(var p=n[l].index,y=0;y<p.count;++y)h.push(p.getX(y)+A);A+=n[l].attributes.position.count}u.setIndex(h)}for(var f in o){var v=this.mergeBufferAttributes(o[f]);if(!v)return null;u.setAttribute(f,v)}for(var f in s){var g=s[f][0].length;if(g===0)break;u.morphAttributes=u.morphAttributes||{},u.morphAttributes[f]=[];for(var l=0;l<g;++l){for(var E=[],y=0;y<s[f].length;++y)E.push(s[f][y][l]);var b=this.mergeBufferAttributes(E);if(!b)return null;u.morphAttributes[f].push(b)}}return u},mergeBufferAttributes:function(n){for(var t,e,r,i=0,o=0;o<n.length;++o){var s=n[o];if(s.isInterleavedBufferAttribute||(t===void 0&&(t=s.array.constructor),t!==s.array.constructor)||(e===void 0&&(e=s.itemSize),e!==s.itemSize)||(r===void 0&&(r=s.normalized),r!==s.normalized))return null;i+=s.array.length}for(var u=new t(i),c=0,o=0;o<n.length;++o)u.set(n[o].array,c),c+=n[o].array.length;return new THREE__namespace.BufferAttribute(u,e,r)},interleaveAttributes:function(n){for(var t,e=0,r=0,i=0,o=n.length;i<o;++i){var s=n[i];if(t===void 0&&(t=s.array.constructor),t!==s.array.constructor)return console.warn("AttributeBuffers of different types cannot be interleaved"),null;e+=s.array.length,r+=s.itemSize}for(var u=new THREE__namespace.InterleavedBuffer(new t(e),r),c=0,l=[],d=["getX","getY","getZ","getW"],f=["setX","setY","setZ","setW"],m=0,o=n.length;m<o;m++){var s=n[m],A=s.itemSize,h=s.count,p=new THREE__namespace.InterleavedBufferAttribute(u,A,c,s.normalized);l.push(p),c+=A;for(var y=0;y<h;y++)for(var v=0;v<A;v++)p[f[v]](y,s[d[v]](y))}return l},estimateBytesUsed:function(n){var t=0;for(var e in n.attributes){var r=n.getAttribute(e);t+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}var i=n.getIndex();return t+=i?i.count*i.itemSize*i.array.BYTES_PER_ELEMENT:0,t},mergeVertices:function(n,t){t===void 0&&(t=1e-4),t=Math.max(t,Number.EPSILON);for(var e={},r=n.getIndex(),i=n.getAttribute("position"),o=r?r.count:i.count,s=0,u=Object.keys(n.attributes),c={},l={},d=[],f=["getX","getY","getZ","getW"],m=0,A=u.length;m<A;m++){var h=u[m];c[h]=[];var p=n.morphAttributes[h];p&&(l[h]=new Array(p.length).fill().map(function(){return[]}))}for(var y=Math.log10(1/t),v=Math.pow(10,y),m=0;m<o;m++){for(var g=r?r.getX(m):m,E="",b=0,A=u.length;b<A;b++)for(var h=u[b],T=n.getAttribute(h),x=T.itemSize,R=0;R<x;R++)E+="".concat(~~(T[f[R]](g)*v),",");if(E in e)d.push(e[E]);else{for(var b=0,A=u.length;b<A;b++)for(var h=u[b],T=n.getAttribute(h),p=n.morphAttributes[h],x=T.itemSize,_=c[h],M=l[h],R=0;R<x;R++){var S=f[R];if(_.push(T[S](g)),p)for(var I=0,C=p.length;I<C;I++)M[I].push(p[I][S](g))}e[E]=s,d.push(s),s++}}for(var H=n.clone(),m=0,A=u.length;m<A;m++){var h=u[m],B=n.getAttribute(h),L=new B.array.constructor(c[h]),T=new THREE__namespace.BufferAttribute(L,B.itemSize,B.normalized);if(H.setAttribute(h,T),h in l)for(var b=0;b<l[h].length;b++){var O=n.morphAttributes[h][b],L=new O.array.constructor(l[h][b]),k=new THREE__namespace.BufferAttribute(L,O.itemSize,O.normalized);H.morphAttributes[h][b]=k}}return H.setIndex(d),H}};function isThirdPersonMode(n){switch(n){case"Floorplan":return!0;case"Mapview":return!0;default:return!1}}function isFristPersonMode(n){switch(n){case"Panorama":return!0;case"VRPanorama":return!0;case"XRPanorama":return!0;case"Model":return!0;default:return!1}}var scratchVector3=new THREE__namespace.Vector3,scratchSphere=new THREE__namespace.Sphere,scratchMatrix4=new THREE__namespace.Matrix4,scratchMatrix4Inverse=new THREE__namespace.Matrix4,scratchBoundingBox=new THREE__namespace.Box3,ROTATE_X_90_MATRIX=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),ROTATE_X_90_MATRIX_INVERSE=new THREE__namespace.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),DEFAULT_BOUNDING=new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5));function getEcefToEnuMatrixFromUpAxis(n,t,e){switch(n){case"Z":break;case"Y":e.copy(ROTATE_X_90_MATRIX_INVERSE);break;case"-Y":e.copy(ROTATE_X_90_MATRIX);break;case"WGS84":case"GCJ02":case"BD09":getEcefToEnuMatrix(t,e);break;default:e.identity();break}return e}function getExt(n){var t=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(n);if(t){var e=String(t[1]).trim().split(".").slice(1).reverse()[0];if(e)return e}return""}var ModelViewLayer=function(){function n(t,e){this.scene=t,this.error=e,t.viewLayer=this}return Object.defineProperty(n.prototype,"name",{get:function(){return this.scene.name},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"type",{get:function(){return this.scene.type},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"upAxis",{get:function(){return this.scene.upAxis},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"groundHeight",{get:function(){return this.scene.groundHeight},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"model",{get:function(){return this.scene.model},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"coordinates",{get:function(){scratchVector3.setScalar(0);var t=this.scene.localToLla(scratchVector3),e=t.x,r=t.y;return[e,r].map(function(i){return(i/Math.PI*180).toFixed(6)}).join(",")},enumerable:!1,configurable:!0}),n.prototype.getTransformMatrix4=function(t){return t===void 0&&(t=new THREE__namespace.Matrix4),t.copy(this.scene.coordinateTransform.ecefToLocalMatrix),this.scene&&t.premultiply(this.scene.matrixWorld),t},n.prototype.coordinatesToWorldPoint=function(t){var e=new THREE__namespace.Vector3(t.latitude,t.longitude,t.altitude);return this.scene.llaToWorld(e)},n.prototype.worldPointToCoordinates=function(t){return scratchVector3.copy(t),this.scene.worldToLla(scratchVector3),{latitude:scratchVector3.x,longitude:scratchVector3.y,altitude:scratchVector3.z}},n}(),Model=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s=n.call(this)||this;return s.name="",s.onError=(r=e.onError)!==null&&r!==void 0?r:noop$1,s.onShownFloorChange=(i=e.onShownFloorChange)!==null&&i!==void 0?i:noop$1,s.onLoad=(o=e.onLoad)!==null&&o!==void 0?o:noop$1,s.work=null,s.viewLayers=[],s.bounding=new THREE__namespace.Box3(new THREE__namespace.Vector3,new THREE__namespace.Vector3),s.floorLength=0,s.textureOptions={},s.refined=!1,s.refineProgress=[0,0],s.loaded=!1,s.matrixAutoUpdate=!1,s.needsRender=!0,s.autoRefine=!0,s.materialVersion=0,s.materialParameters=__assign({},defaultPbmParameters),s.cacheCameras=[],s.disposed=!1,s}return Object.defineProperty(t.prototype,"empty",{get:function(){return this.viewLayers.length===0},enumerable:!1,configurable:!0}),t.prototype.getMaterial=function(){return __assign({},this.materialParameters)},t.prototype.setMaterial=function(e){var r=this.materialParameters.shownFloorIndex,i=updatePBMParameters(this.materialParameters,e);if(i){var o=this.materialParameters.shownFloorIndex;r!==o&&this.onShownFloorChange(o),this.materialVersion++,this.needsRender=!0}},Object.defineProperty(t.prototype,"brightness",{get:function(){return this.materialParameters.brightness},set:function(e){this.setMaterial({brightness:typeof e=="number"?e:1})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shownFloorIndex",{get:function(){return this.materialParameters.shownFloorIndex},set:function(e){this.setMaterial({shownFloorIndex:e})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shownFloor",{get:function(){return this.shownFloorIndex===-1?null:this.shownFloorIndex},set:function(e){this.shownFloorIndex=e===null?-1:e},enumerable:!1,configurable:!0}),t.prototype.show=function(e){this.shownFloor=e!=null?e:null},Object.defineProperty(t.prototype,"clippers",{get:function(){return this.materialParameters.clippers},set:function(e){this.setMaterial({clippers:e})},enumerable:!1,configurable:!0}),t.prototype.getEdgesBySphere=function(e,r){r===void 0&&(r=30/180*Math.PI);for(var i=Math.cos(r),o=[],s=0,u=this.children;s<u.length;s++){var c=u[s];c instanceof Tile3DModel&&c.tileset.selectedTiles.forEach(function(l){var d,f,m;if(!(l.boundingVolume&&l.boundingVolume.distanceToPoint(e.center)>e.radius)){var A=(f=(d=l.content)===null||d===void 0?void 0:d.data)===null||f===void 0?void 0:f.object;if(A&&A.visible){var h=[];if(A.traverseVisible(function(K){if(K instanceof THREE__namespace.Mesh){var Q=bvhMeshMap.get(K);if(Q){scratchMatrix4.copy(K.matrixWorld),scratchMatrix4Inverse.getInverse(scratchMatrix4),scratchSphere.copy(e).applyMatrix4(scratchMatrix4Inverse);var q=Q.trianglesInSphere(scratchSphere.center,scratchSphere.radius),J=new THREE__namespace.BufferGeometry;J.setAttribute("position",new THREE__namespace.BufferAttribute(q,3)),J.applyMatrix4(K.matrixWorld),J=BufferGeometryUtils.mergeVertices(J,.01),h.push(J)}}}),h.length===0)return;for(var p=["a","b","c"],y=BufferGeometryUtils.mergeBufferGeometries(h,!1),v=y.getAttribute("position").array,g=((m=y.getIndex())===null||m===void 0?void 0:m.array)||[],E=[],b=[],T=0,x=v.length;T<x;T+=3){var R=new THREE__namespace.Vector3(v[T],v[T+1],v[T+2]);E.push(R)}for(var T=0,x=g.length;T<x;T+=3){var _=g[T],M=g[T+1],S=g[T+2],I=new THREE__namespace.Vector3().crossVectors(E[M].clone().sub(E[_]),E[S].clone().sub(E[_])).normalize();b.push({a:_,b:M,c:S,normal:I})}for(var C={},T=0,x=b.length;T<x;T++)for(var H=b[T],B=0;B<3;B++){var L=H[p[B]],O=H[p[(B+1)%3]],k=[Math.min(L,O),Math.max(L,O)],G=k[0]+"-"+k[1];C[G]===void 0?C[G]={index1:k[0],index2:k[1],face1:T}:C[G].face2=T}for(var G in C){var z=C[G];if(z.face2===void 0||b[z.face1].normal.dot(b[z.face2].normal)<=i){var D=E[z.index1],U=E[z.index2];o.push(new THREE__namespace.Line3(D,U))}}E.length=0,b.length=0}}})}return o},t.prototype.intersectRaycaster=function(e,r,i){r===void 0&&(r=null),i===void 0&&(i=!0);for(var o=[],s=0,u=this.children.length;s<u;s++){var c=this.children[s];c.visible&&c instanceof Tile3DModel&&c.intersectRaycaster(e,!1,o)}return r!=null&&(o=o.filter(function(l){return l.floor===r})),this.getMaterial().pointBack==="HIDDEN"&&(o=o.filter(function(l){return!(l.object instanceof PBMPointCloud&&l.face&&l.face.normal.angleTo(e.ray.direction)<Math.PI/2)})),i&&o.sort(function(l,d){return l.distance-d.distance}),o},t.prototype.load=function(e,r){var i,o=this,s,u,c,l;if(r===void 0&&(r={}),this.work=e,this.name=this.work.workCode,!e.model)return Promise.resolve();for(var d=e.model,f=0,m=0,A=e.observers;m<A.length;m++){var h=A[m];f=Math.max(f,h.floorIndex)}this.floorLength=f+1;for(var p=!1,y=[],v=function(z){var D=z.tileset,U=z.upAxis,K=z.name,Q=z.type;Q==="mesh"&&(p=!0);var q=D.split("#"),J=q[0],j=q[1],re=(s=(j||J).split("?")[1])!==null&&s!==void 0?s:"",W=getFetcher(e).ajax(D,{responseType:"text"}).then(function(te){var $,ne,ee,fe=D?D.slice(0,D.lastIndexOf("/")+1):"",ie=normalizeTilesetHeader(JSON.parse(te.body),fe),se=ie.root,Ae=ie.rootMeta,he=Ae===void 0?{}:Ae;he.upAxis&&he.upAxis!==U&&(U=he.upAxis),"lodVersion"in ie&&(U="-Y","floorInfo"in ie&&(ie.properties=ie.properties||{},ie.properties.floorInfo=ie.floorInfo.map(function(le){return{ground:-le.ground,height:le.height}}),delete ie.floorInfo),ie.asset.tilesetVersion=String(ie.lodVersion),delete ie.lodVersion);var me=se.boundingVolume?makeBoundingVolume(se.boundingVolume):void 0;me&&se.transform&&me.applyMatrix4(scratchMatrix4.fromArray(se.transform));var Z=null,Y=new THREE__namespace.Matrix4,N=new THREE__namespace.Matrix4;he.coordinate?(Z=he.coordinate.ground_height,Y.fromArray(he.coordinate.pose_ecef_to_enu),N.fromArray(he.coordinate.pose_enu_to_ecef)):(me?me.getCenter(scratchVector3):scratchVector3.setScalar(0),getEcefToEnuMatrixFromUpAxis(U,scratchVector3,Y),N.getInverse(Y));var Ee=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),ge=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE),ve=new THREE__namespace.Matrix4().premultiply(Y).premultiply(Ee),xe=new THREE__namespace.Matrix4().getInverse(ve);ie.root={refine:($=se.refine)!==null&&$!==void 0?$:"REPLACE",geometricError:se.geometricError,transform:ve.toArray(),boundingVolume:me?me.toJson():void 0,viewerRequestVolume:!((ne=r["3d-tiles"])===null||ne===void 0)&&ne.viewerRequestVolume?(ee=r["3d-tiles"])===null||ee===void 0?void 0:ee.viewerRequestVolume.toJson():void 0,children:[se]};var de=new Tile3DModel(o,ie,{name:K,type:Q,upAxis:U,url:D,referer:D,search:re,fetcher:getFetcher(e),groundHeight:Z,coordinateTransform:{localToEnuMatrix:ge,enuToLocalMatrix:Ee,enuToEcefMatrix:N,ecefToEnuMatrix:Y,localToEcefMatrix:xe,ecefToLocalMatrix:ve}});if(de.matrix.copy(e.transform),de.matrix.decompose(de.position,de.quaternion,de.scale),de.matrixWorldNeedsUpdate=!0,r["3d-tiles"]){var ce=r["3d-tiles"];typeof ce.debug!="undefined"&&(de.debug=ce.debug),typeof ce.minLevelOfDetail!="undefined"&&(de.minLevelOfDetail=ce.minLevelOfDetail),typeof ce.maxLevelOfDetail!="undefined"&&(de.maxLevelOfDetail=ce.maxLevelOfDetail),typeof ce.skipLevelOfDetail!="undefined"&&(de.skipLevelOfDetail=ce.skipLevelOfDetail),typeof ce.loadSiblings!="undefined"&&(de.loadSiblings=ce.loadSiblings),typeof ce.maxMemoryUsage!="undefined"&&(de.maxMemoryUsage=ce.maxMemoryUsage),typeof ce.maxRequests!="undefined"&&(de.maxRequests=ce.maxRequests),typeof ce.maxScreenSpaceError!="undefined"&&(de.maxScreenSpaceError=ce.maxScreenSpaceError)}return new ModelViewLayer(de,null)});y.push(W.catch(function(te){o.onError(te);var $=new THREE__namespace.Matrix4,ne=new THREE__namespace.Matrix4,ee=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),fe=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE),ie=new THREE__namespace.Matrix4().premultiply($).premultiply(ee),se=new THREE__namespace.Matrix4().getInverse(ie),Ae=D?D.slice(0,D.lastIndexOf("/")+1):"",he=normalizeTilesetHeader({asset:{version:"0.0"},geometricError:0,root:{geometricError:0}},Ae),me=new Tile3DModel(o,he,{name:K,type:Q,upAxis:U,url:D,referer:D,search:re,fetcher:getFetcher(e),groundHeight:null,coordinateTransform:{localToEnuMatrix:fe,enuToLocalMatrix:ee,enuToEcefMatrix:ne,ecefToEnuMatrix:$,localToEcefMatrix:se,ecefToLocalMatrix:ie},onError:o.onError});return new ModelViewLayer(me,te)}))},g=0,E=d.layers;g<E.length;g++){var b=E[g];v(b)}if(!p&&d.file){var T=d.file,x=d.textureBase,R=d.textures,_=getExt(T)||"at3d",M=_==="at3d"||_==="pbm"?"Z":"Y",S=new THREE__namespace.Matrix4,I=new THREE__namespace.Matrix4,C=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX),H=new THREE__namespace.Matrix4().copy(ROTATE_X_90_MATRIX_INVERSE);getEcefToEnuMatrixFromUpAxis(M,scratchVector3.setScalar(0),S),I.getInverse(S);var B=new THREE__namespace.Matrix4().premultiply(S).premultiply(C),L=new THREE__namespace.Matrix4().getInverse(B),O=normalizeTilesetHeader({asset:{gltfUpAxis:"Z",version:"0.0"},geometricError:0,root:{refine:"REPLACE",geometricError:0,transform:B.toArray(),viewerRequestVolume:!((u=r["3d-tiles"])===null||u===void 0)&&u.viewerRequestVolume?(c=r["3d-tiles"])===null||c===void 0?void 0:c.viewerRequestVolume.toJson():void 0,content:{uri:T},extras:(i={},i[_]={textureBaseUri:x,textureArray:R,textureOptions:(l=r.textureOptions)!==null&&l!==void 0?l:{}},i)}},""),k=new Tile3DModel(this,O,{name:"fallback",type:"mesh",upAxis:M,url:"",referer:T,fetcher:getFetcher(e),groundHeight:null,coordinateTransform:{localToEnuMatrix:H,enuToLocalMatrix:C,enuToEcefMatrix:I,ecefToEnuMatrix:S,localToEcefMatrix:L,ecefToLocalMatrix:B},onError:this.onError});k.matrix.copy(e.transform),k.matrix.decompose(k.position,k.quaternion,k.scale),k.matrixWorldNeedsUpdate=!0;var G=new ModelViewLayer(k,null);y.push(Promise.resolve(G))}return Promise.all(y).then(function(z){for(var D,U=[],K=[],Q=[],q=0,J=z;q<J.length;q++){var j=J[q];if(o.viewLayers.push(j),o.disposed){j.scene.dispose();continue}switch(o.add(j.scene),j.scene.visible=!1,j.scene.type){case"mesh":U.push(j.scene);break;case"point_cloud":K.push(j.scene);break;default:Q.push(j.scene);break}}U.length?U[0].visible=!0:K.length?K[0].visible=!0:Q.length&&(Q[0].visible=!0);var re=(D=r["3d-tiles"])===null||D===void 0?void 0:D.showLayers;if(typeof re=="boolean")for(var W=0,te=z;W<te.length;W++){var j=te[W];j.scene&&(j.scene.visible=re)}else if(Array.isArray(re))for(var $=0,ne=z;$<ne.length;$++){var j=ne[$];j.scene&&(j.scene.visible=re.indexOf(j.scene.name)!==-1)}})},t.prototype.update=function(e,r,i){if(this.children.length){var o=this.loaded;this.refined=this.work!==null,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=this.work!==null,this.bounding.makeEmpty();for(var s=0,u=this.viewLayers;s<u.length;s++){var c=u[s],l=c.scene;l&&(this.work&&(l.idle=this.materialParameters.modelAlpha<=0,l.cacheCameras=this.cacheCameras,this.autoRefine===!1?l.needsRefined=!1:isFristPersonMode(i)?l.needsRefined=this.materialParameters.modelAlpha===0||this.materialParameters.modelAlpha===1:l.needsRefined=!0,this.work.transform.equals(l.matrix)||(l.matrix.copy(this.work.transform),l.matrix.decompose(l.position,l.quaternion,l.scale),l.matrixWorldNeedsUpdate=!0)),l.update(e,r),l.boundingBox.isEmpty()||(scratchBoundingBox.copy(l.boundingBox).applyMatrix4(l.matrix),this.bounding.union(scratchBoundingBox)),l.needsRender===!0&&(l.needsRender=!1,this.needsRender=!0),l.refined===!1&&(this.refined=!1),this.refineProgress[0]+=l.refineProgress[0],this.refineProgress[1]+=l.refineProgress[1],l.loaded===!1&&(this.loaded=!1))}this.bounding.isEmpty()&&this.bounding.copy(DEFAULT_BOUNDING),o===!1&&this.loaded===!0&&this.onLoad()}else this.work&&!this.work.model?(this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=!0):(this.refined=!1,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=!1),this.bounding.set(new THREE__namespace.Vector3,new THREE__namespace.Vector3)},t.prototype.dispose=function(){this.disposed=!0;for(var e;e=this.children[0];)e instanceof Tile3DModel&&e.dispose(),this.remove(e)},t}(THREE__namespace.Object3D);function createModels(){var n=new THREE__namespace.Box3,t=omit(defaultPbmParameters,["clippers","shownFloorIndex","brightness"]),e=Object.assign([],{bounding:n,needsRender:!1,refined:!1,refineProgress:[0,0],loaded:!1,materialVersion:0,cacheCameras:[],autoUpdate:!0,intersectRaycaster:function(r,i,o){o===void 0&&(o=!0);var s;if(e.length===1)s=e[0].intersectRaycaster(r,i,o);else if(e.length===0)s=[];else{s=[];for(var u=0,c=e;u<c.length;u++){var l=c[u];if(l.visible){var d=l.intersectRaycaster(r,i,!1);d.length&&s.push.apply(s,d)}}o&&s.sort(function(f,m){return f.distance-m.distance})}return s},setMaterial:function(r){var i=updatePBMParameters(t,r);i&&(e.materialVersion++,e.needsRender=!0)},getMaterial:function(){return __assign({},t)},resetBrightness:function(){for(var r=0,i=e;r<i.length;r++){var o=i[r];o.setMaterial({brightness:1})}},update:function(r,i,o){if(e.autoUpdate!==!1){e.refined=e.length>0,e.loaded=e.length>0,e.refineProgress[0]=0,e.refineProgress[1]=0,n.makeEmpty();for(var s=0,u=e.cacheCameras;s<u.length;s++){var c=u[s];c.updateMatrixWorld(!0),c.updateProjectionMatrix()}for(var l=0,d=0,f=e;d<f.length;d++){for(var m=f[d],A=0,h=m.viewLayers;A<h.length;A++){var p=h[A];p.scene.modelIndex=l++}m.setMaterial(t),m.cacheCameras=e.cacheCameras,m.update(r,i,o),m.needsRender===!0&&(e.needsRender=!0,m.needsRender=!1),m.refined===!1&&(e.refined=!1),e.refineProgress[0]+=m.refineProgress[0],e.refineProgress[1]+=m.refineProgress[1],m.loaded===!1&&(e.loaded=!1),n.union(m.bounding)}n.isEmpty()&&n.copy(DEFAULT_BOUNDING)}}});return e}function mixNumber(n,t,e){return n+(t-n)*e}function value(n,t,e,r){var i=(t*e+2*n)/Math.pow(e,3),o=-(2*t*e+3*n)/Math.pow(e,2),s=t,u=n;return i*Math.pow(r,3)+o*Math.pow(r,2)+s*r+u}function velocity(n,t,e,r){var i=(t*e+2*n)/Math.pow(e,3),o=-(2*t*e+3*n)/Math.pow(e,2),s=t;return 3*i*Math.pow(r,2)+2*o*r+s}function mixCircle(n,t,e,r){var i=r[1]-r[0];return n=circleValue(n,r),t=circleValue(t,r),t-n>i/2?mixNumber(n+i,t,e):n-t>i/2?mixNumber(n-i,t,e):mixNumber(n,t,e)}function circleValue(n,t){var e=t[1]-t[0];return n<t[0]?circleValue(n+e,t):n>=t[1]?circleValue(n-e,t):n}function mixValue(n,t,e,r){return r?mixCircle(n,t,e,r):mixNumber(n,t,e)}var Motion=function(){function n(t){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=now(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(var e in t){var r=t[e];typeof r=="number"?(this.value[e]=r,this.config[e]={circle:!1}):(this.value[e]=r.value,this.config[e]={circle:r.circle})}this.keyframes=[{progress:0,value:__assign({},this.value)},{progress:1,value:__assign({},this.value)}]}return n.prototype.getProgress=function(t){var e=t-this.startTime;return e<0?0:e>=this.duration?1:1-value(1,this.startVelocity,this.duration,e)},n.prototype.getValue=function(t){for(var e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>t){var r=this.keyframes[e-1],i=this.keyframes[e],o={};for(var s in this.config){var u=(t-r.progress)/(i.progress-r.progress);o[s]=mixValue(r.value[s],i.value[s],u,this.config[s].circle)}return o}return __assign({},this.keyframes[this.keyframes.length-1].value)},n.prototype.getProgressVelocity=function(t){var e=t-this.startTime;return e>=this.duration?0:velocity(1,this.startVelocity,this.duration,e)},n.prototype.update=function(t){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(t))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},n.prototype.getKeyFrameSegment=function(t){for(var e=this.getProgress(t),r=1;r<this.keyframes.length;r++)if(this.keyframes[r].progress>e)return[this.keyframes[r-1],this.keyframes[r]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},n.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},n.prototype.set=function(t,e,r,i){var o;r===void 0&&(r=0),isNaN(e)&&(e=0),isNaN(r)&&(r=0),i=i!=null?i:now();var s=this.getProgress(i),u=this.getValue(s),c={};for(var l in this.config)c[l]=(o=t[l])!==null&&o!==void 0?o:u[l];var d=[{progress:0,value:u},{progress:1,value:c}];return this.setKeyframes(d,e,r,i)},n.prototype.setKeyframes=function(t,e,r,i){var o=this;if(r===void 0&&(r=0),t.length<2)throw new Error("keyframes invalid.");return isNaN(e)&&(e=0),isNaN(r)&&(r=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise(function(s,u){i=i!=null?i:now(),o.progress=0,o.ended=!1,o.startTime=i,o.startVelocity=r,o.keyframes=t,o.duration=e,e===0?(o.progress=1,o.value=__assign({},t[t.length-1].value)):o.value=__assign({},t[0].value),o.callbacks=[s,u]})},n.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},n}(),easeOut$2=function(n){return n*(2-n)},sharedGeometry2$2=function(){var n=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),t=new Float32Array([1,0,0,0,1,1,0,1]),e=new Uint8Array([0,2,1,2,3,1]),r=new THREE__namespace.BufferGeometry;return r.setAttribute("position",new THREE__namespace.BufferAttribute(n,3)),r.setAttribute("uv",new THREE__namespace.BufferAttribute(t,2)),r.setIndex(new THREE__namespace.BufferAttribute(e,1)),r}(),vertexShader$4=`
933
933
  varying vec2 vUv;
934
934
  #include <common>
935
935
  #include <logdepthbuf_pars_vertex>
@@ -1325,7 +1325,7 @@ void main() {
1325
1325
  * Copyright (c) 2016 Jorik Tangelder;
1326
1326
  * Licensed under the MIT license */var Hammer=function(n,t,e,r){var i=["","webkit","Moz","MS","ms","o"],o=t.createElement?t.createElement("div"):r,s="function",u=Math.round,c=Math.abs,l=Date.now;function d(w,P,F){return setTimeout(g(w,F),P)}function f(w,P,F){return Array.isArray(w)?(m(w,F[P],F),!0):!1}function m(w,P,F){var V;if(w)if(w.forEach)w.forEach(P,F);else if(w.length!==r)for(V=0;V<w.length;)P.call(F,w[V],V,w),V++;else for(V in w)w.hasOwnProperty(V)&&P.call(F,w[V],V,w)}function A(w,P,F){var V="DEPRECATED METHOD: "+P+`
1327
1327
  `+F+` AT
1328
- `;return function(){var X=new Error("get-stack-trace"),ae=X&&X.stack?X.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",pe=n.console&&(n.console.warn||n.console.log);return pe&&pe.call(n.console,V,ae),w.apply(this,arguments)}}var h;typeof Object.assign!="function"?h=function(P){if(P===r||P===null)throw new TypeError("Cannot convert undefined or null to object");for(var F=Object(P),V=1;V<arguments.length;V++){var X=arguments[V];if(X!==r&&X!==null)for(var ae in X)X.hasOwnProperty(ae)&&(F[ae]=X[ae])}return F}:h=Object.assign;var p=A(function(P,F,V){for(var X=Object.keys(F),ae=0;ae<X.length;)(!V||V&&P[X[ae]]===r)&&(P[X[ae]]=F[X[ae]]),ae++;return P},"extend","Use `assign`."),y=A(function(P,F){return p(P,F,!0)},"merge","Use `assign`.");function v(w,P,F){var V=P.prototype,X;X=w.prototype=Object.create(V),X.constructor=w,X._super=V,F&&h(X,F)}function g(w,P){return function(){return w.apply(P,arguments)}}function E(w,P){return typeof w==s?w.apply(P&&P[0]||r,P):w}function b(w,P){return w===r?P:w}function T(w,P,F){m(M(P),function(V){w.addEventListener(V,F,!1)})}function x(w,P,F){m(M(P),function(V){w.removeEventListener(V,F,!1)})}function R(w,P){for(;w;){if(w==P)return!0;w=w.parentNode}return!1}function _(w,P){return w.indexOf(P)>-1}function M(w){return w.trim().split(/\s+/g)}function S(w,P,F){if(w.indexOf&&!F)return w.indexOf(P);for(var V=0;V<w.length;){if(F&&w[V][F]==P||!F&&w[V]===P)return V;V++}return-1}function I(w){return Array.prototype.slice.call(w,0)}function C(w,P,F){for(var V=[],X=[],ae=0;ae<w.length;){var pe=w[ae][P];S(X,pe)<0&&V.push(w[ae]),X[ae]=pe,ae++}return V=V.sort(function(Oe,Se){return Oe[P]>Se[P]}),V}function H(w,P){for(var F,V,X=P[0].toUpperCase()+P.slice(1),ae=0;ae<i.length;){if(F=i[ae],V=F?F+X:P,V in w)return V;ae++}return r}var B=1;function L(){return B++}function O(w){var P=w.ownerDocument||w;return P.defaultView||P.parentWindow||n}var k=/mobile|tablet|ip(ad|hone|od)|android/i,G="ontouchstart"in n,z=H(n,"PointerEvent")!==r,D=G&&k.test(navigator.userAgent),U="touch",K="pen",Q="mouse",q="kinect",J=25,W=1,re=2,j=4,te=8,$=1,ne=2,ee=4,fe=8,ie=16,se=ne|ee,Ae=fe|ie,he=se|Ae,me=["x","y"],Z=["clientX","clientY"];function Y(w,P){var F=this;this.manager=w,this.callback=P,this.element=w.element,this.target=w.options.inputTarget,this.domHandler=function(V){E(w.options.enable,[w])&&F.handler(V)},this.init()}Y.prototype={handler:function(){},init:function(){this.evEl&&T(this.element,this.evEl,this.domHandler),this.evTarget&&T(this.target,this.evTarget,this.domHandler),this.evWin&&T(O(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(O(this.element),this.evWin,this.domHandler)}};function N(w){var P,F=w.options.inputClass;return F?P=F:z?P=We:D?P=Fe:G?P=Ne:P=Be,new P(w,Ee)}function Ee(w,P,F){var V=F.pointers.length,X=F.changedPointers.length,ae=P&W&&V-X===0,pe=P&(j|te)&&V-X===0;F.isFirst=!!ae,F.isFinal=!!pe,ae&&(w.session={}),F.eventType=P,ge(w,F),w.emit("hammer.input",F),w.recognize(F),w.session.prevInput=F}function ge(w,P){var F=w.session,V=P.pointers,X=V.length;F.firstInput||(F.firstInput=de(P)),X>1&&!F.firstMultiple?F.firstMultiple=de(P):X===1&&(F.firstMultiple=!1);var ae=F.firstInput,pe=F.firstMultiple,Ce=pe?pe.center:ae.center,Oe=P.center=ce(V);P.timeStamp=l(),P.deltaTime=P.timeStamp-ae.timeStamp,P.angle=Te(Ce,Oe),P.distance=oe(Ce,Oe),ve(F,P),P.offsetDirection=ue(P.deltaX,P.deltaY);var Se=le(P.deltaTime,P.deltaX,P.deltaY);P.overallVelocityX=Se.x,P.overallVelocityY=Se.y,P.overallVelocity=c(Se.x)>c(Se.y)?Se.x:Se.y,P.scale=pe?Ie(pe.pointers,V):1,P.rotation=pe?Re(pe.pointers,V):0,P.maxPointers=F.prevInput?P.pointers.length>F.prevInput.maxPointers?P.pointers.length:F.prevInput.maxPointers:P.pointers.length,xe(F,P);var Ye=w.element;R(P.srcEvent.target,Ye)&&(Ye=P.srcEvent.target),P.target=Ye}function ve(w,P){var F=P.center,V=w.offsetDelta||{},X=w.prevDelta||{},ae=w.prevInput||{};(P.eventType===W||ae.eventType===j)&&(X=w.prevDelta={x:ae.deltaX||0,y:ae.deltaY||0},V=w.offsetDelta={x:F.x,y:F.y}),P.deltaX=X.x+(F.x-V.x),P.deltaY=X.y+(F.y-V.y)}function xe(w,P){var F=w.lastInterval||P,V=P.timeStamp-F.timeStamp,X,ae,pe,Ce;if(P.eventType!=te&&(V>J||F.velocity===r)){var Oe=P.deltaX-F.deltaX,Se=P.deltaY-F.deltaY,Ye=le(V,Oe,Se);ae=Ye.x,pe=Ye.y,X=c(Ye.x)>c(Ye.y)?Ye.x:Ye.y,Ce=ue(Oe,Se),w.lastInterval=P}else X=F.velocity,ae=F.velocityX,pe=F.velocityY,Ce=F.direction;P.velocity=X,P.velocityX=ae,P.velocityY=pe,P.direction=Ce}function de(w){for(var P=[],F=0;F<w.pointers.length;)P[F]={clientX:u(w.pointers[F].clientX),clientY:u(w.pointers[F].clientY)},F++;return{timeStamp:l(),pointers:P,center:ce(P),deltaX:w.deltaX,deltaY:w.deltaY}}function ce(w){var P=w.length;if(P===1)return{x:u(w[0].clientX),y:u(w[0].clientY)};for(var F=0,V=0,X=0;X<P;)F+=w[X].clientX,V+=w[X].clientY,X++;return{x:u(F/P),y:u(V/P)}}function le(w,P,F){return{x:P/w||0,y:F/w||0}}function ue(w,P){return w===P?$:c(w)>=c(P)?w<0?ne:ee:P<0?fe:ie}function oe(w,P,F){F||(F=me);var V=P[F[0]]-w[F[0]],X=P[F[1]]-w[F[1]];return Math.sqrt(V*V+X*X)}function Te(w,P,F){F||(F=me);var V=P[F[0]]-w[F[0]],X=P[F[1]]-w[F[1]];return Math.atan2(X,V)*180/Math.PI}function Re(w,P){return Te(P[1],P[0],Z)+Te(w[1],w[0],Z)}function Ie(w,P){return oe(P[0],P[1],Z)/oe(w[0],w[1],Z)}var lt={mousedown:W,mousemove:re,mouseup:j},ye="mousedown",we="mousemove mouseup";function Be(){this.evEl=ye,this.evWin=we,this.pressed=!1,Y.apply(this,arguments)}v(Be,Y,{handler:function(P){var F=lt[P.type];F&W&&(P.button===0||P.button===2)&&(this.pressed=!0),F&re&&P.which!==1&&(F=j),this.pressed&&(F&j&&(this.pressed=!1),this.callback(this.manager,F,{pointers:[P],changedPointers:[P],pointerType:Q,srcEvent:P}))}});var Je={pointerdown:W,pointermove:re,pointerup:j,pointercancel:te,pointerout:te},ht={2:U,3:K,4:Q,5:q},Xe="pointerdown",Ve="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(Xe="MSPointerDown",Ve="MSPointerMove MSPointerUp MSPointerCancel");function We(){this.evEl=Xe,this.evWin=Ve,Y.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}v(We,Y,{handler:function(P){var F=this.store,V=!1,X=!1,ae=P.type.toLowerCase().replace("ms",""),pe=Je[ae],Ce=ht[P.pointerType]||P.pointerType,Oe=Ce==U,Se=S(F,P.pointerId,"pointerId");pe&W&&(P.button===0||P.button===2||Oe)?Se<0&&(F.push(P),Se=F.length-1):pe&(j|te)?V=!0:!Oe&&P.buttons===0&&(V=!0,X=!0,pe=Je.pointerup),!(Se<0)&&(X||(F[Se]=P),this.callback(this.manager,pe,{pointers:F,changedPointers:[P],pointerType:Ce,srcEvent:F[Se]}),V&&F.splice(Se,1))}});var it={touchstart:W,touchmove:re,touchend:j,touchcancel:te},Ue="touchstart",je="touchstart touchmove touchend touchcancel";function ze(){this.evTarget=Ue,this.evWin=je,this.started=!1,Y.apply(this,arguments)}v(ze,Y,{handler:function(P){var F=it[P.type];if(F===W&&(this.started=!0),!!this.started){var V=He.call(this,P,F);F&(j|te)&&V[0].length-V[1].length===0&&(this.started=!1),this.callback(this.manager,F,{pointers:V[0],changedPointers:V[1],pointerType:U,srcEvent:P})}}});function He(w,P){var F=I(w.touches),V=I(w.changedTouches);return P&(j|te)&&(F=C(F.concat(V),"identifier")),[F,V]}var be={touchstart:W,touchmove:re,touchend:j,touchcancel:te},$e="touchstart touchmove touchend touchcancel";function Fe(){this.evTarget=$e,this.targetIds={},Y.apply(this,arguments)}v(Fe,Y,{handler:function(P){var F=be[P.type],V=et.call(this,P,F);V&&this.callback(this.manager,F,{pointers:V[0],changedPointers:V[1],pointerType:U,srcEvent:P})}});function et(w,P){var F=I(w.touches),V=this.targetIds;if(P&(W|re)&&F.length===1)return V[F[0].identifier]=!0,[F,F];var X,ae,pe=I(w.changedTouches),Ce=[],Oe=this.target;if(ae=F.filter(function(Se){return R(Se.target,Oe)}),P===W)for(X=0;X<ae.length;)V[ae[X].identifier]=!0,X++;for(X=0;X<pe.length;)V[pe[X].identifier]&&Ce.push(pe[X]),P&(j|te)&&delete V[pe[X].identifier],X++;if(Ce.length)return[C(ae.concat(Ce),"identifier"),Ce]}var tt=2500,Qe=25;function Ne(){Y.apply(this,arguments);var w=g(this.handler,this);this.touch=new Fe(this.manager,w),this.mouse=new Be(this.manager,w),this.primaryTouch=null,this.lastTouches=[]}v(Ne,Y,{handler:function(P,F,V){var X=V.pointerType==U,ae=V.pointerType==Q;if(!(ae&&V.sourceCapabilities&&V.sourceCapabilities.firesTouchEvents)){if(X)rt.call(this,F,V);else if(ae&&pt.call(this,V))return;this.callback(P,F,V)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function rt(w,P){w&W?(this.primaryTouch=P.changedPointers[0].identifier,ot.call(this,P)):w&(j|te)&&ot.call(this,P)}function ot(w){var P=w.changedPointers[0];if(P.identifier===this.primaryTouch){var F={x:P.clientX,y:P.clientY};this.lastTouches.push(F);var V=this.lastTouches,X=function(){var ae=V.indexOf(F);ae>-1&&V.splice(ae,1)};setTimeout(X,tt)}}function pt(w){for(var P=w.srcEvent.clientX,F=w.srcEvent.clientY,V=0;V<this.lastTouches.length;V++){var X=this.lastTouches[V],ae=Math.abs(P-X.x),pe=Math.abs(F-X.y);if(ae<=Qe&&pe<=Qe)return!0}return!1}var ct=o?H(o.style,"touchAction"):r,dt=ct!==r,Ge="compute",Me="auto",_e="manipulation",Pe="none",ke="pan-x",Le="pan-y",qe=Pt();function st(w,P){this.manager=w,this.set(P)}st.prototype={set:function(w){w==Ge&&(w=this.compute()),dt&&this.manager.element.style&&qe[w]&&(this.manager.element.style[ct]=w),this.actions=w.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var w=[];return m(this.manager.recognizers,function(P){E(P.options.enable,[P])&&(w=w.concat(P.getTouchAction()))}),ft(w.join(" "))},preventDefaults:function(w){var P=w.srcEvent,F=w.offsetDirection;if(this.manager.session.prevented){P.preventDefault();return}var V=this.actions,X=_(V,Pe)&&!qe[Pe],ae=_(V,Le)&&!qe[Le],pe=_(V,ke)&&!qe[ke];if(X){var Ce=w.pointers.length===1,Oe=w.distance<2,Se=w.deltaTime<250;if(Ce&&Oe&&Se)return}if(!(pe&&ae)&&(X||ae&&F&se||pe&&F&Ae))return this.preventSrc(P)},preventSrc:function(w){this.manager.session.prevented=!0,w.preventDefault()}};function ft(w){if(_(w,Pe))return Pe;var P=_(w,ke),F=_(w,Le);return P&&F?Pe:P||F?P?ke:Le:_(w,_e)?_e:Me}function Pt(){if(!dt)return!1;var w={},P=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(F){w[F]=P?n.CSS.supports("touch-action",F):!0}),w}var gt=1,De=2,vt=4,ut=8,nt=ut,At=16,Ze=32;function at(w){this.options=h({},this.defaults,w||{}),this.id=L(),this.manager=null,this.options.enable=b(this.options.enable,!0),this.state=gt,this.simultaneous={},this.requireFail=[]}at.prototype={defaults:{},set:function(w){return h(this.options,w),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(w){if(f(w,"recognizeWith",this))return this;var P=this.simultaneous;return w=yt(w,this),P[w.id]||(P[w.id]=w,w.recognizeWith(this)),this},dropRecognizeWith:function(w){return f(w,"dropRecognizeWith",this)?this:(w=yt(w,this),delete this.simultaneous[w.id],this)},requireFailure:function(w){if(f(w,"requireFailure",this))return this;var P=this.requireFail;return w=yt(w,this),S(P,w)===-1&&(P.push(w),w.requireFailure(this)),this},dropRequireFailure:function(w){if(f(w,"dropRequireFailure",this))return this;w=yt(w,this);var P=S(this.requireFail,w);return P>-1&&this.requireFail.splice(P,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(w){return!!this.simultaneous[w.id]},emit:function(w){var P=this,F=this.state;function V(X){P.manager.emit(X,w)}F<ut&&V(P.options.event+wt(F)),V(P.options.event),w.additionalEvent&&V(w.additionalEvent),F>=ut&&V(P.options.event+wt(F))},tryEmit:function(w){if(this.canEmit())return this.emit(w);this.state=Ze},canEmit:function(){for(var w=0;w<this.requireFail.length;){if(!(this.requireFail[w].state&(Ze|gt)))return!1;w++}return!0},recognize:function(w){var P=h({},w);if(!E(this.options.enable,[this,P])){this.reset(),this.state=Ze;return}this.state&(nt|At|Ze)&&(this.state=gt),this.state=this.process(P),this.state&(De|vt|ut|At)&&this.tryEmit(P)},process:function(w){},getTouchAction:function(){},reset:function(){}};function wt(w){return w&At?"cancel":w&ut?"end":w&vt?"move":w&De?"start":""}function Mt(w){return w==ie?"down":w==fe?"up":w==ne?"left":w==ee?"right":""}function yt(w,P){var F=P.manager;return F?F.get(w):w}function Ke(){at.apply(this,arguments)}v(Ke,at,{defaults:{pointers:1},attrTest:function(w){var P=this.options.pointers;return P===0||w.pointers.length===P},process:function(w){var P=this.state,F=w.eventType,V=P&(De|vt),X=this.attrTest(w);return V&&(F&te||!X)?P|At:V||X?F&j?P|ut:P&De?P|vt:De:Ze}});function bt(){Ke.apply(this,arguments),this.pX=null,this.pY=null}v(bt,Ke,{defaults:{event:"pan",threshold:10,pointers:1,direction:he},getTouchAction:function(){var w=this.options.direction,P=[];return w&se&&P.push(Le),w&Ae&&P.push(ke),P},directionTest:function(w){var P=this.options,F=!0,V=w.distance,X=w.direction,ae=w.deltaX,pe=w.deltaY;return X&P.direction||(P.direction&se?(X=ae===0?$:ae<0?ne:ee,F=ae!=this.pX,V=Math.abs(w.deltaX)):(X=pe===0?$:pe<0?fe:ie,F=pe!=this.pY,V=Math.abs(w.deltaY))),w.direction=X,F&&V>P.threshold&&X&P.direction},attrTest:function(w){return Ke.prototype.attrTest.call(this,w)&&(this.state&De||!(this.state&De)&&this.directionTest(w))},emit:function(w){this.pX=w.deltaX,this.pY=w.deltaY;var P=Mt(w.direction);P&&(w.additionalEvent=this.options.event+P),this._super.emit.call(this,w)}});function Tt(){Ke.apply(this,arguments)}v(Tt,Ke,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(w){return this._super.attrTest.call(this,w)&&(Math.abs(w.scale-1)>this.options.threshold||this.state&De)},emit:function(w){if(w.scale!==1){var P=w.scale<1?"in":"out";w.additionalEvent=this.options.event+P}this._super.emit.call(this,w)}});function _t(){at.apply(this,arguments),this._timer=null,this._input=null}v(_t,at,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Me]},process:function(w){var P=this.options,F=w.pointers.length===P.pointers,V=w.distance<P.threshold,X=w.deltaTime>P.time;if(this._input=w,!V||!F||w.eventType&(j|te)&&!X)this.reset();else if(w.eventType&W)this.reset(),this._timer=d(function(){this.state=nt,this.tryEmit()},P.time,this);else if(w.eventType&j)return nt;return Ze},reset:function(){clearTimeout(this._timer)},emit:function(w){this.state===nt&&(w&&w.eventType&j?this.manager.emit(this.options.event+"up",w):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}});function xt(){Ke.apply(this,arguments)}v(xt,Ke,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(w){return this._super.attrTest.call(this,w)&&(Math.abs(w.rotation)>this.options.threshold||this.state&De)}});function Rt(){Ke.apply(this,arguments)}v(Rt,Ke,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:se|Ae,pointers:1},getTouchAction:function(){return bt.prototype.getTouchAction.call(this)},attrTest:function(w){var P=this.options.direction,F;return P&(se|Ae)?F=w.overallVelocity:P&se?F=w.overallVelocityX:P&Ae&&(F=w.overallVelocityY),this._super.attrTest.call(this,w)&&P&w.offsetDirection&&w.distance>this.options.threshold&&w.maxPointers==this.options.pointers&&c(F)>this.options.velocity&&w.eventType&j},emit:function(w){var P=Mt(w.offsetDirection);P&&this.manager.emit(this.options.event+P,w),this.manager.emit(this.options.event,w)}});function Et(){at.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}v(Et,at,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[_e]},process:function(w){var P=this.options,F=w.pointers.length===P.pointers,V=w.distance<P.threshold,X=w.deltaTime<P.time;if(this.reset(),w.eventType&W&&this.count===0)return this.failTimeout();if(V&&X&&F){if(w.eventType!=j)return this.failTimeout();var ae=this.pTime?w.timeStamp-this.pTime<P.interval:!0,pe=!this.pCenter||oe(this.pCenter,w.center)<P.posThreshold;this.pTime=w.timeStamp,this.pCenter=w.center,!pe||!ae?this.count=1:this.count+=1,this._input=w;var Ce=this.count%P.taps;if(Ce===0)return this.hasRequireFailures()?(this._timer=d(function(){this.state=nt,this.tryEmit()},P.interval,this),De):nt}return Ze},failTimeout:function(){return this._timer=d(function(){this.state=Ze},this.options.interval,this),Ze},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==nt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function mt(w,P){return P=P||{},P.recognizers=b(P.recognizers,mt.defaults.preset),new St(w,P)}mt.VERSION="2.0.7",mt.defaults={domEvents:!1,touchAction:Ge,enable:!0,inputTarget:null,inputClass:null,preset:[[xt,{enable:!1}],[Tt,{enable:!1},["rotate"]],[Rt,{direction:se}],[bt,{direction:se},["swipe"]],[Et],[Et,{event:"doubletap",taps:2},["tap"]],[_t]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Bt=1,Ct=2;function St(w,P){this.options=h({},mt.defaults,P||{}),this.options.inputTarget=this.options.inputTarget||w,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=w,this.input=N(this),this.touchAction=new st(this,this.options.touchAction),It(this,!0),m(this.options.recognizers,function(F){var V=this.add(new F[0](F[1]));F[2]&&V.recognizeWith(F[2]),F[3]&&V.requireFailure(F[3])},this)}St.prototype={set:function(w){return h(this.options,w),w.touchAction&&this.touchAction.update(),w.inputTarget&&(this.input.destroy(),this.input.target=w.inputTarget,this.input.init()),this},stop:function(w){this.session.stopped=w?Ct:Bt},recognize:function(w){var P=this.session;if(!P.stopped){this.touchAction.preventDefaults(w);var F,V=this.recognizers,X=P.curRecognizer;(!X||X&&X.state&nt)&&(X=P.curRecognizer=null);for(var ae=0;ae<V.length;)F=V[ae],P.stopped!==Ct&&(!X||F==X||F.canRecognizeWith(X))?F.recognize(w):F.reset(),!X&&F.state&(De|vt|ut)&&(X=P.curRecognizer=F),ae++}},get:function(w){if(w instanceof at)return w;for(var P=this.recognizers,F=0;F<P.length;F++)if(P[F].options.event==w)return P[F];return null},add:function(w){if(f(w,"add",this))return this;var P=this.get(w.options.event);return P&&this.remove(P),this.recognizers.push(w),w.manager=this,this.touchAction.update(),w},remove:function(w){if(f(w,"remove",this))return this;if(w=this.get(w),w){var P=this.recognizers,F=S(P,w);F!==-1&&(P.splice(F,1),this.touchAction.update())}return this},on:function(w,P){if(w!==r&&P!==r){var F=this.handlers;return m(M(w),function(V){F[V]=F[V]||[],F[V].push(P)}),this}},off:function(w,P){if(w!==r){var F=this.handlers;return m(M(w),function(V){P?F[V]&&F[V].splice(S(F[V],P),1):delete F[V]}),this}},emit:function(w,P){this.options.domEvents&&Ht(w,P);var F=this.handlers[w]&&this.handlers[w].slice();if(!(!F||!F.length)){P.type=w,P.preventDefault=function(){P.srcEvent.preventDefault()};for(var V=0;V<F.length;)F[V](P),V++}},destroy:function(){this.element&&It(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function It(w,P){var F=w.element;if(F.style){var V;m(w.options.cssProps,function(X,ae){V=H(F.style,ae),P?(w.oldCssProps[V]=F.style[V],F.style[V]=X):F.style[V]=w.oldCssProps[V]||""}),P||(w.oldCssProps={})}}function Ht(w,P){var F=t.createEvent("Event");F.initEvent(w,!0,!0),F.gesture=P,P.target.dispatchEvent(F)}return h(mt,{INPUT_START:W,INPUT_MOVE:re,INPUT_END:j,INPUT_CANCEL:te,STATE_POSSIBLE:gt,STATE_BEGAN:De,STATE_CHANGED:vt,STATE_ENDED:ut,STATE_RECOGNIZED:nt,STATE_CANCELLED:At,STATE_FAILED:Ze,DIRECTION_NONE:$,DIRECTION_LEFT:ne,DIRECTION_RIGHT:ee,DIRECTION_UP:fe,DIRECTION_DOWN:ie,DIRECTION_HORIZONTAL:se,DIRECTION_VERTICAL:Ae,DIRECTION_ALL:he,Manager:St,Input:Y,TouchAction:st,TouchInput:Fe,MouseInput:Be,PointerEventInput:We,TouchMouseInput:Ne,SingleTouchInput:ze,Recognizer:at,AttrRecognizer:Ke,Tap:Et,Pan:bt,Swipe:Rt,Pinch:Tt,Rotate:xt,Press:_t,on:T,off:x,each:m,merge:y,extend:p,assign:h,inherit:v,bindFn:g,prefixed:H}),mt}(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{});function calculateThreeMouse(n,t,e){var r=t.getBoundingClientRect(),i=r.top,o=r.left,s=r.width,u=r.height;return e&&(o=o+s*e.left,i=i+u*(1-e.bottom-e.height),s=s*e.width,u=u*e.height),new THREE__namespace.Vector2((n.x-o)/s*2-1,-(n.y-i)/u*2+1)}var camera$2=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$5=new THREE__namespace.BufferGeometry;geometry$5.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$5.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$4=new THREE__namespace.Mesh(geometry$5),scene$2=new THREE__namespace.Scene;scene$2.add(mesh$4);var DEFAULT_VERTEX_SHADER=`
1328
+ `;return function(){var X=new Error("get-stack-trace"),ae=X&&X.stack?X.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",pe=n.console&&(n.console.warn||n.console.log);return pe&&pe.call(n.console,V,ae),w.apply(this,arguments)}}var h;typeof Object.assign!="function"?h=function(P){if(P===r||P===null)throw new TypeError("Cannot convert undefined or null to object");for(var F=Object(P),V=1;V<arguments.length;V++){var X=arguments[V];if(X!==r&&X!==null)for(var ae in X)X.hasOwnProperty(ae)&&(F[ae]=X[ae])}return F}:h=Object.assign;var p=A(function(P,F,V){for(var X=Object.keys(F),ae=0;ae<X.length;)(!V||V&&P[X[ae]]===r)&&(P[X[ae]]=F[X[ae]]),ae++;return P},"extend","Use `assign`."),y=A(function(P,F){return p(P,F,!0)},"merge","Use `assign`.");function v(w,P,F){var V=P.prototype,X;X=w.prototype=Object.create(V),X.constructor=w,X._super=V,F&&h(X,F)}function g(w,P){return function(){return w.apply(P,arguments)}}function E(w,P){return typeof w==s?w.apply(P&&P[0]||r,P):w}function b(w,P){return w===r?P:w}function T(w,P,F){m(M(P),function(V){w.addEventListener(V,F,!1)})}function x(w,P,F){m(M(P),function(V){w.removeEventListener(V,F,!1)})}function R(w,P){for(;w;){if(w==P)return!0;w=w.parentNode}return!1}function _(w,P){return w.indexOf(P)>-1}function M(w){return w.trim().split(/\s+/g)}function S(w,P,F){if(w.indexOf&&!F)return w.indexOf(P);for(var V=0;V<w.length;){if(F&&w[V][F]==P||!F&&w[V]===P)return V;V++}return-1}function I(w){return Array.prototype.slice.call(w,0)}function C(w,P,F){for(var V=[],X=[],ae=0;ae<w.length;){var pe=w[ae][P];S(X,pe)<0&&V.push(w[ae]),X[ae]=pe,ae++}return V=V.sort(function(Oe,Se){return Oe[P]>Se[P]}),V}function H(w,P){for(var F,V,X=P[0].toUpperCase()+P.slice(1),ae=0;ae<i.length;){if(F=i[ae],V=F?F+X:P,V in w)return V;ae++}return r}var B=1;function L(){return B++}function O(w){var P=w.ownerDocument||w;return P.defaultView||P.parentWindow||n}var k=/mobile|tablet|ip(ad|hone|od)|android/i,G="ontouchstart"in n,z=H(n,"PointerEvent")!==r,D=G&&k.test(navigator.userAgent),U="touch",K="pen",Q="mouse",q="kinect",J=25,j=1,re=2,W=4,te=8,$=1,ne=2,ee=4,fe=8,ie=16,se=ne|ee,Ae=fe|ie,he=se|Ae,me=["x","y"],Z=["clientX","clientY"];function Y(w,P){var F=this;this.manager=w,this.callback=P,this.element=w.element,this.target=w.options.inputTarget,this.domHandler=function(V){E(w.options.enable,[w])&&F.handler(V)},this.init()}Y.prototype={handler:function(){},init:function(){this.evEl&&T(this.element,this.evEl,this.domHandler),this.evTarget&&T(this.target,this.evTarget,this.domHandler),this.evWin&&T(O(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(O(this.element),this.evWin,this.domHandler)}};function N(w){var P,F=w.options.inputClass;return F?P=F:z?P=je:D?P=Fe:G?P=Ne:P=Be,new P(w,Ee)}function Ee(w,P,F){var V=F.pointers.length,X=F.changedPointers.length,ae=P&j&&V-X===0,pe=P&(W|te)&&V-X===0;F.isFirst=!!ae,F.isFinal=!!pe,ae&&(w.session={}),F.eventType=P,ge(w,F),w.emit("hammer.input",F),w.recognize(F),w.session.prevInput=F}function ge(w,P){var F=w.session,V=P.pointers,X=V.length;F.firstInput||(F.firstInput=de(P)),X>1&&!F.firstMultiple?F.firstMultiple=de(P):X===1&&(F.firstMultiple=!1);var ae=F.firstInput,pe=F.firstMultiple,Ce=pe?pe.center:ae.center,Oe=P.center=ce(V);P.timeStamp=l(),P.deltaTime=P.timeStamp-ae.timeStamp,P.angle=Te(Ce,Oe),P.distance=oe(Ce,Oe),ve(F,P),P.offsetDirection=ue(P.deltaX,P.deltaY);var Se=le(P.deltaTime,P.deltaX,P.deltaY);P.overallVelocityX=Se.x,P.overallVelocityY=Se.y,P.overallVelocity=c(Se.x)>c(Se.y)?Se.x:Se.y,P.scale=pe?Ie(pe.pointers,V):1,P.rotation=pe?Re(pe.pointers,V):0,P.maxPointers=F.prevInput?P.pointers.length>F.prevInput.maxPointers?P.pointers.length:F.prevInput.maxPointers:P.pointers.length,xe(F,P);var Ye=w.element;R(P.srcEvent.target,Ye)&&(Ye=P.srcEvent.target),P.target=Ye}function ve(w,P){var F=P.center,V=w.offsetDelta||{},X=w.prevDelta||{},ae=w.prevInput||{};(P.eventType===j||ae.eventType===W)&&(X=w.prevDelta={x:ae.deltaX||0,y:ae.deltaY||0},V=w.offsetDelta={x:F.x,y:F.y}),P.deltaX=X.x+(F.x-V.x),P.deltaY=X.y+(F.y-V.y)}function xe(w,P){var F=w.lastInterval||P,V=P.timeStamp-F.timeStamp,X,ae,pe,Ce;if(P.eventType!=te&&(V>J||F.velocity===r)){var Oe=P.deltaX-F.deltaX,Se=P.deltaY-F.deltaY,Ye=le(V,Oe,Se);ae=Ye.x,pe=Ye.y,X=c(Ye.x)>c(Ye.y)?Ye.x:Ye.y,Ce=ue(Oe,Se),w.lastInterval=P}else X=F.velocity,ae=F.velocityX,pe=F.velocityY,Ce=F.direction;P.velocity=X,P.velocityX=ae,P.velocityY=pe,P.direction=Ce}function de(w){for(var P=[],F=0;F<w.pointers.length;)P[F]={clientX:u(w.pointers[F].clientX),clientY:u(w.pointers[F].clientY)},F++;return{timeStamp:l(),pointers:P,center:ce(P),deltaX:w.deltaX,deltaY:w.deltaY}}function ce(w){var P=w.length;if(P===1)return{x:u(w[0].clientX),y:u(w[0].clientY)};for(var F=0,V=0,X=0;X<P;)F+=w[X].clientX,V+=w[X].clientY,X++;return{x:u(F/P),y:u(V/P)}}function le(w,P,F){return{x:P/w||0,y:F/w||0}}function ue(w,P){return w===P?$:c(w)>=c(P)?w<0?ne:ee:P<0?fe:ie}function oe(w,P,F){F||(F=me);var V=P[F[0]]-w[F[0]],X=P[F[1]]-w[F[1]];return Math.sqrt(V*V+X*X)}function Te(w,P,F){F||(F=me);var V=P[F[0]]-w[F[0]],X=P[F[1]]-w[F[1]];return Math.atan2(X,V)*180/Math.PI}function Re(w,P){return Te(P[1],P[0],Z)+Te(w[1],w[0],Z)}function Ie(w,P){return oe(P[0],P[1],Z)/oe(w[0],w[1],Z)}var lt={mousedown:j,mousemove:re,mouseup:W},ye="mousedown",we="mousemove mouseup";function Be(){this.evEl=ye,this.evWin=we,this.pressed=!1,Y.apply(this,arguments)}v(Be,Y,{handler:function(P){var F=lt[P.type];F&j&&(P.button===0||P.button===2)&&(this.pressed=!0),F&re&&P.which!==1&&(F=W),this.pressed&&(F&W&&(this.pressed=!1),this.callback(this.manager,F,{pointers:[P],changedPointers:[P],pointerType:Q,srcEvent:P}))}});var Je={pointerdown:j,pointermove:re,pointerup:W,pointercancel:te,pointerout:te},ht={2:U,3:K,4:Q,5:q},Xe="pointerdown",Ve="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(Xe="MSPointerDown",Ve="MSPointerMove MSPointerUp MSPointerCancel");function je(){this.evEl=Xe,this.evWin=Ve,Y.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}v(je,Y,{handler:function(P){var F=this.store,V=!1,X=!1,ae=P.type.toLowerCase().replace("ms",""),pe=Je[ae],Ce=ht[P.pointerType]||P.pointerType,Oe=Ce==U,Se=S(F,P.pointerId,"pointerId");pe&j&&(P.button===0||P.button===2||Oe)?Se<0&&(F.push(P),Se=F.length-1):pe&(W|te)?V=!0:!Oe&&P.buttons===0&&(V=!0,X=!0,pe=Je.pointerup),!(Se<0)&&(X||(F[Se]=P),this.callback(this.manager,pe,{pointers:F,changedPointers:[P],pointerType:Ce,srcEvent:F[Se]}),V&&F.splice(Se,1))}});var it={touchstart:j,touchmove:re,touchend:W,touchcancel:te},Ue="touchstart",We="touchstart touchmove touchend touchcancel";function ze(){this.evTarget=Ue,this.evWin=We,this.started=!1,Y.apply(this,arguments)}v(ze,Y,{handler:function(P){var F=it[P.type];if(F===j&&(this.started=!0),!!this.started){var V=He.call(this,P,F);F&(W|te)&&V[0].length-V[1].length===0&&(this.started=!1),this.callback(this.manager,F,{pointers:V[0],changedPointers:V[1],pointerType:U,srcEvent:P})}}});function He(w,P){var F=I(w.touches),V=I(w.changedTouches);return P&(W|te)&&(F=C(F.concat(V),"identifier")),[F,V]}var be={touchstart:j,touchmove:re,touchend:W,touchcancel:te},$e="touchstart touchmove touchend touchcancel";function Fe(){this.evTarget=$e,this.targetIds={},Y.apply(this,arguments)}v(Fe,Y,{handler:function(P){var F=be[P.type],V=et.call(this,P,F);V&&this.callback(this.manager,F,{pointers:V[0],changedPointers:V[1],pointerType:U,srcEvent:P})}});function et(w,P){var F=I(w.touches),V=this.targetIds;if(P&(j|re)&&F.length===1)return V[F[0].identifier]=!0,[F,F];var X,ae,pe=I(w.changedTouches),Ce=[],Oe=this.target;if(ae=F.filter(function(Se){return R(Se.target,Oe)}),P===j)for(X=0;X<ae.length;)V[ae[X].identifier]=!0,X++;for(X=0;X<pe.length;)V[pe[X].identifier]&&Ce.push(pe[X]),P&(W|te)&&delete V[pe[X].identifier],X++;if(Ce.length)return[C(ae.concat(Ce),"identifier"),Ce]}var tt=2500,Qe=25;function Ne(){Y.apply(this,arguments);var w=g(this.handler,this);this.touch=new Fe(this.manager,w),this.mouse=new Be(this.manager,w),this.primaryTouch=null,this.lastTouches=[]}v(Ne,Y,{handler:function(P,F,V){var X=V.pointerType==U,ae=V.pointerType==Q;if(!(ae&&V.sourceCapabilities&&V.sourceCapabilities.firesTouchEvents)){if(X)rt.call(this,F,V);else if(ae&&pt.call(this,V))return;this.callback(P,F,V)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function rt(w,P){w&j?(this.primaryTouch=P.changedPointers[0].identifier,ot.call(this,P)):w&(W|te)&&ot.call(this,P)}function ot(w){var P=w.changedPointers[0];if(P.identifier===this.primaryTouch){var F={x:P.clientX,y:P.clientY};this.lastTouches.push(F);var V=this.lastTouches,X=function(){var ae=V.indexOf(F);ae>-1&&V.splice(ae,1)};setTimeout(X,tt)}}function pt(w){for(var P=w.srcEvent.clientX,F=w.srcEvent.clientY,V=0;V<this.lastTouches.length;V++){var X=this.lastTouches[V],ae=Math.abs(P-X.x),pe=Math.abs(F-X.y);if(ae<=Qe&&pe<=Qe)return!0}return!1}var ct=o?H(o.style,"touchAction"):r,dt=ct!==r,Ge="compute",Me="auto",_e="manipulation",Pe="none",ke="pan-x",Le="pan-y",qe=Pt();function st(w,P){this.manager=w,this.set(P)}st.prototype={set:function(w){w==Ge&&(w=this.compute()),dt&&this.manager.element.style&&qe[w]&&(this.manager.element.style[ct]=w),this.actions=w.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var w=[];return m(this.manager.recognizers,function(P){E(P.options.enable,[P])&&(w=w.concat(P.getTouchAction()))}),ft(w.join(" "))},preventDefaults:function(w){var P=w.srcEvent,F=w.offsetDirection;if(this.manager.session.prevented){P.preventDefault();return}var V=this.actions,X=_(V,Pe)&&!qe[Pe],ae=_(V,Le)&&!qe[Le],pe=_(V,ke)&&!qe[ke];if(X){var Ce=w.pointers.length===1,Oe=w.distance<2,Se=w.deltaTime<250;if(Ce&&Oe&&Se)return}if(!(pe&&ae)&&(X||ae&&F&se||pe&&F&Ae))return this.preventSrc(P)},preventSrc:function(w){this.manager.session.prevented=!0,w.preventDefault()}};function ft(w){if(_(w,Pe))return Pe;var P=_(w,ke),F=_(w,Le);return P&&F?Pe:P||F?P?ke:Le:_(w,_e)?_e:Me}function Pt(){if(!dt)return!1;var w={},P=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(F){w[F]=P?n.CSS.supports("touch-action",F):!0}),w}var gt=1,De=2,vt=4,ut=8,nt=ut,At=16,Ze=32;function at(w){this.options=h({},this.defaults,w||{}),this.id=L(),this.manager=null,this.options.enable=b(this.options.enable,!0),this.state=gt,this.simultaneous={},this.requireFail=[]}at.prototype={defaults:{},set:function(w){return h(this.options,w),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(w){if(f(w,"recognizeWith",this))return this;var P=this.simultaneous;return w=yt(w,this),P[w.id]||(P[w.id]=w,w.recognizeWith(this)),this},dropRecognizeWith:function(w){return f(w,"dropRecognizeWith",this)?this:(w=yt(w,this),delete this.simultaneous[w.id],this)},requireFailure:function(w){if(f(w,"requireFailure",this))return this;var P=this.requireFail;return w=yt(w,this),S(P,w)===-1&&(P.push(w),w.requireFailure(this)),this},dropRequireFailure:function(w){if(f(w,"dropRequireFailure",this))return this;w=yt(w,this);var P=S(this.requireFail,w);return P>-1&&this.requireFail.splice(P,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(w){return!!this.simultaneous[w.id]},emit:function(w){var P=this,F=this.state;function V(X){P.manager.emit(X,w)}F<ut&&V(P.options.event+wt(F)),V(P.options.event),w.additionalEvent&&V(w.additionalEvent),F>=ut&&V(P.options.event+wt(F))},tryEmit:function(w){if(this.canEmit())return this.emit(w);this.state=Ze},canEmit:function(){for(var w=0;w<this.requireFail.length;){if(!(this.requireFail[w].state&(Ze|gt)))return!1;w++}return!0},recognize:function(w){var P=h({},w);if(!E(this.options.enable,[this,P])){this.reset(),this.state=Ze;return}this.state&(nt|At|Ze)&&(this.state=gt),this.state=this.process(P),this.state&(De|vt|ut|At)&&this.tryEmit(P)},process:function(w){},getTouchAction:function(){},reset:function(){}};function wt(w){return w&At?"cancel":w&ut?"end":w&vt?"move":w&De?"start":""}function Mt(w){return w==ie?"down":w==fe?"up":w==ne?"left":w==ee?"right":""}function yt(w,P){var F=P.manager;return F?F.get(w):w}function Ke(){at.apply(this,arguments)}v(Ke,at,{defaults:{pointers:1},attrTest:function(w){var P=this.options.pointers;return P===0||w.pointers.length===P},process:function(w){var P=this.state,F=w.eventType,V=P&(De|vt),X=this.attrTest(w);return V&&(F&te||!X)?P|At:V||X?F&W?P|ut:P&De?P|vt:De:Ze}});function bt(){Ke.apply(this,arguments),this.pX=null,this.pY=null}v(bt,Ke,{defaults:{event:"pan",threshold:10,pointers:1,direction:he},getTouchAction:function(){var w=this.options.direction,P=[];return w&se&&P.push(Le),w&Ae&&P.push(ke),P},directionTest:function(w){var P=this.options,F=!0,V=w.distance,X=w.direction,ae=w.deltaX,pe=w.deltaY;return X&P.direction||(P.direction&se?(X=ae===0?$:ae<0?ne:ee,F=ae!=this.pX,V=Math.abs(w.deltaX)):(X=pe===0?$:pe<0?fe:ie,F=pe!=this.pY,V=Math.abs(w.deltaY))),w.direction=X,F&&V>P.threshold&&X&P.direction},attrTest:function(w){return Ke.prototype.attrTest.call(this,w)&&(this.state&De||!(this.state&De)&&this.directionTest(w))},emit:function(w){this.pX=w.deltaX,this.pY=w.deltaY;var P=Mt(w.direction);P&&(w.additionalEvent=this.options.event+P),this._super.emit.call(this,w)}});function Tt(){Ke.apply(this,arguments)}v(Tt,Ke,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(w){return this._super.attrTest.call(this,w)&&(Math.abs(w.scale-1)>this.options.threshold||this.state&De)},emit:function(w){if(w.scale!==1){var P=w.scale<1?"in":"out";w.additionalEvent=this.options.event+P}this._super.emit.call(this,w)}});function _t(){at.apply(this,arguments),this._timer=null,this._input=null}v(_t,at,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Me]},process:function(w){var P=this.options,F=w.pointers.length===P.pointers,V=w.distance<P.threshold,X=w.deltaTime>P.time;if(this._input=w,!V||!F||w.eventType&(W|te)&&!X)this.reset();else if(w.eventType&j)this.reset(),this._timer=d(function(){this.state=nt,this.tryEmit()},P.time,this);else if(w.eventType&W)return nt;return Ze},reset:function(){clearTimeout(this._timer)},emit:function(w){this.state===nt&&(w&&w.eventType&W?this.manager.emit(this.options.event+"up",w):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}});function xt(){Ke.apply(this,arguments)}v(xt,Ke,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(w){return this._super.attrTest.call(this,w)&&(Math.abs(w.rotation)>this.options.threshold||this.state&De)}});function Rt(){Ke.apply(this,arguments)}v(Rt,Ke,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:se|Ae,pointers:1},getTouchAction:function(){return bt.prototype.getTouchAction.call(this)},attrTest:function(w){var P=this.options.direction,F;return P&(se|Ae)?F=w.overallVelocity:P&se?F=w.overallVelocityX:P&Ae&&(F=w.overallVelocityY),this._super.attrTest.call(this,w)&&P&w.offsetDirection&&w.distance>this.options.threshold&&w.maxPointers==this.options.pointers&&c(F)>this.options.velocity&&w.eventType&W},emit:function(w){var P=Mt(w.offsetDirection);P&&this.manager.emit(this.options.event+P,w),this.manager.emit(this.options.event,w)}});function Et(){at.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}v(Et,at,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[_e]},process:function(w){var P=this.options,F=w.pointers.length===P.pointers,V=w.distance<P.threshold,X=w.deltaTime<P.time;if(this.reset(),w.eventType&j&&this.count===0)return this.failTimeout();if(V&&X&&F){if(w.eventType!=W)return this.failTimeout();var ae=this.pTime?w.timeStamp-this.pTime<P.interval:!0,pe=!this.pCenter||oe(this.pCenter,w.center)<P.posThreshold;this.pTime=w.timeStamp,this.pCenter=w.center,!pe||!ae?this.count=1:this.count+=1,this._input=w;var Ce=this.count%P.taps;if(Ce===0)return this.hasRequireFailures()?(this._timer=d(function(){this.state=nt,this.tryEmit()},P.interval,this),De):nt}return Ze},failTimeout:function(){return this._timer=d(function(){this.state=Ze},this.options.interval,this),Ze},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==nt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function mt(w,P){return P=P||{},P.recognizers=b(P.recognizers,mt.defaults.preset),new St(w,P)}mt.VERSION="2.0.7",mt.defaults={domEvents:!1,touchAction:Ge,enable:!0,inputTarget:null,inputClass:null,preset:[[xt,{enable:!1}],[Tt,{enable:!1},["rotate"]],[Rt,{direction:se}],[bt,{direction:se},["swipe"]],[Et],[Et,{event:"doubletap",taps:2},["tap"]],[_t]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Bt=1,Ct=2;function St(w,P){this.options=h({},mt.defaults,P||{}),this.options.inputTarget=this.options.inputTarget||w,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=w,this.input=N(this),this.touchAction=new st(this,this.options.touchAction),It(this,!0),m(this.options.recognizers,function(F){var V=this.add(new F[0](F[1]));F[2]&&V.recognizeWith(F[2]),F[3]&&V.requireFailure(F[3])},this)}St.prototype={set:function(w){return h(this.options,w),w.touchAction&&this.touchAction.update(),w.inputTarget&&(this.input.destroy(),this.input.target=w.inputTarget,this.input.init()),this},stop:function(w){this.session.stopped=w?Ct:Bt},recognize:function(w){var P=this.session;if(!P.stopped){this.touchAction.preventDefaults(w);var F,V=this.recognizers,X=P.curRecognizer;(!X||X&&X.state&nt)&&(X=P.curRecognizer=null);for(var ae=0;ae<V.length;)F=V[ae],P.stopped!==Ct&&(!X||F==X||F.canRecognizeWith(X))?F.recognize(w):F.reset(),!X&&F.state&(De|vt|ut)&&(X=P.curRecognizer=F),ae++}},get:function(w){if(w instanceof at)return w;for(var P=this.recognizers,F=0;F<P.length;F++)if(P[F].options.event==w)return P[F];return null},add:function(w){if(f(w,"add",this))return this;var P=this.get(w.options.event);return P&&this.remove(P),this.recognizers.push(w),w.manager=this,this.touchAction.update(),w},remove:function(w){if(f(w,"remove",this))return this;if(w=this.get(w),w){var P=this.recognizers,F=S(P,w);F!==-1&&(P.splice(F,1),this.touchAction.update())}return this},on:function(w,P){if(w!==r&&P!==r){var F=this.handlers;return m(M(w),function(V){F[V]=F[V]||[],F[V].push(P)}),this}},off:function(w,P){if(w!==r){var F=this.handlers;return m(M(w),function(V){P?F[V]&&F[V].splice(S(F[V],P),1):delete F[V]}),this}},emit:function(w,P){this.options.domEvents&&Ht(w,P);var F=this.handlers[w]&&this.handlers[w].slice();if(!(!F||!F.length)){P.type=w,P.preventDefault=function(){P.srcEvent.preventDefault()};for(var V=0;V<F.length;)F[V](P),V++}},destroy:function(){this.element&&It(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function It(w,P){var F=w.element;if(F.style){var V;m(w.options.cssProps,function(X,ae){V=H(F.style,ae),P?(w.oldCssProps[V]=F.style[V],F.style[V]=X):F.style[V]=w.oldCssProps[V]||""}),P||(w.oldCssProps={})}}function Ht(w,P){var F=t.createEvent("Event");F.initEvent(w,!0,!0),F.gesture=P,P.target.dispatchEvent(F)}return h(mt,{INPUT_START:j,INPUT_MOVE:re,INPUT_END:W,INPUT_CANCEL:te,STATE_POSSIBLE:gt,STATE_BEGAN:De,STATE_CHANGED:vt,STATE_ENDED:ut,STATE_RECOGNIZED:nt,STATE_CANCELLED:At,STATE_FAILED:Ze,DIRECTION_NONE:$,DIRECTION_LEFT:ne,DIRECTION_RIGHT:ee,DIRECTION_UP:fe,DIRECTION_DOWN:ie,DIRECTION_HORIZONTAL:se,DIRECTION_VERTICAL:Ae,DIRECTION_ALL:he,Manager:St,Input:Y,TouchAction:st,TouchInput:Fe,MouseInput:Be,PointerEventInput:je,TouchMouseInput:Ne,SingleTouchInput:ze,Recognizer:at,AttrRecognizer:Ke,Tap:Et,Pan:bt,Swipe:Rt,Pinch:Tt,Rotate:xt,Press:_t,on:T,off:x,each:m,merge:y,extend:p,assign:h,inherit:v,bindFn:g,prefixed:H}),mt}(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{});function calculateThreeMouse(n,t,e){var r=t.getBoundingClientRect(),i=r.top,o=r.left,s=r.width,u=r.height;return e&&(o=o+s*e.left,i=i+u*(1-e.bottom-e.height),s=s*e.width,u=u*e.height),new THREE__namespace.Vector2((n.x-o)/s*2-1,-(n.y-i)/u*2+1)}var camera$2=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$5=new THREE__namespace.BufferGeometry;geometry$5.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$5.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$4=new THREE__namespace.Mesh(geometry$5),scene$2=new THREE__namespace.Scene;scene$2.add(mesh$4);var DEFAULT_VERTEX_SHADER=`
1329
1329
  varying vec2 vUv;
1330
1330
  void main() {
1331
1331
  vUv = uv;
@@ -1485,7 +1485,7 @@ void main() {
1485
1485
  gl_FragColor = vec4(videoColor.rgb, match * blendAlpha * alpha);
1486
1486
  #endif
1487
1487
  }
1488
- `,PanoVideo=function(){function n(){this.material=new THREE__namespace.ShaderMaterial({vertexShader:PANO_VIDEO_MATERIAL_VERTEX_SHADER,fragmentShader:PANO_VIDEO_TILE_MATERIAL_FRAGMENT_SHADER,uniforms:{size:new THREE__namespace.Uniform(null),matrix:new THREE__namespace.Uniform(null),alpha:new THREE__namespace.Uniform(null),map:new THREE__namespace.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor}),this.object=new THREE__namespace.Mesh(sharedGeometry$1,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.name="pano-video",this.alphaMotion=new Motion({alpha:0})}return n.prototype.setMaterial=function(t){t?(this.material.uniforms.size.value=t.size,this.material.uniforms.matrix.value=t.matrix,this.material.uniforms.map.value=t.map,this.alphaMotion.set({alpha:t.alpha},500).catch(noop$1),this.material.uniforms.alpha.value=t.alpha):(this.material.uniforms.size.value=null,this.material.uniforms.matrix.value=null,this.material.uniforms.map.value=null,this.alphaMotion.set({alpha:0},0).catch(noop$1));var e=t!==null,r=this.material.defines.USE_PANO_VIDEO;e!==r&&(this.material.defines.USE_PANO_VIDEO=e,this.material.needsUpdate=!0,this.object.visible=t!==null)},n.prototype.updateTime=function(t){this.alphaMotion.ended||(this.alphaMotion.update(t),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)},n.prototype.dispose=function(){this.material.dispose()},n}(),ROTATE_Y_PI_MATRIX$1=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE$1=new THREE__namespace.Vector3(-1,1,1),CubeRenderTargetPool=function(){function n(t){t===void 0&&(t=0),this.width=t,this.pool=[]}return Object.defineProperty(n.prototype,"size",{get:function(){return this.pool.length},enumerable:!1,configurable:!0}),n.prototype.create=function(){return new THREE__namespace.WebGLCubeRenderTarget(this.width,{stencilBuffer:!1,depthBuffer:!1})},n.prototype.pop=function(){var t=this.pool.pop();return t||this.create()},n.prototype.push=function(t){this.pool.indexOf(t)===-1&&this.pool.push(t)},n.prototype.clear=function(){for(var t=0,e=this.pool;t<e.length;t++){var r=e[t];r.dispose()}this.pool.length=0},n}(),PanoramaController=function(n){__extends(t,n);function t(e){var r=this,i,o,s,u,c=t.parseArgs(e);r=n.call(this,c)||this,r.TILED_CUBE_TEXTURE_LEVEL=2,r.mode="Panorama",r.tileLevel=0,r.initAnimationed=!1,r.maxAccessibleDistance=c.maxAccessibleDistance,r.panoTapTriggerRadius=c.panoTapTriggerRadius,r.panoCircleMeshCreator=c.panoCircleMeshCreator,r.tileLevelForFov=c.tileLevelForFov,r.tileMaxRequest=c.tileMaxRequest,r.luminanceAdaptiveEffectEnable=c.luminanceAdaptiveEffectEnable,r.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(r.renderer,r.modelScene,r.camera,r.models),r.colorCubeRenderTargetPool=new CubeRenderTargetPool,r.luminanceCubeRenderTargetPool=new CubeRenderTargetPool;var l=r.models.getMaterial()||{},d=l.pano0,f=l.pano1;d&&(f==null?void 0:f.map)!==d.map&&(r.models.setMaterial({pano0:f}),d.map.dispose(),d.map instanceof TileCubeTextureTarget&&d.map.cubeRenderTarget&&r.colorCubeRenderTargetPool.push(d.map.cubeRenderTarget),d.luminanceMap&&(d.luminanceMap.dispose(),d.luminanceMap instanceof TileCubeTextureTarget&&d.luminanceMap.cubeRenderTarget&&r.luminanceCubeRenderTargetPool.push(d.luminanceMap.cubeRenderTarget)));for(var m=r.colorCubeRenderTargetPool.size;m<2;m++){var A=Math.max(1024*r.TILED_CUBE_TEXTURE_LEVEL,512),h=r.colorCubeRenderTargetPool.create();h.setSize(A,A),renderCubeTextureToCubeRenderTarget(null,h,r.renderer),r.colorCubeRenderTargetPool.push(h)}r.panoMeshes={},r.updatePanoMeshes(),r.locationMotion=new Motion({count:0,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(o=(i=r.models.getMaterial())===null||i===void 0?void 0:i.modelAlpha)!==null&&o!==void 0?o:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),panoPicture:(u=(s=r.models.getMaterial())===null||s===void 0?void 0:s.pano1)!==null&&u!==void 0?u:null,position:r.camera.pose.offset.clone(),effect:"fly",fixCameraTransform:new THREE__namespace.Matrix4};var p=r.works.getResolvedObserver(r.currentPano);return r.textureLoader=new TextureLoader,r.tiling=new Tiling(p?getFetcher(p.work):internalFetcher,r.TILED_CUBE_TEXTURE_LEVEL+1,r.imageOptions),r.scene.add(r.tiling.object),r.panoVideo=new PanoVideo,r.scene.add(r.panoVideo.object),r}return t.parseArgs=function(e){var r,i,o,s,u,c;if(e instanceof t)return e;var l=n.parseArgs.call(this,e);return __assign(__assign({},l),{maxAccessibleDistance:(r=e.maxAccessibleDistance)!==null&&r!==void 0?r:5,panoTapTriggerRadius:(i=e.panoTapTriggerRadius)!==null&&i!==void 0?i:.5,panoCircleMeshCreator:(o=e.panoCircleMeshCreator)!==null&&o!==void 0?o:function(d){return new PanoCircleMesh},tileLevelForFov:(s=e.tileLevelForFov)!==null&&s!==void 0?s:function(d,f){var m=function(v){return v/Math.PI*180},A=function(v){return v/180*Math.PI},h=f.height/2/Math.tan(A(d/2)),p=f.width>f.height?d:m(Math.atan(Math.tan(A(d/2))*(f.width/f.height))*2);p*=.9;var y=h*(Math.tan(A(p/2))-Math.tan(A(p/2-1)));return y>80?5:y>60?4:y>30?3:y>18?2:y>12?1:0},tileMaxRequest:(u=e.tileMaxRequest)!==null&&u!==void 0?u:3,luminanceAdaptiveEffectEnable:(c=e.luminanceAdaptiveEffectEnable)!==null&&c!==void 0?c:!0})},t.initAnimationEndState=function(e){var r=this.parseArgs(e),i=n.initAnimationEndState.call(this,r);return __assign(__assign({},i),{mode:"Panorama"})},t.prototype.destroy=function(){var e,r;if(n.prototype.destroy.call(this),this.scene.remove(this.tiling.object),this.tiling.dispose(),this.locationMotion.dispose(),this.colorCubeRenderTargetPool.clear(),this.luminanceCubeRenderTargetPool.clear(),delete this.pendingTextureTask,this.panoMeshes)for(var i=Object.keys(this.panoMeshes),o=0,s=i;o<s.length;o++){var u=s[o],c=this.panoMeshes[u];this.helper.remove(c),c.dispose(),delete this.panoMeshes[u]}var l=this.videoTexture.image;l.pause(),l.oncanplay=function(){},l.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var d=(e=this.models.getMaterial())!==null&&e!==void 0?e:{},f=d.pano0,m=d.pano1,A=0,h=Object.keys(this.panoResources);A<h.length;A++){var p=h[A],y=this.panoResources[p];if(y.panoPicture){var v=y.panoPicture.map;v&&v!==(f==null?void 0:f.map)&&v!==(m==null?void 0:m.map)&&(v.dispose(),(r=y.panoPicture.luminanceMap)===null||r===void 0||r.dispose(),y.panoPicture=null)}delete this.panoResources[p]}this.luminanceAdaptiveEffect.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended!==!0?!1:n.prototype.isReady.call(this)},t.prototype.isTileReady=function(){var e,r,i,o=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),s=((e=o.panoPicture)===null||e===void 0?void 0:e.map)instanceof TileCubeTextureTarget&&(i=(r=o.panoPicture)===null||r===void 0?void 0:r.map.tilePending)!==null&&i!==void 0?i:0,u=this.tiling.pedding;return this.initAnimationed&&s<=0&&u<=0},t.prototype.updateWork=function(e,r,i,o){var s=this;this.userAction=o,this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:i.duration,effect:i.effect,state:r,userAction:o}})),c={workCode:u.workCode,panoIndex:u.panoIndex},l=this.works.getWork(c.workCode);return this.tiling.setFetcher(l?getFetcher(l):internalFetcher),this.tiling.cleanup(),this.initAnimationed=!1,this.hideIntersectMesh(),this.updatePanoMeshes(),this.moveToPano(c,{effect:i.effect,duration:i.duration,longitude:r.longitude,latitude:r.latitude,fov:r.fov,moveEndCallback:function(){s.initAnimationed=!0},moveCancelCallback:function(){s.initAnimationed=!0}},o),!0},t.prototype.updateModel=function(e){this.models=e,this.updatePanoMeshes()},t.prototype.updateTime=function(e,r){var i=this,o,s,u,c,l,d,f,m,A,h;if(!this.destroyed){var p={},y={},v=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),E=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var b=this.locationMotion.getKeyFrameSegment(e),T=b[0],x=b[1],R=this.panoResourceFromLocationMotionKeyframe(T),_=this.panoResourceFromLocationMotionKeyframe(x),M=new THREE__namespace.Vector3().copy(R.position),S=new THREE__namespace.Vector3().copy(_.position),I=this.locationMotion.value.count-x.value.count+1;p.progress=I,_.panoPicture&&(I<1?R.panoPicture&&(p.pano0=R.panoPicture):p.pano0=_.panoPicture,p.pano1=_.panoPicture),_.effect==="montage"?p.transition="BLACK":_.effect==="spread"?p.transition="SPREAD":p.transition="FADE",(_.effect==="zoomin"||_.effect==="zoomout")&&(p.progress=Math.pow(I,3)),I<1&&_.effect!=="fly"&&(p.pano0&&R.panoPicture&&(p.pano0={map:p.pano0.map,zoom:p.pano0.zoom,luminanceMap:p.pano0.luminanceMap,matrix:R.panoPicture.matrix.clone().premultiply(R.fixCameraTransform).setPosition(_.position)}),M.copy(S),E=!0),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(M.x+(S.x-M.x)*I,M.y+(S.y-M.y)*I,M.z+(S.z-M.z)*I);for(var C=[],H=[],B=0,L=this.locationMotion.keyframes;B<L.length;B++){var O=L[B],k=O.key,G=O.progress;k!==void 0&&(C.push(k),G>this.locationMotion.progress&&H.push(k))}for(var z=0,D=Object.keys(this.panoResources);z<D.length;z++){var U=D[z];if(!(H.indexOf(U)>=0)){var K=this.panoResources[U];if(K.panoPicture){var Q=K.panoPicture.map,q=K.panoPicture.luminanceMap;if(Q){if(Q===((o=p.pano0)===null||o===void 0?void 0:o.map)||Q===((s=p.pano1)===null||s===void 0?void 0:s.map))continue;Q instanceof TileCubeTextureTarget&&Q.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(Q.cubeRenderTarget),Q.dispose(),q&&(q instanceof TileCubeTextureTarget&&q.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(q.cubeRenderTarget),q.dispose()),K.panoPicture=null}}C.indexOf(U)>=0||delete this.panoResources[U]}}this.currentPano=panoParse(_.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(v.panoId),state:__assign(__assign(__assign(__assign({},panoParse(g.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(p)===!1&&(!((u=p.pano0)===null||u===void 0)&&u.map&&p.pano0.map instanceof TileCubeTextureTarget&&!p.pano0.map.cubeRenderTarget&&(p.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=p.pano0)===null||c===void 0)&&c.luminanceMap&&p.pano0.luminanceMap instanceof TileCubeTextureTarget&&!p.pano0.luminanceMap.cubeRenderTarget&&(p.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),!((l=p.pano1)===null||l===void 0)&&l.map&&p.pano1.map instanceof TileCubeTextureTarget&&!p.pano1.map.cubeRenderTarget&&(p.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((d=p.pano1)===null||d===void 0)&&d.luminanceMap&&p.pano1.luminanceMap instanceof TileCubeTextureTarget&&!p.pano1.luminanceMap.cubeRenderTarget&&(p.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.models.setMaterial(p)),isEmptyObject(y)===!1&&this.setCamera(y);var J=this.works.getResolvedObserver(this.currentPano),W=this.locationMotion.ended?this.getForwardObserverOrNot():null;if(this.camera.pose.distance>.1||E)for(var re=0,j=Object.keys(this.panoMeshes);re<j.length;re++){var te=j[re],$=this.panoMeshes[te];$.setOpacity(0),$.setCurrent(!1),$.updateTime&&$.updateTime(e,r),$.visible=!1}else if(J){var ne=arrayMin(J.visibleIds,function(ce){var le=i.works.getResolvedObserver(ce);return le?J.standingPosition.distanceTo(le.standingPosition):1/0},!0),ee=ne[1];ee=clamp$1(ee,2.5,1/0);for(var fe=J.visibleIds.concat(panoStringify(this.currentPano)),ie=this.camera.getDirection(new THREE__namespace.Vector3),se=0,Ae=Object.keys(this.panoMeshes);se<Ae.length;se++){var te=Ae[se],$=this.panoMeshes[te],he=this.works.getResolvedObserver(te);if(fe.indexOf(te)===-1)$.setCurrent(!1),$.setOpacity(0);else if(!he)$.setCurrent(!1),$.setOpacity(0);else if(!he.loadable&&!he.active)$.setCurrent(!1),$.setOpacity(0);else{var me=$.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);$.setCurrent(!$.loading&&$.progress===0&&W!==null&&W.panoId===te),$.setOpacity(me<.01?0:clamp$1(ee/me*1.2,.4,.85));var Z=this.camera.position.clone().setY($.position.y),Y=new THREE__namespace.Vector3().copy($.position).sub(Z).normalize();if(te===panoStringify(this.currentPano)){var N=clamp$1((.5-Z.distanceTo($.position))/.5,0,1);Y.multiplyScalar(1-N).add(ie.clone().multiplyScalar(N))}Y.length()>0&&$.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(Y.x,Y.z),0))}$.updateTime&&$.updateTime(e,r)}}var Ee=this.tileLevel=function(){if(i.tileLevelForFov===!1)return 0;var ce=i.renderer.getDrawingBufferSize(new THREE__namespace.Vector2);ce.width*=i.scissor.width,ce.height*=i.scissor.height;var le=g.panoId,ue=i.works.getResolvedObserver(le),oe=i.imageOptions.size;if(typeof oe=="undefined"&&ue){var Te=ue.images.up.match(/\/cube_(\d+)\//);Te&&(oe=Number(Te[1]))}typeof oe=="undefined"&&(oe=2048);var Re=0;oe>=1024&&(Re=1),oe>=2048&&(Re=2),oe>=4096&&(Re=3),oe>=8192&&(Re=4);var Ie=i.tileLevelForFov(i.camera.fov,ce);return Ie>Re?Ie:0}(),ge=function(){var ce=i.camera.quaternion.clone(),le=i.works.getResolvedObserver(g.panoId),ue=le!=null?le:J;ue&&ce.premultiply(ue.quaternion.clone().inverse());var oe=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ce),Te=new THREE__namespace.Matrix4().getInverse(oe),Re=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(i.camera.projectionMatrix,Te));return Re}();g.panoId===panoStringify(this.currentPano)&&(((f=g.panoPicture)===null||f===void 0?void 0:f.map)instanceof TileCubeTextureTarget&&(g.panoPicture.map.maxRequest=this.tileMaxRequest,g.panoPicture.map.update(ge,Ee),g.panoPicture.map.needsRender===!0&&(g.panoPicture.map.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)),((m=g.panoPicture)===null||m===void 0?void 0:m.luminanceMap)instanceof TileCubeTextureTarget&&(g.panoPicture.luminanceMap.maxRequest=this.tileMaxRequest,g.panoPicture.luminanceMap.update(ge,Ee),g.panoPicture.luminanceMap.needsRender===!0&&(g.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)));{var ve=this.tiling.object.visible;if(this.initAnimationed){var xe=g.panoId,de=this.works.getResolvedObserver(xe);de?isSimilarVector3(this.camera.position,de.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==xe&&this.tiling.cleanup(),this.tiling.panoId=xe,this.tiling.setResource((h=(A=de.images)===null||A===void 0?void 0:A.tiles)!==null&&h!==void 0?h:[],this.enableIOSEDR&&de.images.luminance?de.images.luminance:null),this.tiling.setFetcher(getFetcher(de.work)),this.tiling.setRotation(de.quaternion),this.tiling.setPosition(de.position),this.tiling.maxRequest=this.tileMaxRequest,Ee>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(ge,Ee,e):this.tiling.update(ge,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;ve!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh.scale.setScalar(clamp$1(this.cameraMotion.value.fov/45,0,1))}},t.prototype.render=function(e,r){var i=this.renderer.getRenderTarget(),o=this.works.getResolvedObserver(this.currentPano);o&&o.video&&(this.needsRender=!0,this.modelSceneNeedsRender=!0),this.updateScreenBuffer(r),e&&(r==="luminance"?(this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable,this.luminanceAdaptiveEffect.render(this.screenBuffers)):(this.renderer.setRenderTarget(this.modelRenderTarget),this.renderer.render(this.modelScene,this.camera))),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,i),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,i),this.renderer.setRenderTarget(i),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.postProcessing=function(e,r){if(!this.destroyed&&r==="luminance")return this.luminanceAdaptiveEffect||(this.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(this.renderer,this.scene,this.camera,this.models),this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable),this.luminanceAdaptiveEffect.render(e)},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1],i=this.panoResourceFromLocationMotionKeyframe(r),o=this.works.getResolvedObserver(i.panoId);return{workCode:o?o.work.workCode:this.currentPano.workCode,panoIndex:o?o.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:o?o.position.clone():this.camera.position.clone(),distance:this.locationMotion.value.distance}},t.prototype.moveToPano=function(e,r,i){var o=this,s,u,c,l,d=(s=r.effect)!==null&&s!==void 0?s:"fly";this.userAction=i,this.stopMomentumMovement();var f=this.works.getResolvedObserver(e);if(!f)throw new Error("Invalid PanoId ".concat(JSON.stringify(e)));var m=getImageSizeFromURL(f.images.up),A=this.imageOptions.size;typeof A=="undefined"&&f&&m&&(A=Number(m)),typeof A=="undefined"&&(A=2048);var h=this.imageOptions.transform,p=__assign({key:"pano.".concat(f.panoId)},pick(this.imageOptions,["format","size","quality","sharpen","mappings"])),y=f.images,v=(c=(u=f.images.tiles)===null||u===void 0?void 0:u.filter(function(L){return L.size>A}))!==null&&c!==void 0?c:null,g=h,E={key:"pano_luminance.".concat(f.panoId),size:p.size?p.size/2:void 0},b=this.enableIOSEDR&&f.images.luminance?f.images.luminance:null,T=function(){if(!f.images.tiles||!b)return null;var L=getImageSizeFromURL(b.up);return L?v==null?void 0:v.map(function(O){var k=O.size*O.scale/2;return L<k?{level:O.level,size:k,scale:1,back:replaceImageSize(b.back,k),front:replaceImageSize(b.front,k),left:replaceImageSize(b.left,k),right:replaceImageSize(b.right,k),up:replaceImageSize(b.up,k),down:replaceImageSize(b.down,k)}:{level:O.level,size:L,scale:k/L,back:b.back,front:b.front,left:b.left,right:b.right,up:b.up,down:b.down}}):null}(),x="pano:"+jsonHash([y,p,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===x)return;var R=this.pendingTextureTask.panoId;(l=this.panoMeshes[R])===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:f.pano}))}var _="move-to-pano-"+f.panoId;this.pending.add(_);var M=this.models.getMaterial()||{},S=M.pano0,I=M.pano1,C;if(S&&S.map.name===x&&S.luminanceMap!==null===this.enableIOSEDR?C=S:(I==null?void 0:I.map.name)===x&&I.luminanceMap!==null===this.enableIOSEDR&&(C=I),C){var H={panoId:f.panoId,effect:d,panoPicture:{zoom:1,map:C.map,luminanceMap:C.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(f.position,f.quaternion,PANO_TEXTURE_SCALE$1)},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};AnimationFrameLoop.shared.add(function(){o.pending.delete(_),o.doMoveToPano(f.pano,H,r)},!0,1);return}this.pendingTextureTask={panoId:f.panoId,hash:x,onLoad:function(L,O){var k;if(o.pending.delete(_),o.destroyed)L.body.dispose();else{L.body.name=x;var G={panoId:f.panoId,effect:d,panoPicture:{zoom:1,map:L.body,luminanceMap:(k=O==null?void 0:O.body)!==null&&k!==void 0?k:null,matrix:new THREE__namespace.Matrix4().compose(f.position,f.quaternion,PANO_TEXTURE_SCALE$1)},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};o.doMoveToPano(f.pano,G,r)}},onError:function(L){o.pending.delete(_);var O=__assign(__assign(__assign({},f.pano),{mode:o.mode}),clonePose(o.camera.pose));o.emit("pano.error",createEvent("pano.error",{error:L,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:O})),o.emit("pano.cancel",createEvent("pano.cancel",{error:L,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:O})),o.emit("error",L),r.moveCancelCallback&&r.moveCancelCallback()}};var B=this.panoMeshes[f.panoId];B&&B.tap&&B.tap(),Promise.all([this.tileLevelForFov&&v&&v.length?this.textureLoader.loadTiledCubeTexture(y,v,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:h,options:p},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(f.work)},void 0,void 0,function(L){var O,k;o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:L,meta:null,pano:f.pano})),((O=o.pendingTextureTask)===null||O===void 0?void 0:O.hash)===x&&((k=o.panoMeshes[f.panoId])===null||k===void 0||k.setProgress(L))},this.renderer):this.textureLoader.loadCubeTexture(y,{imageURL:{transform:h,options:p},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(f.work)},void 0,void 0,function(L){var O,k;o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:L,meta:null,pano:f.pano})),((O=o.pendingTextureTask)===null||O===void 0?void 0:O.hash)===x&&((k=o.panoMeshes[f.panoId])===null||k===void 0||k.setProgress(L))},this.renderer),b?this.tileLevelForFov&&T&&T.length?this.textureLoader.loadTiledCubeTexture(b,T,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:g,options:E},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,fetcher:getFetcher(f.work)},void 0,void 0,void 0,this.renderer).catch(function(){return null}):this.textureLoader.loadCubeTexture(b,{imageURL:{transform:g,options:E},fetcher:getFetcher(f.work)},void 0,void 0,void 0,this.renderer).catch(function(){return null}):Promise.resolve(null)]).then(function(L){var O,k,G=L[0],z=L[1];((O=o.pendingTextureTask)===null||O===void 0?void 0:O.hash)===x?(o.pendingTextureTask.onLoad(G,z),(k=o.panoMeshes[f.panoId])===null||k===void 0||k.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:G.meta,pano:f.pano}))):(G.body.dispose(),z==null||z.body.dispose())}).catch(function(L){var O,k;((O=o.pendingTextureTask)===null||O===void 0?void 0:O.hash)===x&&(o.pendingTextureTask.onError(L),(k=o.panoMeshes[f.panoId])===null||k===void 0||k.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.error",createEvent("pano.texture.error",{error:L,progress:0,meta:null,pano:f.pano})),o.emit("error",L))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:f.pano}))},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var i=e.initial,o=i.duration,s=i.effect,u=i.userAction;e.userAction=u;var c=t.initAnimationEndState(e),l={workCode:c.workCode,panoIndex:c.panoIndex},d={modelAlpha:0},f={perspToOrtho:0},m=!1;e.moveToPano(l,{longitude:c.longitude,latitude:c.latitude,fov:c.fov,effect:s,duration:o,moveStartCallback:function(A){m=!0,e.perspToOrthoMotion.set(f,o).catch(noop$1),e.modelAlphaMotion.setKeyframes([{progress:0,value:__assign({},e.modelAlphaMotion.value)},{progress:.6,value:__assign({},e.modelAlphaMotion.value)},{progress:1,value:d}],o).catch(noop$1),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:A,userAction:e.userAction}))},moveEndCallback:function(A){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:A,userAction:e.userAction})),e.initAnimationed=!0,r()},moveCancelCallback:function(){var A=__assign(__assign(__assign({},l),{mode:e.mode}),clonePose(e.camera.pose));m===!1&&e.emit("initAnimation.start",createEvent("initAnimation.start",{state:A,userAction:e.userAction})),e.emit("initAnimation.end",createEvent("initAnimation.end",{state:A,userAction:e.userAction})),e.initAnimationed=!0,r()}},u)})},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var r=0,i=1;i<e.length;i++){var o=this.panoResourceFromLocationMotionKeyframe(e[i-1]).position,s=this.panoResourceFromLocationMotionKeyframe(e[i]).position,u=o.distanceTo(s)*(e[i].value.count-e[i-1].value.count);r+=u}return r},t.prototype.updatePanoMeshes=function(){for(var e=this,r={},i=Object.keys(this.panoMeshes),o=0,s=i;o<s.length;o++){var u=s[o],c=this.panoMeshes[u];r[u]=c,delete this.panoMeshes[u]}for(var l=1,d={},f=function(x){var R=arrayMin(x.accessibleIds,function(M){var S=e.works.getResolvedObserver(M);if(!S)return 1/0;var I=S.standingPosition.distanceTo(x.standingPosition);return clamp$1(I,1,1/0)},!0),_=R[1];d[x.panoId]===void 0&&(d[x.panoId]=_)},m=0,A=this.works.resolvedObservers;m<A.length;m++){var h=A[m];f(h)}var p=Object.keys(d).map(function(x){return d[x]});if(p.length){var y=p.reduce(function(x,R){return x+R},0)/p.length;l=clamp$1(y*.6,1,3)}for(var v=0,g=this.works.resolvedObservers;v<g.length;v++){var h=g[v],c=void 0;r[h.panoId]?(c=r[h.panoId],c.loading===!0&&h.loadable===!1&&c.setLoading(!1),delete r[h.panoId]):(c=this.panoCircleMeshCreator(h.pano),c.name="PanoCircleMesh_"+h.panoId,this.helper.add(c)),c.scale.set(l,1,l),c.position.copy(h.standingPosition),this.panoMeshes[h.panoId]=c}for(var E=0,b=Object.keys(r);E<b.length;E++){var T=b[E];this.helper.remove(r[T]),r[T].dispose(),delete r[T]}},t.prototype.doMoveToPano=function(e,r,i){var o=this,s,u,c,l,d,f,m,A,h,p,y;i===void 0&&(i={});var v=now(),g=createUuid();this.tiling.cleanup(),this.panoResources[g]=r;var E=1,b,T,x;if(this.locationMotion.ended){var R=this.locationMotion.getKeyFrameSegment(v);R[0];var _=R[1],M=this.locationMotion.value,S=((s=this.panoResourceFromLocationMotionKeyframe(_))!==null&&s!==void 0?s:this.camera).position,I=r.position;b=Math.max(S.distanceTo(I),E),T=[{key:_.key,progress:0,value:__assign(__assign({},M),{count:0})},{key:g,progress:1,value:{distance:0,count:1}}],x=0}else{var C=this.locationMotion.getKeyFrameSegment(v),H=C[0],_=C[1],M=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(H).position,S=this.panoResourceFromLocationMotionKeyframe(_).position,I=r.position,L=_.value.count-M.count,O=Math.max(B.distanceTo(S),E)*L,k=Math.max(S.distanceTo(I),E);b=O+k,T=[{key:H.key,progress:0,value:__assign({},M)},{key:_.key,progress:O/b,value:_.value},{key:g,progress:1,value:{count:_.value.count+1,distance:0}}];var G=this.locationMotionKeyframesLength(this.locationMotion.keyframes),z=this.locationMotionKeyframesLength(T);G===0||G===0?x=0:x=this.locationMotion.getProgressVelocity(v)*G/z}var D=r.effect==="instant"?0:this.calculateMovingDuration(i.duration,r.effect==="fly"?b:0),U={longitude:i.longitude,latitude:i.latitude,fov:i.fov},K=__assign(__assign({},e),{mode:this.mode,longitude:(u=U.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(c=U.latitude)!==null&&c!==void 0?c:this.camera.pose.latitude,fov:(l=U.fov)!==null&&l!==void 0?l:this.camera.pose.fov,offset:r.position.clone(),distance:this.camera.pose.distance}),Q=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:i,prevPano:Q,progress:0,state:K,userAction:this.userAction,error:null})),i.moveStartCallback&&i.moveStartCallback(K),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(U,D).catch(noop$1);else{var q=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),J=coordinatesToVector({longitude:(d=U.longitude)!==null&&d!==void 0?d:this.cameraMotion.value.longitude,latitude:(f=U.latitude)!==null&&f!==void 0?f:this.cameraMotion.value.latitude}),W=new THREE__namespace.Object3D;W.lookAt(q);var re=new THREE__namespace.Matrix4().makeRotationFromQuaternion(W.quaternion);W.lookAt(J);var j=new THREE__namespace.Matrix4().makeRotationFromQuaternion(W.quaternion),te=new THREE__namespace.Matrix4().getInverse(re).premultiply(j),$=this.cameraMotion.value.fov,ne=(m=U.fov)!==null&&m!==void 0?m:this.cameraMotion.value.fov,ee=1;r.effect==="zoomin"?ee=1.5:r.effect==="zoomout"&&(ee=.4);for(var fe=clamp$1(ne*ee,1,170),ie=0;ie<T.length-1;ie++){var se=T[ie].key;if(se){var Ae=this.panoResources[se];Ae&&(Ae.fixCameraTransform.copy(te),Ae.panoPicture&&(Ae.panoPicture.zoom=Math.tan($/2/180*Math.PI)/Math.tan(fe/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(A=U.longitude)!==null&&A!==void 0?A:this.cameraMotion.value.longitude,latitude:(h=U.latitude)!==null&&h!==void 0?h:this.cameraMotion.value.latitude,fov:fe}},{progress:1,value:{longitude:(p=U.longitude)!==null&&p!==void 0?p:this.cameraMotion.value.longitude,latitude:(y=U.latitude)!==null&&y!==void 0?y:this.cameraMotion.value.latitude,fov:ne}}],D).catch(noop$1)}var he=this.locationMotion.setKeyframes(T,D,x);he.then(function(){for(var me,Z,Y=0,N=o.models;Y<N.length;Y++){var Ee=N[Y];Ee.show()}var ge=__assign(__assign({},e),{mode:o.mode,longitude:o.camera.pose.longitude,latitude:o.camera.pose.latitude,fov:o.camera.pose.fov,offset:o.camera.pose.offset.clone(),distance:o.camera.pose.distance});o.emit("pano.arrived",createEvent("pano.arrived",{options:i,prevPano:Q,progress:1,state:ge,userAction:o.userAction,error:null})),i.moveEndCallback&&i.moveEndCallback(ge);var ve=o.works.getResolvedObserver(e);if(ve&&ve.video&&o.videoTexture&&o.videoTexture.image instanceof HTMLVideoElement){var xe=ROTATE_Y_PI_MATRIX$1.clone().multiply((Z=(me=o.models.getMaterial().pano1)===null||me===void 0?void 0:me.matrix)!==null&&Z!==void 0?Z:new THREE__namespace.Matrix4).multiply(ve.video.matrix),de={map:o.videoTexture,size:ve.video.size,matrix:xe,alpha:1},ce=createUuid(),le=o.videoTexture.image;le.setAttribute("uuid",ce),canplayVideo().then(function(ue){ue&&ve.video&&le.getAttribute("uuid")===ce&&(le.oncanplay=function(){le.oncanplay=noop$1,le.play()},le.ontimeupdate=function(){le.currentTime>.5&&(le.ontimeupdate=noop$1,o.panoVideo.setMaterial(de))},le.src=ve.video.source)}).catch(function(){le.removeAttribute("uuid")})}},function(){o.emit("pano.cancel",createEvent("pano.cancel",{options:i,prevPano:Q,progress:0,state:K,userAction:o.userAction,error:null})),i.moveCancelCallback&&i.moveCancelCallback()})},t.prototype.getForwardObserverOrNot=function(e){var r=this,i=this.works.getResolvedObserver(this.currentPano);if(!i)return null;var o=e!=null?e:new THREE__namespace.Raycaster(this.camera.position.clone(),this.camera.getDirection(new THREE__namespace.Vector3));o.params.Points={threshold:.1};var s=i.standingPosition.clone();if(i.position.distanceTo(o.ray.origin)>1){var u=this.models.intersectRaycaster(new THREE__namespace.Raycaster(o.ray.origin,new THREE__namespace.Vector3(0,-1,0)))[0];u&&u.distance<=2?s.copy(u.point):s.copy(o.ray.origin).add(new THREE__namespace.Vector3(0,-1.5,0))}var c=this.models.intersectRaycaster(o)[0],l=c?c.point:o.ray.origin.clone().add(o.ray.direction.clone().normalize().multiplyScalar(3)),d=l.clone().sub(s).normalize();if(d.length()===0)return null;for(var f=i.accessibleIds.filter(function(T){if(T===panoStringify(r.currentPano))return!1;var x=r.works.getResolvedObserver(T);if(!x)return!1;var R=x.standingPosition.clone().project(r.camera);return Math.abs(R.z)>1||Math.abs(R.x)>1||Math.abs(R.y)>1?!1:x.loadable||x.active}),m=f.slice().sort(function(T,x){var R=r.works.getResolvedObserver(T).standingPosition.clone().distanceTo(s),_=r.works.getResolvedObserver(x).standingPosition.clone().distanceTo(s);return R-_}),A=0,h=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];A<h.length;A++)for(var p=h[A],y=0,v=m;y<v.length;y++){var g=v[y],E=this.works.getResolvedObserver(g);if(E){var b=E.standingPosition.clone().sub(s);if(b&&b.length()!==0&&d.angleTo(b)<p)return E}}return null},t.prototype.onTapGesture=function(e){var r=this,i;if(this.userAction=e.userAction,this.stopMomentumMovement(),!!this.initAnimationed){if(!this.locationMotion.ended){var o=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]);if(o.panoId!==panoStringify(this.currentPano))return}var s=e.center.raycaster,u=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),c=null,l=this.works.getResolvedObserver(this.currentPano);if(l){var d=l.accessibleIds.filter(function(z){if(z===panoStringify(r.currentPano))return!1;var D=r.works.getResolvedObserver(z);return!D||D.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:D.loadable||D.active}),f=this.models.intersectRaycaster(s)[0];if(f){var m=arrayMin(d,function(z){var D=r.works.getResolvedObserver(z);if(!D)return 1/0;var U=D.standingPosition.clone();return U.distanceTo(f.point)},!0),A=m[0],h=m[1];A&&h<this.panoTapTriggerRadius&&(c=(i=this.works.getResolvedObserver(A))!==null&&i!==void 0?i:null)}c||(c=this.getForwardObserverOrNot(s));for(var p=0,y=this.locationMotion.keyframes;p<y.length;p++){var v=y[p],g=this.panoResourceFromLocationMotionKeyframe(v);if(!(v.progress<this.locationMotion.progress)&&c&&g.panoId===c.panoId){c=null;break}}if(!c)this.emit("gesture.tap",e),e.defaultPrevented||this.locationMotion.ended===!0&&this.cameraBounce();else{for(var E={},b=Math.PI/6,T=Math.PI/12,x=c.position.clone().setY(0).sub(l.position.clone().setY(0)).normalize(),R=[],_=[],M=[],S=0,I=c.accessibleIds;S<I.length;S++){var A=I[S],C=panoParse(A);if(!(panoEqual(C,this.currentPano)||panoEqual(C,c.pano))){var H=this.works.getResolvedObserver(A);if(H){var B=H.position.clone().sub(c.position).setY(0);x.angleTo(B)<b&&M.push(B)}}}var L=M.length>0?M:__spreadArray(__spreadArray([],R,!0),_,!0),O=L.slice().sort(function(z,D){return z.angleTo(x)-D.angleTo(x)})[0];O&&O.angleTo(u)>T&&(E.longitude=Math.atan2(-O.x,-O.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(E.latitude=clamp$1(0,this.minLatitude,this.maxLatitude));var k=__assign({},e.state);if(k.workCode=c.pano.workCode,k.panoIndex=c.pano.panoIndex,E.longitude!==void 0&&(k.longitude=E.longitude),E.latitude!==void 0&&(k.latitude=E.latitude),E.fov!==void 0&&(k.fov=E.fov),k.distance=0,k.offset=c.position.clone(),e.state=k,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:k,userAction:e.userAction,options:E,progress:0,error:null})),c&&!c.active){var G=c.panoId;this.panoMeshes[G]&&(this.panoMeshes[G].setDisabled(!1),this.panoMeshes[G].setLoading(!0))}c&&c.active&&this.emit("pano.request",createEvent("pano.request",{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:k,options:E,error:null}))}}}}},t}(PanoramaLikeController),DEG_TO_RAD=Math.PI/180,RAD_TO_DEG=180/Math.PI,MIN_TIMESTEP=.001,MAX_TIMESTEP=1,isIOS=function(){var n=typeof navigator!="undefined"&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return n}}(),isSafari=function(){var n=typeof navigator!="undefined"&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return n}}(),isFirefoxAndroid=function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("Firefox")!==-1&&navigator.userAgent.indexOf("Android")!==-1;return function(){return n}}(),getChromeVersion=function(){var n=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=n?parseInt(n[1],10):null;return function(){return t}}(),isChromeWithoutDeviceMotion=function(){var n=!1;if(getChromeVersion()===65){var t=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var e=t[1].split(".");e[0],e[1];var r=e[2],i=e[3];n=parseInt(r,10)===3325&&parseInt(i,10)<148}}return function(){return n}}(),isSafariWithoutDeviceMotion=function(){var n=isIOS()&&isSafari()&&typeof navigator!="undefined"&&navigator.userAgent.indexOf("13_4")!==-1;return function(){return n}}(),isR7=function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("R7 Build")!==-1;return function(){return n}}();function isLandscapeMode(){var n=typeof window!="undefined"&&(window.orientation==90||window.orientation==-90);return isR7()?!n:n}function isTimestampDeltaValid(n){return!(isNaN(n)||n<=MIN_TIMESTEP||n>MAX_TIMESTEP)}function getQuaternionAngle(n){if(n.w>1)return 0;var t=2*Math.acos(n.w);return t}var warnOnce=function(){var n={};return function(t,e){n[t]===void 0&&(console.warn("cardboard: "+e),n[t]=!0)}}();function getOriginFromUrl(n){var t,e=n.indexOf("://");e!==-1?t=e+3:t=0;var r=n.indexOf("/",t);return r===-1&&(r=n.length),n.substring(0,r)}function isInsideCrossOriginIFrame(){if(typeof window=="undefined"||typeof document=="undefined")return!1;var n=window.self!==window.top,t=getOriginFromUrl(document.referrer),e=getOriginFromUrl(window.location.href);return n&&t!==e}var updateEyeViewMatrices=function(){function n(r,i,o){var s=i?i[0]:0,u=i?i[1]:0,c=i?i[2]:0,l=i?i[3]:1,d=s+s,f=u+u,m=c+c,A=s*d,h=s*f,p=s*m,y=u*f,v=u*m,g=c*m,E=l*d,b=l*f,T=l*m;return r[0]=1-(y+g),r[1]=h+T,r[2]=p-b,r[3]=0,r[4]=h-T,r[5]=1-(A+g),r[6]=v+E,r[7]=0,r[8]=p+b,r[9]=v-E,r[10]=1-(A+y),r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function t(r,i,o){var s=o[0],u=o[1],c=o[2],l,d,f,m,A,h,p,y,v,g,E,b;return i===r?(r[12]=i[0]*s+i[4]*u+i[8]*c+i[12],r[13]=i[1]*s+i[5]*u+i[9]*c+i[13],r[14]=i[2]*s+i[6]*u+i[10]*c+i[14],r[15]=i[3]*s+i[7]*u+i[11]*c+i[15]):(l=i[0],d=i[1],f=i[2],m=i[3],A=i[4],h=i[5],p=i[6],y=i[7],v=i[8],g=i[9],E=i[10],b=i[11],r[0]=l,r[1]=d,r[2]=f,r[3]=m,r[4]=A,r[5]=h,r[6]=p,r[7]=y,r[8]=v,r[9]=g,r[10]=E,r[11]=b,r[12]=l*s+A*u+v*c+i[12],r[13]=d*s+h*u+g*c+i[13],r[14]=f*s+p*u+E*c+i[14],r[15]=m*s+y*u+b*c+i[15]),r}function e(r,i){var o=i[0],s=i[1],u=i[2],c=i[3],l=i[4],d=i[5],f=i[6],m=i[7],A=i[8],h=i[9],p=i[10],y=i[11],v=i[12],g=i[13],E=i[14],b=i[15],T=o*d-s*l,x=o*f-u*l,R=o*m-c*l,_=s*f-u*d,M=s*m-c*d,S=u*m-c*f,I=A*g-h*v,C=A*E-p*v,H=A*b-y*v,B=h*E-p*g,L=h*b-y*g,O=p*b-y*E,k=T*O-x*L+R*B+_*H-M*C+S*I;return k?(k=1/k,r[0]=(d*O-f*L+m*B)*k,r[1]=(u*L-s*O-c*B)*k,r[2]=(g*S-E*M+b*_)*k,r[3]=(p*M-h*S-y*_)*k,r[4]=(f*H-l*O-m*C)*k,r[5]=(o*O-u*H+c*C)*k,r[6]=(E*R-v*S-b*x)*k,r[7]=(A*S-p*R+y*x)*k,r[8]=(l*L-d*H+m*I)*k,r[9]=(s*H-o*L-c*I)*k,r[10]=(v*M-g*R+b*T)*k,r[11]=(h*R-A*M-y*T)*k,r[12]=(d*C-l*B-f*I)*k,r[13]=(o*B-s*C+u*I)*k,r[14]=(g*x-v*_-E*T)*k,r[15]=(A*_-h*x+p*T)*k,r):null}return function(r,i,o){n(r,i),o&&t(r,r,o),e(r,r)}}(),SensorSample=function(){function n(t,e){t===void 0&&(t=new THREE__namespace.Vector3),e===void 0&&(e=0),this.sample=t,this.timestampS=e}return n.prototype.set=function(t,e){this.sample=t,this.timestampS=e},n.prototype.copy=function(t){this.set(t.sample,t.timestampS)},n}(),ComplementaryFilter=function(){function n(t,e){this.kFilter=t,this.isDebug=e,this.currentAccelMeasurement=new SensorSample,this.currentGyroMeasurement=new SensorSample,this.previousGyroMeasurement=new SensorSample,isIOS()?this.filterQ=new THREE__namespace.Quaternion(-1,0,0,1):this.filterQ=new THREE__namespace.Quaternion(1,0,0,1),this.previousFilterQ=new THREE__namespace.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new THREE__namespace.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new THREE__namespace.Vector3,this.measuredGravity=new THREE__namespace.Vector3,this.gyroIntegralQ=new THREE__namespace.Quaternion}return n.prototype.addAccelMeasurement=function(t,e){this.currentAccelMeasurement.set(t,e)},n.prototype.addGyroMeasurement=function(t,e){this.currentGyroMeasurement.set(t,e);var r=e-this.previousGyroMeasurement.timestampS;isTimestampDeltaValid(r)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},n.prototype.getOrientation=function(){return this.filterQ},n.prototype.run_=function(){if(!this.isOrientationInitialized){this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),this.isOrientationInitialized=!0;return}var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,e=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(e),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(e);var r=new THREE__namespace.Quaternion;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var i=new THREE__namespace.Quaternion;i.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),i.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",RAD_TO_DEG*getQuaternionAngle(i),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var o=new THREE__namespace.Quaternion;o.copy(this.filterQ),o.multiply(i),this.filterQ.slerp(o,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},n.prototype.accelToQuaternion_=function(t){var e=new THREE__namespace.Vector3;e.copy(t),e.normalize();var r=new THREE__namespace.Quaternion;return r.setFromUnitVectors(new THREE__namespace.Vector3(0,0,-1),e),r.inverse(),r},n.prototype.gyroToQuaternionDelta_=function(t,e){var r=new THREE__namespace.Quaternion,i=new THREE__namespace.Vector3;return i.copy(t),i.normalize(),r.setFromAxisAngle(i,t.length()*e),r},n}(),PosePredictor=function(){function n(t,e){this.predictionTimeS=t,this.isDebug=e,this.previousQ=new THREE__namespace.Quaternion,this.previousTimestampS=null,this.deltaQ=new THREE__namespace.Quaternion,this.outQ=new THREE__namespace.Quaternion}return n.prototype.getPrediction=function(t,e,r){if(!this.previousTimestampS)return this.previousQ.copy(t),this.previousTimestampS=r,t;var i=new THREE__namespace.Vector3;i.copy(e),i.normalize();var o=e.length();if(o<DEG_TO_RAD*20)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(RAD_TO_DEG*o).toFixed(1)),this.outQ.copy(t),this.previousQ.copy(t),this.outQ;var s=o*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(i,s),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(t),this.previousTimestampS=r,this.outQ},n}(),Distortion=function(){function n(t){this.coefficients=t}return n.prototype.distortInverse=function(t){for(var e=0,r=1,i=t-this.distort(e);Math.abs(r-e)>1e-4;){var o=t-this.distort(r),s=r-o*((r-e)/(o-i));e=r,r=s,i=o}return r},n.prototype.distort=function(t){for(var e=t*t,r=0,i=0;i<this.coefficients.length;i++)r=e*(r+this.coefficients[i]);return(r+1)*t},n}(),Pose=function(){function n(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null}return n}(),FieldOfView=function(){function n(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0}return n}(),Sensor=function(){function n(t,e,r,i){this.viewer={id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=r,this.accelerometer=new THREE__namespace.Vector3,this.gyroscope=new THREE__namespace.Vector3,this.filter=new ComplementaryFilter(t,i),this.posePredictor=new PosePredictor(e,i),this.isFirefoxAndroid=isFirefoxAndroid(),this.isIOS=isIOS();var o=getChromeVersion();this.isDeviceMotionInRadians=!this.isIOS&&o!==null&&o<66,this.isWithoutDeviceMotion=isChromeWithoutDeviceMotion()||isSafariWithoutDeviceMotion(),this.filterToWorldQ=new THREE__namespace.Quaternion,isIOS()?this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new THREE__namespace.Quaternion,this.worldToScreenQ=new THREE__namespace.Quaternion,this.originalPoseAdjustQ=new THREE__namespace.Quaternion;var s=typeof window!="undefined"?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),s),this.setScreenTransform_(),isLandscapeMode()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new THREE__namespace.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return n.prototype.getPosition=function(){return null},n.prototype.getOrientation=function(){var t;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||function(){var o=new THREE__namespace.Quaternion().setFromAxisAngle(new THREE__namespace.Vector3(0,0,-1),0),s=new THREE__namespace.Quaternion;return typeof window!="undefined"&&window.orientation===-90?s.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/-2):s.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/2),o.multiply(s)}(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||function(){var o=new THREE__namespace.Quaternion;return o.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),o}(),t=this._deviceOrientationQ;var e=new THREE__namespace.Quaternion;return e.copy(t),e.multiply(this.deviceOrientationFilterToWorldQ),e.multiply(this.resetQ),e.multiply(this.worldToScreenQ),e.multiplyQuaternions(this.deviceOrientationFixQ,e),this.yawOnly&&(e.x=0,e.z=0,e.normalize()),this.orientationOut_[0]=e.x,this.orientationOut_[1]=e.y,this.orientationOut_[2]=e.z,this.orientationOut_[3]=e.w,this.orientationOut_}else{var r=this.filter.getOrientation();t=this.posePredictor.getPrediction(r,this.gyroscope,this.previousTimestampS)}var i=new THREE__namespace.Quaternion;return i.copy(this.filterToWorldQ),i.multiply(this.resetQ),i.multiply(t),i.multiply(this.worldToScreenQ),this.yawOnly&&(i.x=0,i.z=0,i.normalize()),this.orientationOut_[0]=i.x,this.orientationOut_[1]=i.y,this.orientationOut_[2]=i.z,this.orientationOut_[3]=i.w,this.orientationOut_},n.prototype.getPose=function(){var t=new Pose;return t.orientation=this.getOrientation(),t},n.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),isLandscapeMode()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},n.prototype.getFrameData=function(t){var e=this.getOrientation(),r=this.getEyeOffset(),i=this.getEyeProjectionMatrix();return t.pose.angularAcceleration=null,t.pose.angularVelocity=null,t.pose.linearAcceleration=null,t.pose.linearVelocity=null,t.pose.orientation=e,t.pose.position=null,t.timestamp=this.previousTimestampS,t.leftProjectionMatrix.set(i.left),t.rightProjectionMatrix.set(i.right),updateEyeViewMatrices(t.leftViewMatrix,e,r.left),updateEyeViewMatrices(t.rightViewMatrix,e,r.right),t},n.prototype.start=function(){if(typeof window=="undefined")return function(){};var t=this.onDeviceMotion_.bind(this),e=this.onOrientationChange_.bind(this),r=this.onMessage_.bind(this),i=this.onDeviceOrientation_.bind(this);return isIOS()&&isInsideCrossOriginIFrame()&&window.addEventListener("message",r),window.addEventListener("orientationchange",e),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",i):window.addEventListener("devicemotion",t),function(){window.removeEventListener("devicemotion",t),window.removeEventListener("deviceorientation",e),window.removeEventListener("orientationchange",e),window.removeEventListener("message",r)}},n.prototype.getEyeOffset=function(){return{left:[-this.viewer.interLensDistance*.5,0,0],right:[this.viewer.interLensDistance*.5,0,0]}},n.prototype.getEyeProjectionMatrix=function(){var t=this.getEyeFieldOfView(),e=this.depthNear,r=this.depthFar,i={left:[],right:[]};{var o=t.left.upDegrees*DEG_TO_RAD,s=t.left.downDegrees*DEG_TO_RAD,u=t.left.leftDegrees*DEG_TO_RAD,c=t.left.rightDegrees*DEG_TO_RAD,l=2/(u+c),d=2/(o+s);i.left[0]=l,i.left[1]=0,i.left[2]=0,i.left[3]=0,i.left[4]=0,i.left[5]=d,i.left[6]=0,i.left[7]=0,i.left[8]=-((u-c)*l*.5),i.left[9]=(o-s)*d*.5,i.left[10]=r/(e-r),i.left[11]=-1,i.left[12]=0,i.left[13]=0,i.left[14]=r*e/(e-r),i.left[15]=0}{var o=t.right.upDegrees*DEG_TO_RAD,s=t.right.downDegrees*DEG_TO_RAD,u=t.right.leftDegrees*DEG_TO_RAD,c=t.right.rightDegrees*DEG_TO_RAD,l=2/(u+c),d=2/(o+s);i.right[0]=l,i.right[1]=0,i.right[2]=0,i.right[3]=0,i.right[4]=0,i.right[5]=d,i.right[6]=0,i.right[7]=0,i.right[8]=-((u-c)*l*.5),i.right[9]=(o-s)*d*.5,i.right[10]=r/(e-r),i.right[11]=-1,i.right[12]=0,i.right[13]=0,i.right[14]=r*e/(e-r),i.right[15]=0}return i},n.prototype.getEyeFieldOfView=function(){var t=this.viewer,e=this.device,r=new Distortion(t.distortionCoefficients),i=t.screenLensDistance,o=(e.widthMeters-t.interLensDistance)/2,s=t.interLensDistance/2,u=t.baselineLensDistance-e.bevelMeters,c=e.heightMeters-u,l=RAD_TO_DEG*Math.atan(r.distort(o/i)),d=RAD_TO_DEG*Math.atan(r.distort(s/i)),f=RAD_TO_DEG*Math.atan(r.distort(u/i)),m=RAD_TO_DEG*Math.atan(r.distort(c/i)),A=new FieldOfView,h=new FieldOfView;return A.leftDegrees=Math.min(l,t.fov),A.rightDegrees=Math.min(d,t.fov),A.downDegrees=Math.min(f,t.fov),A.upDegrees=Math.min(m,t.fov),h.leftDegrees=A.rightDegrees,h.rightDegrees=A.leftDegrees,h.upDegrees=A.upDegrees,h.downDegrees=A.downDegrees,{left:A,right:h}},n.prototype.onDeviceOrientation_=function(t){this._deviceOrientationQ=this._deviceOrientationQ||new THREE__namespace.Quaternion;var e=t.alpha,r=t.beta,i=t.gamma;e=(e||0)*Math.PI/180,r=(r||0)*Math.PI/180,i=(i||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new THREE__namespace.Euler(e,r,-i,"YXZ"))},n.prototype.onDeviceMotion_=function(t){this.updateDeviceMotion_(t)},n.prototype.updateDeviceMotion_=function(t){var e=t.accelerationIncludingGravity,r=t.rotationRate,i=t.timeStamp/1e3,o=i-this.previousTimestampS;if(o<0){warnOnce("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),this.previousTimestampS=i;return}else if(o<=MIN_TIMESTEP||o>MAX_TIMESTEP){warnOnce("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),this.previousTimestampS=i;return}e&&(this.accelerometer.set(-e.x,-e.y,-e.z),r&&(isR7()?this.gyroscope.set(-r.beta,r.alpha,r.gamma):this.gyroscope.set(r.alpha,r.beta,r.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,i)),this.filter.addAccelMeasurement(this.accelerometer,i)),this.previousTimestampS=i},n.prototype.onOrientationChange_=function(){this.setScreenTransform_()},n.prototype.onMessage_=function(t){var e=t.data;if(!(!e||!e.type)){var r=e.type.toLowerCase();r==="devicemotion"&&this.updateDeviceMotion_(e.deviceMotionEvent)}},n.prototype.setScreenTransform_=function(){this.worldToScreenQ.set(0,0,0,1);var t=typeof window!="undefined"?window.orientation:0;switch(t){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),Math.PI/2);break}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},n}(),defaultLeftBounds=[0,0,.5,1],defaultRightBounds=[.5,0,.5,1],Cardboard=function(){function n(t){var e=this;this.renderer=t,this.sensor=new Sensor(.98,.04,!1,!1),this.scale=1,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera;var r=this.sensor.start();this.dispose=function(){var i=e.renderer.getSize(new THREE__namespace.Vector2);e.renderer.setScissor(0,0,i.width,i.height),e.renderer.setViewport(0,0,i.width,i.height),e.renderer.setScissorTest(!1),r()}}return n.prototype.render=function(t,e){var r=this.renderer.getSize(new THREE__namespace.Vector2);if(r.width>r.height){var i=t.autoUpdate;i&&(t.updateMatrixWorld(),t.autoUpdate=!1);var o={x:Math.round(r.width*defaultLeftBounds[0]),y:Math.round(r.height*defaultLeftBounds[1]),width:Math.round(r.width*defaultLeftBounds[2]),height:Math.round(r.height*defaultLeftBounds[3])},s={x:Math.round(r.width*defaultRightBounds[0]),y:Math.round(r.height*defaultRightBounds[1]),width:Math.round(r.width*defaultRightBounds[2]),height:Math.round(r.height*defaultRightBounds[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),e.parent===null&&e.updateMatrixWorld(),e.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),e.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var u=this.sensor.getEyeOffset();this.cameraL.translateOnAxis(new THREE__namespace.Vector3().fromArray(u.left),this.scale),this.cameraR.translateOnAxis(new THREE__namespace.Vector3().fromArray(u.right),this.scale);var c=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=c.left.slice(),this.cameraR.projectionMatrix.elements=c.right.slice(),this.renderer.setViewport(o.x,o.y,o.width,o.height),this.renderer.setScissor(o.x,o.y,o.width,o.height),this.renderer.render(t,this.cameraL),this.renderer.setViewport(s.x,s.y,s.width,s.height),this.renderer.setScissor(s.x,s.y,s.width,s.height),this.renderer.render(t,this.cameraR),this.renderer.setViewport(0,0,r.width,r.height),this.renderer.setScissor(0,0,r.width,r.height),this.renderer.setScissorTest(!1),i&&(t.autoUpdate=!0)}else this.renderer.render(t,e)},n.prototype.dispose=function(){},n}();const cardboard="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADqCAMAAAAvZYhaAAAC/VBMVEUAAAD///99fX37+/v5+fn29vbx8fHv7+/Nzc3o6Ojq6urh4eHU1NTR0dGDg4Pl5eWSkpLHx8fj4+Pe3t7X19fAwMDZ2dnCwsKrq6uioqLb29uNjY2enp67u7t5eXmAgIC2traWlpa5ubnKysqmpqZycnKHh4eurq6ysrKKioqDg4Pd3d12dnb9/f1vb2/s7OxlZWXz8/OoqKiZmZlpaWmbm5teXl7W1tbJycnExMRiYmJsbGywsLCPj49aWlq9vb1UVFRYWFhra2t+fn7t7e1RUVFOTk6Dg4OAgICCgoKKioqEhISIiIhqamqCgoKIiIiQkJCIiIiWlpawsLBmZmaAgICenp6Li4uBgYGTk5OMjIyVlZWFhYWCgoKvr6+Ojo59fX2SkpKvr6+Ojo6QkJCurq6BgYGxsbF8fHx4eHitra2enp6srKyJiYmurq54eHj5+fl+fn57e3v////5+fnS0tLAwMCVlZWwsLCurq5QUFCtra2EhISUlJSwsLCUlJSUlJSlpaWVlZW3t7diYmLAwMCFhYV3d3f///+tra3///9XV1eampqnp6d8fHz///////9VVVVlZWVtbW3+/v5SUlKcnJytra28vLzGxsbR0dHX19doaGiWlpafn5/Hx8ezs7Nzc3Nubm7AwMCIiIjj4+NTU1P29vZbW1vl5eVkZGTMzMxYWFjq6upfX1/k5OT////4+PjV1dWkpKRoaGj4+Pizs7Pm5ubAwMCfn5+vr6+urq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var _a,LOCALE={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},TEXT=typeof navigator!="undefined"&&(_a=LOCALE[navigator.language.split("-")[0]])!==null&&_a!==void 0?_a:LOCALE.zh,CONTENTS=`
1488
+ `,PanoVideo=function(){function n(){this.material=new THREE__namespace.ShaderMaterial({vertexShader:PANO_VIDEO_MATERIAL_VERTEX_SHADER,fragmentShader:PANO_VIDEO_TILE_MATERIAL_FRAGMENT_SHADER,uniforms:{size:new THREE__namespace.Uniform(null),matrix:new THREE__namespace.Uniform(null),alpha:new THREE__namespace.Uniform(null),map:new THREE__namespace.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor}),this.object=new THREE__namespace.Mesh(sharedGeometry$1,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.name="pano-video",this.alphaMotion=new Motion({alpha:0})}return n.prototype.setMaterial=function(t){t?(this.material.uniforms.size.value=t.size,this.material.uniforms.matrix.value=t.matrix,this.material.uniforms.map.value=t.map,this.alphaMotion.set({alpha:t.alpha},500).catch(noop$1),this.material.uniforms.alpha.value=t.alpha):(this.material.uniforms.size.value=null,this.material.uniforms.matrix.value=null,this.material.uniforms.map.value=null,this.alphaMotion.set({alpha:0},0).catch(noop$1));var e=t!==null,r=this.material.defines.USE_PANO_VIDEO;e!==r&&(this.material.defines.USE_PANO_VIDEO=e,this.material.needsUpdate=!0,this.object.visible=t!==null)},n.prototype.updateTime=function(t){this.alphaMotion.ended||(this.alphaMotion.update(t),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)},n.prototype.dispose=function(){this.material.dispose()},n}(),ROTATE_Y_PI_MATRIX$1=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE$1=new THREE__namespace.Vector3(-1,1,1),CubeRenderTargetPool=function(){function n(t){t===void 0&&(t=0),this.width=t,this.pool=[]}return Object.defineProperty(n.prototype,"size",{get:function(){return this.pool.length},enumerable:!1,configurable:!0}),n.prototype.create=function(){return new THREE__namespace.WebGLCubeRenderTarget(this.width,{stencilBuffer:!1,depthBuffer:!1})},n.prototype.pop=function(){var t=this.pool.pop();return t||this.create()},n.prototype.push=function(t){this.pool.indexOf(t)===-1&&this.pool.push(t)},n.prototype.clear=function(){for(var t=0,e=this.pool;t<e.length;t++){var r=e[t];r.dispose()}this.pool.length=0},n}(),PanoramaController=function(n){__extends(t,n);function t(e){var r=this,i,o,s,u,c=t.parseArgs(e);r=n.call(this,c)||this,r.TILED_CUBE_TEXTURE_LEVEL=2,r.mode="Panorama",r.tileLevel=0,r.initAnimationed=!1,r.maxAccessibleDistance=c.maxAccessibleDistance,r.panoTapTriggerRadius=c.panoTapTriggerRadius,r.panoCircleMeshCreator=c.panoCircleMeshCreator,r.tileLevelForFov=c.tileLevelForFov,r.tileMaxRequest=c.tileMaxRequest,r.luminanceAdaptiveEffectEnable=c.luminanceAdaptiveEffectEnable,r.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(r.renderer,r.modelScene,r.camera,r.models),r.colorCubeRenderTargetPool=new CubeRenderTargetPool,r.luminanceCubeRenderTargetPool=new CubeRenderTargetPool;var l=r.models.getMaterial()||{},d=l.pano0,f=l.pano1;d&&(f==null?void 0:f.map)!==d.map&&(r.models.setMaterial({pano0:f}),d.map.dispose(),d.map instanceof TileCubeTextureTarget&&d.map.cubeRenderTarget&&r.colorCubeRenderTargetPool.push(d.map.cubeRenderTarget),d.luminanceMap&&(d.luminanceMap.dispose(),d.luminanceMap instanceof TileCubeTextureTarget&&d.luminanceMap.cubeRenderTarget&&r.luminanceCubeRenderTargetPool.push(d.luminanceMap.cubeRenderTarget)));for(var m=r.colorCubeRenderTargetPool.size;m<2;m++){var A=Math.max(1024*r.TILED_CUBE_TEXTURE_LEVEL,512),h=r.colorCubeRenderTargetPool.create();h.setSize(A,A),renderCubeTextureToCubeRenderTarget(null,h,r.renderer),r.colorCubeRenderTargetPool.push(h)}r.panoMeshes={},r.updatePanoMeshes(),r.locationMotion=new Motion({count:0,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(o=(i=r.models.getMaterial())===null||i===void 0?void 0:i.modelAlpha)!==null&&o!==void 0?o:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),panoPicture:(u=(s=r.models.getMaterial())===null||s===void 0?void 0:s.pano1)!==null&&u!==void 0?u:null,position:r.camera.pose.offset.clone(),effect:"fly",fixCameraTransform:new THREE__namespace.Matrix4};var p=r.works.getResolvedObserver(r.currentPano);return r.textureLoader=new TextureLoader,r.tiling=new Tiling(p?getFetcher(p.work):internalFetcher,r.TILED_CUBE_TEXTURE_LEVEL+1,r.imageOptions),r.scene.add(r.tiling.object),r.panoVideo=new PanoVideo,r.scene.add(r.panoVideo.object),r}return t.parseArgs=function(e){var r,i,o,s,u,c;if(e instanceof t)return e;var l=n.parseArgs.call(this,e);return __assign(__assign({},l),{maxAccessibleDistance:(r=e.maxAccessibleDistance)!==null&&r!==void 0?r:5,panoTapTriggerRadius:(i=e.panoTapTriggerRadius)!==null&&i!==void 0?i:.5,panoCircleMeshCreator:(o=e.panoCircleMeshCreator)!==null&&o!==void 0?o:function(d){return new PanoCircleMesh},tileLevelForFov:(s=e.tileLevelForFov)!==null&&s!==void 0?s:function(d,f){var m=function(v){return v/Math.PI*180},A=function(v){return v/180*Math.PI},h=f.height/2/Math.tan(A(d/2)),p=f.width>f.height?d:m(Math.atan(Math.tan(A(d/2))*(f.width/f.height))*2);p*=.9;var y=h*(Math.tan(A(p/2))-Math.tan(A(p/2-1)));return y>80?5:y>60?4:y>40?3:y>18?2:y>12?1:0},tileMaxRequest:(u=e.tileMaxRequest)!==null&&u!==void 0?u:3,luminanceAdaptiveEffectEnable:(c=e.luminanceAdaptiveEffectEnable)!==null&&c!==void 0?c:!0})},t.initAnimationEndState=function(e){var r=this.parseArgs(e),i=n.initAnimationEndState.call(this,r);return __assign(__assign({},i),{mode:"Panorama"})},t.prototype.destroy=function(){var e,r;if(n.prototype.destroy.call(this),this.scene.remove(this.tiling.object),this.tiling.dispose(),this.locationMotion.dispose(),this.colorCubeRenderTargetPool.clear(),this.luminanceCubeRenderTargetPool.clear(),delete this.pendingTextureTask,this.panoMeshes)for(var i=Object.keys(this.panoMeshes),o=0,s=i;o<s.length;o++){var u=s[o],c=this.panoMeshes[u];this.helper.remove(c),c.dispose(),delete this.panoMeshes[u]}var l=this.videoTexture.image;l.pause(),l.oncanplay=function(){},l.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var d=(e=this.models.getMaterial())!==null&&e!==void 0?e:{},f=d.pano0,m=d.pano1,A=0,h=Object.keys(this.panoResources);A<h.length;A++){var p=h[A],y=this.panoResources[p];if(y.panoPicture){var v=y.panoPicture.map;v&&v!==(f==null?void 0:f.map)&&v!==(m==null?void 0:m.map)&&(v.dispose(),(r=y.panoPicture.luminanceMap)===null||r===void 0||r.dispose(),y.panoPicture=null)}delete this.panoResources[p]}this.luminanceAdaptiveEffect.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended!==!0?!1:n.prototype.isReady.call(this)},t.prototype.isTileReady=function(){var e,r,i,o=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),s=((e=o.panoPicture)===null||e===void 0?void 0:e.map)instanceof TileCubeTextureTarget&&(i=(r=o.panoPicture)===null||r===void 0?void 0:r.map.tilePending)!==null&&i!==void 0?i:0,u=this.tiling.pedding;return this.initAnimationed&&s<=0&&u<=0},t.prototype.updateWork=function(e,r,i,o){var s=this;this.userAction=o,this.works=e;var u=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:i.duration,effect:i.effect,state:r,userAction:o}})),c={workCode:u.workCode,panoIndex:u.panoIndex},l=this.works.getWork(c.workCode);return this.tiling.setFetcher(l?getFetcher(l):internalFetcher),this.tiling.cleanup(),this.initAnimationed=!1,this.hideIntersectMesh(),this.updatePanoMeshes(),this.moveToPano(c,{effect:i.effect,duration:i.duration,longitude:r.longitude,latitude:r.latitude,fov:r.fov,moveEndCallback:function(){s.initAnimationed=!0},moveCancelCallback:function(){s.initAnimationed=!0}},o),!0},t.prototype.updateModel=function(e){this.models=e,this.updatePanoMeshes()},t.prototype.updateTime=function(e,r){var i=this,o,s,u,c,l,d,f,m,A,h;if(!this.destroyed){var p={},y={},v=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),E=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var b=this.locationMotion.getKeyFrameSegment(e),T=b[0],x=b[1],R=this.panoResourceFromLocationMotionKeyframe(T),_=this.panoResourceFromLocationMotionKeyframe(x),M=new THREE__namespace.Vector3().copy(R.position),S=new THREE__namespace.Vector3().copy(_.position),I=this.locationMotion.value.count-x.value.count+1;p.progress=I,_.panoPicture&&(I<1?R.panoPicture&&(p.pano0=R.panoPicture):p.pano0=_.panoPicture,p.pano1=_.panoPicture),_.effect==="montage"?p.transition="BLACK":_.effect==="spread"?p.transition="SPREAD":p.transition="FADE",(_.effect==="zoomin"||_.effect==="zoomout")&&(p.progress=Math.pow(I,3)),I<1&&_.effect!=="fly"&&(p.pano0&&R.panoPicture&&(p.pano0={map:p.pano0.map,zoom:p.pano0.zoom,luminanceMap:p.pano0.luminanceMap,matrix:R.panoPicture.matrix.clone().premultiply(R.fixCameraTransform).setPosition(_.position)}),M.copy(S),E=!0),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(M.x+(S.x-M.x)*I,M.y+(S.y-M.y)*I,M.z+(S.z-M.z)*I);for(var C=[],H=[],B=0,L=this.locationMotion.keyframes;B<L.length;B++){var O=L[B],k=O.key,G=O.progress;k!==void 0&&(C.push(k),G>this.locationMotion.progress&&H.push(k))}for(var z=0,D=Object.keys(this.panoResources);z<D.length;z++){var U=D[z];if(!(H.indexOf(U)>=0)){var K=this.panoResources[U];if(K.panoPicture){var Q=K.panoPicture.map,q=K.panoPicture.luminanceMap;if(Q){if(Q===((o=p.pano0)===null||o===void 0?void 0:o.map)||Q===((s=p.pano1)===null||s===void 0?void 0:s.map))continue;Q instanceof TileCubeTextureTarget&&Q.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(Q.cubeRenderTarget),Q.dispose(),q&&(q instanceof TileCubeTextureTarget&&q.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(q.cubeRenderTarget),q.dispose()),K.panoPicture=null}}C.indexOf(U)>=0||delete this.panoResources[U]}}this.currentPano=panoParse(_.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(v.panoId),state:__assign(__assign(__assign(__assign({},panoParse(g.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(p)===!1&&(!((u=p.pano0)===null||u===void 0)&&u.map&&p.pano0.map instanceof TileCubeTextureTarget&&!p.pano0.map.cubeRenderTarget&&(p.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=p.pano0)===null||c===void 0)&&c.luminanceMap&&p.pano0.luminanceMap instanceof TileCubeTextureTarget&&!p.pano0.luminanceMap.cubeRenderTarget&&(p.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),!((l=p.pano1)===null||l===void 0)&&l.map&&p.pano1.map instanceof TileCubeTextureTarget&&!p.pano1.map.cubeRenderTarget&&(p.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((d=p.pano1)===null||d===void 0)&&d.luminanceMap&&p.pano1.luminanceMap instanceof TileCubeTextureTarget&&!p.pano1.luminanceMap.cubeRenderTarget&&(p.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.models.setMaterial(p)),isEmptyObject(y)===!1&&this.setCamera(y);var J=this.works.getResolvedObserver(this.currentPano),j=this.locationMotion.ended?this.getForwardObserverOrNot():null;if(this.camera.pose.distance>.1||E)for(var re=0,W=Object.keys(this.panoMeshes);re<W.length;re++){var te=W[re],$=this.panoMeshes[te];$.setOpacity(0),$.setCurrent(!1),$.updateTime&&$.updateTime(e,r),$.visible=!1}else if(J){var ne=arrayMin(J.visibleIds,function(ce){var le=i.works.getResolvedObserver(ce);return le?J.standingPosition.distanceTo(le.standingPosition):1/0},!0),ee=ne[1];ee=clamp$1(ee,2.5,1/0);for(var fe=J.visibleIds.concat(panoStringify(this.currentPano)),ie=this.camera.getDirection(new THREE__namespace.Vector3),se=0,Ae=Object.keys(this.panoMeshes);se<Ae.length;se++){var te=Ae[se],$=this.panoMeshes[te],he=this.works.getResolvedObserver(te);if(fe.indexOf(te)===-1)$.setCurrent(!1),$.setOpacity(0);else if(!he)$.setCurrent(!1),$.setOpacity(0);else if(!he.loadable&&!he.active)$.setCurrent(!1),$.setOpacity(0);else{var me=$.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);$.setCurrent(!$.loading&&$.progress===0&&j!==null&&j.panoId===te),$.setOpacity(me<.01?0:clamp$1(ee/me*1.2,.4,.85));var Z=this.camera.position.clone().setY($.position.y),Y=new THREE__namespace.Vector3().copy($.position).sub(Z).normalize();if(te===panoStringify(this.currentPano)){var N=clamp$1((.5-Z.distanceTo($.position))/.5,0,1);Y.multiplyScalar(1-N).add(ie.clone().multiplyScalar(N))}Y.length()>0&&$.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(Y.x,Y.z),0))}$.updateTime&&$.updateTime(e,r)}}var Ee=this.tileLevel=function(){if(i.tileLevelForFov===!1)return 0;var ce=i.renderer.getDrawingBufferSize(new THREE__namespace.Vector2);ce.width*=i.scissor.width,ce.height*=i.scissor.height;var le=g.panoId,ue=i.works.getResolvedObserver(le),oe=i.imageOptions.size;if(typeof oe=="undefined"&&ue){var Te=ue.images.up.match(/\/cube_(\d+)\//);Te&&(oe=Number(Te[1]))}typeof oe=="undefined"&&(oe=2048);var Re=0;oe>=1024&&(Re=1),oe>=2048&&(Re=2),oe>=4096&&(Re=3),oe>=8192&&(Re=4);var Ie=i.tileLevelForFov(i.camera.fov,ce);return Ie>Re?Ie:0}(),ge=function(){var ce=i.camera.quaternion.clone(),le=i.works.getResolvedObserver(g.panoId),ue=le!=null?le:J;ue&&ce.premultiply(ue.quaternion.clone().inverse());var oe=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ce),Te=new THREE__namespace.Matrix4().getInverse(oe),Re=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(i.camera.projectionMatrix,Te));return Re}();g.panoId===panoStringify(this.currentPano)&&(((f=g.panoPicture)===null||f===void 0?void 0:f.map)instanceof TileCubeTextureTarget&&(g.panoPicture.map.maxRequest=this.tileMaxRequest,g.panoPicture.map.update(ge,Ee),g.panoPicture.map.needsRender===!0&&(g.panoPicture.map.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)),((m=g.panoPicture)===null||m===void 0?void 0:m.luminanceMap)instanceof TileCubeTextureTarget&&(g.panoPicture.luminanceMap.maxRequest=this.tileMaxRequest,g.panoPicture.luminanceMap.update(ge,Ee),g.panoPicture.luminanceMap.needsRender===!0&&(g.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)));{var ve=this.tiling.object.visible;if(this.initAnimationed){var xe=g.panoId,de=this.works.getResolvedObserver(xe);de?isSimilarVector3(this.camera.position,de.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==xe&&this.tiling.cleanup(),this.tiling.panoId=xe,this.tiling.setResource((h=(A=de.images)===null||A===void 0?void 0:A.tiles)!==null&&h!==void 0?h:[],this.enableIOSEDR&&de.images.luminance?de.images.luminance:null),this.tiling.setFetcher(getFetcher(de.work)),this.tiling.setRotation(de.quaternion),this.tiling.setPosition(de.position),this.tiling.maxRequest=this.tileMaxRequest,Ee>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(ge,Ee,e):this.tiling.update(ge,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;ve!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh.scale.setScalar(clamp$1(this.cameraMotion.value.fov/45,0,1))}},t.prototype.render=function(e,r){var i=this.renderer.getRenderTarget(),o=this.works.getResolvedObserver(this.currentPano);o&&o.video&&(this.needsRender=!0,this.modelSceneNeedsRender=!0),this.updateScreenBuffer(r),e&&(r==="luminance"?(this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable,this.luminanceAdaptiveEffect.render(this.screenBuffers)):(this.renderer.setRenderTarget(this.modelRenderTarget),this.renderer.render(this.modelScene,this.camera))),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,i),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,i),this.renderer.setRenderTarget(i),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.postProcessing=function(e,r){if(!this.destroyed&&r==="luminance")return this.luminanceAdaptiveEffect||(this.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(this.renderer,this.scene,this.camera,this.models),this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable),this.luminanceAdaptiveEffect.render(e)},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1],i=this.panoResourceFromLocationMotionKeyframe(r),o=this.works.getResolvedObserver(i.panoId);return{workCode:o?o.work.workCode:this.currentPano.workCode,panoIndex:o?o.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:o?o.position.clone():this.camera.position.clone(),distance:this.locationMotion.value.distance}},t.prototype.moveToPano=function(e,r,i){var o=this,s,u,c,l,d=(s=r.effect)!==null&&s!==void 0?s:"fly";this.userAction=i,this.stopMomentumMovement();var f=this.works.getResolvedObserver(e);if(!f)throw new Error("Invalid PanoId ".concat(JSON.stringify(e)));var m=getImageSizeFromURL(f.images.up),A=this.imageOptions.size;typeof A=="undefined"&&f&&m&&(A=Number(m)),typeof A=="undefined"&&(A=2048);var h=this.imageOptions.transform,p=__assign({key:"pano.".concat(f.panoId)},pick(this.imageOptions,["format","size","quality","sharpen","mappings"])),y=f.images,v=(c=(u=f.images.tiles)===null||u===void 0?void 0:u.filter(function(L){return L.size>A}))!==null&&c!==void 0?c:null,g=h,E={key:"pano_luminance.".concat(f.panoId),size:p.size?p.size/2:void 0},b=this.enableIOSEDR&&f.images.luminance?f.images.luminance:null,T=function(){if(!f.images.tiles||!b)return null;var L=getImageSizeFromURL(b.up);return L?v==null?void 0:v.map(function(O){var k=O.size*O.scale/2;return L<k?{level:O.level,size:k,scale:1,back:replaceImageSize(b.back,k),front:replaceImageSize(b.front,k),left:replaceImageSize(b.left,k),right:replaceImageSize(b.right,k),up:replaceImageSize(b.up,k),down:replaceImageSize(b.down,k)}:{level:O.level,size:L,scale:k/L,back:b.back,front:b.front,left:b.left,right:b.right,up:b.up,down:b.down}}):null}(),x="pano:"+jsonHash([y,p,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===x)return;var R=this.pendingTextureTask.panoId;(l=this.panoMeshes[R])===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:f.pano}))}var _="move-to-pano-"+f.panoId;this.pending.add(_);var M=this.models.getMaterial()||{},S=M.pano0,I=M.pano1,C;if(S&&S.map.name===x&&S.luminanceMap!==null===this.enableIOSEDR?C=S:(I==null?void 0:I.map.name)===x&&I.luminanceMap!==null===this.enableIOSEDR&&(C=I),C){var H={panoId:f.panoId,effect:d,panoPicture:{zoom:1,map:C.map,luminanceMap:C.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(f.position,f.quaternion,PANO_TEXTURE_SCALE$1)},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};AnimationFrameLoop.shared.add(function(){o.pending.delete(_),o.doMoveToPano(f.pano,H,r)},!0,1);return}this.pendingTextureTask={panoId:f.panoId,hash:x,onLoad:function(L,O){var k;if(o.pending.delete(_),o.destroyed)L.body.dispose();else{L.body.name=x;var G={panoId:f.panoId,effect:d,panoPicture:{zoom:1,map:L.body,luminanceMap:(k=O==null?void 0:O.body)!==null&&k!==void 0?k:null,matrix:new THREE__namespace.Matrix4().compose(f.position,f.quaternion,PANO_TEXTURE_SCALE$1)},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};o.doMoveToPano(f.pano,G,r)}},onError:function(L){o.pending.delete(_);var O=__assign(__assign(__assign({},f.pano),{mode:o.mode}),clonePose(o.camera.pose));o.emit("pano.error",createEvent("pano.error",{error:L,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:O})),o.emit("pano.cancel",createEvent("pano.cancel",{error:L,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:O})),o.emit("error",L),r.moveCancelCallback&&r.moveCancelCallback()}};var B=this.panoMeshes[f.panoId];B&&B.tap&&B.tap(),Promise.all([this.tileLevelForFov&&v&&v.length?this.textureLoader.loadTiledCubeTexture(y,v,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:h,options:p},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(f.work)},void 0,void 0,function(L){var O,k;o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:L,meta:null,pano:f.pano})),((O=o.pendingTextureTask)===null||O===void 0?void 0:O.hash)===x&&((k=o.panoMeshes[f.panoId])===null||k===void 0||k.setProgress(L))},this.renderer):this.textureLoader.loadCubeTexture(y,{imageURL:{transform:h,options:p},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(f.work)},void 0,void 0,function(L){var O,k;o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:L,meta:null,pano:f.pano})),((O=o.pendingTextureTask)===null||O===void 0?void 0:O.hash)===x&&((k=o.panoMeshes[f.panoId])===null||k===void 0||k.setProgress(L))},this.renderer),b?this.tileLevelForFov&&T&&T.length?this.textureLoader.loadTiledCubeTexture(b,T,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:g,options:E},minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,fetcher:getFetcher(f.work)},void 0,void 0,void 0,this.renderer).catch(function(){return null}):this.textureLoader.loadCubeTexture(b,{imageURL:{transform:g,options:E},fetcher:getFetcher(f.work)},void 0,void 0,void 0,this.renderer).catch(function(){return null}):Promise.resolve(null)]).then(function(L){var O,k,G=L[0],z=L[1];((O=o.pendingTextureTask)===null||O===void 0?void 0:O.hash)===x?(o.pendingTextureTask.onLoad(G,z),(k=o.panoMeshes[f.panoId])===null||k===void 0||k.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:G.meta,pano:f.pano}))):(G.body.dispose(),z==null||z.body.dispose())}).catch(function(L){var O,k;((O=o.pendingTextureTask)===null||O===void 0?void 0:O.hash)===x&&(o.pendingTextureTask.onError(L),(k=o.panoMeshes[f.panoId])===null||k===void 0||k.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.error",createEvent("pano.texture.error",{error:L,progress:0,meta:null,pano:f.pano})),o.emit("error",L))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:f.pano}))},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var i=e.initial,o=i.duration,s=i.effect,u=i.userAction;e.userAction=u;var c=t.initAnimationEndState(e),l={workCode:c.workCode,panoIndex:c.panoIndex},d={modelAlpha:0},f={perspToOrtho:0},m=!1;e.moveToPano(l,{longitude:c.longitude,latitude:c.latitude,fov:c.fov,effect:s,duration:o,moveStartCallback:function(A){m=!0,e.perspToOrthoMotion.set(f,o).catch(noop$1),e.modelAlphaMotion.setKeyframes([{progress:0,value:__assign({},e.modelAlphaMotion.value)},{progress:.6,value:__assign({},e.modelAlphaMotion.value)},{progress:1,value:d}],o).catch(noop$1),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:A,userAction:e.userAction}))},moveEndCallback:function(A){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:A,userAction:e.userAction})),e.initAnimationed=!0,r()},moveCancelCallback:function(){var A=__assign(__assign(__assign({},l),{mode:e.mode}),clonePose(e.camera.pose));m===!1&&e.emit("initAnimation.start",createEvent("initAnimation.start",{state:A,userAction:e.userAction})),e.emit("initAnimation.end",createEvent("initAnimation.end",{state:A,userAction:e.userAction})),e.initAnimationed=!0,r()}},u)})},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var r=0,i=1;i<e.length;i++){var o=this.panoResourceFromLocationMotionKeyframe(e[i-1]).position,s=this.panoResourceFromLocationMotionKeyframe(e[i]).position,u=o.distanceTo(s)*(e[i].value.count-e[i-1].value.count);r+=u}return r},t.prototype.updatePanoMeshes=function(){for(var e=this,r={},i=Object.keys(this.panoMeshes),o=0,s=i;o<s.length;o++){var u=s[o],c=this.panoMeshes[u];r[u]=c,delete this.panoMeshes[u]}for(var l=1,d={},f=function(x){var R=arrayMin(x.accessibleIds,function(M){var S=e.works.getResolvedObserver(M);if(!S)return 1/0;var I=S.standingPosition.distanceTo(x.standingPosition);return clamp$1(I,1,1/0)},!0),_=R[1];d[x.panoId]===void 0&&(d[x.panoId]=_)},m=0,A=this.works.resolvedObservers;m<A.length;m++){var h=A[m];f(h)}var p=Object.keys(d).map(function(x){return d[x]});if(p.length){var y=p.reduce(function(x,R){return x+R},0)/p.length;l=clamp$1(y*.6,1,3)}for(var v=0,g=this.works.resolvedObservers;v<g.length;v++){var h=g[v],c=void 0;r[h.panoId]?(c=r[h.panoId],c.loading===!0&&h.loadable===!1&&c.setLoading(!1),delete r[h.panoId]):(c=this.panoCircleMeshCreator(h.pano),c.name="PanoCircleMesh_"+h.panoId,this.helper.add(c)),c.scale.set(l,1,l),c.position.copy(h.standingPosition),this.panoMeshes[h.panoId]=c}for(var E=0,b=Object.keys(r);E<b.length;E++){var T=b[E];this.helper.remove(r[T]),r[T].dispose(),delete r[T]}},t.prototype.doMoveToPano=function(e,r,i){var o=this,s,u,c,l,d,f,m,A,h,p,y;i===void 0&&(i={});var v=now(),g=createUuid();this.tiling.cleanup(),this.panoResources[g]=r;var E=1,b,T,x;if(this.locationMotion.ended){var R=this.locationMotion.getKeyFrameSegment(v);R[0];var _=R[1],M=this.locationMotion.value,S=((s=this.panoResourceFromLocationMotionKeyframe(_))!==null&&s!==void 0?s:this.camera).position,I=r.position;b=Math.max(S.distanceTo(I),E),T=[{key:_.key,progress:0,value:__assign(__assign({},M),{count:0})},{key:g,progress:1,value:{distance:0,count:1}}],x=0}else{var C=this.locationMotion.getKeyFrameSegment(v),H=C[0],_=C[1],M=this.locationMotion.value,B=this.panoResourceFromLocationMotionKeyframe(H).position,S=this.panoResourceFromLocationMotionKeyframe(_).position,I=r.position,L=_.value.count-M.count,O=Math.max(B.distanceTo(S),E)*L,k=Math.max(S.distanceTo(I),E);b=O+k,T=[{key:H.key,progress:0,value:__assign({},M)},{key:_.key,progress:O/b,value:_.value},{key:g,progress:1,value:{count:_.value.count+1,distance:0}}];var G=this.locationMotionKeyframesLength(this.locationMotion.keyframes),z=this.locationMotionKeyframesLength(T);G===0||G===0?x=0:x=this.locationMotion.getProgressVelocity(v)*G/z}var D=r.effect==="instant"?0:this.calculateMovingDuration(i.duration,r.effect==="fly"?b:0),U={longitude:i.longitude,latitude:i.latitude,fov:i.fov},K=__assign(__assign({},e),{mode:this.mode,longitude:(u=U.longitude)!==null&&u!==void 0?u:this.camera.pose.longitude,latitude:(c=U.latitude)!==null&&c!==void 0?c:this.camera.pose.latitude,fov:(l=U.fov)!==null&&l!==void 0?l:this.camera.pose.fov,offset:r.position.clone(),distance:this.camera.pose.distance}),Q=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:i,prevPano:Q,progress:0,state:K,userAction:this.userAction,error:null})),i.moveStartCallback&&i.moveStartCallback(K),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(U,D).catch(noop$1);else{var q=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),J=coordinatesToVector({longitude:(d=U.longitude)!==null&&d!==void 0?d:this.cameraMotion.value.longitude,latitude:(f=U.latitude)!==null&&f!==void 0?f:this.cameraMotion.value.latitude}),j=new THREE__namespace.Object3D;j.lookAt(q);var re=new THREE__namespace.Matrix4().makeRotationFromQuaternion(j.quaternion);j.lookAt(J);var W=new THREE__namespace.Matrix4().makeRotationFromQuaternion(j.quaternion),te=new THREE__namespace.Matrix4().getInverse(re).premultiply(W),$=this.cameraMotion.value.fov,ne=(m=U.fov)!==null&&m!==void 0?m:this.cameraMotion.value.fov,ee=1;r.effect==="zoomin"?ee=1.5:r.effect==="zoomout"&&(ee=.4);for(var fe=clamp$1(ne*ee,1,170),ie=0;ie<T.length-1;ie++){var se=T[ie].key;if(se){var Ae=this.panoResources[se];Ae&&(Ae.fixCameraTransform.copy(te),Ae.panoPicture&&(Ae.panoPicture.zoom=Math.tan($/2/180*Math.PI)/Math.tan(fe/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(A=U.longitude)!==null&&A!==void 0?A:this.cameraMotion.value.longitude,latitude:(h=U.latitude)!==null&&h!==void 0?h:this.cameraMotion.value.latitude,fov:fe}},{progress:1,value:{longitude:(p=U.longitude)!==null&&p!==void 0?p:this.cameraMotion.value.longitude,latitude:(y=U.latitude)!==null&&y!==void 0?y:this.cameraMotion.value.latitude,fov:ne}}],D).catch(noop$1)}var he=this.locationMotion.setKeyframes(T,D,x);he.then(function(){for(var me,Z,Y=0,N=o.models;Y<N.length;Y++){var Ee=N[Y];Ee.show()}var ge=__assign(__assign({},e),{mode:o.mode,longitude:o.camera.pose.longitude,latitude:o.camera.pose.latitude,fov:o.camera.pose.fov,offset:o.camera.pose.offset.clone(),distance:o.camera.pose.distance});o.emit("pano.arrived",createEvent("pano.arrived",{options:i,prevPano:Q,progress:1,state:ge,userAction:o.userAction,error:null})),i.moveEndCallback&&i.moveEndCallback(ge);var ve=o.works.getResolvedObserver(e);if(ve&&ve.video&&o.videoTexture&&o.videoTexture.image instanceof HTMLVideoElement){var xe=ROTATE_Y_PI_MATRIX$1.clone().multiply((Z=(me=o.models.getMaterial().pano1)===null||me===void 0?void 0:me.matrix)!==null&&Z!==void 0?Z:new THREE__namespace.Matrix4).multiply(ve.video.matrix),de={map:o.videoTexture,size:ve.video.size,matrix:xe,alpha:1},ce=createUuid(),le=o.videoTexture.image;le.setAttribute("uuid",ce),canplayVideo().then(function(ue){ue&&ve.video&&le.getAttribute("uuid")===ce&&(le.oncanplay=function(){le.oncanplay=noop$1,le.play()},le.ontimeupdate=function(){le.currentTime>.5&&(le.ontimeupdate=noop$1,o.panoVideo.setMaterial(de))},le.src=ve.video.source)}).catch(function(){le.removeAttribute("uuid")})}},function(){o.emit("pano.cancel",createEvent("pano.cancel",{options:i,prevPano:Q,progress:0,state:K,userAction:o.userAction,error:null})),i.moveCancelCallback&&i.moveCancelCallback()})},t.prototype.getForwardObserverOrNot=function(e){var r=this,i=this.works.getResolvedObserver(this.currentPano);if(!i)return null;var o=e!=null?e:new THREE__namespace.Raycaster(this.camera.position.clone(),this.camera.getDirection(new THREE__namespace.Vector3));o.params.Points={threshold:.1};var s=i.standingPosition.clone();if(i.position.distanceTo(o.ray.origin)>1){var u=this.models.intersectRaycaster(new THREE__namespace.Raycaster(o.ray.origin,new THREE__namespace.Vector3(0,-1,0)))[0];u&&u.distance<=2?s.copy(u.point):s.copy(o.ray.origin).add(new THREE__namespace.Vector3(0,-1.5,0))}var c=this.models.intersectRaycaster(o)[0],l=c?c.point:o.ray.origin.clone().add(o.ray.direction.clone().normalize().multiplyScalar(3)),d=l.clone().sub(s).normalize();if(d.length()===0)return null;for(var f=i.accessibleIds.filter(function(T){if(T===panoStringify(r.currentPano))return!1;var x=r.works.getResolvedObserver(T);if(!x)return!1;var R=x.standingPosition.clone().project(r.camera);return Math.abs(R.z)>1||Math.abs(R.x)>1||Math.abs(R.y)>1?!1:x.loadable||x.active}),m=f.slice().sort(function(T,x){var R=r.works.getResolvedObserver(T).standingPosition.clone().distanceTo(s),_=r.works.getResolvedObserver(x).standingPosition.clone().distanceTo(s);return R-_}),A=0,h=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];A<h.length;A++)for(var p=h[A],y=0,v=m;y<v.length;y++){var g=v[y],E=this.works.getResolvedObserver(g);if(E){var b=E.standingPosition.clone().sub(s);if(b&&b.length()!==0&&d.angleTo(b)<p)return E}}return null},t.prototype.onTapGesture=function(e){var r=this,i;if(this.userAction=e.userAction,this.stopMomentumMovement(),!!this.initAnimationed){if(!this.locationMotion.ended){var o=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]);if(o.panoId!==panoStringify(this.currentPano))return}var s=e.center.raycaster,u=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),c=null,l=this.works.getResolvedObserver(this.currentPano);if(l){var d=l.accessibleIds.filter(function(z){if(z===panoStringify(r.currentPano))return!1;var D=r.works.getResolvedObserver(z);return!D||D.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:D.loadable||D.active}),f=this.models.intersectRaycaster(s)[0];if(f){var m=arrayMin(d,function(z){var D=r.works.getResolvedObserver(z);if(!D)return 1/0;var U=D.standingPosition.clone();return U.distanceTo(f.point)},!0),A=m[0],h=m[1];A&&h<this.panoTapTriggerRadius&&(c=(i=this.works.getResolvedObserver(A))!==null&&i!==void 0?i:null)}c||(c=this.getForwardObserverOrNot(s));for(var p=0,y=this.locationMotion.keyframes;p<y.length;p++){var v=y[p],g=this.panoResourceFromLocationMotionKeyframe(v);if(!(v.progress<this.locationMotion.progress)&&c&&g.panoId===c.panoId){c=null;break}}if(!c)this.emit("gesture.tap",e),e.defaultPrevented||this.locationMotion.ended===!0&&this.cameraBounce();else{for(var E={},b=Math.PI/6,T=Math.PI/12,x=c.position.clone().setY(0).sub(l.position.clone().setY(0)).normalize(),R=[],_=[],M=[],S=0,I=c.accessibleIds;S<I.length;S++){var A=I[S],C=panoParse(A);if(!(panoEqual(C,this.currentPano)||panoEqual(C,c.pano))){var H=this.works.getResolvedObserver(A);if(H){var B=H.position.clone().sub(c.position).setY(0);x.angleTo(B)<b&&M.push(B)}}}var L=M.length>0?M:__spreadArray(__spreadArray([],R,!0),_,!0),O=L.slice().sort(function(z,D){return z.angleTo(x)-D.angleTo(x)})[0];O&&O.angleTo(u)>T&&(E.longitude=Math.atan2(-O.x,-O.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(E.latitude=clamp$1(0,this.minLatitude,this.maxLatitude));var k=__assign({},e.state);if(k.workCode=c.pano.workCode,k.panoIndex=c.pano.panoIndex,E.longitude!==void 0&&(k.longitude=E.longitude),E.latitude!==void 0&&(k.latitude=E.latitude),E.fov!==void 0&&(k.fov=E.fov),k.distance=0,k.offset=c.position.clone(),e.state=k,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:k,userAction:e.userAction,options:E,progress:0,error:null})),c&&!c.active){var G=c.panoId;this.panoMeshes[G]&&(this.panoMeshes[G].setDisabled(!1),this.panoMeshes[G].setLoading(!0))}c&&c.active&&this.emit("pano.request",createEvent("pano.request",{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:k,options:E,error:null}))}}}}},t}(PanoramaLikeController),DEG_TO_RAD=Math.PI/180,RAD_TO_DEG=180/Math.PI,MIN_TIMESTEP=.001,MAX_TIMESTEP=1,isIOS=function(){var n=typeof navigator!="undefined"&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return n}}(),isSafari=function(){var n=typeof navigator!="undefined"&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return n}}(),isFirefoxAndroid=function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("Firefox")!==-1&&navigator.userAgent.indexOf("Android")!==-1;return function(){return n}}(),getChromeVersion=function(){var n=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=n?parseInt(n[1],10):null;return function(){return t}}(),isChromeWithoutDeviceMotion=function(){var n=!1;if(getChromeVersion()===65){var t=typeof navigator!="undefined"?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var e=t[1].split(".");e[0],e[1];var r=e[2],i=e[3];n=parseInt(r,10)===3325&&parseInt(i,10)<148}}return function(){return n}}(),isSafariWithoutDeviceMotion=function(){var n=isIOS()&&isSafari()&&typeof navigator!="undefined"&&navigator.userAgent.indexOf("13_4")!==-1;return function(){return n}}(),isR7=function(){var n=typeof navigator!="undefined"&&navigator.userAgent.indexOf("R7 Build")!==-1;return function(){return n}}();function isLandscapeMode(){var n=typeof window!="undefined"&&(window.orientation==90||window.orientation==-90);return isR7()?!n:n}function isTimestampDeltaValid(n){return!(isNaN(n)||n<=MIN_TIMESTEP||n>MAX_TIMESTEP)}function getQuaternionAngle(n){if(n.w>1)return 0;var t=2*Math.acos(n.w);return t}var warnOnce=function(){var n={};return function(t,e){n[t]===void 0&&(console.warn("cardboard: "+e),n[t]=!0)}}();function getOriginFromUrl(n){var t,e=n.indexOf("://");e!==-1?t=e+3:t=0;var r=n.indexOf("/",t);return r===-1&&(r=n.length),n.substring(0,r)}function isInsideCrossOriginIFrame(){if(typeof window=="undefined"||typeof document=="undefined")return!1;var n=window.self!==window.top,t=getOriginFromUrl(document.referrer),e=getOriginFromUrl(window.location.href);return n&&t!==e}var updateEyeViewMatrices=function(){function n(r,i,o){var s=i?i[0]:0,u=i?i[1]:0,c=i?i[2]:0,l=i?i[3]:1,d=s+s,f=u+u,m=c+c,A=s*d,h=s*f,p=s*m,y=u*f,v=u*m,g=c*m,E=l*d,b=l*f,T=l*m;return r[0]=1-(y+g),r[1]=h+T,r[2]=p-b,r[3]=0,r[4]=h-T,r[5]=1-(A+g),r[6]=v+E,r[7]=0,r[8]=p+b,r[9]=v-E,r[10]=1-(A+y),r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function t(r,i,o){var s=o[0],u=o[1],c=o[2],l,d,f,m,A,h,p,y,v,g,E,b;return i===r?(r[12]=i[0]*s+i[4]*u+i[8]*c+i[12],r[13]=i[1]*s+i[5]*u+i[9]*c+i[13],r[14]=i[2]*s+i[6]*u+i[10]*c+i[14],r[15]=i[3]*s+i[7]*u+i[11]*c+i[15]):(l=i[0],d=i[1],f=i[2],m=i[3],A=i[4],h=i[5],p=i[6],y=i[7],v=i[8],g=i[9],E=i[10],b=i[11],r[0]=l,r[1]=d,r[2]=f,r[3]=m,r[4]=A,r[5]=h,r[6]=p,r[7]=y,r[8]=v,r[9]=g,r[10]=E,r[11]=b,r[12]=l*s+A*u+v*c+i[12],r[13]=d*s+h*u+g*c+i[13],r[14]=f*s+p*u+E*c+i[14],r[15]=m*s+y*u+b*c+i[15]),r}function e(r,i){var o=i[0],s=i[1],u=i[2],c=i[3],l=i[4],d=i[5],f=i[6],m=i[7],A=i[8],h=i[9],p=i[10],y=i[11],v=i[12],g=i[13],E=i[14],b=i[15],T=o*d-s*l,x=o*f-u*l,R=o*m-c*l,_=s*f-u*d,M=s*m-c*d,S=u*m-c*f,I=A*g-h*v,C=A*E-p*v,H=A*b-y*v,B=h*E-p*g,L=h*b-y*g,O=p*b-y*E,k=T*O-x*L+R*B+_*H-M*C+S*I;return k?(k=1/k,r[0]=(d*O-f*L+m*B)*k,r[1]=(u*L-s*O-c*B)*k,r[2]=(g*S-E*M+b*_)*k,r[3]=(p*M-h*S-y*_)*k,r[4]=(f*H-l*O-m*C)*k,r[5]=(o*O-u*H+c*C)*k,r[6]=(E*R-v*S-b*x)*k,r[7]=(A*S-p*R+y*x)*k,r[8]=(l*L-d*H+m*I)*k,r[9]=(s*H-o*L-c*I)*k,r[10]=(v*M-g*R+b*T)*k,r[11]=(h*R-A*M-y*T)*k,r[12]=(d*C-l*B-f*I)*k,r[13]=(o*B-s*C+u*I)*k,r[14]=(g*x-v*_-E*T)*k,r[15]=(A*_-h*x+p*T)*k,r):null}return function(r,i,o){n(r,i),o&&t(r,r,o),e(r,r)}}(),SensorSample=function(){function n(t,e){t===void 0&&(t=new THREE__namespace.Vector3),e===void 0&&(e=0),this.sample=t,this.timestampS=e}return n.prototype.set=function(t,e){this.sample=t,this.timestampS=e},n.prototype.copy=function(t){this.set(t.sample,t.timestampS)},n}(),ComplementaryFilter=function(){function n(t,e){this.kFilter=t,this.isDebug=e,this.currentAccelMeasurement=new SensorSample,this.currentGyroMeasurement=new SensorSample,this.previousGyroMeasurement=new SensorSample,isIOS()?this.filterQ=new THREE__namespace.Quaternion(-1,0,0,1):this.filterQ=new THREE__namespace.Quaternion(1,0,0,1),this.previousFilterQ=new THREE__namespace.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new THREE__namespace.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new THREE__namespace.Vector3,this.measuredGravity=new THREE__namespace.Vector3,this.gyroIntegralQ=new THREE__namespace.Quaternion}return n.prototype.addAccelMeasurement=function(t,e){this.currentAccelMeasurement.set(t,e)},n.prototype.addGyroMeasurement=function(t,e){this.currentGyroMeasurement.set(t,e);var r=e-this.previousGyroMeasurement.timestampS;isTimestampDeltaValid(r)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},n.prototype.getOrientation=function(){return this.filterQ},n.prototype.run_=function(){if(!this.isOrientationInitialized){this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),this.isOrientationInitialized=!0;return}var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,e=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(e),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(e);var r=new THREE__namespace.Quaternion;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var i=new THREE__namespace.Quaternion;i.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),i.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",RAD_TO_DEG*getQuaternionAngle(i),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var o=new THREE__namespace.Quaternion;o.copy(this.filterQ),o.multiply(i),this.filterQ.slerp(o,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},n.prototype.accelToQuaternion_=function(t){var e=new THREE__namespace.Vector3;e.copy(t),e.normalize();var r=new THREE__namespace.Quaternion;return r.setFromUnitVectors(new THREE__namespace.Vector3(0,0,-1),e),r.inverse(),r},n.prototype.gyroToQuaternionDelta_=function(t,e){var r=new THREE__namespace.Quaternion,i=new THREE__namespace.Vector3;return i.copy(t),i.normalize(),r.setFromAxisAngle(i,t.length()*e),r},n}(),PosePredictor=function(){function n(t,e){this.predictionTimeS=t,this.isDebug=e,this.previousQ=new THREE__namespace.Quaternion,this.previousTimestampS=null,this.deltaQ=new THREE__namespace.Quaternion,this.outQ=new THREE__namespace.Quaternion}return n.prototype.getPrediction=function(t,e,r){if(!this.previousTimestampS)return this.previousQ.copy(t),this.previousTimestampS=r,t;var i=new THREE__namespace.Vector3;i.copy(e),i.normalize();var o=e.length();if(o<DEG_TO_RAD*20)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(RAD_TO_DEG*o).toFixed(1)),this.outQ.copy(t),this.previousQ.copy(t),this.outQ;var s=o*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(i,s),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(t),this.previousTimestampS=r,this.outQ},n}(),Distortion=function(){function n(t){this.coefficients=t}return n.prototype.distortInverse=function(t){for(var e=0,r=1,i=t-this.distort(e);Math.abs(r-e)>1e-4;){var o=t-this.distort(r),s=r-o*((r-e)/(o-i));e=r,r=s,i=o}return r},n.prototype.distort=function(t){for(var e=t*t,r=0,i=0;i<this.coefficients.length;i++)r=e*(r+this.coefficients[i]);return(r+1)*t},n}(),Pose=function(){function n(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null}return n}(),FieldOfView=function(){function n(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0}return n}(),Sensor=function(){function n(t,e,r,i){this.viewer={id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=r,this.accelerometer=new THREE__namespace.Vector3,this.gyroscope=new THREE__namespace.Vector3,this.filter=new ComplementaryFilter(t,i),this.posePredictor=new PosePredictor(e,i),this.isFirefoxAndroid=isFirefoxAndroid(),this.isIOS=isIOS();var o=getChromeVersion();this.isDeviceMotionInRadians=!this.isIOS&&o!==null&&o<66,this.isWithoutDeviceMotion=isChromeWithoutDeviceMotion()||isSafariWithoutDeviceMotion(),this.filterToWorldQ=new THREE__namespace.Quaternion,isIOS()?this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new THREE__namespace.Quaternion,this.worldToScreenQ=new THREE__namespace.Quaternion,this.originalPoseAdjustQ=new THREE__namespace.Quaternion;var s=typeof window!="undefined"?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),s),this.setScreenTransform_(),isLandscapeMode()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new THREE__namespace.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return n.prototype.getPosition=function(){return null},n.prototype.getOrientation=function(){var t;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||function(){var o=new THREE__namespace.Quaternion().setFromAxisAngle(new THREE__namespace.Vector3(0,0,-1),0),s=new THREE__namespace.Quaternion;return typeof window!="undefined"&&window.orientation===-90?s.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/-2):s.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/2),o.multiply(s)}(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||function(){var o=new THREE__namespace.Quaternion;return o.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),o}(),t=this._deviceOrientationQ;var e=new THREE__namespace.Quaternion;return e.copy(t),e.multiply(this.deviceOrientationFilterToWorldQ),e.multiply(this.resetQ),e.multiply(this.worldToScreenQ),e.multiplyQuaternions(this.deviceOrientationFixQ,e),this.yawOnly&&(e.x=0,e.z=0,e.normalize()),this.orientationOut_[0]=e.x,this.orientationOut_[1]=e.y,this.orientationOut_[2]=e.z,this.orientationOut_[3]=e.w,this.orientationOut_}else{var r=this.filter.getOrientation();t=this.posePredictor.getPrediction(r,this.gyroscope,this.previousTimestampS)}var i=new THREE__namespace.Quaternion;return i.copy(this.filterToWorldQ),i.multiply(this.resetQ),i.multiply(t),i.multiply(this.worldToScreenQ),this.yawOnly&&(i.x=0,i.z=0,i.normalize()),this.orientationOut_[0]=i.x,this.orientationOut_[1]=i.y,this.orientationOut_[2]=i.z,this.orientationOut_[3]=i.w,this.orientationOut_},n.prototype.getPose=function(){var t=new Pose;return t.orientation=this.getOrientation(),t},n.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),isLandscapeMode()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},n.prototype.getFrameData=function(t){var e=this.getOrientation(),r=this.getEyeOffset(),i=this.getEyeProjectionMatrix();return t.pose.angularAcceleration=null,t.pose.angularVelocity=null,t.pose.linearAcceleration=null,t.pose.linearVelocity=null,t.pose.orientation=e,t.pose.position=null,t.timestamp=this.previousTimestampS,t.leftProjectionMatrix.set(i.left),t.rightProjectionMatrix.set(i.right),updateEyeViewMatrices(t.leftViewMatrix,e,r.left),updateEyeViewMatrices(t.rightViewMatrix,e,r.right),t},n.prototype.start=function(){if(typeof window=="undefined")return function(){};var t=this.onDeviceMotion_.bind(this),e=this.onOrientationChange_.bind(this),r=this.onMessage_.bind(this),i=this.onDeviceOrientation_.bind(this);return isIOS()&&isInsideCrossOriginIFrame()&&window.addEventListener("message",r),window.addEventListener("orientationchange",e),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",i):window.addEventListener("devicemotion",t),function(){window.removeEventListener("devicemotion",t),window.removeEventListener("deviceorientation",e),window.removeEventListener("orientationchange",e),window.removeEventListener("message",r)}},n.prototype.getEyeOffset=function(){return{left:[-this.viewer.interLensDistance*.5,0,0],right:[this.viewer.interLensDistance*.5,0,0]}},n.prototype.getEyeProjectionMatrix=function(){var t=this.getEyeFieldOfView(),e=this.depthNear,r=this.depthFar,i={left:[],right:[]};{var o=t.left.upDegrees*DEG_TO_RAD,s=t.left.downDegrees*DEG_TO_RAD,u=t.left.leftDegrees*DEG_TO_RAD,c=t.left.rightDegrees*DEG_TO_RAD,l=2/(u+c),d=2/(o+s);i.left[0]=l,i.left[1]=0,i.left[2]=0,i.left[3]=0,i.left[4]=0,i.left[5]=d,i.left[6]=0,i.left[7]=0,i.left[8]=-((u-c)*l*.5),i.left[9]=(o-s)*d*.5,i.left[10]=r/(e-r),i.left[11]=-1,i.left[12]=0,i.left[13]=0,i.left[14]=r*e/(e-r),i.left[15]=0}{var o=t.right.upDegrees*DEG_TO_RAD,s=t.right.downDegrees*DEG_TO_RAD,u=t.right.leftDegrees*DEG_TO_RAD,c=t.right.rightDegrees*DEG_TO_RAD,l=2/(u+c),d=2/(o+s);i.right[0]=l,i.right[1]=0,i.right[2]=0,i.right[3]=0,i.right[4]=0,i.right[5]=d,i.right[6]=0,i.right[7]=0,i.right[8]=-((u-c)*l*.5),i.right[9]=(o-s)*d*.5,i.right[10]=r/(e-r),i.right[11]=-1,i.right[12]=0,i.right[13]=0,i.right[14]=r*e/(e-r),i.right[15]=0}return i},n.prototype.getEyeFieldOfView=function(){var t=this.viewer,e=this.device,r=new Distortion(t.distortionCoefficients),i=t.screenLensDistance,o=(e.widthMeters-t.interLensDistance)/2,s=t.interLensDistance/2,u=t.baselineLensDistance-e.bevelMeters,c=e.heightMeters-u,l=RAD_TO_DEG*Math.atan(r.distort(o/i)),d=RAD_TO_DEG*Math.atan(r.distort(s/i)),f=RAD_TO_DEG*Math.atan(r.distort(u/i)),m=RAD_TO_DEG*Math.atan(r.distort(c/i)),A=new FieldOfView,h=new FieldOfView;return A.leftDegrees=Math.min(l,t.fov),A.rightDegrees=Math.min(d,t.fov),A.downDegrees=Math.min(f,t.fov),A.upDegrees=Math.min(m,t.fov),h.leftDegrees=A.rightDegrees,h.rightDegrees=A.leftDegrees,h.upDegrees=A.upDegrees,h.downDegrees=A.downDegrees,{left:A,right:h}},n.prototype.onDeviceOrientation_=function(t){this._deviceOrientationQ=this._deviceOrientationQ||new THREE__namespace.Quaternion;var e=t.alpha,r=t.beta,i=t.gamma;e=(e||0)*Math.PI/180,r=(r||0)*Math.PI/180,i=(i||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new THREE__namespace.Euler(e,r,-i,"YXZ"))},n.prototype.onDeviceMotion_=function(t){this.updateDeviceMotion_(t)},n.prototype.updateDeviceMotion_=function(t){var e=t.accelerationIncludingGravity,r=t.rotationRate,i=t.timeStamp/1e3,o=i-this.previousTimestampS;if(o<0){warnOnce("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),this.previousTimestampS=i;return}else if(o<=MIN_TIMESTEP||o>MAX_TIMESTEP){warnOnce("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),this.previousTimestampS=i;return}e&&(this.accelerometer.set(-e.x,-e.y,-e.z),r&&(isR7()?this.gyroscope.set(-r.beta,r.alpha,r.gamma):this.gyroscope.set(r.alpha,r.beta,r.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,i)),this.filter.addAccelMeasurement(this.accelerometer,i)),this.previousTimestampS=i},n.prototype.onOrientationChange_=function(){this.setScreenTransform_()},n.prototype.onMessage_=function(t){var e=t.data;if(!(!e||!e.type)){var r=e.type.toLowerCase();r==="devicemotion"&&this.updateDeviceMotion_(e.deviceMotionEvent)}},n.prototype.setScreenTransform_=function(){this.worldToScreenQ.set(0,0,0,1);var t=typeof window!="undefined"?window.orientation:0;switch(t){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),Math.PI/2);break}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},n}(),defaultLeftBounds=[0,0,.5,1],defaultRightBounds=[.5,0,.5,1],Cardboard=function(){function n(t){var e=this;this.renderer=t,this.sensor=new Sensor(.98,.04,!1,!1),this.scale=1,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera;var r=this.sensor.start();this.dispose=function(){var i=e.renderer.getSize(new THREE__namespace.Vector2);e.renderer.setScissor(0,0,i.width,i.height),e.renderer.setViewport(0,0,i.width,i.height),e.renderer.setScissorTest(!1),r()}}return n.prototype.render=function(t,e){var r=this.renderer.getSize(new THREE__namespace.Vector2);if(r.width>r.height){var i=t.autoUpdate;i&&(t.updateMatrixWorld(),t.autoUpdate=!1);var o={x:Math.round(r.width*defaultLeftBounds[0]),y:Math.round(r.height*defaultLeftBounds[1]),width:Math.round(r.width*defaultLeftBounds[2]),height:Math.round(r.height*defaultLeftBounds[3])},s={x:Math.round(r.width*defaultRightBounds[0]),y:Math.round(r.height*defaultRightBounds[1]),width:Math.round(r.width*defaultRightBounds[2]),height:Math.round(r.height*defaultRightBounds[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),e.parent===null&&e.updateMatrixWorld(),e.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),e.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var u=this.sensor.getEyeOffset();this.cameraL.translateOnAxis(new THREE__namespace.Vector3().fromArray(u.left),this.scale),this.cameraR.translateOnAxis(new THREE__namespace.Vector3().fromArray(u.right),this.scale);var c=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=c.left.slice(),this.cameraR.projectionMatrix.elements=c.right.slice(),this.renderer.setViewport(o.x,o.y,o.width,o.height),this.renderer.setScissor(o.x,o.y,o.width,o.height),this.renderer.render(t,this.cameraL),this.renderer.setViewport(s.x,s.y,s.width,s.height),this.renderer.setScissor(s.x,s.y,s.width,s.height),this.renderer.render(t,this.cameraR),this.renderer.setViewport(0,0,r.width,r.height),this.renderer.setScissor(0,0,r.width,r.height),this.renderer.setScissorTest(!1),i&&(t.autoUpdate=!0)}else this.renderer.render(t,e)},n.prototype.dispose=function(){},n}();const cardboard="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADqCAMAAAAvZYhaA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dL94y7VqSoKFhWiMDXnUBaHBwoQT9Prx4Szm3TyRodLupoMJHH5LyK+9es8+l/CKvDytukQQND8FSlFIOreGM0/omiATVapVo12xd0jhExKW5294RAc40RVoftY47cd2LKtMOFwkajzuAeVOlIhfJeKahLyiWJRhLr3Ai2BVzQYKG4lLYXfg8HCSI33a2nTH5OaVWmzYHJGhsdLmDuN2exAonBTzZIuzEUS+ec0ZMBQn+Ea5KlXNI4C/UAO/k6hKwBptJgn8fgmVckgFXML9YEEFLUKMvlqAp0eWyDEAL65dLqyWo6RekTZ2XNCsD6rgpTK/4p3WcrrPH1ghWJGhONC3JoGAkRHH1JKjpNEcCxOV2I8MWyiUJqNVajSVodgiWcVMVLVeSS1ATCZoc88qjVKlSc3kSLJ5c5V6rTZQAcVkGbBeuOkgCgq2CBM3MoFwGr1tvim2aMpZZqyBBc3N1UF2GX90j9SQJKCBB83OfYAcNVjFcSrvzo95WOShB83Ody5V24fqzO0nAUSzB/89Nph38VqmuOa3gticJOP9fApuHTDt4nFJ7AXdPC0lg8/gq8y5XapSrgpUgbQ0JpF5u97hS1fOC26nlJJA8Yd41Sg3fU4dtRQkKeXSN3jo4Qqm0397OmyZOGatoDrScBIWM3DFn5kXi1ZyqRSUoZtKOa1vWKArztqgEnhIHty4f9/btuEstKwGkxf+XuCT5CbTFnFRuxktuAAAAAElFTkSuQmCC";var _a,LOCALE={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},TEXT=typeof navigator!="undefined"&&(_a=LOCALE[navigator.language.split("-")[0]])!==null&&_a!==void 0?_a:LOCALE.zh,CONTENTS=`
1489
1489
  <style>
1490
1490
  .$id {
1491
1491
  all: initial;
@@ -1846,7 +1846,7 @@ void main() {
1846
1846
 
1847
1847
  gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity * outside * inside);
1848
1848
  }
1849
- `,PanoSphereMesh=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.progress=0,e.opacity=0,e.loading=!1,e.current=!1,e.disabled=!1,e.currentMotion=new Motion({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),e.opacityMotion=new Motion({opacity:0}),e.loadingMotion=new Motion({opacity:0}),e.disableMotion=new Motion({opacity:0});var r={blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return e.hitTestMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.MeshBasicMaterial(__assign(__assign({},r),{color:0,opacity:0}))),e.hitTestMesh.scale.set(1.5,1.5,1.5),e.ringMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader:ringVertexShader,fragmentShader:ringFragmentShader,uniforms:{opacity:{value:0}}}))),e.panoMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader,fragmentShader,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),e.add(e.hitTestMesh),e.add(e.ringMesh),e.add(e.panoMesh),e.renderOrder=1e4,e.needsRender=!0,e}return t.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},30).catch(noop$1))},t.prototype.setCurrent=function(e){if(this.current!==e){if(e){var r=[{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}];this.currentMotion.setKeyframes(r,1500).catch(noop$1)}else{var r=[{progress:0,value:__assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(r,200).catch(noop$1)}this.current=e}},t.prototype.setLoading=function(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(noop$1):this.loadingMotion.set({opacity:0},0).catch(noop$1),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(noop$1),this.needsRender=!0)},t.prototype.tap=function(){return Promise.resolve()},t.prototype.updateTime=function(e,r){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var i=this.opacityMotion.value.opacity;this.visible=i!==0;var o=this.currentMotion.value,s=o.ringScale,u=o.ringOpacity,c=o.circleFade,l=o.circleOpacity,d=o.circleScale;this.ringMesh.scale.set(s,1,s),this.ringMesh.material.uniforms.opacity.value=u*i,this.panoMesh.material.uniforms.opacity.value=i,this.panoMesh.material.uniforms.circleOpacity.value=l,this.panoMesh.material.uniforms.circleScale.value=d,this.panoMesh.material.uniforms.circleFade.value=c,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0},t.prototype.dispose=function(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()},t}(THREE__namespace.Object3D),ACTIVE_TO_CURRENT_DELAY=1500,VRPanoramaController=function(n){__extends(t,n);function t(e){var r=this,i=t.parseArgs(e);r=n.call(this,i)||this,r.mode="VRPanorama",r.cardboard=new Cardboard(r.renderer);var o=createHelper();r.helperElement=o;var s=new Hammer(o);return r.element.parentNode&&(r.element.parentNode.insertBefore(o,r.element),r.setHelperElementSize(),s.on("tap",function(){return r.emit("vr.requestExit",createEvent("vr.requestExit",{}))})),r.destroyHelper=function(){s.destroy(),o.parentNode&&o.parentNode.removeChild(o),delete r.helperElement},r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),i=n.initAnimationEndState.call(this,r);return __assign(__assign({},i),{mode:"VRPanorama"})},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper();for(var e=Object.keys(this.panoMeshes),r=0,i=e;r<i.length;r++){var o=i[r],s=this.panoMeshes[o];this.helper.remove(s),s.dispose(),delete this.panoMeshes[o]}},t.prototype.isReady=function(){return!1},t.prototype.updateRenderSize=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.setHelperElementSize()},t.prototype.updateCamera=function(e,r,i){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,i){return Promise.resolve()},t.prototype.updatePanoMeshesVisible=function(){for(var e=this.works.getResolvedObserver(this.currentPano),r=(e?e.visibleIds:[]).concat(panoStringify(this.currentPano)),i=0,o=this.works.resolvedObservers;i<o.length;i++){var s=o[i],u=this.panoMeshes[s.panoId];u&&(r.indexOf(s.panoId)>=0?u.parent!==this.helper&&this.helper.add(u):u.parent===this.helper&&(this.helper.remove(u),u.setOpacity(0)))}},t.prototype.updatePanoMeshes=function(){for(var e=Object.keys(this.panoMeshes),r=0,i=e;r<i.length;r++){var o=i[r],s=this.panoMeshes[o];this.helper.remove(s),s.dispose(),delete this.panoMeshes[o]}for(var u=0,c=this.works.resolvedObservers;u<c.length;u++){var l=c[u],d=l.panoId,f=new PanoSphereMesh;f.name="panoSphere_".concat(d),f.position.copy(l.position),f.needsRender=!0,this.panoMeshes[d]=f}this.updatePanoMeshesVisible()},t.prototype.updateTime=function(e,r){var i=this,o,s,u,c,l,d,f,m,A,h;if(!this.destroyed){var p=this.currentPano;this.userAction=!0,this.needsRender=!0,this.modelSceneNeedsRender=!0;var y={},v={},g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),E=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),b=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),y.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var T=this.locationMotion.getKeyFrameSegment(e),x=T[0],R=T[1],_=this.panoResourceFromLocationMotionKeyframe(x),M=this.panoResourceFromLocationMotionKeyframe(R),S=_.position,I=M.position,C=this.locationMotion.value.count-R.value.count+1;y.progress=C,M.panoPicture&&(C<1?_.panoPicture&&(y.pano0=_.panoPicture):y.pano0=M.panoPicture,y.pano1=M.panoPicture),M.effect==="montage"?y.transition="BLACK":M.effect==="spread"?y.transition="SPREAD":y.transition="FADE",(M.effect==="zoomin"||M.effect==="zoomout")&&(y.progress=Math.pow(C,3)),C<1&&M.effect!=="fly"&&(y.pano0&&_.panoPicture&&(y.pano0={map:y.pano0.map,zoom:y.pano0.zoom,luminanceMap:y.pano0.luminanceMap,matrix:_.panoPicture.matrix.clone().premultiply(_.fixCameraTransform).setPosition(M.position)}),S.copy(I),b=!0),v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(S.x+(I.x-S.x)*C,S.y+(I.y-S.y)*C,S.z+(I.z-S.z)*C);for(var H=[],B=[],L=0,O=this.locationMotion.keyframes;L<O.length;L++){var k=O[L],G=k.key,z=k.progress;G!==void 0&&(H.push(G),z>this.locationMotion.progress&&B.push(G))}for(var D=0,U=Object.keys(this.panoResources);D<U.length;D++){var K=U[D];if(!(B.indexOf(K)>=0)){var Q=this.panoResources[K];if(Q.panoPicture){var q=Q.panoPicture.map,J=Q.panoPicture.luminanceMap;if(q){if(q===((o=y.pano0)===null||o===void 0?void 0:o.map)||q===((s=y.pano1)===null||s===void 0?void 0:s.map))continue;q instanceof TileCubeTextureTarget&&q.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(q.cubeRenderTarget),q.dispose(),J&&(J instanceof TileCubeTextureTarget&&J.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(J.cubeRenderTarget),J.dispose()),Q.panoPicture=null}}H.indexOf(K)>=0||delete this.panoResources[K]}}this.currentPano=panoParse(M.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(g.panoId),state:__assign(__assign(__assign(__assign({},panoParse(E.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),v),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(y)===!1&&(!((u=y.pano0)===null||u===void 0)&&u.map&&y.pano0.map instanceof TileCubeTextureTarget&&!y.pano0.map.cubeRenderTarget&&(y.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=y.pano0)===null||c===void 0)&&c.luminanceMap&&y.pano0.luminanceMap instanceof TileCubeTextureTarget&&!y.pano0.luminanceMap.cubeRenderTarget&&(y.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),!((l=y.pano1)===null||l===void 0)&&l.map&&y.pano1.map instanceof TileCubeTextureTarget&&!y.pano1.map.cubeRenderTarget&&(y.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((d=y.pano1)===null||d===void 0)&&d.luminanceMap&&y.pano1.luminanceMap instanceof TileCubeTextureTarget&&!y.pano1.luminanceMap.cubeRenderTarget&&(y.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.models.setMaterial(y)),v.offset&&this.camera.position.copy(v.offset),panoEqual(this.currentPano,p)&&this.updatePanoMeshesVisible();var W=this.camera.pose.longitude,re=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose();var j=this.works.getResolvedObserver(this.currentPano);if(this.camera.pose.distance>.1||b)for(var te=0,$=Object.keys(this.panoMeshes);te<$.length;te++){var ne=$[te],ee=this.panoMeshes[ne];ee.setOpacity(0),ee.updateTime&&ee.updateTime(e,r),ee.visible=!1}else if(j)for(var fe=j.visibleIds.concat(panoStringify(this.currentPano)),ie=0,se=fe;ie<se.length;ie++){var ne=se[ie],Ae=panoParse(ne),he=this.works.getResolvedObserver(Ae);if(he){var ee=this.panoMeshes[ne];if(!he.loadable&&!he.active){ee.setOpacity(0);continue}var me=ee.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);me<.05?ee.setOpacity(0):ee.setOpacity(clamp$1(1.5/me,0,1)),panoEqual(this.currentPano,Ae)&&ee.setOpacity(0),ee.lookAt(this.camera.position)}}if(this.locationMotion.ended)for(var Z=this.intersect(e),Y=0,N=this.works.resolvedObservers;Y<N.length;Y++){var he=N[Y],ee=this.panoMeshes[he.panoId];ee&&(ee.setCurrent(ee===Z),ee.updateTime&&ee.updateTime(e,r))}(W!==this.camera.pose.longitude||re!==this.camera.pose.latitude)&&(this.cameraMotion.set(pick(this.camera.pose,["longitude","latitude"]),0).catch(noop$1),this.emit("camera.update",createEvent("camera.update",{userAction:!0,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))})));var Ee=this.tileLevel=function(){if(i.tileLevelForFov===!1)return 0;var ce=i.renderer.getDrawingBufferSize(new THREE__namespace.Vector2);ce.width*=i.scissor.width,ce.height*=i.scissor.height;var le=E.panoId,ue=i.works.getResolvedObserver(le),oe=i.imageOptions.size;if(typeof oe=="undefined"&&ue){var Te=ue.images.up.match(/\/cube_(\d+)\//);Te&&(oe=Number(Te[1]))}typeof oe=="undefined"&&(oe=2048);var Re=0;oe>=1024&&(Re=1),oe>=2048&&(Re=2),oe>=4096&&(Re=3),oe>=8192&&(Re=4);var Ie=i.tileLevelForFov(i.camera.fov,ce);return Ie>Re?Ie:0}(),ge=function(){var ce=i.camera.quaternion.clone(),le=i.works.getResolvedObserver(E.panoId),ue=le!=null?le:j;ue&&ce.premultiply(ue.quaternion.clone().inverse());var oe=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ce),Te=new THREE__namespace.Matrix4().getInverse(oe),Re=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(i.camera.projectionMatrix,Te));return Re}();E.panoId===panoStringify(this.currentPano)&&(((f=E.panoPicture)===null||f===void 0?void 0:f.map)instanceof TileCubeTextureTarget&&(E.panoPicture.map.maxRequest=this.tileMaxRequest,E.panoPicture.map.update(ge,Ee),E.panoPicture.map.needsRender===!0&&(E.panoPicture.map.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)),((m=E.panoPicture)===null||m===void 0?void 0:m.luminanceMap)instanceof TileCubeTextureTarget&&(E.panoPicture.luminanceMap.maxRequest=this.tileMaxRequest,E.panoPicture.luminanceMap.update(ge,Ee),E.panoPicture.luminanceMap.needsRender===!0&&(E.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)));{var ve=this.tiling.object.visible;if(this.initAnimationed){var xe=E.panoId,de=this.works.getResolvedObserver(xe);de?isSimilarVector3(this.camera.position,de.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==xe&&this.tiling.cleanup(),this.tiling.panoId=xe,this.tiling.setResource((h=(A=de.images)===null||A===void 0?void 0:A.tiles)!==null&&h!==void 0?h:[],this.enableIOSEDR&&de.images.luminance?de.images.luminance:null),this.tiling.setFetcher(getFetcher(de.work)),this.tiling.setRotation(de.quaternion),this.tiling.setPosition(de.position),this.tiling.maxRequest=this.tileMaxRequest,Ee>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(ge,Ee,e):this.tiling.update(ge,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;ve!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}},t.prototype.render=function(){this.cardboard.render(this.modelScene,this.camera),this.renderer.autoClear=!1,this.cardboard.render(this.scene,this.camera),this.renderer.autoClear=!0},t.prototype.setCamera=function(e){},t.prototype.destroyHelper=function(){},t.prototype.setHelperElementSize=function(){if(this.helperElement){var e=new THREE__namespace.Vector2(this.element.offsetWidth,this.element.offsetHeight),r=e.x*this.scissor.left,i=e.y*(1-this.scissor.bottom-this.scissor.height),o=e.x*this.scissor.width,s=e.y*this.scissor.height;this.helperElement.style.marginLeft=r+"px",this.helperElement.style.marginTop=i+"px",this.helperElement.style.width=o+"px",this.helperElement.style.height=s+"px"}},t.prototype.intersect=function(e){var r,i;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,delete this.activePanoMesh,delete this.activeTime;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>ACTIVE_TO_CURRENT_DELAY){for(var o=this.activePanoMesh,s=Object.keys(this.panoMeshes),u=null,c=0,l=s;c<l.length;c++){var d=l[c];if(this.panoMeshes[d]===o){u=d;break}}return u!==null&&this.moveToPano(panoParse(u),{},!0),delete this.activePanoMesh,delete this.activeTime,o}var f=this.camera.getDirection(new THREE__namespace.Vector3),m=new THREE__namespace.Raycaster(this.camera.position,f);m.params.Points={threshold:.1};for(var A=void 0,h=[],p=this.works.getResolvedObserver(this.currentPano),y=p?p.visibleIds:[],v=0,g=y;v<g.length;v++){var u=g[v],E=this.panoMeshes[u],b=m.intersectObject((r=E.hitTestMesh)!==null&&r!==void 0?r:E,!0)[0];b&&h.push({panoMesh:E,intersection:__assign({floor:(i=p==null?void 0:p.floorIndex)!==null&&i!==void 0?i:0},b)})}var T=h.sort(function(S,I){return S.intersection.distance-I.intersection.distance})[0];T?(A=T.intersection,this.activePanoMesh!==T.panoMesh&&(this.activePanoMesh=T.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(T.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),A||(A=this.models.intersectRaycaster(m)[0]);var x=createEvent("intersect.update",{raycaster:m,intersection:A!=null?A:null,object:this.intersectMesh});if(this.emit("intersect.update",x),x.defaultPrevented){this.hideIntersectMesh();return}if(A&&A.face){var R=A.face.normal,_=new THREE__namespace.Quaternion;_.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),R),this.intersectMesh.quaternion.copy(_);var M=A.point.clone();this.intersectMesh.position.copy(M),T?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return T==null?void 0:T.panoMesh},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t}(PanoramaController),HUMAN_EYE_POSITION=new THREE__namespace.Vector3(0,1.6,0),ModelController=function(n){__extends(t,n);function t(e){var r=this,i,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Model",r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(i=r.models.getMaterial().modelAlpha)!==null&&i!==void 0?i:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r}return t.parseArgs=function(e){return e instanceof t?e:n.parseArgs.call(this,e)},t.initAnimationEndState=function(e){var r,i,o,s,u,c,l=this.parseArgs(e),d=l.works,f=e.initial,m=f.state,A=f.currentState,h=typeof m.panoIndex=="number"?{workCode:(o=(r=m.workCode)!==null&&r!==void 0?r:(i=l.works[0])===null||i===void 0?void 0:i.workCode)!==null&&o!==void 0?o:"",panoIndex:m.panoIndex}:{workCode:A.workCode,panoIndex:A.panoIndex},p=d.getResolvedObserver(h),y=(s=m.longitude)!==null&&s!==void 0?s:A.longitude,v=clamp$1((u=m.latitude)!==null&&u!==void 0?u:!p||isFristPersonMode(A.mode)?A.latitude:l.defaultLatitude,l.minLatitude,l.maxLatitude),g=clamp$1((c=m.fov)!==null&&c!==void 0?c:!p||isFristPersonMode(A.mode)?A.fov:l.defaultFov,l.minFov,l.maxFov),E=new THREE__namespace.Vector3;if(l.initial.state.offset)E.copy(l.initial.state.offset);else if(p)E.copy(p.position);else{var b=coordinatesToVector(A).setLength(A.distance);E.copy(l.initial.currentState.offset).sub(b)}return{workCode:h.workCode,panoIndex:h.panoIndex,mode:"Model",longitude:y,latitude:v,fov:g,offset:E,distance:0}},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended!==!1},t.prototype.updateWork=function(e,r,i,o){this.works=e;var s=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:i.duration,effect:i.effect,state:r,userAction:o}}));return this.hideIntersectMesh(),this.moveToPosition(s.offset,{duration:0,longitude:s.longitude,latitude:s.latitude,fov:s.fov},o),!0},t.prototype.updateCamera=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();var s={},u={};return s.distance=0,e.offset!==void 0&&(s.x=e.offset.x,s.y=e.offset.y,s.z=e.offset.z),e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),o.locationMotion.set(s,r).catch(noop$1),o.cameraMotion.set(u,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();for(var s=[],u=[],c=0,l=e;c<l.length;c++){var d=l[c];s.push({key:d.key,progress:d.progress,value:{distance:0,x:d.value.offset.x,y:d.value.offset.x,z:d.value.offset.x}}),u.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return o.locationMotion.setKeyframes(s,r).catch(noop$1),o.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var i={},o={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),i.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),o.distance=this.locationMotion.value.distance,o.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);var s=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),u=this.works.resolvedObservers,c=arrayMin(u,function(l){return l.position.distanceTo(s)});this.currentPano=c?{workCode:c.work.workCode,panoIndex:c.panoIndex}:{workCode:"",panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov),isEmptyObject(i)||this.models.setMaterial(i),isEmptyObject(o)||this.setCamera(o)}},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var i=e.initial;i.state,i.currentState;var o=i.duration,s=i.userAction;e.userAction=s;var u=t.initAnimationEndState(e),c={modelAlpha:1},l={perspToOrtho:0},d={longitude:u.longitude,latitude:u.latitude,fov:u.fov,duration:o,moveStartCallback:function(f){e.perspToOrthoMotion.set(l,o).catch(noop$1),e.modelAlphaMotion.set(c,o).catch(noop$1),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:f,userAction:e.userAction}))},moveEndCallback:function(f){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:f,userAction:e.userAction})),r()},moveCancelCallback:function(){var f=e.currentPano,m=__assign(__assign({},f),{mode:e.mode,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance});e.emit("initAnimation.end",createEvent("initAnimation.end",{state:m,userAction:e.userAction})),r()}};e.moveToPosition(u.offset,d,s)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},t.prototype.moveToPano=function(e,r,i){r===void 0&&(r={});var o=this.works.getResolvedObserver(e);o&&this.moveToPosition(o.position,r,i)},t.prototype.moveToPosition=function(e,r,i){var o=this,s,u,c;r===void 0&&(r={}),this.userAction=i,this.stopMomentumMovement();for(var l=now(),d=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),f=d.distanceTo(e),m=this.locationMotion.getProgressVelocity(l),A=0,h=1;h<this.locationMotion.keyframes.length;h++){var p=this.locationMotion.keyframes[h-1].value,y=p.x,v=p.y,g=p.z,E=this.locationMotion.keyframes[h].value,b=E.x,T=E.y,x=E.z;A+=Math.sqrt(Math.pow(b-y,2)+Math.pow(T-v,2)+Math.pow(x-g,2))}var R=f===0?0:m*A/f,_=this.calculateMovingDuration(r.duration,f),M={x:e.x,y:e.y,z:e.z,distance:0},S={longitude:r.longitude,latitude:r.latitude,fov:r.fov},I=this.works.resolvedObservers,C=arrayMin(I,function(O){return O.position.distanceTo(d)}),H=C?{workCode:C.work.workCode,panoIndex:C.panoIndex}:{workCode:"",panoIndex:0},B=__assign(__assign({},H),{mode:this.mode,longitude:(s=S.longitude)!==null&&s!==void 0?s:this.camera.pose.longitude,latitude:(u=S.latitude)!==null&&u!==void 0?u:this.camera.pose.latitude,fov:(c=S.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:e.clone(),distance:0}),L=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:L,progress:0,state:B,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(B),this.cameraMotion.set(S,_).catch(noop$1),this.locationMotion.set(M,_,R).then(function(){for(var O=0,k=o.models;O<k.length;O++){var G=k[O];G.show()}var z=__assign(__assign(__assign({},H),{mode:o.mode}),clonePose(o.camera.pose));o.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:L,progress:0,state:z,userAction:o.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(z)},function(){r.moveCancelCallback&&r.moveCancelCallback(),o.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:L,progress:0,state:B,userAction:o.userAction,error:null}))})},t.prototype.onTapGesture=function(e){var r=e.center.raycaster;this.stopMomentumMovement();var i=this.models.intersectRaycaster(r)[0];if(i&&i.face){var o=i.face.normal,s=i.point;if(new THREE__namespace.Vector3(0,1,0).angleTo(o)>Math.PI/3){var u=o.clone().setLength(.3).add(s);r.set(u,new THREE__namespace.Vector3(0,-1,0)),i=this.models.intersectRaycaster(r)[0]}}if(i){var c=new THREE__namespace.Vector3().copy(i.point).add(HUMAN_EYE_POSITION),l=this.works.resolvedObservers,d=arrayMin(l,function(A){return A.position.distanceTo(c)},!0),f=d[0],m=d[1];f&&m<5&&(c.y=f.position.y),e.state.offset.copy(c),e.state.distance=0,this.emit("gesture.tap",e),e.defaultPrevented||this.moveToPosition(c,{},!0)}else this.emit("gesture.tap",e),e.defaultPrevented||this.cameraBounce()},t}(PanoramaLikeController);const edlVertexShader=function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}(`}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{Hnvor-rp@-}|vv|{Hnvor-rp?-H{vs|z-znA-}|wrpv|{Znv\x07H{vs|z-znA-z|qrycvrZnv\x07Hn\bv{t-rp?-bH|vq-znv{56-
1849
+ `,PanoSphereMesh=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.progress=0,e.opacity=0,e.loading=!1,e.current=!1,e.disabled=!1,e.currentMotion=new Motion({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),e.opacityMotion=new Motion({opacity:0}),e.loadingMotion=new Motion({opacity:0}),e.disableMotion=new Motion({opacity:0});var r={blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return e.hitTestMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.MeshBasicMaterial(__assign(__assign({},r),{color:0,opacity:0}))),e.hitTestMesh.scale.set(1.5,1.5,1.5),e.ringMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader:ringVertexShader,fragmentShader:ringFragmentShader,uniforms:{opacity:{value:0}}}))),e.panoMesh=new THREE__namespace.Mesh(sharedGeometry,new THREE__namespace.ShaderMaterial(__assign(__assign({},r),{vertexShader,fragmentShader,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),e.add(e.hitTestMesh),e.add(e.ringMesh),e.add(e.panoMesh),e.renderOrder=1e4,e.needsRender=!0,e}return t.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp$1(e,0,1),this.opacityMotion.set({opacity:e},30).catch(noop$1))},t.prototype.setCurrent=function(e){if(this.current!==e){if(e){var r=[{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}];this.currentMotion.setKeyframes(r,1500).catch(noop$1)}else{var r=[{progress:0,value:__assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(r,200).catch(noop$1)}this.current=e}},t.prototype.setLoading=function(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(noop$1):this.loadingMotion.set({opacity:0},0).catch(noop$1),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(noop$1),this.needsRender=!0)},t.prototype.tap=function(){return Promise.resolve()},t.prototype.updateTime=function(e,r){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var i=this.opacityMotion.value.opacity;this.visible=i!==0;var o=this.currentMotion.value,s=o.ringScale,u=o.ringOpacity,c=o.circleFade,l=o.circleOpacity,d=o.circleScale;this.ringMesh.scale.set(s,1,s),this.ringMesh.material.uniforms.opacity.value=u*i,this.panoMesh.material.uniforms.opacity.value=i,this.panoMesh.material.uniforms.circleOpacity.value=l,this.panoMesh.material.uniforms.circleScale.value=d,this.panoMesh.material.uniforms.circleFade.value=c,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0},t.prototype.dispose=function(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()},t}(THREE__namespace.Object3D),ACTIVE_TO_CURRENT_DELAY=1500,VRPanoramaController=function(n){__extends(t,n);function t(e){var r=this,i=t.parseArgs(e);r=n.call(this,i)||this,r.mode="VRPanorama",r.cardboard=new Cardboard(r.renderer);var o=createHelper();r.helperElement=o;var s=new Hammer(o);return r.element.parentNode&&(r.element.parentNode.insertBefore(o,r.element),r.setHelperElementSize(),s.on("tap",function(){return r.emit("vr.requestExit",createEvent("vr.requestExit",{}))})),r.destroyHelper=function(){s.destroy(),o.parentNode&&o.parentNode.removeChild(o),delete r.helperElement},r}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),i=n.initAnimationEndState.call(this,r);return __assign(__assign({},i),{mode:"VRPanorama"})},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper();for(var e=Object.keys(this.panoMeshes),r=0,i=e;r<i.length;r++){var o=i[r],s=this.panoMeshes[o];this.helper.remove(s),s.dispose(),delete this.panoMeshes[o]}},t.prototype.isReady=function(){return!1},t.prototype.updateRenderSize=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.setHelperElementSize()},t.prototype.updateCamera=function(e,r,i){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,i){return Promise.resolve()},t.prototype.updatePanoMeshesVisible=function(){for(var e=this.works.getResolvedObserver(this.currentPano),r=(e?e.visibleIds:[]).concat(panoStringify(this.currentPano)),i=0,o=this.works.resolvedObservers;i<o.length;i++){var s=o[i],u=this.panoMeshes[s.panoId];u&&(r.indexOf(s.panoId)>=0?u.parent!==this.helper&&this.helper.add(u):u.parent===this.helper&&(this.helper.remove(u),u.setOpacity(0)))}},t.prototype.updatePanoMeshes=function(){for(var e=Object.keys(this.panoMeshes),r=0,i=e;r<i.length;r++){var o=i[r],s=this.panoMeshes[o];this.helper.remove(s),s.dispose(),delete this.panoMeshes[o]}for(var u=0,c=this.works.resolvedObservers;u<c.length;u++){var l=c[u],d=l.panoId,f=new PanoSphereMesh;f.name="panoSphere_".concat(d),f.position.copy(l.position),f.needsRender=!0,this.panoMeshes[d]=f}this.updatePanoMeshesVisible()},t.prototype.updateTime=function(e,r){var i=this,o,s,u,c,l,d,f,m,A,h;if(!this.destroyed){var p=this.currentPano;this.userAction=!0,this.needsRender=!0,this.modelSceneNeedsRender=!0;var y={},v={},g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),E=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),b=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),y.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var T=this.locationMotion.getKeyFrameSegment(e),x=T[0],R=T[1],_=this.panoResourceFromLocationMotionKeyframe(x),M=this.panoResourceFromLocationMotionKeyframe(R),S=_.position,I=M.position,C=this.locationMotion.value.count-R.value.count+1;y.progress=C,M.panoPicture&&(C<1?_.panoPicture&&(y.pano0=_.panoPicture):y.pano0=M.panoPicture,y.pano1=M.panoPicture),M.effect==="montage"?y.transition="BLACK":M.effect==="spread"?y.transition="SPREAD":y.transition="FADE",(M.effect==="zoomin"||M.effect==="zoomout")&&(y.progress=Math.pow(C,3)),C<1&&M.effect!=="fly"&&(y.pano0&&_.panoPicture&&(y.pano0={map:y.pano0.map,zoom:y.pano0.zoom,luminanceMap:y.pano0.luminanceMap,matrix:_.panoPicture.matrix.clone().premultiply(_.fixCameraTransform).setPosition(M.position)}),S.copy(I),b=!0),v.distance=this.locationMotion.value.distance,v.offset=new THREE__namespace.Vector3(S.x+(I.x-S.x)*C,S.y+(I.y-S.y)*C,S.z+(I.z-S.z)*C);for(var H=[],B=[],L=0,O=this.locationMotion.keyframes;L<O.length;L++){var k=O[L],G=k.key,z=k.progress;G!==void 0&&(H.push(G),z>this.locationMotion.progress&&B.push(G))}for(var D=0,U=Object.keys(this.panoResources);D<U.length;D++){var K=U[D];if(!(B.indexOf(K)>=0)){var Q=this.panoResources[K];if(Q.panoPicture){var q=Q.panoPicture.map,J=Q.panoPicture.luminanceMap;if(q){if(q===((o=y.pano0)===null||o===void 0?void 0:o.map)||q===((s=y.pano1)===null||s===void 0?void 0:s.map))continue;q instanceof TileCubeTextureTarget&&q.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(q.cubeRenderTarget),q.dispose(),J&&(J instanceof TileCubeTextureTarget&&J.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(J.cubeRenderTarget),J.dispose()),Q.panoPicture=null}}H.indexOf(K)>=0||delete this.panoResources[K]}}this.currentPano=panoParse(M.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(g.panoId),state:__assign(__assign(__assign(__assign({},panoParse(E.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),v),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(y)===!1&&(!((u=y.pano0)===null||u===void 0)&&u.map&&y.pano0.map instanceof TileCubeTextureTarget&&!y.pano0.map.cubeRenderTarget&&(y.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=y.pano0)===null||c===void 0)&&c.luminanceMap&&y.pano0.luminanceMap instanceof TileCubeTextureTarget&&!y.pano0.luminanceMap.cubeRenderTarget&&(y.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),!((l=y.pano1)===null||l===void 0)&&l.map&&y.pano1.map instanceof TileCubeTextureTarget&&!y.pano1.map.cubeRenderTarget&&(y.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((d=y.pano1)===null||d===void 0)&&d.luminanceMap&&y.pano1.luminanceMap instanceof TileCubeTextureTarget&&!y.pano1.luminanceMap.cubeRenderTarget&&(y.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.models.setMaterial(y)),v.offset&&this.camera.position.copy(v.offset),panoEqual(this.currentPano,p)&&this.updatePanoMeshesVisible();var j=this.camera.pose.longitude,re=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose();var W=this.works.getResolvedObserver(this.currentPano);if(this.camera.pose.distance>.1||b)for(var te=0,$=Object.keys(this.panoMeshes);te<$.length;te++){var ne=$[te],ee=this.panoMeshes[ne];ee.setOpacity(0),ee.updateTime&&ee.updateTime(e,r),ee.visible=!1}else if(W)for(var fe=W.visibleIds.concat(panoStringify(this.currentPano)),ie=0,se=fe;ie<se.length;ie++){var ne=se[ie],Ae=panoParse(ne),he=this.works.getResolvedObserver(Ae);if(he){var ee=this.panoMeshes[ne];if(!he.loadable&&!he.active){ee.setOpacity(0);continue}var me=ee.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);me<.05?ee.setOpacity(0):ee.setOpacity(clamp$1(1.5/me,0,1)),panoEqual(this.currentPano,Ae)&&ee.setOpacity(0),ee.lookAt(this.camera.position)}}if(this.locationMotion.ended)for(var Z=this.intersect(e),Y=0,N=this.works.resolvedObservers;Y<N.length;Y++){var he=N[Y],ee=this.panoMeshes[he.panoId];ee&&(ee.setCurrent(ee===Z),ee.updateTime&&ee.updateTime(e,r))}(j!==this.camera.pose.longitude||re!==this.camera.pose.latitude)&&(this.cameraMotion.set(pick(this.camera.pose,["longitude","latitude"]),0).catch(noop$1),this.emit("camera.update",createEvent("camera.update",{userAction:!0,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))})));var Ee=this.tileLevel=function(){if(i.tileLevelForFov===!1)return 0;var ce=i.renderer.getDrawingBufferSize(new THREE__namespace.Vector2);ce.width*=i.scissor.width,ce.height*=i.scissor.height;var le=E.panoId,ue=i.works.getResolvedObserver(le),oe=i.imageOptions.size;if(typeof oe=="undefined"&&ue){var Te=ue.images.up.match(/\/cube_(\d+)\//);Te&&(oe=Number(Te[1]))}typeof oe=="undefined"&&(oe=2048);var Re=0;oe>=1024&&(Re=1),oe>=2048&&(Re=2),oe>=4096&&(Re=3),oe>=8192&&(Re=4);var Ie=i.tileLevelForFov(i.camera.fov,ce);return Ie>Re?Ie:0}(),ge=function(){var ce=i.camera.quaternion.clone(),le=i.works.getResolvedObserver(E.panoId),ue=le!=null?le:W;ue&&ce.premultiply(ue.quaternion.clone().inverse());var oe=new THREE__namespace.Matrix4().makeRotationFromQuaternion(ce),Te=new THREE__namespace.Matrix4().getInverse(oe),Re=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(i.camera.projectionMatrix,Te));return Re}();E.panoId===panoStringify(this.currentPano)&&(((f=E.panoPicture)===null||f===void 0?void 0:f.map)instanceof TileCubeTextureTarget&&(E.panoPicture.map.maxRequest=this.tileMaxRequest,E.panoPicture.map.update(ge,Ee),E.panoPicture.map.needsRender===!0&&(E.panoPicture.map.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)),((m=E.panoPicture)===null||m===void 0?void 0:m.luminanceMap)instanceof TileCubeTextureTarget&&(E.panoPicture.luminanceMap.maxRequest=this.tileMaxRequest,E.panoPicture.luminanceMap.update(ge,Ee),E.panoPicture.luminanceMap.needsRender===!0&&(E.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0)));{var ve=this.tiling.object.visible;if(this.initAnimationed){var xe=E.panoId,de=this.works.getResolvedObserver(xe);de?isSimilarVector3(this.camera.position,de.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==xe&&this.tiling.cleanup(),this.tiling.panoId=xe,this.tiling.setResource((h=(A=de.images)===null||A===void 0?void 0:A.tiles)!==null&&h!==void 0?h:[],this.enableIOSEDR&&de.images.luminance?de.images.luminance:null),this.tiling.setFetcher(getFetcher(de.work)),this.tiling.setRotation(de.quaternion),this.tiling.setPosition(de.position),this.tiling.maxRequest=this.tileMaxRequest,Ee>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(ge,Ee,e):this.tiling.update(ge,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;ve!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}},t.prototype.render=function(){this.cardboard.render(this.modelScene,this.camera),this.renderer.autoClear=!1,this.cardboard.render(this.scene,this.camera),this.renderer.autoClear=!0},t.prototype.setCamera=function(e){},t.prototype.destroyHelper=function(){},t.prototype.setHelperElementSize=function(){if(this.helperElement){var e=new THREE__namespace.Vector2(this.element.offsetWidth,this.element.offsetHeight),r=e.x*this.scissor.left,i=e.y*(1-this.scissor.bottom-this.scissor.height),o=e.x*this.scissor.width,s=e.y*this.scissor.height;this.helperElement.style.marginLeft=r+"px",this.helperElement.style.marginTop=i+"px",this.helperElement.style.width=o+"px",this.helperElement.style.height=s+"px"}},t.prototype.intersect=function(e){var r,i;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,delete this.activePanoMesh,delete this.activeTime;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>ACTIVE_TO_CURRENT_DELAY){for(var o=this.activePanoMesh,s=Object.keys(this.panoMeshes),u=null,c=0,l=s;c<l.length;c++){var d=l[c];if(this.panoMeshes[d]===o){u=d;break}}return u!==null&&this.moveToPano(panoParse(u),{},!0),delete this.activePanoMesh,delete this.activeTime,o}var f=this.camera.getDirection(new THREE__namespace.Vector3),m=new THREE__namespace.Raycaster(this.camera.position,f);m.params.Points={threshold:.1};for(var A=void 0,h=[],p=this.works.getResolvedObserver(this.currentPano),y=p?p.visibleIds:[],v=0,g=y;v<g.length;v++){var u=g[v],E=this.panoMeshes[u],b=m.intersectObject((r=E.hitTestMesh)!==null&&r!==void 0?r:E,!0)[0];b&&h.push({panoMesh:E,intersection:__assign({floor:(i=p==null?void 0:p.floorIndex)!==null&&i!==void 0?i:0},b)})}var T=h.sort(function(S,I){return S.intersection.distance-I.intersection.distance})[0];T?(A=T.intersection,this.activePanoMesh!==T.panoMesh&&(this.activePanoMesh=T.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(T.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),A||(A=this.models.intersectRaycaster(m)[0]);var x=createEvent("intersect.update",{raycaster:m,intersection:A!=null?A:null,object:this.intersectMesh});if(this.emit("intersect.update",x),x.defaultPrevented){this.hideIntersectMesh();return}if(A&&A.face){var R=A.face.normal,_=new THREE__namespace.Quaternion;_.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),R),this.intersectMesh.quaternion.copy(_);var M=A.point.clone();this.intersectMesh.position.copy(M),T?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return T==null?void 0:T.panoMesh},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t}(PanoramaController),HUMAN_EYE_POSITION=new THREE__namespace.Vector3(0,1.6,0),ModelController=function(n){__extends(t,n);function t(e){var r=this,i,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Model",r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(i=r.models.getMaterial().modelAlpha)!==null&&i!==void 0?i:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r}return t.parseArgs=function(e){return e instanceof t?e:n.parseArgs.call(this,e)},t.initAnimationEndState=function(e){var r,i,o,s,u,c,l=this.parseArgs(e),d=l.works,f=e.initial,m=f.state,A=f.currentState,h=typeof m.panoIndex=="number"?{workCode:(o=(r=m.workCode)!==null&&r!==void 0?r:(i=l.works[0])===null||i===void 0?void 0:i.workCode)!==null&&o!==void 0?o:"",panoIndex:m.panoIndex}:{workCode:A.workCode,panoIndex:A.panoIndex},p=d.getResolvedObserver(h),y=(s=m.longitude)!==null&&s!==void 0?s:A.longitude,v=clamp$1((u=m.latitude)!==null&&u!==void 0?u:!p||isFristPersonMode(A.mode)?A.latitude:l.defaultLatitude,l.minLatitude,l.maxLatitude),g=clamp$1((c=m.fov)!==null&&c!==void 0?c:!p||isFristPersonMode(A.mode)?A.fov:l.defaultFov,l.minFov,l.maxFov),E=new THREE__namespace.Vector3;if(l.initial.state.offset)E.copy(l.initial.state.offset);else if(p)E.copy(p.position);else{var b=coordinatesToVector(A).setLength(A.distance);E.copy(l.initial.currentState.offset).sub(b)}return{workCode:h.workCode,panoIndex:h.panoIndex,mode:"Model",longitude:y,latitude:v,fov:g,offset:E,distance:0}},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose()},t.prototype.isReady=function(){return this.locationMotion.ended!==!1},t.prototype.updateWork=function(e,r,i,o){this.works=e;var s=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:i.duration,effect:i.effect,state:r,userAction:o}}));return this.hideIntersectMesh(),this.moveToPosition(s.offset,{duration:0,longitude:s.longitude,latitude:s.latitude,fov:s.fov},o),!0},t.prototype.updateCamera=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();var s={},u={};return s.distance=0,e.offset!==void 0&&(s.x=e.offset.x,s.y=e.offset.y,s.z=e.offset.z),e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),o.locationMotion.set(s,r).catch(noop$1),o.cameraMotion.set(u,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();for(var s=[],u=[],c=0,l=e;c<l.length;c++){var d=l[c];s.push({key:d.key,progress:d.progress,value:{distance:0,x:d.value.offset.x,y:d.value.offset.x,z:d.value.offset.x}}),u.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return o.locationMotion.setKeyframes(s,r).catch(noop$1),o.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var i={},o={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),i.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),o.distance=this.locationMotion.value.distance,o.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);var s=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),u=this.works.resolvedObservers,c=arrayMin(u,function(l){return l.position.distanceTo(s)});this.currentPano=c?{workCode:c.work.workCode,panoIndex:c.panoIndex}:{workCode:"",panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov),isEmptyObject(i)||this.models.setMaterial(i),isEmptyObject(o)||this.setCamera(o)}},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var i=e.initial;i.state,i.currentState;var o=i.duration,s=i.userAction;e.userAction=s;var u=t.initAnimationEndState(e),c={modelAlpha:1},l={perspToOrtho:0},d={longitude:u.longitude,latitude:u.latitude,fov:u.fov,duration:o,moveStartCallback:function(f){e.perspToOrthoMotion.set(l,o).catch(noop$1),e.modelAlphaMotion.set(c,o).catch(noop$1),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:f,userAction:e.userAction}))},moveEndCallback:function(f){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:f,userAction:e.userAction})),r()},moveCancelCallback:function(){var f=e.currentPano,m=__assign(__assign({},f),{mode:e.mode,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance});e.emit("initAnimation.end",createEvent("initAnimation.end",{state:m,userAction:e.userAction})),r()}};e.moveToPosition(u.offset,d,s)})},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},t.prototype.moveToPano=function(e,r,i){r===void 0&&(r={});var o=this.works.getResolvedObserver(e);o&&this.moveToPosition(o.position,r,i)},t.prototype.moveToPosition=function(e,r,i){var o=this,s,u,c;r===void 0&&(r={}),this.userAction=i,this.stopMomentumMovement();for(var l=now(),d=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),f=d.distanceTo(e),m=this.locationMotion.getProgressVelocity(l),A=0,h=1;h<this.locationMotion.keyframes.length;h++){var p=this.locationMotion.keyframes[h-1].value,y=p.x,v=p.y,g=p.z,E=this.locationMotion.keyframes[h].value,b=E.x,T=E.y,x=E.z;A+=Math.sqrt(Math.pow(b-y,2)+Math.pow(T-v,2)+Math.pow(x-g,2))}var R=f===0?0:m*A/f,_=this.calculateMovingDuration(r.duration,f),M={x:e.x,y:e.y,z:e.z,distance:0},S={longitude:r.longitude,latitude:r.latitude,fov:r.fov},I=this.works.resolvedObservers,C=arrayMin(I,function(O){return O.position.distanceTo(d)}),H=C?{workCode:C.work.workCode,panoIndex:C.panoIndex}:{workCode:"",panoIndex:0},B=__assign(__assign({},H),{mode:this.mode,longitude:(s=S.longitude)!==null&&s!==void 0?s:this.camera.pose.longitude,latitude:(u=S.latitude)!==null&&u!==void 0?u:this.camera.pose.latitude,fov:(c=S.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:e.clone(),distance:0}),L=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:r,prevPano:L,progress:0,state:B,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(B),this.cameraMotion.set(S,_).catch(noop$1),this.locationMotion.set(M,_,R).then(function(){for(var O=0,k=o.models;O<k.length;O++){var G=k[O];G.show()}var z=__assign(__assign(__assign({},H),{mode:o.mode}),clonePose(o.camera.pose));o.emit("pano.arrived",createEvent("pano.arrived",{options:r,prevPano:L,progress:0,state:z,userAction:o.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(z)},function(){r.moveCancelCallback&&r.moveCancelCallback(),o.emit("pano.cancel",createEvent("pano.cancel",{options:r,prevPano:L,progress:0,state:B,userAction:o.userAction,error:null}))})},t.prototype.onTapGesture=function(e){var r=e.center.raycaster;this.stopMomentumMovement();var i=this.models.intersectRaycaster(r)[0];if(i&&i.face){var o=i.face.normal,s=i.point;if(new THREE__namespace.Vector3(0,1,0).angleTo(o)>Math.PI/3){var u=o.clone().setLength(.3).add(s);r.set(u,new THREE__namespace.Vector3(0,-1,0)),i=this.models.intersectRaycaster(r)[0]}}if(i){var c=new THREE__namespace.Vector3().copy(i.point).add(HUMAN_EYE_POSITION),l=this.works.resolvedObservers,d=arrayMin(l,function(A){return A.position.distanceTo(c)},!0),f=d[0],m=d[1];f&&m<5&&(c.y=f.position.y),e.state.offset.copy(c),e.state.distance=0,this.emit("gesture.tap",e),e.defaultPrevented||this.moveToPosition(c,{},!0)}else this.emit("gesture.tap",e),e.defaultPrevented||this.cameraBounce()},t}(PanoramaLikeController);const edlVertexShader=function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}(`}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{Hnvor-rp@-}|vv|{Hnvor-rp?-H{vs|z-znA-}|wrpv|{Znv\x07H{vs|z-znA-z|qrycvrZnv\x07Hn\bv{t-rp?-bH|vq-znv{56-
1850
1850
  b-J-HrpA-z]|vv|{-J-z|qrycvrZnv\x07-7-rpA5}|vv|{9>;=6Htyl]|vv|{-J-}|wrpv|{Znv\x07-7-z]|vv|{H\f`),edlFragmentShader=function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}(`0r\x07r{v|{-TYlRealsntlqr}u-G-r{noyr<<<<-nqn}rq-s|z-ur-RQY-unqr-p|qr-s|z-Puvvn{-O|pur{\b-v{-py|q-p|z}nrG<<-u}G<<tvuo;p|z<py|qp|z}nr<{x<rr<znr<}ytv{<\0RQY<unqr<RQY<<}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{H{vs|z-sy|n-prr{dvquH{vs|z-sy|n-prr{UrvtuH{vs|z-rp?-{rvtuo|h[RVTUO\\b_lP\\b[ajH{vs|z-sy|n-rqy\`r{tuH{vs|z-sy|n-nqvH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-[rnH{vs|z-sy|n-SnH{vs|z-znA-]|wH{vs|z-nz}yr?Q-RQYP|y|Hn\bv{t-rp?-bHsy|n-r}|{r5sy|n-qr}u6
1851
1851
  --rp?-_nqv-J-nqv-<-rp?5prr{dvqu9-prr{Urvtu6H--sy|n-z-J-=;=H--s|5v{-v-J-=H-v-I-[RVTUO\\b_lP\\b[aH-v886
1852
1852
  ----rp?-[rvtuo|-J-b-8-_nqv-7-{rvtuo|hvjH----sy|n-{rvtuo|Qr}u-J-r\x07r?Q5RQYP|y|9-[rvtuo|6;nH----{rvtuo|Qr}u-J-5{rvtuo|Qr}u-JJ->;=6-L-=;=-G-{rvtuo|Qr}uH----vs5{rvtuo|Qr}u-.J-=;=6
@@ -1859,7 +1859,7 @@ void main() {
1859
1859
  `,e},t.prototype.updateShaderSource=function(){var e=this.getDefines()+edlVertexShader,r=this.getDefines()+edlFragmentShader;this.setValues({vertexShader:e,fragmentShader:r}),this.needsUpdate=!0},__decorate([uniform$1("screenWidth"),__metadata("design:type",Number)],t.prototype,"screenWidth",void 0),__decorate([uniform$1("screenHeight"),__metadata("design:type",Number)],t.prototype,"screenHeight",void 0),__decorate([uniform$1("edlStrength"),__metadata("design:type",Number)],t.prototype,"edlStrength",void 0),__decorate([uniform$1("uNear"),__metadata("design:type",Number)],t.prototype,"uNear",void 0),__decorate([uniform$1("uFar"),__metadata("design:type",Number)],t.prototype,"uFar",void 0),__decorate([uniform$1("radius"),__metadata("design:type",Number)],t.prototype,"radius",void 0),__decorate([uniform$1("neighbours",!0),__metadata("design:type",Float32Array)],t.prototype,"neighbours",void 0),__decorate([uniform$1("depthMap"),__metadata("design:type",THREE__namespace.Texture)],t.prototype,"depthMap",void 0),__decorate([uniform$1("uEDLColor"),__metadata("design:type",THREE__namespace.Texture)],t.prototype,"uEDLColor",void 0),__decorate([uniform$1("uEDLDepth"),__metadata("design:type",THREE__namespace.Texture)],t.prototype,"uEDLDepth",void 0),__decorate([uniform$1("uProj"),__metadata("design:type",Array)],t.prototype,"uProj",void 0),t}(THREE__namespace.RawShaderMaterial);function makeUniform$1(n,t){return{type:n,value:t}}function uniform$1(n,t){return t===void 0&&(t=!1),function(e,r){Object.defineProperty(e,r,{get:function(){return this.getUniform(n)},set:function(i){i!==this.getUniform(n)&&(this.setUniform(n,i),t&&this.updateShaderSource())}})}}var passCamera$1=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$2=new THREE__namespace.BufferGeometry;geometry$2.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$2.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$2=new THREE__namespace.Mesh(geometry$2),edlEffectScene=new THREE__namespace.Scene;edlEffectScene.add(mesh$2);var EDLEffect=function(n){__extends(t,n);function t(e,r,i,o){var s=n.call(this,e,r,i,o)||this;return s.sharedV2=new THREE__namespace.Vector2,s.renderer=e,s.material=new EDLMaterial,mesh$2.material=s.material,s.material.needsUpdate=!0,s}return t.prototype.render=function(e){this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.setRenderTarget(e[0]),this.renderer.render(this.scene,this.camera);var r=this.camera,i=this.material.uniforms,o=this.renderer.getSize(this.sharedV2);i.screenWidth.value=o.x,i.screenHeight.value=o.y;var s=r.projectionMatrix,u=new Float32Array(16);u.set(s.elements);for(var c=new Float32Array(this.material.neighbourCount*2),l=0;l<this.material.neighbourCount;l++)c[2*l+0]=Math.cos(2*l*Math.PI/this.material.neighbourCount),c[2*l+1]=Math.sin(2*l*Math.PI/this.material.neighbourCount);i.neighbours.value=c,i.uNear.value=r.near,i.uFar.value=r.far,i.uEDLColor.value=e[0].texture,i.uProj.value=u,i.edlStrength.value=.25,i.radius.value=1,i.opacity.value=1,this.renderer.setRenderTarget(e[1]),this.renderer.render(edlEffectScene,passCamera$1)},t.prototype.dispose=function(){this.copyPass.dispose()},t}(Effect);const fragment=function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}(`}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{H{vs|z-nz}yr?Q-drvtuZn}H{vs|z-nz}yr?Q-Qr}uZn}Hn\bv{t-rp?-bH|vq-znv{56-
1860
1860
  sy|n-qr}u-J-r\x07r?Q5Qr}uZn}9-b6;Hvs5qr}u-KJ->;=6
1861
1861
  qvpnqH\frpA-p|y|-J-r\x07r?Q5drvtuZn}9-b6H-p|y|-J-p|y|-<-p|y|;HtylSntP|y|-J-rpA5p|y|;\x07\b 9->;=6H-\f`),vertex=function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=113,i=126,o=0,s="";return t[o].split(s).map(function(u){return u.charCodeAt(o)>i?u:String.fromCharCode((u.charCodeAt(o)+r)%i)}).join(s)}(`}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{Hnvor-rp@-}|vv|{Hnvor-rp?-H{vs|z-znA-}|wrpv|{Znv\x07H{vs|z-znA-z|qrycvrZnv\x07Hn\bv{t-rp?-bH|vq-znv{56-
1862
- b-J-Htyl]|vv|{-J-}|wrpv|{Znv\x07-7-z|qrycvrZnv\x07-7-rpA5}|vv|{9>;=6H\f`);var HQMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{vertexShader:vertex,fragmentShader:fragment})||this;return r.uniforms={uDepthMap:makeUniform("t",null),uWeightMap:makeUniform("t",null)},r.depthTest=!0,r.depthWrite=!0,r.opacity=1,r}return t.prototype.getUniform=function(e){return this.uniforms===void 0?void 0:this.uniforms[e].value},t.prototype.setUniform=function(e,r){if(this.uniforms!==void 0){var i=this.uniforms[e];i.value=r}},__decorate([uniform("uDepthMap"),__metadata("design:type",Number)],t.prototype,"uDepthMap",void 0),__decorate([uniform("uWeightMap"),__metadata("design:type",Number)],t.prototype,"uWeightMap",void 0),t}(THREE__namespace.RawShaderMaterial);function makeUniform(n,t){return{type:n,value:t}}function uniform(n,t){return t===void 0&&(t=!1),function(e,r){Object.defineProperty(e,r,{get:function(){return this.getUniform(n)},set:function(i){i!==this.getUniform(n)&&(this.setUniform(n,i),t&&this.updateShaderSource())}})}}var passCamera=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$1=new THREE__namespace.BufferGeometry;geometry$1.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$1.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$1=new THREE__namespace.Mesh(geometry$1),hqScene=new THREE__namespace.Scene;hqScene.add(mesh$1);var HQEffect=function(n){__extends(t,n);function t(e,r,i,o){var s=n.call(this,e,r,i,o)||this;return s.sharedV2=new THREE__namespace.Vector2,s.renderer=e,s.material=new HQMaterial,s.camera=i,mesh$1.material=s.material,s}return t.prototype.render=function(e){this.models.setMaterial({useHQDepth:!0,useHQWeight:!1}),this.models.update(this.renderer,this.camera,"Mapview"),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.setRenderTarget(e[0]),this.renderer.render(this.scene,this.camera),this.models.setMaterial({useHQWeight:!0,useHQDepth:!1}),this.models.update(this.renderer,this.camera,"Mapview"),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.renderer.setClearColor(new THREE__namespace.Color(0,0,0)),this.renderer.setClearAlpha(0),this.renderer.setRenderTarget(e[1]),this.renderer.render(this.scene,this.camera),this.material.uniforms.uWeightMap.value=e[1].texture,this.material.uniforms.uDepthMap.value=e[0].depthTexture,this.renderer.autoClearDepth=!0,this.renderer.autoClearColor=!0,this.renderer.setClearColor(new THREE__namespace.Color(0,0,0)),this.renderer.setClearAlpha(1),this.renderer.setRenderTarget(e[2]),this.renderer.render(hqScene,passCamera)},t.prototype.dispose=function(){this.copyPass.dispose()},t}(Effect),RAYCASTER_NEAR=.5,minDistance=.5,PANGESTURE_FORWARD_ANGLE=Math.PI/7,MapviewController=function(n){__extends(t,n);function t(e){var r=this,i,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.cameraType=o.cameraType,r.modelInScreen=o.modelInScreen,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(i=r.models.getMaterial().modelAlpha)!==null&&i!==void 0?i:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.currentTapId=null,r.helper.add(r.intersectMesh),r.edlTarget=new THREE__namespace.WebGLRenderTarget(1024,1024,{generateMipmaps:!1,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(1024,1024,THREE__namespace.UnsignedIntType)}),r.edlEffect=new EDLEffect(r.renderer,r.modelScene,r.camera,r.models),r.hqEffect=new HQEffect(r.renderer,r.modelScene,r.camera,r.models),r}return t.parseArgs=function(e){var r,i,o,s,u,c,l,d;if(e instanceof t)return e;var f=n.parseArgs.call(this,e);return __assign(__assign({},f),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:Math.PI/4,defaultLatitude:(i=e.defaultLatitude)!==null&&i!==void 0?i:Math.PI/4,defaultDistance:(o=e.defaultDistance)!==null&&o!==void 0?o:150,maxLatitude:(s=e.maxLatitude)!==null&&s!==void 0?s:+Math.PI/2,minLatitude:(u=e.minLatitude)!==null&&u!==void 0?u:0,cameraType:(c=e.cameraType)!==null&&c!==void 0?c:"auto",modelInScreen:(l=e.modelInScreen)!==null&&l!==void 0?l:"boundingbox-center",intersectMeshCreator:(d=e.intersectMeshCreator)!==null&&d!==void 0?d:function(){return new IntersectMesh}})},t.distanceFromModel=function(e,r,i){var o=e.bounding,s=Math.pow(Math.pow(o.max.x-o.min.x+1,2)+Math.pow(o.max.y-o.min.y+1,2)+Math.pow(o.max.z-o.min.z+1,2),1/2),u=s/2/Math.tan(Math.PI*r/360);return i<1&&(u=u/i),isNaN(u)?s:u},t.initAnimationEndState=function(e){var r,i,o,s,u,c,l,d=this.parseArgs(e),f=d.works,m=d.models,A=e.initial,h=A.state,p=A.currentState,y=typeof h.panoIndex=="number"?{workCode:(o=(r=h.workCode)!==null&&r!==void 0?r:(i=d.works[0])===null||i===void 0?void 0:i.workCode)!==null&&o!==void 0?o:"",panoIndex:h.panoIndex}:{workCode:p.workCode,panoIndex:p.panoIndex},v=f.getResolvedObserver(y),g=(s=h.fov)!==null&&s!==void 0?s:60,E=clamp$1((u=h.latitude)!==null&&u!==void 0?u:isThirdPersonMode(p.mode)?p.latitude:d.defaultLatitude,d.minLatitude,d.maxLatitude),b=t.distanceFromModel(d.models,g,d.camera.aspect),T=new THREE__namespace.Vector3,x=(c=h.distance)!==null&&c!==void 0?c:Math.min(d.defaultDistance,b),R=(l=h.longitude)!==null&&l!==void 0?l:isThirdPersonMode(p.mode)?p.longitude:d.defaultLongitude;return h.offset?T.copy(h.offset):d.defaultDistance<b&&v?(T.copy(v.position),h.longitude===void 0&&(R=p.longitude)):T.copy(m.bounding.getCenter(T)),m.bounding.containsPoint(T)||m.bounding.getCenter(T),__assign(__assign({},y),{mode:"Mapview",longitude:R,latitude:E,fov:g,offset:T,distance:x})},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,i,o){this.userAction=o,this.works=e;var s=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:i.duration,effect:i.effect,state:r,userAction:o}}));this.currentPano={workCode:s.workCode,panoIndex:s.panoIndex};var u={longitude:s.longitude,latitude:s.latitude,fov:s.fov},c={x:s.offset.x,y:s.offset.y,z:s.offset.z,distance:s.distance,orthoDistance:s.distance};return this.locationMotion.set(c,i.duration).catch(noop$1),this.cameraMotion.set(u,i.duration).catch(noop$1),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e)},t.prototype.updateCamera=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();var s={},u={};return e.distance!==void 0&&(s.distance=e.distance),e.offset!==void 0&&(s.x=e.offset.x,s.y=e.offset.y,s.z=e.offset.z),e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),o.locationMotion.set(s,r).catch(noop$1),o.cameraMotion.set(u,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();for(var s=[],u=[],c=0,l=e;c<l.length;c++){var d=l[c];s.push({key:d.key,progress:d.progress,value:{distance:d.value.distance,x:d.value.offset.x,y:d.value.offset.x,z:d.value.offset.x}}),u.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return o.locationMotion.setKeyframes(s,r).catch(noop$1),o.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var i={},o={};this.locationMotion.ended||(this.locationMotion.update(e),o.distance=this.locationMotion.value.distance,o.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),i.modelAlpha=this.modelAlphaMotion.value.modelAlpha);var s=0;this.cameraType==="auto"?s=Math.PI/2-this.cameraMotion.value.latitude<.02?1:0:this.cameraType==="perspective"?s=0:this.cameraType==="orthographic"&&(s=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==s&&this.perspToOrthoMotion.set({perspToOrtho:s},500).catch(noop$1),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(i)||this.models.setMaterial(i),isEmptyObject(o)||this.setCamera(o)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var i=e.initial;i.state,i.currentState;var o=i.duration,s=i.userAction;e.userAction=s;var u=t.initAnimationEndState(e),c={longitude:u.longitude,latitude:u.latitude,fov:u.fov},l={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance},d={modelAlpha:1},f={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:u,userAction:e.userAction})),e.perspToOrthoMotion.set(f,o).catch(noop$1),e.modelAlphaMotion.set(d,o/3).catch(noop$1),e.cameraMotion.set(c,o).catch(noop$1),e.locationMotion.set(l,o).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:u,userAction:e.userAction}))},function(m){var A=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:A,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this,i=this.models.intersectRaycaster(e)[0];if(!i)return null;var o=this.works.resolvedObservers.filter(function(l){for(var d,f=0,m=r.models;f<m.length;f++){var A=m[f];if(A.visible&&((d=A.work)===null||d===void 0?void 0:d.workCode)===l.work.workCode)return!0}return!1}),s=arrayMin(o,function(l){return l.standingPosition.distanceTo(i.point)},!0),u=s[0],c=s[1];return u&&c<10?u:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.scissor.width),latitude:2*e.y/(r.y*this.scissor.height)}},t.prototype.requestMomentumMovement=function(e,r,i,o){var s=this;if(this.inMomentumMovement!==null){for(var u=__assign({},i),c={longitude:0,latitude:0,x:0,y:0,z:0},l=0;l<o;l++)u.longitude*=.996,u.latitude*=.996*.998,u.x*=.99,u.y*=.99,u.z*=.99,c.longitude+=u.longitude,c.latitude+=u.latitude,c.x+=u.x,c.y+=u.y,c.z+=u.z;var d=formatRad(this.cameraMotion.value.longitude+c.longitude),f=clamp$1(this.cameraMotion.value.latitude+c.latitude,this.minLatitude,this.maxLatitude),m=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),A=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:f,offset:m,fov:this.cameraMotion.value.fov,distance:this.camera.pose.distance}),h=!(Math.abs(u.longitude)>1e-4||Math.abs(u.latitude)>1e-4||Math.abs(u.x)>1e-4||Math.abs(u.y)>1e-4||Math.abs(u.z)>1e-4),p=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:h,state:A}));if(this.inMomentumMovement.event=p,this.emit("gesture.momentum",p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:f},0).catch(noop$1),this.locationMotion.set({x:A.offset.x,y:A.offset.y,z:A.offset.z},0).catch(noop$1),h?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(y,v){s.requestMomentumMovement(e,!1,u,v|0)},!0,1))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),i=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),o=new THREE__namespace.Raycaster(i,r);o.params.Points={threshold:.1},o.near=RAYCASTER_NEAR;var s;if(o.ray.direction.y<-.3&&(s=this.models.intersectRaycaster(o).filter(function(f){var m,A=(m=f.face)===null||m===void 0?void 0:m.normal;return A&&o.ray.direction.dot(A)>=0?!1:f.distance>minDistance+o.near})[0],!s)){var u=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),-this.models.bounding.min.y),c=o.ray.intersectPlane(u,new THREE__namespace.Vector3);if(c){var l=c.distanceTo(o.ray.origin);l<1e4&&l>=o.near&&(s={distance:l,floor:0,point:c,object:this.scene,face:null})}}if(!s){var d=Math.max(e.distance,3);s={distance:d,floor:0,point:o.ray.direction.clone().setLength(d).add(o.ray.origin),object:this.scene,face:null}}s&&(e.distance=clamp$1(s.distance,0,1/0),e.offset.copy(i).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,i=this.panState,o=0;e.pointerType==="mouse"&&(o=e.srcEvent.buttons),i&&o===0&&i.buttons!==0&&(o=i.buttons);var s=i==null?void 0:i.target;if(!s){var u=this.relativeClientPosition(e.center),c=new THREE__namespace.Raycaster;c.params.Points={threshold:.1},c.setFromCamera(u,this.camera),c.near=RAYCASTER_NEAR,s=new THREE__namespace.Vector3().copy(c.ray.direction).multiplyScalar(3).add(c.ray.origin);var l=this.models.intersectRaycaster(c)[0];if(!l&&c.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),f=c.ray.intersectPlane(d,new THREE__namespace.Vector3);if(f){var m=f.distanceTo(c.ray.origin);m<1e4&&m>=c.near&&(l={distance:m,floor:0,point:f,object:this.scene})}}if(l)s.copy(l.point);else{var A=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(A,this.camera.pose.offset);c.ray.intersectPlane(d,s)}}if(e.isFinal?delete this.panState:this.panState={target:s,buttons:o,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof i=="undefined"||i.pointerLength!==r)){var h=r>1||o===2;if(h){var p={x:e.center.x-i.x,y:e.center.y-i.y},y=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),v=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(y),g=new THREE__namespace.Vector3().copy(v).sub(i.target).length();g*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var E=this.renderer.getSize(new THREE__namespace.Vector2),b=2*p.x*g/E.y,T=2*p.y*g/E.y,x=new THREE__namespace.Vector3;if(x.setFromMatrixColumn(this.camera.matrix,0),x.multiplyScalar(-b),y.add(x),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?x.setFromMatrixColumn(this.camera.matrix,1):(x.setFromMatrixColumn(this.camera.matrix,0),x.crossVectors(this.camera.up,x)),x.multiplyScalar(T),y.add(x),this.modelInScreen==="boundingbox-center"){var R=this.models.bounding.clone();R.expandByScalar(this.camera.pose.distance),y.clamp(R.min,R.max)}var _=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:y,distance:this.camera.pose.distance});if(e.state=_,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:_.offset.x,y:_.offset.y,z:_.offset.z},0).catch(noop$1),e.isFinal&&(this.fixFinalState(_),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:_.distance,x:_.offset.x,y:_.offset.y,z:_.offset.z},0).catch(noop$1)),e.isFinal){var M=this.renderer.getSize(new THREE__namespace.Vector2),S=2*e.velocityX*g/M.y,I=2*e.velocityY*g/M.y,C=new THREE__namespace.Vector3,H=new THREE__namespace.Vector3;C.setFromMatrixColumn(this.camera.matrix,0),C.multiplyScalar(-S),H.add(C),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?C.setFromMatrixColumn(this.camera.matrix,1):(C.setFromMatrixColumn(this.camera.matrix,0),C.crossVectors(this.camera.up,C)),C.multiplyScalar(I),H.add(C),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:H.x,y:H.y,z:H.z},0)}}else{var p={x:e.center.x-i.x,y:e.center.y-i.y},B=this.coordinatesForOffset(p),L=formatRad(this.cameraMotion.value.longitude+B.longitude),O=clamp$1(this.cameraMotion.value.latitude+B.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(O=this.cameraMotion.value.latitude);var _=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:L,latitude:O,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=_,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:_.distance,x:_.offset.x,y:_.offset.y,z:_.offset.z},0).catch(noop$1):this.cameraMotion.set({longitude:_.longitude,latitude:_.latitude},0).catch(noop$1),e.isFinal){var k=e.velocityX,G=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:k,y:G})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var i=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(typeof i!="undefined"){var o=this.models.bounding.getCenter(new THREE__namespace.Vector3),s=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),u=clamp$1(i/e.scale,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(u)),l=this.models.bounding.containsPoint(c),d;if(!l&&this.pinchState&&this.pinchState.scale>e.scale&&o.distanceTo(c)>s?d=e.state.distance:(d=u,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=d,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop$1),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)),e.isFinal)){if(!("__fixFinalState"in e)){var f=e.state;this.fixFinalState(e.state);var m={x:f.offset.x,y:f.offset.y,z:f.offset.z,distance:f.distance};this.locationMotion.set(m,0).catch(noop$1)}delete this.panState,delete this.pinchState}}}},t.prototype.onMouseMove=function(e){var r,i;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var o=e.center.raycaster;if(o.near=RAYCASTER_NEAR,o.far=500,e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var s=this.models.intersectRaycaster(o)[0],u=createEvent("intersect.update",{raycaster:o,intersection:s!=null?s:null,object:this.intersectMesh});if(this.emit("intersect.update",u),u.defaultPrevented){this.hideIntersectMesh();return}if(s){var c=(i=(r=s.face)===null||r===void 0?void 0:r.normal)!==null&&i!==void 0?i:new THREE__namespace.Vector3().copy(o.ray.direction).multiplyScalar(-1),l=c.clone(),d=s.point.clone();this.intersectMesh.position.copy(d);var f=o.ray.origin.distanceTo(d),m=2*Math.tan(.5*this.camera.fov/180*Math.PI),A=Math.max(f*m/10,1);this.intersectMesh.scale.set(A,A,A);var h=d.clone().add(l);if(this.intersectMesh.lookAt(h),Math.abs(c.y)>.99){var p=this.camera.position.clone().sub(d);this.intersectMesh.rotation.z=-Math.atan2(p.z,p.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady)if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var i={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(i,0).catch(noop$1)}else{var o=e.center.delta/2*Math.max(Math.log(this.locationMotion.value.distance),1),s=this.models.bounding.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),c=clamp$1(this.locationMotion.value.distance-o,minDistance,1/0),l=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(c)),d=this.models.bounding.containsPoint(l);if(this.modelInScreen!=="none"&&(c=!d&&o<0&&s.distanceTo(l)>u?e.state.distance:c),e.state.distance=c,this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:c},0).catch(noop$1)}},t.prototype.onTapGesture=function(e){var r=this;this.userAction=e.userAction,this.stopMomentumMovement();var i=e.center.raycaster,o=this.getForwardObserverOrNot(i);if(!o)this.emit("gesture.tap",e);else{var s={longitude:this.camera.pose.longitude,latitude:0},u=__assign(__assign({},e.state),{mode:"Panorama",workCode:o.pano.workCode,panoIndex:o.pano.panoIndex,longitude:s.longitude,latitude:s.latitude,offset:o?o.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=u,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:u,userAction:e.userAction,options:s,progress:0,error:null})),o&&o.active)){var c=this.currentTapId=createUuid();this.preloadPano(o.pano).then(function(l){r.currentTapId===c&&r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:u,options:s,error:null}))})}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t.prototype.render=function(e,r){var i=this.renderer.getRenderTarget();this.updateScreenBuffer(r),e&&(r==="edl"?this.edlEffect.render(this.screenBuffers):r==="hq"?this.hqEffect.render(this.screenBuffers):(this.renderer.setRenderTarget(this.modelRenderTarget),this.renderer.render(this.modelScene,this.camera))),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,i),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,i),this.renderer.setRenderTarget(i),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t}(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var i=null,o=null,s=null,u=this._targetRay,c=this._grip,l=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(u!==null&&(i=e.getPose(t.targetRaySpace,r),i!==null&&(u.matrix.fromArray(i.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),i.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(i.linearVelocity)):u.hasLinearVelocity=!1,i.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(i.angularVelocity)):u.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),l&&t.hand){s=!0;for(var d=0,f=t.hand.values();d<f.length;d++){var m=f[d],A=e.getJointPose(m,r);if(l.joints[m.jointName]===void 0){var h=new THREE__namespace.Group;h.matrixAutoUpdate=!1,h.visible=!1,l.joints[m.jointName]=h,l.add(h)}var p=l.joints[m.jointName];A!==null&&(p.matrix.fromArray(A.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.jointRadius=A.radius),p.visible=A!==null}var y=l.joints["index-finger-tip"],v=l.joints["thumb-tip"],g=y.position.distanceTo(v.position),E=.02,b=.005;l.inputState.pinching&&g>E+b?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&g<=E-b&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(o=e.getPose(t.gripSpace,r),o!==null&&(c.matrix.fromArray(o.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),o.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(o.linearVelocity)):c.hasLinearVelocity=!1,o.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(o.angularVelocity)):c.hasAngularVelocity=!1));return u!==null&&(u.visible=i!==null),c!==null&&(c.visible=o!==null),l!==null&&(l.visible=s!==null),this},n}(),framebufferScaleFactor=1,XRManager=function(){function n(t,e,r){var i,o,s,u,c;this.isPanorama=(i=r==null?void 0:r.isPanorama)!==null&&i!==void 0?i:!0;var l=navigator.userAgent.toLowerCase(),d;l.includes("oculus")?d="Oculus":l.includes("pico")?d="Pico":d="VP",this.machineType=(o=r==null?void 0:r.machineType)!==null&&o!==void 0?o:d,this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(s=r==null?void 0:r.referenceSpaceType)!==null&&s!==void 0?s:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(u=r==null?void 0:r.onSessionStart)!==null&&u!==void 0?u:noop$1,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop$1,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="right"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getLeftController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="left"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var i=this.cameraLPos.distanceTo(this.cameraRPos),o=e.projectionMatrix.elements,s=r.projectionMatrix.elements,u=o[14]/(o[10]-1),c=o[14]/(o[10]+1),l=(o[9]+1)/o[5],d=(o[9]-1)/o[5],f=(o[8]-1)/o[0],m=(s[8]+1)/s[0],A=u*f,h=u*m,p=i/(-f+m),y=p*-f;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(y),t.translateZ(p),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=u+p,g=c+p,E=A-y,b=h+(i-y),T=l*c/g*v,x=d*c/g*v;t.projectionMatrix.makePerspective(E,b,T,x,v,g)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var i=0;i<r.length;i++)this.updateCamera(r[i],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var o=t.children,i=0,s=o.length;i<s;i++)o[i].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var i=t.removed[r],o=this.inputSourcesMap.get(i);o&&(o.dispatchEvent({type:"disconnected",data:i}),this.inputSourcesMap.delete(i))}for(var r=0;r<t.added.length;r++){var i=t.added[r],o=this.inputSourcesMap.get(i);o&&o.dispatchEvent({type:"connected",data:i})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(i){e.onSessionEvent(i)}),this.session.addEventListener("selectstart",function(i){e.onSessionEvent(i)}),this.session.addEventListener("selectend",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeeze",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeezestart",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeezeend",function(i){e.onSessionEvent(i)}),this.session.addEventListener("end",function(i){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var i={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":case"VP":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,i)});break;case"Oculus":e.session.updateRenderState({layers:[new XRWebGLLayer(e.session,e.gl,i)]});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(o){e.onRequestReferenceSpace(o)}),e.session.addEventListener("inputsourceschange",function(o){e.updateInputSources(o)})})}},n}(),LineSegmentsGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],i=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(o),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(i,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,i=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),i.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var i=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var i=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(i,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var i=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var i=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),i.setFromBufferAttribute(r),this.boundingBox.union(i)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var o=0,s=new THREE__namespace.Vector3,u=0,c=e.count;u<c;u++)s.fromBufferAttribute(e,u),o=Math.max(o,i.distanceToSquared(s)),s.fromBufferAttribute(r,u),o=Math.max(o,i.distanceToSquared(s));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t}(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
1862
+ b-J-Htyl]|vv|{-J-}|wrpv|{Znv\x07-7-z|qrycvrZnv\x07-7-rpA5}|vv|{9>;=6H\f`);var HQMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{vertexShader:vertex,fragmentShader:fragment})||this;return r.uniforms={uDepthMap:makeUniform("t",null),uWeightMap:makeUniform("t",null)},r.depthTest=!0,r.depthWrite=!0,r.opacity=1,r}return t.prototype.getUniform=function(e){return this.uniforms===void 0?void 0:this.uniforms[e].value},t.prototype.setUniform=function(e,r){if(this.uniforms!==void 0){var i=this.uniforms[e];i.value=r}},__decorate([uniform("uDepthMap"),__metadata("design:type",Number)],t.prototype,"uDepthMap",void 0),__decorate([uniform("uWeightMap"),__metadata("design:type",Number)],t.prototype,"uWeightMap",void 0),t}(THREE__namespace.RawShaderMaterial);function makeUniform(n,t){return{type:n,value:t}}function uniform(n,t){return t===void 0&&(t=!1),function(e,r){Object.defineProperty(e,r,{get:function(){return this.getUniform(n)},set:function(i){i!==this.getUniform(n)&&(this.setUniform(n,i),t&&this.updateShaderSource())}})}}var passCamera=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$1=new THREE__namespace.BufferGeometry;geometry$1.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$1.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$1=new THREE__namespace.Mesh(geometry$1),hqScene=new THREE__namespace.Scene;hqScene.add(mesh$1);var HQEffect=function(n){__extends(t,n);function t(e,r,i,o){var s=n.call(this,e,r,i,o)||this;return s.sharedV2=new THREE__namespace.Vector2,s.renderer=e,s.material=new HQMaterial,s.camera=i,mesh$1.material=s.material,s}return t.prototype.render=function(e){this.models.setMaterial({useHQDepth:!0,useHQWeight:!1}),this.models.update(this.renderer,this.camera,"Mapview"),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.setRenderTarget(e[0]),this.renderer.render(this.scene,this.camera),this.models.setMaterial({useHQWeight:!0,useHQDepth:!1}),this.models.update(this.renderer,this.camera,"Mapview"),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.renderer.setClearColor(new THREE__namespace.Color(0,0,0)),this.renderer.setClearAlpha(0),this.renderer.setRenderTarget(e[1]),this.renderer.render(this.scene,this.camera),this.material.uniforms.uWeightMap.value=e[1].texture,this.material.uniforms.uDepthMap.value=e[0].depthTexture,this.renderer.autoClearDepth=!0,this.renderer.autoClearColor=!0,this.renderer.setClearColor(new THREE__namespace.Color(0,0,0)),this.renderer.setClearAlpha(1),this.renderer.setRenderTarget(e[2]),this.renderer.render(hqScene,passCamera)},t.prototype.dispose=function(){this.copyPass.dispose()},t}(Effect),RAYCASTER_NEAR=.5,minDistance=.5,PANGESTURE_FORWARD_ANGLE=Math.PI/7,MapviewController=function(n){__extends(t,n);function t(e){var r=this,i,o=t.parseArgs(e);return r=n.call(this,o)||this,r.mode="Mapview",r.defaultLongitude=o.defaultLongitude,r.defaultLatitude=o.defaultLatitude,r.defaultDistance=o.defaultDistance,r.maxLatitude=o.maxLatitude,r.minLatitude=o.minLatitude,r.cameraType=o.cameraType,r.modelInScreen=o.modelInScreen,r.locationMotion=new Motion({x:r.camera.pose.offset.x,y:r.camera.pose.offset.y,z:r.camera.pose.offset.z,distance:r.camera.pose.distance}),r.modelAlphaMotion=new Motion({modelAlpha:(i=r.models.getMaterial().modelAlpha)!==null&&i!==void 0?i:0}),r.perspToOrthoMotion=new Motion({perspToOrtho:r.camera.perspToOrtho.x}),r.intersectMeshCreator=o.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.currentTapId=null,r.helper.add(r.intersectMesh),r.edlTarget=new THREE__namespace.WebGLRenderTarget(1024,1024,{generateMipmaps:!1,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(1024,1024,THREE__namespace.UnsignedIntType)}),r.edlEffect=new EDLEffect(r.renderer,r.modelScene,r.camera,r.models),r.hqEffect=new HQEffect(r.renderer,r.modelScene,r.camera,r.models),r}return t.parseArgs=function(e){var r,i,o,s,u,c,l,d;if(e instanceof t)return e;var f=n.parseArgs.call(this,e);return __assign(__assign({},f),{defaultLongitude:(r=e.defaultLongitude)!==null&&r!==void 0?r:Math.PI/4,defaultLatitude:(i=e.defaultLatitude)!==null&&i!==void 0?i:Math.PI/4,defaultDistance:(o=e.defaultDistance)!==null&&o!==void 0?o:150,maxLatitude:(s=e.maxLatitude)!==null&&s!==void 0?s:+Math.PI/2,minLatitude:(u=e.minLatitude)!==null&&u!==void 0?u:0,cameraType:(c=e.cameraType)!==null&&c!==void 0?c:"auto",modelInScreen:(l=e.modelInScreen)!==null&&l!==void 0?l:"boundingbox-center",intersectMeshCreator:(d=e.intersectMeshCreator)!==null&&d!==void 0?d:function(){return new IntersectMesh}})},t.distanceFromModel=function(e,r,i){var o=e.bounding,s=Math.pow(Math.pow(o.max.x-o.min.x+1,2)+Math.pow(o.max.y-o.min.y+1,2)+Math.pow(o.max.z-o.min.z+1,2),1/2),u=s/2/Math.tan(Math.PI*r/360);return i<1&&(u=u/i),isNaN(u)?s:u},t.initAnimationEndState=function(e){var r,i,o,s,u,c,l,d=this.parseArgs(e),f=d.works,m=d.models,A=e.initial,h=A.state,p=A.currentState,y=typeof h.panoIndex=="number"?{workCode:(o=(r=h.workCode)!==null&&r!==void 0?r:(i=d.works[0])===null||i===void 0?void 0:i.workCode)!==null&&o!==void 0?o:"",panoIndex:h.panoIndex}:{workCode:p.workCode,panoIndex:p.panoIndex},v=f.getResolvedObserver(y),g=(s=h.fov)!==null&&s!==void 0?s:60,E=clamp$1((u=h.latitude)!==null&&u!==void 0?u:isThirdPersonMode(p.mode)?p.latitude:d.defaultLatitude,d.minLatitude,d.maxLatitude),b=t.distanceFromModel(d.models,g,d.camera.aspect),T=new THREE__namespace.Vector3,x=(c=h.distance)!==null&&c!==void 0?c:Math.min(d.defaultDistance,b),R=(l=h.longitude)!==null&&l!==void 0?l:isThirdPersonMode(p.mode)?p.longitude:d.defaultLongitude;return h.offset?T.copy(h.offset):d.defaultDistance<b&&v?(T.copy(v.position),h.longitude===void 0&&(R=p.longitude)):T.copy(m.bounding.getCenter(T)),m.bounding.containsPoint(T)||m.bounding.getCenter(T),__assign(__assign({},y),{mode:"Mapview",longitude:R,latitude:E,fov:g,offset:T,distance:x})},t.prototype.destroy=function(){n.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return this.locationMotion.ended===!1?!1:n.prototype.isReady.call(this)},t.prototype.updateWork=function(e,r,i,o){this.userAction=o,this.works=e;var s=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:i.duration,effect:i.effect,state:r,userAction:o}}));this.currentPano={workCode:s.workCode,panoIndex:s.panoIndex};var u={longitude:s.longitude,latitude:s.latitude,fov:s.fov},c={x:s.offset.x,y:s.offset.y,z:s.offset.z,distance:s.distance,orthoDistance:s.distance};return this.locationMotion.set(c,i.duration).catch(noop$1),this.cameraMotion.set(u,i.duration).catch(noop$1),!0},t.prototype.updateModel=function(e){n.prototype.updateModel.call(this,e)},t.prototype.updateCamera=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();var s={},u={};return e.distance!==void 0&&(s.distance=e.distance),e.offset!==void 0&&(s.x=e.offset.x,s.y=e.offset.y,s.z=e.offset.z),e.longitude!==void 0&&(u.longitude=e.longitude),e.latitude!==void 0&&(u.latitude=e.latitude),e.fov!==void 0&&(u.fov=e.fov),o.locationMotion.set(s,r).catch(noop$1),o.cameraMotion.set(u,r).catch(noop$1)})},t.prototype.updateCameraWithKeyframes=function(e,r,i){var o=this;return this.initAnimationReady.then(function(){o.userAction=i,o.stopMomentumMovement();for(var s=[],u=[],c=0,l=e;c<l.length;c++){var d=l[c];s.push({key:d.key,progress:d.progress,value:{distance:d.value.distance,x:d.value.offset.x,y:d.value.offset.x,z:d.value.offset.x}}),u.push({key:d.key,progress:d.progress,value:{longitude:d.value.longitude,latitude:d.value.latitude,fov:d.value.fov}})}return o.locationMotion.setKeyframes(s,r).catch(noop$1),o.cameraMotion.setKeyframes(e,r)})},t.prototype.updateTime=function(e,r){if(!this.destroyed){var i={},o={};this.locationMotion.ended||(this.locationMotion.update(e),o.distance=this.locationMotion.value.distance,o.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),o.longitude=this.cameraMotion.value.longitude,o.latitude=this.cameraMotion.value.latitude,o.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),i.modelAlpha=this.modelAlphaMotion.value.modelAlpha);var s=0;this.cameraType==="auto"?s=Math.PI/2-this.cameraMotion.value.latitude<.02?1:0:this.cameraType==="perspective"?s=0:this.cameraType==="orthographic"&&(s=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==s&&this.perspToOrthoMotion.set({perspToOrtho:s},500).catch(noop$1),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(i)||this.models.setMaterial(i),isEmptyObject(o)||this.setCamera(o)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],r=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:r.value.distance,offset:new THREE__namespace.Vector3(r.value.x,r.value.y,r.value.z)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise(function(r){var i=e.initial;i.state,i.currentState;var o=i.duration,s=i.userAction;e.userAction=s;var u=t.initAnimationEndState(e),c={longitude:u.longitude,latitude:u.latitude,fov:u.fov},l={x:u.offset.x,y:u.offset.y,z:u.offset.z,distance:u.distance},d={modelAlpha:1},f={perspToOrtho:0};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:u,userAction:e.userAction})),e.perspToOrthoMotion.set(f,o).catch(noop$1),e.modelAlphaMotion.set(d,o/3).catch(noop$1),e.cameraMotion.set(c,o).catch(noop$1),e.locationMotion.set(l,o).then(function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:u,userAction:e.userAction}))},function(m){var A=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:A,userAction:e.userAction}))}).then(function(){r()})})},t.prototype.getForwardObserverOrNot=function(e){var r=this,i=this.models.intersectRaycaster(e)[0];if(!i)return null;var o=this.works.resolvedObservers.filter(function(l){for(var d,f=0,m=r.models;f<m.length;f++){var A=m[f];if(A.visible&&((d=A.work)===null||d===void 0?void 0:d.workCode)===l.work.workCode)return!0}return!1}),s=arrayMin(o,function(l){return l.standingPosition.distanceTo(i.point)},!0),u=s[0],c=s[1];return u&&c<10?u:null},t.prototype.coordinatesForOffset=function(e){var r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(r.x*this.scissor.width),latitude:2*e.y/(r.y*this.scissor.height)}},t.prototype.requestMomentumMovement=function(e,r,i,o){var s=this;if(this.inMomentumMovement!==null){for(var u=__assign({},i),c={longitude:0,latitude:0,x:0,y:0,z:0},l=0;l<o;l++)u.longitude*=.996,u.latitude*=.996*.998,u.x*=.99,u.y*=.99,u.z*=.99,c.longitude+=u.longitude,c.latitude+=u.latitude,c.x+=u.x,c.y+=u.y,c.z+=u.z;var d=formatRad(this.cameraMotion.value.longitude+c.longitude),f=clamp$1(this.cameraMotion.value.latitude+c.latitude,this.minLatitude,this.maxLatitude),m=new THREE__namespace.Vector3(this.locationMotion.value.x+c.x,this.locationMotion.value.y+c.y,this.locationMotion.value.z+c.z),A=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:d,latitude:f,offset:m,fov:this.cameraMotion.value.fov,distance:this.camera.pose.distance}),h=!(Math.abs(u.longitude)>1e-4||Math.abs(u.latitude)>1e-4||Math.abs(u.x)>1e-4||Math.abs(u.y)>1e-4||Math.abs(u.z)>1e-4),p=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:r,isFinal:h,state:A}));if(this.inMomentumMovement.event=p,this.emit("gesture.momentum",p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:d,latitude:f},0).catch(noop$1),this.locationMotion.set({x:A.offset.x,y:A.offset.y,z:A.offset.z},0).catch(noop$1),h?this.inMomentumMovement=null:AnimationFrameLoop.shared.add(function(y,v){s.requestMomentumMovement(e,!1,u,v|0)},!0,1))}},t.prototype.fixFinalState=function(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==1){var r=coordinatesToVector(e,new THREE__namespace.Vector3),i=new THREE__namespace.Vector3().copy(e.offset).sub(r.clone().multiplyScalar(e.distance)),o=new THREE__namespace.Raycaster(i,r);o.params.Points={threshold:.1},o.near=RAYCASTER_NEAR;var s;if(o.ray.direction.y<-.3&&(s=this.models.intersectRaycaster(o).filter(function(f){var m,A=(m=f.face)===null||m===void 0?void 0:m.normal;return A&&o.ray.direction.dot(A)>=0?!1:f.distance>minDistance+o.near})[0],!s)){var u=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),-this.models.bounding.min.y),c=o.ray.intersectPlane(u,new THREE__namespace.Vector3);if(c){var l=c.distanceTo(o.ray.origin);l<1e4&&l>=o.near&&(s={distance:l,floor:0,point:c,object:this.scene,face:null})}}if(!s){var d=Math.max(e.distance,3);s={distance:d,floor:0,point:o.ray.direction.clone().setLength(d).add(o.ray.origin),object:this.scene,face:null}}s&&(e.distance=clamp$1(s.distance,0,1/0),e.offset.copy(i).add(r.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=e.pointers.length,i=this.panState,o=0;e.pointerType==="mouse"&&(o=e.srcEvent.buttons),i&&o===0&&i.buttons!==0&&(o=i.buttons);var s=i==null?void 0:i.target;if(!s){var u=this.relativeClientPosition(e.center),c=new THREE__namespace.Raycaster;c.params.Points={threshold:.1},c.setFromCamera(u,this.camera),c.near=RAYCASTER_NEAR,s=new THREE__namespace.Vector3().copy(c.ray.direction).multiplyScalar(3).add(c.ray.origin);var l=this.models.intersectRaycaster(c)[0];if(!l&&c.ray.direction.y<-.3){var d=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),f=c.ray.intersectPlane(d,new THREE__namespace.Vector3);if(f){var m=f.distanceTo(c.ray.origin);m<1e4&&m>=c.near&&(l={distance:m,floor:0,point:f,object:this.scene})}}if(l)s.copy(l.point);else{var A=new THREE__namespace.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),d=new THREE__namespace.Plane().setFromNormalAndCoplanarPoint(A,this.camera.pose.offset);c.ray.intersectPlane(d,s)}}if(e.isFinal?delete this.panState:this.panState={target:s,buttons:o,pointerLength:r,x:e.center.x,y:e.center.y},!(typeof i=="undefined"||i.pointerLength!==r)){var h=r>1||o===2;if(h){var p={x:e.center.x-i.x,y:e.center.y-i.y},y=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),v=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(y),g=new THREE__namespace.Vector3().copy(v).sub(i.target).length();g*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var E=this.renderer.getSize(new THREE__namespace.Vector2),b=2*p.x*g/E.y,T=2*p.y*g/E.y,x=new THREE__namespace.Vector3;if(x.setFromMatrixColumn(this.camera.matrix,0),x.multiplyScalar(-b),y.add(x),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?x.setFromMatrixColumn(this.camera.matrix,1):(x.setFromMatrixColumn(this.camera.matrix,0),x.crossVectors(this.camera.up,x)),x.multiplyScalar(T),y.add(x),this.modelInScreen==="boundingbox-center"){var R=this.models.bounding.clone();R.expandByScalar(this.camera.pose.distance),y.clamp(R.min,R.max)}var _=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:y,distance:this.camera.pose.distance});if(e.state=_,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:_.offset.x,y:_.offset.y,z:_.offset.z},0).catch(noop$1),e.isFinal&&(this.fixFinalState(_),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:_.distance,x:_.offset.x,y:_.offset.y,z:_.offset.z},0).catch(noop$1)),e.isFinal){var M=this.renderer.getSize(new THREE__namespace.Vector2),S=2*e.velocityX*g/M.y,I=2*e.velocityY*g/M.y,C=new THREE__namespace.Vector3,H=new THREE__namespace.Vector3;C.setFromMatrixColumn(this.camera.matrix,0),C.multiplyScalar(-S),H.add(C),this.camera.pose.latitude<PANGESTURE_FORWARD_ANGLE?C.setFromMatrixColumn(this.camera.matrix,1):(C.setFromMatrixColumn(this.camera.matrix,0),C.crossVectors(this.camera.up,C)),C.multiplyScalar(I),H.add(C),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:H.x,y:H.y,z:H.z},0)}}else{var p={x:e.center.x-i.x,y:e.center.y-i.y},B=this.coordinatesForOffset(p),L=formatRad(this.cameraMotion.value.longitude+B.longitude),O=clamp$1(this.cameraMotion.value.latitude+B.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(O=this.cameraMotion.value.latitude);var _=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:L,latitude:O,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=_,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:_.distance,x:_.offset.x,y:_.offset.y,z:_.offset.z},0).catch(noop$1):this.cameraMotion.set({longitude:_.longitude,latitude:_.latitude},0).catch(noop$1),e.isFinal){var k=e.velocityX,G=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:k,y:G})),{x:0,y:0,z:0}),0)}}}},t.prototype.onPinchGesture=function(e){var r;if(this.initAnimationIsReady){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var i=(r=this.pinchState)===null||r===void 0?void 0:r.distance;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(typeof i!="undefined"){var o=this.models.bounding.getCenter(new THREE__namespace.Vector3),s=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),u=clamp$1(i/e.scale,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(u)),l=this.models.bounding.containsPoint(c),d;if(!l&&this.pinchState&&this.pinchState.scale>e.scale&&o.distanceTo(c)>s?d=e.state.distance:(d=u,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=d,this.emit("gesture.pinch",e),!e.defaultPrevented&&(this.locationMotion.set({distance:e.state.distance},0).catch(noop$1),e.pointerType!=="mouse"&&(e.type="gesture.pan",this.onPanGesture(e)),e.isFinal)){if(!("__fixFinalState"in e)){var f=e.state;this.fixFinalState(e.state);var m={x:f.offset.x,y:f.offset.y,z:f.offset.z,distance:f.distance};this.locationMotion.set(m,0).catch(noop$1)}delete this.panState,delete this.pinchState}}}},t.prototype.onMouseMove=function(e){var r,i;if(this.intersectMesh.parent&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var o=e.center.raycaster;if(o.near=RAYCASTER_NEAR,o.far=500,e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}var s=this.models.intersectRaycaster(o)[0],u=createEvent("intersect.update",{raycaster:o,intersection:s!=null?s:null,object:this.intersectMesh});if(this.emit("intersect.update",u),u.defaultPrevented){this.hideIntersectMesh();return}if(s){var c=(i=(r=s.face)===null||r===void 0?void 0:r.normal)!==null&&i!==void 0?i:new THREE__namespace.Vector3().copy(o.ray.direction).multiplyScalar(-1),l=c.clone(),d=s.point.clone();this.intersectMesh.position.copy(d);var f=o.ray.origin.distanceTo(d),m=2*Math.tan(.5*this.camera.fov/180*Math.PI),A=Math.max(f*m/10,1);this.intersectMesh.scale.set(A,A,A);var h=d.clone().add(l);if(this.intersectMesh.lookAt(h),Math.abs(c.y)>.99){var p=this.camera.position.clone().sub(d);this.intersectMesh.rotation.z=-Math.atan2(p.z,p.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}},t.prototype.onMouseWheel=function(e){if(this.initAnimationIsReady)if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var r=e.state;if(this.fixFinalState(r),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var i={x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance};this.locationMotion.set(i,0).catch(noop$1)}else{var o=e.center.delta/2*Math.max(Math.log(this.locationMotion.value.distance),1),s=this.models.bounding.getCenter(new THREE__namespace.Vector3),u=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),c=clamp$1(this.locationMotion.value.distance-o,minDistance,1/0),l=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(c)),d=this.models.bounding.containsPoint(l);if(this.modelInScreen!=="none"&&(c=!d&&o<0&&s.distanceTo(l)>u?e.state.distance:c),e.state.distance=c,this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:c},0).catch(noop$1)}},t.prototype.onTapGesture=function(e){var r=this;this.userAction=e.userAction,this.stopMomentumMovement();var i=e.center.raycaster,o=this.getForwardObserverOrNot(i);if(!o)this.emit("gesture.tap",e);else{var s={longitude:this.camera.pose.longitude,latitude:0},u=__assign(__assign({},e.state),{mode:"Panorama",workCode:o.pano.workCode,panoIndex:o.pano.panoIndex,longitude:s.longitude,latitude:s.latitude,offset:o?o.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=u,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:u,userAction:e.userAction,options:s,progress:0,error:null})),o&&o.active)){var c=this.currentTapId=createUuid();this.preloadPano(o.pano).then(function(l){r.currentTapId===c&&r.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:u,options:s,error:null}))})}}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t.prototype.render=function(e,r){var i=this.renderer.getRenderTarget();this.updateScreenBuffer(r),e&&(r==="edl"?this.edlEffect.render(this.screenBuffers):r==="hq"?this.hqEffect.render(this.screenBuffers):(this.renderer.setRenderTarget(this.modelRenderTarget),this.renderer.render(this.modelScene,this.camera))),this.depthCopyPass.render(this.modelRenderTarget.depthTexture,i),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!0,this.copyPass.render(this.modelRenderTarget,i),this.renderer.setRenderTarget(i),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,this.camera),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t}(BaseController);function isNil(n){return n==null}var _moveEvent={type:"move"},XRController=function(){function n(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return n.prototype.getHandSpace=function(){return this._hand===null&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},n.prototype.getTargetRaySpace=function(){return this._targetRay===null&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},n.prototype.getGripSpace=function(){return this._grip===null&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},n.prototype.dispatchEvent=function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},n.prototype.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},n.prototype.getAxes=function(){return this._axes},n.prototype.update=function(t,e,r){var i=null,o=null,s=null,u=this._targetRay,c=this._grip,l=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&e.session.visibilityState!=="visible-blurred")if(u!==null&&(i=e.getPose(t.targetRaySpace,r),i!==null&&(u.matrix.fromArray(i.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),i.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(i.linearVelocity)):u.hasLinearVelocity=!1,i.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(i.angularVelocity)):u.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent))),l&&t.hand){s=!0;for(var d=0,f=t.hand.values();d<f.length;d++){var m=f[d],A=e.getJointPose(m,r);if(l.joints[m.jointName]===void 0){var h=new THREE__namespace.Group;h.matrixAutoUpdate=!1,h.visible=!1,l.joints[m.jointName]=h,l.add(h)}var p=l.joints[m.jointName];A!==null&&(p.matrix.fromArray(A.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.jointRadius=A.radius),p.visible=A!==null}var y=l.joints["index-finger-tip"],v=l.joints["thumb-tip"],g=y.position.distanceTo(v.position),E=.02,b=.005;l.inputState.pinching&&g>E+b?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&g<=E-b&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(o=e.getPose(t.gripSpace,r),o!==null&&(c.matrix.fromArray(o.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),o.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(o.linearVelocity)):c.hasLinearVelocity=!1,o.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(o.angularVelocity)):c.hasAngularVelocity=!1));return u!==null&&(u.visible=i!==null),c!==null&&(c.visible=o!==null),l!==null&&(l.visible=s!==null),this},n}(),framebufferScaleFactor=1,XRManager=function(){function n(t,e,r){var i,o,s,u,c;this.isPanorama=(i=r==null?void 0:r.isPanorama)!==null&&i!==void 0?i:!0;var l=navigator.userAgent.toLowerCase(),d;l.includes("pico")?d="Pico":l.includes("oculus")?d="Oculus":d="VP",this.machineType=(o=r==null?void 0:r.machineType)!==null&&o!==void 0?o:d,this.renderer=t,this.gl=e,this.enabled=!1,this.session=null,this.referenceSpaceType=(s=r==null?void 0:r.referenceSpaceType)!==null&&s!==void 0?s:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=(u=r==null?void 0:r.onSessionStart)!==null&&u!==void 0?u:noop$1,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)!==null&&c!==void 0?c:noop$1,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return n.prototype.getController=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getRightController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="right"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getLeftController=function(){if(!this.session)return null;var t=this.session.inputSources[0].handedness==="left"?0:1,e=this.controllers[t];return e||console.warn("no controller find"),e.getTargetRaySpace()},n.prototype.getControllerGrip=function(t){var e=this.controllers[t];return e||console.warn("no controller find"),e.getGripSpace()},n.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},n.prototype.updateCamera=function(t,e){e===null?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)},n.prototype.setProjectionFromUnion=function(t,e,r){this.cameraLPos.setFromMatrixPosition(e.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var i=this.cameraLPos.distanceTo(this.cameraRPos),o=e.projectionMatrix.elements,s=r.projectionMatrix.elements,u=o[14]/(o[10]-1),c=o[14]/(o[10]+1),l=(o[9]+1)/o[5],d=(o[9]-1)/o[5],f=(o[8]-1)/o[0],m=(s[8]+1)/s[0],A=u*f,h=u*m,p=i/(-f+m),y=p*-f;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(y),t.translateZ(p),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=u+p,g=c+p,E=A-y,b=h+(i-y),T=l*c/g*v,x=d*c/g*v;t.projectionMatrix.makePerspective(E,b,T,x,v,g)},n.prototype.getCamera=function(t){this.cameraVR.near=this.cameraR.near=this.cameraL.near=t.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=t.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);var e=t.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,e);for(var i=0;i<r.length;i++)this.updateCamera(r[i],e);t.matrixWorld.copy(this.cameraVR.matrixWorld);for(var o=t.children,i=0,s=o.length;i<s;i++)o[i].updateMatrixWorld(!0);return r.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},n.prototype.updateInputSources=function(t){if(!this.session){console.warn("session is lose!");return}for(var e=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(e[r],this.controllers[r]);for(var r=0;r<t.removed.length;r++){var i=t.removed[r],o=this.inputSourcesMap.get(i);o&&(o.dispatchEvent({type:"disconnected",data:i}),this.inputSourcesMap.delete(i))}for(var r=0;r<t.added.length;r++){var i=t.added[r],o=this.inputSourcesMap.get(i);o&&o.dispatchEvent({type:"connected",data:i})}},n.prototype.onSessionEvent=function(t){var e=this.inputSourcesMap.get(t.inputSource);e&&e.dispatchEvent({type:t.type})},n.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach(function(t,e){t.disconnect(e)}),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},n.prototype.onRequestReferenceSpace=function(t){this.referenceSpace=t,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},n.prototype.setSession=function(t){var e=this;if(this.session=t,this.session){this.session.addEventListener("select",function(i){e.onSessionEvent(i)}),this.session.addEventListener("selectstart",function(i){e.onSessionEvent(i)}),this.session.addEventListener("selectend",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeeze",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeezestart",function(i){e.onSessionEvent(i)}),this.session.addEventListener("squeezeend",function(i){e.onSessionEvent(i)}),this.session.addEventListener("end",function(i){e.onSessionEnd()});var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(function(){var i={antialias:r==null?void 0:r.antialias,alpha:r==null?void 0:r.alpha,depth:r==null?void 0:r.depth,stencil:r==null?void 0:r.stencil,framebufferScaleFactor};if(!e.session){console.error("session is lose while set session!");return}switch(e.machineType){case"Pico":case"VP":e.session.updateRenderState({baseLayer:new XRWebGLLayer(e.session,e.gl,i)});break;case"Oculus":e.session.updateRenderState({layers:[new XRWebGLLayer(e.session,e.gl,i)]});break;default:e.machineType;break}e.session.requestReferenceSpace(e.referenceSpaceType).then(function(o){e.onRequestReferenceSpace(o)}),e.session.addEventListener("inputsourceschange",function(o){e.updateInputSources(o)})})}},n}(),LineSegmentsGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;e.type="LineSegmentsGeometry";var r=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],i=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(o),e.setAttribute("position",new THREE__namespace.Float32BufferAttribute(r,3)),e.setAttribute("uv",new THREE__namespace.Float32BufferAttribute(i,2)),e}return t.prototype.applyMatrix4=function(e){var r=this.attributes.instanceStart,i=this.attributes.instanceEnd;return r!==void 0&&(r.applyMatrix4(e),i.applyMatrix4(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var i=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var r;e instanceof Float32Array?r=e:Array.isArray(e)?r=new Float32Array(e):r=new Float32Array;var i=new THREE__namespace.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(i,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var i=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var i=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),i.setFromBufferAttribute(r),this.boundingBox.union(i)}},t.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new THREE__namespace.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(e!==void 0&&r!==void 0){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var o=0,s=new THREE__namespace.Vector3,u=0,c=e.count;u<c;u++)s.fromBufferAttribute(e,u),o=Math.max(o,i.distanceToSquared(s)),s.fromBufferAttribute(r,u),o=Math.max(o,i.distanceToSquared(s));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t}(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
1863
1863
  #include <common>
1864
1864
  #include <color_pars_vertex>
1865
1865
  #include <fog_pars_vertex>
@@ -2058,7 +2058,7 @@ void main() {
2058
2058
  #include <premultiplied_alpha_fragment>
2059
2059
 
2060
2060
  }
2061
- `},LineMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(i){this.uniforms.diffuse.value=i}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(i){this.uniforms.linewidth.value=i}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(i){this.uniforms.dashScale.value=i}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(i){this.uniforms.dashSize.value=i}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(i){this.uniforms.gapSize.value=i}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(i){this.uniforms.opacity.value=i}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(i){this.uniforms.resolution.value.copy(i)}}}),r.setValues(e),r}return t}(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=function(n){__extends(t,n);function t(e,r){var i=n.call(this)||this;return i.type="LineSegments2",i.geometry=e!==void 0?e:new LineSegmentsGeometry,i.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),i}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,i=e.attributes.instanceEnd,o=new Float32Array(2*r.count),s=new THREE__namespace.Vector3,u=new THREE__namespace.Vector3,c=0,l=0,d=r.count;c<d;c++,l+=2)s.fromBufferAttribute(r,c),u.fromBufferAttribute(i,c),o[l]=l===0?0:o[l-1],o[l+1]=o[l]+s.distanceTo(u);var f=new THREE__namespace.InstancedInterleavedBuffer(o,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(f,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(f,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var i=e.ray,o=e.camera,s=o.projectionMatrix,u=this.geometry,c=this.material,l=c.resolution,d=c.linewidth,f=u.attributes.instanceStart,m=u.attributes.instanceEnd,A=new THREE__namespace.Vector4,h=new THREE__namespace.Vector4,p=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,g=new THREE__namespace.Line3,E=new THREE__namespace.Vector3;i.at(1,p),p.w=1,p.applyMatrix4(o.matrixWorldInverse),p.applyMatrix4(s),p.multiplyScalar(1/p.w),p.x*=l.x/2,p.y*=l.y/2,p.z=0,y.copy(p);var b=this.matrixWorld;v.multiplyMatrices(o.matrixWorldInverse,b);for(var T=0,x=f.count;T<x;T++){A.fromBufferAttribute(f,T),h.fromBufferAttribute(m,T),A.w=1,h.w=1,A.applyMatrix4(v),h.applyMatrix4(v),A.applyMatrix4(s),h.applyMatrix4(s),A.multiplyScalar(1/A.w),h.multiplyScalar(1/h.w);var R=A.z<-1&&h.z<-1,_=A.z>1&&h.z>1;if(!(R||_)){A.x*=l.x/2,A.y*=l.y/2,h.x*=l.x/2,h.y*=l.y/2,g.start.copy(A),g.start.z=0,g.end.copy(h),g.end.z=0;var M=g.closestPointToPointParameter(y,!0);g.at(M,E);var S=THREE__namespace.MathUtils.lerp(A.z,h.z,M),I=S>=-1&&S<=1,C=y.distanceTo(E)<d*.5;if(I&&C){g.start.fromBufferAttribute(f,T),g.end.fromBufferAttribute(m,T),g.start.applyMatrix4(b),g.end.applyMatrix4(b);var H=new THREE__namespace.Vector3,B=new THREE__namespace.Vector3;i.distanceSqToSegment(g.start,g.end,B,H),r.push({point:B,pointOnLine:H,distance:i.origin.distanceTo(B),object:this,faceIndex:T})}}}},t}(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=function(n){__extends(t,n);function t(e,r){var i=n.call(this,e,r)||this;return i.type="Line2",i}return t}(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,i=new Float32Array(2*r),o=0;o<r;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return n.prototype.setPositions.call(this,i),this},t.prototype.setColors=function(e){for(var r=e.length-3,i=new Float32Array(2*r),o=0;o<r;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return n.prototype.setColors.call(this,i),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var i=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vT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enpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var i=n.call(this)||this;i.type="FiveLine",i.needsRender=!0;var o=new LineGeometry,s=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});i.line=new Line2(o,s);var u=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return i.points=new THREE__namespace.Points(u,c),i.points.renderOrder=11,i.points.frustumCulled=!1,i.setPoints(e,r),i.add(i.line,i.points),i}return Object.defineProperty(t,"version",{get:function(){return"6.2.0-alpha.11"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var i=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];i==="dashed"?(r.dashed=o,o?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[i]=e[i]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var i=this.line.material.resolution;(i.x!==e||i.y!==r)&&(i.set(e,r),this.needsRender=!0)},t}(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,i,o){var s,u,c,l,d,f;return i===void 0&&(i=null),o===void 0&&(o=!0),__generator(this,function(m){switch(m.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(s=m.sent(),e.profiles.some(function(A){var h=s[A];return h&&(u={profileId:A,profilePath:"".concat(r,"/").concat(h.path),deprecated:!!h.deprecated}),!!u}),!u){if(!i)throw new Error("No matching profile name found");if(c=s[i],!c)throw new Error('No matching profile name found and default profile "'.concat(i,'" missing.'));u={profileId:i,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(u.profilePath)];case 2:if(l=m.sent(),o){if(f=void 0,f=l.layouts[e.handedness],!f)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(u.profileId));f.assetPath&&(d=u.profilePath.replace("profile.json",f.assetPath))}return[2,{profile:l,assetPath:d}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,i=Math.sqrt(n*n+t*t);if(i>1){var o=Math.atan2(t,n);e=Math.cos(o),r=Math.sin(o)}var s={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return s}var VisualResponse=function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,i=t.button,o=t.state,s=normalizeAxes(e,r),u=s.normalizedXAxis,c=s.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(o)?u:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(o)?c:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(o)?i:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(o):this.value=this.states.includes(o)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n}(),Component=function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(i){var o=new VisualResponse(e.visualResponses[i]);r.visualResponses[i]=o}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(i){i.updateFromComponent(e.values)})},n}(),MotionController=function(){function n(t,e,r){var i=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(o){var s=i.layoutDescription.components[o];i.components[o]=new Component(o,s)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n}(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(i){i instanceof THREE__namespace.Mesh&&i.isMesh&&(i.material.envMap=r.envMap,i.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(i){var o=i.valueNode,s=i.minNode,u=i.maxNode,c=i.value,l=i.valueNodeProperty;o&&(l===Constants.VisualResponseProperty.VISIBILITY?o.visible=c:l===Constants.VisualResponseProperty.TRANSFORM&&(o.quaternion.copy(s.quaternion).slerp(u.quaternion,c),o.position.lerpVectors(s.position,u.position,c)))})}))},t}(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,i=e.touchPointNodeName,o=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(i),e.touchPointNode){var s=new THREE.SphereGeometry(.001),u=new THREE.MeshBasicMaterial({color:255}),c=new THREE.Mesh(s,u);e.touchPointNode.add(c)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(o).forEach(function(l){var d=l.valueNodeName,f=l.minNodeName,m=l.maxNodeName,A=l.valueNodeProperty;if(A===Constants.VisualResponseProperty.TRANSFORM){if(l.minNode=t.getObjectByName(f),l.maxNode=t.getObjectByName(m),!l.minNode){console.warn("Could not find ".concat(f," in the model"));return}if(!l.maxNode){console.warn("Could not find ".concat(m," in the model"));return}}l.valueNode=t.getObjectByName(d),l.valueNode||console.warn("Could not find ".concat(d," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,i=null;return t.addEventListener("connected",function(o){var s=o.data;s.targetRayMode!=="tracked-pointer"||!s.gamepad||fetchProfile(s,e.path,DEFAULT_PROFILE).then(function(u){var c=u.profile,l=u.assetPath;r.motionController=new MotionController(s,c,l);var d=e._assetCache[r.motionController.assetUrl];if(d)i=d.scene.clone(),addAssetSceneToControllerModel(r,i);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(f){e._assetCache[r.motionController.assetUrl]=f,i=f.scene.clone(),addAssetSceneToControllerModel(r,i)})}}).catch(function(u){console.warn(u)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(i),i=null}),r},n}();function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(-1,1,1),XRPanoramaController=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.right.params.Points={threshold:.1},r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var i=r.xrManager.getController(0);r.controllerWrappers[0].add(i);var o=r.xrManager.getController(1);r.controllerWrappers[1].add(o);var s=new XRControllerModelFactory;s.gltfLoader={load:function(c,l){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(d){var f;return parseGltf(d.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(f=c.split("?")[1])!==null&&f!==void 0?f:"",fetcher:internalFetcher})}).then(function(d){return l(d)})}},(r.xrManager.machineType==="Oculus"||r.xrManager.machineType==="Pico")&&r.scene.add(r.pointerLines.left,r.pointerLines.right,r.controllerWrappers[0],r.controllerWrappers[1]),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade",fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var u=AnimationFrameLoop.shared.getContext();return u?(r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(u),r.on("xr.session.start",function(){var c=r.xrManager.getControllerGrip(0);c.add(s.createControllerModel(c)),r.controllerWrappers[0].add(c);var l=r.xrManager.getControllerGrip(1);l.add(s.createControllerModel(l)),r.controllerWrappers[1].add(l)}),r.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},r.xrManager.machineType==="VP"&&r.initHandEvent(),r):(console.error("获取session失败,请退出重试"),r)}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),i=n.initAnimationEndState.call(this,r);return __assign(__assign({},i),{mode:"XRPanorama"})},t.prototype.moveToPano=function(e,r,i){var o=this,s,u,c,l,d=(s=r.effect)!==null&&s!==void 0?s:"fade";this.userAction=i,this.stopMomentumMovement();var f=this.works.getResolvedObserver(e);if(!f)throw new Error("Invalid PanoIndex");var m=getImageSizeFromURL(f.images.up),A=this.imageOptions.size;typeof A=="undefined"&&f&&m&&(A=Number(m)),typeof A=="undefined"&&(A=2048);var h=this.imageOptions.transform,p=function(I,C){return mapPanoResource(applyImageURLOptions(I,h,C))},y=__assign({key:"pano.".concat(f.panoId)},pick(this.imageOptions,["format","size","quality"])),v=f.images,g=(c=(u=f.images.tiles)===null||u===void 0?void 0:u.filter(function(I){return I.size>A}))!==null&&c!==void 0?c:null,E="pano:"+jsonHash([v,y,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===E)return;var b=this.pendingTextureTask.panoId;(l=this.panoMeshes[b])===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:f.pano}))}var T=this.models.getMaterial()||{},x=T.pano0,R=T.pano1,_;if((x==null?void 0:x.map.name)===E?_=x:(R==null?void 0:R.map.name)===E&&(_=R),_){var M={panoId:f.panoId,effect:d,leftPanoPicture:{zoom:1,map:_.map,luminanceMap:_.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(f.position,f.quaternion,PANO_TEXTURE_SCALE)},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(f.pano,M,r);return}var S="move-to-pano-"+f.panoId;this.pending.add(S),this.pendingTextureTask={panoId:f.panoId,hash:E,onLoad:function(I){if(o.pending.delete(S),o.destroyed)I.body.dispose();else{I.body.name=E;var C={panoId:f.panoId,effect:d,leftPanoPicture:{zoom:1,map:I.body,luminanceMap:null,matrix:new THREE__namespace.Matrix4().compose(f.position,f.quaternion,PANO_TEXTURE_SCALE)},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};o.doMoveToPano(f.pano,C,r)}},onError:function(I){o.pending.delete(S);var C=__assign(__assign(__assign({},f.pano),{mode:o.mode}),clonePose(o.camera.pose));o.emit("pano.error",createEvent("pano.error",{error:I,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:C})),o.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:C})),r.moveCancelCallback&&r.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&g&&g.length?this.textureLoader.loadTiledCubeTexture(v,g,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:p,options:y},format:THREE__namespace.RGBAFormat,minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,viaAjax:!0,fetcher:getFetcher(f.work)},void 0,void 0,function(I){var C,H;o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:I,meta:null,pano:f.pano})),((C=o.pendingTextureTask)===null||C===void 0?void 0:C.hash)===E&&((H=o.panoMeshes[f.panoId])===null||H===void 0||H.setProgress(I))},this.renderer):this.textureLoader.loadCubeTexture(v,{imageURL:{transform:p,options:y},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(f.work)},void 0,void 0,function(I){var C,H;((C=o.pendingTextureTask)===null||C===void 0?void 0:C.hash)===E&&((H=o.panoMeshes[f.panoId])===null||H===void 0||H.setProgress(I)),o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:I,meta:null,pano:f.pano}))},this.renderer)]).then(function(I){var C,H,B=I[0];((C=o.pendingTextureTask)===null||C===void 0?void 0:C.hash)===E?(o.pendingTextureTask.onLoad(B),(H=o.panoMeshes[f.panoId])===null||H===void 0||H.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:B.meta,pano:f.pano}))):B.body.dispose()}).catch(function(I){var C,H;((C=o.pendingTextureTask)===null||C===void 0?void 0:C.hash)===E&&(o.pendingTextureTask.onError(I),(H=o.panoMeshes[f.panoId])===null||H===void 0||H.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.error",createEvent("pano.texture.error",{error:I,progress:0,meta:null,pano:f.pano})),o.emit("error",I))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:f.pano}))},t.prototype.doMoveToPano=function(e,r,i){var o=this,s,u,c,l,d,f,m,A,h,p;i===void 0&&(i={});var y=now(),v=createUuid();this.panoResources[v]=r;var g=1,E,b,T;if(this.locationMotion.ended){var x=this.locationMotion.getKeyFrameSegment(y);x[0];var R=x[1],_=this.locationMotion.value,M=this.panoResourceFromLocationMotionKeyframe(R).position,S=r.position;E=Math.max(M.distanceTo(S),g),b=[{key:R.key,progress:0,value:__assign(__assign({},_),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],T=0}else{var I=this.locationMotion.getKeyFrameSegment(y),C=I[0],R=I[1],_=this.locationMotion.value,H=this.panoResourceFromLocationMotionKeyframe(C).position,M=this.panoResourceFromLocationMotionKeyframe(R).position,S=r.position,B=R.value.count-_.count,L=Math.max(H.distanceTo(M),g)*B,O=Math.max(M.distanceTo(S),g);E=L+O,b=[{key:C.key,progress:0,value:__assign({},_)},{key:R.key,progress:L/E,value:R.value},{key:v,progress:1,value:{count:R.value.count+1,distance:0}}];var k=this.locationMotionKeyframesLength(this.locationMotion.keyframes),G=this.locationMotionKeyframesLength(b);T=this.locationMotion.getProgressVelocity(y)*k/G}var z=r.effect==="instant"?0:this.calculateMovingDuration(i.duration,r.effect==="fly"?E:0),D={longitude:i.longitude,latitude:i.latitude,fov:i.fov},U=__assign(__assign({},e),{mode:this.mode,longitude:(s=D.longitude)!==null&&s!==void 0?s:this.camera.pose.longitude,latitude:(u=D.latitude)!==null&&u!==void 0?u:this.camera.pose.latitude,fov:(c=D.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),K=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:i,prevPano:K,progress:0,state:U,userAction:this.userAction,error:null})),i.moveStartCallback&&i.moveStartCallback(U),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(D,z).catch(noop$1);else{var Q=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),q=coordinatesToVector({longitude:(l=D.longitude)!==null&&l!==void 0?l:this.cameraMotion.value.longitude,latitude:(d=D.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),J=new THREE__namespace.Object3D;J.lookAt(Q);var W=new THREE__namespace.Matrix4().makeRotationFromQuaternion(J.quaternion);J.lookAt(q);var re=new THREE__namespace.Matrix4().makeRotationFromQuaternion(J.quaternion),j=new THREE__namespace.Matrix4().getInverse(W).premultiply(re),te=this.cameraMotion.value.fov,$=(f=D.fov)!==null&&f!==void 0?f:this.cameraMotion.value.fov,ne=1;r.effect==="zoomin"?ne=1.5:r.effect==="zoomout"&&(ne=.4);for(var ee=$*ne,fe=0;fe<b.length-1;fe++){var ie=b[fe].key;if(ie){var se=this.panoResources[ie];se&&(se.fixCameraTransform.copy(j),se.leftPanoPicture&&(se.leftPanoPicture.zoom=Math.tan(te/2/180*Math.PI)/Math.tan(ee/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(m=D.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(A=D.latitude)!==null&&A!==void 0?A:this.cameraMotion.value.latitude,fov:ee}},{progress:1,value:{longitude:(h=D.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(p=D.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude,fov:$}}],z).catch(noop$1)}var Ae=this.locationMotion.setKeyframes(b,z,T);Ae.then(function(){for(var he,me,Z,Y=0,N=o.models;Y<N.length;Y++){var Ee=N[Y];Ee.show()}var ge=__assign(__assign({},e),{mode:o.mode,longitude:o.camera.pose.longitude,latitude:o.camera.pose.latitude,fov:o.camera.pose.fov,offset:o.camera.pose.offset.clone(),distance:0});o.emit("pano.arrived",createEvent("pano.arrived",{options:i,prevPano:K,progress:1,state:ge,userAction:o.userAction,error:null})),i.moveEndCallback&&i.moveEndCallback(ge);var ve=o.works.getResolvedObserver(o.currentPano);if(ve&&ve.video&&o.videoTexture&&o.videoTexture.image instanceof HTMLVideoElement){var xe=ROTATE_Y_PI_MATRIX.clone().multiply((Z=(me=(he=o.models.getMaterial())===null||he===void 0?void 0:he.pano1)===null||me===void 0?void 0:me.matrix)!==null&&Z!==void 0?Z:new THREE__namespace.Matrix4).multiply(ve.video.matrix),de={map:o.videoTexture,size:ve.video.size,matrix:xe,alpha:1},ce=createUuid(),le=o.videoTexture.image;le.setAttribute("uuid",ce),canplayVideo().then(function(ue){ue&&ve.video&&le.getAttribute("uuid")===ce&&(le.oncanplay=function(){le.oncanplay=noop$1,le.play()},le.ontimeupdate=function(){le.currentTime>.5&&(le.ontimeupdate=noop$1,o.panoVideo.setMaterial(de))},le.src=ve.video.source)}).catch(function(){le.removeAttribute("uuid")})}},function(){o.emit("pano.cancel",createEvent("pano.cancel",{options:i,prevPano:K,progress:0,state:U,userAction:o.userAction,error:null})),i.moveCancelCallback&&i.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,i,o,s,u;this.stopMomentumMovement();var c=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),l=null,d=this.works.getResolvedObserver(this.currentPano);if(!d)return null;var f=d.accessibleIds.filter(function(q){var J=panoParse(q);if(panoEqual(J,r.currentPano))return!1;var W=r.works.getResolvedObserver(J);return!W||W.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:W.loadable||W.active}),m=this.models.intersectRaycaster(e)[0];if(m){var A=arrayMin(f,function(q){var J=r.works.getResolvedObserver(q);if(!J)return 1/0;var W=J.standingPosition.clone();return W.distanceTo(m.point)},!0),h=A[0],p=A[1];h&&p<this.panoTapTriggerRadius&&(l=(i=this.works.getResolvedObserver(h))!==null&&i!==void 0?i:null)}if(isNil(l)){var y=this.getForwardObserverOrNot(e);y&&(l=y)}for(var v=0,g=this.locationMotion.keyframes;v<g.length;v++){var E=g[v],b=this.panoResourceFromLocationMotionKeyframe(E);if(!(E.progress<this.locationMotion.progress)&&l&&b.panoId===l.panoId){l=null;break}}if(isNil(l))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(l&&!l.active){var T=l.panoId;this.panoMeshes[T]&&(this.panoMeshes[T].setDisabled(!1),this.panoMeshes[T].setLoading(!0))}var x={};if(l){for(var R=Math.PI/6,_=Math.PI/12,M=new THREE__namespace.Vector3(0,1,0),S=l.position.clone().setY(0).sub(d.position.clone().setY(0)).normalize(),I=S.clone().applyAxisAngle(M,R),C=S.clone().applyAxisAngle(M,-R),H=[],B=[],L=[],O=0,k=l.accessibleIds;O<k.length;O++){var h=k[O],G=panoParse(h);if(!(panoEqual(G,this.currentPano)||panoEqual(G,l.pano))){var z=this.works.getResolvedObserver(h);if(z){var D=z.position.clone().sub(l.position).setY(0);S.angleTo(D)<R?L.push(D):I.angleTo(D)<R?H.push(D):C.angleTo(D)<R&&B.push(D)}}}var U=L.length>0?L:__spreadArray(__spreadArray([],H,!0),B,!0),K=U.slice().sort(function(q,J){return q.angleTo(S)-J.angleTo(S)})[0];K&&K.angleTo(c)>_&&(x.longitude=Math.atan2(-K.x,-K.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(x.latitude=clamp$1(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(x.fov=this.defaultFov);var Q={workCode:l.pano.workCode,panoIndex:l.pano.panoIndex,mode:this.mode,longitude:(o=x.longitude)!==null&&o!==void 0?o:this.camera.pose.longitude,latitude:(s=x.latitude)!==null&&s!==void 0?s:this.camera.pose.latitude,fov:(u=x.fov)!==null&&u!==void 0?u:this.camera.pose.fov,distance:0,offset:l?l.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:Q,userAction:!0,options:x,progress:0,error:null})),l&&l.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:Q,options:x,error:null})),l.pano):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,i){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,i){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var i=this,o,s,u,c,l,d,f,m,A=[],h=2;h<arguments.length;h++)A[h-2]=arguments[h];this.userAction=!0;var p={},y={},v=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),E=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var b=this.locationMotion.getKeyFrameSegment(e),T=b[0],x=b[1],R=this.panoResourceFromLocationMotionKeyframe(T),_=this.panoResourceFromLocationMotionKeyframe(x),M=new THREE__namespace.Vector3().copy(R.position),S=new THREE__namespace.Vector3().copy(_.position),I=this.locationMotion.value.count-x.value.count+1;p.progress=I,_.leftPanoPicture&&(I<1?R.leftPanoPicture&&(p.pano0=R.leftPanoPicture):p.pano0=_.leftPanoPicture,p.pano1=_.leftPanoPicture),_.effect==="montage"?p.transition="BLACK":_.effect==="spread"?p.transition="SPREAD":p.transition="FADE",(_.effect==="zoomin"||_.effect==="zoomout")&&(p.progress=Math.pow(I,3)),I<1&&_.effect!=="fly"&&(p.pano0&&R.leftPanoPicture&&(p.pano0={map:p.pano0.map,zoom:p.pano0.zoom,luminanceMap:p.pano0.luminanceMap,matrix:R.leftPanoPicture.matrix.clone().setPosition(_.position)}),M.copy(S),E=!0),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(M.x+(S.x-M.x)*I,M.y+(S.y-M.y)*I,M.z+(S.z-M.z)*I);for(var C=[],H=[],B=0,L=this.locationMotion.keyframes;B<L.length;B++){var O=L[B],k=O.key,G=O.progress;k!==void 0&&(C.push(k),G>this.locationMotion.progress&&H.push(k))}for(var z=0,D=Object.keys(this.panoResources);z<D.length;z++){var U=D[z];if(!(H.indexOf(U)>=0)){var K=this.panoResources[U];if(K.leftPanoPicture){var Q=K.leftPanoPicture.map;if(Q){if(Q===((o=p.pano0)===null||o===void 0?void 0:o.map)||Q===((s=p.pano1)===null||s===void 0?void 0:s.map))continue;Q instanceof TileCubeTextureTarget&&Q.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(Q.cubeRenderTarget),Q.dispose(),K.leftPanoPicture=null}}C.indexOf(U)>=0||delete this.panoResources[U]}}this.currentPano=panoParse(_.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(v.panoId),state:__assign(__assign(__assign(__assign({},panoParse(g.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(p)===!1&&(!((u=p.pano0)===null||u===void 0)&&u.map&&p.pano0.map instanceof TileCubeTextureTarget&&!p.pano0.map.cubeRenderTarget&&(p.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=p.pano1)===null||c===void 0)&&c.map&&p.pano1.map instanceof TileCubeTextureTarget&&!p.pano1.map.cubeRenderTarget&&(p.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(p)),isEmptyObject(y)===!1&&this.setCamera(y);var q=this.works.getResolvedObserver(this.currentPano),J=A[1];if(!J){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var W=this.xrManager.referenceSpace;if(W){var re=this.xrManager.cameraVR,j=this.xrManager.cameraL,te=this.xrManager.cameraR,$=[j,te],ne=J.getViewerPose(W),ee=new THREE__namespace.Vector3(0,0,0);if(ne){var fe;fe=this.xrManager.session.renderState.baseLayer;var ie=ne.views;if(!fe){console.error("no layer found");return}this.renderer.setFramebuffer(fe.framebuffer);var se=!1;ie.length!==re.cameras.length&&(re.cameras.length=0,se=!0),this.parallaxCameraMatrixs=[];var Ae=new THREE__namespace.Vector3,he=new THREE__namespace.Vector3;new THREE__namespace.Matrix4().fromArray(ie[0].transform.matrix).decompose(Ae,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),new THREE__namespace.Matrix4().fromArray(ie[1].transform.matrix).decompose(he,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),he.clone().sub(Ae).normalize();var me=new THREE__namespace.Vector3,Z=new THREE__namespace.Quaternion,Y=new THREE__namespace.Vector3;this.camera.matrix.decompose(me,Z,Y);for(var N=0;N<ie.length;N++){var Ee=ie[N],ge=fe.getViewport(Ee),ve=$[N];ve.matrix.fromArray(Ee.transform.matrix);var xe=new THREE__namespace.Vector3,de=new THREE__namespace.Quaternion,ce=new THREE__namespace.Vector3;ve.matrix.decompose(xe,de,ce),ee.copy(me),ve.position.copy(me),ve.quaternion.copy(de),ve.scale.copy(ce),ve.updateMatrix(),ve.projectionMatrix.fromArray(Ee.projectionMatrix),ve.viewport.set(ge.x,ge.y,ge.width,ge.height),se===!0&&re.cameras.push(ve)}if(this.xrManager.session&&this.xrManager.session.inputSources){for(var N=0;N<this.xrManager.session.inputSources.length;N++)if(this.xrManager.session.inputSources[N]&&this.xrManager.session.inputSources[N].targetRayMode==="transient-pointer"){var le=J.getPose(this.xrManager.session.inputSources[N].targetRaySpace,W);if(le){var ue=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(le.transform.orientation),oe=new THREE__namespace.Raycaster(this.camera.position,ue);this.gazeRay=oe}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var Te=this.xrManager.session.inputSources,N=0;N<Te.length;N++){var Re=this.xrManager.controllers[N],Ie=Te[N];if(Ie){Re&&Re.update(Ie,J,W);var oe=this.xrManager.getController(N),lt=new THREE__namespace.Vector3(0,1.2,0),ye=oe.position.clone().add(ee).sub(lt);Ie.handedness==="left"?this.xrControllerRay.left.set(ye,new THREE__namespace.Vector3(0,0,-1).applyEuler(oe.rotation)):Ie.handedness==="right"&&this.xrControllerRay.right.set(ye,new THREE__namespace.Vector3(0,0,-1).applyEuler(oe.rotation)),this.controllerWrappers[N].position.copy(new THREE__namespace.Vector3(0,0,0).add(ee).sub(lt));var we=this.models.intersectRaycaster(this.xrControllerRay.right);if(we.length===0&&(we=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(st){var ft;return __assign({floor:(ft=q==null?void 0:q.floorIndex)!==null&&ft!==void 0?ft:0},st)})),we.length>=1&&we[0].face)if(Ie.handedness==="right"){var Be=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),Je=we[0].face.normal,ht=Je.clone(),Xe=we[0].point.clone();this.intersectMesh.position.copy(Xe);var Ve=Xe.clone().add(ht);if(this.intersectMesh.lookAt(Ve),Math.abs(Je.y)>.99){var We=this.camera.position.clone().sub(Xe);this.intersectMesh.rotation.z=-Math.atan2(We.z,We.x)}this.intersectMesh.visible=!0,this.needsRender=!0,Be.length>0?(this.pointerLines.right.setPoints(ye,Be[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(ye,we[0].point));var it=we[0],Ue=createEvent("intersect.update",{raycaster:(l=this.xrControllerRay.right)!==null&&l!==void 0?l:null,intersection:it!=null?it:null,object:this.intersectMesh});if(this.emit("intersect.update",Ue),Ue.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(ye,we[0].point)}}this.updateControllerHelper(Te,e,r)}if(this.camera.pose.distance>.1||E)for(var je=0,ze=Object.keys(this.panoMeshes);je<ze.length;je++){var He=ze[je],be=this.panoMeshes[He];be.setOpacity(0),be.setCurrent(!1),be.updateTime&&be.updateTime(e,r),be.visible=!1}else if(q){var $e=arrayMin(q.visibleIds,function(Le){var qe=i.works.getResolvedObserver(Le);return qe?q.standingPosition.distanceTo(qe.standingPosition):1/0},!0),Fe=$e[1];Fe=clamp$1(Fe,2.5,1/0);for(var et=q.visibleIds.concat(panoStringify(this.currentPano)),tt=this.getForwardObserverOrNot(),Qe=this.camera.getDirection(new THREE__namespace.Vector3),Ne=0,rt=Object.keys(this.panoMeshes);Ne<rt.length;Ne++){var He=rt[Ne],be=this.panoMeshes[He],ot=this.works.getResolvedObserver(He);if(et.indexOf(He)===-1)be.setCurrent(!1),be.setOpacity(0);else if(!ot)be.setCurrent(!1),be.setOpacity(0);else if(!ot.loadable&&!ot.active)be.setCurrent(!1),be.setOpacity(0);else{var pt=be.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);be.setCurrent(!be.loading&&be.progress===0&&tt!==null&&tt.panoId===He),be.setOpacity(pt<.01?0:clamp$1(Fe/pt*1.2,.65,.98));var ct=this.camera.position.clone().setY(be.position.y),ue=new THREE__namespace.Vector3().copy(be.position).sub(ct).normalize();if(He===panoStringify(this.currentPano)){var dt=clamp$1((.5-ct.distanceTo(be.position))/.5,0,1);ue.multiplyScalar(1-dt).add(Qe.clone().multiplyScalar(dt))}ue.length()>0&&be.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(ue.x,ue.z),0))}be.updateTime&&be.updateTime(e,r)}}var Ge=function(){return 4}(),Me=function(){var Le=new THREE__namespace.PerspectiveCamera;Le.applyMatrix4(re.matrix),Le.position.set(0,0,0);var qe=i.works.getResolvedObserver(g.panoId),st=qe!=null?qe:q;st&&Le.quaternion.premultiply(st.quaternion.clone().inverse()),Le.updateProjectionMatrix(),Le.updateMatrixWorld(!0);var ft=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(Le.projectionMatrix,Le.matrixWorldInverse));return ft}();g.panoId===panoStringify(this.currentPano)&&((d=g.leftPanoPicture)===null||d===void 0?void 0:d.map)instanceof TileCubeTextureTarget&&(g.leftPanoPicture.map.maxRequest=this.tileMaxRequest,g.leftPanoPicture.map.update(Me,Ge),g.leftPanoPicture.map.needsRender===!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0));{var _e=this.tiling.object.visible;if(this.initAnimationed){var Pe=g.panoId,ke=this.works.getResolvedObserver(Pe);ke?isSimilarVector3(this.camera.position,ke.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Pe&&this.tiling.cleanup(),this.tiling.panoId=Pe,this.tiling.setResource((m=(f=ke.images)===null||f===void 0?void 0:f.tiles)!==null&&m!==void 0?m:[],this.enableIOSEDR&&ke.images.luminance?ke.images.luminance:null),this.tiling.setFetcher(getFetcher(ke.work)),this.tiling.setRotation(ke.quaternion),this.tiling.setPosition(ke.position),this.tiling.maxRequest=this.tileMaxRequest,Ge>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(Me,Ge,e):this.tiling.update(Me,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;_e!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}}},t.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.modelScene,e),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,e),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,i){var o=this.xrControllerRay.left,s=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var u={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var l=e[c].handedness,d=e[c].gamepad;switch(l){case"left":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"LeftAxesDown",r)),d!=null&&d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"X",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"Y",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"LeftTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"LeftPinch",r));var f={raycaster:o,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:i};u.buttons.X=d.buttons&&d.buttons[4]?d.buttons[4].pressed:!1,u.buttons.Y=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,u.buttons.LeftTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,u.buttons.LeftPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1,u.left=f;break;case"right":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"RightAxesDown",r)),d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"A",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"B",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"RightTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"RightPinch",r));var m={raycaster:s,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:i};u.right=m,u.buttons.A=d.buttons&&d.buttons[4]?d==null?void 0:d.buttons[4].pressed:!1,u.buttons.B=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,u.buttons.RightTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,u.buttons.RightPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",u))}},t.prototype.emitHandleEvent=function(e,r,i){var o=this.xrControllerRay.left,s=this.xrControllerRay.right;if(e)if(this.xrHandleState[r].touchStart===!1)this.xrHandleState[r].touchStartTime=i,this.xrHandleState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:o,rightRay:s}}}));else{var u=i-this.xrHandleState[r].touchStartTime;u>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:o,rightRay:s}}}))}else if(this.xrHandleState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:o,rightRay:s}}}));var u=i-this.xrHandleState[r].touchStartTime;if(u<=CONTROLLER_EVNET_DELTA_TIME){var c=createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:o,rightRay:s}}}),l=this.emit("xr.gesture.tap",c);!l&&!c.defaultPrevented&&r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[r].touchStart=!1,this.xrHandleState[r].touchStartTime=0}},t.prototype.initHandEvent=function(){var e=this;if(!this.xrManager.session)throw new Error("初始化失败");this.xrManager.session.addEventListener("select",function(r){e.gazeRay&&e.checkSelectedPano(e.gazeRay)})},t}(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap","xr.gesture.press","xr.gesture.buttonUp","xr.gesture.buttonDown","xr.controller.update"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.emit("webXRAxesUpdate","left",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&n.emit("webXRAxesUpdate","right",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(n){{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);n.add(t)}}function parseKeyValue(n){for(var t,e,r={},i=n.split(/(\;|\,)/),o=0,s=i;o<s.length;o++){var u=s[o],c=u.split("="),l=(t=c[0])===null||t===void 0?void 0:t.trim(),d=(e=c[1])===null||e===void 0?void 0:e.trim();l&&d&&(r[l]=d)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var i=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),o=Number(i["initial-scale"]);if(!isNaN(o))return o}}return 1}const textureURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHt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4d6kX8tV+ozqAs+uYCSmO2w+jd4zGNeUYL4nqZxeN5WKVgooSAClmEaYhqhdit89QC7niSbCEM2sdkBuHYxQg9ri5ZjkuhI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=new THREE__namespace.BufferGeometry;geometry.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3)),geometry.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2)),geometry.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new THREE__namespace.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new THREE__namespace.Scene;scene.add(mesh),scene.matrixAutoUpdate=!1;var camera=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5),camera.lookAt(0,0,0),camera.updateMatrixWorld(!0),camera.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),i=n.getScissor(prevScissor),o=n.getScissorTest(),s=n.autoClear,u=i.x+imageOffset[0]/3,c=i.y+imageOffset[1]/3,l=imageSize[0]/3,d=imageSize[1]/3;n.setViewport(u,c,l,d),n.setScissor(u,c,l,d),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(i),n.setScissorTest(o),n.autoClear=s}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop$1},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=800,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},sharedVector2=new THREE__namespace.Vector2,sharedFrustum=new THREE__namespace.Frustum,sharedProjScreenMatrix=new THREE__namespace.Matrix4,clockForMixer=new WeakMap,worksMap=new WeakMap,emptyWorks=createWorks([]),Five=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s,u,c,l,d,f,m,A,h=n.call(this)||this;if(h.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[h.ident]=h),h.renderSwitch01=0,h.currentMode="Panorama",h.pano={workCode:"",panoIndex:0},h.needsRender=!1,h.modelSceneNeedsRender=!1,h.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,h.imageOptions=__assign({},(i=e.imageOptions)!==null&&i!==void 0?i:{}),h.textureOptions=__assign({},(o=e.textureOptions)!==null&&o!==void 0?o:{}),h.poweredByRealsee=(s=e.poweredByRealsee)!==null&&s!==void 0?s:!0,h.extraElements=[],h.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},h.fps={testCount:0,testTime:now()},h.info=null,h.modeChangeDuration=(u=e.modeChangeDuration)!==null&&u!==void 0?u:DEFAULT_MODE_CHANGE_DURATION,h.enableWheel=(c=e.enableWheel)!==null&&c!==void 0?c:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&h.throwError(new Error("cannot render a internal renderer")),h.renderer=e.renderer;else try{h.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,backgroundColor:e.backgroundColor,backgroundAlpha:e.backgroundAlpha,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision});var p=getViewportScale();h.renderer.setPixelRatio(p===1?window.devicePixelRatio:1),h.renderer.setSize(512,512)}catch(S){S instanceof Error&&h.throwError(S)}h.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(d=(l=h.renderer)===null||l===void 0?void 0:l.outputEncoding)!==null&&d!==void 0?d:THREE__namespace.sRGBEncoding,generateMipmaps:!1});var y=new THREE__namespace.DepthTexture(1,1);y.generateMipmaps=!1,y.format=THREE__namespace.DepthStencilFormat,y.type=THREE__namespace.UnsignedInt248Type,h.modelRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(m=(f=h.renderer)===null||f===void 0?void 0:f.outputEncoding)!==null&&m!==void 0?m:THREE__namespace.sRGBEncoding,depthTexture:y,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),h.scissor=Object.assign({left:0,bottom:0,width:1,height:1},e.scissor),h.camera=new Camera(DEFAULT_CAMERA_FOV),h.scene=new Scene,h.xrCustomObjectsScene=new THREE__namespace.Scene,h.scene.add(h.xrCustomObjectsScene),h.scene.matrixAutoUpdate=!1,h.lastLoadWorkTask=Promise.resolve(),h.requestProxy=(A=e.requestProxy)!==null&&A!==void 0?A:DEFAULT_REQUEST_PROXY,h.networkSubscribe=new NetworkSubscribe,h.networkSubscribe.on("network",function(S,I,C,H){var B;h.emit("network.resource",createEvent("network.resource",{source:S,requestType:I,requestState:C,detail:H})),(B=h.analysis)===null||B===void 0||B.network(h.works,S,I,C,H)}),h.boundingMesh=generateBoundingMesh(new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5))),h.boundingMesh.name="bounding",h.models=createModels(),h.models.push(new Model),h.lastModels=createModels(),h.lastWorks=createWorks([]),h.readyCallbacks=[],h.syncingState=!1,h.helperGroup=new THREE__namespace.Group,h.helperGroup.name="helper",h.helperGroup.matrixAutoUpdate=!1,h.scene.add(h.helperGroup),h.modelGroup=new THREE__namespace.Group,h.modelGroup.visible=!1,h.modelGroup.name="model",h.modelGroup.matrixAutoUpdate=!1,h.modelScene=new THREE__namespace.Scene,h.modelScene.add(h.modelGroup),h.modelScene.add(h.boundingMesh),h.modelScene.matrixAutoUpdate=!1,h.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement()),initLights(h.scene),initLights(h.modelScene),h.state={mode:h.currentMode,workCode:h.pano.workCode,panoIndex:h.pano.panoIndex,longitude:h.camera.pose.longitude,latitude:h.camera.pose.latitude,fov:h.camera.pose.fov,offset:h.camera.pose.offset.clone(),distance:h.camera.pose.distance},h.stateSynced=!1,h._enablePostProcessing=!1,h._enableIOSEDR=!1,h._enableEDL=!1,h._enableHQ=!1,h.destroyed=!1,h.paused=!0,typeof window!="undefined"&&(e.play!==!1&&h.play(),h.stopAnimationLoop=AnimationFrameLoop.shared.add(function(S,I){for(var C=[],H=2;H<arguments.length;H++)C[H-2]=arguments[H];h.updateTime.apply(h,__spreadArray([S,I],C,!1))},!1,0,10));var v=function(){typeof document!="undefined"&&document.fullscreenElement===null&&h.currentMode==="VRPanorama"&&h.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},g=function(){h.needsRender=!0,h.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",v,!1),h.renderer&&h.renderer.domElement.addEventListener("webglcontextrestored",g,!1),h.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",v,!1),h.renderer&&h.renderer.domElement.removeEventListener("webglcontextrestored",g,!1)},h.plugins={},e.plugins&&e.plugins.length)for(var E=0,b=e.plugins;E<b.length;E++){var T=b[E];if(typeof T=="function")T(h);else if(Array.isArray(T)){var x=T[0],R=T[1],_=T[2];if(typeof x=="function"){var M=x(h,_);typeof R=="string"&&(h.plugins[R]?h.throwError(new Error("plugin name ".concat(R," is exists."))):h.plugins[R]=M)}}}return h.gpuPickingRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{generateMipmaps:!1}),h.meshReplaceMaterialMap=new Map,h.meshOriginMaterialMap=new Map,initLegacyEvent(h),h}return Object.defineProperty(t,"version",{get:function(){return"6.2.0-alpha.11"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.getGPUPicking=function(e,r,i,o,s){var u=this;if(o===void 0&&(o=1),s===void 0&&(s=new THREE__namespace.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.models.setMaterial({constantColor:s}),this.scene.traverse(function(f){if(!(!(f instanceof THREE__namespace.Mesh)||f instanceof PBMMesh)){var m=Object.keys(i).filter(function(h){return h===f.uuid})[0];if(m)if(u.meshOriginMaterialMap.set(m,f.material),u.meshReplaceMaterialMap.get(m))f.material=u.meshReplaceMaterialMap.get(m);else{var A=new THREE__namespace.ShaderMaterial({uniforms:{color:{value:i[m]}},vertexShader:`
2061
+ `},LineMaterial=function(n){__extends(t,n);function t(e){var r=n.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return r.type="LineMaterial",r.dashed=!1,Object.defineProperties(r,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(i){this.uniforms.diffuse.value=i}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(i){this.uniforms.linewidth.value=i}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(i){this.uniforms.dashScale.value=i}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(i){this.uniforms.dashSize.value=i}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(i){this.uniforms.gapSize.value=i}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(i){this.uniforms.opacity.value=i}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(i){this.uniforms.resolution.value.copy(i)}}}),r.setValues(e),r}return t}(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=function(n){__extends(t,n);function t(e,r){var i=n.call(this)||this;return i.type="LineSegments2",i.geometry=e!==void 0?e:new LineSegmentsGeometry,i.material=r!==void 0?r:new LineMaterial({color:Math.random()*16777215}),i}return t.prototype.computeLineDistances=function(){for(var e=this.geometry,r=e.attributes.instanceStart,i=e.attributes.instanceEnd,o=new Float32Array(2*r.count),s=new THREE__namespace.Vector3,u=new THREE__namespace.Vector3,c=0,l=0,d=r.count;c<d;c++,l+=2)s.fromBufferAttribute(r,c),u.fromBufferAttribute(i,c),o[l]=l===0?0:o[l-1],o[l+1]=o[l]+s.distanceTo(u);var f=new THREE__namespace.InstancedInterleavedBuffer(o,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(f,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(f,1,1)),this},t.prototype.raycast=function(e,r){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var i=e.ray,o=e.camera,s=o.projectionMatrix,u=this.geometry,c=this.material,l=c.resolution,d=c.linewidth,f=u.attributes.instanceStart,m=u.attributes.instanceEnd,A=new THREE__namespace.Vector4,h=new THREE__namespace.Vector4,p=new THREE__namespace.Vector4,y=new THREE__namespace.Vector3,v=new THREE__namespace.Matrix4,g=new THREE__namespace.Line3,E=new THREE__namespace.Vector3;i.at(1,p),p.w=1,p.applyMatrix4(o.matrixWorldInverse),p.applyMatrix4(s),p.multiplyScalar(1/p.w),p.x*=l.x/2,p.y*=l.y/2,p.z=0,y.copy(p);var b=this.matrixWorld;v.multiplyMatrices(o.matrixWorldInverse,b);for(var T=0,x=f.count;T<x;T++){A.fromBufferAttribute(f,T),h.fromBufferAttribute(m,T),A.w=1,h.w=1,A.applyMatrix4(v),h.applyMatrix4(v),A.applyMatrix4(s),h.applyMatrix4(s),A.multiplyScalar(1/A.w),h.multiplyScalar(1/h.w);var R=A.z<-1&&h.z<-1,_=A.z>1&&h.z>1;if(!(R||_)){A.x*=l.x/2,A.y*=l.y/2,h.x*=l.x/2,h.y*=l.y/2,g.start.copy(A),g.start.z=0,g.end.copy(h),g.end.z=0;var M=g.closestPointToPointParameter(y,!0);g.at(M,E);var S=THREE__namespace.MathUtils.lerp(A.z,h.z,M),I=S>=-1&&S<=1,C=y.distanceTo(E)<d*.5;if(I&&C){g.start.fromBufferAttribute(f,T),g.end.fromBufferAttribute(m,T),g.start.applyMatrix4(b),g.end.applyMatrix4(b);var H=new THREE__namespace.Vector3,B=new THREE__namespace.Vector3;i.distanceSqToSegment(g.start,g.end,B,H),r.push({point:B,pointOnLine:H,distance:i.origin.distanceTo(B),object:this,faceIndex:T})}}}},t}(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=function(n){__extends(t,n);function t(e,r){var i=n.call(this,e,r)||this;return i.type="Line2",i}return t}(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.type="LineGeometry",e}return t.prototype.setPositions=function(e){for(var r=e.length-3,i=new Float32Array(2*r),o=0;o<r;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return n.prototype.setPositions.call(this,i),this},t.prototype.setColors=function(e){for(var r=e.length-3,i=new Float32Array(2*r),o=0;o<r;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return n.prototype.setColors.call(this,i),this},t.prototype.fromLine=function(e){var r=e.geometry;if(r instanceof THREE__namespace.Geometry){var i=new THREE__namespace.BufferGeometry().fromGeometry(r);this.setPositions(i.attributes.position.array)}else r instanceof THREE__namespace.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8Fp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haredCircleTexture=null,FiveLine=function(n){__extends(t,n);function t(e,r){e===void 0&&(e=new THREE__namespace.Vector3),r===void 0&&(r=new THREE__namespace.Vector3);var i=n.call(this)||this;i.type="FiveLine",i.needsRender=!0;var o=new LineGeometry,s=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});i.line=new Line2(o,s);var u=new THREE__namespace.BufferGeometry,c=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new THREE__namespace.TextureLoader().load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return i.points=new THREE__namespace.Points(u,c),i.points.renderOrder=11,i.points.frustumCulled=!1,i.setPoints(e,r),i.add(i.line,i.points),i}return Object.defineProperty(t,"version",{get:function(){return"6.2.0-alpha.13"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,r){var i=[].concat(e.toArray(),r.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var r=this.line.material;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];i==="dashed"?(r.dashed=o,o?r.defines.USE_DASH="":delete r.defines.USE_DASH,r.needsUpdate=!0):r[i]=e[i]}this.needsRender=!0},t.prototype.setResolution=function(e,r){var i=this.line.material.resolution;(i.x!==e||i.y!==r)&&(i.set(e,r),this.needsRender=!0)},t}(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetch(n)];case 1:if(t=e.sent(),t.ok)return[2,t.json()];throw new Error(t.statusText)}})})}function fetchProfilesList(n){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:if(!n)throw new Error("No basePath supplied");return t="profilesList.json",[4,fetchJsonFile("".concat(n,"/").concat(t))];case 1:return e=r.sent(),[2,e]}})})}function fetchProfile(n,t){return __awaiter(this,arguments,void 0,function(e,r,i,o){var s,u,c,l,d,f;return i===void 0&&(i=null),o===void 0&&(o=!0),__generator(this,function(m){switch(m.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!r)throw new Error("No basePath supplied");return[4,fetchProfilesList(r)];case 1:if(s=m.sent(),e.profiles.some(function(A){var h=s[A];return h&&(u={profileId:A,profilePath:"".concat(r,"/").concat(h.path),deprecated:!!h.deprecated}),!!u}),!u){if(!i)throw new Error("No matching profile name found");if(c=s[i],!c)throw new Error('No matching profile name found and default profile "'.concat(i,'" missing.'));u={profileId:i,profilePath:"".concat(r,"/").concat(c.path),deprecated:!!c.deprecated}}return[4,fetchJsonFile(u.profilePath)];case 2:if(l=m.sent(),o){if(f=void 0,f=l.layouts[e.handedness],!f)throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(u.profileId));f.assetPath&&(d=u.profilePath.replace("profile.json",f.assetPath))}return[2,{profile:l,assetPath:d}]}})})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(n,t){n===void 0&&(n=0),t===void 0&&(t=0);var e=n,r=t,i=Math.sqrt(n*n+t*t);if(i>1){var o=Math.atan2(t,n);e=Math.cos(o),r=Math.sin(o)}var s={normalizedXAxis:e*.5+.5,normalizedYAxis:r*.5+.5};return s}var VisualResponse=function(){function n(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return n.prototype.updateFromComponent=function(t){var e=t.xAxis,r=t.yAxis,i=t.button,o=t.state,s=normalizeAxes(e,r),u=s.normalizedXAxis,c=s.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(o)?u:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(o)?c:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(o)?i:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(o):this.value=this.states.includes(o)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},n}(),Component=function(){function n(t,e){var r=this;if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(function(i){var o=new VisualResponse(e.visualResponses[i]);r.visualResponses[i]=o}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}return Object.defineProperty(n.prototype,"data",{get:function(){var t=__assign({id:this.id},this.values);return t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(t){var e=this;if(this.values.state=Constants.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){var r=t.buttons[this.gamepadIndices.button];this.values.button=r.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,r.pressed||this.values.button===1?this.values.state=Constants.ComponentState.PRESSED:(r.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(i){i.updateFromComponent(e.values)})},n}(),MotionController=function(){function n(t,e,r){var i=this;if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=r,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(o){var s=i.layoutDescription.components[o];i.components[o]=new Component(o,s)}),this.updateFromGamepad()}return Object.defineProperty(n.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"data",{get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t},enumerable:!1,configurable:!0}),n.prototype.updateFromGamepad=function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})},n}(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=function(n){__extends(t,n);function t(){var e=n.call(this)||this;return e.motionController=null,e.envMap=null,e}return t.prototype.setEnvironmentMap=function(e){var r=this;return this.envMap==e?this:(this.envMap=e,this.traverse(function(i){i instanceof THREE__namespace.Mesh&&i.isMesh&&(i.material.envMap=r.envMap,i.material.needsUpdate=!0)}),this)},t.prototype.updateMatrixWorld=function(e){n.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(r){Object.values(r.visualResponses).forEach(function(i){var o=i.valueNode,s=i.minNode,u=i.maxNode,c=i.value,l=i.valueNodeProperty;o&&(l===Constants.VisualResponseProperty.VISIBILITY?o.visible=c:l===Constants.VisualResponseProperty.TRANSFORM&&(o.quaternion.copy(s.quaternion).slerp(u.quaternion,c),o.position.lerpVectors(s.position,u.position,c)))})}))},t}(THREE.Object3D);function findNodes(n,t){Object.values(n.components).forEach(function(e){var r=e.type,i=e.touchPointNodeName,o=e.visualResponses;if(r===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(i),e.touchPointNode){var s=new THREE.SphereGeometry(.001),u=new THREE.MeshBasicMaterial({color:255}),c=new THREE.Mesh(s,u);e.touchPointNode.add(c)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(o).forEach(function(l){var d=l.valueNodeName,f=l.minNodeName,m=l.maxNodeName,A=l.valueNodeProperty;if(A===Constants.VisualResponseProperty.TRANSFORM){if(l.minNode=t.getObjectByName(f),l.maxNode=t.getObjectByName(m),!l.minNode){console.warn("Could not find ".concat(f," in the model"));return}if(!l.maxNode){console.warn("Could not find ".concat(m," in the model"));return}}l.valueNode=t.getObjectByName(d),l.valueNode||console.warn("Could not find ".concat(d," in the model"))})})}function addAssetSceneToControllerModel(n,t){findNodes(n.motionController,t),n.envMap&&t.traverse(function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=n.envMap,e.material.needsUpdate=!0)}),n.add(t)}var XRControllerModelFactory=function(){function n(t){t===void 0&&(t=null),this.gltfLoader=t,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return n.prototype.createControllerModel=function(t){var e=this,r=new XRControllerModel,i=null;return t.addEventListener("connected",function(o){var s=o.data;s.targetRayMode!=="tracked-pointer"||!s.gamepad||fetchProfile(s,e.path,DEFAULT_PROFILE).then(function(u){var c=u.profile,l=u.assetPath;r.motionController=new MotionController(s,c,l);var d=e._assetCache[r.motionController.assetUrl];if(d)i=d.scene.clone(),addAssetSceneToControllerModel(r,i);else{if(!e.gltfLoader)throw new Error("GLTFLoader not set.");e.gltfLoader.load(r.motionController.assetUrl,function(f){e._assetCache[r.motionController.assetUrl]=f,i=f.scene.clone(),addAssetSceneToControllerModel(r,i)})}}).catch(function(u){console.warn(u)})}),t.addEventListener("disconnected",function(){r.motionController=null,r.remove(i),i=null}),r},n}();function mapPanoResource(n,t){return n}var CONTROLLER_EVNET_DELTA_TIME=300,ROTATE_Y_PI_MATRIX=new THREE__namespace.Matrix4().makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(-1,1,1),XRPanoramaController=function(n){__extends(t,n);function t(e){var r=n.call(this,e)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(c){r.emit("xr.session.start",createEvent("xr.session.start",{session:c,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.right.params.Points={threshold:.1},r.gazeRay=null,r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group];var i=r.xrManager.getController(0);r.controllerWrappers[0].add(i);var o=r.xrManager.getController(1);r.controllerWrappers[1].add(o);var s=new XRControllerModelFactory;s.gltfLoader={load:function(c,l){internalFetcher.ajax(c,{responseType:"arraybuffer"}).then(function(d){var f;return parseGltf(d.body,{resourcePath:c.slice(0,c.lastIndexOf("/")+1),search:(f=c.split("?")[1])!==null&&f!==void 0?f:"",fetcher:internalFetcher})}).then(function(d){return l(d)})}},(r.xrManager.machineType==="Oculus"||r.xrManager.machineType==="Pico")&&r.scene.add(r.pointerLines.left,r.pointerLines.right,r.controllerWrappers[0],r.controllerWrappers[1]),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade",fixCameraTransform:new THREE__namespace.Matrix4},r.parallaxCameraMatrixs=[];var u=AnimationFrameLoop.shared.getContext();return u?(r.on("xr.session.end",function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)}),r.xrManager.setSession(u),r.on("xr.session.start",function(){var c=r.xrManager.getControllerGrip(0);c.add(s.createControllerModel(c)),r.controllerWrappers[0].add(c);var l=r.xrManager.getControllerGrip(1);l.add(s.createControllerModel(l)),r.controllerWrappers[1].add(l)}),r.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},r.xrManager.machineType==="VP"&&r.initHandEvent(),r):(console.error("获取session失败,请退出重试"),r)}return t.parseArgs=function(e){if(e instanceof t)return e;var r=__assign(__assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return n.parseArgs.call(this,r)},t.initAnimationEndState=function(e){var r=this.parseArgs(e),i=n.initAnimationEndState.call(this,r);return __assign(__assign({},i),{mode:"XRPanorama"})},t.prototype.moveToPano=function(e,r,i){var o=this,s,u,c,l,d=(s=r.effect)!==null&&s!==void 0?s:"fade";this.userAction=i,this.stopMomentumMovement();var f=this.works.getResolvedObserver(e);if(!f)throw new Error("Invalid PanoIndex");var m=getImageSizeFromURL(f.images.up),A=this.imageOptions.size;typeof A=="undefined"&&f&&m&&(A=Number(m)),typeof A=="undefined"&&(A=2048);var h=this.imageOptions.transform,p=function(I,C){return mapPanoResource(applyImageURLOptions(I,h,C))},y=__assign({key:"pano.".concat(f.panoId)},pick(this.imageOptions,["format","size","quality"])),v=f.images,g=(c=(u=f.images.tiles)===null||u===void 0?void 0:u.filter(function(I){return I.size>A}))!==null&&c!==void 0?c:null,E="pano:"+jsonHash([v,y,h]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===E)return;var b=this.pendingTextureTask.panoId;(l=this.panoMeshes[b])===null||l===void 0||l.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:f.pano}))}var T=this.models.getMaterial()||{},x=T.pano0,R=T.pano1,_;if((x==null?void 0:x.map.name)===E?_=x:(R==null?void 0:R.map.name)===E&&(_=R),_){var M={panoId:f.panoId,effect:d,leftPanoPicture:{zoom:1,map:_.map,luminanceMap:_.luminanceMap,matrix:new THREE__namespace.Matrix4().compose(f.position,f.quaternion,PANO_TEXTURE_SCALE)},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};this.doMoveToPano(f.pano,M,r);return}var S="move-to-pano-"+f.panoId;this.pending.add(S),this.pendingTextureTask={panoId:f.panoId,hash:E,onLoad:function(I){if(o.pending.delete(S),o.destroyed)I.body.dispose();else{I.body.name=E;var C={panoId:f.panoId,effect:d,leftPanoPicture:{zoom:1,map:I.body,luminanceMap:null,matrix:new THREE__namespace.Matrix4().compose(f.position,f.quaternion,PANO_TEXTURE_SCALE)},position:f.position.clone(),fixCameraTransform:new THREE__namespace.Matrix4};o.doMoveToPano(f.pano,C,r)}},onError:function(I){o.pending.delete(S);var C=__assign(__assign(__assign({},f.pano),{mode:o.mode}),clonePose(o.camera.pose));o.emit("pano.error",createEvent("pano.error",{error:I,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:C})),o.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:C})),r.moveCancelCallback&&r.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&g&&g.length?this.textureLoader.loadTiledCubeTexture(v,g,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:p,options:y},format:THREE__namespace.RGBAFormat,minFilter:THREE__namespace.LinearFilter,magFilter:THREE__namespace.LinearFilter,generateMipmaps:!1,viaAjax:!0,fetcher:getFetcher(f.work)},void 0,void 0,function(I){var C,H;o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:I,meta:null,pano:f.pano})),((C=o.pendingTextureTask)===null||C===void 0?void 0:C.hash)===E&&((H=o.panoMeshes[f.panoId])===null||H===void 0||H.setProgress(I))},this.renderer):this.textureLoader.loadCubeTexture(v,{imageURL:{transform:p,options:y},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(f.work)},void 0,void 0,function(I){var C,H;((C=o.pendingTextureTask)===null||C===void 0?void 0:C.hash)===E&&((H=o.panoMeshes[f.panoId])===null||H===void 0||H.setProgress(I)),o.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:I,meta:null,pano:f.pano}))},this.renderer)]).then(function(I){var C,H,B=I[0];((C=o.pendingTextureTask)===null||C===void 0?void 0:C.hash)===E?(o.pendingTextureTask.onLoad(B),(H=o.panoMeshes[f.panoId])===null||H===void 0||H.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:B.meta,pano:f.pano}))):B.body.dispose()}).catch(function(I){var C,H;((C=o.pendingTextureTask)===null||C===void 0?void 0:C.hash)===E&&(o.pendingTextureTask.onError(I),(H=o.panoMeshes[f.panoId])===null||H===void 0||H.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.error",createEvent("pano.texture.error",{error:I,progress:0,meta:null,pano:f.pano})),o.emit("error",I))}),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:f.pano}))},t.prototype.doMoveToPano=function(e,r,i){var o=this,s,u,c,l,d,f,m,A,h,p;i===void 0&&(i={});var y=now(),v=createUuid();this.panoResources[v]=r;var g=1,E,b,T;if(this.locationMotion.ended){var x=this.locationMotion.getKeyFrameSegment(y);x[0];var R=x[1],_=this.locationMotion.value,M=this.panoResourceFromLocationMotionKeyframe(R).position,S=r.position;E=Math.max(M.distanceTo(S),g),b=[{key:R.key,progress:0,value:__assign(__assign({},_),{count:0})},{key:v,progress:1,value:{distance:0,count:1}}],T=0}else{var I=this.locationMotion.getKeyFrameSegment(y),C=I[0],R=I[1],_=this.locationMotion.value,H=this.panoResourceFromLocationMotionKeyframe(C).position,M=this.panoResourceFromLocationMotionKeyframe(R).position,S=r.position,B=R.value.count-_.count,L=Math.max(H.distanceTo(M),g)*B,O=Math.max(M.distanceTo(S),g);E=L+O,b=[{key:C.key,progress:0,value:__assign({},_)},{key:R.key,progress:L/E,value:R.value},{key:v,progress:1,value:{count:R.value.count+1,distance:0}}];var k=this.locationMotionKeyframesLength(this.locationMotion.keyframes),G=this.locationMotionKeyframesLength(b);T=this.locationMotion.getProgressVelocity(y)*k/G}var z=r.effect==="instant"?0:this.calculateMovingDuration(i.duration,r.effect==="fly"?E:0),D={longitude:i.longitude,latitude:i.latitude,fov:i.fov},U=__assign(__assign({},e),{mode:this.mode,longitude:(s=D.longitude)!==null&&s!==void 0?s:this.camera.pose.longitude,latitude:(u=D.latitude)!==null&&u!==void 0?u:this.camera.pose.latitude,fov:(c=D.fov)!==null&&c!==void 0?c:this.camera.pose.fov,offset:r.position.clone(),distance:0}),K=this.currentPano;if(this.emit("pano.moveTo",createEvent("pano.moveTo",{options:i,prevPano:K,progress:0,state:U,userAction:this.userAction,error:null})),i.moveStartCallback&&i.moveStartCallback(U),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),r.effect==="fly")this.cameraMotion.set(D,z).catch(noop$1);else{var Q=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),q=coordinatesToVector({longitude:(l=D.longitude)!==null&&l!==void 0?l:this.cameraMotion.value.longitude,latitude:(d=D.latitude)!==null&&d!==void 0?d:this.cameraMotion.value.latitude}),J=new THREE__namespace.Object3D;J.lookAt(Q);var j=new THREE__namespace.Matrix4().makeRotationFromQuaternion(J.quaternion);J.lookAt(q);var re=new THREE__namespace.Matrix4().makeRotationFromQuaternion(J.quaternion),W=new THREE__namespace.Matrix4().getInverse(j).premultiply(re),te=this.cameraMotion.value.fov,$=(f=D.fov)!==null&&f!==void 0?f:this.cameraMotion.value.fov,ne=1;r.effect==="zoomin"?ne=1.5:r.effect==="zoomout"&&(ne=.4);for(var ee=$*ne,fe=0;fe<b.length-1;fe++){var ie=b[fe].key;if(ie){var se=this.panoResources[ie];se&&(se.fixCameraTransform.copy(W),se.leftPanoPicture&&(se.leftPanoPicture.zoom=Math.tan(te/2/180*Math.PI)/Math.tan(ee/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(m=D.longitude)!==null&&m!==void 0?m:this.cameraMotion.value.longitude,latitude:(A=D.latitude)!==null&&A!==void 0?A:this.cameraMotion.value.latitude,fov:ee}},{progress:1,value:{longitude:(h=D.longitude)!==null&&h!==void 0?h:this.cameraMotion.value.longitude,latitude:(p=D.latitude)!==null&&p!==void 0?p:this.cameraMotion.value.latitude,fov:$}}],z).catch(noop$1)}var Ae=this.locationMotion.setKeyframes(b,z,T);Ae.then(function(){for(var he,me,Z,Y=0,N=o.models;Y<N.length;Y++){var Ee=N[Y];Ee.show()}var ge=__assign(__assign({},e),{mode:o.mode,longitude:o.camera.pose.longitude,latitude:o.camera.pose.latitude,fov:o.camera.pose.fov,offset:o.camera.pose.offset.clone(),distance:0});o.emit("pano.arrived",createEvent("pano.arrived",{options:i,prevPano:K,progress:1,state:ge,userAction:o.userAction,error:null})),i.moveEndCallback&&i.moveEndCallback(ge);var ve=o.works.getResolvedObserver(o.currentPano);if(ve&&ve.video&&o.videoTexture&&o.videoTexture.image instanceof HTMLVideoElement){var xe=ROTATE_Y_PI_MATRIX.clone().multiply((Z=(me=(he=o.models.getMaterial())===null||he===void 0?void 0:he.pano1)===null||me===void 0?void 0:me.matrix)!==null&&Z!==void 0?Z:new THREE__namespace.Matrix4).multiply(ve.video.matrix),de={map:o.videoTexture,size:ve.video.size,matrix:xe,alpha:1},ce=createUuid(),le=o.videoTexture.image;le.setAttribute("uuid",ce),canplayVideo().then(function(ue){ue&&ve.video&&le.getAttribute("uuid")===ce&&(le.oncanplay=function(){le.oncanplay=noop$1,le.play()},le.ontimeupdate=function(){le.currentTime>.5&&(le.ontimeupdate=noop$1,o.panoVideo.setMaterial(de))},le.src=ve.video.source)}).catch(function(){le.removeAttribute("uuid")})}},function(){o.emit("pano.cancel",createEvent("pano.cancel",{options:i,prevPano:K,progress:0,state:U,userAction:o.userAction,error:null})),i.moveCancelCallback&&i.moveCancelCallback()})},t.prototype.checkSelectedPano=function(e){var r=this,i,o,s,u;this.stopMomentumMovement();var c=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),l=null,d=this.works.getResolvedObserver(this.currentPano);if(!d)return null;var f=d.accessibleIds.filter(function(q){var J=panoParse(q);if(panoEqual(J,r.currentPano))return!1;var j=r.works.getResolvedObserver(J);return!j||j.position.distanceTo(r.camera.position)>r.maxAccessibleDistance?!1:j.loadable||j.active}),m=this.models.intersectRaycaster(e)[0];if(m){var A=arrayMin(f,function(q){var J=r.works.getResolvedObserver(q);if(!J)return 1/0;var j=J.standingPosition.clone();return j.distanceTo(m.point)},!0),h=A[0],p=A[1];h&&p<this.panoTapTriggerRadius&&(l=(i=this.works.getResolvedObserver(h))!==null&&i!==void 0?i:null)}if(isNil(l)){var y=this.getForwardObserverOrNot(e);y&&(l=y)}for(var v=0,g=this.locationMotion.keyframes;v<g.length;v++){var E=g[v],b=this.panoResourceFromLocationMotionKeyframe(E);if(!(E.progress<this.locationMotion.progress)&&l&&b.panoId===l.panoId){l=null;break}}if(isNil(l))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(l&&!l.active){var T=l.panoId;this.panoMeshes[T]&&(this.panoMeshes[T].setDisabled(!1),this.panoMeshes[T].setLoading(!0))}var x={};if(l){for(var R=Math.PI/6,_=Math.PI/12,M=new THREE__namespace.Vector3(0,1,0),S=l.position.clone().setY(0).sub(d.position.clone().setY(0)).normalize(),I=S.clone().applyAxisAngle(M,R),C=S.clone().applyAxisAngle(M,-R),H=[],B=[],L=[],O=0,k=l.accessibleIds;O<k.length;O++){var h=k[O],G=panoParse(h);if(!(panoEqual(G,this.currentPano)||panoEqual(G,l.pano))){var z=this.works.getResolvedObserver(h);if(z){var D=z.position.clone().sub(l.position).setY(0);S.angleTo(D)<R?L.push(D):I.angleTo(D)<R?H.push(D):C.angleTo(D)<R&&B.push(D)}}}var U=L.length>0?L:__spreadArray(__spreadArray([],H,!0),B,!0),K=U.slice().sort(function(q,J){return q.angleTo(S)-J.angleTo(S)})[0];K&&K.angleTo(c)>_&&(x.longitude=Math.atan2(-K.x,-K.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(x.latitude=clamp$1(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(x.fov=this.defaultFov);var Q={workCode:l.pano.workCode,panoIndex:l.pano.panoIndex,mode:this.mode,longitude:(o=x.longitude)!==null&&o!==void 0?o:this.camera.pose.longitude,latitude:(s=x.latitude)!==null&&s!==void 0?s:this.camera.pose.latitude,fov:(u=x.fov)!==null&&u!==void 0?u:this.camera.pose.fov,distance:0,offset:l?l.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:Q,userAction:!0,options:x,progress:0,error:null})),l&&l.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:Q,options:x,error:null})),l.pano):null},t.prototype.destroy=function(){n.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,r,i){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,r,i){return Promise.resolve()},t.prototype.updateTime=function(e,r){for(var i=this,o,s,u,c,l,d,f,m,A=[],h=2;h<arguments.length;h++)A[h-2]=arguments[h];this.userAction=!0;var p={},y={},v=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),E=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),y.longitude=this.cameraMotion.value.longitude,y.latitude=this.cameraMotion.value.latitude,y.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);var b=this.locationMotion.getKeyFrameSegment(e),T=b[0],x=b[1],R=this.panoResourceFromLocationMotionKeyframe(T),_=this.panoResourceFromLocationMotionKeyframe(x),M=new THREE__namespace.Vector3().copy(R.position),S=new THREE__namespace.Vector3().copy(_.position),I=this.locationMotion.value.count-x.value.count+1;p.progress=I,_.leftPanoPicture&&(I<1?R.leftPanoPicture&&(p.pano0=R.leftPanoPicture):p.pano0=_.leftPanoPicture,p.pano1=_.leftPanoPicture),_.effect==="montage"?p.transition="BLACK":_.effect==="spread"?p.transition="SPREAD":p.transition="FADE",(_.effect==="zoomin"||_.effect==="zoomout")&&(p.progress=Math.pow(I,3)),I<1&&_.effect!=="fly"&&(p.pano0&&R.leftPanoPicture&&(p.pano0={map:p.pano0.map,zoom:p.pano0.zoom,luminanceMap:p.pano0.luminanceMap,matrix:R.leftPanoPicture.matrix.clone().setPosition(_.position)}),M.copy(S),E=!0),y.distance=this.locationMotion.value.distance,y.offset=new THREE__namespace.Vector3(M.x+(S.x-M.x)*I,M.y+(S.y-M.y)*I,M.z+(S.z-M.z)*I);for(var C=[],H=[],B=0,L=this.locationMotion.keyframes;B<L.length;B++){var O=L[B],k=O.key,G=O.progress;k!==void 0&&(C.push(k),G>this.locationMotion.progress&&H.push(k))}for(var z=0,D=Object.keys(this.panoResources);z<D.length;z++){var U=D[z];if(!(H.indexOf(U)>=0)){var K=this.panoResources[U];if(K.leftPanoPicture){var Q=K.leftPanoPicture.map;if(Q){if(Q===((o=p.pano0)===null||o===void 0?void 0:o.map)||Q===((s=p.pano1)===null||s===void 0?void 0:s.map))continue;Q instanceof TileCubeTextureTarget&&Q.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(Q.cubeRenderTarget),Q.dispose(),K.leftPanoPicture=null}}C.indexOf(U)>=0||delete this.panoResources[U]}}this.currentPano=panoParse(_.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(v.panoId),state:__assign(__assign(__assign(__assign({},panoParse(g.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),y),options:{},progress:this.locationMotion.progress,error:null}))}isEmptyObject(p)===!1&&(!((u=p.pano0)===null||u===void 0)&&u.map&&p.pano0.map instanceof TileCubeTextureTarget&&!p.pano0.map.cubeRenderTarget&&(p.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),!((c=p.pano1)===null||c===void 0)&&c.map&&p.pano1.map instanceof TileCubeTextureTarget&&!p.pano1.map.cubeRenderTarget&&(p.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(p)),isEmptyObject(y)===!1&&this.setCamera(y);var q=this.works.getResolvedObserver(this.currentPano),J=A[1];if(!J){console.error("xrFrame丢失,请重试");return}if(!this.xrManager.session){console.error("session丢失,请重试");return}var j=this.xrManager.referenceSpace;if(j){var re=this.xrManager.cameraVR,W=this.xrManager.cameraL,te=this.xrManager.cameraR,$=[W,te],ne=J.getViewerPose(j),ee=new THREE__namespace.Vector3(0,0,0);if(ne){var fe;fe=this.xrManager.session.renderState.baseLayer;var ie=ne.views;if(!fe){console.error("no layer found");return}this.renderer.setFramebuffer(fe.framebuffer);var se=!1;ie.length!==re.cameras.length&&(re.cameras.length=0,se=!0),this.parallaxCameraMatrixs=[];var Ae=new THREE__namespace.Vector3,he=new THREE__namespace.Vector3;new THREE__namespace.Matrix4().fromArray(ie[0].transform.matrix).decompose(Ae,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),new THREE__namespace.Matrix4().fromArray(ie[1].transform.matrix).decompose(he,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),he.clone().sub(Ae).normalize();var me=new THREE__namespace.Vector3,Z=new THREE__namespace.Quaternion,Y=new THREE__namespace.Vector3;this.camera.matrix.decompose(me,Z,Y);for(var N=0;N<ie.length;N++){var Ee=ie[N],ge=fe.getViewport(Ee),ve=$[N];ve.matrix.fromArray(Ee.transform.matrix);var xe=new THREE__namespace.Vector3,de=new THREE__namespace.Quaternion,ce=new THREE__namespace.Vector3;ve.matrix.decompose(xe,de,ce),ee.copy(me),ve.position.copy(me),ve.quaternion.copy(de),ve.scale.copy(ce),ve.updateMatrix(),ve.projectionMatrix.fromArray(Ee.projectionMatrix),ve.viewport.set(ge.x,ge.y,ge.width,ge.height),se===!0&&re.cameras.push(ve)}if(this.xrManager.session&&this.xrManager.session.inputSources){for(var N=0;N<this.xrManager.session.inputSources.length;N++)if(this.xrManager.session.inputSources[N]&&this.xrManager.session.inputSources[N].targetRayMode==="transient-pointer"){var le=J.getPose(this.xrManager.session.inputSources[N].targetRaySpace,j);if(le){var ue=new THREE__namespace.Vector3(0,0,-1).applyQuaternion(le.transform.orientation),oe=new THREE__namespace.Raycaster(this.camera.position,ue);this.gazeRay=oe}}}if(this.xrManager.machineType==="Oculus"||this.xrManager.machineType==="Pico"){for(var Te=this.xrManager.session.inputSources,N=0;N<Te.length;N++){var Re=this.xrManager.controllers[N],Ie=Te[N];if(Ie){Re&&Re.update(Ie,J,j);var oe=this.xrManager.getController(N),lt=new THREE__namespace.Vector3(0,1.2,0),ye=oe.position.clone().add(ee).sub(lt);Ie.handedness==="left"?this.xrControllerRay.left.set(ye,new THREE__namespace.Vector3(0,0,-1).applyEuler(oe.rotation)):Ie.handedness==="right"&&this.xrControllerRay.right.set(ye,new THREE__namespace.Vector3(0,0,-1).applyEuler(oe.rotation)),this.controllerWrappers[N].position.copy(new THREE__namespace.Vector3(0,0,0).add(ee).sub(lt));var we=this.models.intersectRaycaster(this.xrControllerRay.right);if(we.length===0&&(we=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map(function(st){var ft;return __assign({floor:(ft=q==null?void 0:q.floorIndex)!==null&&ft!==void 0?ft:0},st)})),we.length>=1&&we[0].face)if(Ie.handedness==="right"){var Be=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),Je=we[0].face.normal,ht=Je.clone(),Xe=we[0].point.clone();this.intersectMesh.position.copy(Xe);var Ve=Xe.clone().add(ht);if(this.intersectMesh.lookAt(Ve),Math.abs(Je.y)>.99){var je=this.camera.position.clone().sub(Xe);this.intersectMesh.rotation.z=-Math.atan2(je.z,je.x)}this.intersectMesh.visible=!0,this.needsRender=!0,Be.length>0?(this.pointerLines.right.setPoints(ye,Be[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(ye,we[0].point));var it=we[0],Ue=createEvent("intersect.update",{raycaster:(l=this.xrControllerRay.right)!==null&&l!==void 0?l:null,intersection:it!=null?it:null,object:this.intersectMesh});if(this.emit("intersect.update",Ue),Ue.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(ye,we[0].point)}}this.updateControllerHelper(Te,e,r)}if(this.camera.pose.distance>.1||E)for(var We=0,ze=Object.keys(this.panoMeshes);We<ze.length;We++){var He=ze[We],be=this.panoMeshes[He];be.setOpacity(0),be.setCurrent(!1),be.updateTime&&be.updateTime(e,r),be.visible=!1}else if(q){var $e=arrayMin(q.visibleIds,function(Le){var qe=i.works.getResolvedObserver(Le);return qe?q.standingPosition.distanceTo(qe.standingPosition):1/0},!0),Fe=$e[1];Fe=clamp$1(Fe,2.5,1/0);for(var et=q.visibleIds.concat(panoStringify(this.currentPano)),tt=this.getForwardObserverOrNot(),Qe=this.camera.getDirection(new THREE__namespace.Vector3),Ne=0,rt=Object.keys(this.panoMeshes);Ne<rt.length;Ne++){var He=rt[Ne],be=this.panoMeshes[He],ot=this.works.getResolvedObserver(He);if(et.indexOf(He)===-1)be.setCurrent(!1),be.setOpacity(0);else if(!ot)be.setCurrent(!1),be.setOpacity(0);else if(!ot.loadable&&!ot.active)be.setCurrent(!1),be.setOpacity(0);else{var pt=be.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);be.setCurrent(!be.loading&&be.progress===0&&tt!==null&&tt.panoId===He),be.setOpacity(pt<.01?0:clamp$1(Fe/pt*1.2,.65,.98));var ct=this.camera.position.clone().setY(be.position.y),ue=new THREE__namespace.Vector3().copy(be.position).sub(ct).normalize();if(He===panoStringify(this.currentPano)){var dt=clamp$1((.5-ct.distanceTo(be.position))/.5,0,1);ue.multiplyScalar(1-dt).add(Qe.clone().multiplyScalar(dt))}ue.length()>0&&be.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(ue.x,ue.z),0))}be.updateTime&&be.updateTime(e,r)}}var Ge=function(){return 4}(),Me=function(){var Le=new THREE__namespace.PerspectiveCamera;Le.applyMatrix4(re.matrix),Le.position.set(0,0,0);var qe=i.works.getResolvedObserver(g.panoId),st=qe!=null?qe:q;st&&Le.quaternion.premultiply(st.quaternion.clone().inverse()),Le.updateProjectionMatrix(),Le.updateMatrixWorld(!0);var ft=new THREE__namespace.Frustum().setFromProjectionMatrix(new THREE__namespace.Matrix4().multiplyMatrices(Le.projectionMatrix,Le.matrixWorldInverse));return ft}();g.panoId===panoStringify(this.currentPano)&&((d=g.leftPanoPicture)===null||d===void 0?void 0:d.map)instanceof TileCubeTextureTarget&&(g.leftPanoPicture.map.maxRequest=this.tileMaxRequest,g.leftPanoPicture.map.update(Me,Ge),g.leftPanoPicture.map.needsRender===!0&&(this.needsRender=!0,this.modelSceneNeedsRender=!0));{var _e=this.tiling.object.visible;if(this.initAnimationed){var Pe=g.panoId,ke=this.works.getResolvedObserver(Pe);ke?isSimilarVector3(this.camera.position,ke.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Pe&&this.tiling.cleanup(),this.tiling.panoId=Pe,this.tiling.setResource((m=(f=ke.images)===null||f===void 0?void 0:f.tiles)!==null&&m!==void 0?m:[],this.enableIOSEDR&&ke.images.luminance?ke.images.luminance:null),this.tiling.setFetcher(getFetcher(ke.work)),this.tiling.setRotation(ke.quaternion),this.tiling.setPosition(ke.position),this.tiling.maxRequest=this.tileMaxRequest,Ge>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(Me,Ge,e):this.tiling.update(Me,0,e)):this.tiling.object.visible=!1:this.tiling.object.visible=!1}else this.tiling.object.visible=!1;_e!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0,this.modelSceneNeedsRender=!0)}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}}},t.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.modelScene,e),this.renderer.autoClearColor=!1,this.renderer.autoClearDepth=!1,this.renderer.render(this.scene,e),this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,r,i){var o=this.xrControllerRay.left,s=this.xrControllerRay.right;if(!(!e||e.length===0)){for(var u={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},c=0;c<e.length;c++){var l=e[c].handedness,d=e[c].gamepad;switch(l){case"left":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"LeftAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"LeftAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"LeftAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"LeftAxesDown",r)),d!=null&&d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"X",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"Y",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"LeftTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"LeftPinch",r));var f={raycaster:o,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:i};u.buttons.X=d.buttons&&d.buttons[4]?d.buttons[4].pressed:!1,u.buttons.Y=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,u.buttons.LeftTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,u.buttons.LeftPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1,u.left=f;break;case"right":d.axes&&(this.emitHandleEvent(d.axes[2]===-1,"RightAxesLeft",r),this.emitHandleEvent(d.axes[2]===1,"RightAxesRight",r),this.emitHandleEvent(d.axes[3]===-1,"RightAxesUp",r),this.emitHandleEvent(d.axes[3]===1,"RightAxesDown",r)),d.buttons&&(d.buttons[4]&&this.emitHandleEvent(d.buttons[4].pressed,"A",r),d.buttons[5]&&this.emitHandleEvent(d.buttons[5].pressed,"B",r),d.buttons[0]&&this.emitHandleEvent(d.buttons[0].pressed,"RightTrigger",r),d.buttons[1]&&this.emitHandleEvent(d.buttons[1].pressed,"RightPinch",r));var m={raycaster:s,axes:{up:d.axes&&d.axes[3]<0?Math.abs(d.axes[3]):0,down:d.axes&&d.axes[3]<0?0:Math.abs(d.axes[3]),left:d.axes&&d.axes[2]<0?Math.abs(d.axes[2]):0,right:d.axes&&d.axes[2]<0?0:Math.abs(d.axes[2])},deltaTime:i};u.right=m,u.buttons.A=d.buttons&&d.buttons[4]?d==null?void 0:d.buttons[4].pressed:!1,u.buttons.B=d.buttons&&d.buttons[5]?d==null?void 0:d.buttons[5].pressed:!1,u.buttons.RightTrigger=d.buttons&&d.buttons[0]?d==null?void 0:d.buttons[0].pressed:!1,u.buttons.RightPinch=d.buttons&&d.buttons[1]?d==null?void 0:d.buttons[1].pressed:!1;break}}this.emit("xr.controller.update",createEvent("xr.controller.update",u))}},t.prototype.emitHandleEvent=function(e,r,i){var o=this.xrControllerRay.left,s=this.xrControllerRay.right;if(e)if(this.xrHandleState[r].touchStart===!1)this.xrHandleState[r].touchStartTime=i,this.xrHandleState[r].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:o,rightRay:s}}}));else{var u=i-this.xrHandleState[r].touchStartTime;u>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:o,rightRay:s}}}))}else if(this.xrHandleState[r].touchStart===!0){this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:o,rightRay:s}}}));var u=i-this.xrHandleState[r].touchStartTime;if(u<=CONTROLLER_EVNET_DELTA_TIME){var c=createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:r,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:o,rightRay:s}}}),l=this.emit("xr.gesture.tap",c);!l&&!c.defaultPrevented&&r==="RightTrigger"&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[r].touchStart=!1,this.xrHandleState[r].touchStartTime=0}},t.prototype.initHandEvent=function(){var e=this;if(!this.xrManager.session)throw new Error("初始化失败");this.xrManager.session.addEventListener("select",function(r){e.gazeRay&&e.checkSelectedPano(e.gazeRay)})},t}(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap","xr.gesture.press","xr.gesture.buttonUp","xr.gesture.buttonDown","xr.controller.update"];function initLegacyEvent(n){n.on("initAnimation.start",function(t){n.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)}),n.on("initAnimation.end",function(t){n.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)}),n.on("gesture.pan",function(t){var e=!1;e=n.emit("wantsGesture","pan",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPanGesture",t.state,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pan",t.pointers,t.isFinal),n.emit("panGesture",t.state,t.isFinal))}),n.on("gesture.tap",function(t){var e=!1;e=n.emit("wantsGesture","tap",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","tap",t.pointers,t.isFinal),n.emit("tapGesture",t.center.raycaster,t.center.coords,t.isFinal))}),n.on("gesture.press",function(t){var e=!1;e=n.emit("wantsGesture","press",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","press",t.pointers,t.isFinal),n.emit("pressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),n.on("gesture.pinch",function(t){var e=!1;e=n.emit("wantsGesture","pinch",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","pinch",t.pointers,t.isFinal),n.emit("pinchGesture",t.scale,t.state.fov,t.isFinal))}),n.on("gesture.mousewheel",function(t){var e=!1;e=n.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal),e&&t.preventDefault(),e=n.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseWheel",t.pointers,t.isFinal),n.emit("mouseWheel",t.center.delta,t.state.fov,t.isFinal))}),n.on("gesture.mousemove",function(t){var e=!1;e=n.emit("wantsGesture","mouseMove",t.pointers,t.isFinal),e&&t.preventDefault(),t.defaultPrevented||(n.emit("gesture","mouseMove",t.pointers,t.isFinal),e=n.emit("wantsChangeCameraFov",t.state.fov),e&&t.preventDefault())}),n.on("gesture.momentum",function(t){var e=!1;e=n.emit("wantsInteriaPan",t.state),e&&t.preventDefault(),t.defaultPrevented||n.emit("interiaPan",t.state,t.isFinal)}),n.on("camera.update",function(t){n.emit("cameraFovUpdate",t.state.fov,t.userAction),n.emit("cameraDirectionUpdate",t.state,t.userAction);var e=coordinatesToVector(t.state);e.setLength(t.state.distance);var r=t.state.offset.clone().sub(e);n.emit("cameraPositionUpdate",r,t.userAction),n.emit("cameraUpdate",t.state,t.userAction)}),n.on("intersect.update",function(t){if(t.intersection){var e=!1;e=n.emit("wantsShowIntersectionOnModel",t.raycaster),e&&t.preventDefault(),t.defaultPrevented||n.emit("intersectionOnModelUpdate",t.intersection,t.object)}else n.emit("intersectionHidden")}),n.on("pano.request",function(t){var e=n.emit("wantsMoveToPano",t.state.panoIndex,t.options,t.userAction);e||(e=n.emit("wantsToMoveToPano",t.state.panoIndex,t.options,t.userAction)),e&&t.preventDefault(),t.defaultPrevented||n.emit("panoWillLoad",t.state.panoIndex)}),n.on("pano.select",function(t){n.emit("panoSelected",t.state.panoIndex)}),n.on("pano.moveTo",function(t){n.emit("panoLoaded",t.state.panoIndex),n.emit("moveToPano",t.state.panoIndex,t.userAction),n.emit("panoWillArrive",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.moving",function(t){n.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),n.on("pano.arrived",function(t){n.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)}),n.on("pano.cancel",function(t){n.emit("moveToPanoCanceled",t.state.panoIndex)}),n.on("pano.error",function(t){n.emit("panoLoadError",t.error,t.state.panoIndex)}),n.on("pano.texture.load",function(t){n.emit("textureStartLoad",t.pano.panoIndex)}),n.on("pano.texture.success",function(t){n.emit("textureLoaded",t.pano.panoIndex,t.meta)}),n.on("pano.texture.error",function(t){n.emit("textureError",t.error,t.pano.panoIndex)}),n.on("pano.texture.abort",function(t){n.emit("textureAbort",t.pano.panoIndex)}),n.on("pano.texture.progress",function(t){n.emit("textureLoading",t.progress,t.pano.panoIndex)}),n.on("xr.session.start",function(t){n.emit("webXRSessionStart")}),n.on("xr.session.end",function(t){n.emit("webXRSessionEnd")}),n.on("xr.gesture.tap",function(t){n.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.press",function(t){n.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonUp",function(t){n.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.gesture.buttonDown",function(t){n.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})}),n.on("xr.controller.update",function(t){n.emit("webXRControllerRayUpdate",{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&n.emit("webXRAxesUpdate","left",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&n.emit("webXRAxesUpdate","right",{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),n.on("works.request",function(t){n.emit("willLoad",t.input,t.works[0],t.state)}),n.on("works.load",function(t){n.emit("load",t.input,t.works[0],t.state)}),n.on("works.ready",function(t){n.emit("loaded",t.input,t.works[0])}),n.on("state.change",function(t){n.emit("stateChange",t.state,t.userAction)}),n.on("currentState.change",function(t){n.emit("currentStateChange",t.state,t.userAction)}),n.on("state.set",function(t){n.emit("setState",t.state)}),n.on("state.synced",function(t){n.emit("stateSynced",t.state)}),n.on("model.request",function(t){n.emit("modelWillLoad",t.work.model)}),n.on("model.error",function(t){n.emit("modelLoadError",t.error,t.model)}),n.on("model.load",function(t){n.emit("modelLoaded",t.model)}),n.on("model.changeShownFloor",function(t){n.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)}),n.on("render",function(t){n.emit("renderFrame",t.needsRender)}),n.on("mode.change.request",function(t){n.emit("wantsChangeMode",t.mode,t.prevMode)}),n.on("mode.change",function(t){n.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),n.on("helpers.visible",function(t){n.emit("helpersVisibleChange",t.object.visible)}),n.on("network.resource",function(t){n.emit("network",t.source,t.requestType,t.requestState,t.detail)})}function generateDefaultVideoElement(){if(typeof window!="undefined"){var n=document.createElement("video");n.loop=!0,n.autoplay=!0,n.playsInline=!0,n.muted=!0,n.crossOrigin="";var t=function(){document.removeEventListener("touchstart",t,!1),document.removeEventListener("mousedown",t,!1),n.muted=!1};return document.addEventListener("touchstart",t,!1),document.addEventListener("mousedown",t,!1),n}else return{}}function initLights(n){{var t=new THREE__namespace.DirectionalLight(16777215,.3);t.position.copy(new THREE__namespace.Vector3(1,1,1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);t.position.copy(new THREE__namespace.Vector3(-1,-1,-1)),n.add(t)}{var t=new THREE__namespace.DirectionalLight(16777215,.1);n.add(t)}{var t=new THREE__namespace.AmbientLight(16777215,.6);n.add(t)}}function parseKeyValue(n){for(var t,e,r={},i=n.split(/(\;|\,)/),o=0,s=i;o<s.length;o++){var u=s[o],c=u.split("="),l=(t=c[0])===null||t===void 0?void 0:t.trim(),d=(e=c[1])===null||e===void 0?void 0:e.trim();l&&d&&(r[l]=d)}return r}function getViewportScale(){var n;if(typeof document!="undefined")for(var t=document.getElementsByTagName("meta"),e=0;e<t.length;e++){var r=t[e];if(r.getAttribute("name")==="viewport"){var i=parseKeyValue((n=r.getAttribute("content"))!==null&&n!==void 0?n:""),o=Number(i["initial-scale"]);if(!isNaN(o))return o}}return 1}const textureURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/b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cvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=new THREE__namespace.BufferGeometry;geometry.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3)),geometry.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2)),geometry.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new THREE__namespace.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new THREE__namespace.Scene;scene.add(mesh),scene.matrixAutoUpdate=!1;var camera=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5),camera.lookAt(0,0,0),camera.updateMatrixWorld(!0),camera.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(n){if(material.map){var r=n.getViewport(prevViewport),i=n.getScissor(prevScissor),o=n.getScissorTest(),s=n.autoClear,u=i.x+imageOffset[0]/3,c=i.y+imageOffset[1]/3,l=imageSize[0]/3,d=imageSize[1]/3;n.setViewport(u,c,l,d),n.setScissor(u,c,l,d),n.setScissorTest(!0),n.autoClear=!1,n.render(scene,camera),n.setViewport(r),n.setScissor(i),n.setScissorTest(o),n.autoClear=s}else{var t=new THREE__namespace.Texture,e=new Image;e.onload=function(){t.image=e,t.wrapS=THREE__namespace.ClampToEdgeWrapping,t.wrapT=THREE__namespace.ClampToEdgeWrapping,t.minFilter=THREE__namespace.LinearFilter,t.needsUpdate=!0,t.generateMipmaps=!1,material.needsUpdate=!0,e.onload=noop$1},e.src=textureURL,material.map=t}}var DEFAULT_MODE_CHANGE_DURATION=800,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=function(n){return n.replace("//vrlab-public.ljcdn.com/","//vr-public.realsee-cdn.cn/").replace("//vrlab-image4.ljcdn.com/","//vr-image-4.realsee-cdn.cn/").replace("//vrlab-image3.ljcdn.com/","//vr-image-3.realsee-cdn.cn/").replace("//vrlab-image2.ljcdn.com/","//vr-image-2.realsee-cdn.cn/").replace("//vrlab-image1.ljcdn.com/","//vr-image-1.realsee-cdn.cn/")},sharedVector2=new THREE__namespace.Vector2,sharedFrustum=new THREE__namespace.Frustum,sharedProjScreenMatrix=new THREE__namespace.Matrix4,clockForMixer=new WeakMap,worksMap=new WeakMap,emptyWorks=createWorks([]),Five=function(n){__extends(t,n);function t(e){e===void 0&&(e={});var r,i,o,s,u,c,l,d,f,m,A,h=n.call(this)||this;if(h.ident=createUuid(),typeof window!="undefined"&&(__FIVE_DEBUG__.instances[h.ident]=h),h.renderSwitch01=0,h.currentMode="Panorama",h.pano={workCode:"",panoIndex:0},h.needsRender=!1,h.modelSceneNeedsRender=!1,h.onlyRenderIfNeeds=(r=e.onlyRenderIfNeeds)!==null&&r!==void 0?r:!0,h.imageOptions=__assign({},(i=e.imageOptions)!==null&&i!==void 0?i:{}),h.textureOptions=__assign({},(o=e.textureOptions)!==null&&o!==void 0?o:{}),h.poweredByRealsee=(s=e.poweredByRealsee)!==null&&s!==void 0?s:!0,h.extraElements=[],h.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},h.fps={testCount:0,testTime:now()},h.info=null,h.modeChangeDuration=(u=e.modeChangeDuration)!==null&&u!==void 0?u:DEFAULT_MODE_CHANGE_DURATION,h.enableWheel=(c=e.enableWheel)!==null&&c!==void 0?c:!0,typeof window!="undefined")if("renderer"in e)e.renderer instanceof InternalWebGLRenderer&&h.throwError(new Error("cannot render a internal renderer")),h.renderer=e.renderer;else try{h.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,backgroundColor:e.backgroundColor,backgroundAlpha:e.backgroundAlpha,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision});var p=getViewportScale();h.renderer.setPixelRatio(p===1?window.devicePixelRatio:1),h.renderer.setSize(512,512)}catch(S){S instanceof Error&&h.throwError(S)}h.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(d=(l=h.renderer)===null||l===void 0?void 0:l.outputEncoding)!==null&&d!==void 0?d:THREE__namespace.sRGBEncoding,generateMipmaps:!1});var y=new THREE__namespace.DepthTexture(1,1);y.generateMipmaps=!1,y.format=THREE__namespace.DepthStencilFormat,y.type=THREE__namespace.UnsignedInt248Type,h.modelRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:(m=(f=h.renderer)===null||f===void 0?void 0:f.outputEncoding)!==null&&m!==void 0?m:THREE__namespace.sRGBEncoding,depthTexture:y,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),h.scissor=Object.assign({left:0,bottom:0,width:1,height:1},e.scissor),h.camera=new Camera(DEFAULT_CAMERA_FOV),h.scene=new Scene,h.xrCustomObjectsScene=new THREE__namespace.Scene,h.scene.add(h.xrCustomObjectsScene),h.scene.matrixAutoUpdate=!1,h.lastLoadWorkTask=Promise.resolve(),h.requestProxy=(A=e.requestProxy)!==null&&A!==void 0?A:DEFAULT_REQUEST_PROXY,h.networkSubscribe=new NetworkSubscribe,h.networkSubscribe.on("network",function(S,I,C,H){var B;h.emit("network.resource",createEvent("network.resource",{source:S,requestType:I,requestState:C,detail:H})),(B=h.analysis)===null||B===void 0||B.network(h.works,S,I,C,H)}),h.boundingMesh=generateBoundingMesh(new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5))),h.boundingMesh.name="bounding",h.models=createModels(),h.models.push(new Model),h.lastModels=createModels(),h.lastWorks=createWorks([]),h.readyCallbacks=[],h.syncingState=!1,h.helperGroup=new THREE__namespace.Group,h.helperGroup.name="helper",h.helperGroup.matrixAutoUpdate=!1,h.scene.add(h.helperGroup),h.modelGroup=new THREE__namespace.Group,h.modelGroup.visible=!1,h.modelGroup.name="model",h.modelGroup.matrixAutoUpdate=!1,h.modelScene=new THREE__namespace.Scene,h.modelScene.add(h.modelGroup),h.modelScene.add(h.boundingMesh),h.modelScene.matrixAutoUpdate=!1,h.videoTexture=new THREE__namespace.VideoTexture(e.videoInstance||generateDefaultVideoElement()),initLights(h.scene),initLights(h.modelScene),h.state={mode:h.currentMode,workCode:h.pano.workCode,panoIndex:h.pano.panoIndex,longitude:h.camera.pose.longitude,latitude:h.camera.pose.latitude,fov:h.camera.pose.fov,offset:h.camera.pose.offset.clone(),distance:h.camera.pose.distance},h.stateSynced=!1,h._enablePostProcessing=!1,h._enableIOSEDR=!1,h._enableEDL=!1,h._enableHQ=!1,h.destroyed=!1,h.paused=!0,typeof window!="undefined"&&(e.play!==!1&&h.play(),h.stopAnimationLoop=AnimationFrameLoop.shared.add(function(S,I){for(var C=[],H=2;H<arguments.length;H++)C[H-2]=arguments[H];h.updateTime.apply(h,__spreadArray([S,I],C,!1))},!1,0,10));var v=function(){typeof document!="undefined"&&document.fullscreenElement===null&&h.currentMode==="VRPanorama"&&h.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},g=function(){h.needsRender=!0,h.modelSceneNeedsRender=!0};if(typeof document!="undefined"&&document.addEventListener("fullscreenchange",v,!1),h.renderer&&h.renderer.domElement.addEventListener("webglcontextrestored",g,!1),h.removeEventListeners=function(){typeof document!="undefined"&&document.removeEventListener("fullscreenchange",v,!1),h.renderer&&h.renderer.domElement.removeEventListener("webglcontextrestored",g,!1)},h.plugins={},e.plugins&&e.plugins.length)for(var E=0,b=e.plugins;E<b.length;E++){var T=b[E];if(typeof T=="function")T(h);else if(Array.isArray(T)){var x=T[0],R=T[1],_=T[2];if(typeof x=="function"){var M=x(h,_);typeof R=="string"&&(h.plugins[R]?h.throwError(new Error("plugin name ".concat(R," is exists."))):h.plugins[R]=M)}}}return h.gpuPickingRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{generateMipmaps:!1}),h.meshReplaceMaterialMap=new Map,h.meshOriginMaterialMap=new Map,initLegacyEvent(h),h}return Object.defineProperty(t,"version",{get:function(){return"6.2.0-alpha.13"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.getGPUPicking=function(e,r,i,o,s){var u=this;if(o===void 0&&(o=1),s===void 0&&(s=new THREE__namespace.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.models.setMaterial({constantColor:s}),this.scene.traverse(function(f){if(!(!(f instanceof THREE__namespace.Mesh)||f instanceof PBMMesh)){var m=Object.keys(i).filter(function(h){return h===f.uuid})[0];if(m)if(u.meshOriginMaterialMap.set(m,f.material),u.meshReplaceMaterialMap.get(m))f.material=u.meshReplaceMaterialMap.get(m);else{var A=new THREE__namespace.ShaderMaterial({uniforms:{color:{value:i[m]}},vertexShader:`
2062
2062
  void main() {
2063
2063
  vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
2064
2064
  gl_Position = projectionMatrix * mvPosition;
@@ -2068,4 +2068,4 @@ void main() {
2068
2068
  void main() {
2069
2069
  gl_FragColor = vec4( color, 1.0 );
2070
2070
  }
2071
- `});A.depthTest=f.material.depthTest,A.side=f.material.side,u.meshReplaceMaterialMap.set(m,A),f.material=A}}});var c=this.renderer.getSize(new THREE__namespace.Vector2);this.camera.setViewOffset(c.width,c.height,e*o,r*o,1,1),this.renderer.setRenderTarget(this.gpuPickingRenderTarget),this.render();var l=new Uint8Array(4);this.renderer.readRenderTargetPixels(this.gpuPickingRenderTarget,0,0,1,1,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),this.scene.traverse(function(f){!(f instanceof THREE__namespace.Mesh)||f instanceof PBMMesh||u.meshOriginMaterialMap.get(f.uuid)&&(f.material=u.meshOriginMaterialMap.get(f.uuid))}),this.models.setMaterial({constantColor:null});var d=Object.keys(i).filter(function(f){return i[f].equals(new THREE__namespace.Color().setRGB(l[0]/255,l[1]/255,l[2]/255))})[0];return d||!1},t.prototype.dispose=function(){var e,r;if(this.destroyed!==!0){delete __FIVE_DEBUG__.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),(e=this.renderer)===null||e===void 0||e.setAnimationLoop(null),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var i=this.getElement();i&&i.parentNode&&i.parentNode.removeChild(i);var o=this.models.getMaterial();o&&(o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((r=o.pano0)===null||r===void 0?void 0:r.map)&&o.pano1.map.dispose());for(var s=0,u=this.models;s<u.length;s++){var c=u[s];c.dispose()}this.models.length=0,this.models.setMaterial({pano0:null,pano1:null}),this.meshReplaceMaterialMap.forEach(function(l){l.dispose()}),this.meshOriginMaterialMap.forEach(function(l){l.dispose()}),this.renderer instanceof InternalWebGLRenderer&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},t.prototype.setScissor=function(e){var r;if(Object.assign(this.scissor,e),this.controller&&this.controller.updateRenderSize){var i=new THREE__namespace.Vector2;(r=this.renderer)===null||r===void 0||r.getDrawingBufferSize(i),this.controller.updateRenderSize(i)}},Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return this._enableIOSEDR},set:function(e){this._enableIOSEDR!==e&&(this._enableIOSEDR=e,this.currentMode&&this.currentMode==="Panorama"&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"postProcessingType",{get:function(){return this.currentMode==="Panorama"&&this.enableIOSEDR&&this.enablePostProcessing?"luminance":this.currentMode==="Mapview"&&this.enableEDL?"edl":this.currentMode==="Mapview"&&this.enableHQ?"hq":null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this._enableEDL},set:function(e){if(e===!0&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启EDL");this._enableEDL!==e&&(this._enableEDL=e,this.boundingMesh.visible=!e,this.needsRender=!0,this.modelSceneNeedsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this._enableHQ},set:function(e){if(e===!0&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启HQ");this._enableHQ!==e&&(this._enableHQ=e,this.boundingMesh.visible=!e,this.needsRender=!0,this.modelSceneNeedsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return this._enablePostProcessing},set:function(e){this._enablePostProcessing!==e&&(this._enablePostProcessing=e),this.needsRender=!0,this.modelSceneNeedsRender=!0},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var i=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,e.panorama),this.currentMode==="Panorama"&&(i=!0)),e.model&&(Object.assign(this.controllerInits.Model,e.model),this.currentMode==="Model"&&(i=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,e.floorplan),this.currentMode==="Floorplan"&&(i=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,e.topview),this.currentMode==="Topview"&&(i=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,e.mapview),this.currentMode==="Mapview"&&(i=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,e.vrPanorama),this.currentMode==="VRPanorama"&&(i=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode==="Panorama"||this.currentMode==="VRPanorama")&&(i=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&i&&this.controller&&this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var i=this.getElement();if(i){e.appendChild(i),this.refresh(r);var o=window.getComputedStyle(e).position;o!=="relative"&&o!=="absolute"&&o!=="fixed"&&o!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){if(e===void 0&&(e={}),!!this.renderer){var i=this.getElement();if(i){var o=i.parentNode;if(o&&o.nodeName){var s=e.width,u=s===void 0?o.offsetWidth:s,c=e.height,l=c===void 0?o.offsetHeight:c;this.renderer instanceof InternalWebGLRenderer&&(r&&this.renderer.setPixelRatio(r),this.renderer.setSize(u,l))}var d=new THREE__namespace.Vector2;this.renderer.getDrawingBufferSize(d),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize(d),this.modelRenderTarget.setSize(d.x,d.y),this.modelRenderTarget.depthTexture.dispose();var f=new THREE__namespace.DepthTexture(d.x,d.y);f.generateMipmaps=!1,f.format=THREE__namespace.DepthStencilFormat,f.type=THREE__namespace.UnsignedInt248Type,this.modelRenderTarget.depthTexture=f,this.modelRenderTarget.depthTexture.needsUpdate=!0,this.needsRender=!0,this.modelSceneNeedsRender=!0,this.render(noop$1,!0)}}},t.prototype.addExtraElement=function(e){var r=this;return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return r.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var r=this.extraElements.indexOf(e);r!==-1&&(this.extraElements.splice(r,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getPose=function(){var e=this.camera.copyPose(),r=e.longitude,i=e.latitude,o=e.fov,s=e.offset,u=e.distance;return{longitude:r,latitude:i,fov:o,offset:s.clone(),distance:u}},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.updateCamera=function(e,r,i){return i===void 0&&(i=!0),this.controller?this.controller.updateCamera(e,r,i):Promise.reject(new Error("controller is not initialized."))},t.prototype.updateCameraWithKeyframes=function(e,r,i){return i===void 0&&(i=!0),this.controller?this.controller.updateCameraWithKeyframes(e,r,i):Promise.reject(new Error("controller is not initialized."))},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose(),r=e.longitude,i=e.latitude;return{longitude:r,latitude:i}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var e=this.works.getResolvedObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;return r.position.copy(e.position),r.quaternion.copy(e.quaternion),r.scale.set(1,1,1),r.matrix.compose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1,cameraWorldToLocal(this.camera,r)}}return null},Object.defineProperty(t.prototype,"works",{get:function(){var e=worksMap.get(this);if(!e)return emptyWorks;for(var r=0,i=e;r<i.length;r++){var o=i[r];if(!workRawMapping.has(o))return emptyWorks}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.models[0]},enumerable:!1,configurable:!0}),t.prototype.load=function(e,r,i,o){var s=this;if(o===void 0&&(o=!0),!this.renderer)throw new Error("renderer is not initialized");var u=this.lastLoadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return s.load_(c,r,i,o)}):s.load_(e,r,i,o)});return this.lastLoadWorkTask=u.catch(function(c){s.throwError(c)}),u},t.prototype.load_=function(e,r,i,o){var s=this,u,c,l,d,f,m,A,h;o===void 0&&(o=!0);var p={};typeof i=="number"?p.duration=i:typeof i=="object"&&Object.assign(p,i),this.controller||(p.duration=0,p.effect="instant");var y=[];if(Array.isArray(e))for(var v=0,g=e;v<g.length;v++){var E=g[v];typeof E!="string"&&"work"in E?y.push(parseWork(E.work,E)):y.push(parseWork(E))}else y.push(parseWork(e));for(var b=createWorks(y),T=function(q){var J=x,W=new Fetcher({allowHosts:q.allowHosts,get requestProxy(){return J.requestProxy},get networkSubscribe(){return J.networkSubscribe}});registerFetcher(q,W)},x=this,R=0,_=b;R<_.length;R++){var M=_[R];T(M)}this.lastWorks=this.works,r===void 0&&(r="inherit"),r==="inherit"&&this.lastWorks.length===0&&(r="initial");var S=b.initial,I=S.work.observers[0],C=I?{workCode:I.work.workCode,panoIndex:I.panoIndex}:{workCode:S.work.workCode,panoIndex:0},H=(u=S.mode)!==null&&u!==void 0?u:I?"Panorama":"Mapview",B={};if(r==="inherit"){H=this.currentMode;var L=b.resolvedObservers[this.panoIndex];L?C={workCode:L.work.workCode,panoIndex:L.panoIndex}:typeof b.initial.panoIndex=="number"?C={workCode:b.initial.work.workCode,panoIndex:b.initial.panoIndex}:(H==="Panorama"||H==="VRPanorama"||H==="XRPanorama")&&(H="Mapview"),B={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:this.camera.pose.distance,offset:this.camera.pose.offset.clone()}}else if(r==="initial")typeof S.panoIndex=="number"&&(C={workCode:S.work.workCode,panoIndex:S.panoIndex}),S.mode&&(H=S.mode),B={longitude:S.longitude,latitude:S.latitude,fov:S.fov,distance:S.distance,offset:(c=S.offset)===null||c===void 0?void 0:c.clone()};else{if(H=(l=r.mode)!==null&&l!==void 0?l:this.currentMode,typeof r.panoIndex=="number"){var L=b.getResolvedObserver({workCode:(f=(d=r.workCode)!==null&&d!==void 0?d:S.work.workCode)!==null&&f!==void 0?f:"",panoIndex:r.panoIndex});L&&(C={workCode:L.work.workCode,panoIndex:L.panoIndex})}B={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var O=__assign(__assign(__assign({},C),{mode:H}),B);this.emit("works.request",createEvent("works.request",{input:e,works:b,state:O,userAction:o}));var k=function(){var q,J;s.pano=C;var W=(q=p.duration)!==null&&q!==void 0?q:s.modeChangeDuration,re=(J=p.effect)!==null&&J!==void 0?J:"fade",j=__assign(__assign({initial:{state:O,currentState:s.getCurrentState(),duration:W,effect:re,userAction:o}},s.commonParams()),s.controllerInits[H]);if(s.controller&&s.currentMode===H)s.controller.updateWork(b,O,{effect:re,duration:W},o)===!1&&(s.controller.destroy(),s.controller=s.applyController(H,j));else{var te=s.currentMode,$=Controllers[H].initAnimationEndState(j);if(s.controller)s.controller.destroy();else{var ne=Controllers[H].initAnimationEndState(j);s.camera.setFromPose(ne),s.modelGroup.visible=!0,s.emit("camera.update",createEvent("camera.update",{state:s.getCurrentState(),userAction:o}))}s.controller=s.applyController(H,j);var ee=createEvent("mode.change",{prevMode:te,mode:H,state:$,userAction:o});s.emit("mode.change",ee)}};if(worksMap.set(this,b),!this.controller){var G=__assign(__assign({initial:{state:O,currentState:this.getCurrentState(),duration:(m=p.duration)!==null&&m!==void 0?m:this.modeChangeDuration,effect:(A=p.effect)!==null&&A!==void 0?A:"fade",userAction:o}},this.commonParams()),this.controllerInits[H]),z=Controllers[H].initAnimationEndState(G);this.camera.setFromPose(z),this.emit("camera.update",createEvent("camera.update",{state:this.getCurrentState(),userAction:o}))}if(this.updateConfiguration(p,!1),H===t.Mode.Floorplan||H===t.Mode.Topview||H===t.Mode.Mapview||H===t.Mode.Model)this.loadModel(b,p).then(function(){s.needsRender=!0,s.modelSceneNeedsRender=!0,k(),s.emit("camera.update",createEvent("camera.update",{state:s.getCurrentState(),userAction:o}))});else{if(!this.controller){var D=new THREE__namespace.Vector3,U=b.getResolvedObserver(C);U&&D.copy(U.position),this.camera.setFromPose({fov:B.fov,longitude:B.longitude,latitude:B.latitude,distance:B.distance,offset:(h=B.offset)!==null&&h!==void 0?h:D}),this.needsRender=!0,this.modelSceneNeedsRender=!0}k();var K=!1,Q=function(){var q;s.needsRender=!0,s.modelSceneNeedsRender=!0,s.emit("camera.update",createEvent("camera.update",{state:s.getCurrentState(),userAction:o})),setTimeout(function(){s.works===b&&K===!1&&(s.loadModel(b,p),K=!0)},(q=p.duration)!==null&&q!==void 0?q:s.modeChangeDuration)};this.controller.once("pano.moveTo",Q),this.controller.once("pano.cancel",Q)}return this.emit("works.load",createEvent("works.load",{input:e,state:this.getCurrentState(),userAction:o,works:b})),this.ready().then(function(){var q;s.emit("works.ready",createEvent("works.ready",{input:e,state:s.getCurrentState(),userAction:o,works:b})),(q=s.analysis)===null||q===void 0||q.work(b)})},t.prototype.reset=function(){var e=this,r=this.lastLoadWorkTask.then(function(){return e.reset_()});return this.lastLoadWorkTask=r.catch(function(i){e.throwError(i)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var i;e.controller&&(e.controller.destroy(),e.controller=void 0);var o=e.models.getMaterial();o&&(o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((i=o.pano0)===null||i===void 0?void 0:i.map)&&o.pano1.map.dispose()),e.models.setMaterial({pano0:null,pano1:null});for(var s=0,u=e.models;s<u.length;s++){var c=u[s];e.lastModels.push(c)}if(e.models.length=0,e.lastModels.length>0){for(var l=0,d=e.lastModels;l<d.length;l++){var c=d[l];e.modelGroup.remove(c),c.dispose(),e.needsRender=!0,e.modelSceneNeedsRender=!0}e.lastModels.length=0}e.lastWorks&&delete e.lastWorks,worksMap.delete(e),e.currentMode="Panorama",e.pano={workCode:"",panoIndex:0},e.camera.setFromPose({distance:0,fov:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new THREE__namespace.Vector3(0,0,0)}),e.state={mode:e.currentMode,workCode:e.pano.workCode,panoIndex:e.pano.panoIndex,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance},e.models.needsRender=!1,e.camera.needsRender=!1,e.needsRender=!1,e.modelSceneNeedsRender=!1,r()})},t.prototype.changeMode=function(e,r,i,o,s){var u=this;return r===void 0&&(r={}),o===void 0&&(o=!0),s===void 0&&(s=!1),new Promise(function(c,l){var d,f,m,A;if(!u.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var h=0;u.controller&&(typeof i=="number"?h=i:h=(d=i==null?void 0:i.duration)!==null&&d!==void 0?d:u.modeChangeDuration);var p="fly";u.controller&&typeof i=="object"&&i.effect&&(p=i.effect);var y=typeof r.panoIndex=="number"?{workCode:(A=(f=r.workCode)!==null&&f!==void 0?f:(m=u.work)===null||m===void 0?void 0:m.workCode)!==null&&A!==void 0?A:"",panoIndex:r.panoIndex}:u.pano;if(!t.Mode.hasOwnProperty(e)){var v=new Error('mode "'.concat(e,'" is not existed'));u.throwError(v),l(v);return}if((e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&!u.models.loaded){var v=new Error("model is not ready.");u.throwError(v),l(v);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!u.works.getResolvedObserver(y)){var v=new Error("PanoId ".concat(panoStringify(y)," not existed."));u.throwError(v),l(v);return}var g=u.controller,E=u.currentMode,b=function(){if(u.controller&&u.controller.stopMomentumMovement(),u.controller&&s===!1&&E===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?panoEqual(u.pano,y)&&"moveToPano"in u.controller&&typeof u.controller.moveToPano=="function"?u.controller.moveToPano(y,__assign({duration:h},r),o):u.controller.updateCamera(r,h,o).catch(noop$1):(panoEqual(u.pano,y)||(u.pano=y),u.controller.updateCamera(r,h,o).catch(noop$1));else{var x=__assign(__assign({},r),y),R=__assign(__assign({initial:{state:x,currentState:u.getCurrentState(),duration:h,effect:p,userAction:o}},u.commonParams()),u.controllerInits[e]),_=Controllers[e].initAnimationEndState(R),M=createEvent("mode.change.request",{prevMode:u.currentMode,mode:e,state:_,userAction:o});if(u.emit("mode.change.request",M),!M.defaultPrevented){g&&g.destroy(),u.controller=u.applyController(e,R);var S=createEvent("mode.change",{prevMode:u.currentMode,mode:e,state:_,userAction:o});u.emit("mode.change",S)}}c()};if(e===t.Mode.VRPanorama)u.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return b()}).catch(function(x){x instanceof Error&&(u.exitFullscreen(),u.throwError(x),l(x))});else if(e===t.Mode.XRPanorama){var T=AnimationFrameLoop.shared.getContext();T?T.end():requestXRSessionPermission().then(function(x){AnimationFrameLoop.shared.setContext(x),b()}).catch(function(x){x instanceof Error&&(u.throwError(x),l(x))})}else b()})},t.prototype.getPixels=function(e,r,i,o,s,u,c){if(!this.renderer)throw new Error("renderer is not initialized.");var l=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),f=this.renderer.getSize(new THREE__namespace.Vector2);e=Math.ceil(e),r=Math.ceil(r),i=Math.ceil(i),o=Math.ceil(o),s=Math.ceil(s!=null?s:l),u=u!=null?u:!1;var m=this.getPixelsRenderTarget;m.setSize(i*s,o*s),this.renderer.setRenderTarget(m),this.camera.setViewOffset(f.width,f.height,e,f.height-r-o,i,o),this.camera.pixelRatio=s,this.camera.resolution.set(i,o),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height;for(var A=0,h=this.scene.children;A<h.length;A++){var p=h[A];p instanceof THREE__namespace.Object3D&&p.traverseVisible(function(I){I.setResolution&&I.setResolution(i*s/l,o*s/l)})}this.controller?(this.controller.updateRenderSize(new THREE__namespace.Vector2(i*s,o*s)),this.controller.render(!0,this.postProcessingType)):(this.renderer.render(this.scene,this.camera),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!1,this.renderer.render(this.modelScene,this.camera),this.renderer.autoClearDepth=!0,this.renderer.autoClearColor=!0);var y=i*s,v=o*s,g=y*v,E=g*4,b;try{if(c){if(c.length!==E)throw new Error("buffer length is not equals pixels ".concat(E))}else c=new Uint8Array(E);if(this.renderer.readRenderTargetPixels(m,0,0,i*s,o*s,c),u)for(var T=g/2,x=0,R=0,_=0,M=0;R<T;R++)for(M=(v-Math.floor(R/y)-1)*y+R%y,_=0;_<4;_++)x=c[R*4+_],c[R*4+_]=c[M*4+_],c[M*4+_]=x}catch(I){b=I}if(this.renderer.setRenderTarget(d),this.controller&&this.controller.updateRenderSize){var S=new THREE__namespace.Vector2;this.renderer.getDrawingBufferSize(S),this.controller.updateRenderSize(S)}if(this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,b)throw b;return c},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},Object.defineProperty(t.prototype,"observers",{get:function(){return this.works.resolvedObservers},enumerable:!1,configurable:!0}),t.prototype.render=function(e,r){var i=this;if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var o=this.renderer.getSize(sharedVector2);this.scene.traverseVisible(function(s){s.setResolution&&s.setResolution(o.x,o.y)})}return this.aroundScissor(function(){i.renderer&&(i.controller?(i.controller.render(i.onlyRenderIfNeeds?i.modelSceneNeedsRender:!0,i.postProcessingType),i.info={memory:__assign({},i.controller.renderer.info.memory),render:__assign({},i.controller.renderer.info.render)}):(i.renderer.render(i.scene,i.camera),i.info={memory:__assign({},i.renderer.info.memory),render:__assign({},i.renderer.info.render)}),i.poweredByRealsee&&i.currentMode!=="VRPanorama"&&i.currentMode!=="XRPanorama"&&i.renderer.getRenderTarget()!==i.getPixelsRenderTarget&&renderPoweredByRealsee(i.renderer)),e&&AnimationFrameLoop.shared.add(e,!0)}),null},t.prototype.updateTime=function(e,r){for(var i,o=this,s,u,c=[],l=2;l<arguments.length;l++)c[l-2]=arguments[l];if(!this.destroyed){if(this.works.update(),this.syncingState=this.syncState(e,r),this.controller&&(i=this.controller).updateTime.apply(i,__spreadArray([e,r],c,!1)),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.updateTime(e,r),this.renderer){ktx2.detectSupport(this.renderer);var d=this.models.loaded,f=this.models.refined;if(this.models.update(this.renderer,this.camera,this.currentMode),d===!1&&this.models.loaded===!0&&this.emit("models.load",createEvent("models.load",{models:this.models})),f===!1&&this.models.refined===!0&&this.emit("models.refined",createEvent("models.refined",{models:this.models})),this.models.loaded){for(var m=0,A=this.models;m<A.length;m++){var h=A[m];h.parent!==this.modelGroup&&(this.modelGroup.add(h),this.needsRender=!0,this.modelSceneNeedsRender=!0)}if(this.lastModels.length>0){for(var p=0,y=this.lastModels;p<y.length;p++){var h=y[p];this.modelGroup.remove(h),h.dispose(),this.needsRender=!0,this.modelSceneNeedsRender=!0}this.lastModels.length=0}this.lastWorks&&delete this.lastWorks}this.lastModels.setMaterial(this.models.getMaterial()),this.lastModels.materialVersion=this.models.materialVersion,this.lastModels.update(this.renderer,this.camera,this.currentMode)}this.syncingState=!1;var v=new THREE__namespace.Vector2(512,512),g=new THREE__namespace.Vector2(512,512);this.renderer&&(this.renderer.getSize(v),v.x*=this.scissor.width,v.y*=this.scissor.height,this.renderer.getDrawingBufferSize(g),g.x*=this.scissor.width,g.y*=this.scissor.height);{for(var E=new THREE__namespace.Box3,b=new THREE__namespace.Box3,T=new THREE__namespace.Vector3(4,4,4),x=0,R=this.works.resolvedObservers;x<R.length;x++){var _=R[x];b.setFromCenterAndSize(_.position,T),E.union(b)}if(E.union(this.models.bounding),this.lastWorks)for(var M=0,S=this.lastWorks.resolvedObservers;M<S.length;M++){var _=S[M];b.setFromCenterAndSize(_.position,T),E.union(b)}E.union(this.lastModels.bounding),E.getCenter(this.boundingMesh.position),E.getSize(this.boundingMesh.scale),this.boundingMesh.boundingBox.copy(E);var I=(s=this.models.getMaterial())!==null&&s!==void 0?s:{},C=1-((u=I.modelAlpha)!==null&&u!==void 0?u:0);I.opacity=clamp$1(C*4-3,0,1),I.clippers=null,I.shownFloorIndex=-2,this.boundingMesh.setMaterial(I),this.boundingMesh.needsRender=!1}var H=createEvent("render.prepare",{needsRender:!0,info:null});if(this.emit("render.prepare",H),!H.defaultPrevented){var B=[];sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix);for(var L=0,O=this.scene.children;L<O.length;L++){var k=O[L];k!==this.modelGroup&&k!==this.boundingMesh&&k instanceof THREE__namespace.Object3D&&k.traverseVisible(function(Q){if(Q.setResolution&&Q.setResolution(v.x,v.y),Q.setTime&&Q.setTime(e),Q.mixer instanceof THREE__namespace.AnimationMixer){var q=clockForMixer.get(Q.mixer);q||(q=new THREE__namespace.Clock,clockForMixer.set(Q.mixer,q)),Q.mixer.update(q.getDelta())}(Q instanceof THREE__namespace.Mesh||Q instanceof THREE__namespace.Line||Q instanceof THREE__namespace.Points)&&(Q instanceof THREE__namespace.ImmediateRenderObject||!Q.frustumCulled||sharedFrustum.intersectsObject(Q))&&B.push(Q)})}if(g.width*g.height>4096*2048?this.renderSwitch01=this.renderSwitch01^1:this.renderSwitch01=0,this.renderer&&this.paused===!1&&this.renderSwitch01===0){var G=void 0;if(this.onlyRenderIfNeeds!==!0)G=this.render();else{if(this.controller&&(this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.controller.modelSceneNeedsRender===!0&&(this.controller.modelSceneNeedsRender=!1,this.modelSceneNeedsRender=!0)),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.models.needsRender===!0&&(this.models.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.needsRender!==!0)for(var z=0,D=B;z<D.length;z++){var U=D[z],K=function(Q){Q.needsRender===!0?(Q.needsRender=!1,o.needsRender=!0):Q.mixer&&Q.mixer.stats.actions.inUse>0&&(o.needsRender=!0)};K(U),U.traverseAncestors(K)}(this.needsRender!==!1||this.modelSceneNeedsRender!==!1)&&(G=this.render())}this.needsRender=!1,this.modelSceneNeedsRender=!1,this.hasListener("render")&&this.emit("render",createEvent("render",{needsRender:G!==void 0,info:this.info}))}this.needsRender=!1,this.modelSceneNeedsRender=!1}this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0)}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,i){r===void 0&&(r={}),i===void 0&&(i=!0);var o=this,s=o.controller,u=o.renderer;if(!s)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!u)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();var c=this.works.getResolvedObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var l={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in s&&typeof s.moveToPano=="function"?s.moveToPano(l,r,i):c&&(this.pano=l,this.once("initAnimation.start",function(d){r.moveStartCallback&&r.moveStartCallback(d.state)}),this.once("initAnimation.end",function(d){r.moveEndCallback&&r.moveEndCallback(d.state)}),this.changeMode(t.Mode.Panorama,r,{effect:r.effect},i)),this.ready()},t.prototype.preloadPano=function(e,r){var i=this;r===void 0&&(r=noop$1);var o=this.works.getResolvedObserver(e);if(!o)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));var s=["right","left","up","down","front","back"],u=now();return Promise.all(s.map(function(c){var l=__assign({key:"pano.".concat(o.panoId,".").concat(c)},pick(i.imageOptions,["size","format","quality","mappings"])),d=o.images[c],f=i.imageOptions.transform?i.imageOptions.transform(d,l):imageURL(d,l);return getFetcher(o.work).preload(f)})).then(function(){var c=now()-u;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(this.models.length>0&&r){var i=this.camera.position,o=e.clone().sub(i),s=new THREE__namespace.Raycaster(i,o.clone().normalize());s.params.Points={threshold:.1};var u=this.models.intersectRaycaster(s)[0];if(u&&u.distance+.01<o.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var l=this.renderer.getSize(new THREE__namespace.Vector2),d=l.x*this.scissor.width,f=l.y*this.scissor.height,m=l.x*this.scissor.left+(c.x+1)/2*d,A=l.y*(1-this.scissor.bottom-this.scissor.height)+(-c.y+1)/2*f;return new THREE__namespace.Vector2(m,A)},t.prototype.getRenderObjects=function(e){sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix),e||(e=this.scene);var r=[];return e.traverseVisible(function(i){(i instanceof THREE__namespace.Mesh||i instanceof THREE__namespace.Line||i instanceof THREE__namespace.Points)&&(i instanceof THREE__namespace.ImmediateRenderObject||!i.frustumCulled||sharedFrustum.intersectsObject(i))&&r.push(i)}),r},t.prototype.getCurrentState=function(){return __assign(__assign({},this.getPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,i){var o,s,u,c,l,d,f,m,A,h;r===void 0&&(r=!1),i===void 0&&(i=!0),e=Object.assign({},e),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var p;typeof e.panoIndex=="number"&&(e.workCode?p={workCode:e.workCode,panoIndex:e.panoIndex}:p={workCode:(s=(o=this.work)===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:e.panoIndex});var y=(u=e.mode)!==null&&u!==void 0?u:this.state.mode,v,g,E,b,T;if((e.mode===t.Mode.Floorplan||e.mode===t.Mode.Topview||e.mode===t.Mode.Mapview||e.mode===t.Mode.Model)&&!this.models.loaded){this.throwError(new Error("model is not ready."));return}if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==y){if(y==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var x={workCode:p==null?void 0:p.workCode,panoIndex:p==null?void 0:p.panoIndex};typeof e.longitude=="number"&&(x.longitude=e.longitude),typeof e.latitude=="number"&&(x.latitude=e.latitude),typeof e.fov=="number"&&(x.fov=e.fov),typeof e.distance=="number"&&(x.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(x.offset=e.offset);var R=__assign(__assign({initial:{state:x,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[y]),_=Controllers[y].initAnimationEndState(R);v=_.longitude,g=_.latitude,E=_.fov,b=_.offset,T=_.distance}else v=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,g=(l=e.latitude)!==null&&l!==void 0?l:this.state.latitude,E=(d=e.fov)!==null&&d!==void 0?d:this.state.fov,b=(f=e.offset)!==null&&f!==void 0?f:this.state.offset,T=(m=e.distance)!==null&&m!==void 0?m:this.state.distance;var M={workCode:(p!=null?p:this.pano).workCode,panoIndex:(p!=null?p:this.pano).panoIndex,mode:y,longitude:v,latitude:g,fov:E,offset:b,distance:T};this.emit("state.set",createEvent("state.set",{userAction:i,state:M})),stateEqual(this.state,M)||(this.controller&&M.mode==="VRPanorama"&&M.mode!==this.state.mode?(assignState(this.state,M),this.changeMode("VRPanorama")):this.controller&&M.mode==="XRPanorama"&&M.mode!==this.state.mode?(assignState(this.state,M),this.changeMode("XRPanorama")):(assignState(this.state,M),this.controller&&i&&(this.controller.userAction=!1),r&&this.state.mode===M.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((A=this.controller)===null||A===void 0||A.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:i,state:this.state})),(h=this.analysis)===null||h===void 0||h.state(this.works,this.state)))},t.prototype.aroundScissor=function(e){if(this.renderer){if(this.state.mode==="XRPanorama"){e();return}var r=new THREE__namespace.Vector2,i=this.scissor.left!==0||this.scissor.bottom!==0||this.scissor.width!==1||this.scissor.height!==1;if(i){this.renderer.getSize(r);var o=Math.floor(r.x*this.scissor.left),s=Math.floor(r.y*this.scissor.bottom),u=Math.floor(r.x*this.scissor.width),c=Math.floor(r.y*this.scissor.height);this.renderer.setViewport(o,s,u,c),this.renderer.setScissor(o,s,u,c),this.renderer.setScissorTest(!0)}e(),i&&(this.renderer.setViewport(0,0,r.x,r.y),this.renderer.setScissor(0,0,r.x,r.y),this.renderer.setScissorTest(!1))}},t.prototype.syncState=function(e,r,i){i===void 0&&(i=!1);var o=this.stateSynced;if(this.stateSynced=!1,this.works.length===0||!this.controller)return!1;if(this.state.mode!==this.currentMode){var s={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,s,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var u={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},u),{duration:i?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var u={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,u,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var l=1,d=.2,f=.2,m=Math.PI/45,A=i?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,l),h=Math.abs(this.camera.pose.distance-this.state.distance),p=h>f*15?h/15:d,y=i?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,p),v=this.camera.pose.offset.distanceTo(this.state.offset),g=v>f*15?v/15:f,E=i?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,g),b=i?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},m),T=b.longitude,x=b.latitude;if(notSimilarValue(A,this.camera.pose.fov)||notSimilarVector3(E,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(T,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(x,this.camera.pose.latitude)){var R={x:E.x,y:E.y,z:E.z},_={fov:A};return Object.assign(R,{distance:y}),Object.assign(_,{longitude:T,latitude:x}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(_,0).catch(noop$1),this.controller.locationMotion.set(R,0).catch(noop$1),!0}}else{var M=1,S=Math.PI/45,A=i?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,M),I=i?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},S),T=I.longitude,x=I.latitude,y=this.state.distance,E=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(E,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(T,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(x,this.camera.pose.latitude)||notSimilarValue(A,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:T,latitude:x,fov:A},0).catch(noop$1),!0}if(this.stateSynced=!0,o===!1&&this.emit("state.synced",createEvent("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var C=this.currentMode,H=C===t.Mode.Floorplan||C===t.Mode.Topview||C===t.Mode.Mapview||C===t.Mode.Model;if(!H||this.models.loaded){var B=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var L=0,O=B;L<O.length;L++){var k=O[L];this.controller instanceof Controllers.Panorama&&k.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(k):k()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(i){var o;r.readyCallbacks.push(Object.assign(i,{tile:(o=e.tile)!==null&&o!==void 0?o:!1}))})},t.prototype.requestFullscreen=function(){var e;if(isMobile){var r=(e=this.getElement())===null||e===void 0?void 0:e.parentNode;r&&"requestFullscreen"in r&&typeof document!="undefined"&&document.fullscreenElement===null&&r.requestFullscreen()}},t.prototype.exitFullscreen=function(){typeof document!="undefined"&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.loadModel=function(e,r){for(var i=this,o=[],s=function(y){var v=u.models.filter(function(E){var b;return((b=E.work)===null||b===void 0?void 0:b.workCode)===y.workCode})[0];if(v)v.work=y,o.push(v);else{var g=new Model({onError:function(E){i.emit("model.error",createEvent("model.error",{work:y,model:g,error:E})),i.throwError(E)},onShownFloorChange:function(E){i.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:y,model:g,error:null}))},onLoad:function(){i.emit("model.load",createEvent("model.load",{work:y,model:g,error:null}))}});o.push(g),u.emit("model.request",createEvent("model.request",{work:y,model:g,error:null})),g.load(y,{textureOptions:u.textureOptions,"3d-tiles":r["3d-tiles"]})}},u=this,c=0,l=e;c<l.length;c++){var d=l[c];s(d)}if(this.models.length>0){for(var f=0,m=this.models;f<m.length;f++){var A=m[f];o.indexOf(A)===-1&&this.lastModels.push(A)}this.models.length=0}for(var h=0,p=o;h<p.length;h++){var A=p[h];this.models.push(A)}return this.renderer&&(this.models.loaded=!1),new Promise(function(y){i.on("models.load",function(){y()})})},t.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,boundingMesh:this.boundingMesh,camera:this.camera,renderer:this.renderer,scissor:this.scissor,element:this.getElement(),models:this.models,works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,enableIOSEDR:this._enableIOSEDR,enableEDL:this.enableEDL,enableHQ:this.enableHQ,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene,modelRenderTarget:this.modelRenderTarget}},t.prototype.applyController=function(e,r){var i=this;if(!this.renderer)throw new Error("renderer is not initialized.");e!==t.Mode.Mapview&&(this.enableEDL=!1,this.enableHQ=!1);var o=Controllers[e];this.currentMode=e;for(var s=new o(r),u=function(A){s.on(A,function(){for(var h=[],p=0;p<arguments.length;p++)h[p]=arguments[p];var y=i.emit.apply(i,__spreadArray([A],h,!1));if(y)return!1})},c=0,l=PROXY_CONTROLLER_EVENT_NAMES;c<l.length;c++){var d=l[c];u(d)}{var f=Controllers[e].initAnimationEndState(r),m=r.initial.userAction;stateEqual(this.state,f)||(assignState(this.state,f),this.emit("state.change",createEvent("state.change",{userAction:m,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:m,state:this.getCurrentState()}))}return s.on("camera.update",function(A){var h;if(i.controller){var p=i.controller.getTargetState();A.userAction&&i.syncingState===!1&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:A.userAction,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}i.emit("currentState.change",createEvent("currentState.change",{userAction:A.userAction,state:i.getCurrentState()}))}),s.on("initAnimation.start",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("initAnimation.end",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.moveTo",function(A){var h,p=A.state,y=A.userAction;i.pano={workCode:p.workCode,panoIndex:p.panoIndex},y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.arrived",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.cancel",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.moveTo",function(A){var h=A.userAction;i.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:i.getCurrentState()}))}),s.on("pano.request",function(A){i.emit("pano.request",A),A.defaultPrevented||i.moveToPano(A.state,A.options,A.userAction)}),s.on("vr.requestExit",function(){i.currentMode===t.Mode.VRPanorama&&(i.exitFullscreen(),i.changeMode(t.Mode.Panorama))}),s.on("error",function(A){return i.throwError(A)}),s},t.prototype.removeEventListeners=function(){},t.prototype.getWorkResources=function(e){var r=this,i,o=this.models.find(function(l){return l.work===e}),s=((i=o==null?void 0:o.viewLayers)!==null&&i!==void 0?i:[]).map(function(l){return l.scene});function u(l){var d=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(l);if(d){var f=String(d[1]).trim().split(".").slice(1).reverse()[0];if(f)return f}return""}function c(l,d){d===void 0&&(d=0);var f=[];if(l.content&&l.content.uri){var m=u(l.content.uri);if(m==="json"){var A=imageURL(l.content.uri,{key:"model.".concat(d)});f.push({url:A,type:"tileset"})}else if(m==="at3d"&&l.extras[m]){var A=l.content.uri;f.push({url:A,type:"model"});for(var h=l.extras[m],p=h.textureArray,y=h.textureOptions,v=0,g=p;v<g.length;v++){var E=g[v],b=__assign({key:"texture.pbm"},pick(y,["format","quality","size","sharpen","mappings"])),T=applyImageURLOptions(E,y==null?void 0:y.transform,b);f.push({url:T,type:"texture"})}}else{var A=imageURL(l.content.uri,{key:"model.".concat(d)});f.push({url:A,type:"model"})}}if(l.children)for(var x=0;x<l.children.length;x++){var R=l.children[x];f.push.apply(f,c(R,x))}return f}return Promise.all(s.map(function(l){return l.loadAllTilesets()})).then(function(){for(var l=[],d=["right","left","up","down","front","back"],f=0,m=e.observers;f<m.length;f++){for(var A=m[f],h=0,p=d;h<p.length;h++){var y=p[h],v=__assign({key:"pano.".concat(panoStringify(A.pano),".").concat(y)},pick(r.imageOptions,["size","format","quality","mappings"])),g=A.images[y],E=applyImageURLOptions(g,r.imageOptions.transform,v);l.push({url:E,type:"pano"})}if(A.images.tiles)for(var b=0,T=A.images.tiles;b<T.length;b++)for(var x=T[b],R=0,_=d;R<_.length;R++)for(var y=_[R],M=x.size,S=Math.pow(2,x.level),I=1/S,C=0;C<S;C++)for(var H=0;H<S;H++){var B="".concat(A.panoId,".").concat(y,".").concat(x.level,".").concat(C,".").concat(H),v=__assign(__assign({key:"pano_tile.".concat(B)},pick(r.imageOptions,["format","size","quality","sharpen","mappings"])),{size:x.scale>=1?void 0:M*I*x.scale,cut:[M*I*H,M*I*C,M*I,M*I]}),E=applyImageURLOptions(x[y],r.imageOptions.transform,v);l.push({url:E,type:"pano_tile"})}}for(var L=0,O=s;L<O.length;L++){var k=O[L];k.tileset.url&&l.push({url:k.tileset.url,type:"model"}),l.push.apply(l,c(k.tileset.root))}return l})},t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t.Line=null,t}(Subscribe),__FIVE_DEBUG__={instances:{},constructor:Five};typeof window!="undefined"&&Object.assign(window,{__FIVE_DEBUG__});var XRButton=function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function i(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function o(){i(),e.textContent="VR NOT SUPPORTED"}function s(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",s(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():o()}),e;var u=document.createElement("a");return window.isSecureContext===!1?(u.href=document.location.href.replace(/^http:/,"https:"),u.innerHTML="WEBXR NEEDS HTTPS"):(u.href="https://immersiveweb.dev/",u.innerHTML="WEBXR NOT AVAILABLE"),u.style.left="calc(50% - 90px)",u.style.width="180px",u.style.textDecoration="none",s(u),u},n}();exports.AnimationFrameLoop=AnimationFrameLoop,exports.Camera=Camera,exports.Fetcher=Fetcher,exports.Five=Five,exports.InternalWebGLRenderer=InternalWebGLRenderer,exports.IntersectMesh=IntersectMesh,exports.Model=Model,exports.ModelViewLayer=ModelViewLayer,exports.NetworkSubscribe=NetworkSubscribe,exports.PBMContainer=PBMContainer,exports.PBMGroup=PBMGroup,exports.PBMMesh=PBMMesh,exports.PBMMeshMaterial=PBMMeshMaterial,exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES,exports.PanoCircleMesh=PanoCircleMesh,exports.PanoCircleMeshCustom=PanoCircleMeshCustom,exports.PanoCircleMeshSolid=PanoCircleMeshSolid,exports.Scene=Scene,exports.Subscribe=Subscribe,exports.TextureLoader=TextureLoader,exports.Tile=Tile,exports.Tile3DModel=Tile3DModel,exports.TileCache=TileCache,exports.TileCubeTextureTarget=TileCubeTextureTarget,exports.TileNode=TileNode,exports.TileRequestScheduler=TileRequestScheduler,exports.Tileset=Tileset,exports.Work=Work,exports.XRButton=XRButton,exports.defaultImageURLTransform=imageURL,exports.defaultPbmParameters=defaultPbmParameters,exports.getViewportScale=getViewportScale,exports.imageSupport=imageSupport,exports.isPanoId=isPanoId,exports.loadAt3d=loadAt3d,exports.loadB3dm=loadB3dm,exports.loadDome=loadDome,exports.loadDomez=loadDomez,exports.loadGlb=loadGlb,exports.loadPbm=loadPbm,exports.loadPnts=loadPnts,exports.panoEqual=panoEqual,exports.panoParse=panoParse,exports.panoStringify=panoStringify,exports.parseWork=parseWork,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
2071
+ `});A.depthTest=f.material.depthTest,A.side=f.material.side,u.meshReplaceMaterialMap.set(m,A),f.material=A}}});var c=this.renderer.getSize(new THREE__namespace.Vector2);this.camera.setViewOffset(c.width,c.height,e*o,r*o,1,1),this.renderer.setRenderTarget(this.gpuPickingRenderTarget),this.render();var l=new Uint8Array(4);this.renderer.readRenderTargetPixels(this.gpuPickingRenderTarget,0,0,1,1,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),this.scene.traverse(function(f){!(f instanceof THREE__namespace.Mesh)||f instanceof PBMMesh||u.meshOriginMaterialMap.get(f.uuid)&&(f.material=u.meshOriginMaterialMap.get(f.uuid))}),this.models.setMaterial({constantColor:null});var d=Object.keys(i).filter(function(f){return i[f].equals(new THREE__namespace.Color().setRGB(l[0]/255,l[1]/255,l[2]/255))})[0];return d||!1},t.prototype.dispose=function(){var e,r;if(this.destroyed!==!0){delete __FIVE_DEBUG__.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),(e=this.renderer)===null||e===void 0||e.setAnimationLoop(null),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var i=this.getElement();i&&i.parentNode&&i.parentNode.removeChild(i);var o=this.models.getMaterial();o&&(o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((r=o.pano0)===null||r===void 0?void 0:r.map)&&o.pano1.map.dispose());for(var s=0,u=this.models;s<u.length;s++){var c=u[s];c.dispose()}this.models.length=0,this.models.setMaterial({pano0:null,pano1:null}),this.meshReplaceMaterialMap.forEach(function(l){l.dispose()}),this.meshOriginMaterialMap.forEach(function(l){l.dispose()}),this.renderer instanceof InternalWebGLRenderer&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},t.prototype.setScissor=function(e){var r;if(Object.assign(this.scissor,e),this.controller&&this.controller.updateRenderSize){var i=new THREE__namespace.Vector2;(r=this.renderer)===null||r===void 0||r.getDrawingBufferSize(i),this.controller.updateRenderSize(i)}},Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return this._enableIOSEDR},set:function(e){this._enableIOSEDR!==e&&(this._enableIOSEDR=e,this.currentMode&&this.currentMode==="Panorama"&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"postProcessingType",{get:function(){return this.currentMode==="Panorama"&&this.enableIOSEDR&&this.enablePostProcessing?"luminance":this.currentMode==="Mapview"&&this.enableEDL?"edl":this.currentMode==="Mapview"&&this.enableHQ?"hq":null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this._enableEDL},set:function(e){if(e===!0&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启EDL");this._enableEDL!==e&&(this._enableEDL=e,this.boundingMesh.visible=!e,this.needsRender=!0,this.modelSceneNeedsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this._enableHQ},set:function(e){if(e===!0&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启HQ");this._enableHQ!==e&&(this._enableHQ=e,this.boundingMesh.visible=!e,this.needsRender=!0,this.modelSceneNeedsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return this._enablePostProcessing},set:function(e){this._enablePostProcessing!==e&&(this._enablePostProcessing=e),this.needsRender=!0,this.modelSceneNeedsRender=!0},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e,r){r===void 0&&(r=!0);var i=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,e.panorama),this.currentMode==="Panorama"&&(i=!0)),e.model&&(Object.assign(this.controllerInits.Model,e.model),this.currentMode==="Model"&&(i=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,e.floorplan),this.currentMode==="Floorplan"&&(i=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,e.topview),this.currentMode==="Topview"&&(i=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,e.mapview),this.currentMode==="Mapview"&&(i=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,e.vrPanorama),this.currentMode==="VRPanorama"&&(i=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode==="Panorama"||this.currentMode==="VRPanorama")&&(i=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),r&&i&&this.controller&&this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)},t.prototype.appendTo=function(e,r){if(r===void 0&&(r={}),!!this.renderer){if(!(this.renderer instanceof InternalWebGLRenderer)){this.throwError(new Error("cannot call appendTo method when render a external renderer"));return}var i=this.getElement();if(i){e.appendChild(i),this.refresh(r);var o=window.getComputedStyle(e).position;o!=="relative"&&o!=="absolute"&&o!=="fixed"&&o!=="sticky"&&(e.style.position="relative")}}},t.prototype.refresh=function(e,r){if(e===void 0&&(e={}),!!this.renderer){var i=this.getElement();if(i){var o=i.parentNode;if(o&&o.nodeName){var s=e.width,u=s===void 0?o.offsetWidth:s,c=e.height,l=c===void 0?o.offsetHeight:c;this.renderer instanceof InternalWebGLRenderer&&(r&&this.renderer.setPixelRatio(r),this.renderer.setSize(u,l))}var d=new THREE__namespace.Vector2;this.renderer.getDrawingBufferSize(d),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize(d),this.modelRenderTarget.setSize(d.x,d.y),this.modelRenderTarget.depthTexture.dispose();var f=new THREE__namespace.DepthTexture(d.x,d.y);f.generateMipmaps=!1,f.format=THREE__namespace.DepthStencilFormat,f.type=THREE__namespace.UnsignedInt248Type,this.modelRenderTarget.depthTexture=f,this.modelRenderTarget.depthTexture.needsUpdate=!0,this.needsRender=!0,this.modelSceneNeedsRender=!0,this.render(noop$1,!0)}}},t.prototype.addExtraElement=function(e){var r=this;return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return r.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var r=this.extraElements.indexOf(e);r!==-1&&(this.extraElements.splice(r,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getPose=function(){var e=this.camera.copyPose(),r=e.longitude,i=e.latitude,o=e.fov,s=e.offset,u=e.distance;return{longitude:r,latitude:i,fov:o,offset:s.clone(),distance:u}},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.updateCamera=function(e,r,i){return i===void 0&&(i=!0),this.controller?this.controller.updateCamera(e,r,i):Promise.reject(new Error("controller is not initialized."))},t.prototype.updateCameraWithKeyframes=function(e,r,i){return i===void 0&&(i=!0),this.controller?this.controller.updateCameraWithKeyframes(e,r,i):Promise.reject(new Error("controller is not initialized."))},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose(),r=e.longitude,i=e.latitude;return{longitude:r,latitude:i}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var e=this.works.getResolvedObserver(this.pano);if(e){var r=new THREE__namespace.Object3D;return r.position.copy(e.position),r.quaternion.copy(e.quaternion),r.scale.set(1,1,1),r.matrix.compose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1,cameraWorldToLocal(this.camera,r)}}return null},Object.defineProperty(t.prototype,"works",{get:function(){var e=worksMap.get(this);if(!e)return emptyWorks;for(var r=0,i=e;r<i.length;r++){var o=i[r];if(!workRawMapping.has(o))return emptyWorks}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.models[0]},enumerable:!1,configurable:!0}),t.prototype.load=function(e,r,i,o){var s=this;if(o===void 0&&(o=!0),!this.renderer)throw new Error("renderer is not initialized");var u=this.lastLoadWorkTask.then(function(){return isPromise(e)?e.then(function(c){return s.load_(c,r,i,o)}):s.load_(e,r,i,o)});return this.lastLoadWorkTask=u.catch(function(c){s.throwError(c)}),u},t.prototype.load_=function(e,r,i,o){var s=this,u,c,l,d,f,m,A,h;o===void 0&&(o=!0);var p={};typeof i=="number"?p.duration=i:typeof i=="object"&&Object.assign(p,i),this.controller||(p.duration=0,p.effect="instant");var y=[];if(Array.isArray(e))for(var v=0,g=e;v<g.length;v++){var E=g[v];typeof E!="string"&&"work"in E?y.push(parseWork(E.work,E)):y.push(parseWork(E))}else y.push(parseWork(e));for(var b=createWorks(y),T=function(q){var J=x,j=new Fetcher({allowHosts:q.allowHosts,get requestProxy(){return J.requestProxy},get networkSubscribe(){return J.networkSubscribe}});registerFetcher(q,j)},x=this,R=0,_=b;R<_.length;R++){var M=_[R];T(M)}this.lastWorks=this.works,r===void 0&&(r="inherit"),r==="inherit"&&this.lastWorks.length===0&&(r="initial");var S=b.initial,I=S.work.observers[0],C=I?{workCode:I.work.workCode,panoIndex:I.panoIndex}:{workCode:S.work.workCode,panoIndex:0},H=(u=S.mode)!==null&&u!==void 0?u:I?"Panorama":"Mapview",B={};if(r==="inherit"){H=this.currentMode;var L=b.resolvedObservers[this.panoIndex];L?C={workCode:L.work.workCode,panoIndex:L.panoIndex}:typeof b.initial.panoIndex=="number"?C={workCode:b.initial.work.workCode,panoIndex:b.initial.panoIndex}:(H==="Panorama"||H==="VRPanorama"||H==="XRPanorama")&&(H="Mapview"),B={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:this.camera.pose.distance,offset:this.camera.pose.offset.clone()}}else if(r==="initial")typeof S.panoIndex=="number"&&(C={workCode:S.work.workCode,panoIndex:S.panoIndex}),S.mode&&(H=S.mode),B={longitude:S.longitude,latitude:S.latitude,fov:S.fov,distance:S.distance,offset:(c=S.offset)===null||c===void 0?void 0:c.clone()};else{if(H=(l=r.mode)!==null&&l!==void 0?l:this.currentMode,typeof r.panoIndex=="number"){var L=b.getResolvedObserver({workCode:(f=(d=r.workCode)!==null&&d!==void 0?d:S.work.workCode)!==null&&f!==void 0?f:"",panoIndex:r.panoIndex});L&&(C={workCode:L.work.workCode,panoIndex:L.panoIndex})}B={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset}}var O=__assign(__assign(__assign({},C),{mode:H}),B);this.emit("works.request",createEvent("works.request",{input:e,works:b,state:O,userAction:o}));var k=function(){var q,J;s.pano=C;var j=(q=p.duration)!==null&&q!==void 0?q:s.modeChangeDuration,re=(J=p.effect)!==null&&J!==void 0?J:"fade",W=__assign(__assign({initial:{state:O,currentState:s.getCurrentState(),duration:j,effect:re,userAction:o}},s.commonParams()),s.controllerInits[H]);if(s.controller&&s.currentMode===H)s.controller.updateWork(b,O,{effect:re,duration:j},o)===!1&&(s.controller.destroy(),s.controller=s.applyController(H,W));else{var te=s.currentMode,$=Controllers[H].initAnimationEndState(W);if(s.controller)s.controller.destroy();else{var ne=Controllers[H].initAnimationEndState(W);s.camera.setFromPose(ne),s.modelGroup.visible=!0,s.emit("camera.update",createEvent("camera.update",{state:s.getCurrentState(),userAction:o}))}s.controller=s.applyController(H,W);var ee=createEvent("mode.change",{prevMode:te,mode:H,state:$,userAction:o});s.emit("mode.change",ee)}};if(worksMap.set(this,b),!this.controller){var G=__assign(__assign({initial:{state:O,currentState:this.getCurrentState(),duration:(m=p.duration)!==null&&m!==void 0?m:this.modeChangeDuration,effect:(A=p.effect)!==null&&A!==void 0?A:"fade",userAction:o}},this.commonParams()),this.controllerInits[H]),z=Controllers[H].initAnimationEndState(G);this.camera.setFromPose(z),this.emit("camera.update",createEvent("camera.update",{state:this.getCurrentState(),userAction:o}))}if(this.updateConfiguration(p,!1),H===t.Mode.Floorplan||H===t.Mode.Topview||H===t.Mode.Mapview||H===t.Mode.Model)this.loadModel(b,p).then(function(){s.needsRender=!0,s.modelSceneNeedsRender=!0,k(),s.emit("camera.update",createEvent("camera.update",{state:s.getCurrentState(),userAction:o}))});else{if(!this.controller){var D=new THREE__namespace.Vector3,U=b.getResolvedObserver(C);U&&D.copy(U.position),this.camera.setFromPose({fov:B.fov,longitude:B.longitude,latitude:B.latitude,distance:B.distance,offset:(h=B.offset)!==null&&h!==void 0?h:D}),this.needsRender=!0,this.modelSceneNeedsRender=!0}k();var K=!1,Q=function(){var q;s.needsRender=!0,s.modelSceneNeedsRender=!0,s.emit("camera.update",createEvent("camera.update",{state:s.getCurrentState(),userAction:o})),setTimeout(function(){s.works===b&&K===!1&&(s.loadModel(b,p),K=!0)},(q=p.duration)!==null&&q!==void 0?q:s.modeChangeDuration)};this.controller.once("pano.moveTo",Q),this.controller.once("pano.cancel",Q)}return this.emit("works.load",createEvent("works.load",{input:e,state:this.getCurrentState(),userAction:o,works:b})),this.ready().then(function(){var q;s.emit("works.ready",createEvent("works.ready",{input:e,state:s.getCurrentState(),userAction:o,works:b})),(q=s.analysis)===null||q===void 0||q.work(b)})},t.prototype.reset=function(){var e=this,r=this.lastLoadWorkTask.then(function(){return e.reset_()});return this.lastLoadWorkTask=r.catch(function(i){e.throwError(i)}),r},t.prototype.reset_=function(){var e=this;return new Promise(function(r){var i;e.controller&&(e.controller.destroy(),e.controller=void 0);var o=e.models.getMaterial();o&&(o.pano0&&o.pano0.map.dispose(),o.pano1&&o.pano1.map!==((i=o.pano0)===null||i===void 0?void 0:i.map)&&o.pano1.map.dispose()),e.models.setMaterial({pano0:null,pano1:null});for(var s=0,u=e.models;s<u.length;s++){var c=u[s];e.lastModels.push(c)}if(e.models.length=0,e.lastModels.length>0){for(var l=0,d=e.lastModels;l<d.length;l++){var c=d[l];e.modelGroup.remove(c),c.dispose(),e.needsRender=!0,e.modelSceneNeedsRender=!0}e.lastModels.length=0}e.lastWorks&&delete e.lastWorks,worksMap.delete(e),e.currentMode="Panorama",e.pano={workCode:"",panoIndex:0},e.camera.setFromPose({distance:0,fov:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new THREE__namespace.Vector3(0,0,0)}),e.state={mode:e.currentMode,workCode:e.pano.workCode,panoIndex:e.pano.panoIndex,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance},e.models.needsRender=!1,e.camera.needsRender=!1,e.needsRender=!1,e.modelSceneNeedsRender=!1,r()})},t.prototype.changeMode=function(e,r,i,o,s){var u=this;return r===void 0&&(r={}),o===void 0&&(o=!0),s===void 0&&(s=!1),new Promise(function(c,l){var d,f,m,A;if(!u.renderer)throw new Error("renderer is not initialized.");r=__assign({},r);var h=0;u.controller&&(typeof i=="number"?h=i:h=(d=i==null?void 0:i.duration)!==null&&d!==void 0?d:u.modeChangeDuration);var p="fly";u.controller&&typeof i=="object"&&i.effect&&(p=i.effect);var y=typeof r.panoIndex=="number"?{workCode:(A=(f=r.workCode)!==null&&f!==void 0?f:(m=u.work)===null||m===void 0?void 0:m.workCode)!==null&&A!==void 0?A:"",panoIndex:r.panoIndex}:u.pano;if(!t.Mode.hasOwnProperty(e)){var v=new Error('mode "'.concat(e,'" is not existed'));u.throwError(v),l(v);return}if((e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&!u.models.loaded){var v=new Error("model is not ready.");u.throwError(v),l(v);return}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!u.works.getResolvedObserver(y)){var v=new Error("PanoId ".concat(panoStringify(y)," not existed."));u.throwError(v),l(v);return}var g=u.controller,E=u.currentMode,b=function(){if(u.controller&&u.controller.stopMomentumMovement(),u.controller&&s===!1&&E===e)e===t.Mode.Panorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?panoEqual(u.pano,y)&&"moveToPano"in u.controller&&typeof u.controller.moveToPano=="function"?u.controller.moveToPano(y,__assign({duration:h},r),o):u.controller.updateCamera(r,h,o).catch(noop$1):(panoEqual(u.pano,y)||(u.pano=y),u.controller.updateCamera(r,h,o).catch(noop$1));else{var x=__assign(__assign({},r),y),R=__assign(__assign({initial:{state:x,currentState:u.getCurrentState(),duration:h,effect:p,userAction:o}},u.commonParams()),u.controllerInits[e]),_=Controllers[e].initAnimationEndState(R),M=createEvent("mode.change.request",{prevMode:u.currentMode,mode:e,state:_,userAction:o});if(u.emit("mode.change.request",M),!M.defaultPrevented){g&&g.destroy(),u.controller=u.applyController(e,R);var S=createEvent("mode.change",{prevMode:u.currentMode,mode:e,state:_,userAction:o});u.emit("mode.change",S)}}c()};if(e===t.Mode.VRPanorama)u.requestFullscreen(),requestDeviceOrientationPermission().then(function(){return b()}).catch(function(x){x instanceof Error&&(u.exitFullscreen(),u.throwError(x),l(x))});else if(e===t.Mode.XRPanorama){var T=AnimationFrameLoop.shared.getContext();T?T.end():requestXRSessionPermission().then(function(x){AnimationFrameLoop.shared.setContext(x),b()}).catch(function(x){x instanceof Error&&(u.throwError(x),l(x))})}else b()})},t.prototype.getPixels=function(e,r,i,o,s,u,c){if(!this.renderer)throw new Error("renderer is not initialized.");var l=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),f=this.renderer.getSize(new THREE__namespace.Vector2);e=Math.ceil(e),r=Math.ceil(r),i=Math.ceil(i),o=Math.ceil(o),s=Math.ceil(s!=null?s:l),u=u!=null?u:!1;var m=this.getPixelsRenderTarget;m.setSize(i*s,o*s),this.renderer.setRenderTarget(m),this.camera.setViewOffset(f.width,f.height,e,f.height-r-o,i,o),this.camera.pixelRatio=s,this.camera.resolution.set(i,o),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height;for(var A=0,h=this.scene.children;A<h.length;A++){var p=h[A];p instanceof THREE__namespace.Object3D&&p.traverseVisible(function(I){I.setResolution&&I.setResolution(i*s/l,o*s/l)})}this.controller?(this.controller.updateRenderSize(new THREE__namespace.Vector2(i*s,o*s)),this.controller.render(!0,this.postProcessingType)):(this.renderer.render(this.scene,this.camera),this.renderer.autoClearDepth=!1,this.renderer.autoClearColor=!1,this.renderer.render(this.modelScene,this.camera),this.renderer.autoClearDepth=!0,this.renderer.autoClearColor=!0);var y=i*s,v=o*s,g=y*v,E=g*4,b;try{if(c){if(c.length!==E)throw new Error("buffer length is not equals pixels ".concat(E))}else c=new Uint8Array(E);if(this.renderer.readRenderTargetPixels(m,0,0,i*s,o*s,c),u)for(var T=g/2,x=0,R=0,_=0,M=0;R<T;R++)for(M=(v-Math.floor(R/y)-1)*y+R%y,_=0;_<4;_++)x=c[R*4+_],c[R*4+_]=c[M*4+_],c[M*4+_]=x}catch(I){b=I}if(this.renderer.setRenderTarget(d),this.controller&&this.controller.updateRenderSize){var S=new THREE__namespace.Vector2;this.renderer.getDrawingBufferSize(S),this.controller.updateRenderSize(S)}if(this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,b)throw b;return c},t.prototype.getElement=function(){var e;return(e=this.renderer)===null||e===void 0?void 0:e.domElement},Object.defineProperty(t.prototype,"observers",{get:function(){return this.works.resolvedObservers},enumerable:!1,configurable:!0}),t.prototype.render=function(e,r){var i=this;if(r===void 0&&(r=!1),!this.renderer)return null;if(r){var o=this.renderer.getSize(sharedVector2);this.scene.traverseVisible(function(s){s.setResolution&&s.setResolution(o.x,o.y)})}return this.aroundScissor(function(){i.renderer&&(i.controller?(i.controller.render(i.onlyRenderIfNeeds?i.modelSceneNeedsRender:!0,i.postProcessingType),i.info={memory:__assign({},i.controller.renderer.info.memory),render:__assign({},i.controller.renderer.info.render)}):(i.renderer.render(i.scene,i.camera),i.info={memory:__assign({},i.renderer.info.memory),render:__assign({},i.renderer.info.render)}),i.poweredByRealsee&&i.currentMode!=="VRPanorama"&&i.currentMode!=="XRPanorama"&&i.renderer.getRenderTarget()!==i.getPixelsRenderTarget&&renderPoweredByRealsee(i.renderer)),e&&AnimationFrameLoop.shared.add(e,!0)}),null},t.prototype.updateTime=function(e,r){for(var i,o=this,s,u,c=[],l=2;l<arguments.length;l++)c[l-2]=arguments[l];if(!this.destroyed){if(this.works.update(),this.syncingState=this.syncState(e,r),this.controller&&(i=this.controller).updateTime.apply(i,__spreadArray([e,r],c,!1)),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.updateTime(e,r),this.renderer){ktx2.detectSupport(this.renderer);var d=this.models.loaded,f=this.models.refined;if(this.models.update(this.renderer,this.camera,this.currentMode),d===!1&&this.models.loaded===!0&&this.emit("models.load",createEvent("models.load",{models:this.models})),f===!1&&this.models.refined===!0&&this.emit("models.refined",createEvent("models.refined",{models:this.models})),this.models.loaded){for(var m=0,A=this.models;m<A.length;m++){var h=A[m];h.parent!==this.modelGroup&&(this.modelGroup.add(h),this.needsRender=!0,this.modelSceneNeedsRender=!0)}if(this.lastModels.length>0){for(var p=0,y=this.lastModels;p<y.length;p++){var h=y[p];this.modelGroup.remove(h),h.dispose(),this.needsRender=!0,this.modelSceneNeedsRender=!0}this.lastModels.length=0}this.lastWorks&&delete this.lastWorks}this.lastModels.setMaterial(this.models.getMaterial()),this.lastModels.materialVersion=this.models.materialVersion,this.lastModels.update(this.renderer,this.camera,this.currentMode)}this.syncingState=!1;var v=new THREE__namespace.Vector2(512,512),g=new THREE__namespace.Vector2(512,512);this.renderer&&(this.renderer.getSize(v),v.x*=this.scissor.width,v.y*=this.scissor.height,this.renderer.getDrawingBufferSize(g),g.x*=this.scissor.width,g.y*=this.scissor.height);{for(var E=new THREE__namespace.Box3,b=new THREE__namespace.Box3,T=new THREE__namespace.Vector3(4,4,4),x=0,R=this.works.resolvedObservers;x<R.length;x++){var _=R[x];b.setFromCenterAndSize(_.position,T),E.union(b)}if(E.union(this.models.bounding),this.lastWorks)for(var M=0,S=this.lastWorks.resolvedObservers;M<S.length;M++){var _=S[M];b.setFromCenterAndSize(_.position,T),E.union(b)}E.union(this.lastModels.bounding),E.getCenter(this.boundingMesh.position),E.getSize(this.boundingMesh.scale),this.boundingMesh.boundingBox.copy(E);var I=(s=this.models.getMaterial())!==null&&s!==void 0?s:{},C=1-((u=I.modelAlpha)!==null&&u!==void 0?u:0);I.opacity=clamp$1(C*4-3,0,1),I.clippers=null,I.shownFloorIndex=-2,this.boundingMesh.setMaterial(I),this.boundingMesh.needsRender=!1}var H=createEvent("render.prepare",{needsRender:!0,info:null});if(this.emit("render.prepare",H),!H.defaultPrevented){var B=[];sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix);for(var L=0,O=this.scene.children;L<O.length;L++){var k=O[L];k!==this.modelGroup&&k!==this.boundingMesh&&k instanceof THREE__namespace.Object3D&&k.traverseVisible(function(Q){if(Q.setResolution&&Q.setResolution(v.x,v.y),Q.setTime&&Q.setTime(e),Q.mixer instanceof THREE__namespace.AnimationMixer){var q=clockForMixer.get(Q.mixer);q||(q=new THREE__namespace.Clock,clockForMixer.set(Q.mixer,q)),Q.mixer.update(q.getDelta())}(Q instanceof THREE__namespace.Mesh||Q instanceof THREE__namespace.Line||Q instanceof THREE__namespace.Points)&&(Q instanceof THREE__namespace.ImmediateRenderObject||!Q.frustumCulled||sharedFrustum.intersectsObject(Q))&&B.push(Q)})}if(g.width*g.height>4096*2048?this.renderSwitch01=this.renderSwitch01^1:this.renderSwitch01=0,this.renderer&&this.paused===!1&&this.renderSwitch01===0){var G=void 0;if(this.onlyRenderIfNeeds!==!0)G=this.render();else{if(this.controller&&(this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.controller.modelSceneNeedsRender===!0&&(this.controller.modelSceneNeedsRender=!1,this.modelSceneNeedsRender=!0)),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.models.needsRender===!0&&(this.models.needsRender=!1,this.needsRender=!0,this.modelSceneNeedsRender=!0),this.needsRender!==!0)for(var z=0,D=B;z<D.length;z++){var U=D[z],K=function(Q){Q.needsRender===!0?(Q.needsRender=!1,o.needsRender=!0):Q.mixer&&Q.mixer.stats.actions.inUse>0&&(o.needsRender=!0)};K(U),U.traverseAncestors(K)}(this.needsRender!==!1||this.modelSceneNeedsRender!==!1)&&(G=this.render())}this.needsRender=!1,this.modelSceneNeedsRender=!1,this.hasListener("render")&&this.emit("render",createEvent("render",{needsRender:G!==void 0,info:this.info}))}this.needsRender=!1,this.modelSceneNeedsRender=!1}this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0)}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.modelSceneNeedsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,r,i){r===void 0&&(r={}),i===void 0&&(i=!0);var o=this,s=o.controller,u=o.renderer;if(!s)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!u)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();var c=this.works.getResolvedObserver(e);if(!c)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var l={workCode:c.work.workCode,panoIndex:c.panoIndex};return"moveToPano"in s&&typeof s.moveToPano=="function"?s.moveToPano(l,r,i):c&&(this.pano=l,this.once("initAnimation.start",function(d){r.moveStartCallback&&r.moveStartCallback(d.state)}),this.once("initAnimation.end",function(d){r.moveEndCallback&&r.moveEndCallback(d.state)}),this.changeMode(t.Mode.Panorama,r,{effect:r.effect},i)),this.ready()},t.prototype.preloadPano=function(e,r){var i=this;r===void 0&&(r=noop$1);var o=this.works.getResolvedObserver(e);if(!o)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));var s=["right","left","up","down","front","back"],u=now();return Promise.all(s.map(function(c){var l=__assign({key:"pano.".concat(o.panoId,".").concat(c)},pick(i.imageOptions,["size","format","quality","mappings"])),d=o.images[c],f=i.imageOptions.transform?i.imageOptions.transform(d,l):imageURL(d,l);return getFetcher(o.work).preload(f)})).then(function(){var c=now()-u;return r(c),c})},t.prototype.project2d=function(e,r){if(r===void 0&&(r=!1),!this.renderer)return null;if(this.models.length>0&&r){var i=this.camera.position,o=e.clone().sub(i),s=new THREE__namespace.Raycaster(i,o.clone().normalize());s.params.Points={threshold:.1};var u=this.models.intersectRaycaster(s)[0];if(u&&u.distance+.01<o.length())return null}var c=e.clone().project(this.camera);if(Math.abs(c.z)>1)return null;var l=this.renderer.getSize(new THREE__namespace.Vector2),d=l.x*this.scissor.width,f=l.y*this.scissor.height,m=l.x*this.scissor.left+(c.x+1)/2*d,A=l.y*(1-this.scissor.bottom-this.scissor.height)+(-c.y+1)/2*f;return new THREE__namespace.Vector2(m,A)},t.prototype.getRenderObjects=function(e){sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix),e||(e=this.scene);var r=[];return e.traverseVisible(function(i){(i instanceof THREE__namespace.Mesh||i instanceof THREE__namespace.Line||i instanceof THREE__namespace.Points)&&(i instanceof THREE__namespace.ImmediateRenderObject||!i.frustumCulled||sharedFrustum.intersectsObject(i))&&r.push(i)}),r},t.prototype.getCurrentState=function(){return __assign(__assign({},this.getPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,r,i){var o,s,u,c,l,d,f,m,A,h;r===void 0&&(r=!1),i===void 0&&(i=!0),e=Object.assign({},e),e.offset&&!(e instanceof THREE__namespace.Vector3)&&(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z));var p;typeof e.panoIndex=="number"&&(e.workCode?p={workCode:e.workCode,panoIndex:e.panoIndex}:p={workCode:(s=(o=this.work)===null||o===void 0?void 0:o.workCode)!==null&&s!==void 0?s:"",panoIndex:e.panoIndex});var y=(u=e.mode)!==null&&u!==void 0?u:this.state.mode,v,g,E,b,T;if((e.mode===t.Mode.Floorplan||e.mode===t.Mode.Topview||e.mode===t.Mode.Mapview||e.mode===t.Mode.Model)&&!this.models.loaded){this.throwError(new Error("model is not ready."));return}if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==y){if(y==="VRPanorama"){this.changeMode("VRPanorama",void 0,void 0,!0);return}var x={workCode:p==null?void 0:p.workCode,panoIndex:p==null?void 0:p.panoIndex};typeof e.longitude=="number"&&(x.longitude=e.longitude),typeof e.latitude=="number"&&(x.latitude=e.latitude),typeof e.fov=="number"&&(x.fov=e.fov),typeof e.distance=="number"&&(x.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(x.offset=e.offset);var R=__assign(__assign({initial:{state:x,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:"fly",userAction:!1}},this.commonParams()),this.controllerInits[y]),_=Controllers[y].initAnimationEndState(R);v=_.longitude,g=_.latitude,E=_.fov,b=_.offset,T=_.distance}else v=(c=e.longitude)!==null&&c!==void 0?c:this.state.longitude,g=(l=e.latitude)!==null&&l!==void 0?l:this.state.latitude,E=(d=e.fov)!==null&&d!==void 0?d:this.state.fov,b=(f=e.offset)!==null&&f!==void 0?f:this.state.offset,T=(m=e.distance)!==null&&m!==void 0?m:this.state.distance;var M={workCode:(p!=null?p:this.pano).workCode,panoIndex:(p!=null?p:this.pano).panoIndex,mode:y,longitude:v,latitude:g,fov:E,offset:b,distance:T};this.emit("state.set",createEvent("state.set",{userAction:i,state:M})),stateEqual(this.state,M)||(this.controller&&M.mode==="VRPanorama"&&M.mode!==this.state.mode?(assignState(this.state,M),this.changeMode("VRPanorama")):this.controller&&M.mode==="XRPanorama"&&M.mode!==this.state.mode?(assignState(this.state,M),this.changeMode("XRPanorama")):(assignState(this.state,M),this.controller&&i&&(this.controller.userAction=!1),r&&this.state.mode===M.mode&&(this.syncingState=this.syncState(now(),0,r),this.syncingState&&((A=this.controller)===null||A===void 0||A.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:i,state:this.state})),(h=this.analysis)===null||h===void 0||h.state(this.works,this.state)))},t.prototype.aroundScissor=function(e){if(this.renderer){if(this.state.mode==="XRPanorama"){e();return}var r=new THREE__namespace.Vector2,i=this.scissor.left!==0||this.scissor.bottom!==0||this.scissor.width!==1||this.scissor.height!==1;if(i){this.renderer.getSize(r);var o=Math.floor(r.x*this.scissor.left),s=Math.floor(r.y*this.scissor.bottom),u=Math.floor(r.x*this.scissor.width),c=Math.floor(r.y*this.scissor.height);this.renderer.setViewport(o,s,u,c),this.renderer.setScissor(o,s,u,c),this.renderer.setScissorTest(!0)}e(),i&&(this.renderer.setViewport(0,0,r.x,r.y),this.renderer.setScissor(0,0,r.x,r.y),this.renderer.setScissorTest(!1))}},t.prototype.syncState=function(e,r,i){i===void 0&&(i=!1);var o=this.stateSynced;if(this.stateSynced=!1,this.works.length===0||!this.controller)return!1;if(this.state.mode!==this.currentMode){var s={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,s,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var u={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},u),{duration:i?0:void 0}),!1),!0}}else{var c={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(c,this.pano)&&"moveToPano"in this.controller&&typeof this.controller.moveToPano=="function"){var u={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(c,u,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var l=1,d=.2,f=.2,m=Math.PI/45,A=i?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,l),h=Math.abs(this.camera.pose.distance-this.state.distance),p=h>f*15?h/15:d,y=i?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,p),v=this.camera.pose.offset.distanceTo(this.state.offset),g=v>f*15?v/15:f,E=i?new THREE__namespace.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,g),b=i?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},m),T=b.longitude,x=b.latitude;if(notSimilarValue(A,this.camera.pose.fov)||notSimilarVector3(E,this.camera.pose.offset)||notSimilarValue(y,this.camera.pose.distance)||notSimilarValue(T,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(x,this.camera.pose.latitude)){var R={x:E.x,y:E.y,z:E.z},_={fov:A};return Object.assign(R,{distance:y}),Object.assign(_,{longitude:T,latitude:x}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(_,0).catch(noop$1),this.controller.locationMotion.set(R,0).catch(noop$1),!0}}else{var M=1,S=Math.PI/45,A=i?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,M),I=i?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},S),T=I.longitude,x=I.latitude,y=this.state.distance,E=new THREE__namespace.Vector3().copy(this.state.offset);if(notSimilarValue(y,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(E,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(T,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(x,this.camera.pose.latitude)||notSimilarValue(A,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:T,latitude:x,fov:A},0).catch(noop$1),!0}if(this.stateSynced=!0,o===!1&&this.emit("state.synced",createEvent("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var C=this.currentMode,H=C===t.Mode.Floorplan||C===t.Mode.Topview||C===t.Mode.Mapview||C===t.Mode.Model;if(!H||this.models.loaded){var B=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var L=0,O=B;L<O.length;L++){var k=O[L];this.controller instanceof Controllers.Panorama&&k.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(k):k()}}}return!1},t.prototype.ready=function(e){var r=this;return e===void 0&&(e={}),new Promise(function(i){var o;r.readyCallbacks.push(Object.assign(i,{tile:(o=e.tile)!==null&&o!==void 0?o:!1}))})},t.prototype.requestFullscreen=function(){var e;if(isMobile){var r=(e=this.getElement())===null||e===void 0?void 0:e.parentNode;r&&"requestFullscreen"in r&&typeof document!="undefined"&&document.fullscreenElement===null&&r.requestFullscreen()}},t.prototype.exitFullscreen=function(){typeof document!="undefined"&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.loadModel=function(e,r){for(var i=this,o=[],s=function(y){var v=u.models.filter(function(E){var b;return((b=E.work)===null||b===void 0?void 0:b.workCode)===y.workCode})[0];if(v)v.work=y,o.push(v);else{var g=new Model({onError:function(E){i.emit("model.error",createEvent("model.error",{work:y,model:g,error:E})),i.throwError(E)},onShownFloorChange:function(E){i.emit("model.changeShownFloor",createEvent("model.changeShownFloor",{work:y,model:g,error:null}))},onLoad:function(){i.emit("model.load",createEvent("model.load",{work:y,model:g,error:null}))}});o.push(g),u.emit("model.request",createEvent("model.request",{work:y,model:g,error:null})),g.load(y,{textureOptions:u.textureOptions,"3d-tiles":r["3d-tiles"]})}},u=this,c=0,l=e;c<l.length;c++){var d=l[c];s(d)}if(this.models.length>0){for(var f=0,m=this.models;f<m.length;f++){var A=m[f];o.indexOf(A)===-1&&this.lastModels.push(A)}this.models.length=0}for(var h=0,p=o;h<p.length;h++){var A=p[h];this.models.push(A)}return this.renderer&&(this.models.loaded=!1),new Promise(function(y){i.on("models.load",function(){y()})})},t.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,boundingMesh:this.boundingMesh,camera:this.camera,renderer:this.renderer,scissor:this.scissor,element:this.getElement(),models:this.models,works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,enableIOSEDR:this._enableIOSEDR,enableEDL:this.enableEDL,enableHQ:this.enableHQ,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene,modelRenderTarget:this.modelRenderTarget}},t.prototype.applyController=function(e,r){var i=this;if(!this.renderer)throw new Error("renderer is not initialized.");e!==t.Mode.Mapview&&(this.enableEDL=!1,this.enableHQ=!1);var o=Controllers[e];this.currentMode=e;for(var s=new o(r),u=function(A){s.on(A,function(){for(var h=[],p=0;p<arguments.length;p++)h[p]=arguments[p];var y=i.emit.apply(i,__spreadArray([A],h,!1));if(y)return!1})},c=0,l=PROXY_CONTROLLER_EVENT_NAMES;c<l.length;c++){var d=l[c];u(d)}{var f=Controllers[e].initAnimationEndState(r),m=r.initial.userAction;stateEqual(this.state,f)||(assignState(this.state,f),this.emit("state.change",createEvent("state.change",{userAction:m,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:m,state:this.getCurrentState()}))}return s.on("camera.update",function(A){var h;if(i.controller){var p=i.controller.getTargetState();A.userAction&&i.syncingState===!1&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:A.userAction,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}i.emit("currentState.change",createEvent("currentState.change",{userAction:A.userAction,state:i.getCurrentState()}))}),s.on("initAnimation.start",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("initAnimation.end",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.moveTo",function(A){var h,p=A.state,y=A.userAction;i.pano={workCode:p.workCode,panoIndex:p.panoIndex},y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.arrived",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.cancel",function(A){var h,p=A.state,y=A.userAction;y&&i.state.mode===p.mode&&!stateEqual(i.state,p)&&(assignState(i.state,p),i.emit("state.change",createEvent("state.change",{userAction:y,state:i.state})),(h=i.analysis)===null||h===void 0||h.state(i.works,i.state))}),s.on("pano.moveTo",function(A){var h=A.userAction;i.emit("currentState.change",createEvent("currentState.change",{userAction:h,state:i.getCurrentState()}))}),s.on("pano.request",function(A){i.emit("pano.request",A),A.defaultPrevented||i.moveToPano(A.state,A.options,A.userAction)}),s.on("vr.requestExit",function(){i.currentMode===t.Mode.VRPanorama&&(i.exitFullscreen(),i.changeMode(t.Mode.Panorama))}),s.on("error",function(A){return i.throwError(A)}),s},t.prototype.removeEventListeners=function(){},t.prototype.getWorkResources=function(e){var r=this,i,o=this.models.find(function(l){return l.work===e}),s=((i=o==null?void 0:o.viewLayers)!==null&&i!==void 0?i:[]).map(function(l){return l.scene});function u(l){var d=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(l);if(d){var f=String(d[1]).trim().split(".").slice(1).reverse()[0];if(f)return f}return""}function c(l,d){d===void 0&&(d=0);var f=[];if(l.content&&l.content.uri){var m=u(l.content.uri);if(m==="json"){var A=imageURL(l.content.uri,{key:"model.".concat(d)});f.push({url:A,type:"tileset"})}else if(m==="at3d"&&l.extras[m]){var A=l.content.uri;f.push({url:A,type:"model"});for(var h=l.extras[m],p=h.textureArray,y=h.textureOptions,v=0,g=p;v<g.length;v++){var E=g[v],b=__assign({key:"texture.pbm"},pick(y,["format","quality","size","sharpen","mappings"])),T=applyImageURLOptions(E,y==null?void 0:y.transform,b);f.push({url:T,type:"texture"})}}else{var A=imageURL(l.content.uri,{key:"model.".concat(d)});f.push({url:A,type:"model"})}}if(l.children)for(var x=0;x<l.children.length;x++){var R=l.children[x];f.push.apply(f,c(R,x))}return f}return Promise.all(s.map(function(l){return l.loadAllTilesets()})).then(function(){for(var l=[],d=["right","left","up","down","front","back"],f=0,m=e.observers;f<m.length;f++){for(var A=m[f],h=0,p=d;h<p.length;h++){var y=p[h],v=__assign({key:"pano.".concat(panoStringify(A.pano),".").concat(y)},pick(r.imageOptions,["size","format","quality","mappings"])),g=A.images[y],E=applyImageURLOptions(g,r.imageOptions.transform,v);l.push({url:E,type:"pano"})}if(A.images.tiles)for(var b=0,T=A.images.tiles;b<T.length;b++)for(var x=T[b],R=0,_=d;R<_.length;R++)for(var y=_[R],M=x.size,S=Math.pow(2,x.level),I=1/S,C=0;C<S;C++)for(var H=0;H<S;H++){var B="".concat(A.panoId,".").concat(y,".").concat(x.level,".").concat(C,".").concat(H),v=__assign(__assign({key:"pano_tile.".concat(B)},pick(r.imageOptions,["format","size","quality","sharpen","mappings"])),{size:x.scale>=1?void 0:M*I*x.scale,cut:[M*I*H,M*I*C,M*I,M*I]}),E=applyImageURLOptions(x[y],r.imageOptions.transform,v);l.push({url:E,type:"pano_tile"})}}for(var L=0,O=s;L<O.length;L++){var k=O[L];k.tileset.url&&l.push({url:k.tileset.url,type:"model"}),l.push.apply(l,c(k.tileset.root))}return l})},t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t.Line=null,t}(Subscribe),__FIVE_DEBUG__={instances:{},constructor:Five};typeof window!="undefined"&&Object.assign(window,{__FIVE_DEBUG__});var XRButton=function(){function n(){}return n.createButton=function(t){var e=document.createElement("button");function r(){e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){t&&t()}}function i(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function o(){i(),e.textContent="VR NOT SUPPORTED"}function s(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",s(e),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():o()}),e;var u=document.createElement("a");return window.isSecureContext===!1?(u.href=document.location.href.replace(/^http:/,"https:"),u.innerHTML="WEBXR NEEDS HTTPS"):(u.href="https://immersiveweb.dev/",u.innerHTML="WEBXR NOT AVAILABLE"),u.style.left="calc(50% - 90px)",u.style.width="180px",u.style.textDecoration="none",s(u),u},n}();exports.AnimationFrameLoop=AnimationFrameLoop,exports.Camera=Camera,exports.Fetcher=Fetcher,exports.Five=Five,exports.InternalWebGLRenderer=InternalWebGLRenderer,exports.IntersectMesh=IntersectMesh,exports.Model=Model,exports.ModelViewLayer=ModelViewLayer,exports.NetworkSubscribe=NetworkSubscribe,exports.PBMContainer=PBMContainer,exports.PBMGroup=PBMGroup,exports.PBMMesh=PBMMesh,exports.PBMMeshMaterial=PBMMeshMaterial,exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES,exports.PanoCircleMesh=PanoCircleMesh,exports.PanoCircleMeshCustom=PanoCircleMeshCustom,exports.PanoCircleMeshSolid=PanoCircleMeshSolid,exports.Scene=Scene,exports.Subscribe=Subscribe,exports.TextureLoader=TextureLoader,exports.Tile=Tile,exports.Tile3DModel=Tile3DModel,exports.TileCache=TileCache,exports.TileCubeTextureTarget=TileCubeTextureTarget,exports.TileNode=TileNode,exports.TileRequestScheduler=TileRequestScheduler,exports.Tileset=Tileset,exports.Work=Work,exports.XRButton=XRButton,exports.defaultImageURLTransform=imageURL,exports.defaultPbmParameters=defaultPbmParameters,exports.getViewportScale=getViewportScale,exports.imageSupport=imageSupport,exports.isPanoId=isPanoId,exports.loadAt3d=loadAt3d,exports.loadB3dm=loadB3dm,exports.loadDome=loadDome,exports.loadDomez=loadDomez,exports.loadGlb=loadGlb,exports.loadPbm=loadPbm,exports.loadPnts=loadPnts,exports.panoEqual=panoEqual,exports.panoParse=panoParse,exports.panoStringify=panoStringify,exports.parseWork=parseWork,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});