@aibee/crc-bmap 0.8.11 → 0.8.12

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.
@@ -1,4 +1,4 @@
1
- "use strict";var mf=Object.create;var yi=Object.defineProperty;var gf=Object.getOwnPropertyDescriptor;var yf=Object.getOwnPropertyNames;var _f=Object.getPrototypeOf,vf=Object.prototype.hasOwnProperty;var yn=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),xf=(r,e)=>{for(var t in e)yi(r,t,{get:e[t],enumerable:!0})},Vs=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of yf(e))!vf.call(r,i)&&i!==t&&yi(r,i,{get:()=>e[i],enumerable:!(n=gf(e,i))||n.enumerable});return r};var Tr=(r,e,t)=>(t=r!=null?mf(_f(r)):{},Vs(e||!r||!r.__esModule?yi(t,"default",{value:r,enumerable:!0}):t,r)),Cf=r=>Vs(yi({},"__esModule",{value:!0}),r);var Ws=yn((Ey,js)=>{js.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var Zs=yn((Ty,Ys)=>{var qs=Ws();Ys.exports=function(r,e){Array.isArray(e)||(e=[]),r.length>0&&e.push(qs([0,0],r[0]));for(var t=0;t<r.length-1;t++){var n=r[t],i=r[t+1],o=n[0],a=n[1],s=i[0],l=i[1],u=[.75*o+.25*s,.75*a+.25*l],c=[.25*o+.75*s,.25*a+.75*l];e.push(u),e.push(c)}return r.length>1&&e.push(qs([0,0],r[r.length-1])),e}});var $s=yn((Iy,Ks)=>{var Uo=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,t)=>e.priority-t.priority)}set(e,t){let n=Number(t);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(e)?this.queue.map(i=>(i.key===e&&Object.assign(i,{priority:n}),i)):(this.keys.add(e),this.queue.push({key:e,priority:n})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(t=>t.key===e)}};Ks.exports=Uo});var eu=yn((Ry,tu)=>{function Js(r,e){let t=new Map;for(let[n,i]of r)n!==e&&i instanceof Map?t.set(n,Js(i,e)):n!==e&&t.set(n,i);return t}tu.exports=Js});var iu=yn((Ny,ru)=>{function Nf(r){let e=Number(r);return!(isNaN(e)||e<=0)}function nu(r){let e=new Map;return Object.keys(r).forEach(n=>{let i=r[n];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return e.set(n,nu(i));if(!Nf(i))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,i);return e.set(n,Number(i))}),e}ru.exports=nu});var su=yn((Ly,au)=>{function ou(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((e,t)=>{if(typeof e=="object"&&e instanceof Map){ou(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}au.exports=ou});var Oo=yn((Uy,cu)=>{var Lf=$s(),Uf=eu(),uu=iu(),lu=su(),Do=class{constructor(e){e instanceof Map?(lu(e),this.graph=e):e?this.graph=uu(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(lu(t),n=t):n=uu(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=Uf(this.graph,e),this}path(e,t,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let i=new Set,o=new Lf,a=new Map,s=[],l=0,u=[];if(n.avoid&&(u=[].concat(n.avoid)),u.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(u.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(o.set(e,0);!o.isEmpty();){let c=o.next();if(c.key===t){l=c.priority;let f=c.key;for(;a.has(f);)s.push(f),f=a.get(f);break}i.add(c.key),(this.graph.get(c.key)||new Map).forEach((f,d)=>{if(i.has(d)||u.includes(d))return null;if(!o.has(d))return a.set(d,c.key),o.set(d,c.priority+f);let m=o.get(d).priority,p=c.priority+f;return p<m?(a.set(d,c.key),o.set(d,p)):null})}return s.length?(n.trim?s.shift():s=s.concat([e]),n.reverse||(s=s.reverse()),n.cost?{path:s,cost:l}:s):n.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};cu.exports=Do});var sa=yn((oa,aa)=>{(function(r,e){typeof oa=="object"&&typeof aa<"u"?aa.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self,r["'typed'"]=e())})(oa,function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";function i(){function a(v){return typeof v=="object"&&v!==null&&v.constructor===Object}let s=[{name:"number",test:function(v){return typeof v=="number"}},{name:"string",test:function(v){return typeof v=="string"}},{name:"boolean",test:function(v){return typeof v=="boolean"}},{name:"Function",test:function(v){return typeof v=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(v){return v instanceof Date}},{name:"RegExp",test:function(v){return v instanceof RegExp}},{name:"Object",test:a},{name:"null",test:function(v){return v===null}},{name:"undefined",test:function(v){return v===void 0}}],l={name:"any",test:r,isAny:!0},u,c,h=0,f={createCount:0};function d(v){let E=u.get(v);if(E)return E;let P='Unknown type "'+v+'"',L=v.toLowerCase(),k;for(k of c)if(k.toLowerCase()===L){P+='. Did you mean "'+k+'" ?';break}throw new TypeError(P)}function m(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",P=E?d(E).index:c.length,L=[];for(let O=0;O<v.length;++O){if(!v[O]||typeof v[O].name!="string"||typeof v[O].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let W=v[O].name;if(u.has(W))throw new TypeError('Duplicate type name "'+W+'"');L.push(W),u.set(W,{name:W,test:v[O].test,isAny:v[O].isAny,index:P+O,conversionsTo:[]})}let k=c.slice(P);c=c.slice(0,P).concat(L).concat(k);for(let O=P+L.length;O<c.length;++O)u.get(c[O]).index=O}function p(){u=new Map,c=[],h=0,m([l],!1)}p(),m(s);function g(){let v;for(v of c)u.get(v).conversionsTo=[];h=0}function _(v){let E=c.filter(P=>{let L=u.get(P);return!L.isAny&&L.test(v)});return E.length?E:["any"]}function A(v){return v&&typeof v=="function"&&"_typedFunctionData"in v}function y(v,E,P){if(!A(v))throw new TypeError(n);let L=P&&P.exact,k=Array.isArray(E)?E.join(","):E,O=I(k),W=x(O);if(!L||W in v.signatures){let ut=v._typedFunctionData.signatureMap.get(W);if(ut)return ut}let X=O.length,q;if(L){q=[];let ut;for(ut in v.signatures)q.push(v._typedFunctionData.signatureMap.get(ut))}else q=v._typedFunctionData.signatures;for(let ut=0;ut<X;++ut){let pt=O[ut],Mt=[],xe;for(xe of q){let fe=V(xe.params,ut);if(!(!fe||pt.restParam&&!fe.restParam)){if(!fe.hasAny){let qe=T(fe);if(pt.types.some(Ye=>!qe.has(Ye.name)))continue}Mt.push(xe)}}if(q=Mt,q.length===0)break}let F;for(F of q)if(F.params.length<=X)return F;throw new TypeError("Signature not found (signature: "+(v.name||"unnamed")+"("+x(O,", ")+"))")}function S(v,E,P){return y(v,E,P).implementation}function C(v,E){let P=d(E);if(P.test(v))return v;let L=P.conversionsTo;if(L.length===0)throw new Error("There are no conversions to "+E+" defined.");for(let k=0;k<L.length;k++)if(d(L[k].from).test(v))return L[k].convert(v);throw new Error("Cannot convert "+v+" to "+E)}function x(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return v.map(P=>P.name).join(E)}function b(v){let E=v.indexOf("...")===0,L=(E?v.length>3?v.slice(3):"any":v).split("|").map(X=>d(X.trim())),k=!1,O=E?"...":"";return{types:L.map(function(X){return k=X.isAny||k,O+=X.name+"|",{name:X.name,typeIndex:X.index,test:X.test,isAny:X.isAny,conversion:null,conversionIndex:-1}}),name:O.slice(0,-1),hasAny:k,hasConversion:!1,restParam:E}}function w(v){let E=v.types.map(W=>W.name),P=_t(E),L=v.hasAny,k=v.name,O=P.map(function(W){let X=d(W.from);return L=X.isAny||L,k+="|"+W.from,{name:W.from,typeIndex:X.index,test:X.test,isAny:X.isAny,conversion:W,conversionIndex:W.index}});return{types:v.types.concat(O),name:k,hasAny:L,hasConversion:O.length>0,restParam:v.restParam}}function T(v){return v.typeSet||(v.typeSet=new Set,v.types.forEach(E=>v.typeSet.add(E.name))),v.typeSet}function I(v){let E=[];if(typeof v!="string")throw new TypeError("Signatures must be strings");let P=v.trim();if(P==="")return E;let L=P.split(",");for(let k=0;k<L.length;++k){let O=b(L[k].trim());if(O.restParam&&k!==L.length-1)throw new SyntaxError('Unexpected rest parameter "'+L[k]+'": only allowed for the last parameter');if(O.types.length===0)return null;E.push(O)}return E}function R(v){let E=Vt(v);return E?E.restParam:!1}function U(v){if(!v||v.types.length===0)return r;if(v.types.length===1)return d(v.types[0].name).test;if(v.types.length===2){let E=d(v.types[0].name).test,P=d(v.types[1].name).test;return function(k){return E(k)||P(k)}}else{let E=v.types.map(function(P){return d(P.name).test});return function(L){for(let k=0;k<E.length;k++)if(E[k](L))return!0;return!1}}}function Z(v){let E,P,L;if(R(v)){E=Bt(v).map(U);let k=E.length,O=U(Vt(v)),W=function(X){for(let q=k;q<X.length;q++)if(!O(X[q]))return!1;return!0};return function(q){for(let F=0;F<E.length;F++)if(!E[F](q[F]))return!1;return W(q)&&q.length>=k+1}}else return v.length===0?function(O){return O.length===0}:v.length===1?(P=U(v[0]),function(O){return P(O[0])&&O.length===1}):v.length===2?(P=U(v[0]),L=U(v[1]),function(O){return P(O[0])&&L(O[1])&&O.length===2}):(E=v.map(U),function(O){for(let W=0;W<E.length;W++)if(!E[W](O[W]))return!1;return O.length===E.length})}function V(v,E){return E<v.length?v[E]:R(v)?Vt(v):null}function j(v,E){let P=V(v,E);return P?T(P):new Set}function D(v){return v.conversion===null||v.conversion===void 0}function Q(v,E){let P=new Set;return v.forEach(L=>{let k=j(L.params,E),O;for(O of k)P.add(O)}),P.has("any")?["any"]:Array.from(P)}function K(v,E,P){let L,k,O=v||"unnamed",W=P,X;for(X=0;X<E.length;X++){let pt=[];if(W.forEach(Mt=>{let xe=V(Mt.params,X),fe=U(xe);(X<Mt.params.length||R(Mt.params))&&fe(E[X])&&pt.push(Mt)}),pt.length===0){if(k=Q(W,X),k.length>0){let Mt=_(E[X]);return L=new TypeError("Unexpected type of argument in function "+O+" (expected: "+k.join(" or ")+", actual: "+Mt.join(" | ")+", index: "+X+")"),L.data={category:"wrongType",fn:O,index:X,actual:Mt,expected:k},L}}else W=pt}let q=W.map(function(pt){return R(pt.params)?1/0:pt.params.length});if(E.length<Math.min.apply(null,q))return k=Q(W,X),L=new TypeError("Too few arguments in function "+O+" (expected: "+k.join(" or ")+", index: "+E.length+")"),L.data={category:"tooFewArgs",fn:O,index:E.length,expected:k},L;let F=Math.max.apply(null,q);if(E.length>F)return L=new TypeError("Too many arguments in function "+O+" (expected: "+F+", actual: "+E.length+")"),L.data={category:"tooManyArgs",fn:O,index:E.length,expectedLength:F},L;let ut=[];for(let pt=0;pt<E.length;++pt)ut.push(_(E[pt]).join("|"));return L=new TypeError('Arguments of type "'+ut.join(", ")+'" do not match any of the defined signatures of function '+O+"."),L.data={category:"mismatch",actual:ut},L}function G(v){let E=c.length+1;for(let P=0;P<v.types.length;P++)D(v.types[P])&&(E=Math.min(E,v.types[P].typeIndex));return E}function nt(v){let E=h+1;for(let P=0;P<v.types.length;P++)D(v.types[P])||(E=Math.min(E,v.types[P].conversionIndex));return E}function yt(v,E){if(v.hasAny){if(!E.hasAny)return 1}else if(E.hasAny)return-1;if(v.restParam){if(!E.restParam)return 1}else if(E.restParam)return-1;if(v.hasConversion){if(!E.hasConversion)return 1}else if(E.hasConversion)return-1;let P=G(v)-G(E);if(P<0)return-1;if(P>0)return 1;let L=nt(v)-nt(E);return L<0?-1:L>0?1:0}function ft(v,E){let P=v.params,L=E.params,k=Vt(P),O=Vt(L),W=R(P),X=R(L);if(W&&k.hasAny){if(!X||!O.hasAny)return 1}else if(X&&O.hasAny)return-1;let q=0,F=0,ut;for(ut of P)ut.hasAny&&++q,ut.hasConversion&&++F;let pt=0,Mt=0;for(ut of L)ut.hasAny&&++pt,ut.hasConversion&&++Mt;if(q!==pt)return q-pt;if(W&&k.hasConversion){if(!X||!O.hasConversion)return 1}else if(X&&O.hasConversion)return-1;if(F!==Mt)return F-Mt;if(W){if(!X)return 1}else if(X)return-1;let xe=(P.length-L.length)*(W?-1:1);if(xe!==0)return xe;let fe=[],qe=0;for(let Hn=0;Hn<P.length;++Hn){let mi=yt(P[Hn],L[Hn]);fe.push(mi),qe+=mi}if(qe!==0)return qe;let Ye;for(Ye of fe)if(Ye!==0)return Ye;return 0}function _t(v){if(v.length===0)return[];let E=v.map(d);v.length>1&&E.sort((k,O)=>k.index-O.index);let P=E[0].conversionsTo;if(v.length===1)return P;P=P.concat([]);let L=new Set(v);for(let k=1;k<E.length;++k){let O;for(O of E[k].conversionsTo)L.has(O.from)||(P.push(O),L.add(O.from))}return P}function zt(v,E){let P=E;if(v.some(k=>k.hasConversion)){let k=R(v),O=v.map(Dt);P=function(){let X=[],q=k?arguments.length-1:arguments.length;for(let F=0;F<q;F++)X[F]=O[F](arguments[F]);return k&&(X[q]=arguments[q].map(O[q])),E.apply(this,X)}}let L=P;if(R(v)){let k=v.length-1;L=function(){return P.apply(this,Ne(arguments,0,k).concat([Ne(arguments,k)]))}}return L}function Dt(v){let E,P,L,k,O=[],W=[];switch(v.types.forEach(function(X){X.conversion&&(O.push(d(X.conversion.from).test),W.push(X.conversion.convert))}),W.length){case 0:return function(q){return q};case 1:return E=O[0],L=W[0],function(q){return E(q)?L(q):q};case 2:return E=O[0],P=O[1],L=W[0],k=W[1],function(q){return E(q)?L(q):P(q)?k(q):q};default:return function(q){for(let F=0;F<W.length;F++)if(O[F](q))return W[F](q);return q}}}function Nt(v){function E(P,L,k){if(L<P.length){let O=P[L],W=[];if(O.restParam){let X=O.types.filter(D);X.length<O.types.length&&W.push({types:X,name:"..."+X.map(q=>q.name).join("|"),hasAny:X.some(q=>q.isAny),hasConversion:!1,restParam:!0}),W.push(O)}else W=O.types.map(function(X){return{types:[X],name:X.name,hasAny:X.isAny,hasConversion:X.conversion,restParam:!1}});return Ln(W,function(X){return E(P,L+1,k.concat([X]))})}else return[k]}return E(v,0,[])}function wt(v,E){let P=Math.max(v.length,E.length);for(let X=0;X<P;X++){let q=j(v,X),F=j(E,X),ut=!1,pt;for(pt of F)if(q.has(pt)){ut=!0;break}if(!ut)return!1}let L=v.length,k=E.length,O=R(v),W=R(E);return O?W?L===k:k>=L:W?L>=k:L===k}function te(v){return v.map(E=>di(E)?fi(E.referToSelf.callback):pi(E)?Gn(E.referTo.references,E.referTo.callback):E)}function Tt(v,E,P){let L=[],k;for(k of v){let O=P[k];if(typeof O!="number")throw new TypeError('No definition for referenced signature "'+k+'"');if(O=E[O],typeof O!="function")return!1;L.push(O)}return L}function vt(v,E,P){let L=te(v),k=new Array(L.length).fill(!1),O=!0;for(;O;){O=!1;let W=!0;for(let X=0;X<L.length;++X){if(k[X])continue;let q=L[X];if(di(q))L[X]=q.referToSelf.callback(P),L[X].referToSelf=q.referToSelf,k[X]=!0,W=!1;else if(pi(q)){let F=Tt(q.referTo.references,L,E);F?(L[X]=q.referTo.callback.apply(this,F),L[X].referTo=q.referTo,k[X]=!0,W=!1):O=!0}}if(W&&O)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return L}function ve(v){let E=/\bthis(\(|\.signatures\b)/;Object.keys(v).forEach(P=>{let L=v[P];if(E.test(L.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Ft(v,E){if(f.createCount++,Object.keys(E).length===0)throw new SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&ve(E);let P=[],L=[],k={},O=[],W;for(W in E){if(!Object.prototype.hasOwnProperty.call(E,W))continue;let Ct=I(W);if(!Ct)continue;P.forEach(function(Er){if(wt(Er,Ct))throw new TypeError('Conflicting signatures "'+x(Er)+'" and "'+x(Ct)+'".')}),P.push(Ct);let Ce=L.length;L.push(E[W]);let pf=Ct.map(w),gi;for(gi of Nt(pf)){let Er=x(gi);O.push({params:gi,name:Er,fn:Ce}),gi.every(df=>!df.hasConversion)&&(k[Er]=Ce)}}O.sort(ft);let X=vt(L,k,wr),q;for(q in k)Object.prototype.hasOwnProperty.call(k,q)&&(k[q]=X[k[q]]);let F=[],ut=new Map;for(q of O)ut.has(q.name)||(q.fn=X[q.fn],F.push(q),ut.set(q.name,q));let pt=F[0]&&F[0].params.length<=2&&!R(F[0].params),Mt=F[1]&&F[1].params.length<=2&&!R(F[1].params),xe=F[2]&&F[2].params.length<=2&&!R(F[2].params),fe=F[3]&&F[3].params.length<=2&&!R(F[3].params),qe=F[4]&&F[4].params.length<=2&&!R(F[4].params),Ye=F[5]&&F[5].params.length<=2&&!R(F[5].params),Hn=pt&&Mt&&xe&&fe&&qe&&Ye;for(let Ct=0;Ct<F.length;++Ct)F[Ct].test=Z(F[Ct].params);let mi=pt?U(F[0].params[0]):e,Bh=Mt?U(F[1].params[0]):e,kh=xe?U(F[2].params[0]):e,Xh=fe?U(F[3].params[0]):e,Fh=qe?U(F[4].params[0]):e,Vh=Ye?U(F[5].params[0]):e,jh=pt?U(F[0].params[1]):e,Wh=Mt?U(F[1].params[1]):e,qh=xe?U(F[2].params[1]):e,Yh=fe?U(F[3].params[1]):e,Zh=qe?U(F[4].params[1]):e,Qh=Ye?U(F[5].params[1]):e;for(let Ct=0;Ct<F.length;++Ct)F[Ct].implementation=zt(F[Ct].params,F[Ct].fn);let Gh=pt?F[0].implementation:t,Hh=Mt?F[1].implementation:t,Kh=xe?F[2].implementation:t,$h=fe?F[3].implementation:t,Jh=qe?F[4].implementation:t,tf=Ye?F[5].implementation:t,ef=pt?F[0].params.length:-1,nf=Mt?F[1].params.length:-1,rf=xe?F[2].params.length:-1,of=fe?F[3].params.length:-1,af=qe?F[4].params.length:-1,sf=Ye?F[5].params.length:-1,uf=Hn?6:0,lf=F.length,cf=F.map(Ct=>Ct.test),hf=F.map(Ct=>Ct.implementation),ff=function(){for(let Ce=uf;Ce<lf;Ce++)if(cf[Ce](arguments))return hf[Ce].apply(this,arguments);return f.onMismatch(v,arguments,F)};function wr(Ct,Ce){return arguments.length===ef&&mi(Ct)&&jh(Ce)?Gh.apply(this,arguments):arguments.length===nf&&Bh(Ct)&&Wh(Ce)?Hh.apply(this,arguments):arguments.length===rf&&kh(Ct)&&qh(Ce)?Kh.apply(this,arguments):arguments.length===of&&Xh(Ct)&&Yh(Ce)?$h.apply(this,arguments):arguments.length===af&&Fh(Ct)&&Zh(Ce)?Jh.apply(this,arguments):arguments.length===sf&&Vh(Ct)&&Qh(Ce)?tf.apply(this,arguments):ff.apply(this,arguments)}try{Object.defineProperty(wr,"name",{value:v})}catch{}return wr.signatures=k,wr._typedFunctionData={signatures:F,signatureMap:ut},wr}function mt(v,E,P){throw K(v,E,P)}function Bt(v){return Ne(v,0,v.length-1)}function Vt(v){return v[v.length-1]}function Ne(v,E,P){return Array.prototype.slice.call(v,E,P)}function tn(v,E){for(let P=0;P<v.length;P++)if(E(v[P]))return v[P]}function Ln(v,E){return Array.prototype.concat.apply([],v.map(E))}function gn(){let v=Bt(arguments).map(P=>x(I(P))),E=Vt(arguments);if(typeof E!="function")throw new TypeError("Callback function expected as last argument");return Gn(v,E)}function Gn(v,E){return{referTo:{references:v,callback:E}}}function fi(v){if(typeof v!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:v}}}function pi(v){return v&&typeof v.referTo=="object"&&Array.isArray(v.referTo.references)&&typeof v.referTo.callback=="function"}function di(v){return v&&typeof v.referToSelf=="object"&&typeof v.referToSelf.callback=="function"}function br(v,E){if(!v)return E;if(E&&E!==v){let P=new Error("Function names do not match (expected: "+v+", actual: "+E+")");throw P.data={actual:E,expected:v},P}return v}function Sr(v){let E;for(let P in v)Object.prototype.hasOwnProperty.call(v,P)&&(A(v[P])||typeof v[P].signature=="string")&&(E=br(E,v[P].name));return E}function M(v,E){let P;for(P in E)if(Object.prototype.hasOwnProperty.call(E,P)){if(P in v&&E[P]!==v[P]){let L=new Error('Signature "'+P+'" is defined twice');throw L.data={signature:P,sourceFunction:E[P],destFunction:v[P]},L}v[P]=E[P]}}let Y=f;f=function(v){let E=typeof v=="string",P=E?1:0,L=E?v:"",k={};for(let O=P;O<arguments.length;++O){let W=arguments[O],X={},q;if(typeof W=="function"?(q=W.name,typeof W.signature=="string"?X[W.signature]=W:A(W)&&(X=W.signatures)):a(W)&&(X=W,E||(q=Sr(W))),Object.keys(X).length===0){let F=new TypeError("Argument to 'typed' at index "+O+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw F.data={index:O,argument:W},F}E||(L=br(L,q)),M(k,X)}return Ft(L||"",k)},f.create=i,f.createCount=Y.createCount,f.onMismatch=mt,f.throwMismatchError=mt,f.createError=K,f.clear=p,f.clearConversions=g,f.addTypes=m,f._findType=d,f.referTo=gn,f.referToSelf=fi,f.convert=C,f.findSignature=y,f.find=S,f.isTypedFunction=A,f.warnAgainstDeprecatedThis=!0,f.addType=function(v,E){let P="any";E!==!1&&u.has("Object")&&(P="Object"),f.addTypes([v],P)};function xt(v){if(!v||typeof v.from!="string"||typeof v.to!="string"||typeof v.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(v.to===v.from)throw new SyntaxError('Illegal to define conversion from "'+v.from+'" to itself.')}return f.addConversion=function(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};xt(v);let P=d(v.to),L=P.conversionsTo.find(k=>k.from===v.from);if(L)if(E&&E.override)f.removeConversion({from:L.from,to:v.to,convert:L.convert});else throw new Error('There is already a conversion from "'+v.from+'" to "'+P.name+'"');P.conversionsTo.push({from:v.from,convert:v.convert,index:h++})},f.addConversions=function(v,E){v.forEach(P=>f.addConversion(P,E))},f.removeConversion=function(v){xt(v);let E=d(v.to),P=tn(E.conversionsTo,k=>k.from===v.from);if(!P)throw new Error("Attempt to remove nonexistent conversion from "+v.from+" to "+v.to);if(P.convert!==v.convert)throw new Error("Conversion to remove does not match existing conversion");let L=E.conversionsTo.indexOf(P);E.conversionsTo.splice(L,1)},f.resolve=function(v,E){if(!A(v))throw new TypeError(n);let P=v._typedFunctionData.signatures;for(let L=0;L<P.length;++L)if(P[L].test(E))return P[L];return null},f}var o=i();return o})});var oy={};xf(oy,{AibeeLoader:()=>Xs,BMap:()=>Yo,BMapSelect:()=>ea,BaseSvg:()=>Pe,ClickHelper:()=>Nr,Context:()=>Qr,CrLoader:()=>Fs,CrNavPath:()=>ta,Equipment:()=>Zo,Events:()=>Po,Floor:()=>Me,GlbModel:()=>Vr,Graphic:()=>Qt,GraphicLayer:()=>zr,GroundTexture:()=>nr,HeatmapElement:()=>Dr,HooksName:()=>tr,HoverHelper:()=>Zr,Lane:()=>jr,Layer:()=>ie,MapTypePolar:()=>Fu,MergeGraphic:()=>Wr,Model:()=>Or,MulFloorNavigation:()=>Is,MulFloorSelect:()=>Rs,MulFloors:()=>Ho,NavPath:()=>$o,Navigation:()=>Go,Overlay:()=>Ur,PathDirection:()=>No,PdrPosition:()=>Ps,Poi:()=>bn,Poi2:()=>Gt,PoiLayer:()=>Br,PoiLayer2:()=>Vn,RoadNetwork:()=>zo,RoadNetwork2:()=>Bo,SelectBox:()=>Fo,Selection:()=>Yr,Sensor:()=>Kr,Shadow:()=>Lr,SvgLine:()=>kr,SvgPolygon:()=>Xr,TaskQueue:()=>xn,TextTexture:()=>qr,Timer:()=>ee,TweenUtil:()=>hn,UA:()=>To,Wall:()=>Fr,addAlphaToHexColor:()=>Ef,calc_angle:()=>Ao,calc_direction:()=>xi,convertToSnakeCase:()=>ko,createCircle:()=>$n,createLine:()=>Ir,createRect:()=>cn,createSvg:()=>wo,createSvgElement:()=>Pr,createThreeBox:()=>zf,createThreeLine:()=>Of,darkenColor:()=>en,defaultAibeeLoaderOption:()=>iy,defaultConfig:()=>ku,defaultGraphicOptions:()=>Ci,defaultOptions:()=>wu,defaultTextTextureOptions:()=>Ru,deviceToVector3:()=>Af,dispose:()=>ne,distancePointToSegment:()=>Ro,generatorKeyByObj:()=>zn,getAngle:()=>Gs,getCenter:()=>Mr,getConfig:()=>qo,getDirectPath:()=>Rf,getDistanceByPathPos:()=>Lo,getLength:()=>Yt,getLongestSideDir:()=>bf,getMinEdgeSquare:()=>bo,getPathLength:()=>Le,getPointEdgeIndex:()=>ln,getPosByPathDistance:()=>Bn,hasChinese:()=>Co,hexToRgb:()=>vi,initDirectionalLight:()=>xo,initLight:()=>vo,initShape:()=>Ze,isAndroid:()=>Tf,isContain:()=>un,isControl:()=>On,isIphone:()=>Jn,isMac:()=>Dn,isPointInPolygon:()=>So,loadBuildingGround:()=>Ns,loadExternalStreet:()=>jg,loadGraphics:()=>Ls,moveOnRoute:()=>If,proxyOptions:()=>Un,removeWeightPath:()=>Hs,setCirclePosition:()=>_n,setLineStartEnd:()=>Ue,setRectPosition:()=>se,simplifyPath:()=>Rr,sleepOnePromise:()=>Eo,sleepOneRf:()=>_i,smoothPath:()=>Io,strToNumber:()=>wf,timeoutPromise:()=>Te,toWebWorker:()=>Df,transformGraphicData:()=>pe,translatePosToCenter:()=>Oe,triggerWorker:()=>Qe,vector3ToDevice:()=>rt,xhrGet:()=>Mf});module.exports=Cf(oy);var zi=require("three");var ee=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(e){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),e()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(e){this.tasks.requestAnimation.delete(e),window.cancelAnimationFrame(e)}setTimeout(e,t){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),e()},t);return this.tasks.timeout.add(n),n}clearTimeout(e){this.tasks.timeout.delete(e),window.clearTimeout(e)}setInterval(e,t){let n=window.setInterval(()=>{this.tasks.interval.delete(n),e()},t);return this.tasks.interval.add(n),n}clearInterval(e){this.tasks.interval.delete(e),window.clearInterval(e)}dispose(){this.tasks.requestAnimation.forEach(e=>{window.cancelAnimationFrame(e)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(e=>{window.clearTimeout(e)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(e=>{window.clearInterval(e)}),this.tasks.interval.clear()}};var Ee=require("three");function vo(){let r=new Ee.Group,e=new Ee.AmbientLight(16777215,2.6);return r.add(e),r}function Ze(r,e=[]){let t=new Ee.Shape(r.map(n=>new Ee.Vector2(...n)));return e.length&&e.forEach(n=>{var i=new Ee.Path(n.map(o=>new Ee.Vector2(...o)));t.holes.push(i)}),t}function xo(r=16777215,e=1){let t=new Ee.DirectionalLight(r,e);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function ne(r,e){if(e&&r.children&&r.children.length&&r.children.forEach(t=>{ne(t,e)}),r.isMesh){let t=r;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n.dispose()}):t.material.dispose())}r.isLight&&r.dispose?.()}function Co(r){return/[\u4E00-\u9FA5]+/g.test(r)}var kt=require("three"),Kn=require("@turf/turf");function rt(r,e,t,n){let i=r.clone().project(e),o=t/2,a=n/2,s=Math.round(i.x*o+o),l=Math.round(-i.y*a+a);return{x:s,y:l}}function Af(r,e,t,n,i){if(!i)return null;t=Math.min(1,t),n=Math.min(1,n);let o=r/t*2-1,a=1-e/n*2;return new kt.Vector3(o,a,0).unproject(i)}function Mr(r){let e=(0,Kn.featureCollection)(r.map(n=>(0,Kn.point)(n)));return(0,Kn.center)(e).geometry.coordinates}function un(r,e,t){return r.x>=e.x&&r.x<=t.x&&r.y>=e.y&&r.y<=t.y}function bf(r){let e=0,t=new kt.Vector3;for(let n=1;n<r.length;n++){let i=new kt.Vector3(r[n-1][0],r[n-1][1],0),o=new kt.Vector3(r[n][0],r[n][1],0),a=o.distanceTo(i);a>e&&(e=a,t=o.clone().sub(i).normalize())}return t}function Yt(r,e){return Math.sqrt((e[0]-r[0])**2+(e[1]-r[1])**2)}function Le(r){let e=0;for(let t=0;t<r.length-1;t++)e+=Yt(r[t],r[t+1]);return e}function Ao(r,e,t){let n=new kt.Vector2(e[0]-r[0],e[1]-r[1]),i=new kt.Vector2(e[0]-t[0],e[1]-t[1]),a=n.angleTo(i)*180/Math.PI,s=new kt.Vector2(e[0]-r[0],e[1]-r[1]);return new kt.Vector2(t[0]-r[0],t[1]-r[1]).cross(s)>0?a:-a}function bo(r,e){let t=Math.min(Yt(r[0][0],r[0][1]),Yt(r[0][2],r[0][1]))-1;e||(e=Mr(r[0]));let n=Sf(e,t),i=new kt.Vector2(r[0][0][0],r[0][0][1]),o=new kt.Vector2(r[0][1][0],r[0][1][1]),a=new kt.Vector2(r[0][2][0],r[0][2][1]),l=(i.distanceTo(o)>o.distanceTo(a)?o.clone().sub(i):a.clone().sub(o)).angleTo(new kt.Vector2(0,1)),u=new kt.Matrix3;return u.multiply(new kt.Matrix3().translate(e[0],e[1])).multiply(new kt.Matrix3().rotate(l)).multiply(new kt.Matrix3().translate(-e[0],-e[1])),[n.map(c=>{let h=new kt.Vector2(c[0],c[1]).applyMatrix3(u);return[h.x,h.y]})]}function Sf(r,e){let t=e/2;return[[r[0]-t,r[1]+t],[r[0]+t,r[1]+t],[r[0]+t,r[1]-t],[r[0]-t,r[1]-t],[r[0]-t,r[1]+t]]}function ln(r,e){let t=0,n=1/0,[i,o]=e;for(let a=0;a<r.length-1;a++){let[s,l]=r[a],[u,c]=r[a+1],h=Math.min(s,u)<=i&&i<=Math.max(s,u),f=Math.min(l,c)<=o&&o<=Math.max(l,c);if(h&&f){let d=Math.abs((u-s)*(o-l)-(c-l)*(i-s));d<n&&(n=d,t=a)}}return t}function So(r,e){let t=r[0],n=r[1],i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let s=e[o][0],l=e[o][1],u=e[a][0],c=e[a][1];l>n!=c>n&&t<(u-s)*(n-l)/(c-l)+s&&(i=!i)}return i}function Un(r,e){return new Proxy(r,{get:(t,n,i)=>Reflect.get(t,n,i),set:(t,n,i,o)=>{let a=Reflect.get(t,n,o),s=Reflect.set(t,n,i,o);return a!==i&&e.dispatchEvent({type:`change-${n}`,value:i}),s}})}function Te(r,e){return Promise.race([r,new Promise((t,n)=>{setTimeout(()=>n(new Error("Promise timeout")),e)})])}function Pr(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function wo(r,e){let t=Pr("svg");return t.setAttribute("width",r),t.setAttribute("height",e),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function $n(r="2",e){let t=Pr("circle");return t.setAttribute("r",r),t.setAttribute("fill",e),t}function Ir(r){let e=Pr("line");return e.setAttribute("stroke",r),e}function cn(r,e){let t=Pr("rect");return t.setAttribute("stroke",r),t.setAttribute("fill",e),t}function _n(r,e,t){r.setAttribute("cx",`${e}`),r.setAttribute("cy",`${t}`)}function Ue(r,e,t){e&&(r.setAttribute("x1",`${e.x}`),r.setAttribute("y1",`${e.y}`)),t&&(r.setAttribute("x2",`${t.x}`),r.setAttribute("y2",`${t.y}`))}function se(r,e,t,n,i){r.setAttribute("x",`${e}`),r.setAttribute("y",`${t}`),r.setAttribute("width",`${n}`),r.setAttribute("height",`${i}`)}function Eo(){return Promise.resolve()}function _i(){return new Promise(r=>{requestAnimationFrame(r)})}function wf(r){return parseInt(r.replace("#","0x"),16)}function Ef(r,e){let t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(t*e),a=Math.round(n*e),s=Math.round(i*e);return`#${(1<<24|o<<16|a<<8|s).toString(16).slice(1)}`}function en(r,e=.85){let t,n,i;if(r.startsWith("#"))t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let a=r.slice(4,-1).split(",");t=parseInt(a[0].trim()),n=parseInt(a[1].trim()),i=parseInt(a[2].trim())}return t=Math.min(Math.floor(t*e),255),n=Math.min(Math.floor(n*e),255),i=Math.min(Math.floor(i*e),255),"#"+((1<<24)+(t<<16)+(n<<8)+i).toString(16).slice(1)}function vi(r,e){r=r.replace(/^#/,"");let t=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return e!==void 0?`rgba(${t}, ${n}, ${i}, ${e})`:`rgb(${t}, ${n}, ${i})`}var Dn=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,To=(navigator.userAgent||"").toLocaleLowerCase(),Jn=/ios|iphone/i.test(To),Tf=/android|adr|linux/gi.test(To);function On(r){return Dn?r==="Meta":r==="Control"}var Mo="__once__",Po=class{events=new Map;on(e,t){if(typeof t!="function")return;let n=this.events.get(e);return n?n.add(t):this.events.set(e,new Set([t]))}once(e,t){if(typeof t!="function")return;let n=`${Mo}${e}`,i=this.events.get(n);return i?i.add(t):this.events.set(n,new Set([t]))}off(e,t){let n=this.events.get(e),i=this.events.get(`${Mo}${e}`);!n&&!i||(t===void 0&&(n?.clear(),i?.clear()),n?.has(t)&&n.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(e,...t){let n=this.events.get(e),i=this.events.get(`${Mo}${e}`);!n&&!i||(n?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.clear())}};var tr=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(tr||{});function zn(r){return Object.keys(r).sort().map(e=>`${e}=${r[e]}`).join("&")}function Mf(r,e){return new Promise((t,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(e.headers||{}).forEach(o=>{i.setRequestHeader(o,e.headers[o])}),e.responseType&&(i.responseType=e.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(e.responseType==="arraybuffer")t(i.response);else try{let o=JSON.parse(i.responseText);t(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var er=require("three"),Qs=Tr(Zs(),1);function Gs(r,e){let t=r.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function Pf(r){let e=0;return r.reduce(([t,n],[i,o])=>(e+=Math.sqrt((i-t)**2+(o-n)**2),[i,o])),e/r.length}function Io(r,e=.25){if(Pf(r)<e)return r;let t=(0,Qs.default)(r);return Io(t,e)}function Rr(r,e=!1,t=!0,n=5,i=150,o=3){let a=[],s=!e;if(a.push(r[0]),r.length<2)return a;for(let u=0;u<r.length-2;u+=1){let c=r[u],h=r[u+1],f=r[u+2],d=new er.Vector2(c[0]-h[0],c[1]-h[1]),m=new er.Vector2(f[0]-h[0],f[1]-h[1]),p=Gs(d,m)/Math.PI*180,g=d.length()+m.length();(!s||p<i&&g>.01||g>n)&&(a.push(r[u+1]),s=!0)}if(a.push(r[r.length-1]),!t)return a;let l=[];l.push(a[0]);for(let u=0;u<a.length-2;u+=1){let c=new er.Vector2(a[u][0],a[u][1]),h=new er.Vector2(a[u+1][0],a[u+1][1]),f=new er.Vector2(a[u+2][0],a[u+2][1]),d=c.distanceTo(h)/2,m=f.distanceTo(h)/2,p=h.clone(),g=h.clone();p.add(c.clone().sub(h).normalize().multiplyScalar(d>o?o/2:d)),g.add(f.clone().sub(h).normalize().multiplyScalar(m>o?o/2:m));let _=[[p.x,p.y],[h.x,h.y],[g.x,g.y]];l.push(...Io(_,o/25))}return l.push(a[a.length-1]),Hs(l)}function Hs(r){if(r.length<=1)return r;let e=[],t;return r.forEach(([n,i])=>{t?n===t[0]&&i===t[1]||(t=[n,i],e.push([n,i])):(t=[n,i],e.push([n,i]))}),e}function Ro(r,e,t){let n=Math.sqrt((t[0]-e[0])**2+(t[1]-e[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2),closestPoint:e.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-e[0])*(t[0]-e[0])+(r[1]-e[1])*(t[1]-e[1]))/n**2)),o=[e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function If(r,e,t){let[n,i]=r,[o,a]=e,s=Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2));if(s===0||s<t)return[...e];let l=t/s,u=n+(o-n)*l,c=i+(a-i)*l;return[u,c]}var No=(u=>(u.START="start",u.END="end",u.FRONT="front",u.RIGHT="right",u.LEFT="left",u.RIGHT_FRONT="right_front",u.LEFT_FRONT="left_front",u.RIGHT_BACK="right_back",u.LEFT_BACK="left_back",u))(No||{});function xi(r,e,t){let n=Ao(r,e,t);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function Rf(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let e=[{direction:"start",distance:Yt(r[0],r[1]),points:[r[0],r[1]]}];for(let t=2;t<r.length;t++){let n=xi(r[t-2],r[t-1],r[t]);if(n==="front"){let i=e[e.length-1],o=Yt(r[t-1],r[t]);i.distance+=o,t!==2&&i.points.push(r[t-1])}else e.push({direction:n,distance:Yt(r[t-1],r[t]),points:[r[t-1],r[t]]})}return e.push({direction:"end",distance:0,points:[r[r.length-1]]}),e}function Lo(r,e){if(r.length<2)return-1;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=[e[0]-i[0],e[1]-i[1]],s=[o[0]-i[0],o[1]-i[1]],l=Math.min(o[0],i[0])<=e[0]&&e[0]<=Math.max(o[0],i[0]),u=Math.min(o[1],i[1])<=e[1]&&e[1]<=Math.max(o[1],i[1]);if(l&&u){let c=a[0]*s[1]-a[1]*s[0];if(Math.abs(c)<1e-6){let h=Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2);return t+h}}t+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function Bn(r,e){if(r.length<2)return r[0]??null;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2);if(t+=a,t>=e){let s=(e-(t-a))/a,l=i[0]+(o[0]-i[0])*s,u=i[1]+(o[1]-i[1])*s;return[l,u]}}return null}var nn=Tr(Oo(),1);var De="___",zo=class{constructor(e=3){this.lift_priority=e}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new nn.default;escalatorRoute=new nn.default;straightLadderRoute=new nn.default;initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(t=>{t.points.forEach(n=>{let i=`${t.floor}${De}${n.id}`;if(this.pointMap.set(i,n),this.nodeMap.set(`${n.floor}${De}${n.nodeId}`,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push({...n}),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push({...n}),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push({...n}),this.facilityMap.set(n.targetId,o)}}),t.lines.filter(n=>n.direction!=="no").forEach(n=>{let i=`${t.floor}${De}${n.from}`,o=`${t.floor}${De}${n.to}`,a=this.pointMap.get(i)?.cds,s=this.pointMap.get(o)?.cds;if(a?.length&&s?.length){let l=Yt(a,s);this.addLineItem(i,o,l),n.direction==="double"&&this.addLineItem(o,i,l)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let l=`${a[s].floor}${De}${a[s].id}`;for(let u=0;u<a.length;u++)if(s!==u){let c=`${a[u].floor}${De}${a[u].id}`,h=this.pointMap.get(l)?.cds,f=this.pointMap.get(c)?.cds;if(h?.length&&f?.length)if(a[s].type==="straightLadder"){let d=t;this.addLineItem(l,c,d,i)}else{let d=n;this.addLineItem(l,c,d,i)}}}}),this.escalatorMap.forEach((o,a)=>{if(o.start&&o.end){let s=`${o.start.floor}${De}${o.start.id}`,l=`${o.end.floor}${De}${o.end.id}`,u=this.pointMap.get(s)?.cds,c=this.pointMap.get(l)?.cds;if(u?.length&&c?.length){let h=e;this.addLineItem(s,l,h,i)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new nn.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new nn.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new nn.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${De}${e.nodeId}`);if(t){let[n,i]=t.split(De);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{let a=Yt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:n.point.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let s=this.facilityMap.get(o.facility).filter(u=>o.floor?u.floor===o.floor:!0);if(!s.length)return null;let l=s.map(u=>a(i,{floor:u.floor,id:u.id})).filter(u=>!!u);return l.reduce((u,c)=>{let h=c.reduce((f,d)=>f+Le(d.points),0);return h<u.distance&&(u.distance=h,u.path=c),u},{distance:1/0,path:l[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${De}${e.id}`,o=`${t.floor}${De}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[];return a.map(l=>{let u=this.pointMap.get(l);if(u){let{floor:c}=u;if(s[s.length-1]?.floor===c){let h=s[s.length-1];h.points.push(u.cds),h.endType=u.type,h.destId=u.nodeId,h.distance=Le(h.points)}else s.push({floor:c,points:[u.cds],endType:u.type,destId:u.nodeId,distance:0})}}),s}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new nn.default,this.escalatorRoute=new nn.default,this.straightLadderRoute=new nn.default}};var ue=Tr(Oo(),1);var vn=require("lodash"),Pt="___",Bo=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new ue.default;escalatorRoute=new ue.default;straightLadderRoute=new ue.default;forwardLineMap=new Map;forwardRoute=new ue.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(t=>{let n=[];try{n=JSON.parse(t.entry_end_floor)}catch{n=[]}let i=[];try{i=JSON.parse(t.entry_start_floor)}catch{i=[]}return{...t,entry_start_floor:i,entry_end_floor:n}})}initRoute(e,t){this.clear(),this.roadInfo=e,this.initFacilities(t);let n=new Date,i=n.getHours()*60+n.getMinutes();e.length&&(e.forEach(o=>{(o.points||[]).filter(a=>a.openStatus!==!1).filter(a=>{if(!a.startTime||!a.endTime)return!0;let[s,l]=a.startTime.split(":").map(d=>+d),[u,c]=a.endTime.split(":").map(d=>+d),h=s*60+l,f=u*60+c;return i>=h&&i<=f}).forEach(a=>{a.floor=o.floor;let s=`${o.floor}${Pt}${a.id}`;if(this.nodeMap.set(`${o.floor}${Pt}${a.nodeId}`,`${o.floor}${Pt}${a.relatedId||a.id}`),this.pointMap.set(s,a),this.isFacilityByType(a.type)){let l=this.facilities.find(u=>u.id===+a.targetId);if(l){switch(l.entry_infra_type){case"straightLadder":if(l.entry_end_floor.find(f=>f.floor===o.floor)&&l.entry_start_floor.find(f=>f.floor===o.floor)){let f=this.straightLadderMap.get(a.targetId)||[];f.push({...a}),this.straightLadderMap.set(a.targetId,f)}break;case"staircase":if(l.entry_end_floor.find(f=>f.floor===o.floor)&&l.entry_start_floor.find(f=>f.floor===o.floor)){let f=this.staircaseMap.get(a.targetId)||[];f.push({...a}),this.staircaseMap.set(a.targetId,f)}break;case"escalator":let c=this.escalatorMap.get(a.targetId)||[];if(l.entry_start_floor.find(f=>f.floor===o.floor)){let f=c.find(d=>d.end?.floor!==o.floor&&!d.start);f?f.start=a:c.push({start:a})}if(l.entry_end_floor.find(f=>f.floor===o.floor)){let f=c.find(d=>d.start?.floor!==o.floor&&!d.end);f?f.end=a:c.push({end:a})}this.escalatorMap.set(a.targetId,c);break;case"ramp":let h=this.rampMap.get(a.targetId)||[];if(l.entry_start_floor.find(f=>f.floor===o.floor)){let f=h.find(d=>d.end?.floor!==o.floor&&!d.start);f?f.start=a:h.push({start:a})}if(l.entry_end_floor.find(f=>f.floor===o.floor)){let f=h.find(d=>d.start?.floor!==o.floor&&!d.end);f?f.end=a:h.push({end:a})}this.rampMap.set(a.targetId,h);break}let u=this.facilityMap.get(a.targetId)||[];u.push({...a}),this.facilityMap.set(a.targetId,u)}}a.type==="parkingSpace"&&this.parkingMap.set(`${o.floor}${Pt}${a.name}`,a)}),(o.lines||[]).filter(a=>a.direction!=="no").forEach(a=>{let s=`${o.floor}${Pt}${a.from}`,l=`${o.floor}${Pt}${a.to}`,u=this.pointMap.get(s),c=this.pointMap.get(l);if(!u||!c)return;let h=u.cds,f=c.cds,d=Yt(h,f);if(!u.permission&&!c.permission)switch(this.addLineItem(s,l,d),this.addLineItem(l,s,d),a.direction){case"double":this.addLineItem(s,l,d,this.forwardLineMap),this.addLineItem(l,s,d,this.forwardLineMap);break;case"single":this.addLineItem(s,l,d,this.forwardLineMap);break;case"back":this.addLineItem(l,s,d,this.forwardLineMap);break}else u.permission&&(this.setPermissionLine(s,l,u.permission,d,""),this.setPermissionLine(l,s,u.permission,d,"")),c.permission&&c.permission!==u.permission&&(this.setPermissionLine(s,l,c.permission,d,""),this.setPermissionLine(l,s,c.permission,d,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[`permission_${e}`]||(this[`permission_${e}`]=new Set),this[`permission_${e}`]}setPermissionLine(e,t,n,i,o){this.getPermissionMap(n).add({fromKey:e,toKey:t,distance:i,type:o})}addPermissionFacility(){this.straightLadderMap.forEach((e,t)=>{if(e.length<2){this.straightLadderMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${Pt}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${Pt}${e[a].id}`,l=this.pointMap.get(s);if(!l)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"straightLadder"),l.permission&&l.permission!==o.permission&&this.setPermissionLine(i,s,l.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,t)=>{if(e.length<2){this.staircaseMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${Pt}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${Pt}${e[a].id}`,l=this.pointMap.get(s);if(!l)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"staircase"),l.permission&&l.permission!==o.permission&&this.setPermissionLine(i,s,l.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Pt}${n.start.id}`,o=`${n.end.floor}${Pt}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,1,"escalator"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,1,"escalator"))}})}),this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Pt}${n.start.id}`,o=`${n.end.floor}${Pt}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,10,"ramp"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,10,"ramp"))}})})}addPermissionLineToMap(e,t,n,i){let o=this.getPermissionMap(e);console.log(o),o.forEach(a=>{t.includes(a.type)&&(a.type===""?this.addLineItem(a.fromKey,a.toKey,a.distance,n):this.addLineItem(a.fromKey,a.toKey,i.get(a.type),n))})}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let l=`${a[s].floor}${Pt}${a[s].id}`,u=this.pointMap.get(l);if(!(!u||u.permission)){for(let c=0;c<a.length;c++)if(s!==c){let h=`${a[c].floor}${Pt}${a[c].id}`,f=this.pointMap.get(h);if(!f||f.permission)continue;if(a[s].type==="straightLadder"){let d=t;this.addLineItem(l,h,d,i)}else{let d=n;this.addLineItem(l,h,d,i)}}}}}),this.escalatorMap.forEach((o,a)=>{o.forEach(s=>{if(s.start&&s.end){let l=`${s.start.floor}${Pt}${s.start.id}`,u=`${s.end.floor}${Pt}${s.end.id}`,c=this.pointMap.get(l),h=this.pointMap.get(u);if(c&&h&&!c.permission&&!h.permission){let f=e;this.addLineItem(l,u,f,i)}}})})}initBaseRoute(){let e=new Map((0,vn.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new ue.default(e)}initEscalatorRoute(){let e=new Map((0,vn.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new ue.default(e)}initStraightLadderRoute(){let e=new Map((0,vn.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new ue.default(e)}initForwardRoute(){this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Pt}${n.start.id}`,o=`${n.end.floor}${Pt}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&!a.permission&&!s.permission&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.forwardRoute=new ue.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${Pt}${e.nodeId}`);if(t){let[n,i]=t.split(Pt);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{if(o.relatedId)return i;let a=Yt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:t.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let n=this.parkingMap.get(`${e.floor}${Pt}${e.parkingSpace}`);if(n)return{floor:e.floor,id:n.id}}let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilities.filter(i=>+i.type_id==+e.facility).map(i=>i.id).map(i=>this.facilityMap.get(`${i}`)).flat(2)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n="",i){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let o=this.transformStart(e);if(!o)return"no-start";let a=this.transformEnd(t);if(!a)return"no-end";let s=this.getBasePath.bind(this);switch(n){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;case"forward":s=this.getForwardPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(a.id)return s(o,a,i);if(a.facility){let u=this.facilities.filter(h=>+h.type_id==+t.facility).map(h=>h.id).map(h=>this.facilityMap.get(`${h}`)).flat(2).filter(h=>h).filter(h=>a.floor?h.floor===a.floor:!0);if(!u.length)return null;let c=u.map(h=>s(o,{floor:h.floor,id:h.id},i)).filter(h=>!!h);return c.reduce((h,f)=>{let d=f[0].consume;return d<h.distance&&(h.distance=d,h.path=f),h},{distance:1/0,path:c[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${Pt}${e.id}`,o=`${t.floor}${Pt}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[],l=a.reduce((u,c,h,f)=>{if(h===0)return 0;let d=f[h-1],m=n.graph.get(d).get(c);return u+m},0);return a.map(u=>{let c=this.pointMap.get(u);if(c){let{floor:h}=c,f=c.type;if(this.isFacilityByType(c.type)){let d=this.facilities.find(m=>m.id===+c.targetId);d&&(f=d.entry_infra_type)}if(s[s.length-1]?.floor===h){let d=s[s.length-1];d.points.push(c.cds),d.endType=f,d.destId=c.nodeId,d.distance=Le(d.points)}else s.push({floor:h,points:[c.cds],endType:f,destId:c.nodeId,distance:0,consume:l})}}),s}getBasePath(e,t,n){if(!n)return this.getRoutePath(e,t,this.baseRoute);let i=(0,vn.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let o=new ue.default(i);return this.getRoutePath(e,t,o)}getEscalatorPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.escalatorRoute);let i=(0,vn.cloneDeep)(this.escalatorRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",1*o],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]));let a=new ue.default(i);return this.getRoutePath(e,t,a)}getStraightLadderPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.straightLadderRoute);let i=(0,vn.cloneDeep)(this.straightLadderRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",3*o],["straightLadder",1*o],["staircase",3e4*o]]));let a=new ue.default(i);return this.getRoutePath(e,t,a)}getForwardPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.forwardRoute);let i=(0,vn.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],i,new Map([["ramp",10]]));let o=new ue.default(i);return this.getRoutePath(e,t,o)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new ue.default,this.escalatorRoute=new ue.default,this.straightLadderRoute=new ue.default}};var kn=class{static keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let e=this.createKey();for(;this.keySet.has(e);)e=this.createKey();return e}static removeKey(e){this.keySet.delete(e)}static dispose(){this.keySet.clear()}};function ko(r){return r.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function Qe(r,e,t){return new Promise((n,i)=>{let o=kn.genUniqueKey(),a=({data:s})=>{s.type===`${e}_result`&&s.key===o&&(kn.removeKey(o),self.removeEventListener("message",a),s.error?i(s.error):n(s.data))};r.addEventListener("message",a),r.postMessage({type:e,key:o,data:t})})}function Df(r){let e={};for(let n in r)n.startsWith("on")&&(e[ko(n.slice(2))]=r[n]);let t=async({data:n})=>{if(e[n.type])try{let i=await e[n.type](n.data);self.postMessage({type:`${n.type}_result`,key:n.key,data:i})}catch(i){self.postMessage({type:`${n.type}_result`,key:n.key,error:i})}else self.postMessage({type:`${n.type}_result`,key:n.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var Ge=require("three");function Of(r,e=16711680){let t=new Ge.LineBasicMaterial({color:e}),n=new Ge.BufferGeometry().setFromPoints(r);return new Ge.Line(n,t)}function zf(r,e=16711680){let t=new Ge.LineBasicMaterial({color:e}),n=new Ge.BoxGeometry(1,1,1),i=new Ge.Mesh(n,t);return i.position.copy(r),i}function pe(r,e,t=0){r.forEach(n=>{n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"?(n.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=e[0],o[1]-=e[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(i=>i.map(o=>Oe(o,e)))),n.doors?.length&&n.doors.map(i=>{i.coord=Oe(i.coordinate,e)}),n.center&&(n.center=Oe(n.center,e))):n.geometry.coords=Oe(n.geometry.cds,e)});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(t+n+1)}}function Oe(r,e){return[r[0]-e[0],r[1]-e[1]]}var hu=require("@tweenjs/tween.js"),hn=class{pauseTween=!1;tweenStore=new Set;group=new hu.Group;constructor(){}update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(e=>{this.tweenStore.add(e),e.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(e=>{e.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(e){this.group.remove(e)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(e=>e.stop()),this.group.removeAll()}dispose(){this.clear()}};var fu=require("three"),Nr=class extends fu.EventDispatcher{constructor(t){super();this.ctn=t;this.registryEvent()}point;registryEvent(){this.ctn.addEventListener("pointerdown",this._pointerDown),this.ctn.addEventListener("pointerup",this._pointerUp)}unRegistryEvent(){this.ctn.removeEventListener("pointerdown",this._pointerDown),this.ctn.removeEventListener("pointerup",this._pointerUp)}_pointerDown=t=>{this.point={x:t.offsetX,y:t.offsetY}};_pointerUp=t=>{if(!this.point)return;let{offsetX:n,offsetY:i}=t,{x:o,y:a}=this.point;Math.hypot(o-n+(a-i))>3||this.dispatchEvent({type:"click",e:t})};dispose(){this.unRegistryEvent()}};var pu=require("lodash"),du=require("three"),xn=class extends du.EventDispatcher{_task=[];started=!1;activeTask=null;_id=0;constructor(e=!0){super(),e&&this.start()}_isEffectiveTask(e){return e&&typeof e.run=="function"}_getIndexByTid(e){return this._task.findIndex(t=>t.tid===e)}_createTask(e){return this._isEffectiveTask(e)?{...e,tid:++this._id,meta:e.meta||{}}:!1}get task(){return[...this._task]}getTasks(){return[...this._task]}add(e){if(this._isEffectiveTask(e)){let t=this._createTask(e);return this._task.push(t),this.started&&!this.activeTask&&this.start(),t.tid}return!1}replace(e,t){if(!this._isEffectiveTask(t))return console.warn("[TaskQueue] replace\u65B9\u6CD5\u4F20\u5165\u7684task\u53C2\u6570\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;let n=this._getIndexByTid(e);if(n===-1)return console.warn(`[TaskQueue] \u6CA1\u6709\u627E\u5230id=${e}\u7684\u4EFB\u52A1`),!1;let i=this._createTask(t);return this._task.splice(n,1,i),i.tid}replaceByMetaType(e){let t=e.meta?.type;if((0,pu.isNil)(t))return this.add(e);{let n=this._task.find(i=>i.meta.type===t);if(n)return this.replace(n.tid,e)}}remove(e){let t=this._getIndexByTid(e);return t===-1?(console.warn(`[TaskQueue] remove\u65B9\u6CD5\u4F20\u5165\u7684id\uFF1A${e}\u627E\u4E0D\u5230\u5BF9\u5E94\u7684task`),!1):(this._task.splice(t,1),!0)}clear(){this._task.length=0}start(){this.started=!0,!this.activeTask&&this._task.length&&this.exec()}stop(){this.started=!1}async exec(){if(!this.started||!this._task.length)return!1;let e=this._task.shift();this.activeTask=e,this.dispatchEvent({type:"active-task-start",task:e});let t;try{t=await e.run()}catch(n){console.warn("[task run err]",n,e)}return this.activeTask=null,this.dispatchEvent({type:"active-task-end",task:e,res:t}),this.exec()}};var At=require("three");var Lu=require("three");var at=require("three");var gu=require("three/examples/jsm/lines/LineMaterial"),de=require("three");function mu(r){return`${r.x}-${r.y}-${r.z}`}var Zt=class{static lineMaterialMap=new Map;static meshStandardMaterialMap=new Map;static meshBasicMaterialMap=new Map;static shaderMaterialMap=new Map;static line2MaterialMap=new Map;static generateLineMaterialKey({color:e,opacity:t}){return`${e}-${t}`}static createLineMaterial({color:e,opacity:t}){let n=this.generateLineMaterialKey({color:e,opacity:t});if(this.lineMaterialMap.has(n))return this.lineMaterialMap.get(n);let i=new de.LineBasicMaterial({color:new de.Color(e).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(n,i),i}static createMeshStandardMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new de.MeshStandardMaterial({color:new de.Color(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshBasicMaterialMap.has(n))return this.meshBasicMaterialMap.get(n);let i=new de.MeshBasicMaterial({color:e,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(n,i),i}static createShaderMaterial({gradualColor:e,center:t,maxValue:n,opacity:i,direction:o,max:a,min:s}){let l=`${e.toString()}-${mu(t)}-${n}-${i}-${mu(o)}`;if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let u=`
1
+ "use strict";var mf=Object.create;var yi=Object.defineProperty;var gf=Object.getOwnPropertyDescriptor;var yf=Object.getOwnPropertyNames;var _f=Object.getPrototypeOf,vf=Object.prototype.hasOwnProperty;var yn=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),xf=(r,e)=>{for(var t in e)yi(r,t,{get:e[t],enumerable:!0})},Vs=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of yf(e))!vf.call(r,i)&&i!==t&&yi(r,i,{get:()=>e[i],enumerable:!(n=gf(e,i))||n.enumerable});return r};var Tr=(r,e,t)=>(t=r!=null?mf(_f(r)):{},Vs(e||!r||!r.__esModule?yi(t,"default",{value:r,enumerable:!0}):t,r)),Cf=r=>Vs(yi({},"__esModule",{value:!0}),r);var Ws=yn((Ey,js)=>{js.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var Zs=yn((Ty,Ys)=>{var qs=Ws();Ys.exports=function(r,e){Array.isArray(e)||(e=[]),r.length>0&&e.push(qs([0,0],r[0]));for(var t=0;t<r.length-1;t++){var n=r[t],i=r[t+1],o=n[0],a=n[1],s=i[0],l=i[1],u=[.75*o+.25*s,.75*a+.25*l],c=[.25*o+.75*s,.25*a+.75*l];e.push(u),e.push(c)}return r.length>1&&e.push(qs([0,0],r[r.length-1])),e}});var $s=yn((Iy,Ks)=>{var Uo=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,t)=>e.priority-t.priority)}set(e,t){let n=Number(t);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(e)?this.queue.map(i=>(i.key===e&&Object.assign(i,{priority:n}),i)):(this.keys.add(e),this.queue.push({key:e,priority:n})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(t=>t.key===e)}};Ks.exports=Uo});var eu=yn((Ry,tu)=>{function Js(r,e){let t=new Map;for(let[n,i]of r)n!==e&&i instanceof Map?t.set(n,Js(i,e)):n!==e&&t.set(n,i);return t}tu.exports=Js});var iu=yn((Ny,ru)=>{function Nf(r){let e=Number(r);return!(isNaN(e)||e<=0)}function nu(r){let e=new Map;return Object.keys(r).forEach(n=>{let i=r[n];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return e.set(n,nu(i));if(!Nf(i))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,i);return e.set(n,Number(i))}),e}ru.exports=nu});var su=yn((Ly,au)=>{function ou(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((e,t)=>{if(typeof e=="object"&&e instanceof Map){ou(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}au.exports=ou});var Oo=yn((Uy,cu)=>{var Lf=$s(),Uf=eu(),uu=iu(),lu=su(),Do=class{constructor(e){e instanceof Map?(lu(e),this.graph=e):e?this.graph=uu(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(lu(t),n=t):n=uu(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=Uf(this.graph,e),this}path(e,t,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let i=new Set,o=new Lf,a=new Map,s=[],l=0,u=[];if(n.avoid&&(u=[].concat(n.avoid)),u.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(u.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(o.set(e,0);!o.isEmpty();){let c=o.next();if(c.key===t){l=c.priority;let f=c.key;for(;a.has(f);)s.push(f),f=a.get(f);break}i.add(c.key),(this.graph.get(c.key)||new Map).forEach((f,d)=>{if(i.has(d)||u.includes(d))return null;if(!o.has(d))return a.set(d,c.key),o.set(d,c.priority+f);let m=o.get(d).priority,p=c.priority+f;return p<m?(a.set(d,c.key),o.set(d,p)):null})}return s.length?(n.trim?s.shift():s=s.concat([e]),n.reverse||(s=s.reverse()),n.cost?{path:s,cost:l}:s):n.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};cu.exports=Do});var sa=yn((oa,aa)=>{(function(r,e){typeof oa=="object"&&typeof aa<"u"?aa.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self,r["'typed'"]=e())})(oa,function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";function i(){function a(v){return typeof v=="object"&&v!==null&&v.constructor===Object}let s=[{name:"number",test:function(v){return typeof v=="number"}},{name:"string",test:function(v){return typeof v=="string"}},{name:"boolean",test:function(v){return typeof v=="boolean"}},{name:"Function",test:function(v){return typeof v=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(v){return v instanceof Date}},{name:"RegExp",test:function(v){return v instanceof RegExp}},{name:"Object",test:a},{name:"null",test:function(v){return v===null}},{name:"undefined",test:function(v){return v===void 0}}],l={name:"any",test:r,isAny:!0},u,c,h=0,f={createCount:0};function d(v){let E=u.get(v);if(E)return E;let P='Unknown type "'+v+'"',L=v.toLowerCase(),k;for(k of c)if(k.toLowerCase()===L){P+='. Did you mean "'+k+'" ?';break}throw new TypeError(P)}function m(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",P=E?d(E).index:c.length,L=[];for(let O=0;O<v.length;++O){if(!v[O]||typeof v[O].name!="string"||typeof v[O].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let W=v[O].name;if(u.has(W))throw new TypeError('Duplicate type name "'+W+'"');L.push(W),u.set(W,{name:W,test:v[O].test,isAny:v[O].isAny,index:P+O,conversionsTo:[]})}let k=c.slice(P);c=c.slice(0,P).concat(L).concat(k);for(let O=P+L.length;O<c.length;++O)u.get(c[O]).index=O}function p(){u=new Map,c=[],h=0,m([l],!1)}p(),m(s);function g(){let v;for(v of c)u.get(v).conversionsTo=[];h=0}function _(v){let E=c.filter(P=>{let L=u.get(P);return!L.isAny&&L.test(v)});return E.length?E:["any"]}function A(v){return v&&typeof v=="function"&&"_typedFunctionData"in v}function y(v,E,P){if(!A(v))throw new TypeError(n);let L=P&&P.exact,k=Array.isArray(E)?E.join(","):E,O=I(k),W=x(O);if(!L||W in v.signatures){let ut=v._typedFunctionData.signatureMap.get(W);if(ut)return ut}let X=O.length,q;if(L){q=[];let ut;for(ut in v.signatures)q.push(v._typedFunctionData.signatureMap.get(ut))}else q=v._typedFunctionData.signatures;for(let ut=0;ut<X;++ut){let pt=O[ut],Mt=[],xe;for(xe of q){let fe=V(xe.params,ut);if(!(!fe||pt.restParam&&!fe.restParam)){if(!fe.hasAny){let qe=T(fe);if(pt.types.some(Ye=>!qe.has(Ye.name)))continue}Mt.push(xe)}}if(q=Mt,q.length===0)break}let F;for(F of q)if(F.params.length<=X)return F;throw new TypeError("Signature not found (signature: "+(v.name||"unnamed")+"("+x(O,", ")+"))")}function S(v,E,P){return y(v,E,P).implementation}function C(v,E){let P=d(E);if(P.test(v))return v;let L=P.conversionsTo;if(L.length===0)throw new Error("There are no conversions to "+E+" defined.");for(let k=0;k<L.length;k++)if(d(L[k].from).test(v))return L[k].convert(v);throw new Error("Cannot convert "+v+" to "+E)}function x(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return v.map(P=>P.name).join(E)}function b(v){let E=v.indexOf("...")===0,L=(E?v.length>3?v.slice(3):"any":v).split("|").map(X=>d(X.trim())),k=!1,O=E?"...":"";return{types:L.map(function(X){return k=X.isAny||k,O+=X.name+"|",{name:X.name,typeIndex:X.index,test:X.test,isAny:X.isAny,conversion:null,conversionIndex:-1}}),name:O.slice(0,-1),hasAny:k,hasConversion:!1,restParam:E}}function w(v){let E=v.types.map(W=>W.name),P=_t(E),L=v.hasAny,k=v.name,O=P.map(function(W){let X=d(W.from);return L=X.isAny||L,k+="|"+W.from,{name:W.from,typeIndex:X.index,test:X.test,isAny:X.isAny,conversion:W,conversionIndex:W.index}});return{types:v.types.concat(O),name:k,hasAny:L,hasConversion:O.length>0,restParam:v.restParam}}function T(v){return v.typeSet||(v.typeSet=new Set,v.types.forEach(E=>v.typeSet.add(E.name))),v.typeSet}function I(v){let E=[];if(typeof v!="string")throw new TypeError("Signatures must be strings");let P=v.trim();if(P==="")return E;let L=P.split(",");for(let k=0;k<L.length;++k){let O=b(L[k].trim());if(O.restParam&&k!==L.length-1)throw new SyntaxError('Unexpected rest parameter "'+L[k]+'": only allowed for the last parameter');if(O.types.length===0)return null;E.push(O)}return E}function R(v){let E=Vt(v);return E?E.restParam:!1}function U(v){if(!v||v.types.length===0)return r;if(v.types.length===1)return d(v.types[0].name).test;if(v.types.length===2){let E=d(v.types[0].name).test,P=d(v.types[1].name).test;return function(k){return E(k)||P(k)}}else{let E=v.types.map(function(P){return d(P.name).test});return function(L){for(let k=0;k<E.length;k++)if(E[k](L))return!0;return!1}}}function Z(v){let E,P,L;if(R(v)){E=Bt(v).map(U);let k=E.length,O=U(Vt(v)),W=function(X){for(let q=k;q<X.length;q++)if(!O(X[q]))return!1;return!0};return function(q){for(let F=0;F<E.length;F++)if(!E[F](q[F]))return!1;return W(q)&&q.length>=k+1}}else return v.length===0?function(O){return O.length===0}:v.length===1?(P=U(v[0]),function(O){return P(O[0])&&O.length===1}):v.length===2?(P=U(v[0]),L=U(v[1]),function(O){return P(O[0])&&L(O[1])&&O.length===2}):(E=v.map(U),function(O){for(let W=0;W<E.length;W++)if(!E[W](O[W]))return!1;return O.length===E.length})}function V(v,E){return E<v.length?v[E]:R(v)?Vt(v):null}function j(v,E){let P=V(v,E);return P?T(P):new Set}function D(v){return v.conversion===null||v.conversion===void 0}function Q(v,E){let P=new Set;return v.forEach(L=>{let k=j(L.params,E),O;for(O of k)P.add(O)}),P.has("any")?["any"]:Array.from(P)}function K(v,E,P){let L,k,O=v||"unnamed",W=P,X;for(X=0;X<E.length;X++){let pt=[];if(W.forEach(Mt=>{let xe=V(Mt.params,X),fe=U(xe);(X<Mt.params.length||R(Mt.params))&&fe(E[X])&&pt.push(Mt)}),pt.length===0){if(k=Q(W,X),k.length>0){let Mt=_(E[X]);return L=new TypeError("Unexpected type of argument in function "+O+" (expected: "+k.join(" or ")+", actual: "+Mt.join(" | ")+", index: "+X+")"),L.data={category:"wrongType",fn:O,index:X,actual:Mt,expected:k},L}}else W=pt}let q=W.map(function(pt){return R(pt.params)?1/0:pt.params.length});if(E.length<Math.min.apply(null,q))return k=Q(W,X),L=new TypeError("Too few arguments in function "+O+" (expected: "+k.join(" or ")+", index: "+E.length+")"),L.data={category:"tooFewArgs",fn:O,index:E.length,expected:k},L;let F=Math.max.apply(null,q);if(E.length>F)return L=new TypeError("Too many arguments in function "+O+" (expected: "+F+", actual: "+E.length+")"),L.data={category:"tooManyArgs",fn:O,index:E.length,expectedLength:F},L;let ut=[];for(let pt=0;pt<E.length;++pt)ut.push(_(E[pt]).join("|"));return L=new TypeError('Arguments of type "'+ut.join(", ")+'" do not match any of the defined signatures of function '+O+"."),L.data={category:"mismatch",actual:ut},L}function G(v){let E=c.length+1;for(let P=0;P<v.types.length;P++)D(v.types[P])&&(E=Math.min(E,v.types[P].typeIndex));return E}function nt(v){let E=h+1;for(let P=0;P<v.types.length;P++)D(v.types[P])||(E=Math.min(E,v.types[P].conversionIndex));return E}function yt(v,E){if(v.hasAny){if(!E.hasAny)return 1}else if(E.hasAny)return-1;if(v.restParam){if(!E.restParam)return 1}else if(E.restParam)return-1;if(v.hasConversion){if(!E.hasConversion)return 1}else if(E.hasConversion)return-1;let P=G(v)-G(E);if(P<0)return-1;if(P>0)return 1;let L=nt(v)-nt(E);return L<0?-1:L>0?1:0}function ft(v,E){let P=v.params,L=E.params,k=Vt(P),O=Vt(L),W=R(P),X=R(L);if(W&&k.hasAny){if(!X||!O.hasAny)return 1}else if(X&&O.hasAny)return-1;let q=0,F=0,ut;for(ut of P)ut.hasAny&&++q,ut.hasConversion&&++F;let pt=0,Mt=0;for(ut of L)ut.hasAny&&++pt,ut.hasConversion&&++Mt;if(q!==pt)return q-pt;if(W&&k.hasConversion){if(!X||!O.hasConversion)return 1}else if(X&&O.hasConversion)return-1;if(F!==Mt)return F-Mt;if(W){if(!X)return 1}else if(X)return-1;let xe=(P.length-L.length)*(W?-1:1);if(xe!==0)return xe;let fe=[],qe=0;for(let Hn=0;Hn<P.length;++Hn){let mi=yt(P[Hn],L[Hn]);fe.push(mi),qe+=mi}if(qe!==0)return qe;let Ye;for(Ye of fe)if(Ye!==0)return Ye;return 0}function _t(v){if(v.length===0)return[];let E=v.map(d);v.length>1&&E.sort((k,O)=>k.index-O.index);let P=E[0].conversionsTo;if(v.length===1)return P;P=P.concat([]);let L=new Set(v);for(let k=1;k<E.length;++k){let O;for(O of E[k].conversionsTo)L.has(O.from)||(P.push(O),L.add(O.from))}return P}function zt(v,E){let P=E;if(v.some(k=>k.hasConversion)){let k=R(v),O=v.map(Dt);P=function(){let X=[],q=k?arguments.length-1:arguments.length;for(let F=0;F<q;F++)X[F]=O[F](arguments[F]);return k&&(X[q]=arguments[q].map(O[q])),E.apply(this,X)}}let L=P;if(R(v)){let k=v.length-1;L=function(){return P.apply(this,Ne(arguments,0,k).concat([Ne(arguments,k)]))}}return L}function Dt(v){let E,P,L,k,O=[],W=[];switch(v.types.forEach(function(X){X.conversion&&(O.push(d(X.conversion.from).test),W.push(X.conversion.convert))}),W.length){case 0:return function(q){return q};case 1:return E=O[0],L=W[0],function(q){return E(q)?L(q):q};case 2:return E=O[0],P=O[1],L=W[0],k=W[1],function(q){return E(q)?L(q):P(q)?k(q):q};default:return function(q){for(let F=0;F<W.length;F++)if(O[F](q))return W[F](q);return q}}}function Nt(v){function E(P,L,k){if(L<P.length){let O=P[L],W=[];if(O.restParam){let X=O.types.filter(D);X.length<O.types.length&&W.push({types:X,name:"..."+X.map(q=>q.name).join("|"),hasAny:X.some(q=>q.isAny),hasConversion:!1,restParam:!0}),W.push(O)}else W=O.types.map(function(X){return{types:[X],name:X.name,hasAny:X.isAny,hasConversion:X.conversion,restParam:!1}});return Ln(W,function(X){return E(P,L+1,k.concat([X]))})}else return[k]}return E(v,0,[])}function wt(v,E){let P=Math.max(v.length,E.length);for(let X=0;X<P;X++){let q=j(v,X),F=j(E,X),ut=!1,pt;for(pt of F)if(q.has(pt)){ut=!0;break}if(!ut)return!1}let L=v.length,k=E.length,O=R(v),W=R(E);return O?W?L===k:k>=L:W?L>=k:L===k}function te(v){return v.map(E=>di(E)?fi(E.referToSelf.callback):pi(E)?Gn(E.referTo.references,E.referTo.callback):E)}function Tt(v,E,P){let L=[],k;for(k of v){let O=P[k];if(typeof O!="number")throw new TypeError('No definition for referenced signature "'+k+'"');if(O=E[O],typeof O!="function")return!1;L.push(O)}return L}function vt(v,E,P){let L=te(v),k=new Array(L.length).fill(!1),O=!0;for(;O;){O=!1;let W=!0;for(let X=0;X<L.length;++X){if(k[X])continue;let q=L[X];if(di(q))L[X]=q.referToSelf.callback(P),L[X].referToSelf=q.referToSelf,k[X]=!0,W=!1;else if(pi(q)){let F=Tt(q.referTo.references,L,E);F?(L[X]=q.referTo.callback.apply(this,F),L[X].referTo=q.referTo,k[X]=!0,W=!1):O=!0}}if(W&&O)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return L}function ve(v){let E=/\bthis(\(|\.signatures\b)/;Object.keys(v).forEach(P=>{let L=v[P];if(E.test(L.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Ft(v,E){if(f.createCount++,Object.keys(E).length===0)throw new SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&ve(E);let P=[],L=[],k={},O=[],W;for(W in E){if(!Object.prototype.hasOwnProperty.call(E,W))continue;let Ct=I(W);if(!Ct)continue;P.forEach(function(Er){if(wt(Er,Ct))throw new TypeError('Conflicting signatures "'+x(Er)+'" and "'+x(Ct)+'".')}),P.push(Ct);let Ce=L.length;L.push(E[W]);let pf=Ct.map(w),gi;for(gi of Nt(pf)){let Er=x(gi);O.push({params:gi,name:Er,fn:Ce}),gi.every(df=>!df.hasConversion)&&(k[Er]=Ce)}}O.sort(ft);let X=vt(L,k,wr),q;for(q in k)Object.prototype.hasOwnProperty.call(k,q)&&(k[q]=X[k[q]]);let F=[],ut=new Map;for(q of O)ut.has(q.name)||(q.fn=X[q.fn],F.push(q),ut.set(q.name,q));let pt=F[0]&&F[0].params.length<=2&&!R(F[0].params),Mt=F[1]&&F[1].params.length<=2&&!R(F[1].params),xe=F[2]&&F[2].params.length<=2&&!R(F[2].params),fe=F[3]&&F[3].params.length<=2&&!R(F[3].params),qe=F[4]&&F[4].params.length<=2&&!R(F[4].params),Ye=F[5]&&F[5].params.length<=2&&!R(F[5].params),Hn=pt&&Mt&&xe&&fe&&qe&&Ye;for(let Ct=0;Ct<F.length;++Ct)F[Ct].test=Z(F[Ct].params);let mi=pt?U(F[0].params[0]):e,Bh=Mt?U(F[1].params[0]):e,kh=xe?U(F[2].params[0]):e,Xh=fe?U(F[3].params[0]):e,Fh=qe?U(F[4].params[0]):e,Vh=Ye?U(F[5].params[0]):e,jh=pt?U(F[0].params[1]):e,Wh=Mt?U(F[1].params[1]):e,qh=xe?U(F[2].params[1]):e,Yh=fe?U(F[3].params[1]):e,Zh=qe?U(F[4].params[1]):e,Qh=Ye?U(F[5].params[1]):e;for(let Ct=0;Ct<F.length;++Ct)F[Ct].implementation=zt(F[Ct].params,F[Ct].fn);let Gh=pt?F[0].implementation:t,Hh=Mt?F[1].implementation:t,Kh=xe?F[2].implementation:t,$h=fe?F[3].implementation:t,Jh=qe?F[4].implementation:t,tf=Ye?F[5].implementation:t,ef=pt?F[0].params.length:-1,nf=Mt?F[1].params.length:-1,rf=xe?F[2].params.length:-1,of=fe?F[3].params.length:-1,af=qe?F[4].params.length:-1,sf=Ye?F[5].params.length:-1,uf=Hn?6:0,lf=F.length,cf=F.map(Ct=>Ct.test),hf=F.map(Ct=>Ct.implementation),ff=function(){for(let Ce=uf;Ce<lf;Ce++)if(cf[Ce](arguments))return hf[Ce].apply(this,arguments);return f.onMismatch(v,arguments,F)};function wr(Ct,Ce){return arguments.length===ef&&mi(Ct)&&jh(Ce)?Gh.apply(this,arguments):arguments.length===nf&&Bh(Ct)&&Wh(Ce)?Hh.apply(this,arguments):arguments.length===rf&&kh(Ct)&&qh(Ce)?Kh.apply(this,arguments):arguments.length===of&&Xh(Ct)&&Yh(Ce)?$h.apply(this,arguments):arguments.length===af&&Fh(Ct)&&Zh(Ce)?Jh.apply(this,arguments):arguments.length===sf&&Vh(Ct)&&Qh(Ce)?tf.apply(this,arguments):ff.apply(this,arguments)}try{Object.defineProperty(wr,"name",{value:v})}catch{}return wr.signatures=k,wr._typedFunctionData={signatures:F,signatureMap:ut},wr}function mt(v,E,P){throw K(v,E,P)}function Bt(v){return Ne(v,0,v.length-1)}function Vt(v){return v[v.length-1]}function Ne(v,E,P){return Array.prototype.slice.call(v,E,P)}function tn(v,E){for(let P=0;P<v.length;P++)if(E(v[P]))return v[P]}function Ln(v,E){return Array.prototype.concat.apply([],v.map(E))}function gn(){let v=Bt(arguments).map(P=>x(I(P))),E=Vt(arguments);if(typeof E!="function")throw new TypeError("Callback function expected as last argument");return Gn(v,E)}function Gn(v,E){return{referTo:{references:v,callback:E}}}function fi(v){if(typeof v!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:v}}}function pi(v){return v&&typeof v.referTo=="object"&&Array.isArray(v.referTo.references)&&typeof v.referTo.callback=="function"}function di(v){return v&&typeof v.referToSelf=="object"&&typeof v.referToSelf.callback=="function"}function br(v,E){if(!v)return E;if(E&&E!==v){let P=new Error("Function names do not match (expected: "+v+", actual: "+E+")");throw P.data={actual:E,expected:v},P}return v}function Sr(v){let E;for(let P in v)Object.prototype.hasOwnProperty.call(v,P)&&(A(v[P])||typeof v[P].signature=="string")&&(E=br(E,v[P].name));return E}function M(v,E){let P;for(P in E)if(Object.prototype.hasOwnProperty.call(E,P)){if(P in v&&E[P]!==v[P]){let L=new Error('Signature "'+P+'" is defined twice');throw L.data={signature:P,sourceFunction:E[P],destFunction:v[P]},L}v[P]=E[P]}}let Y=f;f=function(v){let E=typeof v=="string",P=E?1:0,L=E?v:"",k={};for(let O=P;O<arguments.length;++O){let W=arguments[O],X={},q;if(typeof W=="function"?(q=W.name,typeof W.signature=="string"?X[W.signature]=W:A(W)&&(X=W.signatures)):a(W)&&(X=W,E||(q=Sr(W))),Object.keys(X).length===0){let F=new TypeError("Argument to 'typed' at index "+O+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw F.data={index:O,argument:W},F}E||(L=br(L,q)),M(k,X)}return Ft(L||"",k)},f.create=i,f.createCount=Y.createCount,f.onMismatch=mt,f.throwMismatchError=mt,f.createError=K,f.clear=p,f.clearConversions=g,f.addTypes=m,f._findType=d,f.referTo=gn,f.referToSelf=fi,f.convert=C,f.findSignature=y,f.find=S,f.isTypedFunction=A,f.warnAgainstDeprecatedThis=!0,f.addType=function(v,E){let P="any";E!==!1&&u.has("Object")&&(P="Object"),f.addTypes([v],P)};function xt(v){if(!v||typeof v.from!="string"||typeof v.to!="string"||typeof v.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(v.to===v.from)throw new SyntaxError('Illegal to define conversion from "'+v.from+'" to itself.')}return f.addConversion=function(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};xt(v);let P=d(v.to),L=P.conversionsTo.find(k=>k.from===v.from);if(L)if(E&&E.override)f.removeConversion({from:L.from,to:v.to,convert:L.convert});else throw new Error('There is already a conversion from "'+v.from+'" to "'+P.name+'"');P.conversionsTo.push({from:v.from,convert:v.convert,index:h++})},f.addConversions=function(v,E){v.forEach(P=>f.addConversion(P,E))},f.removeConversion=function(v){xt(v);let E=d(v.to),P=tn(E.conversionsTo,k=>k.from===v.from);if(!P)throw new Error("Attempt to remove nonexistent conversion from "+v.from+" to "+v.to);if(P.convert!==v.convert)throw new Error("Conversion to remove does not match existing conversion");let L=E.conversionsTo.indexOf(P);E.conversionsTo.splice(L,1)},f.resolve=function(v,E){if(!A(v))throw new TypeError(n);let P=v._typedFunctionData.signatures;for(let L=0;L<P.length;++L)if(P[L].test(E))return P[L];return null},f}var o=i();return o})});var oy={};xf(oy,{AibeeLoader:()=>Xs,BMap:()=>Yo,BMapSelect:()=>ea,BaseSvg:()=>Pe,ClickHelper:()=>Nr,Context:()=>Qr,CrLoader:()=>Fs,CrNavPath:()=>ta,Equipment:()=>Zo,Events:()=>Po,Floor:()=>Me,GlbModel:()=>Vr,Graphic:()=>Qt,GraphicLayer:()=>zr,GroundTexture:()=>nr,HeatmapElement:()=>Dr,HooksName:()=>tr,HoverHelper:()=>Zr,Lane:()=>jr,Layer:()=>ie,MapTypePolar:()=>Fu,MergeGraphic:()=>Wr,Model:()=>Or,MulFloorNavigation:()=>Is,MulFloorSelect:()=>Rs,MulFloors:()=>Ho,NavPath:()=>$o,Navigation:()=>Go,Overlay:()=>Ur,PathDirection:()=>No,PdrPosition:()=>Ps,Poi:()=>bn,Poi2:()=>Gt,PoiLayer:()=>Br,PoiLayer2:()=>Vn,RoadNetwork:()=>zo,RoadNetwork2:()=>Bo,SelectBox:()=>Fo,Selection:()=>Yr,Sensor:()=>Kr,Shadow:()=>Lr,SvgLine:()=>kr,SvgPolygon:()=>Xr,TaskQueue:()=>xn,TextTexture:()=>qr,Timer:()=>ee,TweenUtil:()=>hn,UA:()=>To,Wall:()=>Fr,addAlphaToHexColor:()=>Ef,calc_angle:()=>Ao,calc_direction:()=>xi,convertToSnakeCase:()=>ko,createCircle:()=>$n,createLine:()=>Ir,createRect:()=>cn,createSvg:()=>wo,createSvgElement:()=>Pr,createThreeBox:()=>zf,createThreeLine:()=>Of,darkenColor:()=>en,defaultAibeeLoaderOption:()=>iy,defaultConfig:()=>ku,defaultGraphicOptions:()=>Ci,defaultOptions:()=>wu,defaultTextTextureOptions:()=>Ru,deviceToVector3:()=>Af,dispose:()=>ne,distancePointToSegment:()=>Ro,generatorKeyByObj:()=>zn,getAngle:()=>Gs,getCenter:()=>Mr,getConfig:()=>qo,getDirectPath:()=>Rf,getDistanceByPathPos:()=>Lo,getLength:()=>Yt,getLongestSideDir:()=>bf,getMinEdgeSquare:()=>bo,getPathLength:()=>Le,getPointEdgeIndex:()=>ln,getPosByPathDistance:()=>Bn,hasChinese:()=>Co,hexToRgb:()=>vi,initDirectionalLight:()=>xo,initLight:()=>vo,initShape:()=>Ze,isAndroid:()=>Tf,isContain:()=>un,isControl:()=>On,isIphone:()=>Jn,isMac:()=>Dn,isPointInPolygon:()=>So,loadBuildingGround:()=>Ns,loadExternalStreet:()=>jg,loadGraphics:()=>Ls,moveOnRoute:()=>If,proxyOptions:()=>Un,removeWeightPath:()=>Hs,setCirclePosition:()=>_n,setLineStartEnd:()=>Ue,setRectPosition:()=>se,simplifyPath:()=>Rr,sleepOnePromise:()=>Eo,sleepOneRf:()=>_i,smoothPath:()=>Io,strToNumber:()=>wf,timeoutPromise:()=>Te,toWebWorker:()=>Df,transformGraphicData:()=>pe,translatePosToCenter:()=>Oe,triggerWorker:()=>Qe,vector3ToDevice:()=>rt,xhrGet:()=>Mf});module.exports=Cf(oy);var zi=require("three");var ee=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(e){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),e()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(e){this.tasks.requestAnimation.delete(e),window.cancelAnimationFrame(e)}setTimeout(e,t){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),e()},t);return this.tasks.timeout.add(n),n}clearTimeout(e){this.tasks.timeout.delete(e),window.clearTimeout(e)}setInterval(e,t){let n=window.setInterval(()=>{this.tasks.interval.delete(n),e()},t);return this.tasks.interval.add(n),n}clearInterval(e){this.tasks.interval.delete(e),window.clearInterval(e)}dispose(){this.tasks.requestAnimation.forEach(e=>{window.cancelAnimationFrame(e)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(e=>{window.clearTimeout(e)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(e=>{window.clearInterval(e)}),this.tasks.interval.clear()}};var Ee=require("three");function vo(){let r=new Ee.Group,e=new Ee.AmbientLight(16777215,2.6);return r.add(e),r}function Ze(r,e=[]){let t=new Ee.Shape(r.map(n=>new Ee.Vector2(...n)));return e.length&&e.forEach(n=>{var i=new Ee.Path(n.map(o=>new Ee.Vector2(...o)));t.holes.push(i)}),t}function xo(r=16777215,e=1){let t=new Ee.DirectionalLight(r,e);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function ne(r,e){if(e&&r.children&&r.children.length&&r.children.forEach(t=>{ne(t,e)}),r.isMesh){let t=r;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n.dispose()}):t.material.dispose())}r.isLight&&r.dispose?.()}function Co(r){return/[\u4E00-\u9FA5]+/g.test(r)}var kt=require("three"),Kn=require("@turf/turf");function rt(r,e,t,n){let i=r.clone().project(e),o=t/2,a=n/2,s=Math.round(i.x*o+o),l=Math.round(-i.y*a+a);return{x:s,y:l}}function Af(r,e,t,n,i){if(!i)return null;t=Math.min(1,t),n=Math.min(1,n);let o=r/t*2-1,a=1-e/n*2;return new kt.Vector3(o,a,0).unproject(i)}function Mr(r){let e=(0,Kn.featureCollection)(r.map(n=>(0,Kn.point)(n)));return(0,Kn.center)(e).geometry.coordinates}function un(r,e,t){return r.x>=e.x&&r.x<=t.x&&r.y>=e.y&&r.y<=t.y}function bf(r){let e=0,t=new kt.Vector3;for(let n=1;n<r.length;n++){let i=new kt.Vector3(r[n-1][0],r[n-1][1],0),o=new kt.Vector3(r[n][0],r[n][1],0),a=o.distanceTo(i);a>e&&(e=a,t=o.clone().sub(i).normalize())}return t}function Yt(r,e){return Math.sqrt((e[0]-r[0])**2+(e[1]-r[1])**2)}function Le(r){let e=0;for(let t=0;t<r.length-1;t++)e+=Yt(r[t],r[t+1]);return e}function Ao(r,e,t){let n=new kt.Vector2(e[0]-r[0],e[1]-r[1]),i=new kt.Vector2(e[0]-t[0],e[1]-t[1]),a=n.angleTo(i)*180/Math.PI,s=new kt.Vector2(e[0]-r[0],e[1]-r[1]);return new kt.Vector2(t[0]-r[0],t[1]-r[1]).cross(s)>0?a:-a}function bo(r,e){let t=Math.min(Yt(r[0][0],r[0][1]),Yt(r[0][2],r[0][1]))-1;e||(e=Mr(r[0]));let n=Sf(e,t),i=new kt.Vector2(r[0][0][0],r[0][0][1]),o=new kt.Vector2(r[0][1][0],r[0][1][1]),a=new kt.Vector2(r[0][2][0],r[0][2][1]),l=(i.distanceTo(o)>o.distanceTo(a)?o.clone().sub(i):a.clone().sub(o)).angleTo(new kt.Vector2(0,1)),u=new kt.Matrix3;return u.multiply(new kt.Matrix3().translate(e[0],e[1])).multiply(new kt.Matrix3().rotate(l)).multiply(new kt.Matrix3().translate(-e[0],-e[1])),[n.map(c=>{let h=new kt.Vector2(c[0],c[1]).applyMatrix3(u);return[h.x,h.y]})]}function Sf(r,e){let t=e/2;return[[r[0]-t,r[1]+t],[r[0]+t,r[1]+t],[r[0]+t,r[1]-t],[r[0]-t,r[1]-t],[r[0]-t,r[1]+t]]}function ln(r,e){let t=0,n=1/0,[i,o]=e;for(let a=0;a<r.length-1;a++){let[s,l]=r[a],[u,c]=r[a+1],h=Math.min(s,u)<=i&&i<=Math.max(s,u),f=Math.min(l,c)<=o&&o<=Math.max(l,c);if(h&&f){let d=Math.abs((u-s)*(o-l)-(c-l)*(i-s));d<n&&(n=d,t=a)}}return t}function So(r,e){let t=r[0],n=r[1],i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let s=e[o][0],l=e[o][1],u=e[a][0],c=e[a][1];l>n!=c>n&&t<(u-s)*(n-l)/(c-l)+s&&(i=!i)}return i}function Un(r,e){return new Proxy(r,{get:(t,n,i)=>Reflect.get(t,n,i),set:(t,n,i,o)=>{let a=Reflect.get(t,n,o),s=Reflect.set(t,n,i,o);return a!==i&&e.dispatchEvent({type:`change-${n}`,value:i}),s}})}function Te(r,e){return Promise.race([r,new Promise((t,n)=>{setTimeout(()=>n(new Error("Promise timeout")),e)})])}function Pr(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function wo(r,e){let t=Pr("svg");return t.setAttribute("width",r),t.setAttribute("height",e),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function $n(r="2",e){let t=Pr("circle");return t.setAttribute("r",r),t.setAttribute("fill",e),t}function Ir(r){let e=Pr("line");return e.setAttribute("stroke",r),e}function cn(r,e){let t=Pr("rect");return t.setAttribute("stroke",r),t.setAttribute("fill",e),t}function _n(r,e,t){r.setAttribute("cx",`${e}`),r.setAttribute("cy",`${t}`)}function Ue(r,e,t){e&&(r.setAttribute("x1",`${e.x}`),r.setAttribute("y1",`${e.y}`)),t&&(r.setAttribute("x2",`${t.x}`),r.setAttribute("y2",`${t.y}`))}function se(r,e,t,n,i){r.setAttribute("x",`${e}`),r.setAttribute("y",`${t}`),r.setAttribute("width",`${n}`),r.setAttribute("height",`${i}`)}function Eo(){return Promise.resolve()}function _i(){return new Promise(r=>{requestAnimationFrame(r)})}function wf(r){return parseInt(r.replace("#","0x"),16)}function Ef(r,e){let t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(t*e),a=Math.round(n*e),s=Math.round(i*e);return`#${(1<<24|o<<16|a<<8|s).toString(16).slice(1)}`}function en(r,e=.85){let t,n,i;if(r.startsWith("#"))t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let a=r.slice(4,-1).split(",");t=parseInt(a[0].trim()),n=parseInt(a[1].trim()),i=parseInt(a[2].trim())}return t=Math.min(Math.floor(t*e),255),n=Math.min(Math.floor(n*e),255),i=Math.min(Math.floor(i*e),255),"#"+((1<<24)+(t<<16)+(n<<8)+i).toString(16).slice(1)}function vi(r,e){r=r.replace(/^#/,"");let t=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return e!==void 0?`rgba(${t}, ${n}, ${i}, ${e})`:`rgb(${t}, ${n}, ${i})`}var Dn=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,To=(navigator.userAgent||"").toLocaleLowerCase(),Jn=/ios|iphone/i.test(To),Tf=/android|adr|linux/gi.test(To);function On(r){return Dn?r==="Meta":r==="Control"}var Mo="__once__",Po=class{events=new Map;on(e,t){if(typeof t!="function")return;let n=this.events.get(e);return n?n.add(t):this.events.set(e,new Set([t]))}once(e,t){if(typeof t!="function")return;let n=`${Mo}${e}`,i=this.events.get(n);return i?i.add(t):this.events.set(n,new Set([t]))}off(e,t){let n=this.events.get(e),i=this.events.get(`${Mo}${e}`);!n&&!i||(t===void 0&&(n?.clear(),i?.clear()),n?.has(t)&&n.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(e,...t){let n=this.events.get(e),i=this.events.get(`${Mo}${e}`);!n&&!i||(n?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.clear())}};var tr=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(tr||{});function zn(r){return Object.keys(r).sort().map(e=>`${e}=${r[e]}`).join("&")}function Mf(r,e){return new Promise((t,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(e.headers||{}).forEach(o=>{i.setRequestHeader(o,e.headers[o])}),e.responseType&&(i.responseType=e.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(e.responseType==="arraybuffer")t(i.response);else try{let o=JSON.parse(i.responseText);t(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var er=require("three"),Qs=Tr(Zs(),1);function Gs(r,e){let t=r.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function Pf(r){let e=0;return r.reduce(([t,n],[i,o])=>(e+=Math.sqrt((i-t)**2+(o-n)**2),[i,o])),e/r.length}function Io(r,e=.25){if(Pf(r)<e)return r;let t=(0,Qs.default)(r);return Io(t,e)}function Rr(r,e=!1,t=!0,n=5,i=150,o=3){let a=[],s=!e;if(a.push(r[0]),r.length<2)return a;for(let u=0;u<r.length-2;u+=1){let c=r[u],h=r[u+1],f=r[u+2],d=new er.Vector2(c[0]-h[0],c[1]-h[1]),m=new er.Vector2(f[0]-h[0],f[1]-h[1]),p=Gs(d,m)/Math.PI*180,g=d.length()+m.length();(!s||p<i&&g>.01||g>n)&&(a.push(r[u+1]),s=!0)}if(a.push(r[r.length-1]),!t)return a;let l=[];l.push(a[0]);for(let u=0;u<a.length-2;u+=1){let c=new er.Vector2(a[u][0],a[u][1]),h=new er.Vector2(a[u+1][0],a[u+1][1]),f=new er.Vector2(a[u+2][0],a[u+2][1]),d=c.distanceTo(h)/2,m=f.distanceTo(h)/2,p=h.clone(),g=h.clone();p.add(c.clone().sub(h).normalize().multiplyScalar(d>o?o/2:d)),g.add(f.clone().sub(h).normalize().multiplyScalar(m>o?o/2:m));let _=[[p.x,p.y],[h.x,h.y],[g.x,g.y]];l.push(...Io(_,o/25))}return l.push(a[a.length-1]),Hs(l)}function Hs(r){if(r.length<=1)return r;let e=[],t;return r.forEach(([n,i])=>{t?n===t[0]&&i===t[1]||(t=[n,i],e.push([n,i])):(t=[n,i],e.push([n,i]))}),e}function Ro(r,e,t){let n=Math.sqrt((t[0]-e[0])**2+(t[1]-e[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2),closestPoint:e.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-e[0])*(t[0]-e[0])+(r[1]-e[1])*(t[1]-e[1]))/n**2)),o=[e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function If(r,e,t){let[n,i]=r,[o,a]=e,s=Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2));if(s===0||s<t)return[...e];let l=t/s,u=n+(o-n)*l,c=i+(a-i)*l;return[u,c]}var No=(u=>(u.START="start",u.END="end",u.FRONT="front",u.RIGHT="right",u.LEFT="left",u.RIGHT_FRONT="right_front",u.LEFT_FRONT="left_front",u.RIGHT_BACK="right_back",u.LEFT_BACK="left_back",u))(No||{});function xi(r,e,t){let n=Ao(r,e,t);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function Rf(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let e=[{direction:"start",distance:Yt(r[0],r[1]),points:[r[0],r[1]]}];for(let t=2;t<r.length;t++){let n=xi(r[t-2],r[t-1],r[t]);if(n==="front"){let i=e[e.length-1],o=Yt(r[t-1],r[t]);i.distance+=o,t!==2&&i.points.push(r[t-1])}else e.push({direction:n,distance:Yt(r[t-1],r[t]),points:[r[t-1],r[t]]})}return e.push({direction:"end",distance:0,points:[r[r.length-1]]}),e}function Lo(r,e){if(r.length<2)return-1;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=[e[0]-i[0],e[1]-i[1]],s=[o[0]-i[0],o[1]-i[1]],l=Math.min(o[0],i[0])<=e[0]&&e[0]<=Math.max(o[0],i[0]),u=Math.min(o[1],i[1])<=e[1]&&e[1]<=Math.max(o[1],i[1]);if(l&&u){let c=a[0]*s[1]-a[1]*s[0];if(Math.abs(c)<1e-6){let h=Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2);return t+h}}t+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function Bn(r,e){if(r.length<2)return r[0]??null;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2);if(t+=a,t>=e){let s=(e-(t-a))/a,l=i[0]+(o[0]-i[0])*s,u=i[1]+(o[1]-i[1])*s;return[l,u]}}return null}var nn=Tr(Oo(),1);var De="___",zo=class{constructor(e=3){this.lift_priority=e}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new nn.default;escalatorRoute=new nn.default;straightLadderRoute=new nn.default;initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(t=>{t.points.forEach(n=>{let i=`${t.floor}${De}${n.id}`;if(this.pointMap.set(i,n),this.nodeMap.set(`${n.floor}${De}${n.nodeId}`,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push({...n}),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push({...n}),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push({...n}),this.facilityMap.set(n.targetId,o)}}),t.lines.filter(n=>n.direction!=="no").forEach(n=>{let i=`${t.floor}${De}${n.from}`,o=`${t.floor}${De}${n.to}`,a=this.pointMap.get(i)?.cds,s=this.pointMap.get(o)?.cds;if(a?.length&&s?.length){let l=Yt(a,s);this.addLineItem(i,o,l),n.direction==="double"&&this.addLineItem(o,i,l)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let l=`${a[s].floor}${De}${a[s].id}`;for(let u=0;u<a.length;u++)if(s!==u){let c=`${a[u].floor}${De}${a[u].id}`,h=this.pointMap.get(l)?.cds,f=this.pointMap.get(c)?.cds;if(h?.length&&f?.length)if(a[s].type==="straightLadder"){let d=t;this.addLineItem(l,c,d,i)}else{let d=n;this.addLineItem(l,c,d,i)}}}}),this.escalatorMap.forEach((o,a)=>{if(o.start&&o.end){let s=`${o.start.floor}${De}${o.start.id}`,l=`${o.end.floor}${De}${o.end.id}`,u=this.pointMap.get(s)?.cds,c=this.pointMap.get(l)?.cds;if(u?.length&&c?.length){let h=e;this.addLineItem(s,l,h,i)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new nn.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new nn.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new nn.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${De}${e.nodeId}`);if(t){let[n,i]=t.split(De);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{let a=Yt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:n.point.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let s=this.facilityMap.get(o.facility).filter(u=>o.floor?u.floor===o.floor:!0);if(!s.length)return null;let l=s.map(u=>a(i,{floor:u.floor,id:u.id})).filter(u=>!!u);return l.reduce((u,c)=>{let h=c.reduce((f,d)=>f+Le(d.points),0);return h<u.distance&&(u.distance=h,u.path=c),u},{distance:1/0,path:l[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${De}${e.id}`,o=`${t.floor}${De}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[];return a.map(l=>{let u=this.pointMap.get(l);if(u){let{floor:c}=u;if(s[s.length-1]?.floor===c){let h=s[s.length-1];h.points.push(u.cds),h.endType=u.type,h.destId=u.nodeId,h.distance=Le(h.points)}else s.push({floor:c,points:[u.cds],endType:u.type,destId:u.nodeId,distance:0})}}),s}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new nn.default,this.escalatorRoute=new nn.default,this.straightLadderRoute=new nn.default}};var ue=Tr(Oo(),1);var vn=require("lodash"),Pt="___",Bo=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new ue.default;escalatorRoute=new ue.default;straightLadderRoute=new ue.default;forwardLineMap=new Map;forwardRoute=new ue.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(t=>{let n=[];try{n=JSON.parse(t.entry_end_floor)}catch{n=[]}let i=[];try{i=JSON.parse(t.entry_start_floor)}catch{i=[]}return{...t,entry_start_floor:i,entry_end_floor:n}})}initRoute(e,t){this.clear(),this.roadInfo=e,this.initFacilities(t);let n=new Date,i=n.getHours()*60+n.getMinutes();e.length&&(e.forEach(o=>{(o.points||[]).filter(a=>a.openStatus!==!1).filter(a=>{if(!a.startTime||!a.endTime)return!0;let[s,l]=a.startTime.split(":").map(d=>+d),[u,c]=a.endTime.split(":").map(d=>+d),h=s*60+l,f=u*60+c;return i>=h&&i<=f}).forEach(a=>{a.floor=o.floor;let s=`${o.floor}${Pt}${a.id}`;if(this.nodeMap.set(`${o.floor}${Pt}${a.nodeId}`,`${o.floor}${Pt}${a.relatedId||a.id}`),this.pointMap.set(s,a),this.isFacilityByType(a.type)){let l=this.facilities.find(u=>u.id===+a.targetId);if(l){switch(l.entry_infra_type){case"straightLadder":if(l.entry_end_floor.find(f=>f.floor===o.floor)&&l.entry_start_floor.find(f=>f.floor===o.floor)){let f=this.straightLadderMap.get(a.targetId)||[];f.push({...a}),this.straightLadderMap.set(a.targetId,f)}break;case"staircase":if(l.entry_end_floor.find(f=>f.floor===o.floor)&&l.entry_start_floor.find(f=>f.floor===o.floor)){let f=this.staircaseMap.get(a.targetId)||[];f.push({...a}),this.staircaseMap.set(a.targetId,f)}break;case"escalator":let c=this.escalatorMap.get(a.targetId)||[];if(l.entry_start_floor.find(f=>f.floor===o.floor)){let f=c.find(d=>d.end?.floor!==o.floor&&!d.start);f?f.start=a:c.push({start:a})}if(l.entry_end_floor.find(f=>f.floor===o.floor)){let f=c.find(d=>d.start?.floor!==o.floor&&!d.end);f?f.end=a:c.push({end:a})}this.escalatorMap.set(a.targetId,c);break;case"ramp":let h=this.rampMap.get(a.targetId)||[];if(l.entry_start_floor.find(f=>f.floor===o.floor)){let f=h.find(d=>d.end?.floor!==o.floor&&!d.start);f?f.start=a:h.push({start:a})}if(l.entry_end_floor.find(f=>f.floor===o.floor)){let f=h.find(d=>d.start?.floor!==o.floor&&!d.end);f?f.end=a:h.push({end:a})}this.rampMap.set(a.targetId,h);break}let u=this.facilityMap.get(a.targetId)||[];u.push({...a}),this.facilityMap.set(a.targetId,u)}}a.type==="parkingSpace"&&this.parkingMap.set(`${o.floor}${Pt}${a.name}`,a)}),(o.lines||[]).filter(a=>a.direction!=="no").forEach(a=>{let s=`${o.floor}${Pt}${a.from}`,l=`${o.floor}${Pt}${a.to}`,u=this.pointMap.get(s),c=this.pointMap.get(l);if(!u||!c)return;let h=u.cds,f=c.cds,d=Yt(h,f);if(!u.permission&&!c.permission)switch(this.addLineItem(s,l,d),this.addLineItem(l,s,d),a.direction){case"double":this.addLineItem(s,l,d,this.forwardLineMap),this.addLineItem(l,s,d,this.forwardLineMap);break;case"single":this.addLineItem(s,l,d,this.forwardLineMap);break;case"back":this.addLineItem(l,s,d,this.forwardLineMap);break}else u.permission&&(this.setPermissionLine(s,l,u.permission,d,""),this.setPermissionLine(l,s,u.permission,d,"")),c.permission&&c.permission!==u.permission&&(this.setPermissionLine(s,l,c.permission,d,""),this.setPermissionLine(l,s,c.permission,d,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[`permission_${e}`]||(this[`permission_${e}`]=new Set),this[`permission_${e}`]}setPermissionLine(e,t,n,i,o){this.getPermissionMap(n).add({fromKey:e,toKey:t,distance:i,type:o})}addPermissionFacility(){this.straightLadderMap.forEach((e,t)=>{if(e.length<2){this.straightLadderMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${Pt}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${Pt}${e[a].id}`,l=this.pointMap.get(s);if(!l)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"straightLadder"),l.permission&&l.permission!==o.permission&&this.setPermissionLine(i,s,l.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,t)=>{if(e.length<2){this.staircaseMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${Pt}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${Pt}${e[a].id}`,l=this.pointMap.get(s);if(!l)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"staircase"),l.permission&&l.permission!==o.permission&&this.setPermissionLine(i,s,l.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Pt}${n.start.id}`,o=`${n.end.floor}${Pt}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,1,"escalator"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,1,"escalator"))}})}),this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Pt}${n.start.id}`,o=`${n.end.floor}${Pt}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,10,"ramp"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,10,"ramp"))}})})}addPermissionLineToMap(e,t,n,i){let o=this.getPermissionMap(e);console.log(o),o.forEach(a=>{t.includes(a.type)&&(a.type===""?this.addLineItem(a.fromKey,a.toKey,a.distance,n):this.addLineItem(a.fromKey,a.toKey,i.get(a.type),n))})}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let l=`${a[s].floor}${Pt}${a[s].id}`,u=this.pointMap.get(l);if(!(!u||u.permission)){for(let c=0;c<a.length;c++)if(s!==c){let h=`${a[c].floor}${Pt}${a[c].id}`,f=this.pointMap.get(h);if(!f||f.permission)continue;if(a[s].type==="straightLadder"){let d=t;this.addLineItem(l,h,d,i)}else{let d=n;this.addLineItem(l,h,d,i)}}}}}),this.escalatorMap.forEach((o,a)=>{o.forEach(s=>{if(s.start&&s.end){let l=`${s.start.floor}${Pt}${s.start.id}`,u=`${s.end.floor}${Pt}${s.end.id}`,c=this.pointMap.get(l),h=this.pointMap.get(u);if(c&&h&&!c.permission&&!h.permission){let f=e;this.addLineItem(l,u,f,i)}}})})}initBaseRoute(){let e=new Map((0,vn.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new ue.default(e)}initEscalatorRoute(){let e=new Map((0,vn.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new ue.default(e)}initStraightLadderRoute(){let e=new Map((0,vn.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new ue.default(e)}initForwardRoute(){this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Pt}${n.start.id}`,o=`${n.end.floor}${Pt}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&!a.permission&&!s.permission&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.forwardRoute=new ue.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${Pt}${e.nodeId}`);if(t){let[n,i]=t.split(Pt);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{if(o.relatedId)return i;let a=Yt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:t.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let n=this.parkingMap.get(`${e.floor}${Pt}${e.parkingSpace}`);if(n)return{floor:e.floor,id:n.id}}let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilities.filter(i=>+i.type_id==+e.facility).map(i=>i.id).map(i=>this.facilityMap.get(`${i}`)).flat(2)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n="",i){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let o=this.transformStart(e);if(!o)return"no-start";let a=this.transformEnd(t);if(!a)return"no-end";let s=this.getBasePath.bind(this);switch(n){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;case"forward":s=this.getForwardPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(a.id)return s(o,a,i);if(a.facility){let u=this.facilities.filter(h=>+h.type_id==+t.facility).map(h=>h.id).map(h=>this.facilityMap.get(`${h}`)).flat(2).filter(h=>h).filter(h=>a.floor?h.floor===a.floor:!0);if(!u.length)return null;let c=u.map(h=>s(o,{floor:h.floor,id:h.id},i)).filter(h=>!!h);return c.reduce((h,f)=>{let d=f[0].consume;return d<h.distance&&(h.distance=d,h.path=f),h},{distance:1/0,path:c[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${Pt}${e.id}`,o=`${t.floor}${Pt}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[],l=a.reduce((u,c,h,f)=>{if(h===0)return 0;let d=f[h-1],m=n.graph.get(d).get(c);return u+m},0);return a.map(u=>{let c=this.pointMap.get(u);if(c){let{floor:h}=c,f=c.type;if(this.isFacilityByType(c.type)){let d=this.facilities.find(m=>m.id===+c.targetId);d&&(f=d.entry_infra_type)}if(s[s.length-1]?.floor===h){let d=s[s.length-1];d.points.push(c.cds),d.endType=f,d.destId=c.nodeId,d.distance=Le(d.points)}else s.push({floor:h,points:[c.cds],endType:f,destId:c.nodeId,distance:0,consume:l})}}),s}getBasePath(e,t,n){if(!n)return this.getRoutePath(e,t,this.baseRoute);let i=(0,vn.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let o=new ue.default(i);return this.getRoutePath(e,t,o)}getEscalatorPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.escalatorRoute);let i=(0,vn.cloneDeep)(this.escalatorRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",1*o],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]));let a=new ue.default(i);return this.getRoutePath(e,t,a)}getStraightLadderPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.straightLadderRoute);let i=(0,vn.cloneDeep)(this.straightLadderRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",3*o],["straightLadder",1*o],["staircase",3e4*o]]));let a=new ue.default(i);return this.getRoutePath(e,t,a)}getForwardPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.forwardRoute);let i=(0,vn.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],i,new Map([["ramp",10]]));let o=new ue.default(i);return this.getRoutePath(e,t,o)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new ue.default,this.escalatorRoute=new ue.default,this.straightLadderRoute=new ue.default}};var kn=class{static keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let e=this.createKey();for(;this.keySet.has(e);)e=this.createKey();return e}static removeKey(e){this.keySet.delete(e)}static dispose(){this.keySet.clear()}};function ko(r){return r.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function Qe(r,e,t){return new Promise((n,i)=>{let o=kn.genUniqueKey(),a=({data:s})=>{s.type===`${e}_result`&&s.key===o&&(kn.removeKey(o),self.removeEventListener("message",a),s.error?i(s.error):n(s.data))};r.addEventListener("message",a),r.postMessage({type:e,key:o,data:t})})}function Df(r){let e={};for(let n in r)n.startsWith("on")&&(e[ko(n.slice(2))]=r[n]);let t=async({data:n})=>{if(e[n.type])try{let i=await e[n.type](n.data);self.postMessage({type:`${n.type}_result`,key:n.key,data:i})}catch(i){self.postMessage({type:`${n.type}_result`,key:n.key,error:i})}else self.postMessage({type:`${n.type}_result`,key:n.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var Ge=require("three");function Of(r,e=16711680){let t=new Ge.LineBasicMaterial({color:e}),n=new Ge.BufferGeometry().setFromPoints(r);return new Ge.Line(n,t)}function zf(r,e=16711680){let t=new Ge.LineBasicMaterial({color:e}),n=new Ge.BoxGeometry(1,1,1),i=new Ge.Mesh(n,t);return i.position.copy(r),i}function pe(r,e,t=0){r.forEach(n=>{n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"?(n.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=e[0],o[1]-=e[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(i=>i.map(o=>Oe(o,e)))),n.doors?.length&&n.doors.map(i=>{i.coord=Oe(i.coordinate,e)}),n.center&&(n.center=Oe(n.center,e))):n.geometry.coords=Oe(n.geometry.cds,e)});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(t+n+1)}}function Oe(r,e){return[r[0]-e[0],r[1]-e[1]]}var hu=require("@tweenjs/tween.js"),hn=class{pauseTween=!1;tweenStore=new Set;group=new hu.Group;constructor(){}update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(e=>{this.tweenStore.add(e),e.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(e=>{e.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(e){this.group.remove(e)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(e=>e.stop()),this.group.removeAll()}dispose(){this.clear()}};var fu=require("three"),Nr=class extends fu.EventDispatcher{constructor(t){super();this.ctn=t;this.registryEvent()}point;registryEvent(){this.ctn.addEventListener("pointerdown",this._pointerDown),this.ctn.addEventListener("pointerup",this._pointerUp)}unRegistryEvent(){this.ctn.removeEventListener("pointerdown",this._pointerDown),this.ctn.removeEventListener("pointerup",this._pointerUp)}_pointerDown=t=>{this.point={x:t.offsetX,y:t.offsetY}};_pointerUp=t=>{if(!this.point)return;let{offsetX:n,offsetY:i}=t,{x:o,y:a}=this.point;Math.hypot(o-n+(a-i))>3||this.dispatchEvent({type:"click",e:t})};dispose(){this.unRegistryEvent()}};var pu=require("lodash"),du=require("three"),xn=class extends du.EventDispatcher{_task=[];started=!1;activeTask=null;_id=0;constructor(e=!0){super(),e&&this.start()}_isEffectiveTask(e){return e&&typeof e.run=="function"}_getIndexByTid(e){return this._task.findIndex(t=>t.tid===e)}_createTask(e){return this._isEffectiveTask(e)?{...e,tid:++this._id,meta:e.meta||{}}:!1}get task(){return[...this._task]}getTasks(){return[...this._task]}add(e){if(this._isEffectiveTask(e)){let t=this._createTask(e);return this._task.push(t),this.started&&!this.activeTask&&this.start(),t.tid}return!1}replace(e,t){if(!this._isEffectiveTask(t))return console.warn("[TaskQueue] replace\u65B9\u6CD5\u4F20\u5165\u7684task\u53C2\u6570\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;let n=this._getIndexByTid(e);if(n===-1)return console.warn(`[TaskQueue] \u6CA1\u6709\u627E\u5230id=${e}\u7684\u4EFB\u52A1`),!1;let i=this._createTask(t);return this._task.splice(n,1,i),i.tid}replaceByMetaType(e){let t=e.meta?.type;if((0,pu.isNil)(t))return this.add(e);{let n=this._task.find(i=>i.meta.type===t);return n?this.replace(n.tid,e):this.add(e)}}remove(e){let t=this._getIndexByTid(e);return t===-1?(console.warn(`[TaskQueue] remove\u65B9\u6CD5\u4F20\u5165\u7684id\uFF1A${e}\u627E\u4E0D\u5230\u5BF9\u5E94\u7684task`),!1):(this._task.splice(t,1),!0)}clear(){this._task.length=0}start(){this.started=!0,!this.activeTask&&this._task.length&&this.exec()}stop(){this.started=!1}async exec(){if(!this.started||!this._task.length)return!1;let e=this._task.shift();this.activeTask=e,this.dispatchEvent({type:"active-task-start",task:e});let t;try{t=await e.run()}catch(n){console.warn("[task run err]",n,e)}return this.activeTask=null,this.dispatchEvent({type:"active-task-end",task:e,res:t}),this.exec()}};var At=require("three");var Lu=require("three");var at=require("three");var gu=require("three/examples/jsm/lines/LineMaterial"),de=require("three");function mu(r){return`${r.x}-${r.y}-${r.z}`}var Zt=class{static lineMaterialMap=new Map;static meshStandardMaterialMap=new Map;static meshBasicMaterialMap=new Map;static shaderMaterialMap=new Map;static line2MaterialMap=new Map;static generateLineMaterialKey({color:e,opacity:t}){return`${e}-${t}`}static createLineMaterial({color:e,opacity:t}){let n=this.generateLineMaterialKey({color:e,opacity:t});if(this.lineMaterialMap.has(n))return this.lineMaterialMap.get(n);let i=new de.LineBasicMaterial({color:new de.Color(e).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(n,i),i}static createMeshStandardMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new de.MeshStandardMaterial({color:new de.Color(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshBasicMaterialMap.has(n))return this.meshBasicMaterialMap.get(n);let i=new de.MeshBasicMaterial({color:e,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(n,i),i}static createShaderMaterial({gradualColor:e,center:t,maxValue:n,opacity:i,direction:o,max:a,min:s}){let l=`${e.toString()}-${mu(t)}-${n}-${i}-${mu(o)}`;if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let u=`
2
2
  uniform vec3 uColor;
3
3
  uniform vec3 uGradualColor;
4
4
  uniform vec3 center;
package/lib/bmap.esm.js CHANGED
@@ -3843,6 +3843,8 @@ var TaskQueue = class extends EventDispatcher2 {
3843
3843
  const findTask = this._task.find((item) => item.meta.type === type);
3844
3844
  if (findTask) {
3845
3845
  return this.replace(findTask.tid, task);
3846
+ } else {
3847
+ return this.add(task);
3846
3848
  }
3847
3849
  }
3848
3850
  }
@@ -1,4 +1,4 @@
1
- var zh=Object.create;var Za=Object.defineProperty;var Bh=Object.getOwnPropertyDescriptor;var kh=Object.getOwnPropertyNames;var Xh=Object.getPrototypeOf,Fh=Object.prototype.hasOwnProperty;var He=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Vh=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of kh(e))!Fh.call(r,i)&&i!==t&&Za(r,i,{get:()=>e[i],enumerable:!(n=Bh(e,i))||n.enumerable});return r};var rr=(r,e,t)=>(t=r!=null?zh(Xh(r)):{},Vh(e||!r||!r.__esModule?Za(t,"default",{value:r,enumerable:!0}):t,r));var as=He((fv,os)=>{os.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var ls=He((pv,us)=>{var ss=as();us.exports=function(r,e){Array.isArray(e)||(e=[]),r.length>0&&e.push(ss([0,0],r[0]));for(var t=0;t<r.length-1;t++){var n=r[t],i=r[t+1],o=n[0],a=n[1],s=i[0],l=i[1],u=[.75*o+.25*s,.75*a+.25*l],c=[.25*o+.75*s,.25*a+.75*l];e.push(u),e.push(c)}return r.length>1&&e.push(ss([0,0],r[r.length-1])),e}});var gs=He((vv,ms)=>{var to=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,t)=>e.priority-t.priority)}set(e,t){let n=Number(t);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(e)?this.queue.map(i=>(i.key===e&&Object.assign(i,{priority:n}),i)):(this.keys.add(e),this.queue.push({key:e,priority:n})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(t=>t.key===e)}};ms.exports=to});var vs=He((xv,_s)=>{function ys(r,e){let t=new Map;for(let[n,i]of r)n!==e&&i instanceof Map?t.set(n,ys(i,e)):n!==e&&t.set(n,i);return t}_s.exports=ys});var As=He((Cv,Cs)=>{function ef(r){let e=Number(r);return!(isNaN(e)||e<=0)}function xs(r){let e=new Map;return Object.keys(r).forEach(n=>{let i=r[n];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return e.set(n,xs(i));if(!ef(i))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,i);return e.set(n,Number(i))}),e}Cs.exports=xs});var ws=He((Av,Ss)=>{function bs(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((e,t)=>{if(typeof e=="object"&&e instanceof Map){bs(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}Ss.exports=bs});var no=He((bv,Ms)=>{var nf=gs(),rf=vs(),Es=As(),Ts=ws(),eo=class{constructor(e){e instanceof Map?(Ts(e),this.graph=e):e?this.graph=Es(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(Ts(t),n=t):n=Es(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=rf(this.graph,e),this}path(e,t,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let i=new Set,o=new nf,a=new Map,s=[],l=0,u=[];if(n.avoid&&(u=[].concat(n.avoid)),u.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(u.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(o.set(e,0);!o.isEmpty();){let c=o.next();if(c.key===t){l=c.priority;let f=c.key;for(;a.has(f);)s.push(f),f=a.get(f);break}i.add(c.key),(this.graph.get(c.key)||new Map).forEach((f,d)=>{if(i.has(d)||u.includes(d))return null;if(!o.has(d))return a.set(d,c.key),o.set(d,c.priority+f);let m=o.get(d).priority,p=c.priority+f;return p<m?(a.set(d,c.key),o.set(d,p)):null})}return s.length?(n.trim?s.shift():s=s.concat([e]),n.reverse||(s=s.reverse()),n.cost?{path:s,cost:l}:s):n.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};Ms.exports=eo});var _o=He((go,yo)=>{(function(r,e){typeof go=="object"&&typeof yo<"u"?yo.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self,r["'typed'"]=e())})(go,function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";function i(){function a(v){return typeof v=="object"&&v!==null&&v.constructor===Object}let s=[{name:"number",test:function(v){return typeof v=="number"}},{name:"string",test:function(v){return typeof v=="string"}},{name:"boolean",test:function(v){return typeof v=="boolean"}},{name:"Function",test:function(v){return typeof v=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(v){return v instanceof Date}},{name:"RegExp",test:function(v){return v instanceof RegExp}},{name:"Object",test:a},{name:"null",test:function(v){return v===null}},{name:"undefined",test:function(v){return v===void 0}}],l={name:"any",test:r,isAny:!0},u,c,h=0,f={createCount:0};function d(v){let E=u.get(v);if(E)return E;let P='Unknown type "'+v+'"',L=v.toLowerCase(),k;for(k of c)if(k.toLowerCase()===L){P+='. Did you mean "'+k+'" ?';break}throw new TypeError(P)}function m(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",P=E?d(E).index:c.length,L=[];for(let O=0;O<v.length;++O){if(!v[O]||typeof v[O].name!="string"||typeof v[O].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let W=v[O].name;if(u.has(W))throw new TypeError('Duplicate type name "'+W+'"');L.push(W),u.set(W,{name:W,test:v[O].test,isAny:v[O].isAny,index:P+O,conversionsTo:[]})}let k=c.slice(P);c=c.slice(0,P).concat(L).concat(k);for(let O=P+L.length;O<c.length;++O)u.get(c[O]).index=O}function p(){u=new Map,c=[],h=0,m([l],!1)}p(),m(s);function g(){let v;for(v of c)u.get(v).conversionsTo=[];h=0}function _(v){let E=c.filter(P=>{let L=u.get(P);return!L.isAny&&L.test(v)});return E.length?E:["any"]}function A(v){return v&&typeof v=="function"&&"_typedFunctionData"in v}function y(v,E,P){if(!A(v))throw new TypeError(n);let L=P&&P.exact,k=Array.isArray(E)?E.join(","):E,O=I(k),W=x(O);if(!L||W in v.signatures){let ot=v._typedFunctionData.signatureMap.get(W);if(ot)return ot}let X=O.length,q;if(L){q=[];let ot;for(ot in v.signatures)q.push(v._typedFunctionData.signatureMap.get(ot))}else q=v._typedFunctionData.signatures;for(let ot=0;ot<X;++ot){let ct=O[ot],bt=[],oe;for(oe of q){let Jt=V(oe.params,ot);if(!(!Jt||ct.restParam&&!Jt.restParam)){if(!Jt.hasAny){let Se=T(Jt);if(ct.types.some(we=>!Se.has(we.name)))continue}bt.push(oe)}}if(q=bt,q.length===0)break}let F;for(F of q)if(F.params.length<=X)return F;throw new TypeError("Signature not found (signature: "+(v.name||"unnamed")+"("+x(O,", ")+"))")}function S(v,E,P){return y(v,E,P).implementation}function C(v,E){let P=d(E);if(P.test(v))return v;let L=P.conversionsTo;if(L.length===0)throw new Error("There are no conversions to "+E+" defined.");for(let k=0;k<L.length;k++)if(d(L[k].from).test(v))return L[k].convert(v);throw new Error("Cannot convert "+v+" to "+E)}function x(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return v.map(P=>P.name).join(E)}function b(v){let E=v.indexOf("...")===0,L=(E?v.length>3?v.slice(3):"any":v).split("|").map(X=>d(X.trim())),k=!1,O=E?"...":"";return{types:L.map(function(X){return k=X.isAny||k,O+=X.name+"|",{name:X.name,typeIndex:X.index,test:X.test,isAny:X.isAny,conversion:null,conversionIndex:-1}}),name:O.slice(0,-1),hasAny:k,hasConversion:!1,restParam:E}}function w(v){let E=v.types.map(W=>W.name),P=mt(E),L=v.hasAny,k=v.name,O=P.map(function(W){let X=d(W.from);return L=X.isAny||L,k+="|"+W.from,{name:W.from,typeIndex:X.index,test:X.test,isAny:X.isAny,conversion:W,conversionIndex:W.index}});return{types:v.types.concat(O),name:k,hasAny:L,hasConversion:O.length>0,restParam:v.restParam}}function T(v){return v.typeSet||(v.typeSet=new Set,v.types.forEach(E=>v.typeSet.add(E.name))),v.typeSet}function I(v){let E=[];if(typeof v!="string")throw new TypeError("Signatures must be strings");let P=v.trim();if(P==="")return E;let L=P.split(",");for(let k=0;k<L.length;++k){let O=b(L[k].trim());if(O.restParam&&k!==L.length-1)throw new SyntaxError('Unexpected rest parameter "'+L[k]+'": only allowed for the last parameter');if(O.types.length===0)return null;E.push(O)}return E}function R(v){let E=Ot(v);return E?E.restParam:!1}function U(v){if(!v||v.types.length===0)return r;if(v.types.length===1)return d(v.types[0].name).test;if(v.types.length===2){let E=d(v.types[0].name).test,P=d(v.types[1].name).test;return function(k){return E(k)||P(k)}}else{let E=v.types.map(function(P){return d(P.name).test});return function(L){for(let k=0;k<E.length;k++)if(E[k](L))return!0;return!1}}}function Z(v){let E,P,L;if(R(v)){E=Lt(v).map(U);let k=E.length,O=U(Ot(v)),W=function(X){for(let q=k;q<X.length;q++)if(!O(X[q]))return!1;return!0};return function(q){for(let F=0;F<E.length;F++)if(!E[F](q[F]))return!1;return W(q)&&q.length>=k+1}}else return v.length===0?function(O){return O.length===0}:v.length===1?(P=U(v[0]),function(O){return P(O[0])&&O.length===1}):v.length===2?(P=U(v[0]),L=U(v[1]),function(O){return P(O[0])&&L(O[1])&&O.length===2}):(E=v.map(U),function(O){for(let W=0;W<E.length;W++)if(!E[W](O[W]))return!1;return O.length===E.length})}function V(v,E){return E<v.length?v[E]:R(v)?Ot(v):null}function j(v,E){let P=V(v,E);return P?T(P):new Set}function D(v){return v.conversion===null||v.conversion===void 0}function Q(v,E){let P=new Set;return v.forEach(L=>{let k=j(L.params,E),O;for(O of k)P.add(O)}),P.has("any")?["any"]:Array.from(P)}function K(v,E,P){let L,k,O=v||"unnamed",W=P,X;for(X=0;X<E.length;X++){let ct=[];if(W.forEach(bt=>{let oe=V(bt.params,X),Jt=U(oe);(X<bt.params.length||R(bt.params))&&Jt(E[X])&&ct.push(bt)}),ct.length===0){if(k=Q(W,X),k.length>0){let bt=_(E[X]);return L=new TypeError("Unexpected type of argument in function "+O+" (expected: "+k.join(" or ")+", actual: "+bt.join(" | ")+", index: "+X+")"),L.data={category:"wrongType",fn:O,index:X,actual:bt,expected:k},L}}else W=ct}let q=W.map(function(ct){return R(ct.params)?1/0:ct.params.length});if(E.length<Math.min.apply(null,q))return k=Q(W,X),L=new TypeError("Too few arguments in function "+O+" (expected: "+k.join(" or ")+", index: "+E.length+")"),L.data={category:"tooFewArgs",fn:O,index:E.length,expected:k},L;let F=Math.max.apply(null,q);if(E.length>F)return L=new TypeError("Too many arguments in function "+O+" (expected: "+F+", actual: "+E.length+")"),L.data={category:"tooManyArgs",fn:O,index:E.length,expectedLength:F},L;let ot=[];for(let ct=0;ct<E.length;++ct)ot.push(_(E[ct]).join("|"));return L=new TypeError('Arguments of type "'+ot.join(", ")+'" do not match any of the defined signatures of function '+O+"."),L.data={category:"mismatch",actual:ot},L}function G(v){let E=c.length+1;for(let P=0;P<v.types.length;P++)D(v.types[P])&&(E=Math.min(E,v.types[P].typeIndex));return E}function tt(v){let E=h+1;for(let P=0;P<v.types.length;P++)D(v.types[P])||(E=Math.min(E,v.types[P].conversionIndex));return E}function dt(v,E){if(v.hasAny){if(!E.hasAny)return 1}else if(E.hasAny)return-1;if(v.restParam){if(!E.restParam)return 1}else if(E.restParam)return-1;if(v.hasConversion){if(!E.hasConversion)return 1}else if(E.hasConversion)return-1;let P=G(v)-G(E);if(P<0)return-1;if(P>0)return 1;let L=tt(v)-tt(E);return L<0?-1:L>0?1:0}function lt(v,E){let P=v.params,L=E.params,k=Ot(P),O=Ot(L),W=R(P),X=R(L);if(W&&k.hasAny){if(!X||!O.hasAny)return 1}else if(X&&O.hasAny)return-1;let q=0,F=0,ot;for(ot of P)ot.hasAny&&++q,ot.hasConversion&&++F;let ct=0,bt=0;for(ot of L)ot.hasAny&&++ct,ot.hasConversion&&++bt;if(q!==ct)return q-ct;if(W&&k.hasConversion){if(!X||!O.hasConversion)return 1}else if(X&&O.hasConversion)return-1;if(F!==bt)return F-bt;if(W){if(!X)return 1}else if(X)return-1;let oe=(P.length-L.length)*(W?-1:1);if(oe!==0)return oe;let Jt=[],Se=0;for(let En=0;En<P.length;++En){let Mr=dt(P[En],L[En]);Jt.push(Mr),Se+=Mr}if(Se!==0)return Se;let we;for(we of Jt)if(we!==0)return we;return 0}function mt(v){if(v.length===0)return[];let E=v.map(d);v.length>1&&E.sort((k,O)=>k.index-O.index);let P=E[0].conversionsTo;if(v.length===1)return P;P=P.concat([]);let L=new Set(v);for(let k=1;k<E.length;++k){let O;for(O of E[k].conversionsTo)L.has(O.from)||(P.push(O),L.add(O.from))}return P}function Nt(v,E){let P=E;if(v.some(k=>k.hasConversion)){let k=R(v),O=v.map(It);P=function(){let X=[],q=k?arguments.length-1:arguments.length;for(let F=0;F<q;F++)X[F]=O[F](arguments[F]);return k&&(X[q]=arguments[q].map(O[q])),E.apply(this,X)}}let L=P;if(R(v)){let k=v.length-1;L=function(){return P.apply(this,pe(arguments,0,k).concat([pe(arguments,k)]))}}return L}function It(v){let E,P,L,k,O=[],W=[];switch(v.types.forEach(function(X){X.conversion&&(O.push(d(X.conversion.from).test),W.push(X.conversion.convert))}),W.length){case 0:return function(q){return q};case 1:return E=O[0],L=W[0],function(q){return E(q)?L(q):q};case 2:return E=O[0],P=O[1],L=W[0],k=W[1],function(q){return E(q)?L(q):P(q)?k(q):q};default:return function(q){for(let F=0;F<W.length;F++)if(O[F](q))return W[F](q);return q}}}function Tt(v){function E(P,L,k){if(L<P.length){let O=P[L],W=[];if(O.restParam){let X=O.types.filter(D);X.length<O.types.length&&W.push({types:X,name:"..."+X.map(q=>q.name).join("|"),hasAny:X.some(q=>q.isAny),hasConversion:!1,restParam:!0}),W.push(O)}else W=O.types.map(function(X){return{types:[X],name:X.name,hasAny:X.isAny,hasConversion:X.conversion,restParam:!1}});return fn(W,function(X){return E(P,L+1,k.concat([X]))})}else return[k]}return E(v,0,[])}function Ct(v,E){let P=Math.max(v.length,E.length);for(let X=0;X<P;X++){let q=j(v,X),F=j(E,X),ot=!1,ct;for(ct of F)if(q.has(ct)){ot=!0;break}if(!ot)return!1}let L=v.length,k=E.length,O=R(v),W=R(E);return O?W?L===k:k>=L:W?L>=k:L===k}function Ft(v){return v.map(E=>Tr(E)?wr(E.referToSelf.callback):Er(E)?wn(E.referTo.references,E.referTo.callback):E)}function At(v,E,P){let L=[],k;for(k of v){let O=P[k];if(typeof O!="number")throw new TypeError('No definition for referenced signature "'+k+'"');if(O=E[O],typeof O!="function")return!1;L.push(O)}return L}function gt(v,E,P){let L=Ft(v),k=new Array(L.length).fill(!1),O=!0;for(;O;){O=!1;let W=!0;for(let X=0;X<L.length;++X){if(k[X])continue;let q=L[X];if(Tr(q))L[X]=q.referToSelf.callback(P),L[X].referToSelf=q.referToSelf,k[X]=!0,W=!1;else if(Er(q)){let F=At(q.referTo.references,L,E);F?(L[X]=q.referTo.callback.apply(this,F),L[X].referTo=q.referTo,k[X]=!0,W=!1):O=!0}}if(W&&O)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return L}function ie(v){let E=/\bthis(\(|\.signatures\b)/;Object.keys(v).forEach(P=>{let L=v[P];if(E.test(L.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Dt(v,E){if(f.createCount++,Object.keys(E).length===0)throw new SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&ie(E);let P=[],L=[],k={},O=[],W;for(W in E){if(!Object.prototype.hasOwnProperty.call(E,W))continue;let _t=I(W);if(!_t)continue;P.forEach(function(nr){if(Ct(nr,_t))throw new TypeError('Conflicting signatures "'+x(nr)+'" and "'+x(_t)+'".')}),P.push(_t);let ae=L.length;L.push(E[W]);let Dh=_t.map(w),Pr;for(Pr of Tt(Dh)){let nr=x(Pr);O.push({params:Pr,name:nr,fn:ae}),Pr.every(Oh=>!Oh.hasConversion)&&(k[nr]=ae)}}O.sort(lt);let X=gt(L,k,er),q;for(q in k)Object.prototype.hasOwnProperty.call(k,q)&&(k[q]=X[k[q]]);let F=[],ot=new Map;for(q of O)ot.has(q.name)||(q.fn=X[q.fn],F.push(q),ot.set(q.name,q));let ct=F[0]&&F[0].params.length<=2&&!R(F[0].params),bt=F[1]&&F[1].params.length<=2&&!R(F[1].params),oe=F[2]&&F[2].params.length<=2&&!R(F[2].params),Jt=F[3]&&F[3].params.length<=2&&!R(F[3].params),Se=F[4]&&F[4].params.length<=2&&!R(F[4].params),we=F[5]&&F[5].params.length<=2&&!R(F[5].params),En=ct&&bt&&oe&&Jt&&Se&&we;for(let _t=0;_t<F.length;++_t)F[_t].test=Z(F[_t].params);let Mr=ct?U(F[0].params[0]):e,sh=bt?U(F[1].params[0]):e,uh=oe?U(F[2].params[0]):e,lh=Jt?U(F[3].params[0]):e,ch=Se?U(F[4].params[0]):e,hh=we?U(F[5].params[0]):e,fh=ct?U(F[0].params[1]):e,ph=bt?U(F[1].params[1]):e,dh=oe?U(F[2].params[1]):e,mh=Jt?U(F[3].params[1]):e,gh=Se?U(F[4].params[1]):e,yh=we?U(F[5].params[1]):e;for(let _t=0;_t<F.length;++_t)F[_t].implementation=Nt(F[_t].params,F[_t].fn);let _h=ct?F[0].implementation:t,vh=bt?F[1].implementation:t,xh=oe?F[2].implementation:t,Ch=Jt?F[3].implementation:t,Ah=Se?F[4].implementation:t,bh=we?F[5].implementation:t,Sh=ct?F[0].params.length:-1,wh=bt?F[1].params.length:-1,Eh=oe?F[2].params.length:-1,Th=Jt?F[3].params.length:-1,Mh=Se?F[4].params.length:-1,Ph=we?F[5].params.length:-1,Ih=En?6:0,Rh=F.length,Nh=F.map(_t=>_t.test),Lh=F.map(_t=>_t.implementation),Uh=function(){for(let ae=Ih;ae<Rh;ae++)if(Nh[ae](arguments))return Lh[ae].apply(this,arguments);return f.onMismatch(v,arguments,F)};function er(_t,ae){return arguments.length===Sh&&Mr(_t)&&fh(ae)?_h.apply(this,arguments):arguments.length===wh&&sh(_t)&&ph(ae)?vh.apply(this,arguments):arguments.length===Eh&&uh(_t)&&dh(ae)?xh.apply(this,arguments):arguments.length===Th&&lh(_t)&&mh(ae)?Ch.apply(this,arguments):arguments.length===Mh&&ch(_t)&&gh(ae)?Ah.apply(this,arguments):arguments.length===Ph&&hh(_t)&&yh(ae)?bh.apply(this,arguments):Uh.apply(this,arguments)}try{Object.defineProperty(er,"name",{value:v})}catch{}return er.signatures=k,er._typedFunctionData={signatures:F,signatureMap:ot},er}function ft(v,E,P){throw K(v,E,P)}function Lt(v){return pe(v,0,v.length-1)}function Ot(v){return v[v.length-1]}function pe(v,E,P){return Array.prototype.slice.call(v,E,P)}function Ue(v,E){for(let P=0;P<v.length;P++)if(E(v[P]))return v[P]}function fn(v,E){return Array.prototype.concat.apply([],v.map(E))}function Ge(){let v=Lt(arguments).map(P=>x(I(P))),E=Ot(arguments);if(typeof E!="function")throw new TypeError("Callback function expected as last argument");return wn(v,E)}function wn(v,E){return{referTo:{references:v,callback:E}}}function wr(v){if(typeof v!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:v}}}function Er(v){return v&&typeof v.referTo=="object"&&Array.isArray(v.referTo.references)&&typeof v.referTo.callback=="function"}function Tr(v){return v&&typeof v.referToSelf=="object"&&typeof v.referToSelf.callback=="function"}function Jn(v,E){if(!v)return E;if(E&&E!==v){let P=new Error("Function names do not match (expected: "+v+", actual: "+E+")");throw P.data={actual:E,expected:v},P}return v}function tr(v){let E;for(let P in v)Object.prototype.hasOwnProperty.call(v,P)&&(A(v[P])||typeof v[P].signature=="string")&&(E=Jn(E,v[P].name));return E}function M(v,E){let P;for(P in E)if(Object.prototype.hasOwnProperty.call(E,P)){if(P in v&&E[P]!==v[P]){let L=new Error('Signature "'+P+'" is defined twice');throw L.data={signature:P,sourceFunction:E[P],destFunction:v[P]},L}v[P]=E[P]}}let Y=f;f=function(v){let E=typeof v=="string",P=E?1:0,L=E?v:"",k={};for(let O=P;O<arguments.length;++O){let W=arguments[O],X={},q;if(typeof W=="function"?(q=W.name,typeof W.signature=="string"?X[W.signature]=W:A(W)&&(X=W.signatures)):a(W)&&(X=W,E||(q=tr(W))),Object.keys(X).length===0){let F=new TypeError("Argument to 'typed' at index "+O+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw F.data={index:O,argument:W},F}E||(L=Jn(L,q)),M(k,X)}return Dt(L||"",k)},f.create=i,f.createCount=Y.createCount,f.onMismatch=ft,f.throwMismatchError=ft,f.createError=K,f.clear=p,f.clearConversions=g,f.addTypes=m,f._findType=d,f.referTo=Ge,f.referToSelf=wr,f.convert=C,f.findSignature=y,f.find=S,f.isTypedFunction=A,f.warnAgainstDeprecatedThis=!0,f.addType=function(v,E){let P="any";E!==!1&&u.has("Object")&&(P="Object"),f.addTypes([v],P)};function yt(v){if(!v||typeof v.from!="string"||typeof v.to!="string"||typeof v.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(v.to===v.from)throw new SyntaxError('Illegal to define conversion from "'+v.from+'" to itself.')}return f.addConversion=function(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};yt(v);let P=d(v.to),L=P.conversionsTo.find(k=>k.from===v.from);if(L)if(E&&E.override)f.removeConversion({from:L.from,to:v.to,convert:L.convert});else throw new Error('There is already a conversion from "'+v.from+'" to "'+P.name+'"');P.conversionsTo.push({from:v.from,convert:v.convert,index:h++})},f.addConversions=function(v,E){v.forEach(P=>f.addConversion(P,E))},f.removeConversion=function(v){yt(v);let E=d(v.to),P=Ue(E.conversionsTo,k=>k.from===v.from);if(!P)throw new Error("Attempt to remove nonexistent conversion from "+v.from+" to "+v.to);if(P.convert!==v.convert)throw new Error("Conversion to remove does not match existing conversion");let L=E.conversionsTo.indexOf(P);E.conversionsTo.splice(L,1)},f.resolve=function(v,E){if(!A(v))throw new TypeError(n);let P=v._typedFunctionData.signatures;for(let L=0;L<P.length;++L)if(P[L].test(E))return P[L];return null},f}var o=i();return o})});import{EventDispatcher as Md,Vector3 as Pd}from"three";var Yt=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(e){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),e()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(e){this.tasks.requestAnimation.delete(e),window.cancelAnimationFrame(e)}setTimeout(e,t){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),e()},t);return this.tasks.timeout.add(n),n}clearTimeout(e){this.tasks.timeout.delete(e),window.clearTimeout(e)}setInterval(e,t){let n=window.setInterval(()=>{this.tasks.interval.delete(n),e()},t);return this.tasks.interval.add(n),n}clearInterval(e){this.tasks.interval.delete(e),window.clearInterval(e)}dispose(){this.tasks.requestAnimation.forEach(e=>{window.cancelAnimationFrame(e)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(e=>{window.clearTimeout(e)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(e=>{window.clearInterval(e)}),this.tasks.interval.clear()}};import{Shape as jh,Group as Wh,DirectionalLight as qh,AmbientLight as Yh,Path as Zh,Vector2 as Qa}from"three";function Ga(){let r=new Wh,e=new Yh(16777215,2.6);return r.add(e),r}function De(r,e=[]){let t=new jh(r.map(n=>new Qa(...n)));return e.length&&e.forEach(n=>{var i=new Zh(n.map(o=>new Qa(...o)));t.holes.push(i)}),t}function Ha(r=16777215,e=1){let t=new qh(r,e);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function Zt(r,e){if(e&&r.children&&r.children.length&&r.children.forEach(t=>{Zt(t,e)}),r.isMesh){let t=r;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n.dispose()}):t.material.dispose())}r.isLight&&r.dispose?.()}function Ka(r){return/[\u4E00-\u9FA5]+/g.test(r)}import{Vector3 as Rr,Vector2 as Ve,Matrix3 as Ir}from"three";import{point as Qh,featureCollection as Gh,center as Hh}from"@turf/turf";function et(r,e,t,n){let i=r.clone().project(e),o=t/2,a=n/2,s=Math.round(i.x*o+o),l=Math.round(-i.y*a+a);return{x:s,y:l}}function Z_(r,e,t,n,i){if(!i)return null;t=Math.min(1,t),n=Math.min(1,n);let o=r/t*2-1,a=1-e/n*2;return new Rr(o,a,0).unproject(i)}function Nr(r){let e=Gh(r.map(n=>Qh(n)));return Hh(e).geometry.coordinates}function Ke(r,e,t){return r.x>=e.x&&r.x<=t.x&&r.y>=e.y&&r.y<=t.y}function Q_(r){let e=0,t=new Rr;for(let n=1;n<r.length;n++){let i=new Rr(r[n-1][0],r[n-1][1],0),o=new Rr(r[n][0],r[n][1],0),a=o.distanceTo(i);a>e&&(e=a,t=o.clone().sub(i).normalize())}return t}function Vt(r,e){return Math.sqrt((e[0]-r[0])**2+(e[1]-r[1])**2)}function Ee(r){let e=0;for(let t=0;t<r.length-1;t++)e+=Vt(r[t],r[t+1]);return e}function $a(r,e,t){let n=new Ve(e[0]-r[0],e[1]-r[1]),i=new Ve(e[0]-t[0],e[1]-t[1]),a=n.angleTo(i)*180/Math.PI,s=new Ve(e[0]-r[0],e[1]-r[1]);return new Ve(t[0]-r[0],t[1]-r[1]).cross(s)>0?a:-a}function Ja(r,e){let t=Math.min(Vt(r[0][0],r[0][1]),Vt(r[0][2],r[0][1]))-1;e||(e=Nr(r[0]));let n=Kh(e,t),i=new Ve(r[0][0][0],r[0][0][1]),o=new Ve(r[0][1][0],r[0][1][1]),a=new Ve(r[0][2][0],r[0][2][1]),l=(i.distanceTo(o)>o.distanceTo(a)?o.clone().sub(i):a.clone().sub(o)).angleTo(new Ve(0,1)),u=new Ir;return u.multiply(new Ir().translate(e[0],e[1])).multiply(new Ir().rotate(l)).multiply(new Ir().translate(-e[0],-e[1])),[n.map(c=>{let h=new Ve(c[0],c[1]).applyMatrix3(u);return[h.x,h.y]})]}function Kh(r,e){let t=e/2;return[[r[0]-t,r[1]+t],[r[0]+t,r[1]+t],[r[0]+t,r[1]-t],[r[0]-t,r[1]-t],[r[0]-t,r[1]+t]]}function $e(r,e){let t=0,n=1/0,[i,o]=e;for(let a=0;a<r.length-1;a++){let[s,l]=r[a],[u,c]=r[a+1],h=Math.min(s,u)<=i&&i<=Math.max(s,u),f=Math.min(l,c)<=o&&o<=Math.max(l,c);if(h&&f){let d=Math.abs((u-s)*(o-l)-(c-l)*(i-s));d<n&&(n=d,t=a)}}return t}function ts(r,e){let t=r[0],n=r[1],i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let s=e[o][0],l=e[o][1],u=e[a][0],c=e[a][1];l>n!=c>n&&t<(u-s)*(n-l)/(c-l)+s&&(i=!i)}return i}function Tn(r,e){return new Proxy(r,{get:(t,n,i)=>Reflect.get(t,n,i),set:(t,n,i,o)=>{let a=Reflect.get(t,n,o),s=Reflect.set(t,n,i,o);return a!==i&&e.dispatchEvent({type:`change-${n}`,value:i}),s}})}function de(r,e){return Promise.race([r,new Promise((t,n)=>{setTimeout(()=>n(new Error("Promise timeout")),e)})])}function Lr(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function es(r,e){let t=Lr("svg");return t.setAttribute("width",r),t.setAttribute("height",e),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function ir(r="2",e){let t=Lr("circle");return t.setAttribute("r",r),t.setAttribute("fill",e),t}function Ur(r){let e=Lr("line");return e.setAttribute("stroke",r),e}function Je(r,e){let t=Lr("rect");return t.setAttribute("stroke",r),t.setAttribute("fill",e),t}function pn(r,e,t){r.setAttribute("cx",`${e}`),r.setAttribute("cy",`${t}`)}function Te(r,e,t){e&&(r.setAttribute("x1",`${e.x}`),r.setAttribute("y1",`${e.y}`)),t&&(r.setAttribute("x2",`${t.x}`),r.setAttribute("y2",`${t.y}`))}function te(r,e,t,n,i){r.setAttribute("x",`${e}`),r.setAttribute("y",`${t}`),r.setAttribute("width",`${n}`),r.setAttribute("height",`${i}`)}function ns(){return Promise.resolve()}function Hi(){return new Promise(r=>{requestAnimationFrame(r)})}function tv(r){return parseInt(r.replace("#","0x"),16)}function ev(r,e){let t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(t*e),a=Math.round(n*e),s=Math.round(i*e);return`#${(1<<24|o<<16|a<<8|s).toString(16).slice(1)}`}function je(r,e=.85){let t,n,i;if(r.startsWith("#"))t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let a=r.slice(4,-1).split(",");t=parseInt(a[0].trim()),n=parseInt(a[1].trim()),i=parseInt(a[2].trim())}return t=Math.min(Math.floor(t*e),255),n=Math.min(Math.floor(n*e),255),i=Math.min(Math.floor(i*e),255),"#"+((1<<24)+(t<<16)+(n<<8)+i).toString(16).slice(1)}function Ki(r,e){r=r.replace(/^#/,"");let t=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return e!==void 0?`rgba(${t}, ${n}, ${i}, ${e})`:`rgb(${t}, ${n}, ${i})`}var Mn=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,rs=(navigator.userAgent||"").toLocaleLowerCase(),or=/ios|iphone/i.test(rs),rv=/android|adr|linux/gi.test(rs);function Pn(r){return Mn?r==="Meta":r==="Control"}var $i="__once__",is=class{events=new Map;on(e,t){if(typeof t!="function")return;let n=this.events.get(e);return n?n.add(t):this.events.set(e,new Set([t]))}once(e,t){if(typeof t!="function")return;let n=`${$i}${e}`,i=this.events.get(n);return i?i.add(t):this.events.set(n,new Set([t]))}off(e,t){let n=this.events.get(e),i=this.events.get(`${$i}${e}`);!n&&!i||(t===void 0&&(n?.clear(),i?.clear()),n?.has(t)&&n.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(e,...t){let n=this.events.get(e),i=this.events.get(`${$i}${e}`);!n&&!i||(n?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.clear())}};var ar=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(ar||{});function In(r){return Object.keys(r).sort().map(e=>`${e}=${r[e]}`).join("&")}function cv(r,e){return new Promise((t,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(e.headers||{}).forEach(o=>{i.setRequestHeader(o,e.headers[o])}),e.responseType&&(i.responseType=e.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(e.responseType==="arraybuffer")t(i.response);else try{let o=JSON.parse(i.responseText);t(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var cs=rr(ls(),1);import{Vector2 as sr}from"three";function $h(r,e){let t=r.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function Jh(r){let e=0;return r.reduce(([t,n],[i,o])=>(e+=Math.sqrt((i-t)**2+(o-n)**2),[i,o])),e/r.length}function hs(r,e=.25){if(Jh(r)<e)return r;let t=(0,cs.default)(r);return hs(t,e)}function Dr(r,e=!1,t=!0,n=5,i=150,o=3){let a=[],s=!e;if(a.push(r[0]),r.length<2)return a;for(let u=0;u<r.length-2;u+=1){let c=r[u],h=r[u+1],f=r[u+2],d=new sr(c[0]-h[0],c[1]-h[1]),m=new sr(f[0]-h[0],f[1]-h[1]),p=$h(d,m)/Math.PI*180,g=d.length()+m.length();(!s||p<i&&g>.01||g>n)&&(a.push(r[u+1]),s=!0)}if(a.push(r[r.length-1]),!t)return a;let l=[];l.push(a[0]);for(let u=0;u<a.length-2;u+=1){let c=new sr(a[u][0],a[u][1]),h=new sr(a[u+1][0],a[u+1][1]),f=new sr(a[u+2][0],a[u+2][1]),d=c.distanceTo(h)/2,m=f.distanceTo(h)/2,p=h.clone(),g=h.clone();p.add(c.clone().sub(h).normalize().multiplyScalar(d>o?o/2:d)),g.add(f.clone().sub(h).normalize().multiplyScalar(m>o?o/2:m));let _=[[p.x,p.y],[h.x,h.y],[g.x,g.y]];l.push(...hs(_,o/25))}return l.push(a[a.length-1]),tf(l)}function tf(r){if(r.length<=1)return r;let e=[],t;return r.forEach(([n,i])=>{t?n===t[0]&&i===t[1]||(t=[n,i],e.push([n,i])):(t=[n,i],e.push([n,i]))}),e}function fs(r,e,t){let n=Math.sqrt((t[0]-e[0])**2+(t[1]-e[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2),closestPoint:e.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-e[0])*(t[0]-e[0])+(r[1]-e[1])*(t[1]-e[1]))/n**2)),o=[e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function gv(r,e,t){let[n,i]=r,[o,a]=e,s=Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2));if(s===0||s<t)return[...e];let l=t/s,u=n+(o-n)*l,c=i+(a-i)*l;return[u,c]}var ps=(u=>(u.START="start",u.END="end",u.FRONT="front",u.RIGHT="right",u.LEFT="left",u.RIGHT_FRONT="right_front",u.LEFT_FRONT="left_front",u.RIGHT_BACK="right_back",u.LEFT_BACK="left_back",u))(ps||{});function Ji(r,e,t){let n=$a(r,e,t);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function yv(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let e=[{direction:"start",distance:Vt(r[0],r[1]),points:[r[0],r[1]]}];for(let t=2;t<r.length;t++){let n=Ji(r[t-2],r[t-1],r[t]);if(n==="front"){let i=e[e.length-1],o=Vt(r[t-1],r[t]);i.distance+=o,t!==2&&i.points.push(r[t-1])}else e.push({direction:n,distance:Vt(r[t-1],r[t]),points:[r[t-1],r[t]]})}return e.push({direction:"end",distance:0,points:[r[r.length-1]]}),e}function ds(r,e){if(r.length<2)return-1;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=[e[0]-i[0],e[1]-i[1]],s=[o[0]-i[0],o[1]-i[1]],l=Math.min(o[0],i[0])<=e[0]&&e[0]<=Math.max(o[0],i[0]),u=Math.min(o[1],i[1])<=e[1]&&e[1]<=Math.max(o[1],i[1]);if(l&&u){let c=a[0]*s[1]-a[1]*s[0];if(Math.abs(c)<1e-6){let h=Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2);return t+h}}t+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function Rn(r,e){if(r.length<2)return r[0]??null;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2);if(t+=a,t>=e){let s=(e-(t-a))/a,l=i[0]+(o[0]-i[0])*s,u=i[1]+(o[1]-i[1])*s;return[l,u]}}return null}var Oe=rr(no(),1);var me="___",Ps=class{constructor(e=3){this.lift_priority=e}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new Oe.default;escalatorRoute=new Oe.default;straightLadderRoute=new Oe.default;initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(t=>{t.points.forEach(n=>{let i=`${t.floor}${me}${n.id}`;if(this.pointMap.set(i,n),this.nodeMap.set(`${n.floor}${me}${n.nodeId}`,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push({...n}),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push({...n}),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push({...n}),this.facilityMap.set(n.targetId,o)}}),t.lines.filter(n=>n.direction!=="no").forEach(n=>{let i=`${t.floor}${me}${n.from}`,o=`${t.floor}${me}${n.to}`,a=this.pointMap.get(i)?.cds,s=this.pointMap.get(o)?.cds;if(a?.length&&s?.length){let l=Vt(a,s);this.addLineItem(i,o,l),n.direction==="double"&&this.addLineItem(o,i,l)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let l=`${a[s].floor}${me}${a[s].id}`;for(let u=0;u<a.length;u++)if(s!==u){let c=`${a[u].floor}${me}${a[u].id}`,h=this.pointMap.get(l)?.cds,f=this.pointMap.get(c)?.cds;if(h?.length&&f?.length)if(a[s].type==="straightLadder"){let d=t;this.addLineItem(l,c,d,i)}else{let d=n;this.addLineItem(l,c,d,i)}}}}),this.escalatorMap.forEach((o,a)=>{if(o.start&&o.end){let s=`${o.start.floor}${me}${o.start.id}`,l=`${o.end.floor}${me}${o.end.id}`,u=this.pointMap.get(s)?.cds,c=this.pointMap.get(l)?.cds;if(u?.length&&c?.length){let h=e;this.addLineItem(s,l,h,i)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new Oe.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new Oe.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new Oe.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${me}${e.nodeId}`);if(t){let[n,i]=t.split(me);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{let a=Vt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:n.point.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let s=this.facilityMap.get(o.facility).filter(u=>o.floor?u.floor===o.floor:!0);if(!s.length)return null;let l=s.map(u=>a(i,{floor:u.floor,id:u.id})).filter(u=>!!u);return l.reduce((u,c)=>{let h=c.reduce((f,d)=>f+Ee(d.points),0);return h<u.distance&&(u.distance=h,u.path=c),u},{distance:1/0,path:l[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${me}${e.id}`,o=`${t.floor}${me}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[];return a.map(l=>{let u=this.pointMap.get(l);if(u){let{floor:c}=u;if(s[s.length-1]?.floor===c){let h=s[s.length-1];h.points.push(u.cds),h.endType=u.type,h.destId=u.nodeId,h.distance=Ee(h.points)}else s.push({floor:c,points:[u.cds],endType:u.type,destId:u.nodeId,distance:0})}}),s}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new Oe.default,this.escalatorRoute=new Oe.default,this.straightLadderRoute=new Oe.default}};var Qt=rr(no(),1);import{cloneDeep as dn}from"lodash";var St="___",Is=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new Qt.default;escalatorRoute=new Qt.default;straightLadderRoute=new Qt.default;forwardLineMap=new Map;forwardRoute=new Qt.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(t=>{let n=[];try{n=JSON.parse(t.entry_end_floor)}catch{n=[]}let i=[];try{i=JSON.parse(t.entry_start_floor)}catch{i=[]}return{...t,entry_start_floor:i,entry_end_floor:n}})}initRoute(e,t){this.clear(),this.roadInfo=e,this.initFacilities(t);let n=new Date,i=n.getHours()*60+n.getMinutes();e.length&&(e.forEach(o=>{(o.points||[]).filter(a=>a.openStatus!==!1).filter(a=>{if(!a.startTime||!a.endTime)return!0;let[s,l]=a.startTime.split(":").map(d=>+d),[u,c]=a.endTime.split(":").map(d=>+d),h=s*60+l,f=u*60+c;return i>=h&&i<=f}).forEach(a=>{a.floor=o.floor;let s=`${o.floor}${St}${a.id}`;if(this.nodeMap.set(`${o.floor}${St}${a.nodeId}`,`${o.floor}${St}${a.relatedId||a.id}`),this.pointMap.set(s,a),this.isFacilityByType(a.type)){let l=this.facilities.find(u=>u.id===+a.targetId);if(l){switch(l.entry_infra_type){case"straightLadder":if(l.entry_end_floor.find(f=>f.floor===o.floor)&&l.entry_start_floor.find(f=>f.floor===o.floor)){let f=this.straightLadderMap.get(a.targetId)||[];f.push({...a}),this.straightLadderMap.set(a.targetId,f)}break;case"staircase":if(l.entry_end_floor.find(f=>f.floor===o.floor)&&l.entry_start_floor.find(f=>f.floor===o.floor)){let f=this.staircaseMap.get(a.targetId)||[];f.push({...a}),this.staircaseMap.set(a.targetId,f)}break;case"escalator":let c=this.escalatorMap.get(a.targetId)||[];if(l.entry_start_floor.find(f=>f.floor===o.floor)){let f=c.find(d=>d.end?.floor!==o.floor&&!d.start);f?f.start=a:c.push({start:a})}if(l.entry_end_floor.find(f=>f.floor===o.floor)){let f=c.find(d=>d.start?.floor!==o.floor&&!d.end);f?f.end=a:c.push({end:a})}this.escalatorMap.set(a.targetId,c);break;case"ramp":let h=this.rampMap.get(a.targetId)||[];if(l.entry_start_floor.find(f=>f.floor===o.floor)){let f=h.find(d=>d.end?.floor!==o.floor&&!d.start);f?f.start=a:h.push({start:a})}if(l.entry_end_floor.find(f=>f.floor===o.floor)){let f=h.find(d=>d.start?.floor!==o.floor&&!d.end);f?f.end=a:h.push({end:a})}this.rampMap.set(a.targetId,h);break}let u=this.facilityMap.get(a.targetId)||[];u.push({...a}),this.facilityMap.set(a.targetId,u)}}a.type==="parkingSpace"&&this.parkingMap.set(`${o.floor}${St}${a.name}`,a)}),(o.lines||[]).filter(a=>a.direction!=="no").forEach(a=>{let s=`${o.floor}${St}${a.from}`,l=`${o.floor}${St}${a.to}`,u=this.pointMap.get(s),c=this.pointMap.get(l);if(!u||!c)return;let h=u.cds,f=c.cds,d=Vt(h,f);if(!u.permission&&!c.permission)switch(this.addLineItem(s,l,d),this.addLineItem(l,s,d),a.direction){case"double":this.addLineItem(s,l,d,this.forwardLineMap),this.addLineItem(l,s,d,this.forwardLineMap);break;case"single":this.addLineItem(s,l,d,this.forwardLineMap);break;case"back":this.addLineItem(l,s,d,this.forwardLineMap);break}else u.permission&&(this.setPermissionLine(s,l,u.permission,d,""),this.setPermissionLine(l,s,u.permission,d,"")),c.permission&&c.permission!==u.permission&&(this.setPermissionLine(s,l,c.permission,d,""),this.setPermissionLine(l,s,c.permission,d,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[`permission_${e}`]||(this[`permission_${e}`]=new Set),this[`permission_${e}`]}setPermissionLine(e,t,n,i,o){this.getPermissionMap(n).add({fromKey:e,toKey:t,distance:i,type:o})}addPermissionFacility(){this.straightLadderMap.forEach((e,t)=>{if(e.length<2){this.straightLadderMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${St}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${St}${e[a].id}`,l=this.pointMap.get(s);if(!l)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"straightLadder"),l.permission&&l.permission!==o.permission&&this.setPermissionLine(i,s,l.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,t)=>{if(e.length<2){this.staircaseMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${St}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${St}${e[a].id}`,l=this.pointMap.get(s);if(!l)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"staircase"),l.permission&&l.permission!==o.permission&&this.setPermissionLine(i,s,l.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${St}${n.start.id}`,o=`${n.end.floor}${St}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,1,"escalator"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,1,"escalator"))}})}),this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${St}${n.start.id}`,o=`${n.end.floor}${St}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,10,"ramp"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,10,"ramp"))}})})}addPermissionLineToMap(e,t,n,i){let o=this.getPermissionMap(e);console.log(o),o.forEach(a=>{t.includes(a.type)&&(a.type===""?this.addLineItem(a.fromKey,a.toKey,a.distance,n):this.addLineItem(a.fromKey,a.toKey,i.get(a.type),n))})}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let l=`${a[s].floor}${St}${a[s].id}`,u=this.pointMap.get(l);if(!(!u||u.permission)){for(let c=0;c<a.length;c++)if(s!==c){let h=`${a[c].floor}${St}${a[c].id}`,f=this.pointMap.get(h);if(!f||f.permission)continue;if(a[s].type==="straightLadder"){let d=t;this.addLineItem(l,h,d,i)}else{let d=n;this.addLineItem(l,h,d,i)}}}}}),this.escalatorMap.forEach((o,a)=>{o.forEach(s=>{if(s.start&&s.end){let l=`${s.start.floor}${St}${s.start.id}`,u=`${s.end.floor}${St}${s.end.id}`,c=this.pointMap.get(l),h=this.pointMap.get(u);if(c&&h&&!c.permission&&!h.permission){let f=e;this.addLineItem(l,u,f,i)}}})})}initBaseRoute(){let e=new Map(dn([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new Qt.default(e)}initEscalatorRoute(){let e=new Map(dn([...this.lineMap])),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new Qt.default(e)}initStraightLadderRoute(){let e=new Map(dn([...this.lineMap])),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new Qt.default(e)}initForwardRoute(){this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${St}${n.start.id}`,o=`${n.end.floor}${St}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&!a.permission&&!s.permission&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.forwardRoute=new Qt.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${St}${e.nodeId}`);if(t){let[n,i]=t.split(St);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{if(o.relatedId)return i;let a=Vt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:t.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let n=this.parkingMap.get(`${e.floor}${St}${e.parkingSpace}`);if(n)return{floor:e.floor,id:n.id}}let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilities.filter(i=>+i.type_id==+e.facility).map(i=>i.id).map(i=>this.facilityMap.get(`${i}`)).flat(2)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n="",i){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let o=this.transformStart(e);if(!o)return"no-start";let a=this.transformEnd(t);if(!a)return"no-end";let s=this.getBasePath.bind(this);switch(n){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;case"forward":s=this.getForwardPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(a.id)return s(o,a,i);if(a.facility){let u=this.facilities.filter(h=>+h.type_id==+t.facility).map(h=>h.id).map(h=>this.facilityMap.get(`${h}`)).flat(2).filter(h=>h).filter(h=>a.floor?h.floor===a.floor:!0);if(!u.length)return null;let c=u.map(h=>s(o,{floor:h.floor,id:h.id},i)).filter(h=>!!h);return c.reduce((h,f)=>{let d=f[0].consume;return d<h.distance&&(h.distance=d,h.path=f),h},{distance:1/0,path:c[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${St}${e.id}`,o=`${t.floor}${St}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[],l=a.reduce((u,c,h,f)=>{if(h===0)return 0;let d=f[h-1],m=n.graph.get(d).get(c);return u+m},0);return a.map(u=>{let c=this.pointMap.get(u);if(c){let{floor:h}=c,f=c.type;if(this.isFacilityByType(c.type)){let d=this.facilities.find(m=>m.id===+c.targetId);d&&(f=d.entry_infra_type)}if(s[s.length-1]?.floor===h){let d=s[s.length-1];d.points.push(c.cds),d.endType=f,d.destId=c.nodeId,d.distance=Ee(d.points)}else s.push({floor:h,points:[c.cds],endType:f,destId:c.nodeId,distance:0,consume:l})}}),s}getBasePath(e,t,n){if(!n)return this.getRoutePath(e,t,this.baseRoute);let i=dn(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let o=new Qt.default(i);return this.getRoutePath(e,t,o)}getEscalatorPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.escalatorRoute);let i=dn(this.escalatorRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",1*o],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]));let a=new Qt.default(i);return this.getRoutePath(e,t,a)}getStraightLadderPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.straightLadderRoute);let i=dn(this.straightLadderRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",3*o],["straightLadder",1*o],["staircase",3e4*o]]));let a=new Qt.default(i);return this.getRoutePath(e,t,a)}getForwardPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.forwardRoute);let i=dn(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],i,new Map([["ramp",10]]));let o=new Qt.default(i);return this.getRoutePath(e,t,o)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new Qt.default,this.escalatorRoute=new Qt.default,this.straightLadderRoute=new Qt.default}};var mn=class{static keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let e=this.createKey();for(;this.keySet.has(e);)e=this.createKey();return e}static removeKey(e){this.keySet.delete(e)}static dispose(){this.keySet.clear()}};function Rs(r){return r.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function ze(r,e,t){return new Promise((n,i)=>{let o=mn.genUniqueKey(),a=({data:s})=>{s.type===`${e}_result`&&s.key===o&&(mn.removeKey(o),self.removeEventListener("message",a),s.error?i(s.error):n(s.data))};r.addEventListener("message",a),r.postMessage({type:e,key:o,data:t})})}function Lv(r){let e={};for(let n in r)n.startsWith("on")&&(e[Rs(n.slice(2))]=r[n]);let t=async({data:n})=>{if(e[n.type])try{let i=await e[n.type](n.data);self.postMessage({type:`${n.type}_result`,key:n.key,data:i})}catch(i){self.postMessage({type:`${n.type}_result`,key:n.key,error:i})}else self.postMessage({type:`${n.type}_result`,key:n.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}import{BoxGeometry as of,BufferGeometry as af,Line as sf,LineBasicMaterial as Ns,Mesh as uf}from"three";function zv(r,e=16711680){let t=new Ns({color:e}),n=new af().setFromPoints(r);return new sf(n,t)}function Bv(r,e=16711680){let t=new Ns({color:e}),n=new of(1,1,1),i=new uf(n,t);return i.position.copy(r),i}function se(r,e,t=0){r.forEach(n=>{n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"?(n.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=e[0],o[1]-=e[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(i=>i.map(o=>Me(o,e)))),n.doors?.length&&n.doors.map(i=>{i.coord=Me(i.coordinate,e)}),n.center&&(n.center=Me(n.center,e))):n.geometry.coords=Me(n.geometry.cds,e)});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(t+n+1)}}function Me(r,e){return[r[0]-e[0],r[1]-e[1]]}import{Group as lf}from"@tweenjs/tween.js";var tn=class{pauseTween=!1;tweenStore=new Set;group=new lf;constructor(){}update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(e=>{this.tweenStore.add(e),e.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(e=>{e.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(e){this.group.remove(e)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(e=>e.stop()),this.group.removeAll()}dispose(){this.clear()}};import{EventDispatcher as cf}from"three";var Or=class extends cf{constructor(t){super();this.ctn=t;this.registryEvent()}point;registryEvent(){this.ctn.addEventListener("pointerdown",this._pointerDown),this.ctn.addEventListener("pointerup",this._pointerUp)}unRegistryEvent(){this.ctn.removeEventListener("pointerdown",this._pointerDown),this.ctn.removeEventListener("pointerup",this._pointerUp)}_pointerDown=t=>{this.point={x:t.offsetX,y:t.offsetY}};_pointerUp=t=>{if(!this.point)return;let{offsetX:n,offsetY:i}=t,{x:o,y:a}=this.point;Math.hypot(o-n+(a-i))>3||this.dispatchEvent({type:"click",e:t})};dispose(){this.unRegistryEvent()}};import{isNil as hf}from"lodash";import{EventDispatcher as ff}from"three";var gn=class extends ff{_task=[];started=!1;activeTask=null;_id=0;constructor(e=!0){super(),e&&this.start()}_isEffectiveTask(e){return e&&typeof e.run=="function"}_getIndexByTid(e){return this._task.findIndex(t=>t.tid===e)}_createTask(e){return this._isEffectiveTask(e)?{...e,tid:++this._id,meta:e.meta||{}}:!1}get task(){return[...this._task]}getTasks(){return[...this._task]}add(e){if(this._isEffectiveTask(e)){let t=this._createTask(e);return this._task.push(t),this.started&&!this.activeTask&&this.start(),t.tid}return!1}replace(e,t){if(!this._isEffectiveTask(t))return console.warn("[TaskQueue] replace\u65B9\u6CD5\u4F20\u5165\u7684task\u53C2\u6570\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;let n=this._getIndexByTid(e);if(n===-1)return console.warn(`[TaskQueue] \u6CA1\u6709\u627E\u5230id=${e}\u7684\u4EFB\u52A1`),!1;let i=this._createTask(t);return this._task.splice(n,1,i),i.tid}replaceByMetaType(e){let t=e.meta?.type;if(hf(t))return this.add(e);{let n=this._task.find(i=>i.meta.type===t);if(n)return this.replace(n.tid,e)}}remove(e){let t=this._getIndexByTid(e);return t===-1?(console.warn(`[TaskQueue] remove\u65B9\u6CD5\u4F20\u5165\u7684id\uFF1A${e}\u627E\u4E0D\u5230\u5BF9\u5E94\u7684task`),!1):(this._task.splice(t,1),!0)}clear(){this._task.length=0}start(){this.started=!0,!this.activeTask&&this._task.length&&this.exec()}stop(){this.started=!1}async exec(){if(!this.started||!this._task.length)return!1;let e=this._task.shift();this.activeTask=e,this.dispatchEvent({type:"active-task-start",task:e});let t;try{t=await e.run()}catch(n){console.warn("[task run err]",n,e)}return this.activeTask=null,this.dispatchEvent({type:"active-task-end",task:e,res:t}),this.exec()}};import{EventDispatcher as xd,Box2 as Cd,Vector3 as _n,Vector2 as Dn,Raycaster as Ad,Box3 as bd,Color as Sd,AmbientLight as wd}from"three";import{EventDispatcher as nd}from"three";import{Object3D as Sf,ExtrudeGeometry as wf,Mesh as Ef,Box3 as Br,Vector3 as Pe,BufferGeometry as Tf,LineSegments as Mf,Ray as Os,Vector2 as We}from"three";import{LineMaterial as pf}from"three/examples/jsm/lines/LineMaterial";import{Color as zr,LineBasicMaterial as df,MeshStandardMaterial as mf,MeshBasicMaterial as gf,ShaderMaterial as yf,DoubleSide as _f}from"three";function Ls(r){return`${r.x}-${r.y}-${r.z}`}var kt=class{static lineMaterialMap=new Map;static meshStandardMaterialMap=new Map;static meshBasicMaterialMap=new Map;static shaderMaterialMap=new Map;static line2MaterialMap=new Map;static generateLineMaterialKey({color:e,opacity:t}){return`${e}-${t}`}static createLineMaterial({color:e,opacity:t}){let n=this.generateLineMaterialKey({color:e,opacity:t});if(this.lineMaterialMap.has(n))return this.lineMaterialMap.get(n);let i=new df({color:new zr(e).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(n,i),i}static createMeshStandardMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new mf({color:new zr(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshBasicMaterialMap.has(n))return this.meshBasicMaterialMap.get(n);let i=new gf({color:e,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(n,i),i}static createShaderMaterial({gradualColor:e,center:t,maxValue:n,opacity:i,direction:o,max:a,min:s}){let l=`${e.toString()}-${Ls(t)}-${n}-${i}-${Ls(o)}`;if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let u=`
1
+ var zh=Object.create;var Za=Object.defineProperty;var Bh=Object.getOwnPropertyDescriptor;var kh=Object.getOwnPropertyNames;var Xh=Object.getPrototypeOf,Fh=Object.prototype.hasOwnProperty;var He=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Vh=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of kh(e))!Fh.call(r,i)&&i!==t&&Za(r,i,{get:()=>e[i],enumerable:!(n=Bh(e,i))||n.enumerable});return r};var rr=(r,e,t)=>(t=r!=null?zh(Xh(r)):{},Vh(e||!r||!r.__esModule?Za(t,"default",{value:r,enumerable:!0}):t,r));var as=He((fv,os)=>{os.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var ls=He((pv,us)=>{var ss=as();us.exports=function(r,e){Array.isArray(e)||(e=[]),r.length>0&&e.push(ss([0,0],r[0]));for(var t=0;t<r.length-1;t++){var n=r[t],i=r[t+1],o=n[0],a=n[1],s=i[0],l=i[1],u=[.75*o+.25*s,.75*a+.25*l],c=[.25*o+.75*s,.25*a+.75*l];e.push(u),e.push(c)}return r.length>1&&e.push(ss([0,0],r[r.length-1])),e}});var gs=He((vv,ms)=>{var to=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,t)=>e.priority-t.priority)}set(e,t){let n=Number(t);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(e)?this.queue.map(i=>(i.key===e&&Object.assign(i,{priority:n}),i)):(this.keys.add(e),this.queue.push({key:e,priority:n})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(t=>t.key===e)}};ms.exports=to});var vs=He((xv,_s)=>{function ys(r,e){let t=new Map;for(let[n,i]of r)n!==e&&i instanceof Map?t.set(n,ys(i,e)):n!==e&&t.set(n,i);return t}_s.exports=ys});var As=He((Cv,Cs)=>{function ef(r){let e=Number(r);return!(isNaN(e)||e<=0)}function xs(r){let e=new Map;return Object.keys(r).forEach(n=>{let i=r[n];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return e.set(n,xs(i));if(!ef(i))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,i);return e.set(n,Number(i))}),e}Cs.exports=xs});var ws=He((Av,Ss)=>{function bs(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((e,t)=>{if(typeof e=="object"&&e instanceof Map){bs(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}Ss.exports=bs});var no=He((bv,Ms)=>{var nf=gs(),rf=vs(),Es=As(),Ts=ws(),eo=class{constructor(e){e instanceof Map?(Ts(e),this.graph=e):e?this.graph=Es(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(Ts(t),n=t):n=Es(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=rf(this.graph,e),this}path(e,t,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let i=new Set,o=new nf,a=new Map,s=[],l=0,u=[];if(n.avoid&&(u=[].concat(n.avoid)),u.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(u.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(o.set(e,0);!o.isEmpty();){let c=o.next();if(c.key===t){l=c.priority;let f=c.key;for(;a.has(f);)s.push(f),f=a.get(f);break}i.add(c.key),(this.graph.get(c.key)||new Map).forEach((f,d)=>{if(i.has(d)||u.includes(d))return null;if(!o.has(d))return a.set(d,c.key),o.set(d,c.priority+f);let m=o.get(d).priority,p=c.priority+f;return p<m?(a.set(d,c.key),o.set(d,p)):null})}return s.length?(n.trim?s.shift():s=s.concat([e]),n.reverse||(s=s.reverse()),n.cost?{path:s,cost:l}:s):n.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};Ms.exports=eo});var _o=He((go,yo)=>{(function(r,e){typeof go=="object"&&typeof yo<"u"?yo.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self,r["'typed'"]=e())})(go,function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";function i(){function a(v){return typeof v=="object"&&v!==null&&v.constructor===Object}let s=[{name:"number",test:function(v){return typeof v=="number"}},{name:"string",test:function(v){return typeof v=="string"}},{name:"boolean",test:function(v){return typeof v=="boolean"}},{name:"Function",test:function(v){return typeof v=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(v){return v instanceof Date}},{name:"RegExp",test:function(v){return v instanceof RegExp}},{name:"Object",test:a},{name:"null",test:function(v){return v===null}},{name:"undefined",test:function(v){return v===void 0}}],l={name:"any",test:r,isAny:!0},u,c,h=0,f={createCount:0};function d(v){let E=u.get(v);if(E)return E;let P='Unknown type "'+v+'"',L=v.toLowerCase(),k;for(k of c)if(k.toLowerCase()===L){P+='. Did you mean "'+k+'" ?';break}throw new TypeError(P)}function m(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",P=E?d(E).index:c.length,L=[];for(let O=0;O<v.length;++O){if(!v[O]||typeof v[O].name!="string"||typeof v[O].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let W=v[O].name;if(u.has(W))throw new TypeError('Duplicate type name "'+W+'"');L.push(W),u.set(W,{name:W,test:v[O].test,isAny:v[O].isAny,index:P+O,conversionsTo:[]})}let k=c.slice(P);c=c.slice(0,P).concat(L).concat(k);for(let O=P+L.length;O<c.length;++O)u.get(c[O]).index=O}function p(){u=new Map,c=[],h=0,m([l],!1)}p(),m(s);function g(){let v;for(v of c)u.get(v).conversionsTo=[];h=0}function _(v){let E=c.filter(P=>{let L=u.get(P);return!L.isAny&&L.test(v)});return E.length?E:["any"]}function A(v){return v&&typeof v=="function"&&"_typedFunctionData"in v}function y(v,E,P){if(!A(v))throw new TypeError(n);let L=P&&P.exact,k=Array.isArray(E)?E.join(","):E,O=I(k),W=x(O);if(!L||W in v.signatures){let ot=v._typedFunctionData.signatureMap.get(W);if(ot)return ot}let X=O.length,q;if(L){q=[];let ot;for(ot in v.signatures)q.push(v._typedFunctionData.signatureMap.get(ot))}else q=v._typedFunctionData.signatures;for(let ot=0;ot<X;++ot){let ct=O[ot],bt=[],oe;for(oe of q){let Jt=V(oe.params,ot);if(!(!Jt||ct.restParam&&!Jt.restParam)){if(!Jt.hasAny){let Se=T(Jt);if(ct.types.some(we=>!Se.has(we.name)))continue}bt.push(oe)}}if(q=bt,q.length===0)break}let F;for(F of q)if(F.params.length<=X)return F;throw new TypeError("Signature not found (signature: "+(v.name||"unnamed")+"("+x(O,", ")+"))")}function S(v,E,P){return y(v,E,P).implementation}function C(v,E){let P=d(E);if(P.test(v))return v;let L=P.conversionsTo;if(L.length===0)throw new Error("There are no conversions to "+E+" defined.");for(let k=0;k<L.length;k++)if(d(L[k].from).test(v))return L[k].convert(v);throw new Error("Cannot convert "+v+" to "+E)}function x(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return v.map(P=>P.name).join(E)}function b(v){let E=v.indexOf("...")===0,L=(E?v.length>3?v.slice(3):"any":v).split("|").map(X=>d(X.trim())),k=!1,O=E?"...":"";return{types:L.map(function(X){return k=X.isAny||k,O+=X.name+"|",{name:X.name,typeIndex:X.index,test:X.test,isAny:X.isAny,conversion:null,conversionIndex:-1}}),name:O.slice(0,-1),hasAny:k,hasConversion:!1,restParam:E}}function w(v){let E=v.types.map(W=>W.name),P=mt(E),L=v.hasAny,k=v.name,O=P.map(function(W){let X=d(W.from);return L=X.isAny||L,k+="|"+W.from,{name:W.from,typeIndex:X.index,test:X.test,isAny:X.isAny,conversion:W,conversionIndex:W.index}});return{types:v.types.concat(O),name:k,hasAny:L,hasConversion:O.length>0,restParam:v.restParam}}function T(v){return v.typeSet||(v.typeSet=new Set,v.types.forEach(E=>v.typeSet.add(E.name))),v.typeSet}function I(v){let E=[];if(typeof v!="string")throw new TypeError("Signatures must be strings");let P=v.trim();if(P==="")return E;let L=P.split(",");for(let k=0;k<L.length;++k){let O=b(L[k].trim());if(O.restParam&&k!==L.length-1)throw new SyntaxError('Unexpected rest parameter "'+L[k]+'": only allowed for the last parameter');if(O.types.length===0)return null;E.push(O)}return E}function R(v){let E=Ot(v);return E?E.restParam:!1}function U(v){if(!v||v.types.length===0)return r;if(v.types.length===1)return d(v.types[0].name).test;if(v.types.length===2){let E=d(v.types[0].name).test,P=d(v.types[1].name).test;return function(k){return E(k)||P(k)}}else{let E=v.types.map(function(P){return d(P.name).test});return function(L){for(let k=0;k<E.length;k++)if(E[k](L))return!0;return!1}}}function Z(v){let E,P,L;if(R(v)){E=Lt(v).map(U);let k=E.length,O=U(Ot(v)),W=function(X){for(let q=k;q<X.length;q++)if(!O(X[q]))return!1;return!0};return function(q){for(let F=0;F<E.length;F++)if(!E[F](q[F]))return!1;return W(q)&&q.length>=k+1}}else return v.length===0?function(O){return O.length===0}:v.length===1?(P=U(v[0]),function(O){return P(O[0])&&O.length===1}):v.length===2?(P=U(v[0]),L=U(v[1]),function(O){return P(O[0])&&L(O[1])&&O.length===2}):(E=v.map(U),function(O){for(let W=0;W<E.length;W++)if(!E[W](O[W]))return!1;return O.length===E.length})}function V(v,E){return E<v.length?v[E]:R(v)?Ot(v):null}function j(v,E){let P=V(v,E);return P?T(P):new Set}function D(v){return v.conversion===null||v.conversion===void 0}function Q(v,E){let P=new Set;return v.forEach(L=>{let k=j(L.params,E),O;for(O of k)P.add(O)}),P.has("any")?["any"]:Array.from(P)}function K(v,E,P){let L,k,O=v||"unnamed",W=P,X;for(X=0;X<E.length;X++){let ct=[];if(W.forEach(bt=>{let oe=V(bt.params,X),Jt=U(oe);(X<bt.params.length||R(bt.params))&&Jt(E[X])&&ct.push(bt)}),ct.length===0){if(k=Q(W,X),k.length>0){let bt=_(E[X]);return L=new TypeError("Unexpected type of argument in function "+O+" (expected: "+k.join(" or ")+", actual: "+bt.join(" | ")+", index: "+X+")"),L.data={category:"wrongType",fn:O,index:X,actual:bt,expected:k},L}}else W=ct}let q=W.map(function(ct){return R(ct.params)?1/0:ct.params.length});if(E.length<Math.min.apply(null,q))return k=Q(W,X),L=new TypeError("Too few arguments in function "+O+" (expected: "+k.join(" or ")+", index: "+E.length+")"),L.data={category:"tooFewArgs",fn:O,index:E.length,expected:k},L;let F=Math.max.apply(null,q);if(E.length>F)return L=new TypeError("Too many arguments in function "+O+" (expected: "+F+", actual: "+E.length+")"),L.data={category:"tooManyArgs",fn:O,index:E.length,expectedLength:F},L;let ot=[];for(let ct=0;ct<E.length;++ct)ot.push(_(E[ct]).join("|"));return L=new TypeError('Arguments of type "'+ot.join(", ")+'" do not match any of the defined signatures of function '+O+"."),L.data={category:"mismatch",actual:ot},L}function G(v){let E=c.length+1;for(let P=0;P<v.types.length;P++)D(v.types[P])&&(E=Math.min(E,v.types[P].typeIndex));return E}function tt(v){let E=h+1;for(let P=0;P<v.types.length;P++)D(v.types[P])||(E=Math.min(E,v.types[P].conversionIndex));return E}function dt(v,E){if(v.hasAny){if(!E.hasAny)return 1}else if(E.hasAny)return-1;if(v.restParam){if(!E.restParam)return 1}else if(E.restParam)return-1;if(v.hasConversion){if(!E.hasConversion)return 1}else if(E.hasConversion)return-1;let P=G(v)-G(E);if(P<0)return-1;if(P>0)return 1;let L=tt(v)-tt(E);return L<0?-1:L>0?1:0}function lt(v,E){let P=v.params,L=E.params,k=Ot(P),O=Ot(L),W=R(P),X=R(L);if(W&&k.hasAny){if(!X||!O.hasAny)return 1}else if(X&&O.hasAny)return-1;let q=0,F=0,ot;for(ot of P)ot.hasAny&&++q,ot.hasConversion&&++F;let ct=0,bt=0;for(ot of L)ot.hasAny&&++ct,ot.hasConversion&&++bt;if(q!==ct)return q-ct;if(W&&k.hasConversion){if(!X||!O.hasConversion)return 1}else if(X&&O.hasConversion)return-1;if(F!==bt)return F-bt;if(W){if(!X)return 1}else if(X)return-1;let oe=(P.length-L.length)*(W?-1:1);if(oe!==0)return oe;let Jt=[],Se=0;for(let En=0;En<P.length;++En){let Mr=dt(P[En],L[En]);Jt.push(Mr),Se+=Mr}if(Se!==0)return Se;let we;for(we of Jt)if(we!==0)return we;return 0}function mt(v){if(v.length===0)return[];let E=v.map(d);v.length>1&&E.sort((k,O)=>k.index-O.index);let P=E[0].conversionsTo;if(v.length===1)return P;P=P.concat([]);let L=new Set(v);for(let k=1;k<E.length;++k){let O;for(O of E[k].conversionsTo)L.has(O.from)||(P.push(O),L.add(O.from))}return P}function Nt(v,E){let P=E;if(v.some(k=>k.hasConversion)){let k=R(v),O=v.map(It);P=function(){let X=[],q=k?arguments.length-1:arguments.length;for(let F=0;F<q;F++)X[F]=O[F](arguments[F]);return k&&(X[q]=arguments[q].map(O[q])),E.apply(this,X)}}let L=P;if(R(v)){let k=v.length-1;L=function(){return P.apply(this,pe(arguments,0,k).concat([pe(arguments,k)]))}}return L}function It(v){let E,P,L,k,O=[],W=[];switch(v.types.forEach(function(X){X.conversion&&(O.push(d(X.conversion.from).test),W.push(X.conversion.convert))}),W.length){case 0:return function(q){return q};case 1:return E=O[0],L=W[0],function(q){return E(q)?L(q):q};case 2:return E=O[0],P=O[1],L=W[0],k=W[1],function(q){return E(q)?L(q):P(q)?k(q):q};default:return function(q){for(let F=0;F<W.length;F++)if(O[F](q))return W[F](q);return q}}}function Tt(v){function E(P,L,k){if(L<P.length){let O=P[L],W=[];if(O.restParam){let X=O.types.filter(D);X.length<O.types.length&&W.push({types:X,name:"..."+X.map(q=>q.name).join("|"),hasAny:X.some(q=>q.isAny),hasConversion:!1,restParam:!0}),W.push(O)}else W=O.types.map(function(X){return{types:[X],name:X.name,hasAny:X.isAny,hasConversion:X.conversion,restParam:!1}});return fn(W,function(X){return E(P,L+1,k.concat([X]))})}else return[k]}return E(v,0,[])}function Ct(v,E){let P=Math.max(v.length,E.length);for(let X=0;X<P;X++){let q=j(v,X),F=j(E,X),ot=!1,ct;for(ct of F)if(q.has(ct)){ot=!0;break}if(!ot)return!1}let L=v.length,k=E.length,O=R(v),W=R(E);return O?W?L===k:k>=L:W?L>=k:L===k}function Ft(v){return v.map(E=>Tr(E)?wr(E.referToSelf.callback):Er(E)?wn(E.referTo.references,E.referTo.callback):E)}function At(v,E,P){let L=[],k;for(k of v){let O=P[k];if(typeof O!="number")throw new TypeError('No definition for referenced signature "'+k+'"');if(O=E[O],typeof O!="function")return!1;L.push(O)}return L}function gt(v,E,P){let L=Ft(v),k=new Array(L.length).fill(!1),O=!0;for(;O;){O=!1;let W=!0;for(let X=0;X<L.length;++X){if(k[X])continue;let q=L[X];if(Tr(q))L[X]=q.referToSelf.callback(P),L[X].referToSelf=q.referToSelf,k[X]=!0,W=!1;else if(Er(q)){let F=At(q.referTo.references,L,E);F?(L[X]=q.referTo.callback.apply(this,F),L[X].referTo=q.referTo,k[X]=!0,W=!1):O=!0}}if(W&&O)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return L}function ie(v){let E=/\bthis(\(|\.signatures\b)/;Object.keys(v).forEach(P=>{let L=v[P];if(E.test(L.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Dt(v,E){if(f.createCount++,Object.keys(E).length===0)throw new SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&ie(E);let P=[],L=[],k={},O=[],W;for(W in E){if(!Object.prototype.hasOwnProperty.call(E,W))continue;let _t=I(W);if(!_t)continue;P.forEach(function(nr){if(Ct(nr,_t))throw new TypeError('Conflicting signatures "'+x(nr)+'" and "'+x(_t)+'".')}),P.push(_t);let ae=L.length;L.push(E[W]);let Dh=_t.map(w),Pr;for(Pr of Tt(Dh)){let nr=x(Pr);O.push({params:Pr,name:nr,fn:ae}),Pr.every(Oh=>!Oh.hasConversion)&&(k[nr]=ae)}}O.sort(lt);let X=gt(L,k,er),q;for(q in k)Object.prototype.hasOwnProperty.call(k,q)&&(k[q]=X[k[q]]);let F=[],ot=new Map;for(q of O)ot.has(q.name)||(q.fn=X[q.fn],F.push(q),ot.set(q.name,q));let ct=F[0]&&F[0].params.length<=2&&!R(F[0].params),bt=F[1]&&F[1].params.length<=2&&!R(F[1].params),oe=F[2]&&F[2].params.length<=2&&!R(F[2].params),Jt=F[3]&&F[3].params.length<=2&&!R(F[3].params),Se=F[4]&&F[4].params.length<=2&&!R(F[4].params),we=F[5]&&F[5].params.length<=2&&!R(F[5].params),En=ct&&bt&&oe&&Jt&&Se&&we;for(let _t=0;_t<F.length;++_t)F[_t].test=Z(F[_t].params);let Mr=ct?U(F[0].params[0]):e,sh=bt?U(F[1].params[0]):e,uh=oe?U(F[2].params[0]):e,lh=Jt?U(F[3].params[0]):e,ch=Se?U(F[4].params[0]):e,hh=we?U(F[5].params[0]):e,fh=ct?U(F[0].params[1]):e,ph=bt?U(F[1].params[1]):e,dh=oe?U(F[2].params[1]):e,mh=Jt?U(F[3].params[1]):e,gh=Se?U(F[4].params[1]):e,yh=we?U(F[5].params[1]):e;for(let _t=0;_t<F.length;++_t)F[_t].implementation=Nt(F[_t].params,F[_t].fn);let _h=ct?F[0].implementation:t,vh=bt?F[1].implementation:t,xh=oe?F[2].implementation:t,Ch=Jt?F[3].implementation:t,Ah=Se?F[4].implementation:t,bh=we?F[5].implementation:t,Sh=ct?F[0].params.length:-1,wh=bt?F[1].params.length:-1,Eh=oe?F[2].params.length:-1,Th=Jt?F[3].params.length:-1,Mh=Se?F[4].params.length:-1,Ph=we?F[5].params.length:-1,Ih=En?6:0,Rh=F.length,Nh=F.map(_t=>_t.test),Lh=F.map(_t=>_t.implementation),Uh=function(){for(let ae=Ih;ae<Rh;ae++)if(Nh[ae](arguments))return Lh[ae].apply(this,arguments);return f.onMismatch(v,arguments,F)};function er(_t,ae){return arguments.length===Sh&&Mr(_t)&&fh(ae)?_h.apply(this,arguments):arguments.length===wh&&sh(_t)&&ph(ae)?vh.apply(this,arguments):arguments.length===Eh&&uh(_t)&&dh(ae)?xh.apply(this,arguments):arguments.length===Th&&lh(_t)&&mh(ae)?Ch.apply(this,arguments):arguments.length===Mh&&ch(_t)&&gh(ae)?Ah.apply(this,arguments):arguments.length===Ph&&hh(_t)&&yh(ae)?bh.apply(this,arguments):Uh.apply(this,arguments)}try{Object.defineProperty(er,"name",{value:v})}catch{}return er.signatures=k,er._typedFunctionData={signatures:F,signatureMap:ot},er}function ft(v,E,P){throw K(v,E,P)}function Lt(v){return pe(v,0,v.length-1)}function Ot(v){return v[v.length-1]}function pe(v,E,P){return Array.prototype.slice.call(v,E,P)}function Ue(v,E){for(let P=0;P<v.length;P++)if(E(v[P]))return v[P]}function fn(v,E){return Array.prototype.concat.apply([],v.map(E))}function Ge(){let v=Lt(arguments).map(P=>x(I(P))),E=Ot(arguments);if(typeof E!="function")throw new TypeError("Callback function expected as last argument");return wn(v,E)}function wn(v,E){return{referTo:{references:v,callback:E}}}function wr(v){if(typeof v!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:v}}}function Er(v){return v&&typeof v.referTo=="object"&&Array.isArray(v.referTo.references)&&typeof v.referTo.callback=="function"}function Tr(v){return v&&typeof v.referToSelf=="object"&&typeof v.referToSelf.callback=="function"}function Jn(v,E){if(!v)return E;if(E&&E!==v){let P=new Error("Function names do not match (expected: "+v+", actual: "+E+")");throw P.data={actual:E,expected:v},P}return v}function tr(v){let E;for(let P in v)Object.prototype.hasOwnProperty.call(v,P)&&(A(v[P])||typeof v[P].signature=="string")&&(E=Jn(E,v[P].name));return E}function M(v,E){let P;for(P in E)if(Object.prototype.hasOwnProperty.call(E,P)){if(P in v&&E[P]!==v[P]){let L=new Error('Signature "'+P+'" is defined twice');throw L.data={signature:P,sourceFunction:E[P],destFunction:v[P]},L}v[P]=E[P]}}let Y=f;f=function(v){let E=typeof v=="string",P=E?1:0,L=E?v:"",k={};for(let O=P;O<arguments.length;++O){let W=arguments[O],X={},q;if(typeof W=="function"?(q=W.name,typeof W.signature=="string"?X[W.signature]=W:A(W)&&(X=W.signatures)):a(W)&&(X=W,E||(q=tr(W))),Object.keys(X).length===0){let F=new TypeError("Argument to 'typed' at index "+O+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw F.data={index:O,argument:W},F}E||(L=Jn(L,q)),M(k,X)}return Dt(L||"",k)},f.create=i,f.createCount=Y.createCount,f.onMismatch=ft,f.throwMismatchError=ft,f.createError=K,f.clear=p,f.clearConversions=g,f.addTypes=m,f._findType=d,f.referTo=Ge,f.referToSelf=wr,f.convert=C,f.findSignature=y,f.find=S,f.isTypedFunction=A,f.warnAgainstDeprecatedThis=!0,f.addType=function(v,E){let P="any";E!==!1&&u.has("Object")&&(P="Object"),f.addTypes([v],P)};function yt(v){if(!v||typeof v.from!="string"||typeof v.to!="string"||typeof v.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(v.to===v.from)throw new SyntaxError('Illegal to define conversion from "'+v.from+'" to itself.')}return f.addConversion=function(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};yt(v);let P=d(v.to),L=P.conversionsTo.find(k=>k.from===v.from);if(L)if(E&&E.override)f.removeConversion({from:L.from,to:v.to,convert:L.convert});else throw new Error('There is already a conversion from "'+v.from+'" to "'+P.name+'"');P.conversionsTo.push({from:v.from,convert:v.convert,index:h++})},f.addConversions=function(v,E){v.forEach(P=>f.addConversion(P,E))},f.removeConversion=function(v){yt(v);let E=d(v.to),P=Ue(E.conversionsTo,k=>k.from===v.from);if(!P)throw new Error("Attempt to remove nonexistent conversion from "+v.from+" to "+v.to);if(P.convert!==v.convert)throw new Error("Conversion to remove does not match existing conversion");let L=E.conversionsTo.indexOf(P);E.conversionsTo.splice(L,1)},f.resolve=function(v,E){if(!A(v))throw new TypeError(n);let P=v._typedFunctionData.signatures;for(let L=0;L<P.length;++L)if(P[L].test(E))return P[L];return null},f}var o=i();return o})});import{EventDispatcher as Md,Vector3 as Pd}from"three";var Yt=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(e){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),e()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(e){this.tasks.requestAnimation.delete(e),window.cancelAnimationFrame(e)}setTimeout(e,t){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),e()},t);return this.tasks.timeout.add(n),n}clearTimeout(e){this.tasks.timeout.delete(e),window.clearTimeout(e)}setInterval(e,t){let n=window.setInterval(()=>{this.tasks.interval.delete(n),e()},t);return this.tasks.interval.add(n),n}clearInterval(e){this.tasks.interval.delete(e),window.clearInterval(e)}dispose(){this.tasks.requestAnimation.forEach(e=>{window.cancelAnimationFrame(e)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(e=>{window.clearTimeout(e)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(e=>{window.clearInterval(e)}),this.tasks.interval.clear()}};import{Shape as jh,Group as Wh,DirectionalLight as qh,AmbientLight as Yh,Path as Zh,Vector2 as Qa}from"three";function Ga(){let r=new Wh,e=new Yh(16777215,2.6);return r.add(e),r}function De(r,e=[]){let t=new jh(r.map(n=>new Qa(...n)));return e.length&&e.forEach(n=>{var i=new Zh(n.map(o=>new Qa(...o)));t.holes.push(i)}),t}function Ha(r=16777215,e=1){let t=new qh(r,e);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function Zt(r,e){if(e&&r.children&&r.children.length&&r.children.forEach(t=>{Zt(t,e)}),r.isMesh){let t=r;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n.dispose()}):t.material.dispose())}r.isLight&&r.dispose?.()}function Ka(r){return/[\u4E00-\u9FA5]+/g.test(r)}import{Vector3 as Rr,Vector2 as Ve,Matrix3 as Ir}from"three";import{point as Qh,featureCollection as Gh,center as Hh}from"@turf/turf";function et(r,e,t,n){let i=r.clone().project(e),o=t/2,a=n/2,s=Math.round(i.x*o+o),l=Math.round(-i.y*a+a);return{x:s,y:l}}function Z_(r,e,t,n,i){if(!i)return null;t=Math.min(1,t),n=Math.min(1,n);let o=r/t*2-1,a=1-e/n*2;return new Rr(o,a,0).unproject(i)}function Nr(r){let e=Gh(r.map(n=>Qh(n)));return Hh(e).geometry.coordinates}function Ke(r,e,t){return r.x>=e.x&&r.x<=t.x&&r.y>=e.y&&r.y<=t.y}function Q_(r){let e=0,t=new Rr;for(let n=1;n<r.length;n++){let i=new Rr(r[n-1][0],r[n-1][1],0),o=new Rr(r[n][0],r[n][1],0),a=o.distanceTo(i);a>e&&(e=a,t=o.clone().sub(i).normalize())}return t}function Vt(r,e){return Math.sqrt((e[0]-r[0])**2+(e[1]-r[1])**2)}function Ee(r){let e=0;for(let t=0;t<r.length-1;t++)e+=Vt(r[t],r[t+1]);return e}function $a(r,e,t){let n=new Ve(e[0]-r[0],e[1]-r[1]),i=new Ve(e[0]-t[0],e[1]-t[1]),a=n.angleTo(i)*180/Math.PI,s=new Ve(e[0]-r[0],e[1]-r[1]);return new Ve(t[0]-r[0],t[1]-r[1]).cross(s)>0?a:-a}function Ja(r,e){let t=Math.min(Vt(r[0][0],r[0][1]),Vt(r[0][2],r[0][1]))-1;e||(e=Nr(r[0]));let n=Kh(e,t),i=new Ve(r[0][0][0],r[0][0][1]),o=new Ve(r[0][1][0],r[0][1][1]),a=new Ve(r[0][2][0],r[0][2][1]),l=(i.distanceTo(o)>o.distanceTo(a)?o.clone().sub(i):a.clone().sub(o)).angleTo(new Ve(0,1)),u=new Ir;return u.multiply(new Ir().translate(e[0],e[1])).multiply(new Ir().rotate(l)).multiply(new Ir().translate(-e[0],-e[1])),[n.map(c=>{let h=new Ve(c[0],c[1]).applyMatrix3(u);return[h.x,h.y]})]}function Kh(r,e){let t=e/2;return[[r[0]-t,r[1]+t],[r[0]+t,r[1]+t],[r[0]+t,r[1]-t],[r[0]-t,r[1]-t],[r[0]-t,r[1]+t]]}function $e(r,e){let t=0,n=1/0,[i,o]=e;for(let a=0;a<r.length-1;a++){let[s,l]=r[a],[u,c]=r[a+1],h=Math.min(s,u)<=i&&i<=Math.max(s,u),f=Math.min(l,c)<=o&&o<=Math.max(l,c);if(h&&f){let d=Math.abs((u-s)*(o-l)-(c-l)*(i-s));d<n&&(n=d,t=a)}}return t}function ts(r,e){let t=r[0],n=r[1],i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let s=e[o][0],l=e[o][1],u=e[a][0],c=e[a][1];l>n!=c>n&&t<(u-s)*(n-l)/(c-l)+s&&(i=!i)}return i}function Tn(r,e){return new Proxy(r,{get:(t,n,i)=>Reflect.get(t,n,i),set:(t,n,i,o)=>{let a=Reflect.get(t,n,o),s=Reflect.set(t,n,i,o);return a!==i&&e.dispatchEvent({type:`change-${n}`,value:i}),s}})}function de(r,e){return Promise.race([r,new Promise((t,n)=>{setTimeout(()=>n(new Error("Promise timeout")),e)})])}function Lr(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function es(r,e){let t=Lr("svg");return t.setAttribute("width",r),t.setAttribute("height",e),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function ir(r="2",e){let t=Lr("circle");return t.setAttribute("r",r),t.setAttribute("fill",e),t}function Ur(r){let e=Lr("line");return e.setAttribute("stroke",r),e}function Je(r,e){let t=Lr("rect");return t.setAttribute("stroke",r),t.setAttribute("fill",e),t}function pn(r,e,t){r.setAttribute("cx",`${e}`),r.setAttribute("cy",`${t}`)}function Te(r,e,t){e&&(r.setAttribute("x1",`${e.x}`),r.setAttribute("y1",`${e.y}`)),t&&(r.setAttribute("x2",`${t.x}`),r.setAttribute("y2",`${t.y}`))}function te(r,e,t,n,i){r.setAttribute("x",`${e}`),r.setAttribute("y",`${t}`),r.setAttribute("width",`${n}`),r.setAttribute("height",`${i}`)}function ns(){return Promise.resolve()}function Hi(){return new Promise(r=>{requestAnimationFrame(r)})}function tv(r){return parseInt(r.replace("#","0x"),16)}function ev(r,e){let t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(t*e),a=Math.round(n*e),s=Math.round(i*e);return`#${(1<<24|o<<16|a<<8|s).toString(16).slice(1)}`}function je(r,e=.85){let t,n,i;if(r.startsWith("#"))t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let a=r.slice(4,-1).split(",");t=parseInt(a[0].trim()),n=parseInt(a[1].trim()),i=parseInt(a[2].trim())}return t=Math.min(Math.floor(t*e),255),n=Math.min(Math.floor(n*e),255),i=Math.min(Math.floor(i*e),255),"#"+((1<<24)+(t<<16)+(n<<8)+i).toString(16).slice(1)}function Ki(r,e){r=r.replace(/^#/,"");let t=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return e!==void 0?`rgba(${t}, ${n}, ${i}, ${e})`:`rgb(${t}, ${n}, ${i})`}var Mn=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,rs=(navigator.userAgent||"").toLocaleLowerCase(),or=/ios|iphone/i.test(rs),rv=/android|adr|linux/gi.test(rs);function Pn(r){return Mn?r==="Meta":r==="Control"}var $i="__once__",is=class{events=new Map;on(e,t){if(typeof t!="function")return;let n=this.events.get(e);return n?n.add(t):this.events.set(e,new Set([t]))}once(e,t){if(typeof t!="function")return;let n=`${$i}${e}`,i=this.events.get(n);return i?i.add(t):this.events.set(n,new Set([t]))}off(e,t){let n=this.events.get(e),i=this.events.get(`${$i}${e}`);!n&&!i||(t===void 0&&(n?.clear(),i?.clear()),n?.has(t)&&n.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(e,...t){let n=this.events.get(e),i=this.events.get(`${$i}${e}`);!n&&!i||(n?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.clear())}};var ar=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(ar||{});function In(r){return Object.keys(r).sort().map(e=>`${e}=${r[e]}`).join("&")}function cv(r,e){return new Promise((t,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(e.headers||{}).forEach(o=>{i.setRequestHeader(o,e.headers[o])}),e.responseType&&(i.responseType=e.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(e.responseType==="arraybuffer")t(i.response);else try{let o=JSON.parse(i.responseText);t(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var cs=rr(ls(),1);import{Vector2 as sr}from"three";function $h(r,e){let t=r.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function Jh(r){let e=0;return r.reduce(([t,n],[i,o])=>(e+=Math.sqrt((i-t)**2+(o-n)**2),[i,o])),e/r.length}function hs(r,e=.25){if(Jh(r)<e)return r;let t=(0,cs.default)(r);return hs(t,e)}function Dr(r,e=!1,t=!0,n=5,i=150,o=3){let a=[],s=!e;if(a.push(r[0]),r.length<2)return a;for(let u=0;u<r.length-2;u+=1){let c=r[u],h=r[u+1],f=r[u+2],d=new sr(c[0]-h[0],c[1]-h[1]),m=new sr(f[0]-h[0],f[1]-h[1]),p=$h(d,m)/Math.PI*180,g=d.length()+m.length();(!s||p<i&&g>.01||g>n)&&(a.push(r[u+1]),s=!0)}if(a.push(r[r.length-1]),!t)return a;let l=[];l.push(a[0]);for(let u=0;u<a.length-2;u+=1){let c=new sr(a[u][0],a[u][1]),h=new sr(a[u+1][0],a[u+1][1]),f=new sr(a[u+2][0],a[u+2][1]),d=c.distanceTo(h)/2,m=f.distanceTo(h)/2,p=h.clone(),g=h.clone();p.add(c.clone().sub(h).normalize().multiplyScalar(d>o?o/2:d)),g.add(f.clone().sub(h).normalize().multiplyScalar(m>o?o/2:m));let _=[[p.x,p.y],[h.x,h.y],[g.x,g.y]];l.push(...hs(_,o/25))}return l.push(a[a.length-1]),tf(l)}function tf(r){if(r.length<=1)return r;let e=[],t;return r.forEach(([n,i])=>{t?n===t[0]&&i===t[1]||(t=[n,i],e.push([n,i])):(t=[n,i],e.push([n,i]))}),e}function fs(r,e,t){let n=Math.sqrt((t[0]-e[0])**2+(t[1]-e[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2),closestPoint:e.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-e[0])*(t[0]-e[0])+(r[1]-e[1])*(t[1]-e[1]))/n**2)),o=[e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function gv(r,e,t){let[n,i]=r,[o,a]=e,s=Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2));if(s===0||s<t)return[...e];let l=t/s,u=n+(o-n)*l,c=i+(a-i)*l;return[u,c]}var ps=(u=>(u.START="start",u.END="end",u.FRONT="front",u.RIGHT="right",u.LEFT="left",u.RIGHT_FRONT="right_front",u.LEFT_FRONT="left_front",u.RIGHT_BACK="right_back",u.LEFT_BACK="left_back",u))(ps||{});function Ji(r,e,t){let n=$a(r,e,t);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function yv(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let e=[{direction:"start",distance:Vt(r[0],r[1]),points:[r[0],r[1]]}];for(let t=2;t<r.length;t++){let n=Ji(r[t-2],r[t-1],r[t]);if(n==="front"){let i=e[e.length-1],o=Vt(r[t-1],r[t]);i.distance+=o,t!==2&&i.points.push(r[t-1])}else e.push({direction:n,distance:Vt(r[t-1],r[t]),points:[r[t-1],r[t]]})}return e.push({direction:"end",distance:0,points:[r[r.length-1]]}),e}function ds(r,e){if(r.length<2)return-1;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=[e[0]-i[0],e[1]-i[1]],s=[o[0]-i[0],o[1]-i[1]],l=Math.min(o[0],i[0])<=e[0]&&e[0]<=Math.max(o[0],i[0]),u=Math.min(o[1],i[1])<=e[1]&&e[1]<=Math.max(o[1],i[1]);if(l&&u){let c=a[0]*s[1]-a[1]*s[0];if(Math.abs(c)<1e-6){let h=Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2);return t+h}}t+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function Rn(r,e){if(r.length<2)return r[0]??null;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2);if(t+=a,t>=e){let s=(e-(t-a))/a,l=i[0]+(o[0]-i[0])*s,u=i[1]+(o[1]-i[1])*s;return[l,u]}}return null}var Oe=rr(no(),1);var me="___",Ps=class{constructor(e=3){this.lift_priority=e}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new Oe.default;escalatorRoute=new Oe.default;straightLadderRoute=new Oe.default;initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(t=>{t.points.forEach(n=>{let i=`${t.floor}${me}${n.id}`;if(this.pointMap.set(i,n),this.nodeMap.set(`${n.floor}${me}${n.nodeId}`,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push({...n}),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push({...n}),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push({...n}),this.facilityMap.set(n.targetId,o)}}),t.lines.filter(n=>n.direction!=="no").forEach(n=>{let i=`${t.floor}${me}${n.from}`,o=`${t.floor}${me}${n.to}`,a=this.pointMap.get(i)?.cds,s=this.pointMap.get(o)?.cds;if(a?.length&&s?.length){let l=Vt(a,s);this.addLineItem(i,o,l),n.direction==="double"&&this.addLineItem(o,i,l)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let l=`${a[s].floor}${me}${a[s].id}`;for(let u=0;u<a.length;u++)if(s!==u){let c=`${a[u].floor}${me}${a[u].id}`,h=this.pointMap.get(l)?.cds,f=this.pointMap.get(c)?.cds;if(h?.length&&f?.length)if(a[s].type==="straightLadder"){let d=t;this.addLineItem(l,c,d,i)}else{let d=n;this.addLineItem(l,c,d,i)}}}}),this.escalatorMap.forEach((o,a)=>{if(o.start&&o.end){let s=`${o.start.floor}${me}${o.start.id}`,l=`${o.end.floor}${me}${o.end.id}`,u=this.pointMap.get(s)?.cds,c=this.pointMap.get(l)?.cds;if(u?.length&&c?.length){let h=e;this.addLineItem(s,l,h,i)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new Oe.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new Oe.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new Oe.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${me}${e.nodeId}`);if(t){let[n,i]=t.split(me);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{let a=Vt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:n.point.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let s=this.facilityMap.get(o.facility).filter(u=>o.floor?u.floor===o.floor:!0);if(!s.length)return null;let l=s.map(u=>a(i,{floor:u.floor,id:u.id})).filter(u=>!!u);return l.reduce((u,c)=>{let h=c.reduce((f,d)=>f+Ee(d.points),0);return h<u.distance&&(u.distance=h,u.path=c),u},{distance:1/0,path:l[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${me}${e.id}`,o=`${t.floor}${me}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[];return a.map(l=>{let u=this.pointMap.get(l);if(u){let{floor:c}=u;if(s[s.length-1]?.floor===c){let h=s[s.length-1];h.points.push(u.cds),h.endType=u.type,h.destId=u.nodeId,h.distance=Ee(h.points)}else s.push({floor:c,points:[u.cds],endType:u.type,destId:u.nodeId,distance:0})}}),s}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new Oe.default,this.escalatorRoute=new Oe.default,this.straightLadderRoute=new Oe.default}};var Qt=rr(no(),1);import{cloneDeep as dn}from"lodash";var St="___",Is=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new Qt.default;escalatorRoute=new Qt.default;straightLadderRoute=new Qt.default;forwardLineMap=new Map;forwardRoute=new Qt.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(t=>{let n=[];try{n=JSON.parse(t.entry_end_floor)}catch{n=[]}let i=[];try{i=JSON.parse(t.entry_start_floor)}catch{i=[]}return{...t,entry_start_floor:i,entry_end_floor:n}})}initRoute(e,t){this.clear(),this.roadInfo=e,this.initFacilities(t);let n=new Date,i=n.getHours()*60+n.getMinutes();e.length&&(e.forEach(o=>{(o.points||[]).filter(a=>a.openStatus!==!1).filter(a=>{if(!a.startTime||!a.endTime)return!0;let[s,l]=a.startTime.split(":").map(d=>+d),[u,c]=a.endTime.split(":").map(d=>+d),h=s*60+l,f=u*60+c;return i>=h&&i<=f}).forEach(a=>{a.floor=o.floor;let s=`${o.floor}${St}${a.id}`;if(this.nodeMap.set(`${o.floor}${St}${a.nodeId}`,`${o.floor}${St}${a.relatedId||a.id}`),this.pointMap.set(s,a),this.isFacilityByType(a.type)){let l=this.facilities.find(u=>u.id===+a.targetId);if(l){switch(l.entry_infra_type){case"straightLadder":if(l.entry_end_floor.find(f=>f.floor===o.floor)&&l.entry_start_floor.find(f=>f.floor===o.floor)){let f=this.straightLadderMap.get(a.targetId)||[];f.push({...a}),this.straightLadderMap.set(a.targetId,f)}break;case"staircase":if(l.entry_end_floor.find(f=>f.floor===o.floor)&&l.entry_start_floor.find(f=>f.floor===o.floor)){let f=this.staircaseMap.get(a.targetId)||[];f.push({...a}),this.staircaseMap.set(a.targetId,f)}break;case"escalator":let c=this.escalatorMap.get(a.targetId)||[];if(l.entry_start_floor.find(f=>f.floor===o.floor)){let f=c.find(d=>d.end?.floor!==o.floor&&!d.start);f?f.start=a:c.push({start:a})}if(l.entry_end_floor.find(f=>f.floor===o.floor)){let f=c.find(d=>d.start?.floor!==o.floor&&!d.end);f?f.end=a:c.push({end:a})}this.escalatorMap.set(a.targetId,c);break;case"ramp":let h=this.rampMap.get(a.targetId)||[];if(l.entry_start_floor.find(f=>f.floor===o.floor)){let f=h.find(d=>d.end?.floor!==o.floor&&!d.start);f?f.start=a:h.push({start:a})}if(l.entry_end_floor.find(f=>f.floor===o.floor)){let f=h.find(d=>d.start?.floor!==o.floor&&!d.end);f?f.end=a:h.push({end:a})}this.rampMap.set(a.targetId,h);break}let u=this.facilityMap.get(a.targetId)||[];u.push({...a}),this.facilityMap.set(a.targetId,u)}}a.type==="parkingSpace"&&this.parkingMap.set(`${o.floor}${St}${a.name}`,a)}),(o.lines||[]).filter(a=>a.direction!=="no").forEach(a=>{let s=`${o.floor}${St}${a.from}`,l=`${o.floor}${St}${a.to}`,u=this.pointMap.get(s),c=this.pointMap.get(l);if(!u||!c)return;let h=u.cds,f=c.cds,d=Vt(h,f);if(!u.permission&&!c.permission)switch(this.addLineItem(s,l,d),this.addLineItem(l,s,d),a.direction){case"double":this.addLineItem(s,l,d,this.forwardLineMap),this.addLineItem(l,s,d,this.forwardLineMap);break;case"single":this.addLineItem(s,l,d,this.forwardLineMap);break;case"back":this.addLineItem(l,s,d,this.forwardLineMap);break}else u.permission&&(this.setPermissionLine(s,l,u.permission,d,""),this.setPermissionLine(l,s,u.permission,d,"")),c.permission&&c.permission!==u.permission&&(this.setPermissionLine(s,l,c.permission,d,""),this.setPermissionLine(l,s,c.permission,d,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[`permission_${e}`]||(this[`permission_${e}`]=new Set),this[`permission_${e}`]}setPermissionLine(e,t,n,i,o){this.getPermissionMap(n).add({fromKey:e,toKey:t,distance:i,type:o})}addPermissionFacility(){this.straightLadderMap.forEach((e,t)=>{if(e.length<2){this.straightLadderMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${St}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${St}${e[a].id}`,l=this.pointMap.get(s);if(!l)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"straightLadder"),l.permission&&l.permission!==o.permission&&this.setPermissionLine(i,s,l.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,t)=>{if(e.length<2){this.staircaseMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${St}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${St}${e[a].id}`,l=this.pointMap.get(s);if(!l)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"staircase"),l.permission&&l.permission!==o.permission&&this.setPermissionLine(i,s,l.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${St}${n.start.id}`,o=`${n.end.floor}${St}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,1,"escalator"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,1,"escalator"))}})}),this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${St}${n.start.id}`,o=`${n.end.floor}${St}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,10,"ramp"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,10,"ramp"))}})})}addPermissionLineToMap(e,t,n,i){let o=this.getPermissionMap(e);console.log(o),o.forEach(a=>{t.includes(a.type)&&(a.type===""?this.addLineItem(a.fromKey,a.toKey,a.distance,n):this.addLineItem(a.fromKey,a.toKey,i.get(a.type),n))})}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let l=`${a[s].floor}${St}${a[s].id}`,u=this.pointMap.get(l);if(!(!u||u.permission)){for(let c=0;c<a.length;c++)if(s!==c){let h=`${a[c].floor}${St}${a[c].id}`,f=this.pointMap.get(h);if(!f||f.permission)continue;if(a[s].type==="straightLadder"){let d=t;this.addLineItem(l,h,d,i)}else{let d=n;this.addLineItem(l,h,d,i)}}}}}),this.escalatorMap.forEach((o,a)=>{o.forEach(s=>{if(s.start&&s.end){let l=`${s.start.floor}${St}${s.start.id}`,u=`${s.end.floor}${St}${s.end.id}`,c=this.pointMap.get(l),h=this.pointMap.get(u);if(c&&h&&!c.permission&&!h.permission){let f=e;this.addLineItem(l,u,f,i)}}})})}initBaseRoute(){let e=new Map(dn([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new Qt.default(e)}initEscalatorRoute(){let e=new Map(dn([...this.lineMap])),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new Qt.default(e)}initStraightLadderRoute(){let e=new Map(dn([...this.lineMap])),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new Qt.default(e)}initForwardRoute(){this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${St}${n.start.id}`,o=`${n.end.floor}${St}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&!a.permission&&!s.permission&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.forwardRoute=new Qt.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${St}${e.nodeId}`);if(t){let[n,i]=t.split(St);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{if(o.relatedId)return i;let a=Vt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:t.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let n=this.parkingMap.get(`${e.floor}${St}${e.parkingSpace}`);if(n)return{floor:e.floor,id:n.id}}let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilities.filter(i=>+i.type_id==+e.facility).map(i=>i.id).map(i=>this.facilityMap.get(`${i}`)).flat(2)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n="",i){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let o=this.transformStart(e);if(!o)return"no-start";let a=this.transformEnd(t);if(!a)return"no-end";let s=this.getBasePath.bind(this);switch(n){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;case"forward":s=this.getForwardPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(a.id)return s(o,a,i);if(a.facility){let u=this.facilities.filter(h=>+h.type_id==+t.facility).map(h=>h.id).map(h=>this.facilityMap.get(`${h}`)).flat(2).filter(h=>h).filter(h=>a.floor?h.floor===a.floor:!0);if(!u.length)return null;let c=u.map(h=>s(o,{floor:h.floor,id:h.id},i)).filter(h=>!!h);return c.reduce((h,f)=>{let d=f[0].consume;return d<h.distance&&(h.distance=d,h.path=f),h},{distance:1/0,path:c[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${St}${e.id}`,o=`${t.floor}${St}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[],l=a.reduce((u,c,h,f)=>{if(h===0)return 0;let d=f[h-1],m=n.graph.get(d).get(c);return u+m},0);return a.map(u=>{let c=this.pointMap.get(u);if(c){let{floor:h}=c,f=c.type;if(this.isFacilityByType(c.type)){let d=this.facilities.find(m=>m.id===+c.targetId);d&&(f=d.entry_infra_type)}if(s[s.length-1]?.floor===h){let d=s[s.length-1];d.points.push(c.cds),d.endType=f,d.destId=c.nodeId,d.distance=Ee(d.points)}else s.push({floor:h,points:[c.cds],endType:f,destId:c.nodeId,distance:0,consume:l})}}),s}getBasePath(e,t,n){if(!n)return this.getRoutePath(e,t,this.baseRoute);let i=dn(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let o=new Qt.default(i);return this.getRoutePath(e,t,o)}getEscalatorPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.escalatorRoute);let i=dn(this.escalatorRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",1*o],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]));let a=new Qt.default(i);return this.getRoutePath(e,t,a)}getStraightLadderPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.straightLadderRoute);let i=dn(this.straightLadderRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",3*o],["straightLadder",1*o],["staircase",3e4*o]]));let a=new Qt.default(i);return this.getRoutePath(e,t,a)}getForwardPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.forwardRoute);let i=dn(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],i,new Map([["ramp",10]]));let o=new Qt.default(i);return this.getRoutePath(e,t,o)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new Qt.default,this.escalatorRoute=new Qt.default,this.straightLadderRoute=new Qt.default}};var mn=class{static keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let e=this.createKey();for(;this.keySet.has(e);)e=this.createKey();return e}static removeKey(e){this.keySet.delete(e)}static dispose(){this.keySet.clear()}};function Rs(r){return r.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function ze(r,e,t){return new Promise((n,i)=>{let o=mn.genUniqueKey(),a=({data:s})=>{s.type===`${e}_result`&&s.key===o&&(mn.removeKey(o),self.removeEventListener("message",a),s.error?i(s.error):n(s.data))};r.addEventListener("message",a),r.postMessage({type:e,key:o,data:t})})}function Lv(r){let e={};for(let n in r)n.startsWith("on")&&(e[Rs(n.slice(2))]=r[n]);let t=async({data:n})=>{if(e[n.type])try{let i=await e[n.type](n.data);self.postMessage({type:`${n.type}_result`,key:n.key,data:i})}catch(i){self.postMessage({type:`${n.type}_result`,key:n.key,error:i})}else self.postMessage({type:`${n.type}_result`,key:n.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}import{BoxGeometry as of,BufferGeometry as af,Line as sf,LineBasicMaterial as Ns,Mesh as uf}from"three";function zv(r,e=16711680){let t=new Ns({color:e}),n=new af().setFromPoints(r);return new sf(n,t)}function Bv(r,e=16711680){let t=new Ns({color:e}),n=new of(1,1,1),i=new uf(n,t);return i.position.copy(r),i}function se(r,e,t=0){r.forEach(n=>{n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"?(n.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=e[0],o[1]-=e[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(i=>i.map(o=>Me(o,e)))),n.doors?.length&&n.doors.map(i=>{i.coord=Me(i.coordinate,e)}),n.center&&(n.center=Me(n.center,e))):n.geometry.coords=Me(n.geometry.cds,e)});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(t+n+1)}}function Me(r,e){return[r[0]-e[0],r[1]-e[1]]}import{Group as lf}from"@tweenjs/tween.js";var tn=class{pauseTween=!1;tweenStore=new Set;group=new lf;constructor(){}update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(e=>{this.tweenStore.add(e),e.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(e=>{e.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(e){this.group.remove(e)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(e=>e.stop()),this.group.removeAll()}dispose(){this.clear()}};import{EventDispatcher as cf}from"three";var Or=class extends cf{constructor(t){super();this.ctn=t;this.registryEvent()}point;registryEvent(){this.ctn.addEventListener("pointerdown",this._pointerDown),this.ctn.addEventListener("pointerup",this._pointerUp)}unRegistryEvent(){this.ctn.removeEventListener("pointerdown",this._pointerDown),this.ctn.removeEventListener("pointerup",this._pointerUp)}_pointerDown=t=>{this.point={x:t.offsetX,y:t.offsetY}};_pointerUp=t=>{if(!this.point)return;let{offsetX:n,offsetY:i}=t,{x:o,y:a}=this.point;Math.hypot(o-n+(a-i))>3||this.dispatchEvent({type:"click",e:t})};dispose(){this.unRegistryEvent()}};import{isNil as hf}from"lodash";import{EventDispatcher as ff}from"three";var gn=class extends ff{_task=[];started=!1;activeTask=null;_id=0;constructor(e=!0){super(),e&&this.start()}_isEffectiveTask(e){return e&&typeof e.run=="function"}_getIndexByTid(e){return this._task.findIndex(t=>t.tid===e)}_createTask(e){return this._isEffectiveTask(e)?{...e,tid:++this._id,meta:e.meta||{}}:!1}get task(){return[...this._task]}getTasks(){return[...this._task]}add(e){if(this._isEffectiveTask(e)){let t=this._createTask(e);return this._task.push(t),this.started&&!this.activeTask&&this.start(),t.tid}return!1}replace(e,t){if(!this._isEffectiveTask(t))return console.warn("[TaskQueue] replace\u65B9\u6CD5\u4F20\u5165\u7684task\u53C2\u6570\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;let n=this._getIndexByTid(e);if(n===-1)return console.warn(`[TaskQueue] \u6CA1\u6709\u627E\u5230id=${e}\u7684\u4EFB\u52A1`),!1;let i=this._createTask(t);return this._task.splice(n,1,i),i.tid}replaceByMetaType(e){let t=e.meta?.type;if(hf(t))return this.add(e);{let n=this._task.find(i=>i.meta.type===t);return n?this.replace(n.tid,e):this.add(e)}}remove(e){let t=this._getIndexByTid(e);return t===-1?(console.warn(`[TaskQueue] remove\u65B9\u6CD5\u4F20\u5165\u7684id\uFF1A${e}\u627E\u4E0D\u5230\u5BF9\u5E94\u7684task`),!1):(this._task.splice(t,1),!0)}clear(){this._task.length=0}start(){this.started=!0,!this.activeTask&&this._task.length&&this.exec()}stop(){this.started=!1}async exec(){if(!this.started||!this._task.length)return!1;let e=this._task.shift();this.activeTask=e,this.dispatchEvent({type:"active-task-start",task:e});let t;try{t=await e.run()}catch(n){console.warn("[task run err]",n,e)}return this.activeTask=null,this.dispatchEvent({type:"active-task-end",task:e,res:t}),this.exec()}};import{EventDispatcher as xd,Box2 as Cd,Vector3 as _n,Vector2 as Dn,Raycaster as Ad,Box3 as bd,Color as Sd,AmbientLight as wd}from"three";import{EventDispatcher as nd}from"three";import{Object3D as Sf,ExtrudeGeometry as wf,Mesh as Ef,Box3 as Br,Vector3 as Pe,BufferGeometry as Tf,LineSegments as Mf,Ray as Os,Vector2 as We}from"three";import{LineMaterial as pf}from"three/examples/jsm/lines/LineMaterial";import{Color as zr,LineBasicMaterial as df,MeshStandardMaterial as mf,MeshBasicMaterial as gf,ShaderMaterial as yf,DoubleSide as _f}from"three";function Ls(r){return`${r.x}-${r.y}-${r.z}`}var kt=class{static lineMaterialMap=new Map;static meshStandardMaterialMap=new Map;static meshBasicMaterialMap=new Map;static shaderMaterialMap=new Map;static line2MaterialMap=new Map;static generateLineMaterialKey({color:e,opacity:t}){return`${e}-${t}`}static createLineMaterial({color:e,opacity:t}){let n=this.generateLineMaterialKey({color:e,opacity:t});if(this.lineMaterialMap.has(n))return this.lineMaterialMap.get(n);let i=new df({color:new zr(e).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(n,i),i}static createMeshStandardMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new mf({color:new zr(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshBasicMaterialMap.has(n))return this.meshBasicMaterialMap.get(n);let i=new gf({color:e,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(n,i),i}static createShaderMaterial({gradualColor:e,center:t,maxValue:n,opacity:i,direction:o,max:a,min:s}){let l=`${e.toString()}-${Ls(t)}-${n}-${i}-${Ls(o)}`;if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let u=`
2
2
  uniform vec3 uColor;
3
3
  uniform vec3 uGradualColor;
4
4
  uniform vec3 center;
package/lib/bmap.min.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var lf=Object.create;var ls=Object.defineProperty;var cf=Object.getOwnPropertyDescriptor;var hf=Object.getOwnPropertyNames;var ff=Object.getPrototypeOf,pf=Object.prototype.hasOwnProperty;var j=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var dn=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var df=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hf(e))!pf.call(r,i)&&i!==t&&ls(r,i,{get:()=>e[i],enumerable:!(n=cf(e,i))||n.enumerable});return r};var Sr=(r,e,t)=>(t=r!=null?lf(ff(r)):{},df(e||!r||!r.__esModule?ls(t,"default",{value:r,enumerable:!0}):t,r));var Cs=dn((yy,xs)=>{xs.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var Ss=dn((_y,bs)=>{var As=Cs();bs.exports=function(r,e){Array.isArray(e)||(e=[]),r.length>0&&e.push(As([0,0],r[0]));for(var t=0;t<r.length-1;t++){var n=r[t],i=r[t+1],o=n[0],a=n[1],s=i[0],l=i[1],u=[.75*o+.25*s,.75*a+.25*l],c=[.25*o+.75*s,.25*a+.75*l];e.push(u),e.push(c)}return r.length>1&&e.push(As([0,0],r[r.length-1])),e}});var Rs=dn((by,Is)=>{var vo=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,t)=>e.priority-t.priority)}set(e,t){let n=Number(t);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(e)?this.queue.map(i=>(i.key===e&&Object.assign(i,{priority:n}),i)):(this.keys.add(e),this.queue.push({key:e,priority:n})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(t=>t.key===e)}};Is.exports=vo});var Us=dn((Sy,Ls)=>{function Ns(r,e){let t=new Map;for(let[n,i]of r)n!==e&&i instanceof Map?t.set(n,Ns(i,e)):n!==e&&t.set(n,i);return t}Ls.exports=Ns});var zs=dn((wy,Os)=>{function vf(r){let e=Number(r);return!(isNaN(e)||e<=0)}function Ds(r){let e=new Map;return Object.keys(r).forEach(n=>{let i=r[n];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return e.set(n,Ds(i));if(!vf(i))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,i);return e.set(n,Number(i))}),e}Os.exports=Ds});var Xs=dn((Ey,ks)=>{function Bs(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((e,t)=>{if(typeof e=="object"&&e instanceof Map){Bs(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}ks.exports=Bs});var Co=dn((Ty,js)=>{var xf=Rs(),Cf=Us(),Fs=zs(),Vs=Xs(),xo=class{constructor(e){e instanceof Map?(Vs(e),this.graph=e):e?this.graph=Fs(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(Vs(t),n=t):n=Fs(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=Cf(this.graph,e),this}path(e,t,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let i=new Set,o=new xf,a=new Map,s=[],l=0,u=[];if(n.avoid&&(u=[].concat(n.avoid)),u.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(u.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(o.set(e,0);!o.isEmpty();){let c=o.next();if(c.key===t){l=c.priority;let f=c.key;for(;a.has(f);)s.push(f),f=a.get(f);break}i.add(c.key),(this.graph.get(c.key)||new Map).forEach((f,d)=>{if(i.has(d)||u.includes(d))return null;if(!o.has(d))return a.set(d,c.key),o.set(d,c.priority+f);let m=o.get(d).priority,p=c.priority+f;return p<m?(a.set(d,c.key),o.set(d,p)):null})}return s.length?(n.trim?s.shift():s=s.concat([e]),n.reverse||(s=s.reverse()),n.cost?{path:s,cost:l}:s):n.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};js.exports=xo});var Do=dn((Lo,Uo)=>{(function(r,e){typeof Lo=="object"&&typeof Uo<"u"?Uo.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self,r["'typed'"]=e())})(Lo,function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";function i(){function a(v){return typeof v=="object"&&v!==null&&v.constructor===Object}let s=[{name:"number",test:function(v){return typeof v=="number"}},{name:"string",test:function(v){return typeof v=="string"}},{name:"boolean",test:function(v){return typeof v=="boolean"}},{name:"Function",test:function(v){return typeof v=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(v){return v instanceof Date}},{name:"RegExp",test:function(v){return v instanceof RegExp}},{name:"Object",test:a},{name:"null",test:function(v){return v===null}},{name:"undefined",test:function(v){return v===void 0}}],l={name:"any",test:r,isAny:!0},u,c,h=0,f={createCount:0};function d(v){let E=u.get(v);if(E)return E;let P='Unknown type "'+v+'"',L=v.toLowerCase(),k;for(k of c)if(k.toLowerCase()===L){P+='. Did you mean "'+k+'" ?';break}throw new TypeError(P)}function m(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",P=E?d(E).index:c.length,L=[];for(let O=0;O<v.length;++O){if(!v[O]||typeof v[O].name!="string"||typeof v[O].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let q=v[O].name;if(u.has(q))throw new TypeError('Duplicate type name "'+q+'"');L.push(q),u.set(q,{name:q,test:v[O].test,isAny:v[O].isAny,index:P+O,conversionsTo:[]})}let k=c.slice(P);c=c.slice(0,P).concat(L).concat(k);for(let O=P+L.length;O<c.length;++O)u.get(c[O]).index=O}function p(){u=new Map,c=[],h=0,m([l],!1)}p(),m(s);function g(){let v;for(v of c)u.get(v).conversionsTo=[];h=0}function _(v){let E=c.filter(P=>{let L=u.get(P);return!L.isAny&&L.test(v)});return E.length?E:["any"]}function A(v){return v&&typeof v=="function"&&"_typedFunctionData"in v}function y(v,E,P){if(!A(v))throw new TypeError(n);let L=P&&P.exact,k=Array.isArray(E)?E.join(","):E,O=I(k),q=x(O);if(!L||q in v.signatures){let lt=v._typedFunctionData.signatureMap.get(q);if(lt)return lt}let X=O.length,Y;if(L){Y=[];let lt;for(lt in v.signatures)Y.push(v._typedFunctionData.signatureMap.get(lt))}else Y=v._typedFunctionData.signatures;for(let lt=0;lt<X;++lt){let dt=O[lt],Pt=[],xe;for(xe of Y){let fe=V(xe.params,lt);if(!(!fe||dt.restParam&&!fe.restParam)){if(!fe.hasAny){let je=T(fe);if(dt.types.some(We=>!je.has(We.name)))continue}Pt.push(xe)}}if(Y=Pt,Y.length===0)break}let F;for(F of Y)if(F.params.length<=X)return F;throw new TypeError("Signature not found (signature: "+(v.name||"unnamed")+"("+x(O,", ")+"))")}function S(v,E,P){return y(v,E,P).implementation}function C(v,E){let P=d(E);if(P.test(v))return v;let L=P.conversionsTo;if(L.length===0)throw new Error("There are no conversions to "+E+" defined.");for(let k=0;k<L.length;k++)if(d(L[k].from).test(v))return L[k].convert(v);throw new Error("Cannot convert "+v+" to "+E)}function x(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return v.map(P=>P.name).join(E)}function b(v){let E=v.indexOf("...")===0,L=(E?v.length>3?v.slice(3):"any":v).split("|").map(X=>d(X.trim())),k=!1,O=E?"...":"";return{types:L.map(function(X){return k=X.isAny||k,O+=X.name+"|",{name:X.name,typeIndex:X.index,test:X.test,isAny:X.isAny,conversion:null,conversionIndex:-1}}),name:O.slice(0,-1),hasAny:k,hasConversion:!1,restParam:E}}function w(v){let E=v.types.map(q=>q.name),P=vt(E),L=v.hasAny,k=v.name,O=P.map(function(q){let X=d(q.from);return L=X.isAny||L,k+="|"+q.from,{name:q.from,typeIndex:X.index,test:X.test,isAny:X.isAny,conversion:q,conversionIndex:q.index}});return{types:v.types.concat(O),name:k,hasAny:L,hasConversion:O.length>0,restParam:v.restParam}}function T(v){return v.typeSet||(v.typeSet=new Set,v.types.forEach(E=>v.typeSet.add(E.name))),v.typeSet}function I(v){let E=[];if(typeof v!="string")throw new TypeError("Signatures must be strings");let P=v.trim();if(P==="")return E;let L=P.split(",");for(let k=0;k<L.length;++k){let O=b(L[k].trim());if(O.restParam&&k!==L.length-1)throw new SyntaxError('Unexpected rest parameter "'+L[k]+'": only allowed for the last parameter');if(O.types.length===0)return null;E.push(O)}return E}function R(v){let E=jt(v);return E?E.restParam:!1}function U(v){if(!v||v.types.length===0)return r;if(v.types.length===1)return d(v.types[0].name).test;if(v.types.length===2){let E=d(v.types[0].name).test,P=d(v.types[1].name).test;return function(k){return E(k)||P(k)}}else{let E=v.types.map(function(P){return d(P.name).test});return function(L){for(let k=0;k<E.length;k++)if(E[k](L))return!0;return!1}}}function Q(v){let E,P,L;if(R(v)){E=kt(v).map(U);let k=E.length,O=U(jt(v)),q=function(X){for(let Y=k;Y<X.length;Y++)if(!O(X[Y]))return!1;return!0};return function(Y){for(let F=0;F<E.length;F++)if(!E[F](Y[F]))return!1;return q(Y)&&Y.length>=k+1}}else return v.length===0?function(O){return O.length===0}:v.length===1?(P=U(v[0]),function(O){return P(O[0])&&O.length===1}):v.length===2?(P=U(v[0]),L=U(v[1]),function(O){return P(O[0])&&L(O[1])&&O.length===2}):(E=v.map(U),function(O){for(let q=0;q<E.length;q++)if(!E[q](O[q]))return!1;return O.length===E.length})}function V(v,E){return E<v.length?v[E]:R(v)?jt(v):null}function W(v,E){let P=V(v,E);return P?T(P):new Set}function D(v){return v.conversion===null||v.conversion===void 0}function G(v,E){let P=new Set;return v.forEach(L=>{let k=W(L.params,E),O;for(O of k)P.add(O)}),P.has("any")?["any"]:Array.from(P)}function $(v,E,P){let L,k,O=v||"unnamed",q=P,X;for(X=0;X<E.length;X++){let dt=[];if(q.forEach(Pt=>{let xe=V(Pt.params,X),fe=U(xe);(X<Pt.params.length||R(Pt.params))&&fe(E[X])&&dt.push(Pt)}),dt.length===0){if(k=G(q,X),k.length>0){let Pt=_(E[X]);return L=new TypeError("Unexpected type of argument in function "+O+" (expected: "+k.join(" or ")+", actual: "+Pt.join(" | ")+", index: "+X+")"),L.data={category:"wrongType",fn:O,index:X,actual:Pt,expected:k},L}}else q=dt}let Y=q.map(function(dt){return R(dt.params)?1/0:dt.params.length});if(E.length<Math.min.apply(null,Y))return k=G(q,X),L=new TypeError("Too few arguments in function "+O+" (expected: "+k.join(" or ")+", index: "+E.length+")"),L.data={category:"tooFewArgs",fn:O,index:E.length,expected:k},L;let F=Math.max.apply(null,Y);if(E.length>F)return L=new TypeError("Too many arguments in function "+O+" (expected: "+F+", actual: "+E.length+")"),L.data={category:"tooManyArgs",fn:O,index:E.length,expectedLength:F},L;let lt=[];for(let dt=0;dt<E.length;++dt)lt.push(_(E[dt]).join("|"));return L=new TypeError('Arguments of type "'+lt.join(", ")+'" do not match any of the defined signatures of function '+O+"."),L.data={category:"mismatch",actual:lt},L}function H(v){let E=c.length+1;for(let P=0;P<v.types.length;P++)D(v.types[P])&&(E=Math.min(E,v.types[P].typeIndex));return E}function rt(v){let E=h+1;for(let P=0;P<v.types.length;P++)D(v.types[P])||(E=Math.min(E,v.types[P].conversionIndex));return E}function _t(v,E){if(v.hasAny){if(!E.hasAny)return 1}else if(E.hasAny)return-1;if(v.restParam){if(!E.restParam)return 1}else if(E.restParam)return-1;if(v.hasConversion){if(!E.hasConversion)return 1}else if(E.hasConversion)return-1;let P=H(v)-H(E);if(P<0)return-1;if(P>0)return 1;let L=rt(v)-rt(E);return L<0?-1:L>0?1:0}function pt(v,E){let P=v.params,L=E.params,k=jt(P),O=jt(L),q=R(P),X=R(L);if(q&&k.hasAny){if(!X||!O.hasAny)return 1}else if(X&&O.hasAny)return-1;let Y=0,F=0,lt;for(lt of P)lt.hasAny&&++Y,lt.hasConversion&&++F;let dt=0,Pt=0;for(lt of L)lt.hasAny&&++dt,lt.hasConversion&&++Pt;if(Y!==dt)return Y-dt;if(q&&k.hasConversion){if(!X||!O.hasConversion)return 1}else if(X&&O.hasConversion)return-1;if(F!==Pt)return F-Pt;if(q){if(!X)return 1}else if(X)return-1;let xe=(P.length-L.length)*(q?-1:1);if(xe!==0)return xe;let fe=[],je=0;for(let qn=0;qn<P.length;++qn){let Qr=_t(P[qn],L[qn]);fe.push(Qr),je+=Qr}if(je!==0)return je;let We;for(We of fe)if(We!==0)return We;return 0}function vt(v){if(v.length===0)return[];let E=v.map(d);v.length>1&&E.sort((k,O)=>k.index-O.index);let P=E[0].conversionsTo;if(v.length===1)return P;P=P.concat([]);let L=new Set(v);for(let k=1;k<E.length;++k){let O;for(O of E[k].conversionsTo)L.has(O.from)||(P.push(O),L.add(O.from))}return P}function Bt(v,E){let P=E;if(v.some(k=>k.hasConversion)){let k=R(v),O=v.map(Ot);P=function(){let X=[],Y=k?arguments.length-1:arguments.length;for(let F=0;F<Y;F++)X[F]=O[F](arguments[F]);return k&&(X[Y]=arguments[Y].map(O[Y])),E.apply(this,X)}}let L=P;if(R(v)){let k=v.length-1;L=function(){return P.apply(this,Ie(arguments,0,k).concat([Ie(arguments,k)]))}}return L}function Ot(v){let E,P,L,k,O=[],q=[];switch(v.types.forEach(function(X){X.conversion&&(O.push(d(X.conversion.from).test),q.push(X.conversion.convert))}),q.length){case 0:return function(Y){return Y};case 1:return E=O[0],L=q[0],function(Y){return E(Y)?L(Y):Y};case 2:return E=O[0],P=O[1],L=q[0],k=q[1],function(Y){return E(Y)?L(Y):P(Y)?k(Y):Y};default:return function(Y){for(let F=0;F<q.length;F++)if(O[F](Y))return q[F](Y);return Y}}}function Lt(v){function E(P,L,k){if(L<P.length){let O=P[L],q=[];if(O.restParam){let X=O.types.filter(D);X.length<O.types.length&&q.push({types:X,name:"..."+X.map(Y=>Y.name).join("|"),hasAny:X.some(Y=>Y.isAny),hasConversion:!1,restParam:!0}),q.push(O)}else q=O.types.map(function(X){return{types:[X],name:X.name,hasAny:X.isAny,hasConversion:X.conversion,restParam:!1}});return Rn(q,function(X){return E(P,L+1,k.concat([X]))})}else return[k]}return E(v,0,[])}function Et(v,E){let P=Math.max(v.length,E.length);for(let X=0;X<P;X++){let Y=W(v,X),F=W(E,X),lt=!1,dt;for(dt of F)if(Y.has(dt)){lt=!0;break}if(!lt)return!1}let L=v.length,k=E.length,O=R(v),q=R(E);return O?q?L===k:k>=L:q?L>=k:L===k}function $t(v){return v.map(E=>Zr(E)?qr(E.referToSelf.callback):Yr(E)?Wn(E.referTo.references,E.referTo.callback):E)}function Mt(v,E,P){let L=[],k;for(k of v){let O=P[k];if(typeof O!="number")throw new TypeError('No definition for referenced signature "'+k+'"');if(O=E[O],typeof O!="function")return!1;L.push(O)}return L}function xt(v,E,P){let L=$t(v),k=new Array(L.length).fill(!1),O=!0;for(;O;){O=!1;let q=!0;for(let X=0;X<L.length;++X){if(k[X])continue;let Y=L[X];if(Zr(Y))L[X]=Y.referToSelf.callback(P),L[X].referToSelf=Y.referToSelf,k[X]=!0,q=!1;else if(Yr(Y)){let F=Mt(Y.referTo.references,L,E);F?(L[X]=Y.referTo.callback.apply(this,F),L[X].referTo=Y.referTo,k[X]=!0,q=!1):O=!0}}if(q&&O)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return L}function ve(v){let E=/\bthis(\(|\.signatures\b)/;Object.keys(v).forEach(P=>{let L=v[P];if(E.test(L.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Vt(v,E){if(f.createCount++,Object.keys(E).length===0)throw new SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&ve(E);let P=[],L=[],k={},O=[],q;for(q in E){if(!Object.prototype.hasOwnProperty.call(E,q))continue;let At=I(q);if(!At)continue;P.forEach(function(br){if(Et(br,At))throw new TypeError('Conflicting signatures "'+x(br)+'" and "'+x(At)+'".')}),P.push(At);let Ce=L.length;L.push(E[q]);let sf=At.map(w),Gr;for(Gr of Lt(sf)){let br=x(Gr);O.push({params:Gr,name:br,fn:Ce}),Gr.every(uf=>!uf.hasConversion)&&(k[br]=Ce)}}O.sort(pt);let X=xt(L,k,Ar),Y;for(Y in k)Object.prototype.hasOwnProperty.call(k,Y)&&(k[Y]=X[k[Y]]);let F=[],lt=new Map;for(Y of O)lt.has(Y.name)||(Y.fn=X[Y.fn],F.push(Y),lt.set(Y.name,Y));let dt=F[0]&&F[0].params.length<=2&&!R(F[0].params),Pt=F[1]&&F[1].params.length<=2&&!R(F[1].params),xe=F[2]&&F[2].params.length<=2&&!R(F[2].params),fe=F[3]&&F[3].params.length<=2&&!R(F[3].params),je=F[4]&&F[4].params.length<=2&&!R(F[4].params),We=F[5]&&F[5].params.length<=2&&!R(F[5].params),qn=dt&&Pt&&xe&&fe&&je&&We;for(let At=0;At<F.length;++At)F[At].test=Q(F[At].params);let Qr=dt?U(F[0].params[0]):e,Nh=Pt?U(F[1].params[0]):e,Lh=xe?U(F[2].params[0]):e,Uh=fe?U(F[3].params[0]):e,Dh=je?U(F[4].params[0]):e,Oh=We?U(F[5].params[0]):e,zh=dt?U(F[0].params[1]):e,Bh=Pt?U(F[1].params[1]):e,kh=xe?U(F[2].params[1]):e,Xh=fe?U(F[3].params[1]):e,Fh=je?U(F[4].params[1]):e,Vh=We?U(F[5].params[1]):e;for(let At=0;At<F.length;++At)F[At].implementation=Bt(F[At].params,F[At].fn);let jh=dt?F[0].implementation:t,Wh=Pt?F[1].implementation:t,qh=xe?F[2].implementation:t,Yh=fe?F[3].implementation:t,Zh=je?F[4].implementation:t,Qh=We?F[5].implementation:t,Gh=dt?F[0].params.length:-1,Hh=Pt?F[1].params.length:-1,Kh=xe?F[2].params.length:-1,$h=fe?F[3].params.length:-1,Jh=je?F[4].params.length:-1,tf=We?F[5].params.length:-1,ef=qn?6:0,nf=F.length,rf=F.map(At=>At.test),of=F.map(At=>At.implementation),af=function(){for(let Ce=ef;Ce<nf;Ce++)if(rf[Ce](arguments))return of[Ce].apply(this,arguments);return f.onMismatch(v,arguments,F)};function Ar(At,Ce){return arguments.length===Gh&&Qr(At)&&zh(Ce)?jh.apply(this,arguments):arguments.length===Hh&&Nh(At)&&Bh(Ce)?Wh.apply(this,arguments):arguments.length===Kh&&Lh(At)&&kh(Ce)?qh.apply(this,arguments):arguments.length===$h&&Uh(At)&&Xh(Ce)?Yh.apply(this,arguments):arguments.length===Jh&&Dh(At)&&Fh(Ce)?Zh.apply(this,arguments):arguments.length===tf&&Oh(At)&&Vh(Ce)?Qh.apply(this,arguments):af.apply(this,arguments)}try{Object.defineProperty(Ar,"name",{value:v})}catch{}return Ar.signatures=k,Ar._typedFunctionData={signatures:F,signatureMap:lt},Ar}function gt(v,E,P){throw $(v,E,P)}function kt(v){return Ie(v,0,v.length-1)}function jt(v){return v[v.length-1]}function Ie(v,E,P){return Array.prototype.slice.call(v,E,P)}function Je(v,E){for(let P=0;P<v.length;P++)if(E(v[P]))return v[P]}function Rn(v,E){return Array.prototype.concat.apply([],v.map(E))}function pn(){let v=kt(arguments).map(P=>x(I(P))),E=jt(arguments);if(typeof E!="function")throw new TypeError("Callback function expected as last argument");return Wn(v,E)}function Wn(v,E){return{referTo:{references:v,callback:E}}}function qr(v){if(typeof v!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:v}}}function Yr(v){return v&&typeof v.referTo=="object"&&Array.isArray(v.referTo.references)&&typeof v.referTo.callback=="function"}function Zr(v){return v&&typeof v.referToSelf=="object"&&typeof v.referToSelf.callback=="function"}function xr(v,E){if(!v)return E;if(E&&E!==v){let P=new Error("Function names do not match (expected: "+v+", actual: "+E+")");throw P.data={actual:E,expected:v},P}return v}function Cr(v){let E;for(let P in v)Object.prototype.hasOwnProperty.call(v,P)&&(A(v[P])||typeof v[P].signature=="string")&&(E=xr(E,v[P].name));return E}function M(v,E){let P;for(P in E)if(Object.prototype.hasOwnProperty.call(E,P)){if(P in v&&E[P]!==v[P]){let L=new Error('Signature "'+P+'" is defined twice');throw L.data={signature:P,sourceFunction:E[P],destFunction:v[P]},L}v[P]=E[P]}}let Z=f;f=function(v){let E=typeof v=="string",P=E?1:0,L=E?v:"",k={};for(let O=P;O<arguments.length;++O){let q=arguments[O],X={},Y;if(typeof q=="function"?(Y=q.name,typeof q.signature=="string"?X[q.signature]=q:A(q)&&(X=q.signatures)):a(q)&&(X=q,E||(Y=Cr(q))),Object.keys(X).length===0){let F=new TypeError("Argument to 'typed' at index "+O+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw F.data={index:O,argument:q},F}E||(L=xr(L,Y)),M(k,X)}return Vt(L||"",k)},f.create=i,f.createCount=Z.createCount,f.onMismatch=gt,f.throwMismatchError=gt,f.createError=$,f.clear=p,f.clearConversions=g,f.addTypes=m,f._findType=d,f.referTo=pn,f.referToSelf=qr,f.convert=C,f.findSignature=y,f.find=S,f.isTypedFunction=A,f.warnAgainstDeprecatedThis=!0,f.addType=function(v,E){let P="any";E!==!1&&u.has("Object")&&(P="Object"),f.addTypes([v],P)};function Ct(v){if(!v||typeof v.from!="string"||typeof v.to!="string"||typeof v.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(v.to===v.from)throw new SyntaxError('Illegal to define conversion from "'+v.from+'" to itself.')}return f.addConversion=function(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};Ct(v);let P=d(v.to),L=P.conversionsTo.find(k=>k.from===v.from);if(L)if(E&&E.override)f.removeConversion({from:L.from,to:v.to,convert:L.convert});else throw new Error('There is already a conversion from "'+v.from+'" to "'+P.name+'"');P.conversionsTo.push({from:v.from,convert:v.convert,index:h++})},f.addConversions=function(v,E){v.forEach(P=>f.addConversion(P,E))},f.removeConversion=function(v){Ct(v);let E=d(v.to),P=Je(E.conversionsTo,k=>k.from===v.from);if(!P)throw new Error("Attempt to remove nonexistent conversion from "+v.from+" to "+v.to);if(P.convert!==v.convert)throw new Error("Conversion to remove does not match existing conversion");let L=E.conversionsTo.indexOf(P);E.conversionsTo.splice(L,1)},f.resolve=function(v,E){if(!A(v))throw new TypeError(n);let P=v._typedFunctionData.signatures;for(let L=0;L<P.length;++L)if(P[L].test(E))return P[L];return null},f}var o=i();return o})});var Ni=j("three");var oe=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(e){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),e()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(e){this.tasks.requestAnimation.delete(e),window.cancelAnimationFrame(e)}setTimeout(e,t){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),e()},t);return this.tasks.timeout.add(n),n}clearTimeout(e){this.tasks.timeout.delete(e),window.clearTimeout(e)}setInterval(e,t){let n=window.setInterval(()=>{this.tasks.interval.delete(n),e()},t);return this.tasks.interval.add(n),n}clearInterval(e){this.tasks.interval.delete(e),window.clearInterval(e)}dispose(){this.tasks.requestAnimation.forEach(e=>{window.cancelAnimationFrame(e)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(e=>{window.clearTimeout(e)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(e=>{window.clearInterval(e)}),this.tasks.interval.clear()}};var Te=j("three");function cs(){let r=new Te.Group,e=new Te.AmbientLight(16777215,2.6);return r.add(e),r}function tn(r,e=[]){let t=new Te.Shape(r.map(n=>new Te.Vector2(...n)));return e.length&&e.forEach(n=>{var i=new Te.Path(n.map(o=>new Te.Vector2(...o)));t.holes.push(i)}),t}function hs(r=16777215,e=1){let t=new Te.DirectionalLight(r,e);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function ae(r,e){if(e&&r.children&&r.children.length&&r.children.forEach(t=>{ae(t,e)}),r.isMesh){let t=r;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n.dispose()}):t.material.dispose())}r.isLight&&r.dispose?.()}function fs(r){return/[\u4E00-\u9FA5]+/g.test(r)}var Xt=j("three"),Yn=j("@turf/turf");function it(r,e,t,n){let i=r.clone().project(e),o=t/2,a=n/2,s=Math.round(i.x*o+o),l=Math.round(-i.y*a+a);return{x:s,y:l}}function $g(r,e,t,n,i){if(!i)return null;t=Math.min(1,t),n=Math.min(1,n);let o=r/t*2-1,a=1-e/n*2;return new Xt.Vector3(o,a,0).unproject(i)}function Hr(r){let e=(0,Yn.featureCollection)(r.map(n=>(0,Yn.point)(n)));return(0,Yn.center)(e).geometry.coordinates}function mn(r,e,t){return r.x>=e.x&&r.x<=t.x&&r.y>=e.y&&r.y<=t.y}function Jg(r){let e=0,t=new Xt.Vector3;for(let n=1;n<r.length;n++){let i=new Xt.Vector3(r[n-1][0],r[n-1][1],0),o=new Xt.Vector3(r[n][0],r[n][1],0),a=o.distanceTo(i);a>e&&(e=a,t=o.clone().sub(i).normalize())}return t}function Jt(r,e){return Math.sqrt((e[0]-r[0])**2+(e[1]-r[1])**2)}function qe(r){let e=0;for(let t=0;t<r.length-1;t++)e+=Jt(r[t],r[t+1]);return e}function ps(r,e,t){let n=new Xt.Vector2(e[0]-r[0],e[1]-r[1]),i=new Xt.Vector2(e[0]-t[0],e[1]-t[1]),a=n.angleTo(i)*180/Math.PI,s=new Xt.Vector2(e[0]-r[0],e[1]-r[1]);return new Xt.Vector2(t[0]-r[0],t[1]-r[1]).cross(s)>0?a:-a}function ds(r,e){let t=Math.min(Jt(r[0][0],r[0][1]),Jt(r[0][2],r[0][1]))-1;e||(e=Hr(r[0]));let n=mf(e,t),i=new Xt.Vector2(r[0][0][0],r[0][0][1]),o=new Xt.Vector2(r[0][1][0],r[0][1][1]),a=new Xt.Vector2(r[0][2][0],r[0][2][1]),l=(i.distanceTo(o)>o.distanceTo(a)?o.clone().sub(i):a.clone().sub(o)).angleTo(new Xt.Vector2(0,1)),u=new Xt.Matrix3;return u.multiply(new Xt.Matrix3().translate(e[0],e[1])).multiply(new Xt.Matrix3().rotate(l)).multiply(new Xt.Matrix3().translate(-e[0],-e[1])),[n.map(c=>{let h=new Xt.Vector2(c[0],c[1]).applyMatrix3(u);return[h.x,h.y]})]}function mf(r,e){let t=e/2;return[[r[0]-t,r[1]+t],[r[0]+t,r[1]+t],[r[0]+t,r[1]-t],[r[0]-t,r[1]-t],[r[0]-t,r[1]+t]]}function gn(r,e){let t=0,n=1/0,[i,o]=e;for(let a=0;a<r.length-1;a++){let[s,l]=r[a],[u,c]=r[a+1],h=Math.min(s,u)<=i&&i<=Math.max(s,u),f=Math.min(l,c)<=o&&o<=Math.max(l,c);if(h&&f){let d=Math.abs((u-s)*(o-l)-(c-l)*(i-s));d<n&&(n=d,t=a)}}return t}function ms(r,e){let t=r[0],n=r[1],i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let s=e[o][0],l=e[o][1],u=e[a][0],c=e[a][1];l>n!=c>n&&t<(u-s)*(n-l)/(c-l)+s&&(i=!i)}return i}function Zn(r,e){return new Proxy(r,{get:(t,n,i)=>Reflect.get(t,n,i),set:(t,n,i,o)=>{let a=Reflect.get(t,n,o),s=Reflect.set(t,n,i,o);return a!==i&&e.dispatchEvent({type:`change-${n}`,value:i}),s}})}function Re(r,e){return Promise.race([r,new Promise((t,n)=>{setTimeout(()=>n(new Error("Promise timeout")),e)})])}function Kr(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function gs(r,e){let t=Kr("svg");return t.setAttribute("width",r),t.setAttribute("height",e),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function wr(r="2",e){let t=Kr("circle");return t.setAttribute("r",r),t.setAttribute("fill",e),t}function $r(r){let e=Kr("line");return e.setAttribute("stroke",r),e}function yn(r,e){let t=Kr("rect");return t.setAttribute("stroke",r),t.setAttribute("fill",e),t}function Nn(r,e,t){r.setAttribute("cx",`${e}`),r.setAttribute("cy",`${t}`)}function Ye(r,e,t){e&&(r.setAttribute("x1",`${e.x}`),r.setAttribute("y1",`${e.y}`)),t&&(r.setAttribute("x2",`${t.x}`),r.setAttribute("y2",`${t.y}`))}function pe(r,e,t,n,i){r.setAttribute("x",`${e}`),r.setAttribute("y",`${t}`),r.setAttribute("width",`${n}`),r.setAttribute("height",`${i}`)}function ys(){return Promise.resolve()}function mo(){return new Promise(r=>{requestAnimationFrame(r)})}function oy(r){return parseInt(r.replace("#","0x"),16)}function ay(r,e){let t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(t*e),a=Math.round(n*e),s=Math.round(i*e);return`#${(1<<24|o<<16|a<<8|s).toString(16).slice(1)}`}function un(r,e=.85){let t,n,i;if(r.startsWith("#"))t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let a=r.slice(4,-1).split(",");t=parseInt(a[0].trim()),n=parseInt(a[1].trim()),i=parseInt(a[2].trim())}return t=Math.min(Math.floor(t*e),255),n=Math.min(Math.floor(n*e),255),i=Math.min(Math.floor(i*e),255),"#"+((1<<24)+(t<<16)+(n<<8)+i).toString(16).slice(1)}function go(r,e){r=r.replace(/^#/,"");let t=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return e!==void 0?`rgba(${t}, ${n}, ${i}, ${e})`:`rgb(${t}, ${n}, ${i})`}var Qn=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,_s=(navigator.userAgent||"").toLocaleLowerCase(),Er=/ios|iphone/i.test(_s),uy=/android|adr|linux/gi.test(_s);function Gn(r){return Qn?r==="Meta":r==="Control"}var yo="__once__",vs=class{events=new Map;on(e,t){if(typeof t!="function")return;let n=this.events.get(e);return n?n.add(t):this.events.set(e,new Set([t]))}once(e,t){if(typeof t!="function")return;let n=`${yo}${e}`,i=this.events.get(n);return i?i.add(t):this.events.set(n,new Set([t]))}off(e,t){let n=this.events.get(e),i=this.events.get(`${yo}${e}`);!n&&!i||(t===void 0&&(n?.clear(),i?.clear()),n?.has(t)&&n.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(e,...t){let n=this.events.get(e),i=this.events.get(`${yo}${e}`);!n&&!i||(n?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.clear())}};var Tr=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(Tr||{});function Hn(r){return Object.keys(r).sort().map(e=>`${e}=${r[e]}`).join("&")}function my(r,e){return new Promise((t,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(e.headers||{}).forEach(o=>{i.setRequestHeader(o,e.headers[o])}),e.responseType&&(i.responseType=e.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(e.responseType==="arraybuffer")t(i.response);else try{let o=JSON.parse(i.responseText);t(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var Kn=j("three"),ws=Sr(Ss(),1);function gf(r,e){let t=r.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function yf(r){let e=0;return r.reduce(([t,n],[i,o])=>(e+=Math.sqrt((i-t)**2+(o-n)**2),[i,o])),e/r.length}function Es(r,e=.25){if(yf(r)<e)return r;let t=(0,ws.default)(r);return Es(t,e)}function Jr(r,e=!1,t=!0,n=5,i=150,o=3){let a=[],s=!e;if(a.push(r[0]),r.length<2)return a;for(let u=0;u<r.length-2;u+=1){let c=r[u],h=r[u+1],f=r[u+2],d=new Kn.Vector2(c[0]-h[0],c[1]-h[1]),m=new Kn.Vector2(f[0]-h[0],f[1]-h[1]),p=gf(d,m)/Math.PI*180,g=d.length()+m.length();(!s||p<i&&g>.01||g>n)&&(a.push(r[u+1]),s=!0)}if(a.push(r[r.length-1]),!t)return a;let l=[];l.push(a[0]);for(let u=0;u<a.length-2;u+=1){let c=new Kn.Vector2(a[u][0],a[u][1]),h=new Kn.Vector2(a[u+1][0],a[u+1][1]),f=new Kn.Vector2(a[u+2][0],a[u+2][1]),d=c.distanceTo(h)/2,m=f.distanceTo(h)/2,p=h.clone(),g=h.clone();p.add(c.clone().sub(h).normalize().multiplyScalar(d>o?o/2:d)),g.add(f.clone().sub(h).normalize().multiplyScalar(m>o?o/2:m));let _=[[p.x,p.y],[h.x,h.y],[g.x,g.y]];l.push(...Es(_,o/25))}return l.push(a[a.length-1]),_f(l)}function _f(r){if(r.length<=1)return r;let e=[],t;return r.forEach(([n,i])=>{t?n===t[0]&&i===t[1]||(t=[n,i],e.push([n,i])):(t=[n,i],e.push([n,i]))}),e}function Ts(r,e,t){let n=Math.sqrt((t[0]-e[0])**2+(t[1]-e[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2),closestPoint:e.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-e[0])*(t[0]-e[0])+(r[1]-e[1])*(t[1]-e[1]))/n**2)),o=[e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function xy(r,e,t){let[n,i]=r,[o,a]=e,s=Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2));if(s===0||s<t)return[...e];let l=t/s,u=n+(o-n)*l,c=i+(a-i)*l;return[u,c]}var Ms=(u=>(u.START="start",u.END="end",u.FRONT="front",u.RIGHT="right",u.LEFT="left",u.RIGHT_FRONT="right_front",u.LEFT_FRONT="left_front",u.RIGHT_BACK="right_back",u.LEFT_BACK="left_back",u))(Ms||{});function _o(r,e,t){let n=ps(r,e,t);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function Cy(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let e=[{direction:"start",distance:Jt(r[0],r[1]),points:[r[0],r[1]]}];for(let t=2;t<r.length;t++){let n=_o(r[t-2],r[t-1],r[t]);if(n==="front"){let i=e[e.length-1],o=Jt(r[t-1],r[t]);i.distance+=o,t!==2&&i.points.push(r[t-1])}else e.push({direction:n,distance:Jt(r[t-1],r[t]),points:[r[t-1],r[t]]})}return e.push({direction:"end",distance:0,points:[r[r.length-1]]}),e}function Ps(r,e){if(r.length<2)return-1;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=[e[0]-i[0],e[1]-i[1]],s=[o[0]-i[0],o[1]-i[1]],l=Math.min(o[0],i[0])<=e[0]&&e[0]<=Math.max(o[0],i[0]),u=Math.min(o[1],i[1])<=e[1]&&e[1]<=Math.max(o[1],i[1]);if(l&&u){let c=a[0]*s[1]-a[1]*s[0];if(Math.abs(c)<1e-6){let h=Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2);return t+h}}t+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function $n(r,e){if(r.length<2)return r[0]??null;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2);if(t+=a,t>=e){let s=(e-(t-a))/a,l=i[0]+(o[0]-i[0])*s,u=i[1]+(o[1]-i[1])*s;return[l,u]}}return null}var en=Sr(Co(),1);var Ne="___",Ws=class{constructor(e=3){this.lift_priority=e}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new en.default;escalatorRoute=new en.default;straightLadderRoute=new en.default;initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(t=>{t.points.forEach(n=>{let i=`${t.floor}${Ne}${n.id}`;if(this.pointMap.set(i,n),this.nodeMap.set(`${n.floor}${Ne}${n.nodeId}`,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push({...n}),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push({...n}),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push({...n}),this.facilityMap.set(n.targetId,o)}}),t.lines.filter(n=>n.direction!=="no").forEach(n=>{let i=`${t.floor}${Ne}${n.from}`,o=`${t.floor}${Ne}${n.to}`,a=this.pointMap.get(i)?.cds,s=this.pointMap.get(o)?.cds;if(a?.length&&s?.length){let l=Jt(a,s);this.addLineItem(i,o,l),n.direction==="double"&&this.addLineItem(o,i,l)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let l=`${a[s].floor}${Ne}${a[s].id}`;for(let u=0;u<a.length;u++)if(s!==u){let c=`${a[u].floor}${Ne}${a[u].id}`,h=this.pointMap.get(l)?.cds,f=this.pointMap.get(c)?.cds;if(h?.length&&f?.length)if(a[s].type==="straightLadder"){let d=t;this.addLineItem(l,c,d,i)}else{let d=n;this.addLineItem(l,c,d,i)}}}}),this.escalatorMap.forEach((o,a)=>{if(o.start&&o.end){let s=`${o.start.floor}${Ne}${o.start.id}`,l=`${o.end.floor}${Ne}${o.end.id}`,u=this.pointMap.get(s)?.cds,c=this.pointMap.get(l)?.cds;if(u?.length&&c?.length){let h=e;this.addLineItem(s,l,h,i)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new en.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new en.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new en.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${Ne}${e.nodeId}`);if(t){let[n,i]=t.split(Ne);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{let a=Jt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:n.point.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let s=this.facilityMap.get(o.facility).filter(u=>o.floor?u.floor===o.floor:!0);if(!s.length)return null;let l=s.map(u=>a(i,{floor:u.floor,id:u.id})).filter(u=>!!u);return l.reduce((u,c)=>{let h=c.reduce((f,d)=>f+qe(d.points),0);return h<u.distance&&(u.distance=h,u.path=c),u},{distance:1/0,path:l[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${Ne}${e.id}`,o=`${t.floor}${Ne}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[];return a.map(l=>{let u=this.pointMap.get(l);if(u){let{floor:c}=u;if(s[s.length-1]?.floor===c){let h=s[s.length-1];h.points.push(u.cds),h.endType=u.type,h.destId=u.nodeId,h.distance=qe(h.points)}else s.push({floor:c,points:[u.cds],endType:u.type,destId:u.nodeId,distance:0})}}),s}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new en.default,this.escalatorRoute=new en.default,this.straightLadderRoute=new en.default}};var se=Sr(Co(),1);var _n=j("lodash"),It="___",qs=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new se.default;escalatorRoute=new se.default;straightLadderRoute=new se.default;forwardLineMap=new Map;forwardRoute=new se.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(t=>{let n=[];try{n=JSON.parse(t.entry_end_floor)}catch{n=[]}let i=[];try{i=JSON.parse(t.entry_start_floor)}catch{i=[]}return{...t,entry_start_floor:i,entry_end_floor:n}})}initRoute(e,t){this.clear(),this.roadInfo=e,this.initFacilities(t);let n=new Date,i=n.getHours()*60+n.getMinutes();e.length&&(e.forEach(o=>{(o.points||[]).filter(a=>a.openStatus!==!1).filter(a=>{if(!a.startTime||!a.endTime)return!0;let[s,l]=a.startTime.split(":").map(d=>+d),[u,c]=a.endTime.split(":").map(d=>+d),h=s*60+l,f=u*60+c;return i>=h&&i<=f}).forEach(a=>{a.floor=o.floor;let s=`${o.floor}${It}${a.id}`;if(this.nodeMap.set(`${o.floor}${It}${a.nodeId}`,`${o.floor}${It}${a.relatedId||a.id}`),this.pointMap.set(s,a),this.isFacilityByType(a.type)){let l=this.facilities.find(u=>u.id===+a.targetId);if(l){switch(l.entry_infra_type){case"straightLadder":if(l.entry_end_floor.find(f=>f.floor===o.floor)&&l.entry_start_floor.find(f=>f.floor===o.floor)){let f=this.straightLadderMap.get(a.targetId)||[];f.push({...a}),this.straightLadderMap.set(a.targetId,f)}break;case"staircase":if(l.entry_end_floor.find(f=>f.floor===o.floor)&&l.entry_start_floor.find(f=>f.floor===o.floor)){let f=this.staircaseMap.get(a.targetId)||[];f.push({...a}),this.staircaseMap.set(a.targetId,f)}break;case"escalator":let c=this.escalatorMap.get(a.targetId)||[];if(l.entry_start_floor.find(f=>f.floor===o.floor)){let f=c.find(d=>d.end?.floor!==o.floor&&!d.start);f?f.start=a:c.push({start:a})}if(l.entry_end_floor.find(f=>f.floor===o.floor)){let f=c.find(d=>d.start?.floor!==o.floor&&!d.end);f?f.end=a:c.push({end:a})}this.escalatorMap.set(a.targetId,c);break;case"ramp":let h=this.rampMap.get(a.targetId)||[];if(l.entry_start_floor.find(f=>f.floor===o.floor)){let f=h.find(d=>d.end?.floor!==o.floor&&!d.start);f?f.start=a:h.push({start:a})}if(l.entry_end_floor.find(f=>f.floor===o.floor)){let f=h.find(d=>d.start?.floor!==o.floor&&!d.end);f?f.end=a:h.push({end:a})}this.rampMap.set(a.targetId,h);break}let u=this.facilityMap.get(a.targetId)||[];u.push({...a}),this.facilityMap.set(a.targetId,u)}}a.type==="parkingSpace"&&this.parkingMap.set(`${o.floor}${It}${a.name}`,a)}),(o.lines||[]).filter(a=>a.direction!=="no").forEach(a=>{let s=`${o.floor}${It}${a.from}`,l=`${o.floor}${It}${a.to}`,u=this.pointMap.get(s),c=this.pointMap.get(l);if(!u||!c)return;let h=u.cds,f=c.cds,d=Jt(h,f);if(!u.permission&&!c.permission)switch(this.addLineItem(s,l,d),this.addLineItem(l,s,d),a.direction){case"double":this.addLineItem(s,l,d,this.forwardLineMap),this.addLineItem(l,s,d,this.forwardLineMap);break;case"single":this.addLineItem(s,l,d,this.forwardLineMap);break;case"back":this.addLineItem(l,s,d,this.forwardLineMap);break}else u.permission&&(this.setPermissionLine(s,l,u.permission,d,""),this.setPermissionLine(l,s,u.permission,d,"")),c.permission&&c.permission!==u.permission&&(this.setPermissionLine(s,l,c.permission,d,""),this.setPermissionLine(l,s,c.permission,d,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[`permission_${e}`]||(this[`permission_${e}`]=new Set),this[`permission_${e}`]}setPermissionLine(e,t,n,i,o){this.getPermissionMap(n).add({fromKey:e,toKey:t,distance:i,type:o})}addPermissionFacility(){this.straightLadderMap.forEach((e,t)=>{if(e.length<2){this.straightLadderMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${It}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${It}${e[a].id}`,l=this.pointMap.get(s);if(!l)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"straightLadder"),l.permission&&l.permission!==o.permission&&this.setPermissionLine(i,s,l.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,t)=>{if(e.length<2){this.staircaseMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${It}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${It}${e[a].id}`,l=this.pointMap.get(s);if(!l)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"staircase"),l.permission&&l.permission!==o.permission&&this.setPermissionLine(i,s,l.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${It}${n.start.id}`,o=`${n.end.floor}${It}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,1,"escalator"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,1,"escalator"))}})}),this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${It}${n.start.id}`,o=`${n.end.floor}${It}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,10,"ramp"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,10,"ramp"))}})})}addPermissionLineToMap(e,t,n,i){let o=this.getPermissionMap(e);console.log(o),o.forEach(a=>{t.includes(a.type)&&(a.type===""?this.addLineItem(a.fromKey,a.toKey,a.distance,n):this.addLineItem(a.fromKey,a.toKey,i.get(a.type),n))})}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let l=`${a[s].floor}${It}${a[s].id}`,u=this.pointMap.get(l);if(!(!u||u.permission)){for(let c=0;c<a.length;c++)if(s!==c){let h=`${a[c].floor}${It}${a[c].id}`,f=this.pointMap.get(h);if(!f||f.permission)continue;if(a[s].type==="straightLadder"){let d=t;this.addLineItem(l,h,d,i)}else{let d=n;this.addLineItem(l,h,d,i)}}}}}),this.escalatorMap.forEach((o,a)=>{o.forEach(s=>{if(s.start&&s.end){let l=`${s.start.floor}${It}${s.start.id}`,u=`${s.end.floor}${It}${s.end.id}`,c=this.pointMap.get(l),h=this.pointMap.get(u);if(c&&h&&!c.permission&&!h.permission){let f=e;this.addLineItem(l,u,f,i)}}})})}initBaseRoute(){let e=new Map((0,_n.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new se.default(e)}initEscalatorRoute(){let e=new Map((0,_n.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new se.default(e)}initStraightLadderRoute(){let e=new Map((0,_n.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new se.default(e)}initForwardRoute(){this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${It}${n.start.id}`,o=`${n.end.floor}${It}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&!a.permission&&!s.permission&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.forwardRoute=new se.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${It}${e.nodeId}`);if(t){let[n,i]=t.split(It);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{if(o.relatedId)return i;let a=Jt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:t.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let n=this.parkingMap.get(`${e.floor}${It}${e.parkingSpace}`);if(n)return{floor:e.floor,id:n.id}}let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilities.filter(i=>+i.type_id==+e.facility).map(i=>i.id).map(i=>this.facilityMap.get(`${i}`)).flat(2)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n="",i){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let o=this.transformStart(e);if(!o)return"no-start";let a=this.transformEnd(t);if(!a)return"no-end";let s=this.getBasePath.bind(this);switch(n){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;case"forward":s=this.getForwardPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(a.id)return s(o,a,i);if(a.facility){let u=this.facilities.filter(h=>+h.type_id==+t.facility).map(h=>h.id).map(h=>this.facilityMap.get(`${h}`)).flat(2).filter(h=>h).filter(h=>a.floor?h.floor===a.floor:!0);if(!u.length)return null;let c=u.map(h=>s(o,{floor:h.floor,id:h.id},i)).filter(h=>!!h);return c.reduce((h,f)=>{let d=f[0].consume;return d<h.distance&&(h.distance=d,h.path=f),h},{distance:1/0,path:c[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${It}${e.id}`,o=`${t.floor}${It}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[],l=a.reduce((u,c,h,f)=>{if(h===0)return 0;let d=f[h-1],m=n.graph.get(d).get(c);return u+m},0);return a.map(u=>{let c=this.pointMap.get(u);if(c){let{floor:h}=c,f=c.type;if(this.isFacilityByType(c.type)){let d=this.facilities.find(m=>m.id===+c.targetId);d&&(f=d.entry_infra_type)}if(s[s.length-1]?.floor===h){let d=s[s.length-1];d.points.push(c.cds),d.endType=f,d.destId=c.nodeId,d.distance=qe(d.points)}else s.push({floor:h,points:[c.cds],endType:f,destId:c.nodeId,distance:0,consume:l})}}),s}getBasePath(e,t,n){if(!n)return this.getRoutePath(e,t,this.baseRoute);let i=(0,_n.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let o=new se.default(i);return this.getRoutePath(e,t,o)}getEscalatorPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.escalatorRoute);let i=(0,_n.cloneDeep)(this.escalatorRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",1*o],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]));let a=new se.default(i);return this.getRoutePath(e,t,a)}getStraightLadderPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.straightLadderRoute);let i=(0,_n.cloneDeep)(this.straightLadderRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",3*o],["straightLadder",1*o],["staircase",3e4*o]]));let a=new se.default(i);return this.getRoutePath(e,t,a)}getForwardPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.forwardRoute);let i=(0,_n.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],i,new Map([["ramp",10]]));let o=new se.default(i);return this.getRoutePath(e,t,o)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new se.default,this.escalatorRoute=new se.default,this.straightLadderRoute=new se.default}};var Ln=class{static keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let e=this.createKey();for(;this.keySet.has(e);)e=this.createKey();return e}static removeKey(e){this.keySet.delete(e)}static dispose(){this.keySet.clear()}};function Ys(r){return r.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function nn(r,e,t){return new Promise((n,i)=>{let o=Ln.genUniqueKey(),a=({data:s})=>{s.type===`${e}_result`&&s.key===o&&(Ln.removeKey(o),self.removeEventListener("message",a),s.error?i(s.error):n(s.data))};r.addEventListener("message",a),r.postMessage({type:e,key:o,data:t})})}function Oy(r){let e={};for(let n in r)n.startsWith("on")&&(e[Ys(n.slice(2))]=r[n]);let t=async({data:n})=>{if(e[n.type])try{let i=await e[n.type](n.data);self.postMessage({type:`${n.type}_result`,key:n.key,data:i})}catch(i){self.postMessage({type:`${n.type}_result`,key:n.key,error:i})}else self.postMessage({type:`${n.type}_result`,key:n.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var Ze=j("three");function ky(r,e=16711680){let t=new Ze.LineBasicMaterial({color:e}),n=new Ze.BufferGeometry().setFromPoints(r);return new Ze.Line(n,t)}function Xy(r,e=16711680){let t=new Ze.LineBasicMaterial({color:e}),n=new Ze.BoxGeometry(1,1,1),i=new Ze.Mesh(n,t);return i.position.copy(r),i}function Ae(r,e,t=0){r.forEach(n=>{n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"?(n.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=e[0],o[1]-=e[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(i=>i.map(o=>Qe(o,e)))),n.doors?.length&&n.doors.map(i=>{i.coord=Qe(i.coordinate,e)}),n.center&&(n.center=Qe(n.center,e))):n.geometry.coords=Qe(n.geometry.cds,e)});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(t+n+1)}}function Qe(r,e){return[r[0]-e[0],r[1]-e[1]]}var Zs=j("@tweenjs/tween.js"),vn=class{pauseTween=!1;tweenStore=new Set;group=new Zs.Group;constructor(){}update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(e=>{this.tweenStore.add(e),e.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(e=>{e.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(e){this.group.remove(e)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(e=>e.stop()),this.group.removeAll()}dispose(){this.clear()}};var Qs=j("three"),ti=class extends Qs.EventDispatcher{constructor(t){super();this.ctn=t;this.registryEvent()}point;registryEvent(){this.ctn.addEventListener("pointerdown",this._pointerDown),this.ctn.addEventListener("pointerup",this._pointerUp)}unRegistryEvent(){this.ctn.removeEventListener("pointerdown",this._pointerDown),this.ctn.removeEventListener("pointerup",this._pointerUp)}_pointerDown=t=>{this.point={x:t.offsetX,y:t.offsetY}};_pointerUp=t=>{if(!this.point)return;let{offsetX:n,offsetY:i}=t,{x:o,y:a}=this.point;Math.hypot(o-n+(a-i))>3||this.dispatchEvent({type:"click",e:t})};dispose(){this.unRegistryEvent()}};var Gs=j("lodash"),Hs=j("three"),Un=class extends Hs.EventDispatcher{_task=[];started=!1;activeTask=null;_id=0;constructor(e=!0){super(),e&&this.start()}_isEffectiveTask(e){return e&&typeof e.run=="function"}_getIndexByTid(e){return this._task.findIndex(t=>t.tid===e)}_createTask(e){return this._isEffectiveTask(e)?{...e,tid:++this._id,meta:e.meta||{}}:!1}get task(){return[...this._task]}getTasks(){return[...this._task]}add(e){if(this._isEffectiveTask(e)){let t=this._createTask(e);return this._task.push(t),this.started&&!this.activeTask&&this.start(),t.tid}return!1}replace(e,t){if(!this._isEffectiveTask(t))return console.warn("[TaskQueue] replace\u65B9\u6CD5\u4F20\u5165\u7684task\u53C2\u6570\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;let n=this._getIndexByTid(e);if(n===-1)return console.warn(`[TaskQueue] \u6CA1\u6709\u627E\u5230id=${e}\u7684\u4EFB\u52A1`),!1;let i=this._createTask(t);return this._task.splice(n,1,i),i.tid}replaceByMetaType(e){let t=e.meta?.type;if((0,Gs.isNil)(t))return this.add(e);{let n=this._task.find(i=>i.meta.type===t);if(n)return this.replace(n.tid,e)}}remove(e){let t=this._getIndexByTid(e);return t===-1?(console.warn(`[TaskQueue] remove\u65B9\u6CD5\u4F20\u5165\u7684id\uFF1A${e}\u627E\u4E0D\u5230\u5BF9\u5E94\u7684task`),!1):(this._task.splice(t,1),!0)}clear(){this._task.length=0}start(){this.started=!0,!this.activeTask&&this._task.length&&this.exec()}stop(){this.started=!1}async exec(){if(!this.started||!this._task.length)return!1;let e=this._task.shift();this.activeTask=e,this.dispatchEvent({type:"active-task-start",task:e});let t;try{t=await e.run()}catch(n){console.warn("[task run err]",n,e)}return this.activeTask=null,this.dispatchEvent({type:"active-task-end",task:e,res:t}),this.exec()}};var bt=j("three");var du=j("three");var st=j("three");var $s=j("three/examples/jsm/lines/LineMaterial"),de=j("three");function Ks(r){return`${r.x}-${r.y}-${r.z}`}var Zt=class{static lineMaterialMap=new Map;static meshStandardMaterialMap=new Map;static meshBasicMaterialMap=new Map;static shaderMaterialMap=new Map;static line2MaterialMap=new Map;static generateLineMaterialKey({color:e,opacity:t}){return`${e}-${t}`}static createLineMaterial({color:e,opacity:t}){let n=this.generateLineMaterialKey({color:e,opacity:t});if(this.lineMaterialMap.has(n))return this.lineMaterialMap.get(n);let i=new de.LineBasicMaterial({color:new de.Color(e).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(n,i),i}static createMeshStandardMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new de.MeshStandardMaterial({color:new de.Color(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshBasicMaterialMap.has(n))return this.meshBasicMaterialMap.get(n);let i=new de.MeshBasicMaterial({color:e,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(n,i),i}static createShaderMaterial({gradualColor:e,center:t,maxValue:n,opacity:i,direction:o,max:a,min:s}){let l=`${e.toString()}-${Ks(t)}-${n}-${i}-${Ks(o)}`;if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let u=`
1
+ "use strict";(()=>{var lf=Object.create;var ls=Object.defineProperty;var cf=Object.getOwnPropertyDescriptor;var hf=Object.getOwnPropertyNames;var ff=Object.getPrototypeOf,pf=Object.prototype.hasOwnProperty;var j=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var dn=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var df=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hf(e))!pf.call(r,i)&&i!==t&&ls(r,i,{get:()=>e[i],enumerable:!(n=cf(e,i))||n.enumerable});return r};var Sr=(r,e,t)=>(t=r!=null?lf(ff(r)):{},df(e||!r||!r.__esModule?ls(t,"default",{value:r,enumerable:!0}):t,r));var Cs=dn((yy,xs)=>{xs.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var Ss=dn((_y,bs)=>{var As=Cs();bs.exports=function(r,e){Array.isArray(e)||(e=[]),r.length>0&&e.push(As([0,0],r[0]));for(var t=0;t<r.length-1;t++){var n=r[t],i=r[t+1],o=n[0],a=n[1],s=i[0],l=i[1],u=[.75*o+.25*s,.75*a+.25*l],c=[.25*o+.75*s,.25*a+.75*l];e.push(u),e.push(c)}return r.length>1&&e.push(As([0,0],r[r.length-1])),e}});var Rs=dn((by,Is)=>{var vo=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,t)=>e.priority-t.priority)}set(e,t){let n=Number(t);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(e)?this.queue.map(i=>(i.key===e&&Object.assign(i,{priority:n}),i)):(this.keys.add(e),this.queue.push({key:e,priority:n})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(t=>t.key===e)}};Is.exports=vo});var Us=dn((Sy,Ls)=>{function Ns(r,e){let t=new Map;for(let[n,i]of r)n!==e&&i instanceof Map?t.set(n,Ns(i,e)):n!==e&&t.set(n,i);return t}Ls.exports=Ns});var zs=dn((wy,Os)=>{function vf(r){let e=Number(r);return!(isNaN(e)||e<=0)}function Ds(r){let e=new Map;return Object.keys(r).forEach(n=>{let i=r[n];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return e.set(n,Ds(i));if(!vf(i))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,i);return e.set(n,Number(i))}),e}Os.exports=Ds});var Xs=dn((Ey,ks)=>{function Bs(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((e,t)=>{if(typeof e=="object"&&e instanceof Map){Bs(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}ks.exports=Bs});var Co=dn((Ty,js)=>{var xf=Rs(),Cf=Us(),Fs=zs(),Vs=Xs(),xo=class{constructor(e){e instanceof Map?(Vs(e),this.graph=e):e?this.graph=Fs(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(Vs(t),n=t):n=Fs(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=Cf(this.graph,e),this}path(e,t,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let i=new Set,o=new xf,a=new Map,s=[],l=0,u=[];if(n.avoid&&(u=[].concat(n.avoid)),u.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(u.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(o.set(e,0);!o.isEmpty();){let c=o.next();if(c.key===t){l=c.priority;let f=c.key;for(;a.has(f);)s.push(f),f=a.get(f);break}i.add(c.key),(this.graph.get(c.key)||new Map).forEach((f,d)=>{if(i.has(d)||u.includes(d))return null;if(!o.has(d))return a.set(d,c.key),o.set(d,c.priority+f);let m=o.get(d).priority,p=c.priority+f;return p<m?(a.set(d,c.key),o.set(d,p)):null})}return s.length?(n.trim?s.shift():s=s.concat([e]),n.reverse||(s=s.reverse()),n.cost?{path:s,cost:l}:s):n.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};js.exports=xo});var Do=dn((Lo,Uo)=>{(function(r,e){typeof Lo=="object"&&typeof Uo<"u"?Uo.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self,r["'typed'"]=e())})(Lo,function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";function i(){function a(v){return typeof v=="object"&&v!==null&&v.constructor===Object}let s=[{name:"number",test:function(v){return typeof v=="number"}},{name:"string",test:function(v){return typeof v=="string"}},{name:"boolean",test:function(v){return typeof v=="boolean"}},{name:"Function",test:function(v){return typeof v=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(v){return v instanceof Date}},{name:"RegExp",test:function(v){return v instanceof RegExp}},{name:"Object",test:a},{name:"null",test:function(v){return v===null}},{name:"undefined",test:function(v){return v===void 0}}],l={name:"any",test:r,isAny:!0},u,c,h=0,f={createCount:0};function d(v){let E=u.get(v);if(E)return E;let P='Unknown type "'+v+'"',L=v.toLowerCase(),k;for(k of c)if(k.toLowerCase()===L){P+='. Did you mean "'+k+'" ?';break}throw new TypeError(P)}function m(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",P=E?d(E).index:c.length,L=[];for(let O=0;O<v.length;++O){if(!v[O]||typeof v[O].name!="string"||typeof v[O].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let q=v[O].name;if(u.has(q))throw new TypeError('Duplicate type name "'+q+'"');L.push(q),u.set(q,{name:q,test:v[O].test,isAny:v[O].isAny,index:P+O,conversionsTo:[]})}let k=c.slice(P);c=c.slice(0,P).concat(L).concat(k);for(let O=P+L.length;O<c.length;++O)u.get(c[O]).index=O}function p(){u=new Map,c=[],h=0,m([l],!1)}p(),m(s);function g(){let v;for(v of c)u.get(v).conversionsTo=[];h=0}function _(v){let E=c.filter(P=>{let L=u.get(P);return!L.isAny&&L.test(v)});return E.length?E:["any"]}function A(v){return v&&typeof v=="function"&&"_typedFunctionData"in v}function y(v,E,P){if(!A(v))throw new TypeError(n);let L=P&&P.exact,k=Array.isArray(E)?E.join(","):E,O=I(k),q=x(O);if(!L||q in v.signatures){let lt=v._typedFunctionData.signatureMap.get(q);if(lt)return lt}let X=O.length,Y;if(L){Y=[];let lt;for(lt in v.signatures)Y.push(v._typedFunctionData.signatureMap.get(lt))}else Y=v._typedFunctionData.signatures;for(let lt=0;lt<X;++lt){let dt=O[lt],Pt=[],xe;for(xe of Y){let fe=V(xe.params,lt);if(!(!fe||dt.restParam&&!fe.restParam)){if(!fe.hasAny){let je=T(fe);if(dt.types.some(We=>!je.has(We.name)))continue}Pt.push(xe)}}if(Y=Pt,Y.length===0)break}let F;for(F of Y)if(F.params.length<=X)return F;throw new TypeError("Signature not found (signature: "+(v.name||"unnamed")+"("+x(O,", ")+"))")}function S(v,E,P){return y(v,E,P).implementation}function C(v,E){let P=d(E);if(P.test(v))return v;let L=P.conversionsTo;if(L.length===0)throw new Error("There are no conversions to "+E+" defined.");for(let k=0;k<L.length;k++)if(d(L[k].from).test(v))return L[k].convert(v);throw new Error("Cannot convert "+v+" to "+E)}function x(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return v.map(P=>P.name).join(E)}function b(v){let E=v.indexOf("...")===0,L=(E?v.length>3?v.slice(3):"any":v).split("|").map(X=>d(X.trim())),k=!1,O=E?"...":"";return{types:L.map(function(X){return k=X.isAny||k,O+=X.name+"|",{name:X.name,typeIndex:X.index,test:X.test,isAny:X.isAny,conversion:null,conversionIndex:-1}}),name:O.slice(0,-1),hasAny:k,hasConversion:!1,restParam:E}}function w(v){let E=v.types.map(q=>q.name),P=vt(E),L=v.hasAny,k=v.name,O=P.map(function(q){let X=d(q.from);return L=X.isAny||L,k+="|"+q.from,{name:q.from,typeIndex:X.index,test:X.test,isAny:X.isAny,conversion:q,conversionIndex:q.index}});return{types:v.types.concat(O),name:k,hasAny:L,hasConversion:O.length>0,restParam:v.restParam}}function T(v){return v.typeSet||(v.typeSet=new Set,v.types.forEach(E=>v.typeSet.add(E.name))),v.typeSet}function I(v){let E=[];if(typeof v!="string")throw new TypeError("Signatures must be strings");let P=v.trim();if(P==="")return E;let L=P.split(",");for(let k=0;k<L.length;++k){let O=b(L[k].trim());if(O.restParam&&k!==L.length-1)throw new SyntaxError('Unexpected rest parameter "'+L[k]+'": only allowed for the last parameter');if(O.types.length===0)return null;E.push(O)}return E}function R(v){let E=jt(v);return E?E.restParam:!1}function U(v){if(!v||v.types.length===0)return r;if(v.types.length===1)return d(v.types[0].name).test;if(v.types.length===2){let E=d(v.types[0].name).test,P=d(v.types[1].name).test;return function(k){return E(k)||P(k)}}else{let E=v.types.map(function(P){return d(P.name).test});return function(L){for(let k=0;k<E.length;k++)if(E[k](L))return!0;return!1}}}function Q(v){let E,P,L;if(R(v)){E=kt(v).map(U);let k=E.length,O=U(jt(v)),q=function(X){for(let Y=k;Y<X.length;Y++)if(!O(X[Y]))return!1;return!0};return function(Y){for(let F=0;F<E.length;F++)if(!E[F](Y[F]))return!1;return q(Y)&&Y.length>=k+1}}else return v.length===0?function(O){return O.length===0}:v.length===1?(P=U(v[0]),function(O){return P(O[0])&&O.length===1}):v.length===2?(P=U(v[0]),L=U(v[1]),function(O){return P(O[0])&&L(O[1])&&O.length===2}):(E=v.map(U),function(O){for(let q=0;q<E.length;q++)if(!E[q](O[q]))return!1;return O.length===E.length})}function V(v,E){return E<v.length?v[E]:R(v)?jt(v):null}function W(v,E){let P=V(v,E);return P?T(P):new Set}function D(v){return v.conversion===null||v.conversion===void 0}function G(v,E){let P=new Set;return v.forEach(L=>{let k=W(L.params,E),O;for(O of k)P.add(O)}),P.has("any")?["any"]:Array.from(P)}function $(v,E,P){let L,k,O=v||"unnamed",q=P,X;for(X=0;X<E.length;X++){let dt=[];if(q.forEach(Pt=>{let xe=V(Pt.params,X),fe=U(xe);(X<Pt.params.length||R(Pt.params))&&fe(E[X])&&dt.push(Pt)}),dt.length===0){if(k=G(q,X),k.length>0){let Pt=_(E[X]);return L=new TypeError("Unexpected type of argument in function "+O+" (expected: "+k.join(" or ")+", actual: "+Pt.join(" | ")+", index: "+X+")"),L.data={category:"wrongType",fn:O,index:X,actual:Pt,expected:k},L}}else q=dt}let Y=q.map(function(dt){return R(dt.params)?1/0:dt.params.length});if(E.length<Math.min.apply(null,Y))return k=G(q,X),L=new TypeError("Too few arguments in function "+O+" (expected: "+k.join(" or ")+", index: "+E.length+")"),L.data={category:"tooFewArgs",fn:O,index:E.length,expected:k},L;let F=Math.max.apply(null,Y);if(E.length>F)return L=new TypeError("Too many arguments in function "+O+" (expected: "+F+", actual: "+E.length+")"),L.data={category:"tooManyArgs",fn:O,index:E.length,expectedLength:F},L;let lt=[];for(let dt=0;dt<E.length;++dt)lt.push(_(E[dt]).join("|"));return L=new TypeError('Arguments of type "'+lt.join(", ")+'" do not match any of the defined signatures of function '+O+"."),L.data={category:"mismatch",actual:lt},L}function H(v){let E=c.length+1;for(let P=0;P<v.types.length;P++)D(v.types[P])&&(E=Math.min(E,v.types[P].typeIndex));return E}function rt(v){let E=h+1;for(let P=0;P<v.types.length;P++)D(v.types[P])||(E=Math.min(E,v.types[P].conversionIndex));return E}function _t(v,E){if(v.hasAny){if(!E.hasAny)return 1}else if(E.hasAny)return-1;if(v.restParam){if(!E.restParam)return 1}else if(E.restParam)return-1;if(v.hasConversion){if(!E.hasConversion)return 1}else if(E.hasConversion)return-1;let P=H(v)-H(E);if(P<0)return-1;if(P>0)return 1;let L=rt(v)-rt(E);return L<0?-1:L>0?1:0}function pt(v,E){let P=v.params,L=E.params,k=jt(P),O=jt(L),q=R(P),X=R(L);if(q&&k.hasAny){if(!X||!O.hasAny)return 1}else if(X&&O.hasAny)return-1;let Y=0,F=0,lt;for(lt of P)lt.hasAny&&++Y,lt.hasConversion&&++F;let dt=0,Pt=0;for(lt of L)lt.hasAny&&++dt,lt.hasConversion&&++Pt;if(Y!==dt)return Y-dt;if(q&&k.hasConversion){if(!X||!O.hasConversion)return 1}else if(X&&O.hasConversion)return-1;if(F!==Pt)return F-Pt;if(q){if(!X)return 1}else if(X)return-1;let xe=(P.length-L.length)*(q?-1:1);if(xe!==0)return xe;let fe=[],je=0;for(let qn=0;qn<P.length;++qn){let Qr=_t(P[qn],L[qn]);fe.push(Qr),je+=Qr}if(je!==0)return je;let We;for(We of fe)if(We!==0)return We;return 0}function vt(v){if(v.length===0)return[];let E=v.map(d);v.length>1&&E.sort((k,O)=>k.index-O.index);let P=E[0].conversionsTo;if(v.length===1)return P;P=P.concat([]);let L=new Set(v);for(let k=1;k<E.length;++k){let O;for(O of E[k].conversionsTo)L.has(O.from)||(P.push(O),L.add(O.from))}return P}function Bt(v,E){let P=E;if(v.some(k=>k.hasConversion)){let k=R(v),O=v.map(Ot);P=function(){let X=[],Y=k?arguments.length-1:arguments.length;for(let F=0;F<Y;F++)X[F]=O[F](arguments[F]);return k&&(X[Y]=arguments[Y].map(O[Y])),E.apply(this,X)}}let L=P;if(R(v)){let k=v.length-1;L=function(){return P.apply(this,Ie(arguments,0,k).concat([Ie(arguments,k)]))}}return L}function Ot(v){let E,P,L,k,O=[],q=[];switch(v.types.forEach(function(X){X.conversion&&(O.push(d(X.conversion.from).test),q.push(X.conversion.convert))}),q.length){case 0:return function(Y){return Y};case 1:return E=O[0],L=q[0],function(Y){return E(Y)?L(Y):Y};case 2:return E=O[0],P=O[1],L=q[0],k=q[1],function(Y){return E(Y)?L(Y):P(Y)?k(Y):Y};default:return function(Y){for(let F=0;F<q.length;F++)if(O[F](Y))return q[F](Y);return Y}}}function Lt(v){function E(P,L,k){if(L<P.length){let O=P[L],q=[];if(O.restParam){let X=O.types.filter(D);X.length<O.types.length&&q.push({types:X,name:"..."+X.map(Y=>Y.name).join("|"),hasAny:X.some(Y=>Y.isAny),hasConversion:!1,restParam:!0}),q.push(O)}else q=O.types.map(function(X){return{types:[X],name:X.name,hasAny:X.isAny,hasConversion:X.conversion,restParam:!1}});return Rn(q,function(X){return E(P,L+1,k.concat([X]))})}else return[k]}return E(v,0,[])}function Et(v,E){let P=Math.max(v.length,E.length);for(let X=0;X<P;X++){let Y=W(v,X),F=W(E,X),lt=!1,dt;for(dt of F)if(Y.has(dt)){lt=!0;break}if(!lt)return!1}let L=v.length,k=E.length,O=R(v),q=R(E);return O?q?L===k:k>=L:q?L>=k:L===k}function $t(v){return v.map(E=>Zr(E)?qr(E.referToSelf.callback):Yr(E)?Wn(E.referTo.references,E.referTo.callback):E)}function Mt(v,E,P){let L=[],k;for(k of v){let O=P[k];if(typeof O!="number")throw new TypeError('No definition for referenced signature "'+k+'"');if(O=E[O],typeof O!="function")return!1;L.push(O)}return L}function xt(v,E,P){let L=$t(v),k=new Array(L.length).fill(!1),O=!0;for(;O;){O=!1;let q=!0;for(let X=0;X<L.length;++X){if(k[X])continue;let Y=L[X];if(Zr(Y))L[X]=Y.referToSelf.callback(P),L[X].referToSelf=Y.referToSelf,k[X]=!0,q=!1;else if(Yr(Y)){let F=Mt(Y.referTo.references,L,E);F?(L[X]=Y.referTo.callback.apply(this,F),L[X].referTo=Y.referTo,k[X]=!0,q=!1):O=!0}}if(q&&O)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return L}function ve(v){let E=/\bthis(\(|\.signatures\b)/;Object.keys(v).forEach(P=>{let L=v[P];if(E.test(L.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Vt(v,E){if(f.createCount++,Object.keys(E).length===0)throw new SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&ve(E);let P=[],L=[],k={},O=[],q;for(q in E){if(!Object.prototype.hasOwnProperty.call(E,q))continue;let At=I(q);if(!At)continue;P.forEach(function(br){if(Et(br,At))throw new TypeError('Conflicting signatures "'+x(br)+'" and "'+x(At)+'".')}),P.push(At);let Ce=L.length;L.push(E[q]);let sf=At.map(w),Gr;for(Gr of Lt(sf)){let br=x(Gr);O.push({params:Gr,name:br,fn:Ce}),Gr.every(uf=>!uf.hasConversion)&&(k[br]=Ce)}}O.sort(pt);let X=xt(L,k,Ar),Y;for(Y in k)Object.prototype.hasOwnProperty.call(k,Y)&&(k[Y]=X[k[Y]]);let F=[],lt=new Map;for(Y of O)lt.has(Y.name)||(Y.fn=X[Y.fn],F.push(Y),lt.set(Y.name,Y));let dt=F[0]&&F[0].params.length<=2&&!R(F[0].params),Pt=F[1]&&F[1].params.length<=2&&!R(F[1].params),xe=F[2]&&F[2].params.length<=2&&!R(F[2].params),fe=F[3]&&F[3].params.length<=2&&!R(F[3].params),je=F[4]&&F[4].params.length<=2&&!R(F[4].params),We=F[5]&&F[5].params.length<=2&&!R(F[5].params),qn=dt&&Pt&&xe&&fe&&je&&We;for(let At=0;At<F.length;++At)F[At].test=Q(F[At].params);let Qr=dt?U(F[0].params[0]):e,Nh=Pt?U(F[1].params[0]):e,Lh=xe?U(F[2].params[0]):e,Uh=fe?U(F[3].params[0]):e,Dh=je?U(F[4].params[0]):e,Oh=We?U(F[5].params[0]):e,zh=dt?U(F[0].params[1]):e,Bh=Pt?U(F[1].params[1]):e,kh=xe?U(F[2].params[1]):e,Xh=fe?U(F[3].params[1]):e,Fh=je?U(F[4].params[1]):e,Vh=We?U(F[5].params[1]):e;for(let At=0;At<F.length;++At)F[At].implementation=Bt(F[At].params,F[At].fn);let jh=dt?F[0].implementation:t,Wh=Pt?F[1].implementation:t,qh=xe?F[2].implementation:t,Yh=fe?F[3].implementation:t,Zh=je?F[4].implementation:t,Qh=We?F[5].implementation:t,Gh=dt?F[0].params.length:-1,Hh=Pt?F[1].params.length:-1,Kh=xe?F[2].params.length:-1,$h=fe?F[3].params.length:-1,Jh=je?F[4].params.length:-1,tf=We?F[5].params.length:-1,ef=qn?6:0,nf=F.length,rf=F.map(At=>At.test),of=F.map(At=>At.implementation),af=function(){for(let Ce=ef;Ce<nf;Ce++)if(rf[Ce](arguments))return of[Ce].apply(this,arguments);return f.onMismatch(v,arguments,F)};function Ar(At,Ce){return arguments.length===Gh&&Qr(At)&&zh(Ce)?jh.apply(this,arguments):arguments.length===Hh&&Nh(At)&&Bh(Ce)?Wh.apply(this,arguments):arguments.length===Kh&&Lh(At)&&kh(Ce)?qh.apply(this,arguments):arguments.length===$h&&Uh(At)&&Xh(Ce)?Yh.apply(this,arguments):arguments.length===Jh&&Dh(At)&&Fh(Ce)?Zh.apply(this,arguments):arguments.length===tf&&Oh(At)&&Vh(Ce)?Qh.apply(this,arguments):af.apply(this,arguments)}try{Object.defineProperty(Ar,"name",{value:v})}catch{}return Ar.signatures=k,Ar._typedFunctionData={signatures:F,signatureMap:lt},Ar}function gt(v,E,P){throw $(v,E,P)}function kt(v){return Ie(v,0,v.length-1)}function jt(v){return v[v.length-1]}function Ie(v,E,P){return Array.prototype.slice.call(v,E,P)}function Je(v,E){for(let P=0;P<v.length;P++)if(E(v[P]))return v[P]}function Rn(v,E){return Array.prototype.concat.apply([],v.map(E))}function pn(){let v=kt(arguments).map(P=>x(I(P))),E=jt(arguments);if(typeof E!="function")throw new TypeError("Callback function expected as last argument");return Wn(v,E)}function Wn(v,E){return{referTo:{references:v,callback:E}}}function qr(v){if(typeof v!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:v}}}function Yr(v){return v&&typeof v.referTo=="object"&&Array.isArray(v.referTo.references)&&typeof v.referTo.callback=="function"}function Zr(v){return v&&typeof v.referToSelf=="object"&&typeof v.referToSelf.callback=="function"}function xr(v,E){if(!v)return E;if(E&&E!==v){let P=new Error("Function names do not match (expected: "+v+", actual: "+E+")");throw P.data={actual:E,expected:v},P}return v}function Cr(v){let E;for(let P in v)Object.prototype.hasOwnProperty.call(v,P)&&(A(v[P])||typeof v[P].signature=="string")&&(E=xr(E,v[P].name));return E}function M(v,E){let P;for(P in E)if(Object.prototype.hasOwnProperty.call(E,P)){if(P in v&&E[P]!==v[P]){let L=new Error('Signature "'+P+'" is defined twice');throw L.data={signature:P,sourceFunction:E[P],destFunction:v[P]},L}v[P]=E[P]}}let Z=f;f=function(v){let E=typeof v=="string",P=E?1:0,L=E?v:"",k={};for(let O=P;O<arguments.length;++O){let q=arguments[O],X={},Y;if(typeof q=="function"?(Y=q.name,typeof q.signature=="string"?X[q.signature]=q:A(q)&&(X=q.signatures)):a(q)&&(X=q,E||(Y=Cr(q))),Object.keys(X).length===0){let F=new TypeError("Argument to 'typed' at index "+O+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw F.data={index:O,argument:q},F}E||(L=xr(L,Y)),M(k,X)}return Vt(L||"",k)},f.create=i,f.createCount=Z.createCount,f.onMismatch=gt,f.throwMismatchError=gt,f.createError=$,f.clear=p,f.clearConversions=g,f.addTypes=m,f._findType=d,f.referTo=pn,f.referToSelf=qr,f.convert=C,f.findSignature=y,f.find=S,f.isTypedFunction=A,f.warnAgainstDeprecatedThis=!0,f.addType=function(v,E){let P="any";E!==!1&&u.has("Object")&&(P="Object"),f.addTypes([v],P)};function Ct(v){if(!v||typeof v.from!="string"||typeof v.to!="string"||typeof v.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(v.to===v.from)throw new SyntaxError('Illegal to define conversion from "'+v.from+'" to itself.')}return f.addConversion=function(v){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};Ct(v);let P=d(v.to),L=P.conversionsTo.find(k=>k.from===v.from);if(L)if(E&&E.override)f.removeConversion({from:L.from,to:v.to,convert:L.convert});else throw new Error('There is already a conversion from "'+v.from+'" to "'+P.name+'"');P.conversionsTo.push({from:v.from,convert:v.convert,index:h++})},f.addConversions=function(v,E){v.forEach(P=>f.addConversion(P,E))},f.removeConversion=function(v){Ct(v);let E=d(v.to),P=Je(E.conversionsTo,k=>k.from===v.from);if(!P)throw new Error("Attempt to remove nonexistent conversion from "+v.from+" to "+v.to);if(P.convert!==v.convert)throw new Error("Conversion to remove does not match existing conversion");let L=E.conversionsTo.indexOf(P);E.conversionsTo.splice(L,1)},f.resolve=function(v,E){if(!A(v))throw new TypeError(n);let P=v._typedFunctionData.signatures;for(let L=0;L<P.length;++L)if(P[L].test(E))return P[L];return null},f}var o=i();return o})});var Ni=j("three");var oe=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(e){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),e()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(e){this.tasks.requestAnimation.delete(e),window.cancelAnimationFrame(e)}setTimeout(e,t){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),e()},t);return this.tasks.timeout.add(n),n}clearTimeout(e){this.tasks.timeout.delete(e),window.clearTimeout(e)}setInterval(e,t){let n=window.setInterval(()=>{this.tasks.interval.delete(n),e()},t);return this.tasks.interval.add(n),n}clearInterval(e){this.tasks.interval.delete(e),window.clearInterval(e)}dispose(){this.tasks.requestAnimation.forEach(e=>{window.cancelAnimationFrame(e)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(e=>{window.clearTimeout(e)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(e=>{window.clearInterval(e)}),this.tasks.interval.clear()}};var Te=j("three");function cs(){let r=new Te.Group,e=new Te.AmbientLight(16777215,2.6);return r.add(e),r}function tn(r,e=[]){let t=new Te.Shape(r.map(n=>new Te.Vector2(...n)));return e.length&&e.forEach(n=>{var i=new Te.Path(n.map(o=>new Te.Vector2(...o)));t.holes.push(i)}),t}function hs(r=16777215,e=1){let t=new Te.DirectionalLight(r,e);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function ae(r,e){if(e&&r.children&&r.children.length&&r.children.forEach(t=>{ae(t,e)}),r.isMesh){let t=r;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n.dispose()}):t.material.dispose())}r.isLight&&r.dispose?.()}function fs(r){return/[\u4E00-\u9FA5]+/g.test(r)}var Xt=j("three"),Yn=j("@turf/turf");function it(r,e,t,n){let i=r.clone().project(e),o=t/2,a=n/2,s=Math.round(i.x*o+o),l=Math.round(-i.y*a+a);return{x:s,y:l}}function $g(r,e,t,n,i){if(!i)return null;t=Math.min(1,t),n=Math.min(1,n);let o=r/t*2-1,a=1-e/n*2;return new Xt.Vector3(o,a,0).unproject(i)}function Hr(r){let e=(0,Yn.featureCollection)(r.map(n=>(0,Yn.point)(n)));return(0,Yn.center)(e).geometry.coordinates}function mn(r,e,t){return r.x>=e.x&&r.x<=t.x&&r.y>=e.y&&r.y<=t.y}function Jg(r){let e=0,t=new Xt.Vector3;for(let n=1;n<r.length;n++){let i=new Xt.Vector3(r[n-1][0],r[n-1][1],0),o=new Xt.Vector3(r[n][0],r[n][1],0),a=o.distanceTo(i);a>e&&(e=a,t=o.clone().sub(i).normalize())}return t}function Jt(r,e){return Math.sqrt((e[0]-r[0])**2+(e[1]-r[1])**2)}function qe(r){let e=0;for(let t=0;t<r.length-1;t++)e+=Jt(r[t],r[t+1]);return e}function ps(r,e,t){let n=new Xt.Vector2(e[0]-r[0],e[1]-r[1]),i=new Xt.Vector2(e[0]-t[0],e[1]-t[1]),a=n.angleTo(i)*180/Math.PI,s=new Xt.Vector2(e[0]-r[0],e[1]-r[1]);return new Xt.Vector2(t[0]-r[0],t[1]-r[1]).cross(s)>0?a:-a}function ds(r,e){let t=Math.min(Jt(r[0][0],r[0][1]),Jt(r[0][2],r[0][1]))-1;e||(e=Hr(r[0]));let n=mf(e,t),i=new Xt.Vector2(r[0][0][0],r[0][0][1]),o=new Xt.Vector2(r[0][1][0],r[0][1][1]),a=new Xt.Vector2(r[0][2][0],r[0][2][1]),l=(i.distanceTo(o)>o.distanceTo(a)?o.clone().sub(i):a.clone().sub(o)).angleTo(new Xt.Vector2(0,1)),u=new Xt.Matrix3;return u.multiply(new Xt.Matrix3().translate(e[0],e[1])).multiply(new Xt.Matrix3().rotate(l)).multiply(new Xt.Matrix3().translate(-e[0],-e[1])),[n.map(c=>{let h=new Xt.Vector2(c[0],c[1]).applyMatrix3(u);return[h.x,h.y]})]}function mf(r,e){let t=e/2;return[[r[0]-t,r[1]+t],[r[0]+t,r[1]+t],[r[0]+t,r[1]-t],[r[0]-t,r[1]-t],[r[0]-t,r[1]+t]]}function gn(r,e){let t=0,n=1/0,[i,o]=e;for(let a=0;a<r.length-1;a++){let[s,l]=r[a],[u,c]=r[a+1],h=Math.min(s,u)<=i&&i<=Math.max(s,u),f=Math.min(l,c)<=o&&o<=Math.max(l,c);if(h&&f){let d=Math.abs((u-s)*(o-l)-(c-l)*(i-s));d<n&&(n=d,t=a)}}return t}function ms(r,e){let t=r[0],n=r[1],i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let s=e[o][0],l=e[o][1],u=e[a][0],c=e[a][1];l>n!=c>n&&t<(u-s)*(n-l)/(c-l)+s&&(i=!i)}return i}function Zn(r,e){return new Proxy(r,{get:(t,n,i)=>Reflect.get(t,n,i),set:(t,n,i,o)=>{let a=Reflect.get(t,n,o),s=Reflect.set(t,n,i,o);return a!==i&&e.dispatchEvent({type:`change-${n}`,value:i}),s}})}function Re(r,e){return Promise.race([r,new Promise((t,n)=>{setTimeout(()=>n(new Error("Promise timeout")),e)})])}function Kr(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function gs(r,e){let t=Kr("svg");return t.setAttribute("width",r),t.setAttribute("height",e),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function wr(r="2",e){let t=Kr("circle");return t.setAttribute("r",r),t.setAttribute("fill",e),t}function $r(r){let e=Kr("line");return e.setAttribute("stroke",r),e}function yn(r,e){let t=Kr("rect");return t.setAttribute("stroke",r),t.setAttribute("fill",e),t}function Nn(r,e,t){r.setAttribute("cx",`${e}`),r.setAttribute("cy",`${t}`)}function Ye(r,e,t){e&&(r.setAttribute("x1",`${e.x}`),r.setAttribute("y1",`${e.y}`)),t&&(r.setAttribute("x2",`${t.x}`),r.setAttribute("y2",`${t.y}`))}function pe(r,e,t,n,i){r.setAttribute("x",`${e}`),r.setAttribute("y",`${t}`),r.setAttribute("width",`${n}`),r.setAttribute("height",`${i}`)}function ys(){return Promise.resolve()}function mo(){return new Promise(r=>{requestAnimationFrame(r)})}function oy(r){return parseInt(r.replace("#","0x"),16)}function ay(r,e){let t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(t*e),a=Math.round(n*e),s=Math.round(i*e);return`#${(1<<24|o<<16|a<<8|s).toString(16).slice(1)}`}function un(r,e=.85){let t,n,i;if(r.startsWith("#"))t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let a=r.slice(4,-1).split(",");t=parseInt(a[0].trim()),n=parseInt(a[1].trim()),i=parseInt(a[2].trim())}return t=Math.min(Math.floor(t*e),255),n=Math.min(Math.floor(n*e),255),i=Math.min(Math.floor(i*e),255),"#"+((1<<24)+(t<<16)+(n<<8)+i).toString(16).slice(1)}function go(r,e){r=r.replace(/^#/,"");let t=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return e!==void 0?`rgba(${t}, ${n}, ${i}, ${e})`:`rgb(${t}, ${n}, ${i})`}var Qn=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,_s=(navigator.userAgent||"").toLocaleLowerCase(),Er=/ios|iphone/i.test(_s),uy=/android|adr|linux/gi.test(_s);function Gn(r){return Qn?r==="Meta":r==="Control"}var yo="__once__",vs=class{events=new Map;on(e,t){if(typeof t!="function")return;let n=this.events.get(e);return n?n.add(t):this.events.set(e,new Set([t]))}once(e,t){if(typeof t!="function")return;let n=`${yo}${e}`,i=this.events.get(n);return i?i.add(t):this.events.set(n,new Set([t]))}off(e,t){let n=this.events.get(e),i=this.events.get(`${yo}${e}`);!n&&!i||(t===void 0&&(n?.clear(),i?.clear()),n?.has(t)&&n.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(e,...t){let n=this.events.get(e),i=this.events.get(`${yo}${e}`);!n&&!i||(n?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.clear())}};var Tr=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(Tr||{});function Hn(r){return Object.keys(r).sort().map(e=>`${e}=${r[e]}`).join("&")}function my(r,e){return new Promise((t,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(e.headers||{}).forEach(o=>{i.setRequestHeader(o,e.headers[o])}),e.responseType&&(i.responseType=e.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(e.responseType==="arraybuffer")t(i.response);else try{let o=JSON.parse(i.responseText);t(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var Kn=j("three"),ws=Sr(Ss(),1);function gf(r,e){let t=r.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function yf(r){let e=0;return r.reduce(([t,n],[i,o])=>(e+=Math.sqrt((i-t)**2+(o-n)**2),[i,o])),e/r.length}function Es(r,e=.25){if(yf(r)<e)return r;let t=(0,ws.default)(r);return Es(t,e)}function Jr(r,e=!1,t=!0,n=5,i=150,o=3){let a=[],s=!e;if(a.push(r[0]),r.length<2)return a;for(let u=0;u<r.length-2;u+=1){let c=r[u],h=r[u+1],f=r[u+2],d=new Kn.Vector2(c[0]-h[0],c[1]-h[1]),m=new Kn.Vector2(f[0]-h[0],f[1]-h[1]),p=gf(d,m)/Math.PI*180,g=d.length()+m.length();(!s||p<i&&g>.01||g>n)&&(a.push(r[u+1]),s=!0)}if(a.push(r[r.length-1]),!t)return a;let l=[];l.push(a[0]);for(let u=0;u<a.length-2;u+=1){let c=new Kn.Vector2(a[u][0],a[u][1]),h=new Kn.Vector2(a[u+1][0],a[u+1][1]),f=new Kn.Vector2(a[u+2][0],a[u+2][1]),d=c.distanceTo(h)/2,m=f.distanceTo(h)/2,p=h.clone(),g=h.clone();p.add(c.clone().sub(h).normalize().multiplyScalar(d>o?o/2:d)),g.add(f.clone().sub(h).normalize().multiplyScalar(m>o?o/2:m));let _=[[p.x,p.y],[h.x,h.y],[g.x,g.y]];l.push(...Es(_,o/25))}return l.push(a[a.length-1]),_f(l)}function _f(r){if(r.length<=1)return r;let e=[],t;return r.forEach(([n,i])=>{t?n===t[0]&&i===t[1]||(t=[n,i],e.push([n,i])):(t=[n,i],e.push([n,i]))}),e}function Ts(r,e,t){let n=Math.sqrt((t[0]-e[0])**2+(t[1]-e[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2),closestPoint:e.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-e[0])*(t[0]-e[0])+(r[1]-e[1])*(t[1]-e[1]))/n**2)),o=[e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function xy(r,e,t){let[n,i]=r,[o,a]=e,s=Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2));if(s===0||s<t)return[...e];let l=t/s,u=n+(o-n)*l,c=i+(a-i)*l;return[u,c]}var Ms=(u=>(u.START="start",u.END="end",u.FRONT="front",u.RIGHT="right",u.LEFT="left",u.RIGHT_FRONT="right_front",u.LEFT_FRONT="left_front",u.RIGHT_BACK="right_back",u.LEFT_BACK="left_back",u))(Ms||{});function _o(r,e,t){let n=ps(r,e,t);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function Cy(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let e=[{direction:"start",distance:Jt(r[0],r[1]),points:[r[0],r[1]]}];for(let t=2;t<r.length;t++){let n=_o(r[t-2],r[t-1],r[t]);if(n==="front"){let i=e[e.length-1],o=Jt(r[t-1],r[t]);i.distance+=o,t!==2&&i.points.push(r[t-1])}else e.push({direction:n,distance:Jt(r[t-1],r[t]),points:[r[t-1],r[t]]})}return e.push({direction:"end",distance:0,points:[r[r.length-1]]}),e}function Ps(r,e){if(r.length<2)return-1;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=[e[0]-i[0],e[1]-i[1]],s=[o[0]-i[0],o[1]-i[1]],l=Math.min(o[0],i[0])<=e[0]&&e[0]<=Math.max(o[0],i[0]),u=Math.min(o[1],i[1])<=e[1]&&e[1]<=Math.max(o[1],i[1]);if(l&&u){let c=a[0]*s[1]-a[1]*s[0];if(Math.abs(c)<1e-6){let h=Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2);return t+h}}t+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function $n(r,e){if(r.length<2)return r[0]??null;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2);if(t+=a,t>=e){let s=(e-(t-a))/a,l=i[0]+(o[0]-i[0])*s,u=i[1]+(o[1]-i[1])*s;return[l,u]}}return null}var en=Sr(Co(),1);var Ne="___",Ws=class{constructor(e=3){this.lift_priority=e}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new en.default;escalatorRoute=new en.default;straightLadderRoute=new en.default;initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(t=>{t.points.forEach(n=>{let i=`${t.floor}${Ne}${n.id}`;if(this.pointMap.set(i,n),this.nodeMap.set(`${n.floor}${Ne}${n.nodeId}`,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push({...n}),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push({...n}),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push({...n}),this.facilityMap.set(n.targetId,o)}}),t.lines.filter(n=>n.direction!=="no").forEach(n=>{let i=`${t.floor}${Ne}${n.from}`,o=`${t.floor}${Ne}${n.to}`,a=this.pointMap.get(i)?.cds,s=this.pointMap.get(o)?.cds;if(a?.length&&s?.length){let l=Jt(a,s);this.addLineItem(i,o,l),n.direction==="double"&&this.addLineItem(o,i,l)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let l=`${a[s].floor}${Ne}${a[s].id}`;for(let u=0;u<a.length;u++)if(s!==u){let c=`${a[u].floor}${Ne}${a[u].id}`,h=this.pointMap.get(l)?.cds,f=this.pointMap.get(c)?.cds;if(h?.length&&f?.length)if(a[s].type==="straightLadder"){let d=t;this.addLineItem(l,c,d,i)}else{let d=n;this.addLineItem(l,c,d,i)}}}}),this.escalatorMap.forEach((o,a)=>{if(o.start&&o.end){let s=`${o.start.floor}${Ne}${o.start.id}`,l=`${o.end.floor}${Ne}${o.end.id}`,u=this.pointMap.get(s)?.cds,c=this.pointMap.get(l)?.cds;if(u?.length&&c?.length){let h=e;this.addLineItem(s,l,h,i)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new en.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new en.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new en.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${Ne}${e.nodeId}`);if(t){let[n,i]=t.split(Ne);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{let a=Jt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:n.point.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let s=this.facilityMap.get(o.facility).filter(u=>o.floor?u.floor===o.floor:!0);if(!s.length)return null;let l=s.map(u=>a(i,{floor:u.floor,id:u.id})).filter(u=>!!u);return l.reduce((u,c)=>{let h=c.reduce((f,d)=>f+qe(d.points),0);return h<u.distance&&(u.distance=h,u.path=c),u},{distance:1/0,path:l[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${Ne}${e.id}`,o=`${t.floor}${Ne}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[];return a.map(l=>{let u=this.pointMap.get(l);if(u){let{floor:c}=u;if(s[s.length-1]?.floor===c){let h=s[s.length-1];h.points.push(u.cds),h.endType=u.type,h.destId=u.nodeId,h.distance=qe(h.points)}else s.push({floor:c,points:[u.cds],endType:u.type,destId:u.nodeId,distance:0})}}),s}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new en.default,this.escalatorRoute=new en.default,this.straightLadderRoute=new en.default}};var se=Sr(Co(),1);var _n=j("lodash"),It="___",qs=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new se.default;escalatorRoute=new se.default;straightLadderRoute=new se.default;forwardLineMap=new Map;forwardRoute=new se.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(t=>{let n=[];try{n=JSON.parse(t.entry_end_floor)}catch{n=[]}let i=[];try{i=JSON.parse(t.entry_start_floor)}catch{i=[]}return{...t,entry_start_floor:i,entry_end_floor:n}})}initRoute(e,t){this.clear(),this.roadInfo=e,this.initFacilities(t);let n=new Date,i=n.getHours()*60+n.getMinutes();e.length&&(e.forEach(o=>{(o.points||[]).filter(a=>a.openStatus!==!1).filter(a=>{if(!a.startTime||!a.endTime)return!0;let[s,l]=a.startTime.split(":").map(d=>+d),[u,c]=a.endTime.split(":").map(d=>+d),h=s*60+l,f=u*60+c;return i>=h&&i<=f}).forEach(a=>{a.floor=o.floor;let s=`${o.floor}${It}${a.id}`;if(this.nodeMap.set(`${o.floor}${It}${a.nodeId}`,`${o.floor}${It}${a.relatedId||a.id}`),this.pointMap.set(s,a),this.isFacilityByType(a.type)){let l=this.facilities.find(u=>u.id===+a.targetId);if(l){switch(l.entry_infra_type){case"straightLadder":if(l.entry_end_floor.find(f=>f.floor===o.floor)&&l.entry_start_floor.find(f=>f.floor===o.floor)){let f=this.straightLadderMap.get(a.targetId)||[];f.push({...a}),this.straightLadderMap.set(a.targetId,f)}break;case"staircase":if(l.entry_end_floor.find(f=>f.floor===o.floor)&&l.entry_start_floor.find(f=>f.floor===o.floor)){let f=this.staircaseMap.get(a.targetId)||[];f.push({...a}),this.staircaseMap.set(a.targetId,f)}break;case"escalator":let c=this.escalatorMap.get(a.targetId)||[];if(l.entry_start_floor.find(f=>f.floor===o.floor)){let f=c.find(d=>d.end?.floor!==o.floor&&!d.start);f?f.start=a:c.push({start:a})}if(l.entry_end_floor.find(f=>f.floor===o.floor)){let f=c.find(d=>d.start?.floor!==o.floor&&!d.end);f?f.end=a:c.push({end:a})}this.escalatorMap.set(a.targetId,c);break;case"ramp":let h=this.rampMap.get(a.targetId)||[];if(l.entry_start_floor.find(f=>f.floor===o.floor)){let f=h.find(d=>d.end?.floor!==o.floor&&!d.start);f?f.start=a:h.push({start:a})}if(l.entry_end_floor.find(f=>f.floor===o.floor)){let f=h.find(d=>d.start?.floor!==o.floor&&!d.end);f?f.end=a:h.push({end:a})}this.rampMap.set(a.targetId,h);break}let u=this.facilityMap.get(a.targetId)||[];u.push({...a}),this.facilityMap.set(a.targetId,u)}}a.type==="parkingSpace"&&this.parkingMap.set(`${o.floor}${It}${a.name}`,a)}),(o.lines||[]).filter(a=>a.direction!=="no").forEach(a=>{let s=`${o.floor}${It}${a.from}`,l=`${o.floor}${It}${a.to}`,u=this.pointMap.get(s),c=this.pointMap.get(l);if(!u||!c)return;let h=u.cds,f=c.cds,d=Jt(h,f);if(!u.permission&&!c.permission)switch(this.addLineItem(s,l,d),this.addLineItem(l,s,d),a.direction){case"double":this.addLineItem(s,l,d,this.forwardLineMap),this.addLineItem(l,s,d,this.forwardLineMap);break;case"single":this.addLineItem(s,l,d,this.forwardLineMap);break;case"back":this.addLineItem(l,s,d,this.forwardLineMap);break}else u.permission&&(this.setPermissionLine(s,l,u.permission,d,""),this.setPermissionLine(l,s,u.permission,d,"")),c.permission&&c.permission!==u.permission&&(this.setPermissionLine(s,l,c.permission,d,""),this.setPermissionLine(l,s,c.permission,d,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[`permission_${e}`]||(this[`permission_${e}`]=new Set),this[`permission_${e}`]}setPermissionLine(e,t,n,i,o){this.getPermissionMap(n).add({fromKey:e,toKey:t,distance:i,type:o})}addPermissionFacility(){this.straightLadderMap.forEach((e,t)=>{if(e.length<2){this.straightLadderMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${It}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${It}${e[a].id}`,l=this.pointMap.get(s);if(!l)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"straightLadder"),l.permission&&l.permission!==o.permission&&this.setPermissionLine(i,s,l.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,t)=>{if(e.length<2){this.staircaseMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${It}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${It}${e[a].id}`,l=this.pointMap.get(s);if(!l)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"staircase"),l.permission&&l.permission!==o.permission&&this.setPermissionLine(i,s,l.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${It}${n.start.id}`,o=`${n.end.floor}${It}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,1,"escalator"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,1,"escalator"))}})}),this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${It}${n.start.id}`,o=`${n.end.floor}${It}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,10,"ramp"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,10,"ramp"))}})})}addPermissionLineToMap(e,t,n,i){let o=this.getPermissionMap(e);console.log(o),o.forEach(a=>{t.includes(a.type)&&(a.type===""?this.addLineItem(a.fromKey,a.toKey,a.distance,n):this.addLineItem(a.fromKey,a.toKey,i.get(a.type),n))})}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let l=`${a[s].floor}${It}${a[s].id}`,u=this.pointMap.get(l);if(!(!u||u.permission)){for(let c=0;c<a.length;c++)if(s!==c){let h=`${a[c].floor}${It}${a[c].id}`,f=this.pointMap.get(h);if(!f||f.permission)continue;if(a[s].type==="straightLadder"){let d=t;this.addLineItem(l,h,d,i)}else{let d=n;this.addLineItem(l,h,d,i)}}}}}),this.escalatorMap.forEach((o,a)=>{o.forEach(s=>{if(s.start&&s.end){let l=`${s.start.floor}${It}${s.start.id}`,u=`${s.end.floor}${It}${s.end.id}`,c=this.pointMap.get(l),h=this.pointMap.get(u);if(c&&h&&!c.permission&&!h.permission){let f=e;this.addLineItem(l,u,f,i)}}})})}initBaseRoute(){let e=new Map((0,_n.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new se.default(e)}initEscalatorRoute(){let e=new Map((0,_n.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new se.default(e)}initStraightLadderRoute(){let e=new Map((0,_n.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new se.default(e)}initForwardRoute(){this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${It}${n.start.id}`,o=`${n.end.floor}${It}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&!a.permission&&!s.permission&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.forwardRoute=new se.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${It}${e.nodeId}`);if(t){let[n,i]=t.split(It);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{if(o.relatedId)return i;let a=Jt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:t.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let n=this.parkingMap.get(`${e.floor}${It}${e.parkingSpace}`);if(n)return{floor:e.floor,id:n.id}}let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilities.filter(i=>+i.type_id==+e.facility).map(i=>i.id).map(i=>this.facilityMap.get(`${i}`)).flat(2)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n="",i){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let o=this.transformStart(e);if(!o)return"no-start";let a=this.transformEnd(t);if(!a)return"no-end";let s=this.getBasePath.bind(this);switch(n){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;case"forward":s=this.getForwardPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(a.id)return s(o,a,i);if(a.facility){let u=this.facilities.filter(h=>+h.type_id==+t.facility).map(h=>h.id).map(h=>this.facilityMap.get(`${h}`)).flat(2).filter(h=>h).filter(h=>a.floor?h.floor===a.floor:!0);if(!u.length)return null;let c=u.map(h=>s(o,{floor:h.floor,id:h.id},i)).filter(h=>!!h);return c.reduce((h,f)=>{let d=f[0].consume;return d<h.distance&&(h.distance=d,h.path=f),h},{distance:1/0,path:c[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${It}${e.id}`,o=`${t.floor}${It}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[],l=a.reduce((u,c,h,f)=>{if(h===0)return 0;let d=f[h-1],m=n.graph.get(d).get(c);return u+m},0);return a.map(u=>{let c=this.pointMap.get(u);if(c){let{floor:h}=c,f=c.type;if(this.isFacilityByType(c.type)){let d=this.facilities.find(m=>m.id===+c.targetId);d&&(f=d.entry_infra_type)}if(s[s.length-1]?.floor===h){let d=s[s.length-1];d.points.push(c.cds),d.endType=f,d.destId=c.nodeId,d.distance=qe(d.points)}else s.push({floor:h,points:[c.cds],endType:f,destId:c.nodeId,distance:0,consume:l})}}),s}getBasePath(e,t,n){if(!n)return this.getRoutePath(e,t,this.baseRoute);let i=(0,_n.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let o=new se.default(i);return this.getRoutePath(e,t,o)}getEscalatorPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.escalatorRoute);let i=(0,_n.cloneDeep)(this.escalatorRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",1*o],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]));let a=new se.default(i);return this.getRoutePath(e,t,a)}getStraightLadderPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.straightLadderRoute);let i=(0,_n.cloneDeep)(this.straightLadderRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",3*o],["straightLadder",1*o],["staircase",3e4*o]]));let a=new se.default(i);return this.getRoutePath(e,t,a)}getForwardPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.forwardRoute);let i=(0,_n.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],i,new Map([["ramp",10]]));let o=new se.default(i);return this.getRoutePath(e,t,o)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new se.default,this.escalatorRoute=new se.default,this.straightLadderRoute=new se.default}};var Ln=class{static keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let e=this.createKey();for(;this.keySet.has(e);)e=this.createKey();return e}static removeKey(e){this.keySet.delete(e)}static dispose(){this.keySet.clear()}};function Ys(r){return r.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function nn(r,e,t){return new Promise((n,i)=>{let o=Ln.genUniqueKey(),a=({data:s})=>{s.type===`${e}_result`&&s.key===o&&(Ln.removeKey(o),self.removeEventListener("message",a),s.error?i(s.error):n(s.data))};r.addEventListener("message",a),r.postMessage({type:e,key:o,data:t})})}function Oy(r){let e={};for(let n in r)n.startsWith("on")&&(e[Ys(n.slice(2))]=r[n]);let t=async({data:n})=>{if(e[n.type])try{let i=await e[n.type](n.data);self.postMessage({type:`${n.type}_result`,key:n.key,data:i})}catch(i){self.postMessage({type:`${n.type}_result`,key:n.key,error:i})}else self.postMessage({type:`${n.type}_result`,key:n.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var Ze=j("three");function ky(r,e=16711680){let t=new Ze.LineBasicMaterial({color:e}),n=new Ze.BufferGeometry().setFromPoints(r);return new Ze.Line(n,t)}function Xy(r,e=16711680){let t=new Ze.LineBasicMaterial({color:e}),n=new Ze.BoxGeometry(1,1,1),i=new Ze.Mesh(n,t);return i.position.copy(r),i}function Ae(r,e,t=0){r.forEach(n=>{n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"?(n.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=e[0],o[1]-=e[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(i=>i.map(o=>Qe(o,e)))),n.doors?.length&&n.doors.map(i=>{i.coord=Qe(i.coordinate,e)}),n.center&&(n.center=Qe(n.center,e))):n.geometry.coords=Qe(n.geometry.cds,e)});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(t+n+1)}}function Qe(r,e){return[r[0]-e[0],r[1]-e[1]]}var Zs=j("@tweenjs/tween.js"),vn=class{pauseTween=!1;tweenStore=new Set;group=new Zs.Group;constructor(){}update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(e=>{this.tweenStore.add(e),e.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(e=>{e.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(e){this.group.remove(e)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(e=>e.stop()),this.group.removeAll()}dispose(){this.clear()}};var Qs=j("three"),ti=class extends Qs.EventDispatcher{constructor(t){super();this.ctn=t;this.registryEvent()}point;registryEvent(){this.ctn.addEventListener("pointerdown",this._pointerDown),this.ctn.addEventListener("pointerup",this._pointerUp)}unRegistryEvent(){this.ctn.removeEventListener("pointerdown",this._pointerDown),this.ctn.removeEventListener("pointerup",this._pointerUp)}_pointerDown=t=>{this.point={x:t.offsetX,y:t.offsetY}};_pointerUp=t=>{if(!this.point)return;let{offsetX:n,offsetY:i}=t,{x:o,y:a}=this.point;Math.hypot(o-n+(a-i))>3||this.dispatchEvent({type:"click",e:t})};dispose(){this.unRegistryEvent()}};var Gs=j("lodash"),Hs=j("three"),Un=class extends Hs.EventDispatcher{_task=[];started=!1;activeTask=null;_id=0;constructor(e=!0){super(),e&&this.start()}_isEffectiveTask(e){return e&&typeof e.run=="function"}_getIndexByTid(e){return this._task.findIndex(t=>t.tid===e)}_createTask(e){return this._isEffectiveTask(e)?{...e,tid:++this._id,meta:e.meta||{}}:!1}get task(){return[...this._task]}getTasks(){return[...this._task]}add(e){if(this._isEffectiveTask(e)){let t=this._createTask(e);return this._task.push(t),this.started&&!this.activeTask&&this.start(),t.tid}return!1}replace(e,t){if(!this._isEffectiveTask(t))return console.warn("[TaskQueue] replace\u65B9\u6CD5\u4F20\u5165\u7684task\u53C2\u6570\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;let n=this._getIndexByTid(e);if(n===-1)return console.warn(`[TaskQueue] \u6CA1\u6709\u627E\u5230id=${e}\u7684\u4EFB\u52A1`),!1;let i=this._createTask(t);return this._task.splice(n,1,i),i.tid}replaceByMetaType(e){let t=e.meta?.type;if((0,Gs.isNil)(t))return this.add(e);{let n=this._task.find(i=>i.meta.type===t);return n?this.replace(n.tid,e):this.add(e)}}remove(e){let t=this._getIndexByTid(e);return t===-1?(console.warn(`[TaskQueue] remove\u65B9\u6CD5\u4F20\u5165\u7684id\uFF1A${e}\u627E\u4E0D\u5230\u5BF9\u5E94\u7684task`),!1):(this._task.splice(t,1),!0)}clear(){this._task.length=0}start(){this.started=!0,!this.activeTask&&this._task.length&&this.exec()}stop(){this.started=!1}async exec(){if(!this.started||!this._task.length)return!1;let e=this._task.shift();this.activeTask=e,this.dispatchEvent({type:"active-task-start",task:e});let t;try{t=await e.run()}catch(n){console.warn("[task run err]",n,e)}return this.activeTask=null,this.dispatchEvent({type:"active-task-end",task:e,res:t}),this.exec()}};var bt=j("three");var du=j("three");var st=j("three");var $s=j("three/examples/jsm/lines/LineMaterial"),de=j("three");function Ks(r){return`${r.x}-${r.y}-${r.z}`}var Zt=class{static lineMaterialMap=new Map;static meshStandardMaterialMap=new Map;static meshBasicMaterialMap=new Map;static shaderMaterialMap=new Map;static line2MaterialMap=new Map;static generateLineMaterialKey({color:e,opacity:t}){return`${e}-${t}`}static createLineMaterial({color:e,opacity:t}){let n=this.generateLineMaterialKey({color:e,opacity:t});if(this.lineMaterialMap.has(n))return this.lineMaterialMap.get(n);let i=new de.LineBasicMaterial({color:new de.Color(e).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(n,i),i}static createMeshStandardMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new de.MeshStandardMaterial({color:new de.Color(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshBasicMaterialMap.has(n))return this.meshBasicMaterialMap.get(n);let i=new de.MeshBasicMaterial({color:e,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(n,i),i}static createShaderMaterial({gradualColor:e,center:t,maxValue:n,opacity:i,direction:o,max:a,min:s}){let l=`${e.toString()}-${Ks(t)}-${n}-${i}-${Ks(o)}`;if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let u=`
2
2
  uniform vec3 uColor;
3
3
  uniform vec3 uGradualColor;
4
4
  uniform vec3 center;
@@ -59,7 +59,7 @@ export default class TaskQueue extends EventDispatcher<TaskEventMap> {
59
59
  * @param task
60
60
  */
61
61
  replace(id: number, task: MakeOptional<Task, "meta" | "tid">): number | false;
62
- replaceByMetaType(task: MakeOptional<Task, "meta" | "tid">): number | false | undefined;
62
+ replaceByMetaType(task: MakeOptional<Task, "meta" | "tid">): number | false;
63
63
  /**
64
64
  * 根据id删除对应的task
65
65
  * @param id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aibee/crc-bmap",
3
- "version": "0.8.11",
3
+ "version": "0.8.12",
4
4
  "description": "",
5
5
  "main": "lib/bmap.min.js",
6
6
  "module": "lib/bmap.esm.js",