@aibee/crc-bmap 0.12.48 → 0.12.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs CHANGED
@@ -11810,7 +11810,7 @@ void main() {
11810
11810
  \`)};function og(n,t,e){this.x=n,this.y=t,this.weight=e}og.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};og.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};og.prototype.isWall=function(){return this.weight===0};function F2(n){this.content=[],this.scoreFunction=n}F2.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,i=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(i))this.content[e]=t,this.content[n]=i,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],i=this.scoreFunction(e);;){var s=n+1<<1,u=s-1,c=null,f;if(u<t){var p=this.content[u];f=this.scoreFunction(p),f<i&&(c=u)}if(s<t){var d=this.content[s],g=this.scoreFunction(d);g<(c===null?i:f)&&(c=s)}if(c!==null)this.content[n]=this.content[c],this.content[c]=e,n=c;else break}}};function Fx(){this._=null}function jl(n){n.U=n.C=n.L=n.R=n.P=n.N=null}Fx.prototype={constructor:Fx,insert:function(n,t){var e,i,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=U2(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)i=e.U,e===i.L?(s=i.R,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.R&&(Ff(this,e),n=e,e=n.U),e.C=!1,i.C=!0,Uf(this,i))):(s=i.L,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.L&&(Uf(this,e),n=e,e=n.U),e.C=!1,i.C=!0,Ff(this,i))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,i=n.L,s=n.R,u,c;if(i?s?u=U2(s):u=i:u=s,t?t.L===n?t.L=u:t.R=u:this._=u,i&&s?(c=u.C,u.C=n.C,u.L=i,i.U=u,u!==s?(t=u.U,u.U=n.U,n=u.R,t.L=n,u.R=s,s.U=u):(u.U=t,t=u,n=u.R)):(c=n.C,n=u),n&&(n.U=t),!c){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Ff(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,Uf(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Ff(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,Uf(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Ff(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,Uf(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function Ff(n,t){var e=t,i=t.R,s=e.U;s?s.L===e?s.L=i:s.R=i:n._=i,i.U=s,e.U=i,e.R=i.L,e.R&&(e.R.U=e),i.L=e}function Uf(n,t){var e=t,i=t.L,s=e.U;s?s.L===e?s.L=i:s.R=i:n._=i,i.U=s,e.U=i,e.L=i.R,e.L&&(e.L.U=e),i.R=e}function U2(n){for(;n.L;)n=n.L;return n}var Ux=Fx;function Kl(n,t,e,i){var s=[null,null],u=kr.push(s)-1;return s.left=n,s.right=t,e&&Bf(s,n,t,e),i&&Bf(s,t,n,i),Ti[n.index].halfedges.push(u),Ti[t.index].halfedges.push(u),s}function Ql(n,t,e){var i=[t,e];return i.left=n,i}function Bf(n,t,e,i){!n[0]&&!n[1]?(n[0]=i,n.left=t,n.right=e):n.left===e?n[1]=i:n[0]=i}function PK(n,t,e,i,s){var u=n[0],c=n[1],f=u[0],p=u[1],d=c[0],g=c[1],y=0,v=1,E=d-f,M=g-p,A;if(A=t-f,!(!E&&A>0)){if(A/=E,E<0){if(A<y)return;A<v&&(v=A)}else if(E>0){if(A>v)return;A>y&&(y=A)}if(A=i-f,!(!E&&A<0)){if(A/=E,E<0){if(A>v)return;A>y&&(y=A)}else if(E>0){if(A<y)return;A<v&&(v=A)}if(A=e-p,!(!M&&A>0)){if(A/=M,M<0){if(A<y)return;A<v&&(v=A)}else if(M>0){if(A>v)return;A>y&&(y=A)}if(A=s-p,!(!M&&A<0)){if(A/=M,M<0){if(A>v)return;A>y&&(y=A)}else if(M>0){if(A<y)return;A<v&&(v=A)}return!(y>0)&&!(v<1)||(y>0&&(n[0]=[f+y*E,p+y*M]),v<1&&(n[1]=[f+v*E,p+v*M])),!0}}}}}function RK(n,t,e,i,s){var u=n[1];if(u)return!0;var c=n[0],f=n.left,p=n.right,d=f[0],g=f[1],y=p[0],v=p[1],E=(d+y)/2,M=(g+v)/2,A,_;if(v===g){if(E<t||E>=i)return;if(d>y){if(!c)c=[E,e];else if(c[1]>=s)return;u=[E,s]}else{if(!c)c=[E,s];else if(c[1]<e)return;u=[E,e]}}else if(A=(d-y)/(v-g),_=M-A*E,A<-1||A>1)if(d>y){if(!c)c=[(e-_)/A,e];else if(c[1]>=s)return;u=[(s-_)/A,s]}else{if(!c)c=[(s-_)/A,s];else if(c[1]<e)return;u=[(e-_)/A,e]}else if(g<v){if(!c)c=[t,A*t+_];else if(c[0]>=i)return;u=[i,A*i+_]}else{if(!c)c=[i,A*i+_];else if(c[0]<t)return;u=[t,A*t+_]}return n[0]=c,n[1]=u,!0}function B2(n,t,e,i){for(var s=kr.length,u;s--;)(!RK(u=kr[s],n,t,e,i)||!PK(u,n,t,e,i)||!(Math.abs(u[0][0]-u[1][0])>Ln||Math.abs(u[0][1]-u[1][1])>Ln))&&delete kr[s]}function z2(n){return Ti[n.index]={site:n,halfedges:[]}}function LK(n,t){var e=n.site,i=t.left,s=t.right;return e===s&&(s=i,i=e),s?Math.atan2(s[1]-i[1],s[0]-i[0]):(e===i?(i=t[1],s=t[0]):(i=t[0],s=t[1]),Math.atan2(i[0]-s[0],s[1]-i[1]))}function Bx(n,t){return t[+(t.left!==n.site)]}function NK(n,t){return t[+(t.left===n.site)]}function G2(){for(var n=0,t=Ti.length,e,i,s,u;n<t;++n)if((e=Ti[n])&&(u=(i=e.halfedges).length)){var c=new Array(u),f=new Array(u);for(s=0;s<u;++s)c[s]=s,f[s]=LK(e,kr[i[s]]);for(c.sort(function(p,d){return f[d]-f[p]}),s=0;s<u;++s)f[s]=i[c[s]];for(s=0;s<u;++s)i[s]=f[s]}}function k2(n,t,e,i){var s=Ti.length,u,c,f,p,d,g,y,v,E,M,A,_,x=!0;for(u=0;u<s;++u)if(c=Ti[u]){for(f=c.site,d=c.halfedges,p=d.length;p--;)kr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)M=NK(c,kr[d[p]]),A=M[0],_=M[1],y=Bx(c,kr[d[++p%g]]),v=y[0],E=y[1],(Math.abs(A-v)>Ln||Math.abs(_-E)>Ln)&&(d.splice(p,0,kr.push(Ql(f,M,Math.abs(A-n)<Ln&&i-_>Ln?[n,Math.abs(v-n)<Ln?E:i]:Math.abs(_-i)<Ln&&e-A>Ln?[Math.abs(E-i)<Ln?v:e,i]:Math.abs(A-e)<Ln&&_-t>Ln?[e,Math.abs(v-e)<Ln?E:t]:Math.abs(_-t)<Ln&&A-n>Ln?[Math.abs(E-t)<Ln?v:n,t]:null))-1),++g);g&&(x=!1)}if(x){var T,w,R,B=1/0;for(u=0,x=null;u<s;++u)(c=Ti[u])&&(f=c.site,T=f[0]-n,w=f[1]-t,R=T*T+w*w,R<B&&(B=R,x=c));if(x){var U=[n,t],D=[n,i],P=[e,i],ct=[e,t];x.halfedges.push(kr.push(Ql(f=x.site,U,D))-1,kr.push(Ql(f,D,P))-1,kr.push(Ql(f,P,ct))-1,kr.push(Ql(f,ct,U))-1)}}for(u=0;u<s;++u)(c=Ti[u])&&(c.halfedges.length||delete Ti[u])}var q2=[],sg;function OK(){jl(this),this.x=this.y=this.arc=this.site=this.cy=null}function vu(n){var t=n.P,e=n.N;if(!(!t||!e)){var i=t.site,s=n.site,u=e.site;if(i!==u){var c=s[0],f=s[1],p=i[0]-c,d=i[1]-f,g=u[0]-c,y=u[1]-f,v=2*(p*y-d*g);if(!(v>=-V2)){var E=p*p+d*d,M=g*g+y*y,A=(y*E-d*M)/v,_=(p*M-g*E)/v,x=q2.pop()||new OK;x.arc=n,x.site=s,x.x=A+c,x.y=(x.cy=_+f)+Math.sqrt(A*A+_*_),n.circle=x;for(var T=null,w=tc._;w;)if(x.y<w.y||x.y===w.y&&x.x<=w.x)if(w.L)w=w.L;else{T=w.P;break}else if(w.R)w=w.R;else{T=w;break}tc.insert(T,x),T||(sg=x)}}}}function _u(n){var t=n.circle;t&&(t.P||(sg=t.N),tc.remove(t),q2.push(t),jl(t),n.circle=null)}var W2=[];function DK(){jl(this),this.edge=this.site=this.circle=null}function H2(n){var t=W2.pop()||new DK;return t.site=n,t}function zx(n){_u(n),xu.remove(n),W2.push(n),jl(n)}function X2(n){var t=n.circle,e=t.x,i=t.cy,s=[e,i],u=n.P,c=n.N,f=[n];zx(n);for(var p=u;p.circle&&Math.abs(e-p.circle.x)<Ln&&Math.abs(i-p.circle.cy)<Ln;)u=p.P,f.unshift(p),zx(p),p=u;f.unshift(p),_u(p);for(var d=c;d.circle&&Math.abs(e-d.circle.x)<Ln&&Math.abs(i-d.circle.cy)<Ln;)c=d.N,f.push(d),zx(d),d=c;f.push(d),_u(d);var g=f.length,y;for(y=1;y<g;++y)d=f[y],p=f[y-1],Bf(d.edge,p.site,d.site,s);p=f[0],d=f[g-1],d.edge=Kl(p.site,d.site,null,s),vu(p),vu(d)}function Y2(n){for(var t=n[0],e=n[1],i,s,u,c,f=xu._;f;)if(u=$2(f,e)-t,u>Ln)f=f.L;else if(c=t-FK(f,e),c>Ln){if(!f.R){i=f;break}f=f.R}else{u>-Ln?(i=f.P,s=f):c>-Ln?(i=f,s=f.N):i=s=f;break}z2(n);var p=H2(n);if(xu.insert(i,p),!(!i&&!s)){if(i===s){_u(i),s=H2(i.site),xu.insert(p,s),p.edge=s.edge=Kl(i.site,p.site),vu(i),vu(s);return}if(!s){p.edge=Kl(i.site,p.site);return}_u(i),_u(s);var d=i.site,g=d[0],y=d[1],v=n[0]-g,E=n[1]-y,M=s.site,A=M[0]-g,_=M[1]-y,x=2*(v*_-E*A),T=v*v+E*E,w=A*A+_*_,R=[(_*T-E*w)/x+g,(v*w-A*T)/x+y];Bf(s.edge,d,M,R),p.edge=Kl(d,n,null,R),s.edge=Kl(n,M,null,R),vu(i),vu(s)}}function $2(n,t){var e=n.site,i=e[0],s=e[1],u=s-t;if(!u)return i;var c=n.P;if(!c)return-1/0;e=c.site;var f=e[0],p=e[1],d=p-t;if(!d)return f;var g=f-i,y=1/u-1/d,v=g/d;return y?(-v+Math.sqrt(v*v-2*y*(g*g/(-2*d)-p+d/2+s-u/2)))/y+i:(i+f)/2}function FK(n,t){var e=n.N;if(e)return $2(e,t);var i=n.site;return i[1]===t?i[0]:1/0}var Ln=1e-6,V2=1e-12,xu,Ti,tc,kr;function UK(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function BK(n,t){return t[1]-n[1]||t[0]-n[0]}function ag(n,t){var e=n.sort(BK).pop(),i,s,u;for(kr=[],Ti=new Array(n.length),xu=new Ux,tc=new Ux;;)if(u=sg,e&&(!u||e[1]<u.y||e[1]===u.y&&e[0]<u.x))(e[0]!==i||e[1]!==s)&&(Y2(e),i=e[0],s=e[1]),e=n.pop();else if(u)X2(u.arc);else break;if(G2(),t){var c=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];B2(c,f,p,d),k2(c,f,p,d)}this.edges=kr,this.cells=Ti,xu=tc=kr=Ti=null}ag.prototype={constructor:ag,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(i){return Bx(t,n[i])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,i){if(f=(u=e.halfedges).length)for(var s=e.site,u,c=-1,f,p,d=t[u[f-1]],g=d.left===s?d.right:d.left;++c<f;)p=g,d=t[u[c]],g=d.left===s?d.right:d.left,p&&g&&i<p.index&&i<g.index&&UK(s,p,g)<0&&n.push([s.data,p.data,g.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var i=this,s,u=i._found||0,c=i.cells.length,f;!(f=i.cells[u]);)if(++u>=c)return null;var p=n-f.site[0],d=t-f.site[1],g=p*p+d*d;do f=i.cells[s=u],u=null,f.halfedges.forEach(function(y){var v=i.edges[y],E=v.left;if(!((E===f.site||!E)&&!(E=v.right))){var M=n-E[0],A=t-E[1],_=M*M+A*A;_<g&&(g=_,u=E.index)}});while(u!==null);return i._found=s,e==null||g<=e*e?f.site:null}};var XK=Qt(ec(),1);var t1=Qt(K2(),1);function Di(){return new cg}function cg(){this.reset()}cg.prototype={constructor:cg,reset:function(){this.s=this.t=0},add:function(n){Q2(lg,n,this.t),Q2(this,lg.s,this.s),this.s?this.t+=lg.t:this.s=lg.t},valueOf:function(){return this.s}};var lg=new cg;function Q2(n,t,e){var i=n.s=t+e,s=i-t,u=i-s;n.t=t-u+(e-s)}var yn=1e-6;var Tn=Math.PI,br=Tn/2,fg=Tn/4,os=Tn*2,Eu=180/Tn,Fi=Tn/180,nr=Math.abs,Uo=Math.atan,Ui=Math.atan2,hn=Math.cos;var hg=Math.exp;var zf=Math.log;var Me=Math.sin;var jr=Math.sqrt,Gf=Math.tan;function qx(n){return n>1?0:n<-1?Tn:Math.acos(n)}function Ci(n){return n>1?br:n<-1?-br:Math.asin(n)}function Bo(){}var YK=Di(),k0t=Di();function Su(n){var t=n[0],e=n[1],i=hn(e);return[i*hn(t),i*Me(t),Me(e)]}function kf(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function qf(n){var t=jr(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var j0t=Di();function eO(n,t){return[n>Tn?n-os:n<-Tn?n+os:n,t]}eO.invert=eO;function Vx(){var n=[],t;return{point:function(e,i){t.push([e,i])},lineStart:function(){n.push(t=[])},lineEnd:Bo,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Hx(n,t){return nr(n[0]-t[0])<yn&&nr(n[1]-t[1])<yn}function pg(n,t,e,i){this.x=n,this.z=t,this.o=e,this.e=i,this.v=!1,this.n=this.p=null}function Wx(n,t,e,i,s){var u=[],c=[],f,p;if(n.forEach(function(M){if(!((A=M.length-1)<=0)){var A,_=M[0],x=M[A],T;if(Hx(_,x)){for(s.lineStart(),f=0;f<A;++f)s.point((_=M[f])[0],_[1]);s.lineEnd();return}u.push(T=new pg(_,M,null,!0)),c.push(T.o=new pg(_,null,T,!1)),u.push(T=new pg(x,M,null,!1)),c.push(T.o=new pg(x,null,T,!0))}}),!!u.length){for(c.sort(t),nO(u),nO(c),f=0,p=c.length;f<p;++f)c[f].e=e=!e;for(var d=u[0],g,y;;){for(var v=d,E=!0;v.v;)if((v=v.n)===d)return;g=v.z,s.lineStart();do{if(v.v=v.o.v=!0,v.e){if(E)for(f=0,p=g.length;f<p;++f)s.point((y=g[f])[0],y[1]);else i(v.x,v.n.x,1,s);v=v.n}else{if(E)for(g=v.p.z,f=g.length-1;f>=0;--f)s.point((y=g[f])[0],y[1]);else i(v.x,v.p.x,-1,s);v=v.p}v=v.o,g=v.z,E=!E}while(!v.v);s.lineEnd()}}}function nO(n){if(t=n.length){for(var t,e=0,i=n[0],s;++e<t;)i.n=s=n[e],s.p=i,i=s;i.n=s=n[0],s.p=i}}function Aa(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function Xx(n){return n.length===1&&(n=JK(n)),{left:function(t,e,i,s){for(i==null&&(i=0),s==null&&(s=t.length);i<s;){var u=i+s>>>1;n(t[u],e)<0?i=u+1:s=u}return i},right:function(t,e,i,s){for(i==null&&(i=0),s==null&&(s=t.length);i<s;){var u=i+s>>>1;n(t[u],e)>0?s=u:i=u+1}return i}}}function JK(n){return function(t,e){return Aa(n(t),e)}}var rO=Xx(Aa),jK=rO.right,KK=rO.left;var iO=Array.prototype,tQ=iO.slice,eQ=iO.map;var Vyt=Math.sqrt(50),Hyt=Math.sqrt(10),Wyt=Math.sqrt(2);function gg(n){for(var t=n.length,e,i=-1,s=0,u,c;++i<t;)s+=n[i].length;for(u=new Array(s);--t>=0;)for(c=n[t],e=c.length;--e>=0;)u[--s]=c[e];return u}var lQ=1e9,C_t=-lQ;var Yx=Di();function $x(n,t){var e=t[0],i=t[1],s=[Me(e),-hn(e),0],u=0,c=0;Yx.reset();for(var f=0,p=n.length;f<p;++f)if(g=(d=n[f]).length)for(var d,g,y=d[g-1],v=y[0],E=y[1]/2+fg,M=Me(E),A=hn(E),_=0;_<g;++_,v=T,M=R,A=B,y=x){var x=d[_],T=x[0],w=x[1]/2+fg,R=Me(w),B=hn(w),U=T-v,D=U>=0?1:-1,P=D*U,ct=P>Tn,L=M*R;if(Yx.add(Ui(L*D*Me(P),A*B+L*hn(P))),u+=ct?U+D*os:U,ct^v>=e^T>=e){var W=kf(Su(y),Su(x));qf(W);var V=kf(s,W);qf(V);var Mt=(ct^U>=0?-1:1)*Ci(V[2]);(i>Mt||i===Mt&&(W[0]||W[1]))&&(c+=ct^U>=0?1:-1)}}return(u<-yn||u<yn&&Yx<-yn)^c&1}var B_t=Di();var rxt=Di(),ixt=Di();var hQ=1/0;var axt=-hQ;function Zx(n){this._context=n}Zx.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,os);break}}},result:Bo};var yxt=Di();function Jx(){this._string=[]}Jx.prototype={_radius:4.5,_circle:aO(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=aO(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function aO(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function jx(n,t,e,i){return function(s,u){var c=t(u),f=s.invert(i[0],i[1]),p=Vx(),d=t(p),g=!1,y,v,E,M={point:A,lineStart:x,lineEnd:T,polygonStart:function(){M.point=w,M.lineStart=R,M.lineEnd=B,v=[],y=[]},polygonEnd:function(){M.point=A,M.lineStart=x,M.lineEnd=T,v=gg(v);var U=$x(y,f);v.length?(g||(u.polygonStart(),g=!0),Wx(v,gQ,U,e,u)):U&&(g||(u.polygonStart(),g=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),g&&(u.polygonEnd(),g=!1),v=y=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function A(U,D){var P=s(U,D);n(U=P[0],D=P[1])&&u.point(U,D)}function _(U,D){var P=s(U,D);c.point(P[0],P[1])}function x(){M.point=_,c.lineStart()}function T(){M.point=A,c.lineEnd()}function w(U,D){E.push([U,D]);var P=s(U,D);d.point(P[0],P[1])}function R(){d.lineStart(),E=[]}function B(){w(E[0][0],E[0][1]),d.lineEnd();var U=d.clean(),D=p.result(),P,ct=D.length,L,W,V;if(E.pop(),y.push(E),E=null,!!ct){if(U&1){if(W=D[0],(L=W.length-1)>0){for(g||(u.polygonStart(),g=!0),u.lineStart(),P=0;P<L;++P)u.point((V=W[P])[0],V[1]);u.lineEnd()}return}ct>1&&U&2&&D.push(D.pop().concat(D.shift())),v.push(D.filter(dQ))}}return M}}function dQ(n){return n.length>1}function gQ(n,t){return((n=n.x)[0]<0?n[1]-br-yn:br-n[1])-((t=t.x)[0]<0?t[1]-br-yn:br-t[1])}var mQ=jx(function(){return!0},yQ,_Q,[-Tn,-br]);function yQ(n){var t=NaN,e=NaN,i=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(u,c){var f=u>0?Tn:-Tn,p=nr(u-t);nr(p-Tn)<yn?(n.point(t,e=(e+c)/2>0?br:-br),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),n.point(u,e),s=0):i!==f&&p>=Tn&&(nr(t-i)<yn&&(t-=i*yn),nr(u-f)<yn&&(u-=f*yn),e=vQ(t,e,u,c),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),s=0),n.point(t=u,e=c),i=f},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function vQ(n,t,e,i){var s,u,c=Me(n-e);return nr(c)>yn?Uo((Me(t)*(u=hn(i))*Me(e)-Me(i)*(s=hn(t))*Me(n))/(s*u*c)):(t+i)/2}function _Q(n,t,e,i){var s;if(n==null)s=e*br,i.point(-Tn,s),i.point(0,s),i.point(Tn,s),i.point(Tn,0),i.point(Tn,-s),i.point(0,-s),i.point(-Tn,-s),i.point(-Tn,0),i.point(-Tn,s);else if(nr(n[0]-t[0])>yn){var u=n[0]<t[0]?Tn:-Tn;s=e*u/2,i.point(-u,s),i.point(0,s),i.point(u,s)}else i.point(t[0],t[1])}function mg(n){return function(t){var e=new Kx;for(var i in n)e[i]=n[i];return e.stream=t,e}}function Kx(){}Kx.prototype={constructor:Kx,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var i1t=hn(30*Fi);var v1t=mg({point:function(n,t){this.stream.point(n*Fi,t*Fi)}});function yg(n){return function(t,e){var i=hn(t),s=hn(e),u=n(i*s);return[u*s*Me(t),u*Me(e)]}}function ss(n){return function(t,e){var i=jr(t*t+e*e),s=n(i),u=Me(s),c=hn(s);return[Ui(t*u,i*c),Ci(i&&e*u/i)]}}var dO=yg(function(n){return jr(2/(1+n))});dO.invert=ss(function(n){return 2*Ci(n/2)});var gO=yg(function(n){return(n=qx(n))&&n/Me(n)});gO.invert=ss(function(n){return n});function Qx(n,t){return[n,zf(Gf((br+t)/2))]}Qx.invert=function(n,t){return[n,2*Uo(hg(t))-br]};function vg(n,t){return[n,t]}vg.invert=vg;function mO(n,t){var e=hn(t),i=hn(n)*e;return[e*Me(n)/i,Me(t)/i]}mO.invert=ss(Uo);function yO(n,t){var e=t*t,i=e*e;return[n*(.8707-.131979*e+i*(-.013791+i*(.003971*e-.001529*i))),t*(1.007226+e*(.015085+i*(-.044475+.028874*e-.005916*i)))]}yO.invert=function(n,t){var e=t,i=25,s;do{var u=e*e,c=u*u;e-=s=(e*(1.007226+u*(.015085+c*(-.044475+.028874*u-.005916*c)))-t)/(1.007226+u*(.015085*3+c*(-.044475*7+.028874*9*u-.005916*11*c)))}while(nr(s)>yn&&--i>0);return[n/(.8707+(u=e*e)*(-.131979+u*(-.013791+u*u*u*(.003971-.001529*u)))),e]};function vO(n,t){return[hn(t)*Me(n),Me(t)]}vO.invert=ss(Ci);function _O(n,t){var e=hn(t),i=1+hn(n)*e;return[e*Me(n)/i,Me(t)/i]}_O.invert=ss(function(n){return 2*Uo(n)});function xO(n,t){return[zf(Gf((br+t)/2)),-n]}xO.invert=function(n,t){return[-t,2*Uo(hg(n))-br]};var bQ=Qt(ec(),1);var AQ=Qt(ec(),1);var CQ=Qt(ec(),1);var IQ=Qt(ec(),1);function SO(n,t){let e=0,i=1/0,[s,u]=t;for(let c=0;c<n.length-1;c++){let[f,p]=n[c],[d,g]=n[c+1],y=Math.min(f,d)<=s&&s<=Math.max(f,d),v=Math.min(p,g)<=u&&u<=Math.max(p,g);if(y&&v){let E=Math.abs((d-f)*(u-p)-(g-p)*(s-f));E<i&&(i=E,e=c)}}return e}function wO(n,t){let e=n[0],i=n[1],s=!1;for(let u=0,c=t.length-1;u<t.length;c=u++){let f=t[u][0],p=t[u][1],d=t[c][0],g=t[c][1];p>i!=g>i&&e<(d-f)*(i-p)/(g-p)+f&&(s=!s)}return s}var NAt=Qt(ZO(),1),OAt=Qt(o_(),1);function aD(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function uD(n){let t={};for(let i in n)i.startsWith("on")&&(t[aD(i.slice(2))]=n[i]);let e=i=>Ri(this,null,function*(){let{data:s}=i;if(t[s.type])try{let u=yield t[s.type](s.data);if(u!=null&&u.$transfer&&Array.isArray(u.$transfer)){let c=u.$transfer;delete u.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:u},c)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:u})}catch(u){self.postMessage({type:""+s.type+"_result",key:s.key,error:u})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var qAt=Qt(bD(),1),VAt=Qt(Bc(),1);function AD(n,t,e){e===void 0&&(e=0),n.forEach(i=>{if(i.geometry.coords=JSON.parse(JSON.stringify(i.geometry.cds)),i.geometry.type==="polygon"){var s;i.geometry.coords.map(u=>{Array.isArray(u)&&u.forEach(c=>{c[0]-=t[0],c[1]-=t[1]})}),i.geometry.otherCds&&(i.geometry.otherCoords=i.geometry.otherCds.map(u=>u.map(c=>ic(c,t)))),(s=i.doors)!=null&&s.length&&i.doors.map(u=>{u.coord=ic(u.coordinate,t)}),i.center&&(i.centerCoords=ic(i.center,t))}else i.geometry.coords=ic(i.geometry.cds,t),i.center&&(i.centerCoords=ic(i.center,t));if(i.center_x&&i.center_y){let[u,c]=ic([i.center_x,i.center_y],t);i.center_coord_x=u,i.center_coord_y=c}});for(let i=0;i<n.length;i++){let s=n[i];s.deltaHeight=1e-5*(e+i+1)}}function ic(n,t){return[n[0]-t[0],n[1]-t[1]]}var jAt=Qt(p0(),1),KAt=Qt(d0(),1),QAt=Qt(g0(),1),tTt=Qt(y0(),1),eTt=Qt(v0(),1),nTt=Qt(S0(),1),rTt=Qt(I0(),1),iTt=Qt(R0(),1),oTt=Qt(L0(),1),sTt=Qt(O0(),1),aTt=Qt(F0(),1),uTt=Qt(G0(),1),lTt=Qt(V0(),1),cTt=Qt(iy(),1),fTt=Qt(oy(),1),hTt=Qt(Sh(),1);function Eg(n,t=!1){let e=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),s=new Set(Object.keys(n[0].morphAttributes)),u={},c={},f=n[0].morphTargetsRelative,p=new ui,d=0;for(let g=0;g<n.length;++g){let y=n[g],v=0;if(e!==(y.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let E in y.attributes){if(!i.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+'. All geometries must have compatible attributes; make sure "'+E+'" attribute exists among all geometries, or in none of them.'),null;u[E]===void 0&&(u[E]=[]),u[E].push(y.attributes[E]),v++}if(v!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". Make sure all geometries have the same number of attributes."),null;if(f!==y.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let E in y.morphAttributes){if(!s.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphAttributes must be consistent throughout all geometries."),null;c[E]===void 0&&(c[E]=[]),c[E].push(y.morphAttributes[E])}if(t){let E;if(e)E=y.index.count;else if(y.attributes.position!==void 0)E=y.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". The geometry must have either an index or a position attribute"),null;p.addGroup(d,E,g),d+=E}}if(e){let g=0,y=[];for(let v=0;v<n.length;++v){let E=n[v].index;for(let M=0;M<E.count;++M)y.push(E.getX(M)+g);g+=n[v].attributes.position.count}p.setIndex(y)}for(let g in u){let y=TD(u[g]);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" attribute."),null;p.setAttribute(g,y)}for(let g in c){let y=c[g][0].length;if(y===0)break;p.morphAttributes=p.morphAttributes||{},p.morphAttributes[g]=[];for(let v=0;v<y;++v){let E=[];for(let A=0;A<c[g].length;++A)E.push(c[g][A][v]);let M=TD(E);if(!M)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" morphAttribute."),null;p.morphAttributes[g].push(M)}}return p}function TD(n){let t,e,i,s=-1,u=0;for(let d=0;d<n.length;++d){let g=n[d];if(t===void 0&&(t=g.array.constructor),t!==g.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=g.itemSize),e!==g.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=g.normalized),i!==g.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(s===-1&&(s=g.gpuType),s!==g.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;u+=g.count*e}let c=new t(u),f=new Yn(c,e,i),p=0;for(let d=0;d<n.length;++d){let g=n[d];if(g.isInterleavedBufferAttribute){let y=p/e;for(let v=0,E=g.count;v<E;v++)for(let M=0;M<e;M++){let A=g.getComponent(v,M);f.setComponent(v+y,M,A)}}else c.set(g.array,p);p+=g.count*e}return s!==void 0&&(f.gpuType=s),f}function CD(n,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=n.filter(f=>f.geometry.type==="polygon");if(!i.length)return null;let s=i.map(f=>{var p;let d=f.geometry.coords,g=fd(d[0],d.slice(1)),y=new rd(g,{steps:1,bevelEnabled:!1,depth:f.height,curveSegments:4});(p=f).deltaHeight||(p.deltaHeight=0),y.translate(0,0,f.airHeight+f.deltaHeight);let v=y.attributes.position.count,E=new Float32Array(v).fill(f.height+f.airHeight+f.deltaHeight);if(y.setAttribute("maxZ",new Yn(E,1)),y.setAttribute("opacity",new Yn(new Float32Array(v).fill(f.fillOpacity),1)),e){let _=new Float32Array(v).fill(f.airHeight+f.deltaHeight);y.setAttribute("minZ",new Yn(_,1))}let M=new Te(f.fillColor).convertLinearToSRGB(),A=new Float32Array(v*3);for(let _=0;_<v;_++)A[_*3]=M.r,A[_*3+1]=M.g,A[_*3+2]=M.b;return y.setAttribute("color",new Yn(A,3)),y}),u=Eg(s);s.forEach(f=>f.dispose());let c={geometry:u};return u.dispose(),t&&(c.lineGeometry=c1(i)||void 0),c}function c1(n){let{points:t,colors:e,opacities:i}=Ktt(n);if(!t.length)return null;let s=new ui().setFromPoints(t);return s.setAttribute("color",new Yn(new Float32Array(e),3)),s.setAttribute("opacity",new Yn(new Float32Array(i),1)),s}function Ktt(n){let t=[],e=[],i=[];return n.filter(s=>s.strokeOpacity>0).map(s=>{let u=s.height+(s.deltaHeight||0)+s.airHeight,{coords:c}=s.geometry,{strokeColor:f,strokeOpacity:p}=s,d=new Te(f).convertLinearToSRGB();for(let g=0;g<c.length;g++){let y=c[g];for(let v=0;v<y.length;v++){let E=y[v],M=v+1===y.length?y[0]:y[v+1];t.push(new st(E[0],E[1],u)),t.push(new st(M[0],M[1],u)),e.push(d.r,d.g,d.b),e.push(d.r,d.g,d.b),i.push(p),i.push(p)}}}),{points:t,colors:e,opacities:i}}var Hf=function(n){return n.HALF="half",n.POWER="power",n.MECHANICAL="mechanical",n.NORMAL="normal",n.VIP="vip",n}({});var ID=new Ko,Sg=new st,wg=class extends sd{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let t=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],e=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new _r(t,3)),this.setAttribute("uv",new _r(e,2))}applyMatrix4(t){let e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return e!==void 0&&(e.applyMatrix4(t),i.applyMatrix4(t),e.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));let i=new gf(e,6,1);return this.setAttribute("instanceStart",new ts(i,3,0)),this.setAttribute("instanceEnd",new ts(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));let i=new gf(e,6,1);return this.setAttribute("instanceColorStart",new ts(i,3,0)),this.setAttribute("instanceColorEnd",new ts(i,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new od(t.geometry)),this}fromLineSegments(t){let e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ko);let t=this.attributes.instanceStart,e=this.attributes.instanceEnd;t!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(t),ID.setFromBufferAttribute(e),this.boundingBox.union(ID))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new uu),this.boundingBox===null&&this.computeBoundingBox();let t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(t!==void 0&&e!==void 0){let i=this.boundingSphere.center;this.boundingBox.getCenter(i);let s=0;for(let u=0,c=t.count;u<c;u++)Sg.fromBufferAttribute(t,u),s=Math.max(s,i.distanceToSquared(Sg)),Sg.fromBufferAttribute(e,u),s=Math.max(s,i.distanceToSquared(Sg));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}};var xTt=Qt(sD(),1);var Mg=function(n){return n.LAYERED_RENDER_VERSION="layeredRender",n.MERGED_RENDER_VERSION="mergedRender",n}({});var f1=["range","ground","store","facility","parkingSpace"];function PD(n){return f1.indexOf(n.l_type)===-1?f1.length:f1.indexOf(n.l_type)}function Qtt(n){n.layers.sort((t,e)=>PD(t)-PD(e))}function tet(n){let t=n.layers.find(i=>i.l_type==="range"),e=[t.elements[0].center_x,t.elements[0].center_y];n.layers.map(i=>{if(i.l_type!=="range")return AD(i.elements,e)})}function RD(n){Qtt(n),tet(n)}function bg(n,t){return t===void 0&&(t=4),n.floor_id+"_"+n.version_id+(t?"_"+t:"")}var oc=[],sc=[];function eet(n,t){return Ri(this,null,function*(){return yield rp(),fy(n,""+t)})}function LD(n,t,e){return Ri(this,null,function*(){let{db:i}=yield rp();return cC(n,""+t,e,i)})}function net(n){return Ri(this,null,function*(){let t=yield fetch(n.map_url).then(e=>e.json());return t.floor=n.floor,RD(t),oc.push(t),t})}function ret(n,t){return Ri(this,null,function*(){let e=bg(n,t===Mg.LAYERED_RENDER_VERSION?1:void 0);try{let i=yield eet(np.MAP_DATA,e);return i&&(t===Mg.LAYERED_RENDER_VERSION||i.transformed)?(console.log("\\u4ECE\\u7F13\\u5B58\\u4E2D\\u53D6\\u5230\\u4E86\\u6570\\u636E"),i):(console.log("\\u7F13\\u5B58\\u4E2D\\u6CA1\\u6709\\u6570\\u636E",e,i),sc.push(n),null)}catch(i){return console.log("[get floor data error]",i),sc.push(n),null}})}function iet(n,t){return t===void 0&&(t=!0),t&&(n.layers.forEach(e=>{switch(e.l_type){case"ground":if(e.elements.length<2)break;e.mergedElements=Wf(e.elements);break;case"store":h1(e.elements),e.mergedElements=Wf(e.elements);break;case"facility":h1(e.elements),e.mergedElements=Wf(e.elements);break;case"parkingSpace":console.time("parkingSpace merge"),e.mergedElements=oet(e.elements),console.timeEnd("parkingSpace merge"),e.mergedParkingTexture=uet(e.elements);break;case"graph":h1(e.elements),e.mergedElements=Wf(e.elements);break;case"wall":e.mergedElements=Wf(e.elements,!1,!0);break;case"lane":e.mergedElements=set(e.elements);break;case"texture2d":case"texture3d":e.mergedMatrixes=ND(e.elements);break;case"glb":case"text":}}),n.transformed=!0),n}function Wf(n,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=CD(n,t,e);if(i){var s;return[xc({},n[0],{mergedGeometry:i.geometry.toJSON(),lineGeometry:((s=i.lineGeometry)==null?void 0:s.toJSON())||null})]}else return[]}function oet(n){let t=[],e=[],i=[],s=[];n.forEach((c,f)=>{let p=c.geometry.coords[0],[d,g,y]=p.slice(0,3),v=Math.sqrt((g[0]-d[0])**2+(g[1]-d[1])**2),E=Math.sqrt((y[0]-g[0])**2+(y[1]-g[1])**2),M=[v,E],A=Math.max(...M),_=Math.min(...M),x;A===v?x=[g[0]-d[0],g[1]-d[1]]:x=[y[0]-g[0],y[1]-g[1]];let[T,w]=x,R=Math.atan2(w,T)-Math.PI/2,B=new jn().compose(new st(c.center_coord_x,c.center_coord_y,(c.deltaHeight||0)+c.airHeight+c.height/2),new No().setFromAxisAngle(new st(0,0,1),R),new st(_,A,c.height));i.push(...B.toArray()),s.push(...new Te(c.fillColor).convertLinearToSRGB().toArray()),t[f]=c.fillOpacity||1,e[f]=(c.deltaHeight||0)+c.airHeight+c.height});let u=c1(n);return{size:n.length,opacities:t,maxZ:e,matrixes:i,colors:s,lineGeometry:(u==null?void 0:u.toJSON())||null}}function ND(n){let t=n.reduce((i,s)=>{let{iconUrl:u}=s;return i.has(u)||i.set(u,[]),i.get(u).push(s),i},new Map);return Array.from(t.values()).map(i=>{let s=i.map(c=>new jn().compose(new st(c.centerCoords[0],c.centerCoords[1],c.deltaHeight+c.airHeight+c.height),new No().setFromAxisAngle(new st(0,0,1),c.secondRotate),new st(c.secondWidth,c.secondHeight,1)).toArray());return xc({},i[0],{mergedMatrixes:{size:s.length,array:s.flat()}})})}function set(n){let t=n.map(u=>{let c=fd(u.geometry.coords[0].slice(0,-1),u.geometry.coords.slice(1)),f=new id(c,4),p=f.getAttribute("position"),d=[],g=new Te(u.fillColor);for(let v=0;v<p.count;v++){p.setZ(v,u.airHeight+(u.deltaHeight||0));var y;d.push(g.r,g.g,g.b,(y=u.fillOpacity)!=null?y:1)}return f.setAttribute("color",new Yn(new Float32Array(d),4)),f}),e=Eg(t);t.forEach(u=>u.dispose());let i={mergedGeometry:e.toJSON()};e.dispose();let s=n.filter(u=>{var c,f;return u.double&&((f=u.geometry.otherCoords)==null||(c=f[1])==null?void 0:c.length)});return s.length&&[!0,!1].forEach(u=>{let c=s.filter(g=>g.double===!0&&g.dashed===u);if(!c.length)return;let f=[],p=[];c.forEach(g=>{let y=g.geometry.otherCoords[1],v=g.airHeight+(g.deltaHeight||0)+.01,E=new Te(g.secondColor);for(let M=0;M<y.length-1;M++){let A=y[M],_=y[M+1];f.push(A[0],A[1],v,_[0],_[1],v),p.push(E.r,E.g,E.b,E.r,E.g,E.b)}});let d=new wg;d.setPositions(f),d.setColors(p),i[u?"dashedLineGeometry":"lineGeometry"]={positions:f,colors:p},d.dispose()}),i}var aet=new Set([Hf.HALF,Hf.MECHANICAL,Hf.POWER,Hf.VIP]);function uet(n){let t=n.filter(e=>aet.has(e.parkingType)).map(e=>{let i=new Ft(...e.geometry.coords[0][0]),s=new Ft(...e.geometry.coords[0][1]),u=new Ft(...e.geometry.coords[0][2]),c=Math.min(i.distanceTo(s),s.distanceTo(u)),f=0;return c===i.distanceTo(s)?f=s.sub(i).angle()-Math.PI/2:f=u.sub(s).angle()-Math.PI/2,{uuid:e.id,iconUrl:e.parkingType,name:e.texts[0],deltaHeight:(e.deltaHeight||0)+.001,airHeight:e.airHeight,height:e.height,geometry:e.geometry,opacity:e.fillOpacity,visible:!0,secondWidth:c-1,secondHeight:c-1,secondRotate:f,centerCoords:[e.center_coord_x,e.center_coord_y]}});return ND(t)}function h1(n){n.map(t=>{var e;if((e=t.doors)!=null&&e.length&&t.geometry.type==="polygon"){let i=t.geometry.coords[0];t.doors.forEach(s=>{let u=s.type==="single"?.5:1,c=.5,f=SO(i,s.coord),p=new Ft(...s.coord),d=new Ft(...i[f]).sub(new Ft(...s.coord)).normalize(),g=new Ft().addVectors(p,d.clone().multiplyScalar(u)),y=new Ft().addVectors(p,d.clone().multiplyScalar(-u)),v=new Ft(-d.y,d.x),E=new Ft().addVectors(g,v.clone().multiplyScalar(c));wO([E.x,E.y],i)||(v.multiplyScalar(-1),E=new Ft().addVectors(g,v.clone().multiplyScalar(c)));let M=new Ft().addVectors(y,v.clone().multiplyScalar(c)),A=[[g.x,g.y],[E.x,E.y],[M.x,M.y],[y.x,y.y]];i=[...i.slice(0,f+1),...A,...i.slice(f+1)]}),t.geometry.coords[0]=i}})}var p1="";function OD(n){let t=sc.findIndex(e=>e.floor===n);if(t!==-1){console.log("\\u8C03\\u6574\\u697C\\u5C42\\u8BF7\\u6C42\\u7684\\u4F18\\u5148\\u7EA7",n,t);let e=sc.splice(t,1)[0];sc.unshift(e)}else p1=n}var d1="";function DD(n){let t=oc.findIndex(e=>e.floor===n);if(t!==-1){console.log("\\u8C03\\u6574\\u697C\\u5C42merge\\u4F18\\u5148\\u7EA7",n,t);let e=oc.splice(t,1)[0];oc.unshift(e)}else d1=n}function cet(n){OD(n),DD(n)}uD({onLoad(n){return Ri(this,null,function*(){let{floors:t,version:e}=n;for(yield rp(),yield Promise.all(t.map(i=>Ri(this,null,function*(){return ret(i,e)}))),p1&&OD(p1),yield Promise.all(sc.map(i=>Ri(this,null,function*(){let s=yield net(i);if(s&&e===Mg.LAYERED_RENDER_VERSION){let u=bg(t.find(c=>c.floor===s.floor),1);yield LD(np.MAP_DATA,u,s),console.log(s.floor+" \\u5199\\u5165\\u7F13\\u5B58\\u6210\\u529F\\uFF0Ckey="+u),self.postMessage({type:"floor_success",data:{floor:s.floor}})}}))),d1&&DD(d1);oc.length>0;){let i=oc.shift(),s=iet(i),u=bg(t.find(c=>c.floor===i.floor));yield LD(np.MAP_DATA,u,s),console.log(i.floor+" \\u5199\\u5165\\u7F13\\u5B58\\u6210\\u529F\\uFF0Ckey="+u),self.postMessage({type:"floor_success",data:{floor:i.floor}})}fC(),console.log("\\u6240\\u6709\\u6570\\u636E\\u5904\\u7406\\u5B8C\\u6210")})},onAdjustFloorPriority(n){let{floor:t}=n;cet(t)}});
11811
11811
  `],{type:"text/javascript"}),t=URL.createObjectURL(a),e=new Worker(t);return URL.revokeObjectURL(t),e}var Tu={mergeParkingSpace:!0,mergeGraphic:!0,renderVersion:sn.MERGED_RENDER_VERSION,layers:["graph","wall","lane","texture2d","texture3d","glb","store","facility","parkingSpace","text"],filterPoi:()=>!0},je=class extends at{initDb(){return g(this,null,function*(){try{let{db:t}=yield yr();this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return g(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=x({},this.placeConfig,e));else if(typeof t=="string"){let n=yield fetch(t).then(r=>r.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=x({},this.placeConfig,JSON.parse(n.data.config||"{}")))}else return this.load("https://screen.aibee.cn/ai-map/map/get-floor-map?place_id="+t);this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return g(this,null,function*(){return this.initDbPromise.then(()=>xr(t,""+e,n))})}getCacheData(t,e){return g(this,null,function*(){return this.initDbPromise.then(()=>Rn(t,""+e))})}getFloorData(t){return g(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return g(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=Vr(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=Hr(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return g(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>g(this,null,function*(){let r=an(t),i=yield fetch(t.map_url).then(o=>o.json());i.floor=t.floor,er(i),this.setCacheData(Lt.MAP_DATA,r,i),this.setCacheData(Lt.MAP_VERSION,r,t.version_id),n(i)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return g(this,null,function*(){let e=this.floors.find(n=>n.floor===t);return e?new Promise(n=>g(this,null,function*(){let r=an(e,this.options.renderVersion===sn.LAYERED_RENDER_VERSION?1:void 0);try{let i=an(e),o=yield this.getCacheData(Lt.MAP_DATA,i);if(o&&o.transformed){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u5408\u5E76\u540E\u7684\u6570\u636E"),n(o);return}if(this.options.renderVersion===sn.LAYERED_RENDER_VERSION){let s=yield this.getCacheData(Lt.MAP_DATA,r);if(s){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u6570\u636E"),n(s);return}}if(console.log("\u7F13\u5B58\u4E2D\u6CA1\u6709\u6570\u636E"),this.loadWorker){J(this.loadWorker,"adjust_floor_priority",{floor:t});let s=u=>{if(u.data.type==="floor_success"&&u.data.data.floor===t){var l;(l=this.loadWorker)==null||l.removeEventListener("message",s),n(this.getFloorJsonData(t))}};this.loadWorker.addEventListener("message",s)}else n(this.getFloorJsonDataByFloorInfo(e))}catch(i){console.log("[get floor data error]",i),n(this.getFloorJsonDataByFloorInfo(e))}})):null})}getRoadNetworkData(){return g(this,null,function*(){return(yield Promise.all(this.floors.map(e=>g(this,null,function*(){let n=an(e,0);try{let r=yield this.getCacheData(Lt.ROAD_NETWORK_DATA,n);if(r)return r;let i=yield fetch(e.route_url).then(o=>o.json());return this.setCacheData(Lt.ROAD_NETWORK_DATA,n,i),this.setCacheData(Lt.ROUTE_VERSION,n,e.version_id),i}catch(r){let i=yield fetch(e.route_url).then(o=>o.json());return this.setCacheData(Lt.ROAD_NETWORK_DATA,n,i),i}})))).filter(e=>e.points)})}getFacilitiesData(){return g(this,null,function*(){let t=this.floors.reduce((r,i)=>r.updated_at>i.updated_at?r:i,this.floors[0]);if(!t)return null;let e=an(t,0),n=()=>g(this,null,function*(){let r=yield fetch(t.entry_infra_url).then(i=>i.json());return r&&(this.setCacheData(Lt.FACILITY_DATA,e,r),this.setCacheData(Lt.FACILITY_VERSION,e,t.version_id)),r});try{let r=yield this.getCacheData(Lt.FACILITY_DATA,e);return r||n()}catch(r){return console.log("[get facility error]",r),n()}})}getOtherDataByFreeTime(){return g(this,null,function*(){yield this.initDbPromise,yield J(this.loadWorker,"load",{floors:this.floors,version:this.options.renderVersion}),this.closeWorker()})}getMulFloorsData(t){return g(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return g(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return g(this,null,function*(){er(t),e=this.getFloorBaseLayer(t,e);let r=x({},this.placeConfig,n);return yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,r),this.changeFloorBox(t,e),e})}getDataByJsonStep(t,e,n){return g(this,null,function*(){er(t),e=this.getFloorBaseLayer(t,e);let r=x({},this.placeConfig,n);return this.changeFloorBox(t,e),requestAnimationFrame(()=>g(this,null,function*(){yield this.getFloorContentLayer(t,e),this.changeFloorBox(t,e),requestAnimationFrame(()=>g(this,null,function*(){yield this.getFloorPoi(t,e,r),this.changeFloorBox(t,e)}))})),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new Wr.Vector3),r=Math.max(n.x,n.y,n.z);e.userData.height=r/4+t.floorHeight}switchFloor(t,e){return g(this,null,function*(){return new Promise(n=>{let r={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},i=this.taskQueue.replaceByMetaType(r),o=s=>{let{task:u,res:l}=s;u.tid===i&&(this.taskQueue.removeEventListener("active-task-end",o),n(l))};this.taskQueue.addEventListener("active-task-end",o)})})}_switchFloor(t,e){return g(this,null,function*(){var n;let r=t;if(typeof t=="string"){let c=yield this.getFloorJsonData(t);if(c)r=c;else return null}else er(t);let i=x({},this.placeConfig,e),o=new Vt(this.bmap.context);o.userData.data=t;let s=this.floors.find(c=>c.floor===r.floor);var u;let l=(u=s==null?void 0:s.map_angle)!=null?u:0;return this.bmap.dispatchEvent({type:Et.SWITCH_FLOOR_BEFORE,data:{curFloor:o,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:o,graphics:[],floorData:r}}),this.bmap.context.scene.background=new Wr.Color(i.backgroundColor),this.getFloorBaseLayer(r,o),this.changeFloorBox(r,o),this.bmap.buildingCenter=o.userData.center,this.bmap.currentBuildGround=(n=o.userData.data.layers.find(c=>c.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(o),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(l/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:Et.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield fr(),yield this.getFloorContentLayer(r,o),this.changeFloorBox(r,o),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield gi(2),yield this.getFloorPoi(r,o,i),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:Et.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new Vt(this.bmap.context));let n=[0,0];return t.layers.forEach(r=>{switch(r.l_type){case"range":let i=r.elements[0];n=[i.center_x,i.center_y],e.userData.range=i.geometry.cds[0],e.userData.rangeGraphic=i;break;case"ground":Hi(r,e);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return g(this,null,function*(){e||(e=new Vt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let r=0;r<t.layers.length;r++){let i=t.layers[r];["range","ground"].includes(i.l_type)||this.options.layers.includes(i.l_type)&&(Ys(i,e,this.options),console.log("time",Date.now()-n,i.l_type),n=Date.now())}return e})}getFloorPoi(t,e,n){return g(this,null,function*(){n===void 0&&(n=this.placeConfig);let r=Date.now();yield Promise.all(t.layers.map(o=>{if(this.options.layers.includes(o.l_type))return Zs(o,e,this.locale,n,this.options)})),console.log("poi time",Date.now()-r);let i=Date.now();fr().then(()=>{console.log("poi render time",Date.now()-i)})})}clear(){return g(this,null,function*(){rs(),this.db=null})}closeWorker(){this.loadWorker&&(this.loadWorker.terminate(),this.loadWorker=null)}dispose(){super.dispose(),this.clear(),this.closeWorker(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new He,this.loadWorker=Wi(),this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=x({},Tu,e),this.placeConfig=x({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var dv=require("core-js/modules/web.dom-collections.iterator.js");function Xi(a,t){return g(this,null,function*(){let{brand:e,project:n}=a,{apiDomain:r,apiPath:{floorRange:i},apiInfo:o}=t,s=""+r+i+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(s,o).then(l=>l.json()).then(l=>l.data).then(l=>{let c=(l||[])[0];return c&&(c.info=JSON.parse(c.info)),c})})}function qi(a,t){return g(this,null,function*(){let{brand:e,project:n,floor:r,ts:i,resource_type_list:o}=a,{apiDomain:s,apiPath:{floorGraphic:u},apiInfo:l}=t,c=""+s+u+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+r+"&ts="+i+"&resource_type_list="+o;return yield fetch(c,l).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(f=>f.info=JSON.parse(f.info)),p||[]))})}function Au(a,t){return g(this,null,function*(){let{project:e,floor:n}=a,{apiDomain:r,apiInfo:i}=t,o=r+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(o,i).then(u=>u.json()).then(u=>u.data).then(u=>JSON.parse(u[0].streetInfo||"{}")).then(u=>u.fileId?Cu(u.fileId,t):null)})}function Cu(a,t){return g(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+a,n).then(r=>r.arrayBuffer()).then(r=>{let o=new TextDecoder("utf-8").decode(r);return o?JSON.parse(o):null})})}var ji=class{load(t){return g(this,null,function*(){let e=Ge(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),qi(t,this.bmap.config)]),r=Ge({floor:t.floor,ts:t.ts});wn(n.map(o=>o.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(r)||0),n.forEach(o=>o.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let i=this.floorDataLengthMap.get(r)||0;return this.floorDataLengthMap.set(r,i+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return g(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,r=e.userData.graphicMap||new Map,{ground:i,markGraphic:o,graphic:s}=this.bmap.config;for(let u=0;u<t.length;u++){let l=t[u];l.info.group==="ground"?(l.info.fillColor=i.color,l.info.fillOpacity=i.opacity,l.info.height=i.height,l.info.stroke=i.stroke,l.info.strokeColor=i.strokeColor,l.info.strokeOpacity=i.strokeOpacity):l.info.userData.mark?(l.info.height=o.height,l.info.fillColor=o.color,l.info.fillOpacity=o.opacity,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity):(l.info.fillOpacity=s.fillOpacity,this.bmap.config.initTransToMark&&(l.info.height=o.height,l.info.fillColor=o.color,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity))}for(let u of t){if(u.info.group==="ground")e.createGround(u.info);else{let l=e.addGraphic(u.info);l.userData.data=u,n.set(u.legacy_id,l)}r.set(u.element_uuid,u)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=r,e.userData.rangeGraphic=this.bmap.currentBuildGround,e.userData.range=this.bmap.currentBuildGround.geometry.cds[0],e.userData.center=this.bmap.buildingCenter,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(Et.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(Et.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let n=e.userData.graphicMap||new Map;return t.filter(r=>!n.has(r.element_uuid))}switchFloorByStoreData(t,e){return g(this,null,function*(){let n=yield this.load(x({},t,{resource_type_list:"6"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}switchFloorByOtherData(t,e){return g(this,null,function*(){let n=yield this.load(x({},t,{resource_type_list:"1,2,3,4"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}loadBuildGround(t){return g(this,null,function*(){let{brand:e,project:n}=t,r=yield this.loadBuildingGround({brand:e,project:n});var i;return this.bmap.currentBuildGround=(i=r==null?void 0:r.info)!=null?i:null,this.bmap.changeBuildingCenter(r,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return g(this,null,function*(){let{brand:e,project:n}=t,r=Ge({brand:e,project:n});if(this.buildingGroundMap.has(r))return this.buildingGroundMap.get(r);let i=Xi({brand:e,project:n},this.bmap.config).then(o=>(this.buildingGroundMap.set(r,o),o));return this.buildingGroundMap.set(r,i),i})}switchFloor(t){return g(this,null,function*(){let e=new Vt(this.bmap.context);e.userData.graphicMap=new Map,e.name=t.floor;try{yield Promise.all([this.switchFloorByStoreData(t,e),this.switchFloorByOtherData(t,e)])}catch(n){console.log(n)}return e})}dispose(){this.cacheData.clear(),this.floorDataLengthMap.clear(),this.buildingGroundMap.clear()}constructor(t){this.bmap=t,this.cacheData=new Map,this.floorDataLengthMap=new Map,this.buildingGroundMap=new Map,this.externalStreetMap=new Map}};var Ru=function(a){return a[a.D2=0]="D2",a[a.D3=1.1]="D3",a}({}),Yi=class extends qt.EventDispatcher{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:r}=e,i=t?xn(t.info.geometry.cds[0]):[0,0];this.buildingCenter=i,this.dispatchEvent({type:"center-change",center:i,project:r,brand:n})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor(t){return g(this,null,function*(){return this.loader||(this.loader=new je(this),this.loader.placeConfig=x({},this.loader.placeConfig,this.config.loaderPlaceConfig),yield this.loader.load(this.config.apiPath.loadPlaceInfo+"?place_id="+this.config.placeId+"&env=prod")),this.loader.switchFloor(t)})}switchFloorByFloor(t,e,n){e===void 0&&(e=!0),n===void 0&&(n=t.graphicLayer.children),this.triggerHooks(Et.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:n}),this.buildingCenter=t.userData.center,this.currentBuildGround=t.userData.rangeGraphic,this.context.switchFloor(t,e),this.initialFloorCamera(),this.triggerHooks(Et.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:n})}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(this.config.defaultPadding,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*this.config.control.maxZoomScale,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}addModel(t,e){if(t.options.geometry.type==="polygon"){var n;let r=(n=this.context.currentFloor)==null?void 0:n.addModel(x({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(r){let{facilityAngle:i=0,facilityXScale:o=1,facilityYScale:s=1}=t.options.userData;r.rotateZ((180-i)/180*Math.PI),r.scale.set(o,s,1)}}}addHeatmap(t){var e;return(e=this.context.currentFloor)==null?void 0:e.addHeatmap(t)}getLegacyToGraphicMap(){var t;return((t=this.context.currentFloor)==null?void 0:t.userData.legacyToGraphicMap)||new Map}getFloorAllGraphics(){var t;return((t=this.context.currentFloor)==null?void 0:t.getGraphics())||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let n=t.options.center,r=t.getCenter(),i=(n==null?void 0:n[0])||r.x,o=(n==null?void 0:n[1])||r.y;return console.log(i,o,n,r),this.context.currentFloor.addPoi(x({},e,{position:{x:i,y:o,z:r.z+t.options.height/2}}))}return null}createPoi2ByPosition(t,e){if(this.context.currentFloor){let n=this.mercatorToWorld([t.x,t.y]),r=new rt(this.context,x({},e,{position:{x:n.x,y:n.y,z:t.z}}));return this.context.currentFloor.poiLayer2.pushPoi(r),r}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,r){e===void 0&&(e=500),n===void 0&&(n=0),r===void 0&&(r=0);let i=t.getPosition().clone(),{context:{camera:o}}=this;if(o.updateMatrix(),r){let s=new qt.Vector3;s.setFromMatrixColumn(o.matrix,1),s.normalize(),s.multiplyScalar(r/o.zoom),i.add(s)}if(n){let s=new qt.Vector3;s.setFromMatrixColumn(o.matrix,0),s.normalize(),s.multiplyScalar(n/o.zoom),i.add(s)}return this.context.setCameraPosition(i,e)}translateElementToCenterX(t,e){return g(this,null,function*(){return e===void 0&&(e=500),kt(new Promise(n=>{let r=this.context.control.target.clone(),i=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:o,height:s},camera:u}=this.context,c=R(i,u,o,s).x-o/2,h=new qt.Vector3;h.setFromMatrixColumn(this.context.camera.matrix,0),h.normalize(),h.multiplyScalar(c/this.context.camera.zoom),r.add(h),this.context.setCameraPosition(r,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:r}=this.container;return R(e,this.context.camera,n,r)}changeMapType(t,e){return e===void 0&&(e=500),this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}resetView(t){return g(this,null,function*(){t===void 0&&(t=300);let e=t/3;yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),yield this.context.setPolarAngle(this.config.control.defaultPolar,e),yield this.context.fitCameraToGround(this.config.defaultPadding,e,!1)})}reduceMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver(this.debounceResize);t.observe(this.container),this.observe=t}}unRegistryEvent(){var t;this.context.control.removeEventListener("change",this.onControlChange),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),(t=this.observe)==null||t.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t,e){t===void 0&&(t=.1),e===void 0&&(e=500);let n=this.context.control.getAzimuthalAngle();return this.context.setAzimuthalAngle(n+t,e)}measureDistance(){return g(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Wn(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",r=>{let{distance:i}=r;t(i)})})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new Xn(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",r=>{let{area:i}=r;t(i)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}fitCameraByPois(t,e,n){return g(this,null,function*(){if(e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),!t.length)return;let r=new qt.Box3;return t.forEach(i=>{let{position:o}=i;r.expandByPoint(o)}),this.context.fitCameraToBox(r,e,n,!1)})}fitCameraByPoiNodeIds(t,e,n){return g(this,null,function*(){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500);let r=t.map(i=>this.getPoiById(i)).filter(i=>!!i);if(r.length)return this.fitCameraByPois(r,e,n)})}getGraphicByNodeId(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((n=this.context.currentFloor)==null?void 0:n.parkingSpaceLayer.graphicMap.get(t))||null}deleteGraphic(t){var e;(e=this.context.currentFloor)==null||e.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){var e;if(!t.transformToBuildingGround&&this.currentBuildGround){let n=xn(this.currentBuildGround.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(r=>{Array.isArray(r)&&r.forEach(i=>{i[0]-=n[0],i[1]-=n[1]})});else{let[r,i]=t.geometry.cds;t.geometry.coords=[r-n[0],i-n[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}mercatorToWorld(t){let e=this.buildingCenter;return new qt.Vector3(t[0]-e[0],t[1]-e[1],0)}removePoiById(t){var e,n;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(n=this.context.currentFloor)==null||n.poiLayer2.removePoiById(t)}getPoiById(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||((n=this.context.currentFloor)==null?void 0:n.poiLayer2.getPoiById(t))}getPois(){var t,e;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(n=>!n.options.built_in),...((e=this.context.currentFloor)==null?void 0:e.poiLayer2.pois)||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}dispose(){this.loader&&(this.loader.dispose(),this.loader=null),this.unRegistryEvent(),this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.plugins=[],this.context.dispose(),this.context=null,this.container=null,ht.dispose(),gt.dispose(),we.dispose(),Pt.dispose(),I.dispose(),ee.dispose(),this.debounceResize=null,qt.Sprite.Dispose==null||qt.Sprite.Dispose.call(qt.Sprite)}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new K,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:n}}=this.context;n!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=n)},this.onKeydown=n=>{this.polarKeys.includes(n.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(n.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=n=>{if(this.polarKeys.includes(n.code)){let r=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=r,this.context.control.minPolarAngle=r}if(this.azimuthalKeys.includes(n.code)){let r=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=r,this.context.control.minAzimuthAngle=r}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),r=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let i=this.context.getFitCameraToGroundZoom(this.config.defaultPadding,0)||1;this.context.camera.zoom=r,this.context.control.minZoom=i,this.context.control.maxZoom=i*this.config.control.maxZoomScale,this.basicZoom=r,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=ki(e),this.context=new tr(t,this),this.debounceResize=(0,Ks.debounce)(this.resize,5),this.registryEvent()}};var Pu=function(a){return a.HALF="half",a.POWER="power",a.MECHANICAL="mechanical",a.NORMAL="normal",a.VIP="vip",a}({});var Uv=require("core-js/modules/web.dom-collections.iterator.js");var pt=class extends at{dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null,super.dispose()}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var Zi=class extends pt{fetchEquipment(){return g(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,r=""+t+e;yield fetch(r,n).then(i=>i.json()).then(i=>i.data).then(i=>{this.equipmentList=i,this.equipmentMap=new Map(i.map(o=>[o.equipment_id,o]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)})}getGraphicEquipment(t){return t.userData.data.info.userData.equipment}changeGraphicToEquipment(t){t.filter(e=>{let n=this.getGraphicEquipment(e);return n&&this.equipmentMap.has(n)}).forEach(e=>{let n=this.equipmentMap.get(this.getGraphicEquipment(e)),r=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});r&&(r.userData.data=n,r.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(Et.SWITCH_FLOOR_AFTER,this.onSwitchFloor),Array.from(((t=this.bmap.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).forEach(e=>{if(e.userData.type==="equipment"){var n;(n=this.bmap.context.currentFloor)==null||n.poiLayer.removePoi(e)}}),super.dispose()}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:n}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(n)},this.fetchEquipment(),this.bmap.addEventListener(Et.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var zy=require("core-js/modules/es.string.replace.js"),Gy=require("core-js/modules/es.regexp.exec.js"),ky=require("core-js/modules/web.dom-collections.iterator.js"),Vy=require("core-js/modules/es.promise.finally.js");var oy=require("core-js/modules/web.dom-collections.iterator.js"),sy=require("core-js/modules/es.array.push.js"),vt=require("three");var kv=require("core-js/modules/es.typed-array.float32-array.js"),Vv=require("core-js/modules/es.typed-array.at.js"),Hv=require("core-js/modules/es.typed-array.fill.js"),Wv=require("core-js/modules/es.typed-array.find-last.js"),Xv=require("core-js/modules/es.typed-array.find-last-index.js"),qv=require("core-js/modules/es.typed-array.set.js"),jv=require("core-js/modules/es.typed-array.sort.js"),Yv=require("core-js/modules/es.typed-array.to-reversed.js"),Zv=require("core-js/modules/es.typed-array.to-sorted.js"),Kv=require("core-js/modules/es.typed-array.with.js"),$v=require("core-js/modules/es.array-buffer.constructor.js"),Jv=require("core-js/modules/es.array-buffer.slice.js"),Qv=require("core-js/modules/es.array-buffer.detached.js"),ty=require("core-js/modules/es.array-buffer.transfer.js"),ey=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),ny=require("core-js/modules/es.array.push.js"),ry=require("core-js/modules/es.typed-array.uint16-array.js"),w=require("three"),jt=class extends w.BufferGeometry{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new w.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};jt.prototype.setMatrixWorld=function(a){this.matrixWorld=a};jt.prototype.setGeometry=function(a,t){this._geometry=a,this.setPoints(a.getAttribute("position").array,t)};jt.prototype.setPoints=function(a,t){if(!(a instanceof Float32Array)&&!(a instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=a,this.widthCallback=t,this.positions=[],this.counters=[],a.length&&a[0]instanceof w.Vector3)for(var e=0;e<a.length;e++){var n=a[e],r=e/a.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(r),this.counters.push(r)}else for(var e=0;e<a.length;e+=3){var r=e/a.length;this.positions.push(a[e],a[e+1],a[e+2]),this.positions.push(a[e],a[e+1],a[e+2]),this.counters.push(r),this.counters.push(r)}this.process()};function Iu(a,t){var e=new w.Matrix4,n=new w.Ray,r=new w.Sphere,i=new w.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),r.copy(o.boundingSphere),r.applyMatrix4(this.matrixWorld),a.ray.intersectSphere(r,i)!==!1){e.copy(this.matrixWorld).invert(),n.copy(a.ray).applyMatrix4(e);var s=new w.Vector3,u=new w.Vector3,l=new w.Vector3,c=this instanceof w.LineSegments?2:1,h=o.index,p=o.attributes;if(h!==null)for(var f=h.array,d=p.position.array,m=p.width.array,v=0,y=f.length-1;v<y;v+=c){var S=f[v],M=f[v+1];s.fromArray(d,S*3),u.fromArray(d,M*3);var N=m[Math.floor(v/3)]!==void 0?m[Math.floor(v/3)]:1,L=a.params.Line.threshold+this.material.lineWidth*N/2,Z=L*L,T=n.distanceSqToSegment(s,u,i,l);if(!(T>Z)){i.applyMatrix4(this.matrixWorld);var $=a.ray.origin.distanceTo(i);$<a.near||$>a.far||(t.push({distance:$,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}),v=y)}}}}jt.prototype.raycast=Iu;jt.prototype.compareV3=function(a,t){var e=a*6,n=t*6;return this.positions[e]===this.positions[n]&&this.positions[e+1]===this.positions[n+1]&&this.positions[e+2]===this.positions[n+2]};jt.prototype.copyV3=function(a){var t=a*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};jt.prototype.getDistance=function(a){let t=0;for(let e=0;e<a;e++){let n=6*e,r=new w.Vector3(this.positions[n],this.positions[n+1],this.positions[n+2]),i=new w.Vector3(this.positions[n+6],this.positions[n+7],this.positions[n+8]),o=r.distanceTo(i);t+=o}return t};jt.prototype.process=function(){var a=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(a-1);var n;this.compareV3(0,a-1)?n=this.copyV3(a-2):n=this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var r=0;r<a;r++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(r/(a-1)):t=1,this.width.push(t),this.width.push(t),r===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(r===a-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let o=this.getDistance(r)/e;this.uvs.push(o,0),this.uvs.push(o,1)}if(r<a-1){n=this.copyV3(r),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var i=r*2;this.indices_array.push(i,i+1,i+2),this.indices_array.push(i+2,i+1,i+3)}r>0&&(n=this.copyV3(r),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(a-1,0)?n=this.copyV3(1):n=this.copyV3(a-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new w.BufferAttribute(new Float32Array(this.positions),3),previous:new w.BufferAttribute(new Float32Array(this.previous),3),next:new w.BufferAttribute(new Float32Array(this.next),3),side:new w.BufferAttribute(new Float32Array(this.side),1),width:new w.BufferAttribute(new Float32Array(this.width),1),uv:new w.BufferAttribute(new Float32Array(this.uvs),2),index:new w.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new w.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Ki(a,t,e,n,r){var i;if(a=a.subarray||a.slice?a:a.buffer,e=e.subarray||e.slice?e:e.buffer,a=t?a.subarray?a.subarray(t,r&&t+r):a.slice(t,r&&t+r):a,e.set)e.set(a,n);else for(i=0;i<a.length;i++)e[i+n]=a[i];return e}jt.prototype.advance=function(a){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,r=t.length;Ki(t,0,e,0,r),Ki(t,6,t,0,r-6),t[r-6]=a.x,t[r-5]=a.y,t[r-4]=a.z,t[r-3]=a.x,t[r-2]=a.y,t[r-1]=a.z,Ki(t,6,n,0,r-6),n[r-6]=a.x,n[r-5]=a.y,n[r-4]=a.z,n[r-3]=a.x,n[r-2]=a.y,n[r-1]=a.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};w.ShaderChunk.meshline_vert=["",w.ShaderChunk.logdepthbuf_pars_vertex,w.ShaderChunk.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",w.ShaderChunk.logdepthbuf_vertex,w.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",w.ShaderChunk.fog_vertex,"}"].join(`
11812
11812
  `);w.ShaderChunk.meshline_frag=["",w.ShaderChunk.fog_pars_fragment,w.ShaderChunk.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","uniform float thresholdRatio;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {",""," if (vUV.x <= thresholdRatio) {"," discard;"," }",w.ShaderChunk.logdepthbuf_fragment,""," vec4 c = vColor;"," if( useMap == 1. ) c *= texture2D( map, vUV * repeat );"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","",w.ShaderChunk.fog_fragment,"}"].join(`
11813
- `);var nr=class extends w.ShaderMaterial{constructor(t){super({uniforms:Object.assign({},w.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new w.Color(16777215)},opacity:{value:1},resolution:{value:new w.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new w.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:w.ShaderChunk.meshline_vert,fragmentShader:w.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};nr.prototype.copy=function(a){return w.ShaderMaterial.prototype.copy.call(this,a),this.lineWidth=a.lineWidth,this.map=a.map,this.useMap=a.useMap,this.alphaMap=a.alphaMap,this.useAlphaMap=a.useAlphaMap,this.color.copy(a.color),this.opacity=a.opacity,this.resolution.copy(a.resolution),this.sizeAttenuation=a.sizeAttenuation,this.dashArray.copy(a.dashArray),this.dashOffset.copy(a.dashOffset),this.dashRatio.copy(a.dashRatio),this.useDash=a.useDash,this.visibility=a.visibility,this.alphaTest=a.alphaTest,this.repeat.copy(a.repeat),this};var $s={texture_url:Sr,lineWidth:10,color:16777215},Xr=class extends vt.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:r}}}}}=this,i=t.map(s=>{let[u,l]=s;return R(new vt.Vector3(u,l,0),e,n,r)}).map(s=>{let{x:u,y:l}=s;return[u,l]});return It(i)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new vt.Vector2(t,1)}loadTexture(t){return new Promise((e,n)=>{new vt.TextureLoader().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return g(this,null,function*(){let e=this.geometry=new jt;if(this.updatePoints(t),!this.texture){let i=this.texture=yield this.loadTexture(this.config.texture_url);i.wrapS=i.wrapT=vt.RepeatWrapping}let n=this.material=new nr({useMap:!0,color:new vt.Color(this.config.color),transparent:!0,resolution:new vt.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:vt.NormalBlending,repeat:new vt.Vector2(this.getRepeat(),1)}),r=this.mesh=new vt.Mesh(e,n);return r.renderOrder=99999,this.add(r),r})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=$s,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:r}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,r)}},this.config=Object.assign({},$s,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var ln=require("@tweenjs/tween.js"),Ft=require("three");var fy=require("core-js/modules/es.array.unshift.js"),dy=require("core-js/modules/web.dom-collections.iterator.js"),gy=require("core-js/modules/es.array.push.js"),Js=require("three");var Qs=require("@tweenjs/tween.js"),ta=require("lodash"),un=require("@turf/turf");var Lu={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1,destinationDistanceThreshold:10},qr=class extends at{get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){var t;return((t=this.curRoutePath)==null?void 0:t.points)||[]}registryEvent(){this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.addEventListener("add-path",this.onAddPaths)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.removeEventListener("add-path",this.onAddPaths)}setRoadData(t){this.roadData=t}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null),t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,e){let{curRoutePathPoints:n,position:r,curRoutePath:i,paths:o,routeIndex:s}=this;if(!n.length)return null;let u=n,l=this.paths[this.routeIndex].floor,c=this.getCurRouteRemainDistance();if(r){let v=oe(n,r);u=u.slice(v+1),u.unshift(r)}let h=[{floor:i==null?void 0:i.floor,points:u},...o.slice(s+1)],{distance:p,closestPoint:f,index:d,i:m}=h.reduce((v,y,S)=>{if(y.floor!==t)return v;let{distance:M,closestPoint:N,index:L}=y.points.reduce((Z,T,$,P)=>{if(!P[$+1])return x({},Z,{distance:Z.distance===1/0?z(T,e):Z.distance});let{distance:O,closestPoint:C}=xi(e,T,P[$+1]);if(!this.navigation.options.canBack&&l===t){let V=[e,...P.slice($+1)],tt=It(V);if(c-tt>10)return Z}return O<Z.distance?{distance:O,closestPoint:C,index:$}:Z},{distance:1/0,closestPoint:y.points[0],index:0});return M<v.distance?{distance:M,closestPoint:N,index:S,i:L}:v},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:p,closestPoint:f,routeIndex:d+s,pointIndex:d===0?m+this.pointIndex:m}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:r,closestPoint:i,routeIndex:o,pointIndex:s}=n;r>this.options.offsetDistance?(this.offset=!0,this.resetTimer||(this.resetTimer=this.timer.setTimeout(()=>{this.reset=!0,this.resetTimer=null},this.options.offsetToResetTime))):(this.offset=!1,this.reset=!1,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null)),this.routeIndex=o,this.pointIndex=s,this.position=i,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}pause(){var t;this.tweenUtil.clear(),(t=this.throttleUpdatePosition)==null||t.cancel(),this.paused=!0}continue(){this.paused=!1,this.startCurRouteSimulation()}startCurRouteSimulation(){return g(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let r=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],i=this.getCurRouteRemainDistance(),o=i/this.options.simulationSpeed,s=this.throttleUpdatePosition=(0,ta.throttle)(l=>{let c=ke(r,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new Qs.Tween({distance:0},this.tweenUtil.group).to({distance:i},o*1e3).onUpdate(s).onComplete(()=>{this.tweenUtil.remove(u),s.flush(),s.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{n(this.startCurRouteSimulation())},3e3)):(n(!0),console.log(e,this.routeIndex,this.paths))}).start()})})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.paused||this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[n,...t.slice(e+1)];return It(r)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[...t.slice(0,e+1),n];return It(r)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((r,i)=>r+i.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:r,curRoutePath:i}=this,o=e,s=ae.FRONT,u=(i==null||(t=i.pointInfos[o])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;s===ae.FRONT&&o<=n.length;){let m=n[o],v=n[o+1],y=n[o+2];if(!m||!v)s=ae.END;else if(l+=z(m,v),!y)s=ae.END;else{s=gr(m,v,y),c=En(m,v,y),h=(new Js.Vector2(y[0]-v[0],y[1]-v[1]).angle()*180/Math.PI-90+360)%360;var p;u=(p=i==null?void 0:i.pointInfos[o+1].crossName)!=null?p:"",o+=1}}n[o]&&(l=z(r,n[o]));let f=mr(c);if(s===ae.END&&l<=this.options.directionEmitThreshold)return{dir:s,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f};let d=this.getCurRouteToStartDistance();return e===0&&d<=5?{dir:ae.START,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f}:(l>=this.options.directionEmitThreshold&&(s=ae.FRONT),{dir:s,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let r=(0,un.polygon)(n.cds),i=(0,un.point)(this.position);return(0,un.booleanPointInPolygon)(i,r)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:r,distance:i,crossName:o,angle:s,nextAngle:u,nextDir:l}=n;e<=this.options.destinationDistanceThreshold&&(r=ae.END);let{imageUrl:c}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:i,dir:r,angle:s,nextAngle:u,pos:this.position,routeIndex:this.routeIndex,crossName:o,offset:this.offset,reset:this.reset,imageUrl:c,nextDir:l}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,n){super(),this.navigation=t,this.offset=!1,this.reset=!1,this.position=[0,0],this.routeIndex=0,this.pointIndex=0,this.paths=[],this.timer=new K,this.resetTimer=null,this.tweenUtil=new _e,this.paused=!1,this.onAddPaths=r=>{let{paths:i}=r;this.paths=i,this.resetStatus(i),this.simulationTween&&!this.paused&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},Lu,e),this.roadData=n,this.registryEvent()}};var yy=require("core-js/modules/es.typed-array.uint8-array.js"),xy=require("core-js/modules/es.typed-array.at.js"),Ey=require("core-js/modules/es.typed-array.fill.js"),Sy=require("core-js/modules/es.typed-array.find-last.js"),by=require("core-js/modules/es.typed-array.find-last-index.js"),My=require("core-js/modules/es.typed-array.set.js"),wy=require("core-js/modules/es.typed-array.sort.js"),Ty=require("core-js/modules/es.typed-array.to-reversed.js"),Ay=require("core-js/modules/es.typed-array.to-sorted.js"),Cy=require("core-js/modules/es.typed-array.with.js"),Ry=require("core-js/modules/es.array-buffer.constructor.js"),Py=require("core-js/modules/es.array-buffer.slice.js"),Iy=require("core-js/modules/es.array-buffer.detached.js"),Ly=require("core-js/modules/es.array-buffer.transfer.js"),Ny=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Oy=require("core-js/modules/es.typed-array.from.js"),Dy=require("core-js/modules/web.dom-collections.iterator.js"),Qt=require("three");var xe=class a extends rt{addDebug(){a.canvas.style.cssText=`
11813
+ `);var nr=class extends w.ShaderMaterial{constructor(t){super({uniforms:Object.assign({},w.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new w.Color(16777215)},opacity:{value:1},resolution:{value:new w.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new w.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:w.ShaderChunk.meshline_vert,fragmentShader:w.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};nr.prototype.copy=function(a){return w.ShaderMaterial.prototype.copy.call(this,a),this.lineWidth=a.lineWidth,this.map=a.map,this.useMap=a.useMap,this.alphaMap=a.alphaMap,this.useAlphaMap=a.useAlphaMap,this.color.copy(a.color),this.opacity=a.opacity,this.resolution.copy(a.resolution),this.sizeAttenuation=a.sizeAttenuation,this.dashArray.copy(a.dashArray),this.dashOffset.copy(a.dashOffset),this.dashRatio.copy(a.dashRatio),this.useDash=a.useDash,this.visibility=a.visibility,this.alphaTest=a.alphaTest,this.repeat.copy(a.repeat),this};var $s={texture_url:Sr,lineWidth:10,color:16777215},Xr=class extends vt.Object3D{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:r}}}}}=this,i=t.map(s=>{let[u,l]=s;return R(new vt.Vector3(u,l,0),e,n,r)}).map(s=>{let{x:u,y:l}=s;return[u,l]});return It(i)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new vt.Vector2(t,1)}loadTexture(t){return new Promise((e,n)=>{new vt.TextureLoader().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return g(this,null,function*(){let e=this.geometry=new jt;if(this.updatePoints(t),!this.texture){let i=this.texture=yield this.loadTexture(this.config.texture_url);i.wrapS=i.wrapT=vt.RepeatWrapping}let n=this.material=new nr({useMap:!0,color:new vt.Color(this.config.color),transparent:!0,resolution:new vt.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:vt.NormalBlending,repeat:new vt.Vector2(this.getRepeat(),1)}),r=this.mesh=new vt.Mesh(e,n);return r.renderOrder=99999,this.add(r),r})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=$s,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:r}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,r)}},this.config=Object.assign({},$s,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var ln=require("@tweenjs/tween.js"),Ft=require("three");var fy=require("core-js/modules/es.array.unshift.js"),dy=require("core-js/modules/web.dom-collections.iterator.js"),gy=require("core-js/modules/es.array.push.js"),Js=require("three");var Qs=require("@tweenjs/tween.js"),ta=require("lodash"),un=require("@turf/turf");var Lu={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1,destinationDistanceThreshold:10},qr=class extends at{get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){var t;return((t=this.curRoutePath)==null?void 0:t.points)||[]}registryEvent(){this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.addEventListener("add-path",this.onAddPaths)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.removeEventListener("add-path",this.onAddPaths)}setRoadData(t){this.roadData=t}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,this.offsetDistance=0,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null),t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,e){let{curRoutePathPoints:n,position:r,curRoutePath:i,paths:o,routeIndex:s}=this;if(!n.length)return null;let u=n,l=this.paths[this.routeIndex].floor,c=this.getCurRouteRemainDistance();if(r){let v=oe(n,r);u=u.slice(v+1),u.unshift(r)}let h=[{floor:i==null?void 0:i.floor,points:u},...o.slice(s+1)],{distance:p,closestPoint:f,index:d,i:m}=h.reduce((v,y,S)=>{if(y.floor!==t)return v;let{distance:M,closestPoint:N,index:L}=y.points.reduce((Z,T,$,P)=>{if(!P[$+1])return x({},Z,{distance:Z.distance===1/0?z(T,e):Z.distance});let{distance:O,closestPoint:C}=xi(e,T,P[$+1]);if(!this.navigation.options.canBack&&l===t){let V=[e,...P.slice($+1)],tt=It(V);if(c-tt>10)return Z}return O<Z.distance?{distance:O,closestPoint:C,index:$}:Z},{distance:1/0,closestPoint:y.points[0],index:0});return M<v.distance?{distance:M,closestPoint:N,index:S,i:L}:v},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:p,closestPoint:f,routeIndex:d+s,pointIndex:d===0?m+this.pointIndex:m}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:r,closestPoint:i,routeIndex:o,pointIndex:s}=n;this.offsetDistance=r,r>this.options.offsetDistance?(this.offset=!0,this.resetTimer||(this.resetTimer=this.timer.setTimeout(()=>{this.reset=!0,this.resetTimer=null},this.options.offsetToResetTime))):(this.offset=!1,this.reset=!1,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null)),this.routeIndex=o,this.pointIndex=s,this.position=i,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}pause(){var t;this.tweenUtil.clear(),(t=this.throttleUpdatePosition)==null||t.cancel(),this.paused=!0}continue(){this.paused=!1,this.startCurRouteSimulation()}startCurRouteSimulation(){return g(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let r=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],i=this.getCurRouteRemainDistance(),o=i/this.options.simulationSpeed,s=this.throttleUpdatePosition=(0,ta.throttle)(l=>{let c=ke(r,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new Qs.Tween({distance:0},this.tweenUtil.group).to({distance:i},o*1e3).onUpdate(s).onComplete(()=>{this.tweenUtil.remove(u),s.flush(),s.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{n(this.startCurRouteSimulation())},3e3)):(n(!0),console.log(e,this.routeIndex,this.paths))}).start()})})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.paused||this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[n,...t.slice(e+1)];return It(r)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[...t.slice(0,e+1),n];return It(r)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((r,i)=>r+i.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:r,curRoutePath:i}=this,o=e,s=ae.FRONT,u=(i==null||(t=i.pointInfos[o])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;s===ae.FRONT&&o<=n.length;){let m=n[o],v=n[o+1],y=n[o+2];if(!m||!v)s=ae.END;else if(l+=z(m,v),!y)s=ae.END;else{s=gr(m,v,y),c=En(m,v,y),h=(new Js.Vector2(y[0]-v[0],y[1]-v[1]).angle()*180/Math.PI-90+360)%360;var p;u=(p=i==null?void 0:i.pointInfos[o+1].crossName)!=null?p:"",o+=1}}n[o]&&(l=z(r,n[o]));let f=mr(c);if(s===ae.END&&l<=this.options.directionEmitThreshold)return{dir:s,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f};let d=this.getCurRouteToStartDistance();return e===0&&d<=5?{dir:ae.START,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f}:(l>=this.options.directionEmitThreshold&&(s=ae.FRONT),{dir:s,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let r=(0,un.polygon)(n.cds),i=(0,un.point)(this.position);return(0,un.booleanPointInPolygon)(i,r)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:r,distance:i,crossName:o,angle:s,nextAngle:u,nextDir:l}=n;e<=this.options.destinationDistanceThreshold&&(r=ae.END);let{imageUrl:c}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:i,dir:r,angle:s,nextAngle:u,pos:this.position,routeIndex:this.routeIndex,crossName:o,offset:this.offset,reset:this.reset,imageUrl:c,nextDir:l,offsetDistance:this.offsetDistance}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,n){super(),this.navigation=t,this.offset=!1,this.reset=!1,this.position=[0,0],this.routeIndex=0,this.pointIndex=0,this.paths=[],this.timer=new K,this.resetTimer=null,this.tweenUtil=new _e,this.paused=!1,this.offsetDistance=0,this.onAddPaths=r=>{let{paths:i}=r;this.paths=i,this.resetStatus(i),this.simulationTween&&!this.paused&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},Lu,e),this.roadData=n,this.registryEvent()}};var yy=require("core-js/modules/es.typed-array.uint8-array.js"),xy=require("core-js/modules/es.typed-array.at.js"),Ey=require("core-js/modules/es.typed-array.fill.js"),Sy=require("core-js/modules/es.typed-array.find-last.js"),by=require("core-js/modules/es.typed-array.find-last-index.js"),My=require("core-js/modules/es.typed-array.set.js"),wy=require("core-js/modules/es.typed-array.sort.js"),Ty=require("core-js/modules/es.typed-array.to-reversed.js"),Ay=require("core-js/modules/es.typed-array.to-sorted.js"),Cy=require("core-js/modules/es.typed-array.with.js"),Ry=require("core-js/modules/es.array-buffer.constructor.js"),Py=require("core-js/modules/es.array-buffer.slice.js"),Iy=require("core-js/modules/es.array-buffer.detached.js"),Ly=require("core-js/modules/es.array-buffer.transfer.js"),Ny=require("core-js/modules/es.array-buffer.transfer-to-fixed-length.js"),Oy=require("core-js/modules/es.typed-array.from.js"),Dy=require("core-js/modules/web.dom-collections.iterator.js"),Qt=require("three");var xe=class a extends rt{addDebug(){a.canvas.style.cssText=`
11814
11814
  position: fixed;
11815
11815
  top: 0;
11816
11816
  left: 0;
@@ -11810,7 +11810,7 @@ void main() {
11810
11810
  \`)};function og(n,t,e){this.x=n,this.y=t,this.weight=e}og.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};og.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};og.prototype.isWall=function(){return this.weight===0};function F2(n){this.content=[],this.scoreFunction=n}F2.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,i=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(i))this.content[e]=t,this.content[n]=i,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],i=this.scoreFunction(e);;){var s=n+1<<1,u=s-1,c=null,f;if(u<t){var p=this.content[u];f=this.scoreFunction(p),f<i&&(c=u)}if(s<t){var d=this.content[s],g=this.scoreFunction(d);g<(c===null?i:f)&&(c=s)}if(c!==null)this.content[n]=this.content[c],this.content[c]=e,n=c;else break}}};function Fx(){this._=null}function jl(n){n.U=n.C=n.L=n.R=n.P=n.N=null}Fx.prototype={constructor:Fx,insert:function(n,t){var e,i,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=U2(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)i=e.U,e===i.L?(s=i.R,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.R&&(Ff(this,e),n=e,e=n.U),e.C=!1,i.C=!0,Uf(this,i))):(s=i.L,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.L&&(Uf(this,e),n=e,e=n.U),e.C=!1,i.C=!0,Ff(this,i))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,i=n.L,s=n.R,u,c;if(i?s?u=U2(s):u=i:u=s,t?t.L===n?t.L=u:t.R=u:this._=u,i&&s?(c=u.C,u.C=n.C,u.L=i,i.U=u,u!==s?(t=u.U,u.U=n.U,n=u.R,t.L=n,u.R=s,s.U=u):(u.U=t,t=u,n=u.R)):(c=n.C,n=u),n&&(n.U=t),!c){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Ff(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,Uf(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Ff(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,Uf(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Ff(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,Uf(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function Ff(n,t){var e=t,i=t.R,s=e.U;s?s.L===e?s.L=i:s.R=i:n._=i,i.U=s,e.U=i,e.R=i.L,e.R&&(e.R.U=e),i.L=e}function Uf(n,t){var e=t,i=t.L,s=e.U;s?s.L===e?s.L=i:s.R=i:n._=i,i.U=s,e.U=i,e.L=i.R,e.L&&(e.L.U=e),i.R=e}function U2(n){for(;n.L;)n=n.L;return n}var Ux=Fx;function Kl(n,t,e,i){var s=[null,null],u=kr.push(s)-1;return s.left=n,s.right=t,e&&Bf(s,n,t,e),i&&Bf(s,t,n,i),Ti[n.index].halfedges.push(u),Ti[t.index].halfedges.push(u),s}function Ql(n,t,e){var i=[t,e];return i.left=n,i}function Bf(n,t,e,i){!n[0]&&!n[1]?(n[0]=i,n.left=t,n.right=e):n.left===e?n[1]=i:n[0]=i}function PK(n,t,e,i,s){var u=n[0],c=n[1],f=u[0],p=u[1],d=c[0],g=c[1],y=0,v=1,E=d-f,M=g-p,A;if(A=t-f,!(!E&&A>0)){if(A/=E,E<0){if(A<y)return;A<v&&(v=A)}else if(E>0){if(A>v)return;A>y&&(y=A)}if(A=i-f,!(!E&&A<0)){if(A/=E,E<0){if(A>v)return;A>y&&(y=A)}else if(E>0){if(A<y)return;A<v&&(v=A)}if(A=e-p,!(!M&&A>0)){if(A/=M,M<0){if(A<y)return;A<v&&(v=A)}else if(M>0){if(A>v)return;A>y&&(y=A)}if(A=s-p,!(!M&&A<0)){if(A/=M,M<0){if(A>v)return;A>y&&(y=A)}else if(M>0){if(A<y)return;A<v&&(v=A)}return!(y>0)&&!(v<1)||(y>0&&(n[0]=[f+y*E,p+y*M]),v<1&&(n[1]=[f+v*E,p+v*M])),!0}}}}}function RK(n,t,e,i,s){var u=n[1];if(u)return!0;var c=n[0],f=n.left,p=n.right,d=f[0],g=f[1],y=p[0],v=p[1],E=(d+y)/2,M=(g+v)/2,A,_;if(v===g){if(E<t||E>=i)return;if(d>y){if(!c)c=[E,e];else if(c[1]>=s)return;u=[E,s]}else{if(!c)c=[E,s];else if(c[1]<e)return;u=[E,e]}}else if(A=(d-y)/(v-g),_=M-A*E,A<-1||A>1)if(d>y){if(!c)c=[(e-_)/A,e];else if(c[1]>=s)return;u=[(s-_)/A,s]}else{if(!c)c=[(s-_)/A,s];else if(c[1]<e)return;u=[(e-_)/A,e]}else if(g<v){if(!c)c=[t,A*t+_];else if(c[0]>=i)return;u=[i,A*i+_]}else{if(!c)c=[i,A*i+_];else if(c[0]<t)return;u=[t,A*t+_]}return n[0]=c,n[1]=u,!0}function B2(n,t,e,i){for(var s=kr.length,u;s--;)(!RK(u=kr[s],n,t,e,i)||!PK(u,n,t,e,i)||!(Math.abs(u[0][0]-u[1][0])>Ln||Math.abs(u[0][1]-u[1][1])>Ln))&&delete kr[s]}function z2(n){return Ti[n.index]={site:n,halfedges:[]}}function LK(n,t){var e=n.site,i=t.left,s=t.right;return e===s&&(s=i,i=e),s?Math.atan2(s[1]-i[1],s[0]-i[0]):(e===i?(i=t[1],s=t[0]):(i=t[0],s=t[1]),Math.atan2(i[0]-s[0],s[1]-i[1]))}function Bx(n,t){return t[+(t.left!==n.site)]}function NK(n,t){return t[+(t.left===n.site)]}function G2(){for(var n=0,t=Ti.length,e,i,s,u;n<t;++n)if((e=Ti[n])&&(u=(i=e.halfedges).length)){var c=new Array(u),f=new Array(u);for(s=0;s<u;++s)c[s]=s,f[s]=LK(e,kr[i[s]]);for(c.sort(function(p,d){return f[d]-f[p]}),s=0;s<u;++s)f[s]=i[c[s]];for(s=0;s<u;++s)i[s]=f[s]}}function k2(n,t,e,i){var s=Ti.length,u,c,f,p,d,g,y,v,E,M,A,_,x=!0;for(u=0;u<s;++u)if(c=Ti[u]){for(f=c.site,d=c.halfedges,p=d.length;p--;)kr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)M=NK(c,kr[d[p]]),A=M[0],_=M[1],y=Bx(c,kr[d[++p%g]]),v=y[0],E=y[1],(Math.abs(A-v)>Ln||Math.abs(_-E)>Ln)&&(d.splice(p,0,kr.push(Ql(f,M,Math.abs(A-n)<Ln&&i-_>Ln?[n,Math.abs(v-n)<Ln?E:i]:Math.abs(_-i)<Ln&&e-A>Ln?[Math.abs(E-i)<Ln?v:e,i]:Math.abs(A-e)<Ln&&_-t>Ln?[e,Math.abs(v-e)<Ln?E:t]:Math.abs(_-t)<Ln&&A-n>Ln?[Math.abs(E-t)<Ln?v:n,t]:null))-1),++g);g&&(x=!1)}if(x){var T,w,R,B=1/0;for(u=0,x=null;u<s;++u)(c=Ti[u])&&(f=c.site,T=f[0]-n,w=f[1]-t,R=T*T+w*w,R<B&&(B=R,x=c));if(x){var U=[n,t],D=[n,i],P=[e,i],ct=[e,t];x.halfedges.push(kr.push(Ql(f=x.site,U,D))-1,kr.push(Ql(f,D,P))-1,kr.push(Ql(f,P,ct))-1,kr.push(Ql(f,ct,U))-1)}}for(u=0;u<s;++u)(c=Ti[u])&&(c.halfedges.length||delete Ti[u])}var q2=[],sg;function OK(){jl(this),this.x=this.y=this.arc=this.site=this.cy=null}function vu(n){var t=n.P,e=n.N;if(!(!t||!e)){var i=t.site,s=n.site,u=e.site;if(i!==u){var c=s[0],f=s[1],p=i[0]-c,d=i[1]-f,g=u[0]-c,y=u[1]-f,v=2*(p*y-d*g);if(!(v>=-V2)){var E=p*p+d*d,M=g*g+y*y,A=(y*E-d*M)/v,_=(p*M-g*E)/v,x=q2.pop()||new OK;x.arc=n,x.site=s,x.x=A+c,x.y=(x.cy=_+f)+Math.sqrt(A*A+_*_),n.circle=x;for(var T=null,w=tc._;w;)if(x.y<w.y||x.y===w.y&&x.x<=w.x)if(w.L)w=w.L;else{T=w.P;break}else if(w.R)w=w.R;else{T=w;break}tc.insert(T,x),T||(sg=x)}}}}function _u(n){var t=n.circle;t&&(t.P||(sg=t.N),tc.remove(t),q2.push(t),jl(t),n.circle=null)}var W2=[];function DK(){jl(this),this.edge=this.site=this.circle=null}function H2(n){var t=W2.pop()||new DK;return t.site=n,t}function zx(n){_u(n),xu.remove(n),W2.push(n),jl(n)}function X2(n){var t=n.circle,e=t.x,i=t.cy,s=[e,i],u=n.P,c=n.N,f=[n];zx(n);for(var p=u;p.circle&&Math.abs(e-p.circle.x)<Ln&&Math.abs(i-p.circle.cy)<Ln;)u=p.P,f.unshift(p),zx(p),p=u;f.unshift(p),_u(p);for(var d=c;d.circle&&Math.abs(e-d.circle.x)<Ln&&Math.abs(i-d.circle.cy)<Ln;)c=d.N,f.push(d),zx(d),d=c;f.push(d),_u(d);var g=f.length,y;for(y=1;y<g;++y)d=f[y],p=f[y-1],Bf(d.edge,p.site,d.site,s);p=f[0],d=f[g-1],d.edge=Kl(p.site,d.site,null,s),vu(p),vu(d)}function Y2(n){for(var t=n[0],e=n[1],i,s,u,c,f=xu._;f;)if(u=$2(f,e)-t,u>Ln)f=f.L;else if(c=t-FK(f,e),c>Ln){if(!f.R){i=f;break}f=f.R}else{u>-Ln?(i=f.P,s=f):c>-Ln?(i=f,s=f.N):i=s=f;break}z2(n);var p=H2(n);if(xu.insert(i,p),!(!i&&!s)){if(i===s){_u(i),s=H2(i.site),xu.insert(p,s),p.edge=s.edge=Kl(i.site,p.site),vu(i),vu(s);return}if(!s){p.edge=Kl(i.site,p.site);return}_u(i),_u(s);var d=i.site,g=d[0],y=d[1],v=n[0]-g,E=n[1]-y,M=s.site,A=M[0]-g,_=M[1]-y,x=2*(v*_-E*A),T=v*v+E*E,w=A*A+_*_,R=[(_*T-E*w)/x+g,(v*w-A*T)/x+y];Bf(s.edge,d,M,R),p.edge=Kl(d,n,null,R),s.edge=Kl(n,M,null,R),vu(i),vu(s)}}function $2(n,t){var e=n.site,i=e[0],s=e[1],u=s-t;if(!u)return i;var c=n.P;if(!c)return-1/0;e=c.site;var f=e[0],p=e[1],d=p-t;if(!d)return f;var g=f-i,y=1/u-1/d,v=g/d;return y?(-v+Math.sqrt(v*v-2*y*(g*g/(-2*d)-p+d/2+s-u/2)))/y+i:(i+f)/2}function FK(n,t){var e=n.N;if(e)return $2(e,t);var i=n.site;return i[1]===t?i[0]:1/0}var Ln=1e-6,V2=1e-12,xu,Ti,tc,kr;function UK(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function BK(n,t){return t[1]-n[1]||t[0]-n[0]}function ag(n,t){var e=n.sort(BK).pop(),i,s,u;for(kr=[],Ti=new Array(n.length),xu=new Ux,tc=new Ux;;)if(u=sg,e&&(!u||e[1]<u.y||e[1]===u.y&&e[0]<u.x))(e[0]!==i||e[1]!==s)&&(Y2(e),i=e[0],s=e[1]),e=n.pop();else if(u)X2(u.arc);else break;if(G2(),t){var c=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];B2(c,f,p,d),k2(c,f,p,d)}this.edges=kr,this.cells=Ti,xu=tc=kr=Ti=null}ag.prototype={constructor:ag,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(i){return Bx(t,n[i])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,i){if(f=(u=e.halfedges).length)for(var s=e.site,u,c=-1,f,p,d=t[u[f-1]],g=d.left===s?d.right:d.left;++c<f;)p=g,d=t[u[c]],g=d.left===s?d.right:d.left,p&&g&&i<p.index&&i<g.index&&UK(s,p,g)<0&&n.push([s.data,p.data,g.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var i=this,s,u=i._found||0,c=i.cells.length,f;!(f=i.cells[u]);)if(++u>=c)return null;var p=n-f.site[0],d=t-f.site[1],g=p*p+d*d;do f=i.cells[s=u],u=null,f.halfedges.forEach(function(y){var v=i.edges[y],E=v.left;if(!((E===f.site||!E)&&!(E=v.right))){var M=n-E[0],A=t-E[1],_=M*M+A*A;_<g&&(g=_,u=E.index)}});while(u!==null);return i._found=s,e==null||g<=e*e?f.site:null}};var XK=Qt(ec(),1);var t1=Qt(K2(),1);function Di(){return new cg}function cg(){this.reset()}cg.prototype={constructor:cg,reset:function(){this.s=this.t=0},add:function(n){Q2(lg,n,this.t),Q2(this,lg.s,this.s),this.s?this.t+=lg.t:this.s=lg.t},valueOf:function(){return this.s}};var lg=new cg;function Q2(n,t,e){var i=n.s=t+e,s=i-t,u=i-s;n.t=t-u+(e-s)}var yn=1e-6;var Tn=Math.PI,br=Tn/2,fg=Tn/4,os=Tn*2,Eu=180/Tn,Fi=Tn/180,nr=Math.abs,Uo=Math.atan,Ui=Math.atan2,hn=Math.cos;var hg=Math.exp;var zf=Math.log;var Me=Math.sin;var jr=Math.sqrt,Gf=Math.tan;function qx(n){return n>1?0:n<-1?Tn:Math.acos(n)}function Ci(n){return n>1?br:n<-1?-br:Math.asin(n)}function Bo(){}var YK=Di(),k0t=Di();function Su(n){var t=n[0],e=n[1],i=hn(e);return[i*hn(t),i*Me(t),Me(e)]}function kf(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function qf(n){var t=jr(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var j0t=Di();function eO(n,t){return[n>Tn?n-os:n<-Tn?n+os:n,t]}eO.invert=eO;function Vx(){var n=[],t;return{point:function(e,i){t.push([e,i])},lineStart:function(){n.push(t=[])},lineEnd:Bo,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Hx(n,t){return nr(n[0]-t[0])<yn&&nr(n[1]-t[1])<yn}function pg(n,t,e,i){this.x=n,this.z=t,this.o=e,this.e=i,this.v=!1,this.n=this.p=null}function Wx(n,t,e,i,s){var u=[],c=[],f,p;if(n.forEach(function(M){if(!((A=M.length-1)<=0)){var A,_=M[0],x=M[A],T;if(Hx(_,x)){for(s.lineStart(),f=0;f<A;++f)s.point((_=M[f])[0],_[1]);s.lineEnd();return}u.push(T=new pg(_,M,null,!0)),c.push(T.o=new pg(_,null,T,!1)),u.push(T=new pg(x,M,null,!1)),c.push(T.o=new pg(x,null,T,!0))}}),!!u.length){for(c.sort(t),nO(u),nO(c),f=0,p=c.length;f<p;++f)c[f].e=e=!e;for(var d=u[0],g,y;;){for(var v=d,E=!0;v.v;)if((v=v.n)===d)return;g=v.z,s.lineStart();do{if(v.v=v.o.v=!0,v.e){if(E)for(f=0,p=g.length;f<p;++f)s.point((y=g[f])[0],y[1]);else i(v.x,v.n.x,1,s);v=v.n}else{if(E)for(g=v.p.z,f=g.length-1;f>=0;--f)s.point((y=g[f])[0],y[1]);else i(v.x,v.p.x,-1,s);v=v.p}v=v.o,g=v.z,E=!E}while(!v.v);s.lineEnd()}}}function nO(n){if(t=n.length){for(var t,e=0,i=n[0],s;++e<t;)i.n=s=n[e],s.p=i,i=s;i.n=s=n[0],s.p=i}}function Aa(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function Xx(n){return n.length===1&&(n=JK(n)),{left:function(t,e,i,s){for(i==null&&(i=0),s==null&&(s=t.length);i<s;){var u=i+s>>>1;n(t[u],e)<0?i=u+1:s=u}return i},right:function(t,e,i,s){for(i==null&&(i=0),s==null&&(s=t.length);i<s;){var u=i+s>>>1;n(t[u],e)>0?s=u:i=u+1}return i}}}function JK(n){return function(t,e){return Aa(n(t),e)}}var rO=Xx(Aa),jK=rO.right,KK=rO.left;var iO=Array.prototype,tQ=iO.slice,eQ=iO.map;var Vyt=Math.sqrt(50),Hyt=Math.sqrt(10),Wyt=Math.sqrt(2);function gg(n){for(var t=n.length,e,i=-1,s=0,u,c;++i<t;)s+=n[i].length;for(u=new Array(s);--t>=0;)for(c=n[t],e=c.length;--e>=0;)u[--s]=c[e];return u}var lQ=1e9,C_t=-lQ;var Yx=Di();function $x(n,t){var e=t[0],i=t[1],s=[Me(e),-hn(e),0],u=0,c=0;Yx.reset();for(var f=0,p=n.length;f<p;++f)if(g=(d=n[f]).length)for(var d,g,y=d[g-1],v=y[0],E=y[1]/2+fg,M=Me(E),A=hn(E),_=0;_<g;++_,v=T,M=R,A=B,y=x){var x=d[_],T=x[0],w=x[1]/2+fg,R=Me(w),B=hn(w),U=T-v,D=U>=0?1:-1,P=D*U,ct=P>Tn,L=M*R;if(Yx.add(Ui(L*D*Me(P),A*B+L*hn(P))),u+=ct?U+D*os:U,ct^v>=e^T>=e){var W=kf(Su(y),Su(x));qf(W);var V=kf(s,W);qf(V);var Mt=(ct^U>=0?-1:1)*Ci(V[2]);(i>Mt||i===Mt&&(W[0]||W[1]))&&(c+=ct^U>=0?1:-1)}}return(u<-yn||u<yn&&Yx<-yn)^c&1}var B_t=Di();var rxt=Di(),ixt=Di();var hQ=1/0;var axt=-hQ;function Zx(n){this._context=n}Zx.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,os);break}}},result:Bo};var yxt=Di();function Jx(){this._string=[]}Jx.prototype={_radius:4.5,_circle:aO(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=aO(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function aO(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function jx(n,t,e,i){return function(s,u){var c=t(u),f=s.invert(i[0],i[1]),p=Vx(),d=t(p),g=!1,y,v,E,M={point:A,lineStart:x,lineEnd:T,polygonStart:function(){M.point=w,M.lineStart=R,M.lineEnd=B,v=[],y=[]},polygonEnd:function(){M.point=A,M.lineStart=x,M.lineEnd=T,v=gg(v);var U=$x(y,f);v.length?(g||(u.polygonStart(),g=!0),Wx(v,gQ,U,e,u)):U&&(g||(u.polygonStart(),g=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),g&&(u.polygonEnd(),g=!1),v=y=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function A(U,D){var P=s(U,D);n(U=P[0],D=P[1])&&u.point(U,D)}function _(U,D){var P=s(U,D);c.point(P[0],P[1])}function x(){M.point=_,c.lineStart()}function T(){M.point=A,c.lineEnd()}function w(U,D){E.push([U,D]);var P=s(U,D);d.point(P[0],P[1])}function R(){d.lineStart(),E=[]}function B(){w(E[0][0],E[0][1]),d.lineEnd();var U=d.clean(),D=p.result(),P,ct=D.length,L,W,V;if(E.pop(),y.push(E),E=null,!!ct){if(U&1){if(W=D[0],(L=W.length-1)>0){for(g||(u.polygonStart(),g=!0),u.lineStart(),P=0;P<L;++P)u.point((V=W[P])[0],V[1]);u.lineEnd()}return}ct>1&&U&2&&D.push(D.pop().concat(D.shift())),v.push(D.filter(dQ))}}return M}}function dQ(n){return n.length>1}function gQ(n,t){return((n=n.x)[0]<0?n[1]-br-yn:br-n[1])-((t=t.x)[0]<0?t[1]-br-yn:br-t[1])}var mQ=jx(function(){return!0},yQ,_Q,[-Tn,-br]);function yQ(n){var t=NaN,e=NaN,i=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(u,c){var f=u>0?Tn:-Tn,p=nr(u-t);nr(p-Tn)<yn?(n.point(t,e=(e+c)/2>0?br:-br),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),n.point(u,e),s=0):i!==f&&p>=Tn&&(nr(t-i)<yn&&(t-=i*yn),nr(u-f)<yn&&(u-=f*yn),e=vQ(t,e,u,c),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),s=0),n.point(t=u,e=c),i=f},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function vQ(n,t,e,i){var s,u,c=Me(n-e);return nr(c)>yn?Uo((Me(t)*(u=hn(i))*Me(e)-Me(i)*(s=hn(t))*Me(n))/(s*u*c)):(t+i)/2}function _Q(n,t,e,i){var s;if(n==null)s=e*br,i.point(-Tn,s),i.point(0,s),i.point(Tn,s),i.point(Tn,0),i.point(Tn,-s),i.point(0,-s),i.point(-Tn,-s),i.point(-Tn,0),i.point(-Tn,s);else if(nr(n[0]-t[0])>yn){var u=n[0]<t[0]?Tn:-Tn;s=e*u/2,i.point(-u,s),i.point(0,s),i.point(u,s)}else i.point(t[0],t[1])}function mg(n){return function(t){var e=new Kx;for(var i in n)e[i]=n[i];return e.stream=t,e}}function Kx(){}Kx.prototype={constructor:Kx,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var i1t=hn(30*Fi);var v1t=mg({point:function(n,t){this.stream.point(n*Fi,t*Fi)}});function yg(n){return function(t,e){var i=hn(t),s=hn(e),u=n(i*s);return[u*s*Me(t),u*Me(e)]}}function ss(n){return function(t,e){var i=jr(t*t+e*e),s=n(i),u=Me(s),c=hn(s);return[Ui(t*u,i*c),Ci(i&&e*u/i)]}}var dO=yg(function(n){return jr(2/(1+n))});dO.invert=ss(function(n){return 2*Ci(n/2)});var gO=yg(function(n){return(n=qx(n))&&n/Me(n)});gO.invert=ss(function(n){return n});function Qx(n,t){return[n,zf(Gf((br+t)/2))]}Qx.invert=function(n,t){return[n,2*Uo(hg(t))-br]};function vg(n,t){return[n,t]}vg.invert=vg;function mO(n,t){var e=hn(t),i=hn(n)*e;return[e*Me(n)/i,Me(t)/i]}mO.invert=ss(Uo);function yO(n,t){var e=t*t,i=e*e;return[n*(.8707-.131979*e+i*(-.013791+i*(.003971*e-.001529*i))),t*(1.007226+e*(.015085+i*(-.044475+.028874*e-.005916*i)))]}yO.invert=function(n,t){var e=t,i=25,s;do{var u=e*e,c=u*u;e-=s=(e*(1.007226+u*(.015085+c*(-.044475+.028874*u-.005916*c)))-t)/(1.007226+u*(.015085*3+c*(-.044475*7+.028874*9*u-.005916*11*c)))}while(nr(s)>yn&&--i>0);return[n/(.8707+(u=e*e)*(-.131979+u*(-.013791+u*u*u*(.003971-.001529*u)))),e]};function vO(n,t){return[hn(t)*Me(n),Me(t)]}vO.invert=ss(Ci);function _O(n,t){var e=hn(t),i=1+hn(n)*e;return[e*Me(n)/i,Me(t)/i]}_O.invert=ss(function(n){return 2*Uo(n)});function xO(n,t){return[zf(Gf((br+t)/2)),-n]}xO.invert=function(n,t){return[-t,2*Uo(hg(n))-br]};var bQ=Qt(ec(),1);var AQ=Qt(ec(),1);var CQ=Qt(ec(),1);var IQ=Qt(ec(),1);function SO(n,t){let e=0,i=1/0,[s,u]=t;for(let c=0;c<n.length-1;c++){let[f,p]=n[c],[d,g]=n[c+1],y=Math.min(f,d)<=s&&s<=Math.max(f,d),v=Math.min(p,g)<=u&&u<=Math.max(p,g);if(y&&v){let E=Math.abs((d-f)*(u-p)-(g-p)*(s-f));E<i&&(i=E,e=c)}}return e}function wO(n,t){let e=n[0],i=n[1],s=!1;for(let u=0,c=t.length-1;u<t.length;c=u++){let f=t[u][0],p=t[u][1],d=t[c][0],g=t[c][1];p>i!=g>i&&e<(d-f)*(i-p)/(g-p)+f&&(s=!s)}return s}var NAt=Qt(ZO(),1),OAt=Qt(o_(),1);function aD(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function uD(n){let t={};for(let i in n)i.startsWith("on")&&(t[aD(i.slice(2))]=n[i]);let e=i=>Ri(this,null,function*(){let{data:s}=i;if(t[s.type])try{let u=yield t[s.type](s.data);if(u!=null&&u.$transfer&&Array.isArray(u.$transfer)){let c=u.$transfer;delete u.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:u},c)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:u})}catch(u){self.postMessage({type:""+s.type+"_result",key:s.key,error:u})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var qAt=Qt(bD(),1),VAt=Qt(Bc(),1);function AD(n,t,e){e===void 0&&(e=0),n.forEach(i=>{if(i.geometry.coords=JSON.parse(JSON.stringify(i.geometry.cds)),i.geometry.type==="polygon"){var s;i.geometry.coords.map(u=>{Array.isArray(u)&&u.forEach(c=>{c[0]-=t[0],c[1]-=t[1]})}),i.geometry.otherCds&&(i.geometry.otherCoords=i.geometry.otherCds.map(u=>u.map(c=>ic(c,t)))),(s=i.doors)!=null&&s.length&&i.doors.map(u=>{u.coord=ic(u.coordinate,t)}),i.center&&(i.centerCoords=ic(i.center,t))}else i.geometry.coords=ic(i.geometry.cds,t),i.center&&(i.centerCoords=ic(i.center,t));if(i.center_x&&i.center_y){let[u,c]=ic([i.center_x,i.center_y],t);i.center_coord_x=u,i.center_coord_y=c}});for(let i=0;i<n.length;i++){let s=n[i];s.deltaHeight=1e-5*(e+i+1)}}function ic(n,t){return[n[0]-t[0],n[1]-t[1]]}var jAt=Qt(p0(),1),KAt=Qt(d0(),1),QAt=Qt(g0(),1),tTt=Qt(y0(),1),eTt=Qt(v0(),1),nTt=Qt(S0(),1),rTt=Qt(I0(),1),iTt=Qt(R0(),1),oTt=Qt(L0(),1),sTt=Qt(O0(),1),aTt=Qt(F0(),1),uTt=Qt(G0(),1),lTt=Qt(V0(),1),cTt=Qt(iy(),1),fTt=Qt(oy(),1),hTt=Qt(Sh(),1);function Eg(n,t=!1){let e=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),s=new Set(Object.keys(n[0].morphAttributes)),u={},c={},f=n[0].morphTargetsRelative,p=new ui,d=0;for(let g=0;g<n.length;++g){let y=n[g],v=0;if(e!==(y.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let E in y.attributes){if(!i.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+'. All geometries must have compatible attributes; make sure "'+E+'" attribute exists among all geometries, or in none of them.'),null;u[E]===void 0&&(u[E]=[]),u[E].push(y.attributes[E]),v++}if(v!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". Make sure all geometries have the same number of attributes."),null;if(f!==y.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let E in y.morphAttributes){if(!s.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphAttributes must be consistent throughout all geometries."),null;c[E]===void 0&&(c[E]=[]),c[E].push(y.morphAttributes[E])}if(t){let E;if(e)E=y.index.count;else if(y.attributes.position!==void 0)E=y.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". The geometry must have either an index or a position attribute"),null;p.addGroup(d,E,g),d+=E}}if(e){let g=0,y=[];for(let v=0;v<n.length;++v){let E=n[v].index;for(let M=0;M<E.count;++M)y.push(E.getX(M)+g);g+=n[v].attributes.position.count}p.setIndex(y)}for(let g in u){let y=TD(u[g]);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" attribute."),null;p.setAttribute(g,y)}for(let g in c){let y=c[g][0].length;if(y===0)break;p.morphAttributes=p.morphAttributes||{},p.morphAttributes[g]=[];for(let v=0;v<y;++v){let E=[];for(let A=0;A<c[g].length;++A)E.push(c[g][A][v]);let M=TD(E);if(!M)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" morphAttribute."),null;p.morphAttributes[g].push(M)}}return p}function TD(n){let t,e,i,s=-1,u=0;for(let d=0;d<n.length;++d){let g=n[d];if(t===void 0&&(t=g.array.constructor),t!==g.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=g.itemSize),e!==g.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=g.normalized),i!==g.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(s===-1&&(s=g.gpuType),s!==g.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;u+=g.count*e}let c=new t(u),f=new Yn(c,e,i),p=0;for(let d=0;d<n.length;++d){let g=n[d];if(g.isInterleavedBufferAttribute){let y=p/e;for(let v=0,E=g.count;v<E;v++)for(let M=0;M<e;M++){let A=g.getComponent(v,M);f.setComponent(v+y,M,A)}}else c.set(g.array,p);p+=g.count*e}return s!==void 0&&(f.gpuType=s),f}function CD(n,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=n.filter(f=>f.geometry.type==="polygon");if(!i.length)return null;let s=i.map(f=>{var p;let d=f.geometry.coords,g=fd(d[0],d.slice(1)),y=new rd(g,{steps:1,bevelEnabled:!1,depth:f.height,curveSegments:4});(p=f).deltaHeight||(p.deltaHeight=0),y.translate(0,0,f.airHeight+f.deltaHeight);let v=y.attributes.position.count,E=new Float32Array(v).fill(f.height+f.airHeight+f.deltaHeight);if(y.setAttribute("maxZ",new Yn(E,1)),y.setAttribute("opacity",new Yn(new Float32Array(v).fill(f.fillOpacity),1)),e){let _=new Float32Array(v).fill(f.airHeight+f.deltaHeight);y.setAttribute("minZ",new Yn(_,1))}let M=new Te(f.fillColor).convertLinearToSRGB(),A=new Float32Array(v*3);for(let _=0;_<v;_++)A[_*3]=M.r,A[_*3+1]=M.g,A[_*3+2]=M.b;return y.setAttribute("color",new Yn(A,3)),y}),u=Eg(s);s.forEach(f=>f.dispose());let c={geometry:u};return u.dispose(),t&&(c.lineGeometry=c1(i)||void 0),c}function c1(n){let{points:t,colors:e,opacities:i}=Ktt(n);if(!t.length)return null;let s=new ui().setFromPoints(t);return s.setAttribute("color",new Yn(new Float32Array(e),3)),s.setAttribute("opacity",new Yn(new Float32Array(i),1)),s}function Ktt(n){let t=[],e=[],i=[];return n.filter(s=>s.strokeOpacity>0).map(s=>{let u=s.height+(s.deltaHeight||0)+s.airHeight,{coords:c}=s.geometry,{strokeColor:f,strokeOpacity:p}=s,d=new Te(f).convertLinearToSRGB();for(let g=0;g<c.length;g++){let y=c[g];for(let v=0;v<y.length;v++){let E=y[v],M=v+1===y.length?y[0]:y[v+1];t.push(new st(E[0],E[1],u)),t.push(new st(M[0],M[1],u)),e.push(d.r,d.g,d.b),e.push(d.r,d.g,d.b),i.push(p),i.push(p)}}}),{points:t,colors:e,opacities:i}}var Hf=function(n){return n.HALF="half",n.POWER="power",n.MECHANICAL="mechanical",n.NORMAL="normal",n.VIP="vip",n}({});var ID=new Ko,Sg=new st,wg=class extends sd{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let t=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],e=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new _r(t,3)),this.setAttribute("uv",new _r(e,2))}applyMatrix4(t){let e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return e!==void 0&&(e.applyMatrix4(t),i.applyMatrix4(t),e.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));let i=new gf(e,6,1);return this.setAttribute("instanceStart",new ts(i,3,0)),this.setAttribute("instanceEnd",new ts(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));let i=new gf(e,6,1);return this.setAttribute("instanceColorStart",new ts(i,3,0)),this.setAttribute("instanceColorEnd",new ts(i,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new od(t.geometry)),this}fromLineSegments(t){let e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ko);let t=this.attributes.instanceStart,e=this.attributes.instanceEnd;t!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(t),ID.setFromBufferAttribute(e),this.boundingBox.union(ID))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new uu),this.boundingBox===null&&this.computeBoundingBox();let t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(t!==void 0&&e!==void 0){let i=this.boundingSphere.center;this.boundingBox.getCenter(i);let s=0;for(let u=0,c=t.count;u<c;u++)Sg.fromBufferAttribute(t,u),s=Math.max(s,i.distanceToSquared(Sg)),Sg.fromBufferAttribute(e,u),s=Math.max(s,i.distanceToSquared(Sg));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}};var xTt=Qt(sD(),1);var Mg=function(n){return n.LAYERED_RENDER_VERSION="layeredRender",n.MERGED_RENDER_VERSION="mergedRender",n}({});var f1=["range","ground","store","facility","parkingSpace"];function PD(n){return f1.indexOf(n.l_type)===-1?f1.length:f1.indexOf(n.l_type)}function Qtt(n){n.layers.sort((t,e)=>PD(t)-PD(e))}function tet(n){let t=n.layers.find(i=>i.l_type==="range"),e=[t.elements[0].center_x,t.elements[0].center_y];n.layers.map(i=>{if(i.l_type!=="range")return AD(i.elements,e)})}function RD(n){Qtt(n),tet(n)}function bg(n,t){return t===void 0&&(t=4),n.floor_id+"_"+n.version_id+(t?"_"+t:"")}var oc=[],sc=[];function eet(n,t){return Ri(this,null,function*(){return yield rp(),fy(n,""+t)})}function LD(n,t,e){return Ri(this,null,function*(){let{db:i}=yield rp();return cC(n,""+t,e,i)})}function net(n){return Ri(this,null,function*(){let t=yield fetch(n.map_url).then(e=>e.json());return t.floor=n.floor,RD(t),oc.push(t),t})}function ret(n,t){return Ri(this,null,function*(){let e=bg(n,t===Mg.LAYERED_RENDER_VERSION?1:void 0);try{let i=yield eet(np.MAP_DATA,e);return i&&(t===Mg.LAYERED_RENDER_VERSION||i.transformed)?(console.log("\\u4ECE\\u7F13\\u5B58\\u4E2D\\u53D6\\u5230\\u4E86\\u6570\\u636E"),i):(console.log("\\u7F13\\u5B58\\u4E2D\\u6CA1\\u6709\\u6570\\u636E",e,i),sc.push(n),null)}catch(i){return console.log("[get floor data error]",i),sc.push(n),null}})}function iet(n,t){return t===void 0&&(t=!0),t&&(n.layers.forEach(e=>{switch(e.l_type){case"ground":if(e.elements.length<2)break;e.mergedElements=Wf(e.elements);break;case"store":h1(e.elements),e.mergedElements=Wf(e.elements);break;case"facility":h1(e.elements),e.mergedElements=Wf(e.elements);break;case"parkingSpace":console.time("parkingSpace merge"),e.mergedElements=oet(e.elements),console.timeEnd("parkingSpace merge"),e.mergedParkingTexture=uet(e.elements);break;case"graph":h1(e.elements),e.mergedElements=Wf(e.elements);break;case"wall":e.mergedElements=Wf(e.elements,!1,!0);break;case"lane":e.mergedElements=set(e.elements);break;case"texture2d":case"texture3d":e.mergedMatrixes=ND(e.elements);break;case"glb":case"text":}}),n.transformed=!0),n}function Wf(n,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=CD(n,t,e);if(i){var s;return[xc({},n[0],{mergedGeometry:i.geometry.toJSON(),lineGeometry:((s=i.lineGeometry)==null?void 0:s.toJSON())||null})]}else return[]}function oet(n){let t=[],e=[],i=[],s=[];n.forEach((c,f)=>{let p=c.geometry.coords[0],[d,g,y]=p.slice(0,3),v=Math.sqrt((g[0]-d[0])**2+(g[1]-d[1])**2),E=Math.sqrt((y[0]-g[0])**2+(y[1]-g[1])**2),M=[v,E],A=Math.max(...M),_=Math.min(...M),x;A===v?x=[g[0]-d[0],g[1]-d[1]]:x=[y[0]-g[0],y[1]-g[1]];let[T,w]=x,R=Math.atan2(w,T)-Math.PI/2,B=new jn().compose(new st(c.center_coord_x,c.center_coord_y,(c.deltaHeight||0)+c.airHeight+c.height/2),new No().setFromAxisAngle(new st(0,0,1),R),new st(_,A,c.height));i.push(...B.toArray()),s.push(...new Te(c.fillColor).convertLinearToSRGB().toArray()),t[f]=c.fillOpacity||1,e[f]=(c.deltaHeight||0)+c.airHeight+c.height});let u=c1(n);return{size:n.length,opacities:t,maxZ:e,matrixes:i,colors:s,lineGeometry:(u==null?void 0:u.toJSON())||null}}function ND(n){let t=n.reduce((i,s)=>{let{iconUrl:u}=s;return i.has(u)||i.set(u,[]),i.get(u).push(s),i},new Map);return Array.from(t.values()).map(i=>{let s=i.map(c=>new jn().compose(new st(c.centerCoords[0],c.centerCoords[1],c.deltaHeight+c.airHeight+c.height),new No().setFromAxisAngle(new st(0,0,1),c.secondRotate),new st(c.secondWidth,c.secondHeight,1)).toArray());return xc({},i[0],{mergedMatrixes:{size:s.length,array:s.flat()}})})}function set(n){let t=n.map(u=>{let c=fd(u.geometry.coords[0].slice(0,-1),u.geometry.coords.slice(1)),f=new id(c,4),p=f.getAttribute("position"),d=[],g=new Te(u.fillColor);for(let v=0;v<p.count;v++){p.setZ(v,u.airHeight+(u.deltaHeight||0));var y;d.push(g.r,g.g,g.b,(y=u.fillOpacity)!=null?y:1)}return f.setAttribute("color",new Yn(new Float32Array(d),4)),f}),e=Eg(t);t.forEach(u=>u.dispose());let i={mergedGeometry:e.toJSON()};e.dispose();let s=n.filter(u=>{var c,f;return u.double&&((f=u.geometry.otherCoords)==null||(c=f[1])==null?void 0:c.length)});return s.length&&[!0,!1].forEach(u=>{let c=s.filter(g=>g.double===!0&&g.dashed===u);if(!c.length)return;let f=[],p=[];c.forEach(g=>{let y=g.geometry.otherCoords[1],v=g.airHeight+(g.deltaHeight||0)+.01,E=new Te(g.secondColor);for(let M=0;M<y.length-1;M++){let A=y[M],_=y[M+1];f.push(A[0],A[1],v,_[0],_[1],v),p.push(E.r,E.g,E.b,E.r,E.g,E.b)}});let d=new wg;d.setPositions(f),d.setColors(p),i[u?"dashedLineGeometry":"lineGeometry"]={positions:f,colors:p},d.dispose()}),i}var aet=new Set([Hf.HALF,Hf.MECHANICAL,Hf.POWER,Hf.VIP]);function uet(n){let t=n.filter(e=>aet.has(e.parkingType)).map(e=>{let i=new Ft(...e.geometry.coords[0][0]),s=new Ft(...e.geometry.coords[0][1]),u=new Ft(...e.geometry.coords[0][2]),c=Math.min(i.distanceTo(s),s.distanceTo(u)),f=0;return c===i.distanceTo(s)?f=s.sub(i).angle()-Math.PI/2:f=u.sub(s).angle()-Math.PI/2,{uuid:e.id,iconUrl:e.parkingType,name:e.texts[0],deltaHeight:(e.deltaHeight||0)+.001,airHeight:e.airHeight,height:e.height,geometry:e.geometry,opacity:e.fillOpacity,visible:!0,secondWidth:c-1,secondHeight:c-1,secondRotate:f,centerCoords:[e.center_coord_x,e.center_coord_y]}});return ND(t)}function h1(n){n.map(t=>{var e;if((e=t.doors)!=null&&e.length&&t.geometry.type==="polygon"){let i=t.geometry.coords[0];t.doors.forEach(s=>{let u=s.type==="single"?.5:1,c=.5,f=SO(i,s.coord),p=new Ft(...s.coord),d=new Ft(...i[f]).sub(new Ft(...s.coord)).normalize(),g=new Ft().addVectors(p,d.clone().multiplyScalar(u)),y=new Ft().addVectors(p,d.clone().multiplyScalar(-u)),v=new Ft(-d.y,d.x),E=new Ft().addVectors(g,v.clone().multiplyScalar(c));wO([E.x,E.y],i)||(v.multiplyScalar(-1),E=new Ft().addVectors(g,v.clone().multiplyScalar(c)));let M=new Ft().addVectors(y,v.clone().multiplyScalar(c)),A=[[g.x,g.y],[E.x,E.y],[M.x,M.y],[y.x,y.y]];i=[...i.slice(0,f+1),...A,...i.slice(f+1)]}),t.geometry.coords[0]=i}})}var p1="";function OD(n){let t=sc.findIndex(e=>e.floor===n);if(t!==-1){console.log("\\u8C03\\u6574\\u697C\\u5C42\\u8BF7\\u6C42\\u7684\\u4F18\\u5148\\u7EA7",n,t);let e=sc.splice(t,1)[0];sc.unshift(e)}else p1=n}var d1="";function DD(n){let t=oc.findIndex(e=>e.floor===n);if(t!==-1){console.log("\\u8C03\\u6574\\u697C\\u5C42merge\\u4F18\\u5148\\u7EA7",n,t);let e=oc.splice(t,1)[0];oc.unshift(e)}else d1=n}function cet(n){OD(n),DD(n)}uD({onLoad(n){return Ri(this,null,function*(){let{floors:t,version:e}=n;for(yield rp(),yield Promise.all(t.map(i=>Ri(this,null,function*(){return ret(i,e)}))),p1&&OD(p1),yield Promise.all(sc.map(i=>Ri(this,null,function*(){let s=yield net(i);if(s&&e===Mg.LAYERED_RENDER_VERSION){let u=bg(t.find(c=>c.floor===s.floor),1);yield LD(np.MAP_DATA,u,s),console.log(s.floor+" \\u5199\\u5165\\u7F13\\u5B58\\u6210\\u529F\\uFF0Ckey="+u),self.postMessage({type:"floor_success",data:{floor:s.floor}})}}))),d1&&DD(d1);oc.length>0;){let i=oc.shift(),s=iet(i),u=bg(t.find(c=>c.floor===i.floor));yield LD(np.MAP_DATA,u,s),console.log(i.floor+" \\u5199\\u5165\\u7F13\\u5B58\\u6210\\u529F\\uFF0Ckey="+u),self.postMessage({type:"floor_success",data:{floor:i.floor}})}fC(),console.log("\\u6240\\u6709\\u6570\\u636E\\u5904\\u7406\\u5B8C\\u6210")})},onAdjustFloorPriority(n){let{floor:t}=n;cet(t)}});
11811
11811
  `],{type:"text/javascript"}),t=URL.createObjectURL(a),e=new Worker(t);return URL.revokeObjectURL(t),e}var vc={mergeParkingSpace:!0,mergeGraphic:!0,renderVersion:qe.MERGED_RENDER_VERSION,layers:["graph","wall","lane","texture2d","texture3d","glb","store","facility","parkingSpace","text"],filterPoi:()=>!0},Ae=class extends ${initDb(){return g(this,null,function*(){try{let{db:t}=yield _n();this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return g(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=x({},this.placeConfig,e));else if(typeof t=="string"){let n=yield fetch(t).then(r=>r.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=x({},this.placeConfig,JSON.parse(n.data.config||"{}")))}else return this.load("https://screen.aibee.cn/ai-map/map/get-floor-map?place_id="+t);this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return g(this,null,function*(){return this.initDbPromise.then(()=>vn(t,""+e,n))})}getCacheData(t,e){return g(this,null,function*(){return this.initDbPromise.then(()=>Fe(t,""+e))})}getFloorData(t){return g(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return g(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=ar(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=ur(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return g(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>g(this,null,function*(){let r=Te(t),i=yield fetch(t.map_url).then(o=>o.json());i.floor=t.floor,je(i),this.setCacheData(lt.MAP_DATA,r,i),this.setCacheData(lt.MAP_VERSION,r,t.version_id),n(i)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return g(this,null,function*(){let e=this.floors.find(n=>n.floor===t);return e?new Promise(n=>g(this,null,function*(){let r=Te(e,this.options.renderVersion===qe.LAYERED_RENDER_VERSION?1:void 0);try{let i=Te(e),o=yield this.getCacheData(lt.MAP_DATA,i);if(o&&o.transformed){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u5408\u5E76\u540E\u7684\u6570\u636E"),n(o);return}if(this.options.renderVersion===qe.LAYERED_RENDER_VERSION){let s=yield this.getCacheData(lt.MAP_DATA,r);if(s){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u6570\u636E"),n(s);return}}if(console.log("\u7F13\u5B58\u4E2D\u6CA1\u6709\u6570\u636E"),this.loadWorker){X(this.loadWorker,"adjust_floor_priority",{floor:t});let s=u=>{if(u.data.type==="floor_success"&&u.data.data.floor===t){var l;(l=this.loadWorker)==null||l.removeEventListener("message",s),n(this.getFloorJsonData(t))}};this.loadWorker.addEventListener("message",s)}else n(this.getFloorJsonDataByFloorInfo(e))}catch(i){console.log("[get floor data error]",i),n(this.getFloorJsonDataByFloorInfo(e))}})):null})}getRoadNetworkData(){return g(this,null,function*(){return(yield Promise.all(this.floors.map(e=>g(this,null,function*(){let n=Te(e,0);try{let r=yield this.getCacheData(lt.ROAD_NETWORK_DATA,n);if(r)return r;let i=yield fetch(e.route_url).then(o=>o.json());return this.setCacheData(lt.ROAD_NETWORK_DATA,n,i),this.setCacheData(lt.ROUTE_VERSION,n,e.version_id),i}catch(r){let i=yield fetch(e.route_url).then(o=>o.json());return this.setCacheData(lt.ROAD_NETWORK_DATA,n,i),i}})))).filter(e=>e.points)})}getFacilitiesData(){return g(this,null,function*(){let t=this.floors.reduce((r,i)=>r.updated_at>i.updated_at?r:i,this.floors[0]);if(!t)return null;let e=Te(t,0),n=()=>g(this,null,function*(){let r=yield fetch(t.entry_infra_url).then(i=>i.json());return r&&(this.setCacheData(lt.FACILITY_DATA,e,r),this.setCacheData(lt.FACILITY_VERSION,e,t.version_id)),r});try{let r=yield this.getCacheData(lt.FACILITY_DATA,e);return r||n()}catch(r){return console.log("[get facility error]",r),n()}})}getOtherDataByFreeTime(){return g(this,null,function*(){yield this.initDbPromise,yield X(this.loadWorker,"load",{floors:this.floors,version:this.options.renderVersion}),this.closeWorker()})}getMulFloorsData(t){return g(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return g(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return g(this,null,function*(){je(t),e=this.getFloorBaseLayer(t,e);let r=x({},this.placeConfig,n);return yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,r),this.changeFloorBox(t,e),e})}getDataByJsonStep(t,e,n){return g(this,null,function*(){je(t),e=this.getFloorBaseLayer(t,e);let r=x({},this.placeConfig,n);return this.changeFloorBox(t,e),requestAnimationFrame(()=>g(this,null,function*(){yield this.getFloorContentLayer(t,e),this.changeFloorBox(t,e),requestAnimationFrame(()=>g(this,null,function*(){yield this.getFloorPoi(t,e,r),this.changeFloorBox(t,e)}))})),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new mc),r=Math.max(n.x,n.y,n.z);e.userData.height=r/4+t.floorHeight}switchFloor(t,e){return g(this,null,function*(){return new Promise(n=>{let r={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},i=this.taskQueue.replaceByMetaType(r),o=s=>{let{task:u,res:l}=s;u.tid===i&&(this.taskQueue.removeEventListener("active-task-end",o),n(l))};this.taskQueue.addEventListener("active-task-end",o)})})}_switchFloor(t,e){return g(this,null,function*(){var n;let r=t;if(typeof t=="string"){let c=yield this.getFloorJsonData(t);if(c)r=c;else return null}else je(t);let i=x({},this.placeConfig,e),o=new xt(this.bmap.context);o.userData.data=t;let s=this.floors.find(c=>c.floor===r.floor);var u;let l=(u=s==null?void 0:s.map_angle)!=null?u:0;return this.bmap.dispatchEvent({type:st.SWITCH_FLOOR_BEFORE,data:{curFloor:o,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:o,graphics:[],floorData:r}}),this.bmap.context.scene.background=new _c(i.backgroundColor),this.getFloorBaseLayer(r,o),this.changeFloorBox(r,o),this.bmap.buildingCenter=o.userData.center,this.bmap.currentBuildGround=(n=o.userData.data.layers.find(c=>c.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(o),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(l/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:st.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield Dr(),yield this.getFloorContentLayer(r,o),this.changeFloorBox(r,o),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield Oi(2),yield this.getFloorPoi(r,o,i),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:st.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new xt(this.bmap.context));let n=[0,0];return t.layers.forEach(r=>{switch(r.l_type){case"range":let i=r.elements[0];n=[i.center_x,i.center_y],e.userData.range=i.geometry.cds[0],e.userData.rangeGraphic=i;break;case"ground":oi(r,e);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return g(this,null,function*(){e||(e=new xt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let r=0;r<t.layers.length;r++){let i=t.layers[r];["range","ground"].includes(i.l_type)||this.options.layers.includes(i.l_type)&&(ls(i,e,this.options),console.log("time",Date.now()-n,i.l_type),n=Date.now())}return e})}getFloorPoi(t,e,n){return g(this,null,function*(){n===void 0&&(n=this.placeConfig);let r=Date.now();yield Promise.all(t.layers.map(o=>{if(this.options.layers.includes(o.l_type))return cs(o,e,this.locale,n,this.options)})),console.log("poi time",Date.now()-r);let i=Date.now();Dr().then(()=>{console.log("poi render time",Date.now()-i)})})}clear(){return g(this,null,function*(){po(),this.db=null})}closeWorker(){this.loadWorker&&(this.loadWorker.terminate(),this.loadWorker=null)}dispose(){super.dispose(),this.clear(),this.closeWorker(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new ve,this.loadWorker=si(),this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=x({},vc,e),this.placeConfig=x({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};import"core-js/modules/web.dom-collections.iterator.js";function hs(a,t){return g(this,null,function*(){let{brand:e,project:n}=a,{apiDomain:r,apiPath:{floorRange:i},apiInfo:o}=t,s=""+r+i+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(s,o).then(l=>l.json()).then(l=>l.data).then(l=>{let c=(l||[])[0];return c&&(c.info=JSON.parse(c.info)),c})})}function ps(a,t){return g(this,null,function*(){let{brand:e,project:n,floor:r,ts:i,resource_type_list:o}=a,{apiDomain:s,apiPath:{floorGraphic:u},apiInfo:l}=t,c=""+s+u+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+r+"&ts="+i+"&resource_type_list="+o;return yield fetch(c,l).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(f=>f.info=JSON.parse(f.info)),p||[]))})}function V3(a,t){return g(this,null,function*(){let{project:e,floor:n}=a,{apiDomain:r,apiInfo:i}=t,o=r+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(o,i).then(u=>u.json()).then(u=>u.data).then(u=>JSON.parse(u[0].streetInfo||"{}")).then(u=>u.fileId?yc(u.fileId,t):null)})}function yc(a,t){return g(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+a,n).then(r=>r.arrayBuffer()).then(r=>{let o=new TextDecoder("utf-8").decode(r);return o?JSON.parse(o):null})})}var fs=class{load(t){return g(this,null,function*(){let e=ge(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),ps(t,this.bmap.config)]),r=ge({floor:t.floor,ts:t.ts});fn(n.map(o=>o.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(r)||0),n.forEach(o=>o.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let i=this.floorDataLengthMap.get(r)||0;return this.floorDataLengthMap.set(r,i+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return g(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,r=e.userData.graphicMap||new Map,{ground:i,markGraphic:o,graphic:s}=this.bmap.config;for(let u=0;u<t.length;u++){let l=t[u];l.info.group==="ground"?(l.info.fillColor=i.color,l.info.fillOpacity=i.opacity,l.info.height=i.height,l.info.stroke=i.stroke,l.info.strokeColor=i.strokeColor,l.info.strokeOpacity=i.strokeOpacity):l.info.userData.mark?(l.info.height=o.height,l.info.fillColor=o.color,l.info.fillOpacity=o.opacity,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity):(l.info.fillOpacity=s.fillOpacity,this.bmap.config.initTransToMark&&(l.info.height=o.height,l.info.fillColor=o.color,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity))}for(let u of t){if(u.info.group==="ground")e.createGround(u.info);else{let l=e.addGraphic(u.info);l.userData.data=u,n.set(u.legacy_id,l)}r.set(u.element_uuid,u)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=r,e.userData.rangeGraphic=this.bmap.currentBuildGround,e.userData.range=this.bmap.currentBuildGround.geometry.cds[0],e.userData.center=this.bmap.buildingCenter,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(st.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(st.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let n=e.userData.graphicMap||new Map;return t.filter(r=>!n.has(r.element_uuid))}switchFloorByStoreData(t,e){return g(this,null,function*(){let n=yield this.load(x({},t,{resource_type_list:"6"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}switchFloorByOtherData(t,e){return g(this,null,function*(){let n=yield this.load(x({},t,{resource_type_list:"1,2,3,4"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}loadBuildGround(t){return g(this,null,function*(){let{brand:e,project:n}=t,r=yield this.loadBuildingGround({brand:e,project:n});var i;return this.bmap.currentBuildGround=(i=r==null?void 0:r.info)!=null?i:null,this.bmap.changeBuildingCenter(r,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return g(this,null,function*(){let{brand:e,project:n}=t,r=ge({brand:e,project:n});if(this.buildingGroundMap.has(r))return this.buildingGroundMap.get(r);let i=hs({brand:e,project:n},this.bmap.config).then(o=>(this.buildingGroundMap.set(r,o),o));return this.buildingGroundMap.set(r,i),i})}switchFloor(t){return g(this,null,function*(){let e=new xt(this.bmap.context);e.userData.graphicMap=new Map,e.name=t.floor;try{yield Promise.all([this.switchFloorByStoreData(t,e),this.switchFloorByOtherData(t,e)])}catch(n){console.log(n)}return e})}dispose(){this.cacheData.clear(),this.floorDataLengthMap.clear(),this.buildingGroundMap.clear()}constructor(t){this.bmap=t,this.cacheData=new Map,this.floorDataLengthMap=new Map,this.buildingGroundMap=new Map,this.externalStreetMap=new Map}};var h1=function(a){return a[a.D2=0]="D2",a[a.D3=1.1]="D3",a}({}),ds=class extends Ec{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:r}=e,i=t?an(t.info.geometry.cds[0]):[0,0];this.buildingCenter=i,this.dispatchEvent({type:"center-change",center:i,project:r,brand:n})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor(t){return g(this,null,function*(){return this.loader||(this.loader=new Ae(this),this.loader.placeConfig=x({},this.loader.placeConfig,this.config.loaderPlaceConfig),yield this.loader.load(this.config.apiPath.loadPlaceInfo+"?place_id="+this.config.placeId+"&env=prod")),this.loader.switchFloor(t)})}switchFloorByFloor(t,e,n){e===void 0&&(e=!0),n===void 0&&(n=t.graphicLayer.children),this.triggerHooks(st.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:n}),this.buildingCenter=t.userData.center,this.currentBuildGround=t.userData.rangeGraphic,this.context.switchFloor(t,e),this.initialFloorCamera(),this.triggerHooks(st.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:n})}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(this.config.defaultPadding,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*this.config.control.maxZoomScale,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}addModel(t,e){if(t.options.geometry.type==="polygon"){var n;let r=(n=this.context.currentFloor)==null?void 0:n.addModel(x({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(r){let{facilityAngle:i=0,facilityXScale:o=1,facilityYScale:s=1}=t.options.userData;r.rotateZ((180-i)/180*Math.PI),r.scale.set(o,s,1)}}}addHeatmap(t){var e;return(e=this.context.currentFloor)==null?void 0:e.addHeatmap(t)}getLegacyToGraphicMap(){var t;return((t=this.context.currentFloor)==null?void 0:t.userData.legacyToGraphicMap)||new Map}getFloorAllGraphics(){var t;return((t=this.context.currentFloor)==null?void 0:t.getGraphics())||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let n=t.options.center,r=t.getCenter(),i=(n==null?void 0:n[0])||r.x,o=(n==null?void 0:n[1])||r.y;return console.log(i,o,n,r),this.context.currentFloor.addPoi(x({},e,{position:{x:i,y:o,z:r.z+t.options.height/2}}))}return null}createPoi2ByPosition(t,e){if(this.context.currentFloor){let n=this.mercatorToWorld([t.x,t.y]),r=new K(this.context,x({},e,{position:{x:n.x,y:n.y,z:t.z}}));return this.context.currentFloor.poiLayer2.pushPoi(r),r}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,r){e===void 0&&(e=500),n===void 0&&(n=0),r===void 0&&(r=0);let i=t.getPosition().clone(),{context:{camera:o}}=this;if(o.updateMatrix(),r){let s=new lr;s.setFromMatrixColumn(o.matrix,1),s.normalize(),s.multiplyScalar(r/o.zoom),i.add(s)}if(n){let s=new lr;s.setFromMatrixColumn(o.matrix,0),s.normalize(),s.multiplyScalar(n/o.zoom),i.add(s)}return this.context.setCameraPosition(i,e)}translateElementToCenterX(t,e){return g(this,null,function*(){return e===void 0&&(e=500),_t(new Promise(n=>{let r=this.context.control.target.clone(),i=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:o,height:s},camera:u}=this.context,c=T(i,u,o,s).x-o/2,h=new lr;h.setFromMatrixColumn(this.context.camera.matrix,0),h.normalize(),h.multiplyScalar(c/this.context.camera.zoom),r.add(h),this.context.setCameraPosition(r,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:r}=this.container;return T(e,this.context.camera,n,r)}changeMapType(t,e){return e===void 0&&(e=500),this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}resetView(t){return g(this,null,function*(){t===void 0&&(t=300);let e=t/3;yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),yield this.context.setPolarAngle(this.config.control.defaultPolar,e),yield this.context.fitCameraToGround(this.config.defaultPadding,e,!1)})}reduceMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver(this.debounceResize);t.observe(this.container),this.observe=t}}unRegistryEvent(){var t;this.context.control.removeEventListener("change",this.onControlChange),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),(t=this.observe)==null||t.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t,e){t===void 0&&(t=.1),e===void 0&&(e=500);let n=this.context.control.getAzimuthalAngle();return this.context.setAzimuthalAngle(n+t,e)}measureDistance(){return g(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Bn(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",r=>{let{distance:i}=r;t(i)})})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new zn(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",r=>{let{area:i}=r;t(i)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}fitCameraByPois(t,e,n){return g(this,null,function*(){if(e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),!t.length)return;let r=new xc;return t.forEach(i=>{let{position:o}=i;r.expandByPoint(o)}),this.context.fitCameraToBox(r,e,n,!1)})}fitCameraByPoiNodeIds(t,e,n){return g(this,null,function*(){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500);let r=t.map(i=>this.getPoiById(i)).filter(i=>!!i);if(r.length)return this.fitCameraByPois(r,e,n)})}getGraphicByNodeId(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((n=this.context.currentFloor)==null?void 0:n.parkingSpaceLayer.graphicMap.get(t))||null}deleteGraphic(t){var e;(e=this.context.currentFloor)==null||e.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){var e;if(!t.transformToBuildingGround&&this.currentBuildGround){let n=an(this.currentBuildGround.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(r=>{Array.isArray(r)&&r.forEach(i=>{i[0]-=n[0],i[1]-=n[1]})});else{let[r,i]=t.geometry.cds;t.geometry.coords=[r-n[0],i-n[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}mercatorToWorld(t){let e=this.buildingCenter;return new lr(t[0]-e[0],t[1]-e[1],0)}removePoiById(t){var e,n;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(n=this.context.currentFloor)==null||n.poiLayer2.removePoiById(t)}getPoiById(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||((n=this.context.currentFloor)==null?void 0:n.poiLayer2.getPoiById(t))}getPois(){var t,e;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(n=>!n.options.built_in),...((e=this.context.currentFloor)==null?void 0:e.poiLayer2.pois)||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}dispose(){this.loader&&(this.loader.dispose(),this.loader=null),this.unRegistryEvent(),this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.plugins=[],this.context.dispose(),this.context=null,this.container=null,J.dispose(),rt.dispose(),$t.dispose(),at.dispose(),C.dispose(),wt.dispose(),this.debounceResize=null,ai.Dispose==null||ai.Dispose.call(ai)}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new W,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:n}}=this.context;n!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=n)},this.onKeydown=n=>{this.polarKeys.includes(n.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(n.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=n=>{if(this.polarKeys.includes(n.code)){let r=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=r,this.context.control.minPolarAngle=r}if(this.azimuthalKeys.includes(n.code)){let r=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=r,this.context.control.minAzimuthAngle=r}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),r=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let i=this.context.getFitCameraToGroundZoom(this.config.defaultPadding,0)||1;this.context.camera.zoom=r,this.context.control.minZoom=i,this.context.control.maxZoom=i*this.config.control.maxZoomScale,this.basicZoom=r,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=as(e),this.context=new sr(t,this),this.debounceResize=Sc(this.resize,5),this.registryEvent()}};var d1=function(a){return a.HALF="half",a.POWER="power",a.MECHANICAL="mechanical",a.NORMAL="normal",a.VIP="vip",a}({});import"core-js/modules/web.dom-collections.iterator.js";var et=class extends ${dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null,super.dispose()}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var gs=class extends et{fetchEquipment(){return g(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,r=""+t+e;yield fetch(r,n).then(i=>i.json()).then(i=>i.data).then(i=>{this.equipmentList=i,this.equipmentMap=new Map(i.map(o=>[o.equipment_id,o]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)})}getGraphicEquipment(t){return t.userData.data.info.userData.equipment}changeGraphicToEquipment(t){t.filter(e=>{let n=this.getGraphicEquipment(e);return n&&this.equipmentMap.has(n)}).forEach(e=>{let n=this.equipmentMap.get(this.getGraphicEquipment(e)),r=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});r&&(r.userData.data=n,r.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(st.SWITCH_FLOOR_AFTER,this.onSwitchFloor),Array.from(((t=this.bmap.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).forEach(e=>{if(e.userData.type==="equipment"){var n;(n=this.bmap.context.currentFloor)==null||n.poiLayer.removePoi(e)}}),super.dispose()}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:n}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(n)},this.fetchEquipment(),this.bmap.addEventListener(st.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};import"core-js/modules/es.string.replace.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.promise.finally.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.push.js";import{Mesh as Pc,Object3D as Ic,TextureLoader as Lc,Color as Nc,Vector2 as li,Vector3 as Oc,NormalBlending as Dc,RepeatWrapping as Uc}from"three";import"core-js/modules/es.typed-array.float32-array.js";import"core-js/modules/es.typed-array.at.js";import"core-js/modules/es.typed-array.fill.js";import"core-js/modules/es.typed-array.find-last.js";import"core-js/modules/es.typed-array.find-last-index.js";import"core-js/modules/es.typed-array.set.js";import"core-js/modules/es.typed-array.sort.js";import"core-js/modules/es.typed-array.to-reversed.js";import"core-js/modules/es.typed-array.to-sorted.js";import"core-js/modules/es.typed-array.with.js";import"core-js/modules/es.array-buffer.constructor.js";import"core-js/modules/es.array-buffer.slice.js";import"core-js/modules/es.array-buffer.detached.js";import"core-js/modules/es.array-buffer.transfer.js";import"core-js/modules/es.array-buffer.transfer-to-fixed-length.js";import"core-js/modules/es.array.push.js";import"core-js/modules/es.typed-array.uint16-array.js";import{BufferGeometry as bc,Matrix4 as _s,Vector3 as he,Ray as Mc,Sphere as wc,LineSegments as Tc,BufferAttribute as Qt,ShaderChunk as gt,ShaderMaterial as vs,UniformsLib as Ac,Color as Cc,Vector2 as ms}from"three";var mt=class extends bc{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new _s,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};mt.prototype.setMatrixWorld=function(a){this.matrixWorld=a};mt.prototype.setGeometry=function(a,t){this._geometry=a,this.setPoints(a.getAttribute("position").array,t)};mt.prototype.setPoints=function(a,t){if(!(a instanceof Float32Array)&&!(a instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=a,this.widthCallback=t,this.positions=[],this.counters=[],a.length&&a[0]instanceof he)for(var e=0;e<a.length;e++){var n=a[e],r=e/a.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(r),this.counters.push(r)}else for(var e=0;e<a.length;e+=3){var r=e/a.length;this.positions.push(a[e],a[e+1],a[e+2]),this.positions.push(a[e],a[e+1],a[e+2]),this.counters.push(r),this.counters.push(r)}this.process()};function Rc(a,t){var e=new _s,n=new Mc,r=new wc,i=new he,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),r.copy(o.boundingSphere),r.applyMatrix4(this.matrixWorld),a.ray.intersectSphere(r,i)!==!1){e.copy(this.matrixWorld).invert(),n.copy(a.ray).applyMatrix4(e);var s=new he,u=new he,l=new he,c=this instanceof Tc?2:1,h=o.index,p=o.attributes;if(h!==null)for(var f=h.array,d=p.position.array,m=p.width.array,v=0,y=f.length-1;v<y;v+=c){var S=f[v],b=f[v+1];s.fromArray(d,S*3),u.fromArray(d,b*3);var P=m[Math.floor(v/3)]!==void 0?m[Math.floor(v/3)]:1,R=a.params.Line.threshold+this.material.lineWidth*P/2,V=R*R,M=n.distanceSqToSegment(s,u,i,l);if(!(M>V)){i.applyMatrix4(this.matrixWorld);var H=a.ray.origin.distanceTo(i);H<a.near||H>a.far||(t.push({distance:H,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}),v=y)}}}}mt.prototype.raycast=Rc;mt.prototype.compareV3=function(a,t){var e=a*6,n=t*6;return this.positions[e]===this.positions[n]&&this.positions[e+1]===this.positions[n+1]&&this.positions[e+2]===this.positions[n+2]};mt.prototype.copyV3=function(a){var t=a*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};mt.prototype.getDistance=function(a){let t=0;for(let e=0;e<a;e++){let n=6*e,r=new he(this.positions[n],this.positions[n+1],this.positions[n+2]),i=new he(this.positions[n+6],this.positions[n+7],this.positions[n+8]),o=r.distanceTo(i);t+=o}return t};mt.prototype.process=function(){var a=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(a-1);var n;this.compareV3(0,a-1)?n=this.copyV3(a-2):n=this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var r=0;r<a;r++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(r/(a-1)):t=1,this.width.push(t),this.width.push(t),r===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(r===a-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let o=this.getDistance(r)/e;this.uvs.push(o,0),this.uvs.push(o,1)}if(r<a-1){n=this.copyV3(r),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var i=r*2;this.indices_array.push(i,i+1,i+2),this.indices_array.push(i+2,i+1,i+3)}r>0&&(n=this.copyV3(r),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(a-1,0)?n=this.copyV3(1):n=this.copyV3(a-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new Qt(new Float32Array(this.positions),3),previous:new Qt(new Float32Array(this.previous),3),next:new Qt(new Float32Array(this.next),3),side:new Qt(new Float32Array(this.side),1),width:new Qt(new Float32Array(this.width),1),uv:new Qt(new Float32Array(this.uvs),2),index:new Qt(new Uint16Array(this.indices_array),1),counters:new Qt(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function ui(a,t,e,n,r){var i;if(a=a.subarray||a.slice?a:a.buffer,e=e.subarray||e.slice?e:e.buffer,a=t?a.subarray?a.subarray(t,r&&t+r):a.slice(t,r&&t+r):a,e.set)e.set(a,n);else for(i=0;i<a.length;i++)e[i+n]=a[i];return e}mt.prototype.advance=function(a){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,r=t.length;ui(t,0,e,0,r),ui(t,6,t,0,r-6),t[r-6]=a.x,t[r-5]=a.y,t[r-4]=a.z,t[r-3]=a.x,t[r-2]=a.y,t[r-1]=a.z,ui(t,6,n,0,r-6),n[r-6]=a.x,n[r-5]=a.y,n[r-4]=a.z,n[r-3]=a.x,n[r-2]=a.y,n[r-1]=a.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};gt.meshline_vert=["",gt.logdepthbuf_pars_vertex,gt.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",gt.logdepthbuf_vertex,gt.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",gt.fog_vertex,"}"].join(`
11812
11812
  `);gt.meshline_frag=["",gt.fog_pars_fragment,gt.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","uniform float thresholdRatio;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {",""," if (vUV.x <= thresholdRatio) {"," discard;"," }",gt.logdepthbuf_fragment,""," vec4 c = vColor;"," if( useMap == 1. ) c *= texture2D( map, vUV * repeat );"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","",gt.fog_fragment,"}"].join(`
11813
- `);var Ye=class extends vs{constructor(t){super({uniforms:Object.assign({},Ac.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new Cc(16777215)},opacity:{value:1},resolution:{value:new ms(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new ms(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:gt.meshline_vert,fragmentShader:gt.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};Ye.prototype.copy=function(a){return vs.prototype.copy.call(this,a),this.lineWidth=a.lineWidth,this.map=a.map,this.useMap=a.useMap,this.alphaMap=a.alphaMap,this.useAlphaMap=a.useAlphaMap,this.color.copy(a.color),this.opacity=a.opacity,this.resolution.copy(a.resolution),this.sizeAttenuation=a.sizeAttenuation,this.dashArray.copy(a.dashArray),this.dashOffset.copy(a.dashOffset),this.dashRatio.copy(a.dashRatio),this.useDash=a.useDash,this.visibility=a.visibility,this.alphaTest=a.alphaTest,this.repeat.copy(a.repeat),this};var ys={texture_url:En,lineWidth:10,color:16777215},cr=class extends Ic{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:r}}}}}=this,i=t.map(s=>{let[u,l]=s;return T(new Oc(u,l,0),e,n,r)}).map(s=>{let{x:u,y:l}=s;return[u,l]});return ct(i)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new li(t,1)}loadTexture(t){return new Promise((e,n)=>{new Lc().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return g(this,null,function*(){let e=this.geometry=new mt;if(this.updatePoints(t),!this.texture){let i=this.texture=yield this.loadTexture(this.config.texture_url);i.wrapS=i.wrapT=Uc}let n=this.material=new Ye({useMap:!0,color:new Nc(this.config.color),transparent:!0,resolution:new li(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:Dc,repeat:new li(this.getRepeat(),1)}),r=this.mesh=new Pc(e,n);return r.renderOrder=99999,this.add(r),r})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=ys,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:r}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,r)}},this.config=Object.assign({},ys,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as ci,Easing as jc}from"@tweenjs/tween.js";import{Vector2 as Yc,Vector3 as Tt}from"three";import"core-js/modules/es.array.unshift.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.push.js";import{Vector2 as Fc}from"three";import{Tween as Bc}from"@tweenjs/tween.js";import{throttle as zc}from"lodash";import{booleanPointInPolygon as Gc,point as kc,polygon as Vc}from"@turf/turf";var Hc={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1,destinationDistanceThreshold:10},hr=class extends ${get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){var t;return((t=this.curRoutePath)==null?void 0:t.points)||[]}registryEvent(){this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.addEventListener("add-path",this.onAddPaths)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.removeEventListener("add-path",this.onAddPaths)}setRoadData(t){this.roadData=t}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null),t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,e){let{curRoutePathPoints:n,position:r,curRoutePath:i,paths:o,routeIndex:s}=this;if(!n.length)return null;let u=n,l=this.paths[this.routeIndex].floor,c=this.getCurRouteRemainDistance();if(r){let v=zt(n,r);u=u.slice(v+1),u.unshift(r)}let h=[{floor:i==null?void 0:i.floor,points:u},...o.slice(s+1)],{distance:p,closestPoint:f,index:d,i:m}=h.reduce((v,y,S)=>{if(y.floor!==t)return v;let{distance:b,closestPoint:P,index:R}=y.points.reduce((V,M,H,A)=>{if(!A[H+1])return x({},V,{distance:V.distance===1/0?D(M,e):V.distance});let{distance:I,closestPoint:w}=Wi(e,M,A[H+1]);if(!this.navigation.options.canBack&&l===t){let F=[e,...A.slice(H+1)],q=ct(F);if(c-q>10)return V}return I<V.distance?{distance:I,closestPoint:w,index:H}:V},{distance:1/0,closestPoint:y.points[0],index:0});return b<v.distance?{distance:b,closestPoint:P,index:S,i:R}:v},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:p,closestPoint:f,routeIndex:d+s,pointIndex:d===0?m+this.pointIndex:m}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:r,closestPoint:i,routeIndex:o,pointIndex:s}=n;r>this.options.offsetDistance?(this.offset=!0,this.resetTimer||(this.resetTimer=this.timer.setTimeout(()=>{this.reset=!0,this.resetTimer=null},this.options.offsetToResetTime))):(this.offset=!1,this.reset=!1,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null)),this.routeIndex=o,this.pointIndex=s,this.position=i,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}pause(){var t;this.tweenUtil.clear(),(t=this.throttleUpdatePosition)==null||t.cancel(),this.paused=!0}continue(){this.paused=!1,this.startCurRouteSimulation()}startCurRouteSimulation(){return g(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let r=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],i=this.getCurRouteRemainDistance(),o=i/this.options.simulationSpeed,s=this.throttleUpdatePosition=zc(l=>{let c=me(r,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new Bc({distance:0},this.tweenUtil.group).to({distance:i},o*1e3).onUpdate(s).onComplete(()=>{this.tweenUtil.remove(u),s.flush(),s.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{n(this.startCurRouteSimulation())},3e3)):(n(!0),console.log(e,this.routeIndex,this.paths))}).start()})})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.paused||this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[n,...t.slice(e+1)];return ct(r)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[...t.slice(0,e+1),n];return ct(r)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((r,i)=>r+i.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:r,curRoutePath:i}=this,o=e,s=kt.FRONT,u=(i==null||(t=i.pointInfos[o])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;s===kt.FRONT&&o<=n.length;){let m=n[o],v=n[o+1],y=n[o+2];if(!m||!v)s=kt.END;else if(l+=D(m,v),!y)s=kt.END;else{s=Br(m,v,y),c=un(m,v,y),h=(new Fc(y[0]-v[0],y[1]-v[1]).angle()*180/Math.PI-90+360)%360;var p;u=(p=i==null?void 0:i.pointInfos[o+1].crossName)!=null?p:"",o+=1}}n[o]&&(l=D(r,n[o]));let f=zr(c);if(s===kt.END&&l<=this.options.directionEmitThreshold)return{dir:s,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f};let d=this.getCurRouteToStartDistance();return e===0&&d<=5?{dir:kt.START,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f}:(l>=this.options.directionEmitThreshold&&(s=kt.FRONT),{dir:s,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let r=Vc(n.cds),i=kc(this.position);return Gc(i,r)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:r,distance:i,crossName:o,angle:s,nextAngle:u,nextDir:l}=n;e<=this.options.destinationDistanceThreshold&&(r=kt.END);let{imageUrl:c}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:i,dir:r,angle:s,nextAngle:u,pos:this.position,routeIndex:this.routeIndex,crossName:o,offset:this.offset,reset:this.reset,imageUrl:c,nextDir:l}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,n){super(),this.navigation=t,this.offset=!1,this.reset=!1,this.position=[0,0],this.routeIndex=0,this.pointIndex=0,this.paths=[],this.timer=new W,this.resetTimer=null,this.tweenUtil=new Jt,this.paused=!1,this.onAddPaths=r=>{let{paths:i}=r;this.paths=i,this.resetStatus(i),this.simulationTween&&!this.paused&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},Hc,e),this.roadData=n,this.registryEvent()}};import"core-js/modules/es.typed-array.uint8-array.js";import"core-js/modules/es.typed-array.at.js";import"core-js/modules/es.typed-array.fill.js";import"core-js/modules/es.typed-array.find-last.js";import"core-js/modules/es.typed-array.find-last-index.js";import"core-js/modules/es.typed-array.set.js";import"core-js/modules/es.typed-array.sort.js";import"core-js/modules/es.typed-array.to-reversed.js";import"core-js/modules/es.typed-array.to-sorted.js";import"core-js/modules/es.typed-array.with.js";import"core-js/modules/es.array-buffer.constructor.js";import"core-js/modules/es.array-buffer.slice.js";import"core-js/modules/es.array-buffer.detached.js";import"core-js/modules/es.array-buffer.transfer.js";import"core-js/modules/es.array-buffer.transfer-to-fixed-length.js";import"core-js/modules/es.typed-array.from.js";import"core-js/modules/web.dom-collections.iterator.js";import{DataTexture as Wc,LinearFilter as xs,RGBAFormat as Es,Sprite as Xc,SpriteMaterial as qc}from"three";var Xt=class a extends K{addDebug(){a.canvas.style.cssText=`
11813
+ `);var Ye=class extends vs{constructor(t){super({uniforms:Object.assign({},Ac.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new Cc(16777215)},opacity:{value:1},resolution:{value:new ms(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new ms(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:gt.meshline_vert,fragmentShader:gt.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};Ye.prototype.copy=function(a){return vs.prototype.copy.call(this,a),this.lineWidth=a.lineWidth,this.map=a.map,this.useMap=a.useMap,this.alphaMap=a.alphaMap,this.useAlphaMap=a.useAlphaMap,this.color.copy(a.color),this.opacity=a.opacity,this.resolution.copy(a.resolution),this.sizeAttenuation=a.sizeAttenuation,this.dashArray.copy(a.dashArray),this.dashOffset.copy(a.dashOffset),this.dashRatio.copy(a.dashRatio),this.useDash=a.useDash,this.visibility=a.visibility,this.alphaTest=a.alphaTest,this.repeat.copy(a.repeat),this};var ys={texture_url:En,lineWidth:10,color:16777215},cr=class extends Ic{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:r}}}}}=this,i=t.map(s=>{let[u,l]=s;return T(new Oc(u,l,0),e,n,r)}).map(s=>{let{x:u,y:l}=s;return[u,l]});return ct(i)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new li(t,1)}loadTexture(t){return new Promise((e,n)=>{new Lc().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return g(this,null,function*(){let e=this.geometry=new mt;if(this.updatePoints(t),!this.texture){let i=this.texture=yield this.loadTexture(this.config.texture_url);i.wrapS=i.wrapT=Uc}let n=this.material=new Ye({useMap:!0,color:new Nc(this.config.color),transparent:!0,resolution:new li(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:Dc,repeat:new li(this.getRepeat(),1)}),r=this.mesh=new Pc(e,n);return r.renderOrder=99999,this.add(r),r})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=ys,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:r}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,r)}},this.config=Object.assign({},ys,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as ci,Easing as jc}from"@tweenjs/tween.js";import{Vector2 as Yc,Vector3 as Tt}from"three";import"core-js/modules/es.array.unshift.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.push.js";import{Vector2 as Fc}from"three";import{Tween as Bc}from"@tweenjs/tween.js";import{throttle as zc}from"lodash";import{booleanPointInPolygon as Gc,point as kc,polygon as Vc}from"@turf/turf";var Hc={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1,destinationDistanceThreshold:10},hr=class extends ${get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){var t;return((t=this.curRoutePath)==null?void 0:t.points)||[]}registryEvent(){this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.addEventListener("add-path",this.onAddPaths)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.removeEventListener("add-path",this.onAddPaths)}setRoadData(t){this.roadData=t}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,this.offsetDistance=0,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null),t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,e){let{curRoutePathPoints:n,position:r,curRoutePath:i,paths:o,routeIndex:s}=this;if(!n.length)return null;let u=n,l=this.paths[this.routeIndex].floor,c=this.getCurRouteRemainDistance();if(r){let v=zt(n,r);u=u.slice(v+1),u.unshift(r)}let h=[{floor:i==null?void 0:i.floor,points:u},...o.slice(s+1)],{distance:p,closestPoint:f,index:d,i:m}=h.reduce((v,y,S)=>{if(y.floor!==t)return v;let{distance:b,closestPoint:P,index:R}=y.points.reduce((V,M,H,A)=>{if(!A[H+1])return x({},V,{distance:V.distance===1/0?D(M,e):V.distance});let{distance:I,closestPoint:w}=Wi(e,M,A[H+1]);if(!this.navigation.options.canBack&&l===t){let F=[e,...A.slice(H+1)],q=ct(F);if(c-q>10)return V}return I<V.distance?{distance:I,closestPoint:w,index:H}:V},{distance:1/0,closestPoint:y.points[0],index:0});return b<v.distance?{distance:b,closestPoint:P,index:S,i:R}:v},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:p,closestPoint:f,routeIndex:d+s,pointIndex:d===0?m+this.pointIndex:m}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:r,closestPoint:i,routeIndex:o,pointIndex:s}=n;this.offsetDistance=r,r>this.options.offsetDistance?(this.offset=!0,this.resetTimer||(this.resetTimer=this.timer.setTimeout(()=>{this.reset=!0,this.resetTimer=null},this.options.offsetToResetTime))):(this.offset=!1,this.reset=!1,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null)),this.routeIndex=o,this.pointIndex=s,this.position=i,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}pause(){var t;this.tweenUtil.clear(),(t=this.throttleUpdatePosition)==null||t.cancel(),this.paused=!0}continue(){this.paused=!1,this.startCurRouteSimulation()}startCurRouteSimulation(){return g(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let r=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],i=this.getCurRouteRemainDistance(),o=i/this.options.simulationSpeed,s=this.throttleUpdatePosition=zc(l=>{let c=me(r,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new Bc({distance:0},this.tweenUtil.group).to({distance:i},o*1e3).onUpdate(s).onComplete(()=>{this.tweenUtil.remove(u),s.flush(),s.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{n(this.startCurRouteSimulation())},3e3)):(n(!0),console.log(e,this.routeIndex,this.paths))}).start()})})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.paused||this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[n,...t.slice(e+1)];return ct(r)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[...t.slice(0,e+1),n];return ct(r)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((r,i)=>r+i.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:r,curRoutePath:i}=this,o=e,s=kt.FRONT,u=(i==null||(t=i.pointInfos[o])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;s===kt.FRONT&&o<=n.length;){let m=n[o],v=n[o+1],y=n[o+2];if(!m||!v)s=kt.END;else if(l+=D(m,v),!y)s=kt.END;else{s=Br(m,v,y),c=un(m,v,y),h=(new Fc(y[0]-v[0],y[1]-v[1]).angle()*180/Math.PI-90+360)%360;var p;u=(p=i==null?void 0:i.pointInfos[o+1].crossName)!=null?p:"",o+=1}}n[o]&&(l=D(r,n[o]));let f=zr(c);if(s===kt.END&&l<=this.options.directionEmitThreshold)return{dir:s,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f};let d=this.getCurRouteToStartDistance();return e===0&&d<=5?{dir:kt.START,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f}:(l>=this.options.directionEmitThreshold&&(s=kt.FRONT),{dir:s,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let r=Vc(n.cds),i=kc(this.position);return Gc(i,r)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:r,distance:i,crossName:o,angle:s,nextAngle:u,nextDir:l}=n;e<=this.options.destinationDistanceThreshold&&(r=kt.END);let{imageUrl:c}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:i,dir:r,angle:s,nextAngle:u,pos:this.position,routeIndex:this.routeIndex,crossName:o,offset:this.offset,reset:this.reset,imageUrl:c,nextDir:l,offsetDistance:this.offsetDistance}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,n){super(),this.navigation=t,this.offset=!1,this.reset=!1,this.position=[0,0],this.routeIndex=0,this.pointIndex=0,this.paths=[],this.timer=new W,this.resetTimer=null,this.tweenUtil=new Jt,this.paused=!1,this.offsetDistance=0,this.onAddPaths=r=>{let{paths:i}=r;this.paths=i,this.resetStatus(i),this.simulationTween&&!this.paused&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},Hc,e),this.roadData=n,this.registryEvent()}};import"core-js/modules/es.typed-array.uint8-array.js";import"core-js/modules/es.typed-array.at.js";import"core-js/modules/es.typed-array.fill.js";import"core-js/modules/es.typed-array.find-last.js";import"core-js/modules/es.typed-array.find-last-index.js";import"core-js/modules/es.typed-array.set.js";import"core-js/modules/es.typed-array.sort.js";import"core-js/modules/es.typed-array.to-reversed.js";import"core-js/modules/es.typed-array.to-sorted.js";import"core-js/modules/es.typed-array.with.js";import"core-js/modules/es.array-buffer.constructor.js";import"core-js/modules/es.array-buffer.slice.js";import"core-js/modules/es.array-buffer.detached.js";import"core-js/modules/es.array-buffer.transfer.js";import"core-js/modules/es.array-buffer.transfer-to-fixed-length.js";import"core-js/modules/es.typed-array.from.js";import"core-js/modules/web.dom-collections.iterator.js";import{DataTexture as Wc,LinearFilter as xs,RGBAFormat as Es,Sprite as Xc,SpriteMaterial as qc}from"three";var Xt=class a extends K{addDebug(){a.canvas.style.cssText=`
11814
11814
  position: fixed;
11815
11815
  top: 0;
11816
11816
  left: 0;
@@ -11810,7 +11810,7 @@ void main() {
11810
11810
  \`)};function og(n,t,e){this.x=n,this.y=t,this.weight=e}og.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};og.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};og.prototype.isWall=function(){return this.weight===0};function F2(n){this.content=[],this.scoreFunction=n}F2.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,i=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(i))this.content[e]=t,this.content[n]=i,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],i=this.scoreFunction(e);;){var s=n+1<<1,u=s-1,c=null,f;if(u<t){var p=this.content[u];f=this.scoreFunction(p),f<i&&(c=u)}if(s<t){var d=this.content[s],g=this.scoreFunction(d);g<(c===null?i:f)&&(c=s)}if(c!==null)this.content[n]=this.content[c],this.content[c]=e,n=c;else break}}};function Fx(){this._=null}function jl(n){n.U=n.C=n.L=n.R=n.P=n.N=null}Fx.prototype={constructor:Fx,insert:function(n,t){var e,i,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=U2(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)i=e.U,e===i.L?(s=i.R,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.R&&(Ff(this,e),n=e,e=n.U),e.C=!1,i.C=!0,Uf(this,i))):(s=i.L,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.L&&(Uf(this,e),n=e,e=n.U),e.C=!1,i.C=!0,Ff(this,i))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,i=n.L,s=n.R,u,c;if(i?s?u=U2(s):u=i:u=s,t?t.L===n?t.L=u:t.R=u:this._=u,i&&s?(c=u.C,u.C=n.C,u.L=i,i.U=u,u!==s?(t=u.U,u.U=n.U,n=u.R,t.L=n,u.R=s,s.U=u):(u.U=t,t=u,n=u.R)):(c=n.C,n=u),n&&(n.U=t),!c){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Ff(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,Uf(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Ff(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,Uf(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Ff(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,Uf(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function Ff(n,t){var e=t,i=t.R,s=e.U;s?s.L===e?s.L=i:s.R=i:n._=i,i.U=s,e.U=i,e.R=i.L,e.R&&(e.R.U=e),i.L=e}function Uf(n,t){var e=t,i=t.L,s=e.U;s?s.L===e?s.L=i:s.R=i:n._=i,i.U=s,e.U=i,e.L=i.R,e.L&&(e.L.U=e),i.R=e}function U2(n){for(;n.L;)n=n.L;return n}var Ux=Fx;function Kl(n,t,e,i){var s=[null,null],u=kr.push(s)-1;return s.left=n,s.right=t,e&&Bf(s,n,t,e),i&&Bf(s,t,n,i),Ti[n.index].halfedges.push(u),Ti[t.index].halfedges.push(u),s}function Ql(n,t,e){var i=[t,e];return i.left=n,i}function Bf(n,t,e,i){!n[0]&&!n[1]?(n[0]=i,n.left=t,n.right=e):n.left===e?n[1]=i:n[0]=i}function PK(n,t,e,i,s){var u=n[0],c=n[1],f=u[0],p=u[1],d=c[0],g=c[1],y=0,v=1,E=d-f,M=g-p,A;if(A=t-f,!(!E&&A>0)){if(A/=E,E<0){if(A<y)return;A<v&&(v=A)}else if(E>0){if(A>v)return;A>y&&(y=A)}if(A=i-f,!(!E&&A<0)){if(A/=E,E<0){if(A>v)return;A>y&&(y=A)}else if(E>0){if(A<y)return;A<v&&(v=A)}if(A=e-p,!(!M&&A>0)){if(A/=M,M<0){if(A<y)return;A<v&&(v=A)}else if(M>0){if(A>v)return;A>y&&(y=A)}if(A=s-p,!(!M&&A<0)){if(A/=M,M<0){if(A>v)return;A>y&&(y=A)}else if(M>0){if(A<y)return;A<v&&(v=A)}return!(y>0)&&!(v<1)||(y>0&&(n[0]=[f+y*E,p+y*M]),v<1&&(n[1]=[f+v*E,p+v*M])),!0}}}}}function RK(n,t,e,i,s){var u=n[1];if(u)return!0;var c=n[0],f=n.left,p=n.right,d=f[0],g=f[1],y=p[0],v=p[1],E=(d+y)/2,M=(g+v)/2,A,_;if(v===g){if(E<t||E>=i)return;if(d>y){if(!c)c=[E,e];else if(c[1]>=s)return;u=[E,s]}else{if(!c)c=[E,s];else if(c[1]<e)return;u=[E,e]}}else if(A=(d-y)/(v-g),_=M-A*E,A<-1||A>1)if(d>y){if(!c)c=[(e-_)/A,e];else if(c[1]>=s)return;u=[(s-_)/A,s]}else{if(!c)c=[(s-_)/A,s];else if(c[1]<e)return;u=[(e-_)/A,e]}else if(g<v){if(!c)c=[t,A*t+_];else if(c[0]>=i)return;u=[i,A*i+_]}else{if(!c)c=[i,A*i+_];else if(c[0]<t)return;u=[t,A*t+_]}return n[0]=c,n[1]=u,!0}function B2(n,t,e,i){for(var s=kr.length,u;s--;)(!RK(u=kr[s],n,t,e,i)||!PK(u,n,t,e,i)||!(Math.abs(u[0][0]-u[1][0])>Ln||Math.abs(u[0][1]-u[1][1])>Ln))&&delete kr[s]}function z2(n){return Ti[n.index]={site:n,halfedges:[]}}function LK(n,t){var e=n.site,i=t.left,s=t.right;return e===s&&(s=i,i=e),s?Math.atan2(s[1]-i[1],s[0]-i[0]):(e===i?(i=t[1],s=t[0]):(i=t[0],s=t[1]),Math.atan2(i[0]-s[0],s[1]-i[1]))}function Bx(n,t){return t[+(t.left!==n.site)]}function NK(n,t){return t[+(t.left===n.site)]}function G2(){for(var n=0,t=Ti.length,e,i,s,u;n<t;++n)if((e=Ti[n])&&(u=(i=e.halfedges).length)){var c=new Array(u),f=new Array(u);for(s=0;s<u;++s)c[s]=s,f[s]=LK(e,kr[i[s]]);for(c.sort(function(p,d){return f[d]-f[p]}),s=0;s<u;++s)f[s]=i[c[s]];for(s=0;s<u;++s)i[s]=f[s]}}function k2(n,t,e,i){var s=Ti.length,u,c,f,p,d,g,y,v,E,M,A,_,x=!0;for(u=0;u<s;++u)if(c=Ti[u]){for(f=c.site,d=c.halfedges,p=d.length;p--;)kr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)M=NK(c,kr[d[p]]),A=M[0],_=M[1],y=Bx(c,kr[d[++p%g]]),v=y[0],E=y[1],(Math.abs(A-v)>Ln||Math.abs(_-E)>Ln)&&(d.splice(p,0,kr.push(Ql(f,M,Math.abs(A-n)<Ln&&i-_>Ln?[n,Math.abs(v-n)<Ln?E:i]:Math.abs(_-i)<Ln&&e-A>Ln?[Math.abs(E-i)<Ln?v:e,i]:Math.abs(A-e)<Ln&&_-t>Ln?[e,Math.abs(v-e)<Ln?E:t]:Math.abs(_-t)<Ln&&A-n>Ln?[Math.abs(E-t)<Ln?v:n,t]:null))-1),++g);g&&(x=!1)}if(x){var T,w,R,B=1/0;for(u=0,x=null;u<s;++u)(c=Ti[u])&&(f=c.site,T=f[0]-n,w=f[1]-t,R=T*T+w*w,R<B&&(B=R,x=c));if(x){var U=[n,t],D=[n,i],P=[e,i],ct=[e,t];x.halfedges.push(kr.push(Ql(f=x.site,U,D))-1,kr.push(Ql(f,D,P))-1,kr.push(Ql(f,P,ct))-1,kr.push(Ql(f,ct,U))-1)}}for(u=0;u<s;++u)(c=Ti[u])&&(c.halfedges.length||delete Ti[u])}var q2=[],sg;function OK(){jl(this),this.x=this.y=this.arc=this.site=this.cy=null}function vu(n){var t=n.P,e=n.N;if(!(!t||!e)){var i=t.site,s=n.site,u=e.site;if(i!==u){var c=s[0],f=s[1],p=i[0]-c,d=i[1]-f,g=u[0]-c,y=u[1]-f,v=2*(p*y-d*g);if(!(v>=-V2)){var E=p*p+d*d,M=g*g+y*y,A=(y*E-d*M)/v,_=(p*M-g*E)/v,x=q2.pop()||new OK;x.arc=n,x.site=s,x.x=A+c,x.y=(x.cy=_+f)+Math.sqrt(A*A+_*_),n.circle=x;for(var T=null,w=tc._;w;)if(x.y<w.y||x.y===w.y&&x.x<=w.x)if(w.L)w=w.L;else{T=w.P;break}else if(w.R)w=w.R;else{T=w;break}tc.insert(T,x),T||(sg=x)}}}}function _u(n){var t=n.circle;t&&(t.P||(sg=t.N),tc.remove(t),q2.push(t),jl(t),n.circle=null)}var W2=[];function DK(){jl(this),this.edge=this.site=this.circle=null}function H2(n){var t=W2.pop()||new DK;return t.site=n,t}function zx(n){_u(n),xu.remove(n),W2.push(n),jl(n)}function X2(n){var t=n.circle,e=t.x,i=t.cy,s=[e,i],u=n.P,c=n.N,f=[n];zx(n);for(var p=u;p.circle&&Math.abs(e-p.circle.x)<Ln&&Math.abs(i-p.circle.cy)<Ln;)u=p.P,f.unshift(p),zx(p),p=u;f.unshift(p),_u(p);for(var d=c;d.circle&&Math.abs(e-d.circle.x)<Ln&&Math.abs(i-d.circle.cy)<Ln;)c=d.N,f.push(d),zx(d),d=c;f.push(d),_u(d);var g=f.length,y;for(y=1;y<g;++y)d=f[y],p=f[y-1],Bf(d.edge,p.site,d.site,s);p=f[0],d=f[g-1],d.edge=Kl(p.site,d.site,null,s),vu(p),vu(d)}function Y2(n){for(var t=n[0],e=n[1],i,s,u,c,f=xu._;f;)if(u=$2(f,e)-t,u>Ln)f=f.L;else if(c=t-FK(f,e),c>Ln){if(!f.R){i=f;break}f=f.R}else{u>-Ln?(i=f.P,s=f):c>-Ln?(i=f,s=f.N):i=s=f;break}z2(n);var p=H2(n);if(xu.insert(i,p),!(!i&&!s)){if(i===s){_u(i),s=H2(i.site),xu.insert(p,s),p.edge=s.edge=Kl(i.site,p.site),vu(i),vu(s);return}if(!s){p.edge=Kl(i.site,p.site);return}_u(i),_u(s);var d=i.site,g=d[0],y=d[1],v=n[0]-g,E=n[1]-y,M=s.site,A=M[0]-g,_=M[1]-y,x=2*(v*_-E*A),T=v*v+E*E,w=A*A+_*_,R=[(_*T-E*w)/x+g,(v*w-A*T)/x+y];Bf(s.edge,d,M,R),p.edge=Kl(d,n,null,R),s.edge=Kl(n,M,null,R),vu(i),vu(s)}}function $2(n,t){var e=n.site,i=e[0],s=e[1],u=s-t;if(!u)return i;var c=n.P;if(!c)return-1/0;e=c.site;var f=e[0],p=e[1],d=p-t;if(!d)return f;var g=f-i,y=1/u-1/d,v=g/d;return y?(-v+Math.sqrt(v*v-2*y*(g*g/(-2*d)-p+d/2+s-u/2)))/y+i:(i+f)/2}function FK(n,t){var e=n.N;if(e)return $2(e,t);var i=n.site;return i[1]===t?i[0]:1/0}var Ln=1e-6,V2=1e-12,xu,Ti,tc,kr;function UK(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function BK(n,t){return t[1]-n[1]||t[0]-n[0]}function ag(n,t){var e=n.sort(BK).pop(),i,s,u;for(kr=[],Ti=new Array(n.length),xu=new Ux,tc=new Ux;;)if(u=sg,e&&(!u||e[1]<u.y||e[1]===u.y&&e[0]<u.x))(e[0]!==i||e[1]!==s)&&(Y2(e),i=e[0],s=e[1]),e=n.pop();else if(u)X2(u.arc);else break;if(G2(),t){var c=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];B2(c,f,p,d),k2(c,f,p,d)}this.edges=kr,this.cells=Ti,xu=tc=kr=Ti=null}ag.prototype={constructor:ag,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(i){return Bx(t,n[i])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,i){if(f=(u=e.halfedges).length)for(var s=e.site,u,c=-1,f,p,d=t[u[f-1]],g=d.left===s?d.right:d.left;++c<f;)p=g,d=t[u[c]],g=d.left===s?d.right:d.left,p&&g&&i<p.index&&i<g.index&&UK(s,p,g)<0&&n.push([s.data,p.data,g.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var i=this,s,u=i._found||0,c=i.cells.length,f;!(f=i.cells[u]);)if(++u>=c)return null;var p=n-f.site[0],d=t-f.site[1],g=p*p+d*d;do f=i.cells[s=u],u=null,f.halfedges.forEach(function(y){var v=i.edges[y],E=v.left;if(!((E===f.site||!E)&&!(E=v.right))){var M=n-E[0],A=t-E[1],_=M*M+A*A;_<g&&(g=_,u=E.index)}});while(u!==null);return i._found=s,e==null||g<=e*e?f.site:null}};var XK=Qt(ec(),1);var t1=Qt(K2(),1);function Di(){return new cg}function cg(){this.reset()}cg.prototype={constructor:cg,reset:function(){this.s=this.t=0},add:function(n){Q2(lg,n,this.t),Q2(this,lg.s,this.s),this.s?this.t+=lg.t:this.s=lg.t},valueOf:function(){return this.s}};var lg=new cg;function Q2(n,t,e){var i=n.s=t+e,s=i-t,u=i-s;n.t=t-u+(e-s)}var yn=1e-6;var Tn=Math.PI,br=Tn/2,fg=Tn/4,os=Tn*2,Eu=180/Tn,Fi=Tn/180,nr=Math.abs,Uo=Math.atan,Ui=Math.atan2,hn=Math.cos;var hg=Math.exp;var zf=Math.log;var Me=Math.sin;var jr=Math.sqrt,Gf=Math.tan;function qx(n){return n>1?0:n<-1?Tn:Math.acos(n)}function Ci(n){return n>1?br:n<-1?-br:Math.asin(n)}function Bo(){}var YK=Di(),k0t=Di();function Su(n){var t=n[0],e=n[1],i=hn(e);return[i*hn(t),i*Me(t),Me(e)]}function kf(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function qf(n){var t=jr(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var j0t=Di();function eO(n,t){return[n>Tn?n-os:n<-Tn?n+os:n,t]}eO.invert=eO;function Vx(){var n=[],t;return{point:function(e,i){t.push([e,i])},lineStart:function(){n.push(t=[])},lineEnd:Bo,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Hx(n,t){return nr(n[0]-t[0])<yn&&nr(n[1]-t[1])<yn}function pg(n,t,e,i){this.x=n,this.z=t,this.o=e,this.e=i,this.v=!1,this.n=this.p=null}function Wx(n,t,e,i,s){var u=[],c=[],f,p;if(n.forEach(function(M){if(!((A=M.length-1)<=0)){var A,_=M[0],x=M[A],T;if(Hx(_,x)){for(s.lineStart(),f=0;f<A;++f)s.point((_=M[f])[0],_[1]);s.lineEnd();return}u.push(T=new pg(_,M,null,!0)),c.push(T.o=new pg(_,null,T,!1)),u.push(T=new pg(x,M,null,!1)),c.push(T.o=new pg(x,null,T,!0))}}),!!u.length){for(c.sort(t),nO(u),nO(c),f=0,p=c.length;f<p;++f)c[f].e=e=!e;for(var d=u[0],g,y;;){for(var v=d,E=!0;v.v;)if((v=v.n)===d)return;g=v.z,s.lineStart();do{if(v.v=v.o.v=!0,v.e){if(E)for(f=0,p=g.length;f<p;++f)s.point((y=g[f])[0],y[1]);else i(v.x,v.n.x,1,s);v=v.n}else{if(E)for(g=v.p.z,f=g.length-1;f>=0;--f)s.point((y=g[f])[0],y[1]);else i(v.x,v.p.x,-1,s);v=v.p}v=v.o,g=v.z,E=!E}while(!v.v);s.lineEnd()}}}function nO(n){if(t=n.length){for(var t,e=0,i=n[0],s;++e<t;)i.n=s=n[e],s.p=i,i=s;i.n=s=n[0],s.p=i}}function Aa(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function Xx(n){return n.length===1&&(n=JK(n)),{left:function(t,e,i,s){for(i==null&&(i=0),s==null&&(s=t.length);i<s;){var u=i+s>>>1;n(t[u],e)<0?i=u+1:s=u}return i},right:function(t,e,i,s){for(i==null&&(i=0),s==null&&(s=t.length);i<s;){var u=i+s>>>1;n(t[u],e)>0?s=u:i=u+1}return i}}}function JK(n){return function(t,e){return Aa(n(t),e)}}var rO=Xx(Aa),jK=rO.right,KK=rO.left;var iO=Array.prototype,tQ=iO.slice,eQ=iO.map;var Vyt=Math.sqrt(50),Hyt=Math.sqrt(10),Wyt=Math.sqrt(2);function gg(n){for(var t=n.length,e,i=-1,s=0,u,c;++i<t;)s+=n[i].length;for(u=new Array(s);--t>=0;)for(c=n[t],e=c.length;--e>=0;)u[--s]=c[e];return u}var lQ=1e9,C_t=-lQ;var Yx=Di();function $x(n,t){var e=t[0],i=t[1],s=[Me(e),-hn(e),0],u=0,c=0;Yx.reset();for(var f=0,p=n.length;f<p;++f)if(g=(d=n[f]).length)for(var d,g,y=d[g-1],v=y[0],E=y[1]/2+fg,M=Me(E),A=hn(E),_=0;_<g;++_,v=T,M=R,A=B,y=x){var x=d[_],T=x[0],w=x[1]/2+fg,R=Me(w),B=hn(w),U=T-v,D=U>=0?1:-1,P=D*U,ct=P>Tn,L=M*R;if(Yx.add(Ui(L*D*Me(P),A*B+L*hn(P))),u+=ct?U+D*os:U,ct^v>=e^T>=e){var W=kf(Su(y),Su(x));qf(W);var V=kf(s,W);qf(V);var Mt=(ct^U>=0?-1:1)*Ci(V[2]);(i>Mt||i===Mt&&(W[0]||W[1]))&&(c+=ct^U>=0?1:-1)}}return(u<-yn||u<yn&&Yx<-yn)^c&1}var B_t=Di();var rxt=Di(),ixt=Di();var hQ=1/0;var axt=-hQ;function Zx(n){this._context=n}Zx.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,os);break}}},result:Bo};var yxt=Di();function Jx(){this._string=[]}Jx.prototype={_radius:4.5,_circle:aO(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=aO(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function aO(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function jx(n,t,e,i){return function(s,u){var c=t(u),f=s.invert(i[0],i[1]),p=Vx(),d=t(p),g=!1,y,v,E,M={point:A,lineStart:x,lineEnd:T,polygonStart:function(){M.point=w,M.lineStart=R,M.lineEnd=B,v=[],y=[]},polygonEnd:function(){M.point=A,M.lineStart=x,M.lineEnd=T,v=gg(v);var U=$x(y,f);v.length?(g||(u.polygonStart(),g=!0),Wx(v,gQ,U,e,u)):U&&(g||(u.polygonStart(),g=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),g&&(u.polygonEnd(),g=!1),v=y=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function A(U,D){var P=s(U,D);n(U=P[0],D=P[1])&&u.point(U,D)}function _(U,D){var P=s(U,D);c.point(P[0],P[1])}function x(){M.point=_,c.lineStart()}function T(){M.point=A,c.lineEnd()}function w(U,D){E.push([U,D]);var P=s(U,D);d.point(P[0],P[1])}function R(){d.lineStart(),E=[]}function B(){w(E[0][0],E[0][1]),d.lineEnd();var U=d.clean(),D=p.result(),P,ct=D.length,L,W,V;if(E.pop(),y.push(E),E=null,!!ct){if(U&1){if(W=D[0],(L=W.length-1)>0){for(g||(u.polygonStart(),g=!0),u.lineStart(),P=0;P<L;++P)u.point((V=W[P])[0],V[1]);u.lineEnd()}return}ct>1&&U&2&&D.push(D.pop().concat(D.shift())),v.push(D.filter(dQ))}}return M}}function dQ(n){return n.length>1}function gQ(n,t){return((n=n.x)[0]<0?n[1]-br-yn:br-n[1])-((t=t.x)[0]<0?t[1]-br-yn:br-t[1])}var mQ=jx(function(){return!0},yQ,_Q,[-Tn,-br]);function yQ(n){var t=NaN,e=NaN,i=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(u,c){var f=u>0?Tn:-Tn,p=nr(u-t);nr(p-Tn)<yn?(n.point(t,e=(e+c)/2>0?br:-br),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),n.point(u,e),s=0):i!==f&&p>=Tn&&(nr(t-i)<yn&&(t-=i*yn),nr(u-f)<yn&&(u-=f*yn),e=vQ(t,e,u,c),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),s=0),n.point(t=u,e=c),i=f},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function vQ(n,t,e,i){var s,u,c=Me(n-e);return nr(c)>yn?Uo((Me(t)*(u=hn(i))*Me(e)-Me(i)*(s=hn(t))*Me(n))/(s*u*c)):(t+i)/2}function _Q(n,t,e,i){var s;if(n==null)s=e*br,i.point(-Tn,s),i.point(0,s),i.point(Tn,s),i.point(Tn,0),i.point(Tn,-s),i.point(0,-s),i.point(-Tn,-s),i.point(-Tn,0),i.point(-Tn,s);else if(nr(n[0]-t[0])>yn){var u=n[0]<t[0]?Tn:-Tn;s=e*u/2,i.point(-u,s),i.point(0,s),i.point(u,s)}else i.point(t[0],t[1])}function mg(n){return function(t){var e=new Kx;for(var i in n)e[i]=n[i];return e.stream=t,e}}function Kx(){}Kx.prototype={constructor:Kx,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var i1t=hn(30*Fi);var v1t=mg({point:function(n,t){this.stream.point(n*Fi,t*Fi)}});function yg(n){return function(t,e){var i=hn(t),s=hn(e),u=n(i*s);return[u*s*Me(t),u*Me(e)]}}function ss(n){return function(t,e){var i=jr(t*t+e*e),s=n(i),u=Me(s),c=hn(s);return[Ui(t*u,i*c),Ci(i&&e*u/i)]}}var dO=yg(function(n){return jr(2/(1+n))});dO.invert=ss(function(n){return 2*Ci(n/2)});var gO=yg(function(n){return(n=qx(n))&&n/Me(n)});gO.invert=ss(function(n){return n});function Qx(n,t){return[n,zf(Gf((br+t)/2))]}Qx.invert=function(n,t){return[n,2*Uo(hg(t))-br]};function vg(n,t){return[n,t]}vg.invert=vg;function mO(n,t){var e=hn(t),i=hn(n)*e;return[e*Me(n)/i,Me(t)/i]}mO.invert=ss(Uo);function yO(n,t){var e=t*t,i=e*e;return[n*(.8707-.131979*e+i*(-.013791+i*(.003971*e-.001529*i))),t*(1.007226+e*(.015085+i*(-.044475+.028874*e-.005916*i)))]}yO.invert=function(n,t){var e=t,i=25,s;do{var u=e*e,c=u*u;e-=s=(e*(1.007226+u*(.015085+c*(-.044475+.028874*u-.005916*c)))-t)/(1.007226+u*(.015085*3+c*(-.044475*7+.028874*9*u-.005916*11*c)))}while(nr(s)>yn&&--i>0);return[n/(.8707+(u=e*e)*(-.131979+u*(-.013791+u*u*u*(.003971-.001529*u)))),e]};function vO(n,t){return[hn(t)*Me(n),Me(t)]}vO.invert=ss(Ci);function _O(n,t){var e=hn(t),i=1+hn(n)*e;return[e*Me(n)/i,Me(t)/i]}_O.invert=ss(function(n){return 2*Uo(n)});function xO(n,t){return[zf(Gf((br+t)/2)),-n]}xO.invert=function(n,t){return[-t,2*Uo(hg(n))-br]};var bQ=Qt(ec(),1);var AQ=Qt(ec(),1);var CQ=Qt(ec(),1);var IQ=Qt(ec(),1);function SO(n,t){let e=0,i=1/0,[s,u]=t;for(let c=0;c<n.length-1;c++){let[f,p]=n[c],[d,g]=n[c+1],y=Math.min(f,d)<=s&&s<=Math.max(f,d),v=Math.min(p,g)<=u&&u<=Math.max(p,g);if(y&&v){let E=Math.abs((d-f)*(u-p)-(g-p)*(s-f));E<i&&(i=E,e=c)}}return e}function wO(n,t){let e=n[0],i=n[1],s=!1;for(let u=0,c=t.length-1;u<t.length;c=u++){let f=t[u][0],p=t[u][1],d=t[c][0],g=t[c][1];p>i!=g>i&&e<(d-f)*(i-p)/(g-p)+f&&(s=!s)}return s}var NAt=Qt(ZO(),1),OAt=Qt(o_(),1);function aD(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function uD(n){let t={};for(let i in n)i.startsWith("on")&&(t[aD(i.slice(2))]=n[i]);let e=i=>Ri(this,null,function*(){let{data:s}=i;if(t[s.type])try{let u=yield t[s.type](s.data);if(u!=null&&u.$transfer&&Array.isArray(u.$transfer)){let c=u.$transfer;delete u.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:u},c)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:u})}catch(u){self.postMessage({type:""+s.type+"_result",key:s.key,error:u})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var qAt=Qt(bD(),1),VAt=Qt(Bc(),1);function AD(n,t,e){e===void 0&&(e=0),n.forEach(i=>{if(i.geometry.coords=JSON.parse(JSON.stringify(i.geometry.cds)),i.geometry.type==="polygon"){var s;i.geometry.coords.map(u=>{Array.isArray(u)&&u.forEach(c=>{c[0]-=t[0],c[1]-=t[1]})}),i.geometry.otherCds&&(i.geometry.otherCoords=i.geometry.otherCds.map(u=>u.map(c=>ic(c,t)))),(s=i.doors)!=null&&s.length&&i.doors.map(u=>{u.coord=ic(u.coordinate,t)}),i.center&&(i.centerCoords=ic(i.center,t))}else i.geometry.coords=ic(i.geometry.cds,t),i.center&&(i.centerCoords=ic(i.center,t));if(i.center_x&&i.center_y){let[u,c]=ic([i.center_x,i.center_y],t);i.center_coord_x=u,i.center_coord_y=c}});for(let i=0;i<n.length;i++){let s=n[i];s.deltaHeight=1e-5*(e+i+1)}}function ic(n,t){return[n[0]-t[0],n[1]-t[1]]}var jAt=Qt(p0(),1),KAt=Qt(d0(),1),QAt=Qt(g0(),1),tTt=Qt(y0(),1),eTt=Qt(v0(),1),nTt=Qt(S0(),1),rTt=Qt(I0(),1),iTt=Qt(R0(),1),oTt=Qt(L0(),1),sTt=Qt(O0(),1),aTt=Qt(F0(),1),uTt=Qt(G0(),1),lTt=Qt(V0(),1),cTt=Qt(iy(),1),fTt=Qt(oy(),1),hTt=Qt(Sh(),1);function Eg(n,t=!1){let e=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),s=new Set(Object.keys(n[0].morphAttributes)),u={},c={},f=n[0].morphTargetsRelative,p=new ui,d=0;for(let g=0;g<n.length;++g){let y=n[g],v=0;if(e!==(y.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let E in y.attributes){if(!i.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+'. All geometries must have compatible attributes; make sure "'+E+'" attribute exists among all geometries, or in none of them.'),null;u[E]===void 0&&(u[E]=[]),u[E].push(y.attributes[E]),v++}if(v!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". Make sure all geometries have the same number of attributes."),null;if(f!==y.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let E in y.morphAttributes){if(!s.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphAttributes must be consistent throughout all geometries."),null;c[E]===void 0&&(c[E]=[]),c[E].push(y.morphAttributes[E])}if(t){let E;if(e)E=y.index.count;else if(y.attributes.position!==void 0)E=y.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". The geometry must have either an index or a position attribute"),null;p.addGroup(d,E,g),d+=E}}if(e){let g=0,y=[];for(let v=0;v<n.length;++v){let E=n[v].index;for(let M=0;M<E.count;++M)y.push(E.getX(M)+g);g+=n[v].attributes.position.count}p.setIndex(y)}for(let g in u){let y=TD(u[g]);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" attribute."),null;p.setAttribute(g,y)}for(let g in c){let y=c[g][0].length;if(y===0)break;p.morphAttributes=p.morphAttributes||{},p.morphAttributes[g]=[];for(let v=0;v<y;++v){let E=[];for(let A=0;A<c[g].length;++A)E.push(c[g][A][v]);let M=TD(E);if(!M)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" morphAttribute."),null;p.morphAttributes[g].push(M)}}return p}function TD(n){let t,e,i,s=-1,u=0;for(let d=0;d<n.length;++d){let g=n[d];if(t===void 0&&(t=g.array.constructor),t!==g.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=g.itemSize),e!==g.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=g.normalized),i!==g.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(s===-1&&(s=g.gpuType),s!==g.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;u+=g.count*e}let c=new t(u),f=new Yn(c,e,i),p=0;for(let d=0;d<n.length;++d){let g=n[d];if(g.isInterleavedBufferAttribute){let y=p/e;for(let v=0,E=g.count;v<E;v++)for(let M=0;M<e;M++){let A=g.getComponent(v,M);f.setComponent(v+y,M,A)}}else c.set(g.array,p);p+=g.count*e}return s!==void 0&&(f.gpuType=s),f}function CD(n,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=n.filter(f=>f.geometry.type==="polygon");if(!i.length)return null;let s=i.map(f=>{var p;let d=f.geometry.coords,g=fd(d[0],d.slice(1)),y=new rd(g,{steps:1,bevelEnabled:!1,depth:f.height,curveSegments:4});(p=f).deltaHeight||(p.deltaHeight=0),y.translate(0,0,f.airHeight+f.deltaHeight);let v=y.attributes.position.count,E=new Float32Array(v).fill(f.height+f.airHeight+f.deltaHeight);if(y.setAttribute("maxZ",new Yn(E,1)),y.setAttribute("opacity",new Yn(new Float32Array(v).fill(f.fillOpacity),1)),e){let _=new Float32Array(v).fill(f.airHeight+f.deltaHeight);y.setAttribute("minZ",new Yn(_,1))}let M=new Te(f.fillColor).convertLinearToSRGB(),A=new Float32Array(v*3);for(let _=0;_<v;_++)A[_*3]=M.r,A[_*3+1]=M.g,A[_*3+2]=M.b;return y.setAttribute("color",new Yn(A,3)),y}),u=Eg(s);s.forEach(f=>f.dispose());let c={geometry:u};return u.dispose(),t&&(c.lineGeometry=c1(i)||void 0),c}function c1(n){let{points:t,colors:e,opacities:i}=Ktt(n);if(!t.length)return null;let s=new ui().setFromPoints(t);return s.setAttribute("color",new Yn(new Float32Array(e),3)),s.setAttribute("opacity",new Yn(new Float32Array(i),1)),s}function Ktt(n){let t=[],e=[],i=[];return n.filter(s=>s.strokeOpacity>0).map(s=>{let u=s.height+(s.deltaHeight||0)+s.airHeight,{coords:c}=s.geometry,{strokeColor:f,strokeOpacity:p}=s,d=new Te(f).convertLinearToSRGB();for(let g=0;g<c.length;g++){let y=c[g];for(let v=0;v<y.length;v++){let E=y[v],M=v+1===y.length?y[0]:y[v+1];t.push(new st(E[0],E[1],u)),t.push(new st(M[0],M[1],u)),e.push(d.r,d.g,d.b),e.push(d.r,d.g,d.b),i.push(p),i.push(p)}}}),{points:t,colors:e,opacities:i}}var Hf=function(n){return n.HALF="half",n.POWER="power",n.MECHANICAL="mechanical",n.NORMAL="normal",n.VIP="vip",n}({});var ID=new Ko,Sg=new st,wg=class extends sd{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let t=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],e=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new _r(t,3)),this.setAttribute("uv",new _r(e,2))}applyMatrix4(t){let e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return e!==void 0&&(e.applyMatrix4(t),i.applyMatrix4(t),e.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));let i=new gf(e,6,1);return this.setAttribute("instanceStart",new ts(i,3,0)),this.setAttribute("instanceEnd",new ts(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));let i=new gf(e,6,1);return this.setAttribute("instanceColorStart",new ts(i,3,0)),this.setAttribute("instanceColorEnd",new ts(i,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new od(t.geometry)),this}fromLineSegments(t){let e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ko);let t=this.attributes.instanceStart,e=this.attributes.instanceEnd;t!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(t),ID.setFromBufferAttribute(e),this.boundingBox.union(ID))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new uu),this.boundingBox===null&&this.computeBoundingBox();let t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(t!==void 0&&e!==void 0){let i=this.boundingSphere.center;this.boundingBox.getCenter(i);let s=0;for(let u=0,c=t.count;u<c;u++)Sg.fromBufferAttribute(t,u),s=Math.max(s,i.distanceToSquared(Sg)),Sg.fromBufferAttribute(e,u),s=Math.max(s,i.distanceToSquared(Sg));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}};var xTt=Qt(sD(),1);var Mg=function(n){return n.LAYERED_RENDER_VERSION="layeredRender",n.MERGED_RENDER_VERSION="mergedRender",n}({});var f1=["range","ground","store","facility","parkingSpace"];function PD(n){return f1.indexOf(n.l_type)===-1?f1.length:f1.indexOf(n.l_type)}function Qtt(n){n.layers.sort((t,e)=>PD(t)-PD(e))}function tet(n){let t=n.layers.find(i=>i.l_type==="range"),e=[t.elements[0].center_x,t.elements[0].center_y];n.layers.map(i=>{if(i.l_type!=="range")return AD(i.elements,e)})}function RD(n){Qtt(n),tet(n)}function bg(n,t){return t===void 0&&(t=4),n.floor_id+"_"+n.version_id+(t?"_"+t:"")}var oc=[],sc=[];function eet(n,t){return Ri(this,null,function*(){return yield rp(),fy(n,""+t)})}function LD(n,t,e){return Ri(this,null,function*(){let{db:i}=yield rp();return cC(n,""+t,e,i)})}function net(n){return Ri(this,null,function*(){let t=yield fetch(n.map_url).then(e=>e.json());return t.floor=n.floor,RD(t),oc.push(t),t})}function ret(n,t){return Ri(this,null,function*(){let e=bg(n,t===Mg.LAYERED_RENDER_VERSION?1:void 0);try{let i=yield eet(np.MAP_DATA,e);return i&&(t===Mg.LAYERED_RENDER_VERSION||i.transformed)?(console.log("\\u4ECE\\u7F13\\u5B58\\u4E2D\\u53D6\\u5230\\u4E86\\u6570\\u636E"),i):(console.log("\\u7F13\\u5B58\\u4E2D\\u6CA1\\u6709\\u6570\\u636E",e,i),sc.push(n),null)}catch(i){return console.log("[get floor data error]",i),sc.push(n),null}})}function iet(n,t){return t===void 0&&(t=!0),t&&(n.layers.forEach(e=>{switch(e.l_type){case"ground":if(e.elements.length<2)break;e.mergedElements=Wf(e.elements);break;case"store":h1(e.elements),e.mergedElements=Wf(e.elements);break;case"facility":h1(e.elements),e.mergedElements=Wf(e.elements);break;case"parkingSpace":console.time("parkingSpace merge"),e.mergedElements=oet(e.elements),console.timeEnd("parkingSpace merge"),e.mergedParkingTexture=uet(e.elements);break;case"graph":h1(e.elements),e.mergedElements=Wf(e.elements);break;case"wall":e.mergedElements=Wf(e.elements,!1,!0);break;case"lane":e.mergedElements=set(e.elements);break;case"texture2d":case"texture3d":e.mergedMatrixes=ND(e.elements);break;case"glb":case"text":}}),n.transformed=!0),n}function Wf(n,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=CD(n,t,e);if(i){var s;return[xc({},n[0],{mergedGeometry:i.geometry.toJSON(),lineGeometry:((s=i.lineGeometry)==null?void 0:s.toJSON())||null})]}else return[]}function oet(n){let t=[],e=[],i=[],s=[];n.forEach((c,f)=>{let p=c.geometry.coords[0],[d,g,y]=p.slice(0,3),v=Math.sqrt((g[0]-d[0])**2+(g[1]-d[1])**2),E=Math.sqrt((y[0]-g[0])**2+(y[1]-g[1])**2),M=[v,E],A=Math.max(...M),_=Math.min(...M),x;A===v?x=[g[0]-d[0],g[1]-d[1]]:x=[y[0]-g[0],y[1]-g[1]];let[T,w]=x,R=Math.atan2(w,T)-Math.PI/2,B=new jn().compose(new st(c.center_coord_x,c.center_coord_y,(c.deltaHeight||0)+c.airHeight+c.height/2),new No().setFromAxisAngle(new st(0,0,1),R),new st(_,A,c.height));i.push(...B.toArray()),s.push(...new Te(c.fillColor).convertLinearToSRGB().toArray()),t[f]=c.fillOpacity||1,e[f]=(c.deltaHeight||0)+c.airHeight+c.height});let u=c1(n);return{size:n.length,opacities:t,maxZ:e,matrixes:i,colors:s,lineGeometry:(u==null?void 0:u.toJSON())||null}}function ND(n){let t=n.reduce((i,s)=>{let{iconUrl:u}=s;return i.has(u)||i.set(u,[]),i.get(u).push(s),i},new Map);return Array.from(t.values()).map(i=>{let s=i.map(c=>new jn().compose(new st(c.centerCoords[0],c.centerCoords[1],c.deltaHeight+c.airHeight+c.height),new No().setFromAxisAngle(new st(0,0,1),c.secondRotate),new st(c.secondWidth,c.secondHeight,1)).toArray());return xc({},i[0],{mergedMatrixes:{size:s.length,array:s.flat()}})})}function set(n){let t=n.map(u=>{let c=fd(u.geometry.coords[0].slice(0,-1),u.geometry.coords.slice(1)),f=new id(c,4),p=f.getAttribute("position"),d=[],g=new Te(u.fillColor);for(let v=0;v<p.count;v++){p.setZ(v,u.airHeight+(u.deltaHeight||0));var y;d.push(g.r,g.g,g.b,(y=u.fillOpacity)!=null?y:1)}return f.setAttribute("color",new Yn(new Float32Array(d),4)),f}),e=Eg(t);t.forEach(u=>u.dispose());let i={mergedGeometry:e.toJSON()};e.dispose();let s=n.filter(u=>{var c,f;return u.double&&((f=u.geometry.otherCoords)==null||(c=f[1])==null?void 0:c.length)});return s.length&&[!0,!1].forEach(u=>{let c=s.filter(g=>g.double===!0&&g.dashed===u);if(!c.length)return;let f=[],p=[];c.forEach(g=>{let y=g.geometry.otherCoords[1],v=g.airHeight+(g.deltaHeight||0)+.01,E=new Te(g.secondColor);for(let M=0;M<y.length-1;M++){let A=y[M],_=y[M+1];f.push(A[0],A[1],v,_[0],_[1],v),p.push(E.r,E.g,E.b,E.r,E.g,E.b)}});let d=new wg;d.setPositions(f),d.setColors(p),i[u?"dashedLineGeometry":"lineGeometry"]={positions:f,colors:p},d.dispose()}),i}var aet=new Set([Hf.HALF,Hf.MECHANICAL,Hf.POWER,Hf.VIP]);function uet(n){let t=n.filter(e=>aet.has(e.parkingType)).map(e=>{let i=new Ft(...e.geometry.coords[0][0]),s=new Ft(...e.geometry.coords[0][1]),u=new Ft(...e.geometry.coords[0][2]),c=Math.min(i.distanceTo(s),s.distanceTo(u)),f=0;return c===i.distanceTo(s)?f=s.sub(i).angle()-Math.PI/2:f=u.sub(s).angle()-Math.PI/2,{uuid:e.id,iconUrl:e.parkingType,name:e.texts[0],deltaHeight:(e.deltaHeight||0)+.001,airHeight:e.airHeight,height:e.height,geometry:e.geometry,opacity:e.fillOpacity,visible:!0,secondWidth:c-1,secondHeight:c-1,secondRotate:f,centerCoords:[e.center_coord_x,e.center_coord_y]}});return ND(t)}function h1(n){n.map(t=>{var e;if((e=t.doors)!=null&&e.length&&t.geometry.type==="polygon"){let i=t.geometry.coords[0];t.doors.forEach(s=>{let u=s.type==="single"?.5:1,c=.5,f=SO(i,s.coord),p=new Ft(...s.coord),d=new Ft(...i[f]).sub(new Ft(...s.coord)).normalize(),g=new Ft().addVectors(p,d.clone().multiplyScalar(u)),y=new Ft().addVectors(p,d.clone().multiplyScalar(-u)),v=new Ft(-d.y,d.x),E=new Ft().addVectors(g,v.clone().multiplyScalar(c));wO([E.x,E.y],i)||(v.multiplyScalar(-1),E=new Ft().addVectors(g,v.clone().multiplyScalar(c)));let M=new Ft().addVectors(y,v.clone().multiplyScalar(c)),A=[[g.x,g.y],[E.x,E.y],[M.x,M.y],[y.x,y.y]];i=[...i.slice(0,f+1),...A,...i.slice(f+1)]}),t.geometry.coords[0]=i}})}var p1="";function OD(n){let t=sc.findIndex(e=>e.floor===n);if(t!==-1){console.log("\\u8C03\\u6574\\u697C\\u5C42\\u8BF7\\u6C42\\u7684\\u4F18\\u5148\\u7EA7",n,t);let e=sc.splice(t,1)[0];sc.unshift(e)}else p1=n}var d1="";function DD(n){let t=oc.findIndex(e=>e.floor===n);if(t!==-1){console.log("\\u8C03\\u6574\\u697C\\u5C42merge\\u4F18\\u5148\\u7EA7",n,t);let e=oc.splice(t,1)[0];oc.unshift(e)}else d1=n}function cet(n){OD(n),DD(n)}uD({onLoad(n){return Ri(this,null,function*(){let{floors:t,version:e}=n;for(yield rp(),yield Promise.all(t.map(i=>Ri(this,null,function*(){return ret(i,e)}))),p1&&OD(p1),yield Promise.all(sc.map(i=>Ri(this,null,function*(){let s=yield net(i);if(s&&e===Mg.LAYERED_RENDER_VERSION){let u=bg(t.find(c=>c.floor===s.floor),1);yield LD(np.MAP_DATA,u,s),console.log(s.floor+" \\u5199\\u5165\\u7F13\\u5B58\\u6210\\u529F\\uFF0Ckey="+u),self.postMessage({type:"floor_success",data:{floor:s.floor}})}}))),d1&&DD(d1);oc.length>0;){let i=oc.shift(),s=iet(i),u=bg(t.find(c=>c.floor===i.floor));yield LD(np.MAP_DATA,u,s),console.log(i.floor+" \\u5199\\u5165\\u7F13\\u5B58\\u6210\\u529F\\uFF0Ckey="+u),self.postMessage({type:"floor_success",data:{floor:i.floor}})}fC(),console.log("\\u6240\\u6709\\u6570\\u636E\\u5904\\u7406\\u5B8C\\u6210")})},onAdjustFloorPriority(n){let{floor:t}=n;cet(t)}});
11811
11811
  `],{type:"text/javascript"}),t=URL.createObjectURL(a),e=new Worker(t);return URL.revokeObjectURL(t),e}var hc={mergeParkingSpace:!0,mergeGraphic:!0,renderVersion:qe.MERGED_RENDER_VERSION,layers:["graph","wall","lane","texture2d","texture3d","glb","store","facility","parkingSpace","text"],filterPoi:()=>!0},Ae=class extends ${initDb(){return g(this,null,function*(){try{let{db:t}=yield _n();this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return g(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=x({},this.placeConfig,e));else if(typeof t=="string"){let n=yield fetch(t).then(r=>r.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=x({},this.placeConfig,JSON.parse(n.data.config||"{}")))}else return this.load("https://screen.aibee.cn/ai-map/map/get-floor-map?place_id="+t);this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return g(this,null,function*(){return this.initDbPromise.then(()=>vn(t,""+e,n))})}getCacheData(t,e){return g(this,null,function*(){return this.initDbPromise.then(()=>Fe(t,""+e))})}getFloorData(t){return g(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return g(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=ar(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=ur(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return g(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>g(this,null,function*(){let r=Te(t),i=yield fetch(t.map_url).then(o=>o.json());i.floor=t.floor,je(i),this.setCacheData(lt.MAP_DATA,r,i),this.setCacheData(lt.MAP_VERSION,r,t.version_id),n(i)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return g(this,null,function*(){let e=this.floors.find(n=>n.floor===t);return e?new Promise(n=>g(this,null,function*(){let r=Te(e,this.options.renderVersion===qe.LAYERED_RENDER_VERSION?1:void 0);try{let i=Te(e),o=yield this.getCacheData(lt.MAP_DATA,i);if(o&&o.transformed){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u5408\u5E76\u540E\u7684\u6570\u636E"),n(o);return}if(this.options.renderVersion===qe.LAYERED_RENDER_VERSION){let s=yield this.getCacheData(lt.MAP_DATA,r);if(s){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u6570\u636E"),n(s);return}}if(console.log("\u7F13\u5B58\u4E2D\u6CA1\u6709\u6570\u636E"),this.loadWorker){X(this.loadWorker,"adjust_floor_priority",{floor:t});let s=u=>{if(u.data.type==="floor_success"&&u.data.data.floor===t){var l;(l=this.loadWorker)==null||l.removeEventListener("message",s),n(this.getFloorJsonData(t))}};this.loadWorker.addEventListener("message",s)}else n(this.getFloorJsonDataByFloorInfo(e))}catch(i){console.log("[get floor data error]",i),n(this.getFloorJsonDataByFloorInfo(e))}})):null})}getRoadNetworkData(){return g(this,null,function*(){return(yield Promise.all(this.floors.map(e=>g(this,null,function*(){let n=Te(e,0);try{let r=yield this.getCacheData(lt.ROAD_NETWORK_DATA,n);if(r)return r;let i=yield fetch(e.route_url).then(o=>o.json());return this.setCacheData(lt.ROAD_NETWORK_DATA,n,i),this.setCacheData(lt.ROUTE_VERSION,n,e.version_id),i}catch(r){let i=yield fetch(e.route_url).then(o=>o.json());return this.setCacheData(lt.ROAD_NETWORK_DATA,n,i),i}})))).filter(e=>e.points)})}getFacilitiesData(){return g(this,null,function*(){let t=this.floors.reduce((r,i)=>r.updated_at>i.updated_at?r:i,this.floors[0]);if(!t)return null;let e=Te(t,0),n=()=>g(this,null,function*(){let r=yield fetch(t.entry_infra_url).then(i=>i.json());return r&&(this.setCacheData(lt.FACILITY_DATA,e,r),this.setCacheData(lt.FACILITY_VERSION,e,t.version_id)),r});try{let r=yield this.getCacheData(lt.FACILITY_DATA,e);return r||n()}catch(r){return console.log("[get facility error]",r),n()}})}getOtherDataByFreeTime(){return g(this,null,function*(){yield this.initDbPromise,yield X(this.loadWorker,"load",{floors:this.floors,version:this.options.renderVersion}),this.closeWorker()})}getMulFloorsData(t){return g(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return g(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return g(this,null,function*(){je(t),e=this.getFloorBaseLayer(t,e);let r=x({},this.placeConfig,n);return yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,r),this.changeFloorBox(t,e),e})}getDataByJsonStep(t,e,n){return g(this,null,function*(){je(t),e=this.getFloorBaseLayer(t,e);let r=x({},this.placeConfig,n);return this.changeFloorBox(t,e),requestAnimationFrame(()=>g(this,null,function*(){yield this.getFloorContentLayer(t,e),this.changeFloorBox(t,e),requestAnimationFrame(()=>g(this,null,function*(){yield this.getFloorPoi(t,e,r),this.changeFloorBox(t,e)}))})),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new lc),r=Math.max(n.x,n.y,n.z);e.userData.height=r/4+t.floorHeight}switchFloor(t,e){return g(this,null,function*(){return new Promise(n=>{let r={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},i=this.taskQueue.replaceByMetaType(r),o=s=>{let{task:u,res:l}=s;u.tid===i&&(this.taskQueue.removeEventListener("active-task-end",o),n(l))};this.taskQueue.addEventListener("active-task-end",o)})})}_switchFloor(t,e){return g(this,null,function*(){var n;let r=t;if(typeof t=="string"){let c=yield this.getFloorJsonData(t);if(c)r=c;else return null}else je(t);let i=x({},this.placeConfig,e),o=new xt(this.bmap.context);o.userData.data=t;let s=this.floors.find(c=>c.floor===r.floor);var u;let l=(u=s==null?void 0:s.map_angle)!=null?u:0;return this.bmap.dispatchEvent({type:st.SWITCH_FLOOR_BEFORE,data:{curFloor:o,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:o,graphics:[],floorData:r}}),this.bmap.context.scene.background=new cc(i.backgroundColor),this.getFloorBaseLayer(r,o),this.changeFloorBox(r,o),this.bmap.buildingCenter=o.userData.center,this.bmap.currentBuildGround=(n=o.userData.data.layers.find(c=>c.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(o),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(l/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:st.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield Dr(),yield this.getFloorContentLayer(r,o),this.changeFloorBox(r,o),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield Oi(2),yield this.getFloorPoi(r,o,i),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:st.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new xt(this.bmap.context));let n=[0,0];return t.layers.forEach(r=>{switch(r.l_type){case"range":let i=r.elements[0];n=[i.center_x,i.center_y],e.userData.range=i.geometry.cds[0],e.userData.rangeGraphic=i;break;case"ground":oi(r,e);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return g(this,null,function*(){e||(e=new xt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let r=0;r<t.layers.length;r++){let i=t.layers[r];["range","ground"].includes(i.l_type)||this.options.layers.includes(i.l_type)&&(Qo(i,e,this.options),console.log("time",Date.now()-n,i.l_type),n=Date.now())}return e})}getFloorPoi(t,e,n){return g(this,null,function*(){n===void 0&&(n=this.placeConfig);let r=Date.now();yield Promise.all(t.layers.map(o=>{if(this.options.layers.includes(o.l_type))return ts(o,e,this.locale,n,this.options)})),console.log("poi time",Date.now()-r);let i=Date.now();Dr().then(()=>{console.log("poi render time",Date.now()-i)})})}clear(){return g(this,null,function*(){po(),this.db=null})}closeWorker(){this.loadWorker&&(this.loadWorker.terminate(),this.loadWorker=null)}dispose(){super.dispose(),this.clear(),this.closeWorker(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new ve,this.loadWorker=si(),this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=x({},hc,e),this.placeConfig=x({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};import"core-js/modules/web.dom-collections.iterator.js";function es(a,t){return g(this,null,function*(){let{brand:e,project:n}=a,{apiDomain:r,apiPath:{floorRange:i},apiInfo:o}=t,s=""+r+i+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(s,o).then(l=>l.json()).then(l=>l.data).then(l=>{let c=(l||[])[0];return c&&(c.info=JSON.parse(c.info)),c})})}function ns(a,t){return g(this,null,function*(){let{brand:e,project:n,floor:r,ts:i,resource_type_list:o}=a,{apiDomain:s,apiPath:{floorGraphic:u},apiInfo:l}=t,c=""+s+u+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+r+"&ts="+i+"&resource_type_list="+o;return yield fetch(c,l).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(f=>f.info=JSON.parse(f.info)),p||[]))})}function g3(a,t){return g(this,null,function*(){let{project:e,floor:n}=a,{apiDomain:r,apiInfo:i}=t,o=r+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(o,i).then(u=>u.json()).then(u=>u.data).then(u=>JSON.parse(u[0].streetInfo||"{}")).then(u=>u.fileId?pc(u.fileId,t):null)})}function pc(a,t){return g(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+a,n).then(r=>r.arrayBuffer()).then(r=>{let o=new TextDecoder("utf-8").decode(r);return o?JSON.parse(o):null})})}var rs=class{load(t){return g(this,null,function*(){let e=ge(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),ns(t,this.bmap.config)]),r=ge({floor:t.floor,ts:t.ts});fn(n.map(o=>o.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(r)||0),n.forEach(o=>o.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let i=this.floorDataLengthMap.get(r)||0;return this.floorDataLengthMap.set(r,i+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return g(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,r=e.userData.graphicMap||new Map,{ground:i,markGraphic:o,graphic:s}=this.bmap.config;for(let u=0;u<t.length;u++){let l=t[u];l.info.group==="ground"?(l.info.fillColor=i.color,l.info.fillOpacity=i.opacity,l.info.height=i.height,l.info.stroke=i.stroke,l.info.strokeColor=i.strokeColor,l.info.strokeOpacity=i.strokeOpacity):l.info.userData.mark?(l.info.height=o.height,l.info.fillColor=o.color,l.info.fillOpacity=o.opacity,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity):(l.info.fillOpacity=s.fillOpacity,this.bmap.config.initTransToMark&&(l.info.height=o.height,l.info.fillColor=o.color,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity))}for(let u of t){if(u.info.group==="ground")e.createGround(u.info);else{let l=e.addGraphic(u.info);l.userData.data=u,n.set(u.legacy_id,l)}r.set(u.element_uuid,u)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=r,e.userData.rangeGraphic=this.bmap.currentBuildGround,e.userData.range=this.bmap.currentBuildGround.geometry.cds[0],e.userData.center=this.bmap.buildingCenter,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(st.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(st.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let n=e.userData.graphicMap||new Map;return t.filter(r=>!n.has(r.element_uuid))}switchFloorByStoreData(t,e){return g(this,null,function*(){let n=yield this.load(x({},t,{resource_type_list:"6"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}switchFloorByOtherData(t,e){return g(this,null,function*(){let n=yield this.load(x({},t,{resource_type_list:"1,2,3,4"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}loadBuildGround(t){return g(this,null,function*(){let{brand:e,project:n}=t,r=yield this.loadBuildingGround({brand:e,project:n});var i;return this.bmap.currentBuildGround=(i=r==null?void 0:r.info)!=null?i:null,this.bmap.changeBuildingCenter(r,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return g(this,null,function*(){let{brand:e,project:n}=t,r=ge({brand:e,project:n});if(this.buildingGroundMap.has(r))return this.buildingGroundMap.get(r);let i=es({brand:e,project:n},this.bmap.config).then(o=>(this.buildingGroundMap.set(r,o),o));return this.buildingGroundMap.set(r,i),i})}switchFloor(t){return g(this,null,function*(){let e=new xt(this.bmap.context);e.userData.graphicMap=new Map,e.name=t.floor;try{yield Promise.all([this.switchFloorByStoreData(t,e),this.switchFloorByOtherData(t,e)])}catch(n){console.log(n)}return e})}dispose(){this.cacheData.clear(),this.floorDataLengthMap.clear(),this.buildingGroundMap.clear()}constructor(t){this.bmap=t,this.cacheData=new Map,this.floorDataLengthMap=new Map,this.buildingGroundMap=new Map,this.externalStreetMap=new Map}};var B3=function(a){return a[a.D2=0]="D2",a[a.D3=1.1]="D3",a}({}),is=class extends dc{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:r}=e,i=t?an(t.info.geometry.cds[0]):[0,0];this.buildingCenter=i,this.dispatchEvent({type:"center-change",center:i,project:r,brand:n})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor(t){return g(this,null,function*(){return this.loader||(this.loader=new Ae(this),this.loader.placeConfig=x({},this.loader.placeConfig,this.config.loaderPlaceConfig),yield this.loader.load(this.config.apiPath.loadPlaceInfo+"?place_id="+this.config.placeId+"&env=prod")),this.loader.switchFloor(t)})}switchFloorByFloor(t,e,n){e===void 0&&(e=!0),n===void 0&&(n=t.graphicLayer.children),this.triggerHooks(st.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:n}),this.buildingCenter=t.userData.center,this.currentBuildGround=t.userData.rangeGraphic,this.context.switchFloor(t,e),this.initialFloorCamera(),this.triggerHooks(st.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:n})}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(this.config.defaultPadding,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*this.config.control.maxZoomScale,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}addModel(t,e){if(t.options.geometry.type==="polygon"){var n;let r=(n=this.context.currentFloor)==null?void 0:n.addModel(x({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(r){let{facilityAngle:i=0,facilityXScale:o=1,facilityYScale:s=1}=t.options.userData;r.rotateZ((180-i)/180*Math.PI),r.scale.set(o,s,1)}}}addHeatmap(t){var e;return(e=this.context.currentFloor)==null?void 0:e.addHeatmap(t)}getLegacyToGraphicMap(){var t;return((t=this.context.currentFloor)==null?void 0:t.userData.legacyToGraphicMap)||new Map}getFloorAllGraphics(){var t;return((t=this.context.currentFloor)==null?void 0:t.getGraphics())||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let n=t.options.center,r=t.getCenter(),i=(n==null?void 0:n[0])||r.x,o=(n==null?void 0:n[1])||r.y;return console.log(i,o,n,r),this.context.currentFloor.addPoi(x({},e,{position:{x:i,y:o,z:r.z+t.options.height/2}}))}return null}createPoi2ByPosition(t,e){if(this.context.currentFloor){let n=this.mercatorToWorld([t.x,t.y]),r=new K(this.context,x({},e,{position:{x:n.x,y:n.y,z:t.z}}));return this.context.currentFloor.poiLayer2.pushPoi(r),r}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,r){e===void 0&&(e=500),n===void 0&&(n=0),r===void 0&&(r=0);let i=t.getPosition().clone(),{context:{camera:o}}=this;if(o.updateMatrix(),r){let s=new lr;s.setFromMatrixColumn(o.matrix,1),s.normalize(),s.multiplyScalar(r/o.zoom),i.add(s)}if(n){let s=new lr;s.setFromMatrixColumn(o.matrix,0),s.normalize(),s.multiplyScalar(n/o.zoom),i.add(s)}return this.context.setCameraPosition(i,e)}translateElementToCenterX(t,e){return g(this,null,function*(){return e===void 0&&(e=500),_t(new Promise(n=>{let r=this.context.control.target.clone(),i=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:o,height:s},camera:u}=this.context,c=T(i,u,o,s).x-o/2,h=new lr;h.setFromMatrixColumn(this.context.camera.matrix,0),h.normalize(),h.multiplyScalar(c/this.context.camera.zoom),r.add(h),this.context.setCameraPosition(r,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:r}=this.container;return T(e,this.context.camera,n,r)}changeMapType(t,e){return e===void 0&&(e=500),this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}resetView(t){return g(this,null,function*(){t===void 0&&(t=300);let e=t/3;yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),yield this.context.setPolarAngle(this.config.control.defaultPolar,e),yield this.context.fitCameraToGround(this.config.defaultPadding,e,!1)})}reduceMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver(this.debounceResize);t.observe(this.container),this.observe=t}}unRegistryEvent(){var t;this.context.control.removeEventListener("change",this.onControlChange),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),(t=this.observe)==null||t.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t,e){t===void 0&&(t=.1),e===void 0&&(e=500);let n=this.context.control.getAzimuthalAngle();return this.context.setAzimuthalAngle(n+t,e)}measureDistance(){return g(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Bn(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",r=>{let{distance:i}=r;t(i)})})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new zn(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",r=>{let{area:i}=r;t(i)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}fitCameraByPois(t,e,n){return g(this,null,function*(){if(e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),!t.length)return;let r=new fc;return t.forEach(i=>{let{position:o}=i;r.expandByPoint(o)}),this.context.fitCameraToBox(r,e,n,!1)})}fitCameraByPoiNodeIds(t,e,n){return g(this,null,function*(){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500);let r=t.map(i=>this.getPoiById(i)).filter(i=>!!i);if(r.length)return this.fitCameraByPois(r,e,n)})}getGraphicByNodeId(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((n=this.context.currentFloor)==null?void 0:n.parkingSpaceLayer.graphicMap.get(t))||null}deleteGraphic(t){var e;(e=this.context.currentFloor)==null||e.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){var e;if(!t.transformToBuildingGround&&this.currentBuildGround){let n=an(this.currentBuildGround.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(r=>{Array.isArray(r)&&r.forEach(i=>{i[0]-=n[0],i[1]-=n[1]})});else{let[r,i]=t.geometry.cds;t.geometry.coords=[r-n[0],i-n[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}mercatorToWorld(t){let e=this.buildingCenter;return new lr(t[0]-e[0],t[1]-e[1],0)}removePoiById(t){var e,n;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(n=this.context.currentFloor)==null||n.poiLayer2.removePoiById(t)}getPoiById(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||((n=this.context.currentFloor)==null?void 0:n.poiLayer2.getPoiById(t))}getPois(){var t,e;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(n=>!n.options.built_in),...((e=this.context.currentFloor)==null?void 0:e.poiLayer2.pois)||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}dispose(){this.loader&&(this.loader.dispose(),this.loader=null),this.unRegistryEvent(),this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.plugins=[],this.context.dispose(),this.context=null,this.container=null,J.dispose(),rt.dispose(),$t.dispose(),at.dispose(),C.dispose(),wt.dispose(),this.debounceResize=null,ai.Dispose==null||ai.Dispose.call(ai)}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new W,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:n}}=this.context;n!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=n)},this.onKeydown=n=>{this.polarKeys.includes(n.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(n.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=n=>{if(this.polarKeys.includes(n.code)){let r=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=r,this.context.control.minPolarAngle=r}if(this.azimuthalKeys.includes(n.code)){let r=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=r,this.context.control.minAzimuthAngle=r}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),r=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let i=this.context.getFitCameraToGroundZoom(this.config.defaultPadding,0)||1;this.context.camera.zoom=r,this.context.control.minZoom=i,this.context.control.maxZoom=i*this.config.control.maxZoomScale,this.basicZoom=r,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=$o(e),this.context=new sr(t,this),this.debounceResize=gc(this.resize,5),this.registryEvent()}};var k3=function(a){return a.HALF="half",a.POWER="power",a.MECHANICAL="mechanical",a.NORMAL="normal",a.VIP="vip",a}({});import"core-js/modules/web.dom-collections.iterator.js";var et=class extends ${dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null,super.dispose()}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var os=class extends et{fetchEquipment(){return g(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,r=""+t+e;yield fetch(r,n).then(i=>i.json()).then(i=>i.data).then(i=>{this.equipmentList=i,this.equipmentMap=new Map(i.map(o=>[o.equipment_id,o]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)})}getGraphicEquipment(t){return t.userData.data.info.userData.equipment}changeGraphicToEquipment(t){t.filter(e=>{let n=this.getGraphicEquipment(e);return n&&this.equipmentMap.has(n)}).forEach(e=>{let n=this.equipmentMap.get(this.getGraphicEquipment(e)),r=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});r&&(r.userData.data=n,r.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(st.SWITCH_FLOOR_AFTER,this.onSwitchFloor),Array.from(((t=this.bmap.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).forEach(e=>{if(e.userData.type==="equipment"){var n;(n=this.bmap.context.currentFloor)==null||n.poiLayer.removePoi(e)}}),super.dispose()}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:n}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(n)},this.fetchEquipment(),this.bmap.addEventListener(st.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};import"core-js/modules/es.string.replace.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.promise.finally.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.push.js";import{Mesh as bc,Object3D as Mc,TextureLoader as wc,Color as Tc,Vector2 as li,Vector3 as Ac,NormalBlending as Cc,RepeatWrapping as Rc}from"three";import"core-js/modules/es.typed-array.float32-array.js";import"core-js/modules/es.typed-array.at.js";import"core-js/modules/es.typed-array.fill.js";import"core-js/modules/es.typed-array.find-last.js";import"core-js/modules/es.typed-array.find-last-index.js";import"core-js/modules/es.typed-array.set.js";import"core-js/modules/es.typed-array.sort.js";import"core-js/modules/es.typed-array.to-reversed.js";import"core-js/modules/es.typed-array.to-sorted.js";import"core-js/modules/es.typed-array.with.js";import"core-js/modules/es.array-buffer.constructor.js";import"core-js/modules/es.array-buffer.slice.js";import"core-js/modules/es.array-buffer.detached.js";import"core-js/modules/es.array-buffer.transfer.js";import"core-js/modules/es.array-buffer.transfer-to-fixed-length.js";import"core-js/modules/es.array.push.js";import"core-js/modules/es.typed-array.uint16-array.js";import{BufferGeometry as mc,Matrix4 as as,Vector3 as he,Ray as _c,Sphere as vc,LineSegments as yc,BufferAttribute as Qt,ShaderChunk as gt,ShaderMaterial as us,UniformsLib as xc,Color as Ec,Vector2 as ss}from"three";var mt=class extends mc{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new as,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};mt.prototype.setMatrixWorld=function(a){this.matrixWorld=a};mt.prototype.setGeometry=function(a,t){this._geometry=a,this.setPoints(a.getAttribute("position").array,t)};mt.prototype.setPoints=function(a,t){if(!(a instanceof Float32Array)&&!(a instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=a,this.widthCallback=t,this.positions=[],this.counters=[],a.length&&a[0]instanceof he)for(var e=0;e<a.length;e++){var n=a[e],r=e/a.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(r),this.counters.push(r)}else for(var e=0;e<a.length;e+=3){var r=e/a.length;this.positions.push(a[e],a[e+1],a[e+2]),this.positions.push(a[e],a[e+1],a[e+2]),this.counters.push(r),this.counters.push(r)}this.process()};function Sc(a,t){var e=new as,n=new _c,r=new vc,i=new he,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),r.copy(o.boundingSphere),r.applyMatrix4(this.matrixWorld),a.ray.intersectSphere(r,i)!==!1){e.copy(this.matrixWorld).invert(),n.copy(a.ray).applyMatrix4(e);var s=new he,u=new he,l=new he,c=this instanceof yc?2:1,h=o.index,p=o.attributes;if(h!==null)for(var f=h.array,d=p.position.array,m=p.width.array,v=0,y=f.length-1;v<y;v+=c){var S=f[v],b=f[v+1];s.fromArray(d,S*3),u.fromArray(d,b*3);var P=m[Math.floor(v/3)]!==void 0?m[Math.floor(v/3)]:1,R=a.params.Line.threshold+this.material.lineWidth*P/2,V=R*R,M=n.distanceSqToSegment(s,u,i,l);if(!(M>V)){i.applyMatrix4(this.matrixWorld);var H=a.ray.origin.distanceTo(i);H<a.near||H>a.far||(t.push({distance:H,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}),v=y)}}}}mt.prototype.raycast=Sc;mt.prototype.compareV3=function(a,t){var e=a*6,n=t*6;return this.positions[e]===this.positions[n]&&this.positions[e+1]===this.positions[n+1]&&this.positions[e+2]===this.positions[n+2]};mt.prototype.copyV3=function(a){var t=a*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};mt.prototype.getDistance=function(a){let t=0;for(let e=0;e<a;e++){let n=6*e,r=new he(this.positions[n],this.positions[n+1],this.positions[n+2]),i=new he(this.positions[n+6],this.positions[n+7],this.positions[n+8]),o=r.distanceTo(i);t+=o}return t};mt.prototype.process=function(){var a=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(a-1);var n;this.compareV3(0,a-1)?n=this.copyV3(a-2):n=this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var r=0;r<a;r++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(r/(a-1)):t=1,this.width.push(t),this.width.push(t),r===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(r===a-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let o=this.getDistance(r)/e;this.uvs.push(o,0),this.uvs.push(o,1)}if(r<a-1){n=this.copyV3(r),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var i=r*2;this.indices_array.push(i,i+1,i+2),this.indices_array.push(i+2,i+1,i+3)}r>0&&(n=this.copyV3(r),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(a-1,0)?n=this.copyV3(1):n=this.copyV3(a-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new Qt(new Float32Array(this.positions),3),previous:new Qt(new Float32Array(this.previous),3),next:new Qt(new Float32Array(this.next),3),side:new Qt(new Float32Array(this.side),1),width:new Qt(new Float32Array(this.width),1),uv:new Qt(new Float32Array(this.uvs),2),index:new Qt(new Uint16Array(this.indices_array),1),counters:new Qt(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function ui(a,t,e,n,r){var i;if(a=a.subarray||a.slice?a:a.buffer,e=e.subarray||e.slice?e:e.buffer,a=t?a.subarray?a.subarray(t,r&&t+r):a.slice(t,r&&t+r):a,e.set)e.set(a,n);else for(i=0;i<a.length;i++)e[i+n]=a[i];return e}mt.prototype.advance=function(a){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,r=t.length;ui(t,0,e,0,r),ui(t,6,t,0,r-6),t[r-6]=a.x,t[r-5]=a.y,t[r-4]=a.z,t[r-3]=a.x,t[r-2]=a.y,t[r-1]=a.z,ui(t,6,n,0,r-6),n[r-6]=a.x,n[r-5]=a.y,n[r-4]=a.z,n[r-3]=a.x,n[r-2]=a.y,n[r-1]=a.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};gt.meshline_vert=["",gt.logdepthbuf_pars_vertex,gt.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",gt.logdepthbuf_vertex,gt.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",gt.fog_vertex,"}"].join(`
11812
11812
  `);gt.meshline_frag=["",gt.fog_pars_fragment,gt.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","uniform float thresholdRatio;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {",""," if (vUV.x <= thresholdRatio) {"," discard;"," }",gt.logdepthbuf_fragment,""," vec4 c = vColor;"," if( useMap == 1. ) c *= texture2D( map, vUV * repeat );"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","",gt.fog_fragment,"}"].join(`
11813
- `);var Ye=class extends us{constructor(t){super({uniforms:Object.assign({},xc.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new Ec(16777215)},opacity:{value:1},resolution:{value:new ss(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new ss(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:gt.meshline_vert,fragmentShader:gt.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};Ye.prototype.copy=function(a){return us.prototype.copy.call(this,a),this.lineWidth=a.lineWidth,this.map=a.map,this.useMap=a.useMap,this.alphaMap=a.alphaMap,this.useAlphaMap=a.useAlphaMap,this.color.copy(a.color),this.opacity=a.opacity,this.resolution.copy(a.resolution),this.sizeAttenuation=a.sizeAttenuation,this.dashArray.copy(a.dashArray),this.dashOffset.copy(a.dashOffset),this.dashRatio.copy(a.dashRatio),this.useDash=a.useDash,this.visibility=a.visibility,this.alphaTest=a.alphaTest,this.repeat.copy(a.repeat),this};var ls={texture_url:En,lineWidth:10,color:16777215},cr=class extends Mc{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:r}}}}}=this,i=t.map(s=>{let[u,l]=s;return T(new Ac(u,l,0),e,n,r)}).map(s=>{let{x:u,y:l}=s;return[u,l]});return ct(i)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new li(t,1)}loadTexture(t){return new Promise((e,n)=>{new wc().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return g(this,null,function*(){let e=this.geometry=new mt;if(this.updatePoints(t),!this.texture){let i=this.texture=yield this.loadTexture(this.config.texture_url);i.wrapS=i.wrapT=Rc}let n=this.material=new Ye({useMap:!0,color:new Tc(this.config.color),transparent:!0,resolution:new li(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:Cc,repeat:new li(this.getRepeat(),1)}),r=this.mesh=new bc(e,n);return r.renderOrder=99999,this.add(r),r})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=ls,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:r}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,r)}},this.config=Object.assign({},ls,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as ci,Easing as Gc}from"@tweenjs/tween.js";import{Vector2 as kc,Vector3 as Tt}from"three";import"core-js/modules/es.array.unshift.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.push.js";import{Vector2 as Pc}from"three";import{Tween as Ic}from"@tweenjs/tween.js";import{throttle as Lc}from"lodash";import{booleanPointInPolygon as Nc,point as Oc,polygon as Dc}from"@turf/turf";var Uc={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1,destinationDistanceThreshold:10},hr=class extends ${get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){var t;return((t=this.curRoutePath)==null?void 0:t.points)||[]}registryEvent(){this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.addEventListener("add-path",this.onAddPaths)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.removeEventListener("add-path",this.onAddPaths)}setRoadData(t){this.roadData=t}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null),t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,e){let{curRoutePathPoints:n,position:r,curRoutePath:i,paths:o,routeIndex:s}=this;if(!n.length)return null;let u=n,l=this.paths[this.routeIndex].floor,c=this.getCurRouteRemainDistance();if(r){let v=zt(n,r);u=u.slice(v+1),u.unshift(r)}let h=[{floor:i==null?void 0:i.floor,points:u},...o.slice(s+1)],{distance:p,closestPoint:f,index:d,i:m}=h.reduce((v,y,S)=>{if(y.floor!==t)return v;let{distance:b,closestPoint:P,index:R}=y.points.reduce((V,M,H,A)=>{if(!A[H+1])return x({},V,{distance:V.distance===1/0?D(M,e):V.distance});let{distance:I,closestPoint:w}=Wi(e,M,A[H+1]);if(!this.navigation.options.canBack&&l===t){let F=[e,...A.slice(H+1)],q=ct(F);if(c-q>10)return V}return I<V.distance?{distance:I,closestPoint:w,index:H}:V},{distance:1/0,closestPoint:y.points[0],index:0});return b<v.distance?{distance:b,closestPoint:P,index:S,i:R}:v},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:p,closestPoint:f,routeIndex:d+s,pointIndex:d===0?m+this.pointIndex:m}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:r,closestPoint:i,routeIndex:o,pointIndex:s}=n;r>this.options.offsetDistance?(this.offset=!0,this.resetTimer||(this.resetTimer=this.timer.setTimeout(()=>{this.reset=!0,this.resetTimer=null},this.options.offsetToResetTime))):(this.offset=!1,this.reset=!1,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null)),this.routeIndex=o,this.pointIndex=s,this.position=i,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}pause(){var t;this.tweenUtil.clear(),(t=this.throttleUpdatePosition)==null||t.cancel(),this.paused=!0}continue(){this.paused=!1,this.startCurRouteSimulation()}startCurRouteSimulation(){return g(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let r=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],i=this.getCurRouteRemainDistance(),o=i/this.options.simulationSpeed,s=this.throttleUpdatePosition=Lc(l=>{let c=me(r,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new Ic({distance:0},this.tweenUtil.group).to({distance:i},o*1e3).onUpdate(s).onComplete(()=>{this.tweenUtil.remove(u),s.flush(),s.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{n(this.startCurRouteSimulation())},3e3)):(n(!0),console.log(e,this.routeIndex,this.paths))}).start()})})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.paused||this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[n,...t.slice(e+1)];return ct(r)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[...t.slice(0,e+1),n];return ct(r)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((r,i)=>r+i.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:r,curRoutePath:i}=this,o=e,s=kt.FRONT,u=(i==null||(t=i.pointInfos[o])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;s===kt.FRONT&&o<=n.length;){let m=n[o],v=n[o+1],y=n[o+2];if(!m||!v)s=kt.END;else if(l+=D(m,v),!y)s=kt.END;else{s=Br(m,v,y),c=un(m,v,y),h=(new Pc(y[0]-v[0],y[1]-v[1]).angle()*180/Math.PI-90+360)%360;var p;u=(p=i==null?void 0:i.pointInfos[o+1].crossName)!=null?p:"",o+=1}}n[o]&&(l=D(r,n[o]));let f=zr(c);if(s===kt.END&&l<=this.options.directionEmitThreshold)return{dir:s,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f};let d=this.getCurRouteToStartDistance();return e===0&&d<=5?{dir:kt.START,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f}:(l>=this.options.directionEmitThreshold&&(s=kt.FRONT),{dir:s,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let r=Dc(n.cds),i=Oc(this.position);return Nc(i,r)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:r,distance:i,crossName:o,angle:s,nextAngle:u,nextDir:l}=n;e<=this.options.destinationDistanceThreshold&&(r=kt.END);let{imageUrl:c}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:i,dir:r,angle:s,nextAngle:u,pos:this.position,routeIndex:this.routeIndex,crossName:o,offset:this.offset,reset:this.reset,imageUrl:c,nextDir:l}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,n){super(),this.navigation=t,this.offset=!1,this.reset=!1,this.position=[0,0],this.routeIndex=0,this.pointIndex=0,this.paths=[],this.timer=new W,this.resetTimer=null,this.tweenUtil=new Jt,this.paused=!1,this.onAddPaths=r=>{let{paths:i}=r;this.paths=i,this.resetStatus(i),this.simulationTween&&!this.paused&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},Uc,e),this.roadData=n,this.registryEvent()}};import"core-js/modules/es.typed-array.uint8-array.js";import"core-js/modules/es.typed-array.at.js";import"core-js/modules/es.typed-array.fill.js";import"core-js/modules/es.typed-array.find-last.js";import"core-js/modules/es.typed-array.find-last-index.js";import"core-js/modules/es.typed-array.set.js";import"core-js/modules/es.typed-array.sort.js";import"core-js/modules/es.typed-array.to-reversed.js";import"core-js/modules/es.typed-array.to-sorted.js";import"core-js/modules/es.typed-array.with.js";import"core-js/modules/es.array-buffer.constructor.js";import"core-js/modules/es.array-buffer.slice.js";import"core-js/modules/es.array-buffer.detached.js";import"core-js/modules/es.array-buffer.transfer.js";import"core-js/modules/es.array-buffer.transfer-to-fixed-length.js";import"core-js/modules/es.typed-array.from.js";import"core-js/modules/web.dom-collections.iterator.js";import{DataTexture as Fc,LinearFilter as cs,RGBAFormat as hs,Sprite as Bc,SpriteMaterial as zc}from"three";var Xt=class a extends K{addDebug(){a.canvas.style.cssText=`
11813
+ `);var Ye=class extends us{constructor(t){super({uniforms:Object.assign({},xc.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new Ec(16777215)},opacity:{value:1},resolution:{value:new ss(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new ss(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:gt.meshline_vert,fragmentShader:gt.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};Ye.prototype.copy=function(a){return us.prototype.copy.call(this,a),this.lineWidth=a.lineWidth,this.map=a.map,this.useMap=a.useMap,this.alphaMap=a.alphaMap,this.useAlphaMap=a.useAlphaMap,this.color.copy(a.color),this.opacity=a.opacity,this.resolution.copy(a.resolution),this.sizeAttenuation=a.sizeAttenuation,this.dashArray.copy(a.dashArray),this.dashOffset.copy(a.dashOffset),this.dashRatio.copy(a.dashRatio),this.useDash=a.useDash,this.visibility=a.visibility,this.alphaTest=a.alphaTest,this.repeat.copy(a.repeat),this};var ls={texture_url:En,lineWidth:10,color:16777215},cr=class extends Mc{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:r}}}}}=this,i=t.map(s=>{let[u,l]=s;return T(new Ac(u,l,0),e,n,r)}).map(s=>{let{x:u,y:l}=s;return[u,l]});return ct(i)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new li(t,1)}loadTexture(t){return new Promise((e,n)=>{new wc().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return g(this,null,function*(){let e=this.geometry=new mt;if(this.updatePoints(t),!this.texture){let i=this.texture=yield this.loadTexture(this.config.texture_url);i.wrapS=i.wrapT=Rc}let n=this.material=new Ye({useMap:!0,color:new Tc(this.config.color),transparent:!0,resolution:new li(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:Cc,repeat:new li(this.getRepeat(),1)}),r=this.mesh=new bc(e,n);return r.renderOrder=99999,this.add(r),r})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=ls,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:r}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,r)}},this.config=Object.assign({},ls,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as ci,Easing as Gc}from"@tweenjs/tween.js";import{Vector2 as kc,Vector3 as Tt}from"three";import"core-js/modules/es.array.unshift.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.push.js";import{Vector2 as Pc}from"three";import{Tween as Ic}from"@tweenjs/tween.js";import{throttle as Lc}from"lodash";import{booleanPointInPolygon as Nc,point as Oc,polygon as Dc}from"@turf/turf";var Uc={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1,destinationDistanceThreshold:10},hr=class extends ${get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){var t;return((t=this.curRoutePath)==null?void 0:t.points)||[]}registryEvent(){this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.addEventListener("add-path",this.onAddPaths)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.removeEventListener("add-path",this.onAddPaths)}setRoadData(t){this.roadData=t}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,this.offsetDistance=0,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null),t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,e){let{curRoutePathPoints:n,position:r,curRoutePath:i,paths:o,routeIndex:s}=this;if(!n.length)return null;let u=n,l=this.paths[this.routeIndex].floor,c=this.getCurRouteRemainDistance();if(r){let v=zt(n,r);u=u.slice(v+1),u.unshift(r)}let h=[{floor:i==null?void 0:i.floor,points:u},...o.slice(s+1)],{distance:p,closestPoint:f,index:d,i:m}=h.reduce((v,y,S)=>{if(y.floor!==t)return v;let{distance:b,closestPoint:P,index:R}=y.points.reduce((V,M,H,A)=>{if(!A[H+1])return x({},V,{distance:V.distance===1/0?D(M,e):V.distance});let{distance:I,closestPoint:w}=Wi(e,M,A[H+1]);if(!this.navigation.options.canBack&&l===t){let F=[e,...A.slice(H+1)],q=ct(F);if(c-q>10)return V}return I<V.distance?{distance:I,closestPoint:w,index:H}:V},{distance:1/0,closestPoint:y.points[0],index:0});return b<v.distance?{distance:b,closestPoint:P,index:S,i:R}:v},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:p,closestPoint:f,routeIndex:d+s,pointIndex:d===0?m+this.pointIndex:m}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:r,closestPoint:i,routeIndex:o,pointIndex:s}=n;this.offsetDistance=r,r>this.options.offsetDistance?(this.offset=!0,this.resetTimer||(this.resetTimer=this.timer.setTimeout(()=>{this.reset=!0,this.resetTimer=null},this.options.offsetToResetTime))):(this.offset=!1,this.reset=!1,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null)),this.routeIndex=o,this.pointIndex=s,this.position=i,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}pause(){var t;this.tweenUtil.clear(),(t=this.throttleUpdatePosition)==null||t.cancel(),this.paused=!0}continue(){this.paused=!1,this.startCurRouteSimulation()}startCurRouteSimulation(){return g(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let r=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],i=this.getCurRouteRemainDistance(),o=i/this.options.simulationSpeed,s=this.throttleUpdatePosition=Lc(l=>{let c=me(r,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new Ic({distance:0},this.tweenUtil.group).to({distance:i},o*1e3).onUpdate(s).onComplete(()=>{this.tweenUtil.remove(u),s.flush(),s.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{n(this.startCurRouteSimulation())},3e3)):(n(!0),console.log(e,this.routeIndex,this.paths))}).start()})})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.paused||this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[n,...t.slice(e+1)];return ct(r)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[...t.slice(0,e+1),n];return ct(r)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((r,i)=>r+i.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:r,curRoutePath:i}=this,o=e,s=kt.FRONT,u=(i==null||(t=i.pointInfos[o])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;s===kt.FRONT&&o<=n.length;){let m=n[o],v=n[o+1],y=n[o+2];if(!m||!v)s=kt.END;else if(l+=D(m,v),!y)s=kt.END;else{s=Br(m,v,y),c=un(m,v,y),h=(new Pc(y[0]-v[0],y[1]-v[1]).angle()*180/Math.PI-90+360)%360;var p;u=(p=i==null?void 0:i.pointInfos[o+1].crossName)!=null?p:"",o+=1}}n[o]&&(l=D(r,n[o]));let f=zr(c);if(s===kt.END&&l<=this.options.directionEmitThreshold)return{dir:s,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f};let d=this.getCurRouteToStartDistance();return e===0&&d<=5?{dir:kt.START,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f}:(l>=this.options.directionEmitThreshold&&(s=kt.FRONT),{dir:s,distance:l,crossName:u,angle:c,nextAngle:h,nextDir:f})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let r=Dc(n.cds),i=Oc(this.position);return Nc(i,r)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:r,distance:i,crossName:o,angle:s,nextAngle:u,nextDir:l}=n;e<=this.options.destinationDistanceThreshold&&(r=kt.END);let{imageUrl:c}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:i,dir:r,angle:s,nextAngle:u,pos:this.position,routeIndex:this.routeIndex,crossName:o,offset:this.offset,reset:this.reset,imageUrl:c,nextDir:l,offsetDistance:this.offsetDistance}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,n){super(),this.navigation=t,this.offset=!1,this.reset=!1,this.position=[0,0],this.routeIndex=0,this.pointIndex=0,this.paths=[],this.timer=new W,this.resetTimer=null,this.tweenUtil=new Jt,this.paused=!1,this.offsetDistance=0,this.onAddPaths=r=>{let{paths:i}=r;this.paths=i,this.resetStatus(i),this.simulationTween&&!this.paused&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},Uc,e),this.roadData=n,this.registryEvent()}};import"core-js/modules/es.typed-array.uint8-array.js";import"core-js/modules/es.typed-array.at.js";import"core-js/modules/es.typed-array.fill.js";import"core-js/modules/es.typed-array.find-last.js";import"core-js/modules/es.typed-array.find-last-index.js";import"core-js/modules/es.typed-array.set.js";import"core-js/modules/es.typed-array.sort.js";import"core-js/modules/es.typed-array.to-reversed.js";import"core-js/modules/es.typed-array.to-sorted.js";import"core-js/modules/es.typed-array.with.js";import"core-js/modules/es.array-buffer.constructor.js";import"core-js/modules/es.array-buffer.slice.js";import"core-js/modules/es.array-buffer.detached.js";import"core-js/modules/es.array-buffer.transfer.js";import"core-js/modules/es.array-buffer.transfer-to-fixed-length.js";import"core-js/modules/es.typed-array.from.js";import"core-js/modules/web.dom-collections.iterator.js";import{DataTexture as Fc,LinearFilter as cs,RGBAFormat as hs,Sprite as Bc,SpriteMaterial as zc}from"three";var Xt=class a extends K{addDebug(){a.canvas.style.cssText=`
11814
11814
  position: fixed;
11815
11815
  top: 0;
11816
11816
  left: 0;
@@ -16009,7 +16009,7 @@ void main() {
16009
16009
  \`)};function og(n,t,e){this.x=n,this.y=t,this.weight=e}og.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};og.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};og.prototype.isWall=function(){return this.weight===0};function F2(n){this.content=[],this.scoreFunction=n}F2.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,i=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(i))this.content[e]=t,this.content[n]=i,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],i=this.scoreFunction(e);;){var s=n+1<<1,u=s-1,c=null,f;if(u<t){var p=this.content[u];f=this.scoreFunction(p),f<i&&(c=u)}if(s<t){var d=this.content[s],g=this.scoreFunction(d);g<(c===null?i:f)&&(c=s)}if(c!==null)this.content[n]=this.content[c],this.content[c]=e,n=c;else break}}};function Fx(){this._=null}function jl(n){n.U=n.C=n.L=n.R=n.P=n.N=null}Fx.prototype={constructor:Fx,insert:function(n,t){var e,i,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=U2(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)i=e.U,e===i.L?(s=i.R,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.R&&(Ff(this,e),n=e,e=n.U),e.C=!1,i.C=!0,Uf(this,i))):(s=i.L,s&&s.C?(e.C=s.C=!1,i.C=!0,n=i):(n===e.L&&(Uf(this,e),n=e,e=n.U),e.C=!1,i.C=!0,Ff(this,i))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,i=n.L,s=n.R,u,c;if(i?s?u=U2(s):u=i:u=s,t?t.L===n?t.L=u:t.R=u:this._=u,i&&s?(c=u.C,u.C=n.C,u.L=i,i.U=u,u!==s?(t=u.U,u.U=n.U,n=u.R,t.L=n,u.R=s,s.U=u):(u.U=t,t=u,n=u.R)):(c=n.C,n=u),n&&(n.U=t),!c){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Ff(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,Uf(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Ff(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,Uf(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Ff(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,Uf(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function Ff(n,t){var e=t,i=t.R,s=e.U;s?s.L===e?s.L=i:s.R=i:n._=i,i.U=s,e.U=i,e.R=i.L,e.R&&(e.R.U=e),i.L=e}function Uf(n,t){var e=t,i=t.L,s=e.U;s?s.L===e?s.L=i:s.R=i:n._=i,i.U=s,e.U=i,e.L=i.R,e.L&&(e.L.U=e),i.R=e}function U2(n){for(;n.L;)n=n.L;return n}var Ux=Fx;function Kl(n,t,e,i){var s=[null,null],u=kr.push(s)-1;return s.left=n,s.right=t,e&&Bf(s,n,t,e),i&&Bf(s,t,n,i),Ti[n.index].halfedges.push(u),Ti[t.index].halfedges.push(u),s}function Ql(n,t,e){var i=[t,e];return i.left=n,i}function Bf(n,t,e,i){!n[0]&&!n[1]?(n[0]=i,n.left=t,n.right=e):n.left===e?n[1]=i:n[0]=i}function PK(n,t,e,i,s){var u=n[0],c=n[1],f=u[0],p=u[1],d=c[0],g=c[1],y=0,v=1,E=d-f,M=g-p,A;if(A=t-f,!(!E&&A>0)){if(A/=E,E<0){if(A<y)return;A<v&&(v=A)}else if(E>0){if(A>v)return;A>y&&(y=A)}if(A=i-f,!(!E&&A<0)){if(A/=E,E<0){if(A>v)return;A>y&&(y=A)}else if(E>0){if(A<y)return;A<v&&(v=A)}if(A=e-p,!(!M&&A>0)){if(A/=M,M<0){if(A<y)return;A<v&&(v=A)}else if(M>0){if(A>v)return;A>y&&(y=A)}if(A=s-p,!(!M&&A<0)){if(A/=M,M<0){if(A>v)return;A>y&&(y=A)}else if(M>0){if(A<y)return;A<v&&(v=A)}return!(y>0)&&!(v<1)||(y>0&&(n[0]=[f+y*E,p+y*M]),v<1&&(n[1]=[f+v*E,p+v*M])),!0}}}}}function RK(n,t,e,i,s){var u=n[1];if(u)return!0;var c=n[0],f=n.left,p=n.right,d=f[0],g=f[1],y=p[0],v=p[1],E=(d+y)/2,M=(g+v)/2,A,_;if(v===g){if(E<t||E>=i)return;if(d>y){if(!c)c=[E,e];else if(c[1]>=s)return;u=[E,s]}else{if(!c)c=[E,s];else if(c[1]<e)return;u=[E,e]}}else if(A=(d-y)/(v-g),_=M-A*E,A<-1||A>1)if(d>y){if(!c)c=[(e-_)/A,e];else if(c[1]>=s)return;u=[(s-_)/A,s]}else{if(!c)c=[(s-_)/A,s];else if(c[1]<e)return;u=[(e-_)/A,e]}else if(g<v){if(!c)c=[t,A*t+_];else if(c[0]>=i)return;u=[i,A*i+_]}else{if(!c)c=[i,A*i+_];else if(c[0]<t)return;u=[t,A*t+_]}return n[0]=c,n[1]=u,!0}function B2(n,t,e,i){for(var s=kr.length,u;s--;)(!RK(u=kr[s],n,t,e,i)||!PK(u,n,t,e,i)||!(Math.abs(u[0][0]-u[1][0])>Ln||Math.abs(u[0][1]-u[1][1])>Ln))&&delete kr[s]}function z2(n){return Ti[n.index]={site:n,halfedges:[]}}function LK(n,t){var e=n.site,i=t.left,s=t.right;return e===s&&(s=i,i=e),s?Math.atan2(s[1]-i[1],s[0]-i[0]):(e===i?(i=t[1],s=t[0]):(i=t[0],s=t[1]),Math.atan2(i[0]-s[0],s[1]-i[1]))}function Bx(n,t){return t[+(t.left!==n.site)]}function NK(n,t){return t[+(t.left===n.site)]}function G2(){for(var n=0,t=Ti.length,e,i,s,u;n<t;++n)if((e=Ti[n])&&(u=(i=e.halfedges).length)){var c=new Array(u),f=new Array(u);for(s=0;s<u;++s)c[s]=s,f[s]=LK(e,kr[i[s]]);for(c.sort(function(p,d){return f[d]-f[p]}),s=0;s<u;++s)f[s]=i[c[s]];for(s=0;s<u;++s)i[s]=f[s]}}function k2(n,t,e,i){var s=Ti.length,u,c,f,p,d,g,y,v,E,M,A,_,x=!0;for(u=0;u<s;++u)if(c=Ti[u]){for(f=c.site,d=c.halfedges,p=d.length;p--;)kr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)M=NK(c,kr[d[p]]),A=M[0],_=M[1],y=Bx(c,kr[d[++p%g]]),v=y[0],E=y[1],(Math.abs(A-v)>Ln||Math.abs(_-E)>Ln)&&(d.splice(p,0,kr.push(Ql(f,M,Math.abs(A-n)<Ln&&i-_>Ln?[n,Math.abs(v-n)<Ln?E:i]:Math.abs(_-i)<Ln&&e-A>Ln?[Math.abs(E-i)<Ln?v:e,i]:Math.abs(A-e)<Ln&&_-t>Ln?[e,Math.abs(v-e)<Ln?E:t]:Math.abs(_-t)<Ln&&A-n>Ln?[Math.abs(E-t)<Ln?v:n,t]:null))-1),++g);g&&(x=!1)}if(x){var T,w,R,B=1/0;for(u=0,x=null;u<s;++u)(c=Ti[u])&&(f=c.site,T=f[0]-n,w=f[1]-t,R=T*T+w*w,R<B&&(B=R,x=c));if(x){var U=[n,t],D=[n,i],P=[e,i],ct=[e,t];x.halfedges.push(kr.push(Ql(f=x.site,U,D))-1,kr.push(Ql(f,D,P))-1,kr.push(Ql(f,P,ct))-1,kr.push(Ql(f,ct,U))-1)}}for(u=0;u<s;++u)(c=Ti[u])&&(c.halfedges.length||delete Ti[u])}var q2=[],sg;function OK(){jl(this),this.x=this.y=this.arc=this.site=this.cy=null}function vu(n){var t=n.P,e=n.N;if(!(!t||!e)){var i=t.site,s=n.site,u=e.site;if(i!==u){var c=s[0],f=s[1],p=i[0]-c,d=i[1]-f,g=u[0]-c,y=u[1]-f,v=2*(p*y-d*g);if(!(v>=-V2)){var E=p*p+d*d,M=g*g+y*y,A=(y*E-d*M)/v,_=(p*M-g*E)/v,x=q2.pop()||new OK;x.arc=n,x.site=s,x.x=A+c,x.y=(x.cy=_+f)+Math.sqrt(A*A+_*_),n.circle=x;for(var T=null,w=tc._;w;)if(x.y<w.y||x.y===w.y&&x.x<=w.x)if(w.L)w=w.L;else{T=w.P;break}else if(w.R)w=w.R;else{T=w;break}tc.insert(T,x),T||(sg=x)}}}}function _u(n){var t=n.circle;t&&(t.P||(sg=t.N),tc.remove(t),q2.push(t),jl(t),n.circle=null)}var W2=[];function DK(){jl(this),this.edge=this.site=this.circle=null}function H2(n){var t=W2.pop()||new DK;return t.site=n,t}function zx(n){_u(n),xu.remove(n),W2.push(n),jl(n)}function X2(n){var t=n.circle,e=t.x,i=t.cy,s=[e,i],u=n.P,c=n.N,f=[n];zx(n);for(var p=u;p.circle&&Math.abs(e-p.circle.x)<Ln&&Math.abs(i-p.circle.cy)<Ln;)u=p.P,f.unshift(p),zx(p),p=u;f.unshift(p),_u(p);for(var d=c;d.circle&&Math.abs(e-d.circle.x)<Ln&&Math.abs(i-d.circle.cy)<Ln;)c=d.N,f.push(d),zx(d),d=c;f.push(d),_u(d);var g=f.length,y;for(y=1;y<g;++y)d=f[y],p=f[y-1],Bf(d.edge,p.site,d.site,s);p=f[0],d=f[g-1],d.edge=Kl(p.site,d.site,null,s),vu(p),vu(d)}function Y2(n){for(var t=n[0],e=n[1],i,s,u,c,f=xu._;f;)if(u=$2(f,e)-t,u>Ln)f=f.L;else if(c=t-FK(f,e),c>Ln){if(!f.R){i=f;break}f=f.R}else{u>-Ln?(i=f.P,s=f):c>-Ln?(i=f,s=f.N):i=s=f;break}z2(n);var p=H2(n);if(xu.insert(i,p),!(!i&&!s)){if(i===s){_u(i),s=H2(i.site),xu.insert(p,s),p.edge=s.edge=Kl(i.site,p.site),vu(i),vu(s);return}if(!s){p.edge=Kl(i.site,p.site);return}_u(i),_u(s);var d=i.site,g=d[0],y=d[1],v=n[0]-g,E=n[1]-y,M=s.site,A=M[0]-g,_=M[1]-y,x=2*(v*_-E*A),T=v*v+E*E,w=A*A+_*_,R=[(_*T-E*w)/x+g,(v*w-A*T)/x+y];Bf(s.edge,d,M,R),p.edge=Kl(d,n,null,R),s.edge=Kl(n,M,null,R),vu(i),vu(s)}}function $2(n,t){var e=n.site,i=e[0],s=e[1],u=s-t;if(!u)return i;var c=n.P;if(!c)return-1/0;e=c.site;var f=e[0],p=e[1],d=p-t;if(!d)return f;var g=f-i,y=1/u-1/d,v=g/d;return y?(-v+Math.sqrt(v*v-2*y*(g*g/(-2*d)-p+d/2+s-u/2)))/y+i:(i+f)/2}function FK(n,t){var e=n.N;if(e)return $2(e,t);var i=n.site;return i[1]===t?i[0]:1/0}var Ln=1e-6,V2=1e-12,xu,Ti,tc,kr;function UK(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function BK(n,t){return t[1]-n[1]||t[0]-n[0]}function ag(n,t){var e=n.sort(BK).pop(),i,s,u;for(kr=[],Ti=new Array(n.length),xu=new Ux,tc=new Ux;;)if(u=sg,e&&(!u||e[1]<u.y||e[1]===u.y&&e[0]<u.x))(e[0]!==i||e[1]!==s)&&(Y2(e),i=e[0],s=e[1]),e=n.pop();else if(u)X2(u.arc);else break;if(G2(),t){var c=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];B2(c,f,p,d),k2(c,f,p,d)}this.edges=kr,this.cells=Ti,xu=tc=kr=Ti=null}ag.prototype={constructor:ag,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(i){return Bx(t,n[i])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,i){if(f=(u=e.halfedges).length)for(var s=e.site,u,c=-1,f,p,d=t[u[f-1]],g=d.left===s?d.right:d.left;++c<f;)p=g,d=t[u[c]],g=d.left===s?d.right:d.left,p&&g&&i<p.index&&i<g.index&&UK(s,p,g)<0&&n.push([s.data,p.data,g.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var i=this,s,u=i._found||0,c=i.cells.length,f;!(f=i.cells[u]);)if(++u>=c)return null;var p=n-f.site[0],d=t-f.site[1],g=p*p+d*d;do f=i.cells[s=u],u=null,f.halfedges.forEach(function(y){var v=i.edges[y],E=v.left;if(!((E===f.site||!E)&&!(E=v.right))){var M=n-E[0],A=t-E[1],_=M*M+A*A;_<g&&(g=_,u=E.index)}});while(u!==null);return i._found=s,e==null||g<=e*e?f.site:null}};var XK=Qt(ec(),1);var t1=Qt(K2(),1);function Di(){return new cg}function cg(){this.reset()}cg.prototype={constructor:cg,reset:function(){this.s=this.t=0},add:function(n){Q2(lg,n,this.t),Q2(this,lg.s,this.s),this.s?this.t+=lg.t:this.s=lg.t},valueOf:function(){return this.s}};var lg=new cg;function Q2(n,t,e){var i=n.s=t+e,s=i-t,u=i-s;n.t=t-u+(e-s)}var yn=1e-6;var Tn=Math.PI,br=Tn/2,fg=Tn/4,os=Tn*2,Eu=180/Tn,Fi=Tn/180,nr=Math.abs,Uo=Math.atan,Ui=Math.atan2,hn=Math.cos;var hg=Math.exp;var zf=Math.log;var Me=Math.sin;var jr=Math.sqrt,Gf=Math.tan;function qx(n){return n>1?0:n<-1?Tn:Math.acos(n)}function Ci(n){return n>1?br:n<-1?-br:Math.asin(n)}function Bo(){}var YK=Di(),k0t=Di();function Su(n){var t=n[0],e=n[1],i=hn(e);return[i*hn(t),i*Me(t),Me(e)]}function kf(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function qf(n){var t=jr(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var j0t=Di();function eO(n,t){return[n>Tn?n-os:n<-Tn?n+os:n,t]}eO.invert=eO;function Vx(){var n=[],t;return{point:function(e,i){t.push([e,i])},lineStart:function(){n.push(t=[])},lineEnd:Bo,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Hx(n,t){return nr(n[0]-t[0])<yn&&nr(n[1]-t[1])<yn}function pg(n,t,e,i){this.x=n,this.z=t,this.o=e,this.e=i,this.v=!1,this.n=this.p=null}function Wx(n,t,e,i,s){var u=[],c=[],f,p;if(n.forEach(function(M){if(!((A=M.length-1)<=0)){var A,_=M[0],x=M[A],T;if(Hx(_,x)){for(s.lineStart(),f=0;f<A;++f)s.point((_=M[f])[0],_[1]);s.lineEnd();return}u.push(T=new pg(_,M,null,!0)),c.push(T.o=new pg(_,null,T,!1)),u.push(T=new pg(x,M,null,!1)),c.push(T.o=new pg(x,null,T,!0))}}),!!u.length){for(c.sort(t),nO(u),nO(c),f=0,p=c.length;f<p;++f)c[f].e=e=!e;for(var d=u[0],g,y;;){for(var v=d,E=!0;v.v;)if((v=v.n)===d)return;g=v.z,s.lineStart();do{if(v.v=v.o.v=!0,v.e){if(E)for(f=0,p=g.length;f<p;++f)s.point((y=g[f])[0],y[1]);else i(v.x,v.n.x,1,s);v=v.n}else{if(E)for(g=v.p.z,f=g.length-1;f>=0;--f)s.point((y=g[f])[0],y[1]);else i(v.x,v.p.x,-1,s);v=v.p}v=v.o,g=v.z,E=!E}while(!v.v);s.lineEnd()}}}function nO(n){if(t=n.length){for(var t,e=0,i=n[0],s;++e<t;)i.n=s=n[e],s.p=i,i=s;i.n=s=n[0],s.p=i}}function Aa(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function Xx(n){return n.length===1&&(n=JK(n)),{left:function(t,e,i,s){for(i==null&&(i=0),s==null&&(s=t.length);i<s;){var u=i+s>>>1;n(t[u],e)<0?i=u+1:s=u}return i},right:function(t,e,i,s){for(i==null&&(i=0),s==null&&(s=t.length);i<s;){var u=i+s>>>1;n(t[u],e)>0?s=u:i=u+1}return i}}}function JK(n){return function(t,e){return Aa(n(t),e)}}var rO=Xx(Aa),jK=rO.right,KK=rO.left;var iO=Array.prototype,tQ=iO.slice,eQ=iO.map;var Vyt=Math.sqrt(50),Hyt=Math.sqrt(10),Wyt=Math.sqrt(2);function gg(n){for(var t=n.length,e,i=-1,s=0,u,c;++i<t;)s+=n[i].length;for(u=new Array(s);--t>=0;)for(c=n[t],e=c.length;--e>=0;)u[--s]=c[e];return u}var lQ=1e9,C_t=-lQ;var Yx=Di();function $x(n,t){var e=t[0],i=t[1],s=[Me(e),-hn(e),0],u=0,c=0;Yx.reset();for(var f=0,p=n.length;f<p;++f)if(g=(d=n[f]).length)for(var d,g,y=d[g-1],v=y[0],E=y[1]/2+fg,M=Me(E),A=hn(E),_=0;_<g;++_,v=T,M=R,A=B,y=x){var x=d[_],T=x[0],w=x[1]/2+fg,R=Me(w),B=hn(w),U=T-v,D=U>=0?1:-1,P=D*U,ct=P>Tn,L=M*R;if(Yx.add(Ui(L*D*Me(P),A*B+L*hn(P))),u+=ct?U+D*os:U,ct^v>=e^T>=e){var W=kf(Su(y),Su(x));qf(W);var V=kf(s,W);qf(V);var Mt=(ct^U>=0?-1:1)*Ci(V[2]);(i>Mt||i===Mt&&(W[0]||W[1]))&&(c+=ct^U>=0?1:-1)}}return(u<-yn||u<yn&&Yx<-yn)^c&1}var B_t=Di();var rxt=Di(),ixt=Di();var hQ=1/0;var axt=-hQ;function Zx(n){this._context=n}Zx.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,os);break}}},result:Bo};var yxt=Di();function Jx(){this._string=[]}Jx.prototype={_radius:4.5,_circle:aO(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=aO(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function aO(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function jx(n,t,e,i){return function(s,u){var c=t(u),f=s.invert(i[0],i[1]),p=Vx(),d=t(p),g=!1,y,v,E,M={point:A,lineStart:x,lineEnd:T,polygonStart:function(){M.point=w,M.lineStart=R,M.lineEnd=B,v=[],y=[]},polygonEnd:function(){M.point=A,M.lineStart=x,M.lineEnd=T,v=gg(v);var U=$x(y,f);v.length?(g||(u.polygonStart(),g=!0),Wx(v,gQ,U,e,u)):U&&(g||(u.polygonStart(),g=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),g&&(u.polygonEnd(),g=!1),v=y=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function A(U,D){var P=s(U,D);n(U=P[0],D=P[1])&&u.point(U,D)}function _(U,D){var P=s(U,D);c.point(P[0],P[1])}function x(){M.point=_,c.lineStart()}function T(){M.point=A,c.lineEnd()}function w(U,D){E.push([U,D]);var P=s(U,D);d.point(P[0],P[1])}function R(){d.lineStart(),E=[]}function B(){w(E[0][0],E[0][1]),d.lineEnd();var U=d.clean(),D=p.result(),P,ct=D.length,L,W,V;if(E.pop(),y.push(E),E=null,!!ct){if(U&1){if(W=D[0],(L=W.length-1)>0){for(g||(u.polygonStart(),g=!0),u.lineStart(),P=0;P<L;++P)u.point((V=W[P])[0],V[1]);u.lineEnd()}return}ct>1&&U&2&&D.push(D.pop().concat(D.shift())),v.push(D.filter(dQ))}}return M}}function dQ(n){return n.length>1}function gQ(n,t){return((n=n.x)[0]<0?n[1]-br-yn:br-n[1])-((t=t.x)[0]<0?t[1]-br-yn:br-t[1])}var mQ=jx(function(){return!0},yQ,_Q,[-Tn,-br]);function yQ(n){var t=NaN,e=NaN,i=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(u,c){var f=u>0?Tn:-Tn,p=nr(u-t);nr(p-Tn)<yn?(n.point(t,e=(e+c)/2>0?br:-br),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),n.point(u,e),s=0):i!==f&&p>=Tn&&(nr(t-i)<yn&&(t-=i*yn),nr(u-f)<yn&&(u-=f*yn),e=vQ(t,e,u,c),n.point(i,e),n.lineEnd(),n.lineStart(),n.point(f,e),s=0),n.point(t=u,e=c),i=f},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function vQ(n,t,e,i){var s,u,c=Me(n-e);return nr(c)>yn?Uo((Me(t)*(u=hn(i))*Me(e)-Me(i)*(s=hn(t))*Me(n))/(s*u*c)):(t+i)/2}function _Q(n,t,e,i){var s;if(n==null)s=e*br,i.point(-Tn,s),i.point(0,s),i.point(Tn,s),i.point(Tn,0),i.point(Tn,-s),i.point(0,-s),i.point(-Tn,-s),i.point(-Tn,0),i.point(-Tn,s);else if(nr(n[0]-t[0])>yn){var u=n[0]<t[0]?Tn:-Tn;s=e*u/2,i.point(-u,s),i.point(0,s),i.point(u,s)}else i.point(t[0],t[1])}function mg(n){return function(t){var e=new Kx;for(var i in n)e[i]=n[i];return e.stream=t,e}}function Kx(){}Kx.prototype={constructor:Kx,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var i1t=hn(30*Fi);var v1t=mg({point:function(n,t){this.stream.point(n*Fi,t*Fi)}});function yg(n){return function(t,e){var i=hn(t),s=hn(e),u=n(i*s);return[u*s*Me(t),u*Me(e)]}}function ss(n){return function(t,e){var i=jr(t*t+e*e),s=n(i),u=Me(s),c=hn(s);return[Ui(t*u,i*c),Ci(i&&e*u/i)]}}var dO=yg(function(n){return jr(2/(1+n))});dO.invert=ss(function(n){return 2*Ci(n/2)});var gO=yg(function(n){return(n=qx(n))&&n/Me(n)});gO.invert=ss(function(n){return n});function Qx(n,t){return[n,zf(Gf((br+t)/2))]}Qx.invert=function(n,t){return[n,2*Uo(hg(t))-br]};function vg(n,t){return[n,t]}vg.invert=vg;function mO(n,t){var e=hn(t),i=hn(n)*e;return[e*Me(n)/i,Me(t)/i]}mO.invert=ss(Uo);function yO(n,t){var e=t*t,i=e*e;return[n*(.8707-.131979*e+i*(-.013791+i*(.003971*e-.001529*i))),t*(1.007226+e*(.015085+i*(-.044475+.028874*e-.005916*i)))]}yO.invert=function(n,t){var e=t,i=25,s;do{var u=e*e,c=u*u;e-=s=(e*(1.007226+u*(.015085+c*(-.044475+.028874*u-.005916*c)))-t)/(1.007226+u*(.015085*3+c*(-.044475*7+.028874*9*u-.005916*11*c)))}while(nr(s)>yn&&--i>0);return[n/(.8707+(u=e*e)*(-.131979+u*(-.013791+u*u*u*(.003971-.001529*u)))),e]};function vO(n,t){return[hn(t)*Me(n),Me(t)]}vO.invert=ss(Ci);function _O(n,t){var e=hn(t),i=1+hn(n)*e;return[e*Me(n)/i,Me(t)/i]}_O.invert=ss(function(n){return 2*Uo(n)});function xO(n,t){return[zf(Gf((br+t)/2)),-n]}xO.invert=function(n,t){return[-t,2*Uo(hg(n))-br]};var bQ=Qt(ec(),1);var AQ=Qt(ec(),1);var CQ=Qt(ec(),1);var IQ=Qt(ec(),1);function SO(n,t){let e=0,i=1/0,[s,u]=t;for(let c=0;c<n.length-1;c++){let[f,p]=n[c],[d,g]=n[c+1],y=Math.min(f,d)<=s&&s<=Math.max(f,d),v=Math.min(p,g)<=u&&u<=Math.max(p,g);if(y&&v){let E=Math.abs((d-f)*(u-p)-(g-p)*(s-f));E<i&&(i=E,e=c)}}return e}function wO(n,t){let e=n[0],i=n[1],s=!1;for(let u=0,c=t.length-1;u<t.length;c=u++){let f=t[u][0],p=t[u][1],d=t[c][0],g=t[c][1];p>i!=g>i&&e<(d-f)*(i-p)/(g-p)+f&&(s=!s)}return s}var NAt=Qt(ZO(),1),OAt=Qt(o_(),1);function aD(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function uD(n){let t={};for(let i in n)i.startsWith("on")&&(t[aD(i.slice(2))]=n[i]);let e=i=>Ri(this,null,function*(){let{data:s}=i;if(t[s.type])try{let u=yield t[s.type](s.data);if(u!=null&&u.$transfer&&Array.isArray(u.$transfer)){let c=u.$transfer;delete u.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:u},c)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:u})}catch(u){self.postMessage({type:""+s.type+"_result",key:s.key,error:u})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var qAt=Qt(bD(),1),VAt=Qt(Bc(),1);function AD(n,t,e){e===void 0&&(e=0),n.forEach(i=>{if(i.geometry.coords=JSON.parse(JSON.stringify(i.geometry.cds)),i.geometry.type==="polygon"){var s;i.geometry.coords.map(u=>{Array.isArray(u)&&u.forEach(c=>{c[0]-=t[0],c[1]-=t[1]})}),i.geometry.otherCds&&(i.geometry.otherCoords=i.geometry.otherCds.map(u=>u.map(c=>ic(c,t)))),(s=i.doors)!=null&&s.length&&i.doors.map(u=>{u.coord=ic(u.coordinate,t)}),i.center&&(i.centerCoords=ic(i.center,t))}else i.geometry.coords=ic(i.geometry.cds,t),i.center&&(i.centerCoords=ic(i.center,t));if(i.center_x&&i.center_y){let[u,c]=ic([i.center_x,i.center_y],t);i.center_coord_x=u,i.center_coord_y=c}});for(let i=0;i<n.length;i++){let s=n[i];s.deltaHeight=1e-5*(e+i+1)}}function ic(n,t){return[n[0]-t[0],n[1]-t[1]]}var jAt=Qt(p0(),1),KAt=Qt(d0(),1),QAt=Qt(g0(),1),tTt=Qt(y0(),1),eTt=Qt(v0(),1),nTt=Qt(S0(),1),rTt=Qt(I0(),1),iTt=Qt(R0(),1),oTt=Qt(L0(),1),sTt=Qt(O0(),1),aTt=Qt(F0(),1),uTt=Qt(G0(),1),lTt=Qt(V0(),1),cTt=Qt(iy(),1),fTt=Qt(oy(),1),hTt=Qt(Sh(),1);function Eg(n,t=!1){let e=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),s=new Set(Object.keys(n[0].morphAttributes)),u={},c={},f=n[0].morphTargetsRelative,p=new ui,d=0;for(let g=0;g<n.length;++g){let y=n[g],v=0;if(e!==(y.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let E in y.attributes){if(!i.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+'. All geometries must have compatible attributes; make sure "'+E+'" attribute exists among all geometries, or in none of them.'),null;u[E]===void 0&&(u[E]=[]),u[E].push(y.attributes[E]),v++}if(v!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". Make sure all geometries have the same number of attributes."),null;if(f!==y.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let E in y.morphAttributes){if(!s.has(E))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". .morphAttributes must be consistent throughout all geometries."),null;c[E]===void 0&&(c[E]=[]),c[E].push(y.morphAttributes[E])}if(t){let E;if(e)E=y.index.count;else if(y.attributes.position!==void 0)E=y.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+g+". The geometry must have either an index or a position attribute"),null;p.addGroup(d,E,g),d+=E}}if(e){let g=0,y=[];for(let v=0;v<n.length;++v){let E=n[v].index;for(let M=0;M<E.count;++M)y.push(E.getX(M)+g);g+=n[v].attributes.position.count}p.setIndex(y)}for(let g in u){let y=TD(u[g]);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" attribute."),null;p.setAttribute(g,y)}for(let g in c){let y=c[g][0].length;if(y===0)break;p.morphAttributes=p.morphAttributes||{},p.morphAttributes[g]=[];for(let v=0;v<y;++v){let E=[];for(let A=0;A<c[g].length;++A)E.push(c[g][A][v]);let M=TD(E);if(!M)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+g+" morphAttribute."),null;p.morphAttributes[g].push(M)}}return p}function TD(n){let t,e,i,s=-1,u=0;for(let d=0;d<n.length;++d){let g=n[d];if(t===void 0&&(t=g.array.constructor),t!==g.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=g.itemSize),e!==g.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=g.normalized),i!==g.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(s===-1&&(s=g.gpuType),s!==g.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;u+=g.count*e}let c=new t(u),f=new Yn(c,e,i),p=0;for(let d=0;d<n.length;++d){let g=n[d];if(g.isInterleavedBufferAttribute){let y=p/e;for(let v=0,E=g.count;v<E;v++)for(let M=0;M<e;M++){let A=g.getComponent(v,M);f.setComponent(v+y,M,A)}}else c.set(g.array,p);p+=g.count*e}return s!==void 0&&(f.gpuType=s),f}function CD(n,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=n.filter(f=>f.geometry.type==="polygon");if(!i.length)return null;let s=i.map(f=>{var p;let d=f.geometry.coords,g=fd(d[0],d.slice(1)),y=new rd(g,{steps:1,bevelEnabled:!1,depth:f.height,curveSegments:4});(p=f).deltaHeight||(p.deltaHeight=0),y.translate(0,0,f.airHeight+f.deltaHeight);let v=y.attributes.position.count,E=new Float32Array(v).fill(f.height+f.airHeight+f.deltaHeight);if(y.setAttribute("maxZ",new Yn(E,1)),y.setAttribute("opacity",new Yn(new Float32Array(v).fill(f.fillOpacity),1)),e){let _=new Float32Array(v).fill(f.airHeight+f.deltaHeight);y.setAttribute("minZ",new Yn(_,1))}let M=new Te(f.fillColor).convertLinearToSRGB(),A=new Float32Array(v*3);for(let _=0;_<v;_++)A[_*3]=M.r,A[_*3+1]=M.g,A[_*3+2]=M.b;return y.setAttribute("color",new Yn(A,3)),y}),u=Eg(s);s.forEach(f=>f.dispose());let c={geometry:u};return u.dispose(),t&&(c.lineGeometry=c1(i)||void 0),c}function c1(n){let{points:t,colors:e,opacities:i}=Ktt(n);if(!t.length)return null;let s=new ui().setFromPoints(t);return s.setAttribute("color",new Yn(new Float32Array(e),3)),s.setAttribute("opacity",new Yn(new Float32Array(i),1)),s}function Ktt(n){let t=[],e=[],i=[];return n.filter(s=>s.strokeOpacity>0).map(s=>{let u=s.height+(s.deltaHeight||0)+s.airHeight,{coords:c}=s.geometry,{strokeColor:f,strokeOpacity:p}=s,d=new Te(f).convertLinearToSRGB();for(let g=0;g<c.length;g++){let y=c[g];for(let v=0;v<y.length;v++){let E=y[v],M=v+1===y.length?y[0]:y[v+1];t.push(new st(E[0],E[1],u)),t.push(new st(M[0],M[1],u)),e.push(d.r,d.g,d.b),e.push(d.r,d.g,d.b),i.push(p),i.push(p)}}}),{points:t,colors:e,opacities:i}}var Hf=function(n){return n.HALF="half",n.POWER="power",n.MECHANICAL="mechanical",n.NORMAL="normal",n.VIP="vip",n}({});var ID=new Ko,Sg=new st,wg=class extends sd{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let t=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],e=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new _r(t,3)),this.setAttribute("uv",new _r(e,2))}applyMatrix4(t){let e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return e!==void 0&&(e.applyMatrix4(t),i.applyMatrix4(t),e.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));let i=new gf(e,6,1);return this.setAttribute("instanceStart",new ts(i,3,0)),this.setAttribute("instanceEnd",new ts(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));let i=new gf(e,6,1);return this.setAttribute("instanceColorStart",new ts(i,3,0)),this.setAttribute("instanceColorEnd",new ts(i,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new od(t.geometry)),this}fromLineSegments(t){let e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ko);let t=this.attributes.instanceStart,e=this.attributes.instanceEnd;t!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(t),ID.setFromBufferAttribute(e),this.boundingBox.union(ID))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new uu),this.boundingBox===null&&this.computeBoundingBox();let t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(t!==void 0&&e!==void 0){let i=this.boundingSphere.center;this.boundingBox.getCenter(i);let s=0;for(let u=0,c=t.count;u<c;u++)Sg.fromBufferAttribute(t,u),s=Math.max(s,i.distanceToSquared(Sg)),Sg.fromBufferAttribute(e,u),s=Math.max(s,i.distanceToSquared(Sg));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}};var xTt=Qt(sD(),1);var Mg=function(n){return n.LAYERED_RENDER_VERSION="layeredRender",n.MERGED_RENDER_VERSION="mergedRender",n}({});var f1=["range","ground","store","facility","parkingSpace"];function PD(n){return f1.indexOf(n.l_type)===-1?f1.length:f1.indexOf(n.l_type)}function Qtt(n){n.layers.sort((t,e)=>PD(t)-PD(e))}function tet(n){let t=n.layers.find(i=>i.l_type==="range"),e=[t.elements[0].center_x,t.elements[0].center_y];n.layers.map(i=>{if(i.l_type!=="range")return AD(i.elements,e)})}function RD(n){Qtt(n),tet(n)}function bg(n,t){return t===void 0&&(t=4),n.floor_id+"_"+n.version_id+(t?"_"+t:"")}var oc=[],sc=[];function eet(n,t){return Ri(this,null,function*(){return yield rp(),fy(n,""+t)})}function LD(n,t,e){return Ri(this,null,function*(){let{db:i}=yield rp();return cC(n,""+t,e,i)})}function net(n){return Ri(this,null,function*(){let t=yield fetch(n.map_url).then(e=>e.json());return t.floor=n.floor,RD(t),oc.push(t),t})}function ret(n,t){return Ri(this,null,function*(){let e=bg(n,t===Mg.LAYERED_RENDER_VERSION?1:void 0);try{let i=yield eet(np.MAP_DATA,e);return i&&(t===Mg.LAYERED_RENDER_VERSION||i.transformed)?(console.log("\\u4ECE\\u7F13\\u5B58\\u4E2D\\u53D6\\u5230\\u4E86\\u6570\\u636E"),i):(console.log("\\u7F13\\u5B58\\u4E2D\\u6CA1\\u6709\\u6570\\u636E",e,i),sc.push(n),null)}catch(i){return console.log("[get floor data error]",i),sc.push(n),null}})}function iet(n,t){return t===void 0&&(t=!0),t&&(n.layers.forEach(e=>{switch(e.l_type){case"ground":if(e.elements.length<2)break;e.mergedElements=Wf(e.elements);break;case"store":h1(e.elements),e.mergedElements=Wf(e.elements);break;case"facility":h1(e.elements),e.mergedElements=Wf(e.elements);break;case"parkingSpace":console.time("parkingSpace merge"),e.mergedElements=oet(e.elements),console.timeEnd("parkingSpace merge"),e.mergedParkingTexture=uet(e.elements);break;case"graph":h1(e.elements),e.mergedElements=Wf(e.elements);break;case"wall":e.mergedElements=Wf(e.elements,!1,!0);break;case"lane":e.mergedElements=set(e.elements);break;case"texture2d":case"texture3d":e.mergedMatrixes=ND(e.elements);break;case"glb":case"text":}}),n.transformed=!0),n}function Wf(n,t,e){t===void 0&&(t=!0),e===void 0&&(e=!1);let i=CD(n,t,e);if(i){var s;return[xc({},n[0],{mergedGeometry:i.geometry.toJSON(),lineGeometry:((s=i.lineGeometry)==null?void 0:s.toJSON())||null})]}else return[]}function oet(n){let t=[],e=[],i=[],s=[];n.forEach((c,f)=>{let p=c.geometry.coords[0],[d,g,y]=p.slice(0,3),v=Math.sqrt((g[0]-d[0])**2+(g[1]-d[1])**2),E=Math.sqrt((y[0]-g[0])**2+(y[1]-g[1])**2),M=[v,E],A=Math.max(...M),_=Math.min(...M),x;A===v?x=[g[0]-d[0],g[1]-d[1]]:x=[y[0]-g[0],y[1]-g[1]];let[T,w]=x,R=Math.atan2(w,T)-Math.PI/2,B=new jn().compose(new st(c.center_coord_x,c.center_coord_y,(c.deltaHeight||0)+c.airHeight+c.height/2),new No().setFromAxisAngle(new st(0,0,1),R),new st(_,A,c.height));i.push(...B.toArray()),s.push(...new Te(c.fillColor).convertLinearToSRGB().toArray()),t[f]=c.fillOpacity||1,e[f]=(c.deltaHeight||0)+c.airHeight+c.height});let u=c1(n);return{size:n.length,opacities:t,maxZ:e,matrixes:i,colors:s,lineGeometry:(u==null?void 0:u.toJSON())||null}}function ND(n){let t=n.reduce((i,s)=>{let{iconUrl:u}=s;return i.has(u)||i.set(u,[]),i.get(u).push(s),i},new Map);return Array.from(t.values()).map(i=>{let s=i.map(c=>new jn().compose(new st(c.centerCoords[0],c.centerCoords[1],c.deltaHeight+c.airHeight+c.height),new No().setFromAxisAngle(new st(0,0,1),c.secondRotate),new st(c.secondWidth,c.secondHeight,1)).toArray());return xc({},i[0],{mergedMatrixes:{size:s.length,array:s.flat()}})})}function set(n){let t=n.map(u=>{let c=fd(u.geometry.coords[0].slice(0,-1),u.geometry.coords.slice(1)),f=new id(c,4),p=f.getAttribute("position"),d=[],g=new Te(u.fillColor);for(let v=0;v<p.count;v++){p.setZ(v,u.airHeight+(u.deltaHeight||0));var y;d.push(g.r,g.g,g.b,(y=u.fillOpacity)!=null?y:1)}return f.setAttribute("color",new Yn(new Float32Array(d),4)),f}),e=Eg(t);t.forEach(u=>u.dispose());let i={mergedGeometry:e.toJSON()};e.dispose();let s=n.filter(u=>{var c,f;return u.double&&((f=u.geometry.otherCoords)==null||(c=f[1])==null?void 0:c.length)});return s.length&&[!0,!1].forEach(u=>{let c=s.filter(g=>g.double===!0&&g.dashed===u);if(!c.length)return;let f=[],p=[];c.forEach(g=>{let y=g.geometry.otherCoords[1],v=g.airHeight+(g.deltaHeight||0)+.01,E=new Te(g.secondColor);for(let M=0;M<y.length-1;M++){let A=y[M],_=y[M+1];f.push(A[0],A[1],v,_[0],_[1],v),p.push(E.r,E.g,E.b,E.r,E.g,E.b)}});let d=new wg;d.setPositions(f),d.setColors(p),i[u?"dashedLineGeometry":"lineGeometry"]={positions:f,colors:p},d.dispose()}),i}var aet=new Set([Hf.HALF,Hf.MECHANICAL,Hf.POWER,Hf.VIP]);function uet(n){let t=n.filter(e=>aet.has(e.parkingType)).map(e=>{let i=new Ft(...e.geometry.coords[0][0]),s=new Ft(...e.geometry.coords[0][1]),u=new Ft(...e.geometry.coords[0][2]),c=Math.min(i.distanceTo(s),s.distanceTo(u)),f=0;return c===i.distanceTo(s)?f=s.sub(i).angle()-Math.PI/2:f=u.sub(s).angle()-Math.PI/2,{uuid:e.id,iconUrl:e.parkingType,name:e.texts[0],deltaHeight:(e.deltaHeight||0)+.001,airHeight:e.airHeight,height:e.height,geometry:e.geometry,opacity:e.fillOpacity,visible:!0,secondWidth:c-1,secondHeight:c-1,secondRotate:f,centerCoords:[e.center_coord_x,e.center_coord_y]}});return ND(t)}function h1(n){n.map(t=>{var e;if((e=t.doors)!=null&&e.length&&t.geometry.type==="polygon"){let i=t.geometry.coords[0];t.doors.forEach(s=>{let u=s.type==="single"?.5:1,c=.5,f=SO(i,s.coord),p=new Ft(...s.coord),d=new Ft(...i[f]).sub(new Ft(...s.coord)).normalize(),g=new Ft().addVectors(p,d.clone().multiplyScalar(u)),y=new Ft().addVectors(p,d.clone().multiplyScalar(-u)),v=new Ft(-d.y,d.x),E=new Ft().addVectors(g,v.clone().multiplyScalar(c));wO([E.x,E.y],i)||(v.multiplyScalar(-1),E=new Ft().addVectors(g,v.clone().multiplyScalar(c)));let M=new Ft().addVectors(y,v.clone().multiplyScalar(c)),A=[[g.x,g.y],[E.x,E.y],[M.x,M.y],[y.x,y.y]];i=[...i.slice(0,f+1),...A,...i.slice(f+1)]}),t.geometry.coords[0]=i}})}var p1="";function OD(n){let t=sc.findIndex(e=>e.floor===n);if(t!==-1){console.log("\\u8C03\\u6574\\u697C\\u5C42\\u8BF7\\u6C42\\u7684\\u4F18\\u5148\\u7EA7",n,t);let e=sc.splice(t,1)[0];sc.unshift(e)}else p1=n}var d1="";function DD(n){let t=oc.findIndex(e=>e.floor===n);if(t!==-1){console.log("\\u8C03\\u6574\\u697C\\u5C42merge\\u4F18\\u5148\\u7EA7",n,t);let e=oc.splice(t,1)[0];oc.unshift(e)}else d1=n}function cet(n){OD(n),DD(n)}uD({onLoad(n){return Ri(this,null,function*(){let{floors:t,version:e}=n;for(yield rp(),yield Promise.all(t.map(i=>Ri(this,null,function*(){return ret(i,e)}))),p1&&OD(p1),yield Promise.all(sc.map(i=>Ri(this,null,function*(){let s=yield net(i);if(s&&e===Mg.LAYERED_RENDER_VERSION){let u=bg(t.find(c=>c.floor===s.floor),1);yield LD(np.MAP_DATA,u,s),console.log(s.floor+" \\u5199\\u5165\\u7F13\\u5B58\\u6210\\u529F\\uFF0Ckey="+u),self.postMessage({type:"floor_success",data:{floor:s.floor}})}}))),d1&&DD(d1);oc.length>0;){let i=oc.shift(),s=iet(i),u=bg(t.find(c=>c.floor===i.floor));yield LD(np.MAP_DATA,u,s),console.log(i.floor+" \\u5199\\u5165\\u7F13\\u5B58\\u6210\\u529F\\uFF0Ckey="+u),self.postMessage({type:"floor_success",data:{floor:i.floor}})}fC(),console.log("\\u6240\\u6709\\u6570\\u636E\\u5904\\u7406\\u5B8C\\u6210")})},onAdjustFloorPriority(n){let{floor:t}=n;cet(t)}});
16010
16010
  `],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var tMt={mergeParkingSpace:!0,mergeGraphic:!0,renderVersion:vg.MERGED_RENDER_VERSION,layers:["graph","wall","lane","texture2d","texture3d","glb","store","facility","parkingSpace","text"],filterPoi:()=>!0},fp=class extends Yi{initDb(){return Tt(this,null,function*(){try{let{db:t}=yield n6();this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return Tt(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=te({},this.placeConfig,e));else if(typeof t=="string"){let n=yield fetch(t).then(i=>i.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=te({},this.placeConfig,JSON.parse(n.data.config||"{}")))}else return this.load("https://screen.aibee.cn/ai-map/map/get-floor-map?place_id="+t);this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return Tt(this,null,function*(){return this.initDbPromise.then(()=>r6(t,""+e,n))})}getCacheData(t,e){return Tt(this,null,function*(){return this.initDbPromise.then(()=>Wv(t,""+e))})}getFloorData(t){return Tt(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return Tt(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=V6(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=H6(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return Tt(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>Tt(this,null,function*(){let i=_g(t),o=yield fetch(t.map_url).then(a=>a.json());o.floor=t.floor,b_(o),this.setCacheData(js.MAP_DATA,i,o),this.setCacheData(js.MAP_VERSION,i,t.version_id),n(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return Tt(this,null,function*(){let e=this.floors.find(n=>n.floor===t);return e?new Promise(n=>Tt(this,null,function*(){let i=_g(e,this.options.renderVersion===vg.LAYERED_RENDER_VERSION?1:void 0);try{let o=_g(e),a=yield this.getCacheData(js.MAP_DATA,o);if(a&&a.transformed){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u5408\u5E76\u540E\u7684\u6570\u636E"),n(a);return}if(this.options.renderVersion===vg.LAYERED_RENDER_VERSION){let l=yield this.getCacheData(js.MAP_DATA,i);if(l){console.log("\u4ECE\u7F13\u5B58\u4E2D\u53D6\u5230\u4E86\u6570\u636E"),n(l);return}}if(console.log("\u7F13\u5B58\u4E2D\u6CA1\u6709\u6570\u636E"),this.loadWorker){pi(this.loadWorker,"adjust_floor_priority",{floor:t});let l=c=>{if(c.data.type==="floor_success"&&c.data.data.floor===t){var f;(f=this.loadWorker)==null||f.removeEventListener("message",l),n(this.getFloorJsonData(t))}};this.loadWorker.addEventListener("message",l)}else n(this.getFloorJsonDataByFloorInfo(e))}catch(o){console.log("[get floor data error]",o),n(this.getFloorJsonDataByFloorInfo(e))}})):null})}getRoadNetworkData(){return Tt(this,null,function*(){return(yield Promise.all(this.floors.map(e=>Tt(this,null,function*(){let n=_g(e,0);try{let i=yield this.getCacheData(js.ROAD_NETWORK_DATA,n);if(i)return i;let o=yield fetch(e.route_url).then(a=>a.json());return this.setCacheData(js.ROAD_NETWORK_DATA,n,o),this.setCacheData(js.ROUTE_VERSION,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(a=>a.json());return this.setCacheData(js.ROAD_NETWORK_DATA,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return Tt(this,null,function*(){let t=this.floors.reduce((i,o)=>i.updated_at>o.updated_at?i:o,this.floors[0]);if(!t)return null;let e=_g(t,0),n=()=>Tt(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(js.FACILITY_DATA,e,i),this.setCacheData(js.FACILITY_VERSION,e,t.version_id)),i});try{let i=yield this.getCacheData(js.FACILITY_DATA,e);return i||n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return Tt(this,null,function*(){yield this.initDbPromise,yield pi(this.loadWorker,"load",{floors:this.floors,version:this.options.renderVersion}),this.closeWorker()})}getMulFloorsData(t){return Tt(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return Tt(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return Tt(this,null,function*(){b_(t),e=this.getFloorBaseLayer(t,e);let i=te({},this.placeConfig,n);return yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,i),this.changeFloorBox(t,e),e})}getDataByJsonStep(t,e,n){return Tt(this,null,function*(){b_(t),e=this.getFloorBaseLayer(t,e);let i=te({},this.placeConfig,n);return this.changeFloorBox(t,e),requestAnimationFrame(()=>Tt(this,null,function*(){yield this.getFloorContentLayer(t,e),this.changeFloorBox(t,e),requestAnimationFrame(()=>Tt(this,null,function*(){yield this.getFloorPoi(t,e,i),this.changeFloorBox(t,e)}))})),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new G),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t,e){return Tt(this,null,function*(){return new Promise(n=>{let i={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(i),a=l=>{let{task:c,res:f}=l;c.tid===o&&(this.taskQueue.removeEventListener("active-task-end",a),n(f))};this.taskQueue.addEventListener("active-task-end",a)})})}_switchFloor(t,e){return Tt(this,null,function*(){var n;let i=t;if(typeof t=="string"){let g=yield this.getFloorJsonData(t);if(g)i=g;else return null}else b_(t);let o=te({},this.placeConfig,e),a=new $a(this.bmap.context);a.userData.data=t;let l=this.floors.find(g=>g.floor===i.floor);var c;let f=(c=l==null?void 0:l.map_angle)!=null?c:0;return this.bmap.dispatchEvent({type:ss.SWITCH_FLOOR_BEFORE,data:{curFloor:a,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:a,graphics:[],floorData:i}}),this.bmap.context.scene.background=new ne(o.backgroundColor),this.getFloorBaseLayer(i,a),this.changeFloorBox(i,a),this.bmap.buildingCenter=a.userData.center,this.bmap.currentBuildGround=(n=a.userData.data.layers.find(g=>g.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(a),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(f/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:a,graphics:[]}}),this.bmap.dispatchEvent({type:ss.SWITCH_FLOOR_GROUND,data:{curFloor:a}}),yield y1(),yield this.getFloorContentLayer(i,a),this.changeFloorBox(i,a),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:a,graphics:[]}}),yield ET(2),yield this.getFloorPoi(i,a,o),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:a,graphics:a.graphicLayer.children}}),this.bmap.dispatchEvent({type:ss.SWITCH_FLOOR_AFTER,data:{curFloor:a,graphics:a.graphicLayer.children}}),a})}getFloorBaseLayer(t,e){e||(e=new $a(this.bmap.context));let n=[0,0];return t.layers.forEach(i=>{switch(i.l_type){case"range":let o=i.elements[0];n=[o.center_x,o.center_y],e.userData.range=o.geometry.cds[0],e.userData.rangeGraphic=o;break;case"ground":zR(i,e);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return Tt(this,null,function*(){e||(e=new $a(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let i=0;i<t.layers.length;i++){let o=t.layers[i];["range","ground"].includes(o.l_type)||this.options.layers.includes(o.l_type)&&(o8(o,e,this.options),console.log("time",Date.now()-n,o.l_type),n=Date.now())}return e})}getFloorPoi(t,e,n){return Tt(this,null,function*(){n===void 0&&(n=this.placeConfig);let i=Date.now();yield Promise.all(t.layers.map(a=>{if(this.options.layers.includes(a.l_type))return s8(a,e,this.locale,n,this.options)})),console.log("poi time",Date.now()-i);let o=Date.now();y1().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return Tt(this,null,function*(){BX(),this.db=null})}closeWorker(){this.loadWorker&&(this.loadWorker.terminate(),this.loadWorker=null)}dispose(){super.dispose(),this.clear(),this.closeWorker(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new ep,this.loadWorker=GR(),this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0,textFontSize:14},this.getFloorDataPromise=new Map,this.options=te({},tMt,e),this.placeConfig=te({},this.placeConfig,t.config.loaderPlaceConfig),this.initDbPromise=this.initDb()}};var Hoe=H(ze(),1);function kR(r,t){return Tt(this,null,function*(){let{brand:e,project:n}=r,{apiDomain:i,apiPath:{floorRange:o},apiInfo:a}=t,l=""+i+o+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(l,a).then(f=>f.json()).then(f=>f.data).then(f=>{let g=(f||[])[0];return g&&(g.info=JSON.parse(g.info)),g})})}function VR(r,t){return Tt(this,null,function*(){let{brand:e,project:n,floor:i,ts:o,resource_type_list:a}=r,{apiDomain:l,apiPath:{floorGraphic:c},apiInfo:f}=t,g=""+l+c+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+i+"&ts="+o+"&resource_type_list="+a;return yield fetch(g,f).then(v=>v.json()).then(v=>v.data).then(v=>((v||[]).map(x=>x.info=JSON.parse(x.info)),v||[]))})}function eMt(r,t){return Tt(this,null,function*(){let{project:e,floor:n}=r,{apiDomain:i,apiInfo:o}=t,a=i+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(a,o).then(c=>c.json()).then(c=>c.data).then(c=>JSON.parse(c[0].streetInfo||"{}")).then(c=>c.fileId?nMt(c.fileId,t):null)})}function nMt(r,t){return Tt(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+r,n).then(i=>i.arrayBuffer()).then(i=>{let a=new TextDecoder("utf-8").decode(i);return a?JSON.parse(a):null})})}var HR=class{load(t){return Tt(this,null,function*(){let e=$f(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),VR(t,this.bmap.config)]),i=$f({floor:t.floor,ts:t.ts});Av(n.map(a=>a.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),n.forEach(a=>a.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let o=this.floorDataLengthMap.get(i)||0;return this.floorDataLengthMap.set(i,o+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return Tt(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,i=e.userData.graphicMap||new Map,{ground:o,markGraphic:a,graphic:l}=this.bmap.config;for(let c=0;c<t.length;c++){let f=t[c];f.info.group==="ground"?(f.info.fillColor=o.color,f.info.fillOpacity=o.opacity,f.info.height=o.height,f.info.stroke=o.stroke,f.info.strokeColor=o.strokeColor,f.info.strokeOpacity=o.strokeOpacity):f.info.userData.mark?(f.info.height=a.height,f.info.fillColor=a.color,f.info.fillOpacity=a.opacity,f.info.stroke=a.stroke,f.info.strokeColor=a.strokeColor,f.info.strokeOpacity=a.strokeOpacity):(f.info.fillOpacity=l.fillOpacity,this.bmap.config.initTransToMark&&(f.info.height=a.height,f.info.fillColor=a.color,f.info.stroke=a.stroke,f.info.strokeColor=a.strokeColor,f.info.strokeOpacity=a.strokeOpacity))}for(let c of t){if(c.info.group==="ground")e.createGround(c.info);else{let f=e.addGraphic(c.info);f.userData.data=c,n.set(c.legacy_id,f)}i.set(c.element_uuid,c)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=i,e.userData.rangeGraphic=this.bmap.currentBuildGround,e.userData.range=this.bmap.currentBuildGround.geometry.cds[0],e.userData.center=this.bmap.buildingCenter,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(ss.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(ss.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let n=e.userData.graphicMap||new Map;return t.filter(i=>!n.has(i.element_uuid))}switchFloorByStoreData(t,e){return Tt(this,null,function*(){let n=yield this.load(te({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return Tt(this,null,function*(){let n=yield this.load(te({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return Tt(this,null,function*(){let{brand:e,project:n}=t,i=yield this.loadBuildingGround({brand:e,project:n});var o;return this.bmap.currentBuildGround=(o=i==null?void 0:i.info)!=null?o:null,this.bmap.changeBuildingCenter(i,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return Tt(this,null,function*(){let{brand:e,project:n}=t,i=$f({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=kR({brand:e,project:n},this.bmap.config).then(a=>(this.buildingGroundMap.set(i,a),a));return this.buildingGroundMap.set(i,o),o})}switchFloor(t){return Tt(this,null,function*(){let e=new $a(this.bmap.context);e.userData.graphicMap=new Map,e.name=t.floor;try{yield Promise.all([this.switchFloorByStoreData(t,e),this.switchFloorByOtherData(t,e)])}catch(n){console.log(n)}return e})}dispose(){this.cacheData.clear(),this.floorDataLengthMap.clear(),this.buildingGroundMap.clear()}constructor(t){this.bmap=t,this.cacheData=new Map,this.floorDataLengthMap=new Map,this.buildingGroundMap=new Map,this.externalStreetMap=new Map}};var rMt=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),WR=class extends Sn{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?yv(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:i,brand:n})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor(t){return Tt(this,null,function*(){return this.loader||(this.loader=new fp(this),this.loader.placeConfig=te({},this.loader.placeConfig,this.config.loaderPlaceConfig),yield this.loader.load(this.config.apiPath.loadPlaceInfo+"?place_id="+this.config.placeId+"&env=prod")),this.loader.switchFloor(t)})}switchFloorByFloor(t,e,n){e===void 0&&(e=!0),n===void 0&&(n=t.graphicLayer.children),this.triggerHooks(ss.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:n}),this.buildingCenter=t.userData.center,this.currentBuildGround=t.userData.rangeGraphic,this.context.switchFloor(t,e),this.initialFloorCamera(),this.triggerHooks(ss.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:n})}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(this.config.defaultPadding,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*this.config.control.maxZoomScale,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}addModel(t,e){if(t.options.geometry.type==="polygon"){var n;let i=(n=this.context.currentFloor)==null?void 0:n.addModel(te({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(i){let{facilityAngle:o=0,facilityXScale:a=1,facilityYScale:l=1}=t.options.userData;i.rotateZ((180-o)/180*Math.PI),i.scale.set(a,l,1)}}}addHeatmap(t){var e;return(e=this.context.currentFloor)==null?void 0:e.addHeatmap(t)}getLegacyToGraphicMap(){var t;return((t=this.context.currentFloor)==null?void 0:t.userData.legacyToGraphicMap)||new Map}getFloorAllGraphics(){var t;return((t=this.context.currentFloor)==null?void 0:t.getGraphics())||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let n=t.options.center,i=t.getCenter(),o=(n==null?void 0:n[0])||i.x,a=(n==null?void 0:n[1])||i.y;return console.log(o,a,n,i),this.context.currentFloor.addPoi(te({},e,{position:{x:o,y:a,z:i.z+t.options.height/2}}))}return null}createPoi2ByPosition(t,e){if(this.context.currentFloor){let n=this.mercatorToWorld([t.x,t.y]),i=new Oi(this.context,te({},e,{position:{x:n.x,y:n.y,z:t.z}}));return this.context.currentFloor.poiLayer2.pushPoi(i),i}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,i){e===void 0&&(e=500),n===void 0&&(n=0),i===void 0&&(i=0);let o=t.getPosition().clone(),{context:{camera:a}}=this;if(a.updateMatrix(),i){let l=new G;l.setFromMatrixColumn(a.matrix,1),l.normalize(),l.multiplyScalar(i/a.zoom),o.add(l)}if(n){let l=new G;l.setFromMatrixColumn(a.matrix,0),l.normalize(),l.multiplyScalar(n/a.zoom),o.add(l)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return Tt(this,null,function*(){return e===void 0&&(e=500),Ya(new Promise(n=>{let i=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:a,height:l},camera:c}=this.context,g=sn(o,c,a,l).x-a/2,m=new G;m.setFromMatrixColumn(this.context.camera.matrix,0),m.normalize(),m.multiplyScalar(g/this.context.camera.zoom),i.add(m),this.context.setCameraPosition(i,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:i}=this.container;return sn(e,this.context.camera,n,i)}changeMapType(t,e){return e===void 0&&(e=500),this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}resetView(t){return Tt(this,null,function*(){t===void 0&&(t=300);let e=t/3;yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),yield this.context.setPolarAngle(this.config.control.defaultPolar,e),yield this.context.fitCameraToGround(this.config.defaultPadding,e,!1)})}reduceMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver(this.debounceResize);t.observe(this.container),this.observe=t}}unRegistryEvent(){var t;this.context.control.removeEventListener("change",this.onControlChange),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),(t=this.observe)==null||t.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t,e){t===void 0&&(t=.1),e===void 0&&(e=500);let n=this.context.control.getAzimuthalAngle();return this.context.setAzimuthalAngle(n+t,e)}measureDistance(){return Tt(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new p_(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",i=>{let{distance:o}=i;t(o)})})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new d_(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",i=>{let{area:o}=i;t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}fitCameraByPois(t,e,n){return Tt(this,null,function*(){if(e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),!t.length)return;let i=new Fe;return t.forEach(o=>{let{position:a}=o;i.expandByPoint(a)}),this.context.fitCameraToBox(i,e,n,!1)})}fitCameraByPoiNodeIds(t,e,n){return Tt(this,null,function*(){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500);let i=t.map(o=>this.getPoiById(o)).filter(o=>!!o);if(i.length)return this.fitCameraByPois(i,e,n)})}getGraphicByNodeId(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((n=this.context.currentFloor)==null?void 0:n.parkingSpaceLayer.graphicMap.get(t))||null}deleteGraphic(t){var e;(e=this.context.currentFloor)==null||e.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){var e;if(!t.transformToBuildingGround&&this.currentBuildGround){let n=yv(this.currentBuildGround.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[i,o]=t.geometry.cds;t.geometry.coords=[i-n[0],o-n[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}mercatorToWorld(t){let e=this.buildingCenter;return new G(t[0]-e[0],t[1]-e[1],0)}removePoiById(t){var e,n;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(n=this.context.currentFloor)==null||n.poiLayer2.removePoiById(t)}getPoiById(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||((n=this.context.currentFloor)==null?void 0:n.poiLayer2.getPoiById(t))}getPois(){var t,e;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(n=>!n.options.built_in),...((e=this.context.currentFloor)==null?void 0:e.poiLayer2.pois)||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}dispose(){this.loader&&(this.loader.dispose(),this.loader=null),this.unRegistryEvent(),this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.plugins=[],this.context.dispose(),this.context=null,this.container=null,uo.dispose(),Mo.dispose(),Sh.dispose(),Ms.dispose(),hn.dispose(),v0.dispose(),this.debounceResize=null,Va.Dispose==null||Va.Dispose.call(Va)}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new li,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:n}}=this.context;n!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=n)},this.onKeydown=n=>{this.polarKeys.includes(n.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(n.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=n=>{if(this.polarKeys.includes(n.code)){let i=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=i,this.context.control.minPolarAngle=i}if(this.azimuthalKeys.includes(n.code)){let i=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=i,this.context.control.minAzimuthAngle=i}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),i=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let o=this.context.getFitCameraToGroundZoom(this.config.defaultPadding,0)||1;this.context.camera.zoom=i,this.context.control.minZoom=o,this.context.control.maxZoom=o*this.config.control.maxZoomScale,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=FR(e),this.context=new S_(t,this),this.debounceResize=(0,a8.debounce)(this.resize,5),this.registryEvent()}};var iMt=function(r){return r.HALF="half",r.POWER="power",r.MECHANICAL="mechanical",r.NORMAL="normal",r.VIP="vip",r}({});var fse=H(ze(),1);var lo=class extends Yi{dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null,super.dispose()}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var qR=class extends lo{fetchEquipment(){return Tt(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,i=""+t+e;yield fetch(i,n).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(a=>[a.equipment_id,a]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)})}getGraphicEquipment(t){return t.userData.data.info.userData.equipment}changeGraphicToEquipment(t){t.filter(e=>{let n=this.getGraphicEquipment(e);return n&&this.equipmentMap.has(n)}).forEach(e=>{let n=this.equipmentMap.get(this.getGraphicEquipment(e)),i=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=n,i.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(ss.SWITCH_FLOOR_AFTER,this.onSwitchFloor),Array.from(((t=this.bmap.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).forEach(e=>{if(e.userData.type==="equipment"){var n;(n=this.bmap.context.currentFloor)==null||n.poiLayer.removePoi(e)}}),super.dispose()}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:n}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(n)},this.fetchEquipment(),this.bmap.addEventListener(ss.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var Eae=H(bv(),1),Sae=H(Xa(),1),bae=H(ze(),1),Mae=H(UR(),1);var Use=H(ze(),1),Fse=H(vn(),1);var vse=H(ip(),1),_se=H(ec(),1),yse=H(nc(),1),xse=H(rc(),1),Ese=H(ic(),1),Sse=H(oc(),1),bse=H(sc(),1),Mse=H(ac(),1),wse=H(uc(),1),Tse=H(lc(),1),Ase=H(cc(),1),Cse=H(hc(),1),Rse=H(fc(),1),Pse=H(pc(),1),Ise=H(dc(),1),Lse=H(vn(),1),Nse=H(MR(),1);var Qa=class extends qe{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new Ie,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};Qa.prototype.setMatrixWorld=function(r){this.matrixWorld=r};Qa.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};Qa.prototype.setPoints=function(r,t){if(!(r instanceof Float32Array)&&!(r instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=r,this.widthCallback=t,this.positions=[],this.counters=[],r.length&&r[0]instanceof G)for(var e=0;e<r.length;e++){var n=r[e],i=e/r.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(i),this.counters.push(i)}else for(var e=0;e<r.length;e+=3){var i=e/r.length;this.positions.push(r[e],r[e+1],r[e+2]),this.positions.push(r[e],r[e+1],r[e+2]),this.counters.push(i),this.counters.push(i)}this.process()};function oMt(r,t){var e=new Ie,n=new da,i=new ai,o=new G,a=this.geometry;if(a.boundingSphere||a.computeBoundingSphere(),i.copy(a.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(e);var l=new G,c=new G,f=new G,g=this instanceof ji?2:1,m=a.index,v=a.attributes;if(m!==null)for(var x=m.array,S=v.position.array,w=v.width.array,E=0,b=x.length-1;E<b;E+=g){var C=x[E],A=x[E+1];l.fromArray(S,C*3),c.fromArray(S,A*3);var P=w[Math.floor(E/3)]!==void 0?w[Math.floor(E/3)]:1,U=r.params.Line.threshold+this.material.lineWidth*P/2,F=U*U,D=n.distanceSqToSegment(l,c,o,f);if(!(D>F)){o.applyMatrix4(this.matrixWorld);var N=r.ray.origin.distanceTo(o);N<r.near||N>r.far||(t.push({distance:N,point:f.clone().applyMatrix4(this.matrixWorld),index:E,face:null,faceIndex:null,object:this}),E=b)}}}}Qa.prototype.raycast=oMt;Qa.prototype.compareV3=function(r,t){var e=r*6,n=t*6;return this.positions[e]===this.positions[n]&&this.positions[e+1]===this.positions[n+1]&&this.positions[e+2]===this.positions[n+2]};Qa.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};Qa.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new G(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new G(this.positions[n+6],this.positions[n+7],this.positions[n+8]),a=i.distanceTo(o);t+=a}return t};Qa.prototype.process=function(){var r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(r-1);var n;this.compareV3(0,r-1)?n=this.copyV3(r-2):n=this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var i=0;i<r;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(i/(r-1)):t=1,this.width.push(t),this.width.push(t),i===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(i===r-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let a=this.getDistance(i)/e;this.uvs.push(a,0),this.uvs.push(a,1)}if(i<r-1){n=this.copyV3(i),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=i*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}i>0&&(n=this.copyV3(i),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(r-1,0)?n=this.copyV3(1):n=this.copyV3(r-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new He(new Float32Array(this.positions),3),previous:new He(new Float32Array(this.previous),3),next:new He(new Float32Array(this.next),3),side:new He(new Float32Array(this.side),1),width:new He(new Float32Array(this.width),1),uv:new He(new Float32Array(this.uvs),2),index:new He(new Uint16Array(this.indices_array),1),counters:new He(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function XR(r,t,e,n,i){var o;if(r=r.subarray||r.slice?r:r.buffer,e=e.subarray||e.slice?e:e.buffer,r=t?r.subarray?r.subarray(t,i&&t+i):r.slice(t,i&&t+i):r,e.set)e.set(r,n);else for(o=0;o<r.length;o++)e[o+n]=r[o];return e}Qa.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;XR(t,0,e,0,i),XR(t,6,t,0,i-6),t[i-6]=r.x,t[i-5]=r.y,t[i-4]=r.z,t[i-3]=r.x,t[i-2]=r.y,t[i-1]=r.z,XR(t,6,n,0,i-6),n[i-6]=r.x,n[i-5]=r.y,n[i-4]=r.z,n[i-3]=r.x,n[i-2]=r.y,n[i-1]=r.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};ke.meshline_vert=["",ke.logdepthbuf_pars_vertex,ke.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",ke.logdepthbuf_vertex,ke.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",ke.fog_vertex,"}"].join(`
16011
16011
  `);ke.meshline_frag=["",ke.fog_pars_fragment,ke.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","uniform float thresholdRatio;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {",""," if (vUV.x <= thresholdRatio) {"," discard;"," }",ke.logdepthbuf_fragment,""," vec4 c = vColor;"," if( useMap == 1. ) c *= texture2D( map, vUV * repeat );"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","",ke.fog_fragment,"}"].join(`
16012
- `);var M_=class extends gr{constructor(t){super({uniforms:Object.assign({},pe.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new ne(16777215)},opacity:{value:1},resolution:{value:new pt(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new pt(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:ke.meshline_vert,fragmentShader:ke.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};M_.prototype.copy=function(r){return gr.prototype.copy.call(this,r),this.lineWidth=r.lineWidth,this.map=r.map,this.useMap=r.useMap,this.alphaMap=r.alphaMap,this.useAlphaMap=r.useAlphaMap,this.color.copy(r.color),this.opacity=r.opacity,this.resolution.copy(r.resolution),this.sizeAttenuation=r.sizeAttenuation,this.dashArray.copy(r.dashArray),this.dashOffset.copy(r.dashOffset),this.dashRatio.copy(r.dashRatio),this.useDash=r.useDash,this.visibility=r.visibility,this.alphaTest=r.alphaTest,this.repeat.copy(r.repeat),this};var u8={texture_url:b6,lineWidth:10,color:16777215},W6=class extends Se{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:i}}}}}=this,o=t.map(l=>{let[c,f]=l;return sn(new G(c,f,0),e,n,i)}).map(l=>{let{x:c,y:f}=l;return[c,f]});return Ws(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new pt(t,1)}loadTexture(t){return new Promise((e,n)=>{new G0().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return Tt(this,null,function*(){let e=this.geometry=new Qa;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=zs}let n=this.material=new M_({useMap:!0,color:new ne(this.config.color),transparent:!0,resolution:new pt(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:U0,repeat:new pt(this.getRepeat(),1)}),i=this.mesh=new en(e,n);return i.renderOrder=99999,this.add(i),i})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=u8,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:i}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,i)}},this.config=Object.assign({},u8,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var qse=H(T6(),1),Xse=H(ze(),1),jse=H(vn(),1);var l8=H(qs(),1);var sMt={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1,destinationDistanceThreshold:10},q6=class extends Yi{get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){var t;return((t=this.curRoutePath)==null?void 0:t.points)||[]}registryEvent(){this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.addEventListener("add-path",this.onAddPaths)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.removeEventListener("add-path",this.onAddPaths)}setRoadData(t){this.roadData=t}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null),t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,e){let{curRoutePathPoints:n,position:i,curRoutePath:o,paths:a,routeIndex:l}=this;if(!n.length)return null;let c=n,f=this.paths[this.routeIndex].floor,g=this.getCurRouteRemainDistance();if(i){let E=K0(n,i);c=c.slice(E+1),c.unshift(i)}let m=[{floor:o==null?void 0:o.floor,points:c},...a.slice(l+1)],{distance:v,closestPoint:x,index:S,i:w}=m.reduce((E,b,C)=>{if(b.floor!==t)return E;let{distance:A,closestPoint:P,index:U}=b.points.reduce((F,D,N,nt)=>{if(!nt[N+1])return te({},F,{distance:F.distance===1/0?zr(D,e):F.distance});let{distance:O,closestPoint:V}=VT(e,D,nt[N+1]);if(!this.navigation.options.canBack&&f===t){let W=[e,...nt.slice(N+1)],bt=Ws(W);if(g-bt>10)return F}return O<F.distance?{distance:O,closestPoint:V,index:N}:F},{distance:1/0,closestPoint:b.points[0],index:0});return A<E.distance?{distance:A,closestPoint:P,index:C,i:U}:E},{distance:1/0,closestPoint:c[0],index:0,i:0});return{distance:v,closestPoint:x,routeIndex:S+l,pointIndex:S===0?w+this.pointIndex:w}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:i,closestPoint:o,routeIndex:a,pointIndex:l}=n;i>this.options.offsetDistance?(this.offset=!0,this.resetTimer||(this.resetTimer=this.timer.setTimeout(()=>{this.reset=!0,this.resetTimer=null},this.options.offsetToResetTime))):(this.offset=!1,this.reset=!1,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null)),this.routeIndex=a,this.pointIndex=l,this.position=o,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}pause(){var t;this.tweenUtil.clear(),(t=this.throttleUpdatePosition)==null||t.cancel(),this.paused=!0}continue(){this.paused=!1,this.startCurRouteSimulation()}startCurRouteSimulation(){return Tt(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let i=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),a=o/this.options.simulationSpeed,l=this.throttleUpdatePosition=(0,l8.throttle)(f=>{let g=Jf(i,f.distance);g&&(e.push({floor:t.floor,pos:g}),this.toPosition(t.floor,g))},100),c=this.simulationTween=new Za({distance:0},this.tweenUtil.group).to({distance:o},a*1e3).onUpdate(l).onComplete(()=>{this.tweenUtil.remove(c),l.flush(),l.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{n(this.startCurRouteSimulation())},3e3)):(n(!0),console.log(e,this.routeIndex,this.paths))}).start()})})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.paused||this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[n,...t.slice(e+1)];return Ws(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return Ws(i)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((i,o)=>i+o.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:i,curRoutePath:o}=this,a=e,l=Q0.FRONT,c=(o==null||(t=o.pointInfos[a])==null?void 0:t.crossName)||"",f=0,g=0,m=0;for(;l===Q0.FRONT&&a<=n.length;){let w=n[a],E=n[a+1],b=n[a+2];if(!w||!E)l=Q0.END;else if(f+=zr(w,E),!b)l=Q0.END;else{l=w1(w,E,b),g=xv(w,E,b),m=(new pt(b[0]-E[0],b[1]-E[1]).angle()*180/Math.PI-90+360)%360;var v;c=(v=o==null?void 0:o.pointInfos[a+1].crossName)!=null?v:"",a+=1}}n[a]&&(f=zr(i,n[a]));let x=T1(g);if(l===Q0.END&&f<=this.options.directionEmitThreshold)return{dir:l,distance:f,crossName:c,angle:g,nextAngle:m,nextDir:x};let S=this.getCurRouteToStartDistance();return e===0&&S<=5?{dir:Q0.START,distance:f,crossName:c,angle:g,nextAngle:m,nextDir:x}:(f>=this.options.directionEmitThreshold&&(l=Q0.FRONT),{dir:l,distance:f,crossName:c,angle:g,nextAngle:m,nextDir:x})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let i=br(n.cds),o=Rr(this.position);return Li(o,i)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:i,distance:o,crossName:a,angle:l,nextAngle:c,nextDir:f}=n;e<=this.options.destinationDistanceThreshold&&(i=Q0.END);let{imageUrl:g}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:o,dir:i,angle:l,nextAngle:c,pos:this.position,routeIndex:this.routeIndex,crossName:a,offset:this.offset,reset:this.reset,imageUrl:g,nextDir:f}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,n){super(),this.navigation=t,this.offset=!1,this.reset=!1,this.position=[0,0],this.routeIndex=0,this.pointIndex=0,this.paths=[],this.timer=new li,this.resetTimer=null,this.tweenUtil=new Kl,this.paused=!1,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o),this.simulationTween&&!this.paused&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},sMt,e),this.roadData=n,this.registryEvent()}};var tae=H(e6(),1),eae=H(ec(),1),nae=H(nc(),1),rae=H(rc(),1),iae=H(ic(),1),oae=H(oc(),1),sae=H(sc(),1),aae=H(ac(),1),uae=H(uc(),1),lae=H(lc(),1),cae=H(cc(),1),hae=H(hc(),1),fae=H(fc(),1),pae=H(pc(),1),dae=H(dc(),1),gae=H(oC(),1),mae=H(ze(),1);var yc=class r extends Oi{addDebug(){r.canvas.style.cssText=`
16012
+ `);var M_=class extends gr{constructor(t){super({uniforms:Object.assign({},pe.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new ne(16777215)},opacity:{value:1},resolution:{value:new pt(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new pt(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:ke.meshline_vert,fragmentShader:ke.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};M_.prototype.copy=function(r){return gr.prototype.copy.call(this,r),this.lineWidth=r.lineWidth,this.map=r.map,this.useMap=r.useMap,this.alphaMap=r.alphaMap,this.useAlphaMap=r.useAlphaMap,this.color.copy(r.color),this.opacity=r.opacity,this.resolution.copy(r.resolution),this.sizeAttenuation=r.sizeAttenuation,this.dashArray.copy(r.dashArray),this.dashOffset.copy(r.dashOffset),this.dashRatio.copy(r.dashRatio),this.useDash=r.useDash,this.visibility=r.visibility,this.alphaTest=r.alphaTest,this.repeat.copy(r.repeat),this};var u8={texture_url:b6,lineWidth:10,color:16777215},W6=class extends Se{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:i}}}}}=this,o=t.map(l=>{let[c,f]=l;return sn(new G(c,f,0),e,n,i)}).map(l=>{let{x:c,y:f}=l;return[c,f]});return Ws(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new pt(t,1)}loadTexture(t){return new Promise((e,n)=>{new G0().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return Tt(this,null,function*(){let e=this.geometry=new Qa;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=zs}let n=this.material=new M_({useMap:!0,color:new ne(this.config.color),transparent:!0,resolution:new pt(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:U0,repeat:new pt(this.getRepeat(),1)}),i=this.mesh=new en(e,n);return i.renderOrder=99999,this.add(i),i})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=u8,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:i}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,i)}},this.config=Object.assign({},u8,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};var qse=H(T6(),1),Xse=H(ze(),1),jse=H(vn(),1);var l8=H(qs(),1);var sMt={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1,destinationDistanceThreshold:10},q6=class extends Yi{get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){var t;return((t=this.curRoutePath)==null?void 0:t.points)||[]}registryEvent(){this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.addEventListener("add-path",this.onAddPaths)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.removeEventListener("add-path",this.onAddPaths)}setRoadData(t){this.roadData=t}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,this.offsetDistance=0,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null),t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,e){let{curRoutePathPoints:n,position:i,curRoutePath:o,paths:a,routeIndex:l}=this;if(!n.length)return null;let c=n,f=this.paths[this.routeIndex].floor,g=this.getCurRouteRemainDistance();if(i){let E=K0(n,i);c=c.slice(E+1),c.unshift(i)}let m=[{floor:o==null?void 0:o.floor,points:c},...a.slice(l+1)],{distance:v,closestPoint:x,index:S,i:w}=m.reduce((E,b,C)=>{if(b.floor!==t)return E;let{distance:A,closestPoint:P,index:U}=b.points.reduce((F,D,N,nt)=>{if(!nt[N+1])return te({},F,{distance:F.distance===1/0?zr(D,e):F.distance});let{distance:O,closestPoint:V}=VT(e,D,nt[N+1]);if(!this.navigation.options.canBack&&f===t){let W=[e,...nt.slice(N+1)],bt=Ws(W);if(g-bt>10)return F}return O<F.distance?{distance:O,closestPoint:V,index:N}:F},{distance:1/0,closestPoint:b.points[0],index:0});return A<E.distance?{distance:A,closestPoint:P,index:C,i:U}:E},{distance:1/0,closestPoint:c[0],index:0,i:0});return{distance:v,closestPoint:x,routeIndex:S+l,pointIndex:S===0?w+this.pointIndex:w}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:i,closestPoint:o,routeIndex:a,pointIndex:l}=n;this.offsetDistance=i,i>this.options.offsetDistance?(this.offset=!0,this.resetTimer||(this.resetTimer=this.timer.setTimeout(()=>{this.reset=!0,this.resetTimer=null},this.options.offsetToResetTime))):(this.offset=!1,this.reset=!1,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null)),this.routeIndex=a,this.pointIndex=l,this.position=o,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}pause(){var t;this.tweenUtil.clear(),(t=this.throttleUpdatePosition)==null||t.cancel(),this.paused=!0}continue(){this.paused=!1,this.startCurRouteSimulation()}startCurRouteSimulation(){return Tt(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let i=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),a=o/this.options.simulationSpeed,l=this.throttleUpdatePosition=(0,l8.throttle)(f=>{let g=Jf(i,f.distance);g&&(e.push({floor:t.floor,pos:g}),this.toPosition(t.floor,g))},100),c=this.simulationTween=new Za({distance:0},this.tweenUtil.group).to({distance:o},a*1e3).onUpdate(l).onComplete(()=>{this.tweenUtil.remove(c),l.flush(),l.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{n(this.startCurRouteSimulation())},3e3)):(n(!0),console.log(e,this.routeIndex,this.paths))}).start()})})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.paused||this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[n,...t.slice(e+1)];return Ws(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return Ws(i)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((i,o)=>i+o.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:i,curRoutePath:o}=this,a=e,l=Q0.FRONT,c=(o==null||(t=o.pointInfos[a])==null?void 0:t.crossName)||"",f=0,g=0,m=0;for(;l===Q0.FRONT&&a<=n.length;){let w=n[a],E=n[a+1],b=n[a+2];if(!w||!E)l=Q0.END;else if(f+=zr(w,E),!b)l=Q0.END;else{l=w1(w,E,b),g=xv(w,E,b),m=(new pt(b[0]-E[0],b[1]-E[1]).angle()*180/Math.PI-90+360)%360;var v;c=(v=o==null?void 0:o.pointInfos[a+1].crossName)!=null?v:"",a+=1}}n[a]&&(f=zr(i,n[a]));let x=T1(g);if(l===Q0.END&&f<=this.options.directionEmitThreshold)return{dir:l,distance:f,crossName:c,angle:g,nextAngle:m,nextDir:x};let S=this.getCurRouteToStartDistance();return e===0&&S<=5?{dir:Q0.START,distance:f,crossName:c,angle:g,nextAngle:m,nextDir:x}:(f>=this.options.directionEmitThreshold&&(l=Q0.FRONT),{dir:l,distance:f,crossName:c,angle:g,nextAngle:m,nextDir:x})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let i=br(n.cds),o=Rr(this.position);return Li(o,i)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:i,distance:o,crossName:a,angle:l,nextAngle:c,nextDir:f}=n;e<=this.options.destinationDistanceThreshold&&(i=Q0.END);let{imageUrl:g}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:o,dir:i,angle:l,nextAngle:c,pos:this.position,routeIndex:this.routeIndex,crossName:a,offset:this.offset,reset:this.reset,imageUrl:g,nextDir:f,offsetDistance:this.offsetDistance}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,n){super(),this.navigation=t,this.offset=!1,this.reset=!1,this.position=[0,0],this.routeIndex=0,this.pointIndex=0,this.paths=[],this.timer=new li,this.resetTimer=null,this.tweenUtil=new Kl,this.paused=!1,this.offsetDistance=0,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o),this.simulationTween&&!this.paused&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},sMt,e),this.roadData=n,this.registryEvent()}};var tae=H(e6(),1),eae=H(ec(),1),nae=H(nc(),1),rae=H(rc(),1),iae=H(ic(),1),oae=H(oc(),1),sae=H(sc(),1),aae=H(ac(),1),uae=H(uc(),1),lae=H(lc(),1),cae=H(cc(),1),hae=H(hc(),1),fae=H(fc(),1),pae=H(pc(),1),dae=H(dc(),1),gae=H(oC(),1),mae=H(ze(),1);var yc=class r extends Oi{addDebug(){r.canvas.style.cssText=`
16013
16013
  position: fixed;
16014
16014
  top: 0;
16015
16015
  left: 0;
@@ -23,6 +23,7 @@ export interface NavigationProcessInfo {
23
23
  reset: boolean;
24
24
  imageUrl: string | null;
25
25
  nextDir: PathDirection;
26
+ offsetDistance: number;
26
27
  }
27
28
  interface PositionNavigationEvent {
28
29
  "navigation-info": {
@@ -45,6 +46,7 @@ export declare class PositionNavigation extends EventDispatcher<PositionNavigati
45
46
  throttleUpdatePosition?: DebouncedFuncLeading<(...args: any[]) => void>;
46
47
  roadData: RoadData2[];
47
48
  paused: boolean;
49
+ offsetDistance: number;
48
50
  constructor(navigation: Navigation, options: Partial<PositionNavigationConfig>, roadData: RoadData2[]);
49
51
  get curRoutePath(): PathData2[0] | null;
50
52
  get curRoutePathPoints(): [number, number][];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aibee/crc-bmap",
3
- "version": "0.12.48",
3
+ "version": "0.12.49",
4
4
  "description": "",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.esm.min.js",