@aibee/crc-bmap 0.2.14 → 0.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- var nh=Object.create;var ys=Object.defineProperty;var rh=Object.getOwnPropertyDescriptor;var ih=Object.getOwnPropertyNames;var oh=Object.getPrototypeOf,sh=Object.prototype.hasOwnProperty;var Re=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var ah=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ih(e))!sh.call(r,i)&&i!==t&&ys(r,i,{get:()=>e[i],enumerable:!(n=rh(e,i))||n.enumerable});return r};var pn=(r,e,t)=>(t=r!=null?nh(oh(r)):{},ah(e||!r||!r.__esModule?ys(t,"default",{value:r,enumerable:!0}):t,r));var Ds=Re((Fv,Ps)=>{Ps.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var Ns=Re((Uv,Rs)=>{var Is=Ds();Rs.exports=function(r,e){Array.isArray(e)||(e=[]),r.length>0&&e.push(Is([0,0],r[0]));for(var t=0;t<r.length-1;t++){var n=r[t],i=r[t+1],o=n[0],a=n[1],c=i[0],l=i[1],s=[.75*o+.25*c,.75*a+.25*l],u=[.25*o+.75*c,.25*a+.75*l];e.push(s),e.push(u)}return r.length>1&&e.push(Is([0,0],r[r.length-1])),e}});var ks=Re((Hv,Gs)=>{var Ti=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,t)=>e.priority-t.priority)}set(e,t){let n=Number(t);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(e)?this.queue.map(i=>(i.key===e&&Object.assign(i,{priority:n}),i)):(this.keys.add(e),this.queue.push({key:e,priority:n})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(t=>t.key===e)}};Gs.exports=Ti});var Ws=Re((Wv,Hs)=>{function Vs(r,e){let t=new Map;for(let[n,i]of r)n!==e&&i instanceof Map?t.set(n,Vs(i,e)):n!==e&&t.set(n,i);return t}Hs.exports=Vs});var js=Re((qv,Xs)=>{function xh(r){let e=Number(r);return!(isNaN(e)||e<=0)}function qs(r){let e=new Map;return Object.keys(r).forEach(n=>{let i=r[n];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return e.set(n,qs(i));if(!xh(i))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,i);return e.set(n,Number(i))}),e}Xs.exports=qs});var Zs=Re((Xv,$s)=>{function Ys(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((e,t)=>{if(typeof e=="object"&&e instanceof Map){Ys(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}$s.exports=Ys});var Ai=Re((jv,Qs)=>{var Eh=ks(),bh=Ws(),Ks=js(),Js=Zs(),Ci=class{constructor(e){e instanceof Map?(Js(e),this.graph=e):e?this.graph=Ks(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(Js(t),n=t):n=Ks(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=bh(this.graph,e),this}path(e,t,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let i=new Set,o=new Eh,a=new Map,c=[],l=0,s=[];if(n.avoid&&(s=[].concat(n.avoid)),s.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(s.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(o.set(e,0);!o.isEmpty();){let u=o.next();if(u.key===t){l=u.priority;let f=u.key;for(;a.has(f);)c.push(f),f=a.get(f);break}i.add(u.key),(this.graph.get(u.key)||new Map).forEach((f,d)=>{if(i.has(d)||s.includes(d))return null;if(!o.has(d))return a.set(d,u.key),o.set(d,u.priority+f);let g=o.get(d).priority,p=u.priority+f;return p<g?(a.set(d,u.key),o.set(d,p)):null})}return c.length?(n.trim?c.shift():c=c.concat([e]),n.reverse||(c=c.reverse()),n.cost?{path:c,cost:l}:c):n.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};Qs.exports=Ci});var Hi=Re((ki,Vi)=>{(function(r,e){typeof ki=="object"&&typeof Vi<"u"?Vi.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self,r["'typed'"]=e())})(ki,function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";function i(){function a(E){return typeof E=="object"&&E!==null&&E.constructor===Object}let c=[{name:"number",test:function(E){return typeof E=="number"}},{name:"string",test:function(E){return typeof E=="string"}},{name:"boolean",test:function(E){return typeof E=="boolean"}},{name:"Function",test:function(E){return typeof E=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(E){return E instanceof Date}},{name:"RegExp",test:function(E){return E instanceof RegExp}},{name:"Object",test:a},{name:"null",test:function(E){return E===null}},{name:"undefined",test:function(E){return E===void 0}}],l={name:"any",test:r,isAny:!0},s,u,h=0,f={createCount:0};function d(E){let T=s.get(E);if(T)return T;let A='Unknown type "'+E+'"',I=E.toLowerCase(),U;for(U of u)if(U.toLowerCase()===I){A+='. Did you mean "'+U+'" ?';break}throw new TypeError(A)}function g(E){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",A=T?d(T).index:u.length,I=[];for(let O=0;O<E.length;++O){if(!E[O]||typeof E[O].name!="string"||typeof E[O].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let V=E[O].name;if(s.has(V))throw new TypeError('Duplicate type name "'+V+'"');I.push(V),s.set(V,{name:V,test:E[O].test,isAny:E[O].isAny,index:A+O,conversionsTo:[]})}let U=u.slice(A);u=u.slice(0,A).concat(I).concat(U);for(let O=A+I.length;O<u.length;++O)s.get(u[O]).index=O}function p(){s=new Map,u=[],h=0,g([l],!1)}p(),g(c);function m(){let E;for(E of u)s.get(E).conversionsTo=[];h=0}function v(E){let T=u.filter(A=>{let I=s.get(A);return!I.isAny&&I.test(E)});return T.length?T:["any"]}function b(E){return E&&typeof E=="function"&&"_typedFunctionData"in E}function y(E,T,A){if(!b(E))throw new TypeError(n);let I=A&&A.exact,U=Array.isArray(T)?T.join(","):T,O=P(U),V=_(O);if(!I||V in E.signatures){let ht=E._typedFunctionData.signatureMap.get(V);if(ht)return ht}let z=O.length,H;if(I){H=[];let ht;for(ht in E.signatures)H.push(E._typedFunctionData.signatureMap.get(ht))}else H=E._typedFunctionData.signatures;for(let ht=0;ht<z;++ht){let mt=O[ht],Ct=[],Zt;for(Zt of H){let qt=G(Zt.params,ht);if(!(!qt||mt.restParam&&!qt.restParam)){if(!qt.hasAny){let fe=C(qt);if(mt.types.some(de=>!fe.has(de.name)))continue}Ct.push(Zt)}}if(H=Ct,H.length===0)break}let B;for(B of H)if(B.params.length<=z)return B;throw new TypeError("Signature not found (signature: "+(E.name||"unnamed")+"("+_(O,", ")+"))")}function S(E,T,A){return y(E,T,A).implementation}function x(E,T){let A=d(T);if(A.test(E))return E;let I=A.conversionsTo;if(I.length===0)throw new Error("There are no conversions to "+T+" defined.");for(let U=0;U<I.length;U++)if(d(I[U].from).test(E))return I[U].convert(E);throw new Error("Cannot convert "+E+" to "+T)}function _(E){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return E.map(A=>A.name).join(T)}function M(E){let T=E.indexOf("...")===0,I=(T?E.length>3?E.slice(3):"any":E).split("|").map(z=>d(z.trim())),U=!1,O=T?"...":"";return{types:I.map(function(z){return U=z.isAny||U,O+=z.name+"|",{name:z.name,typeIndex:z.index,test:z.test,isAny:z.isAny,conversion:null,conversionIndex:-1}}),name:O.slice(0,-1),hasAny:U,hasConversion:!1,restParam:T}}function w(E){let T=E.types.map(V=>V.name),A=pt(T),I=E.hasAny,U=E.name,O=A.map(function(V){let z=d(V.from);return I=z.isAny||I,U+="|"+V.from,{name:V.from,typeIndex:z.index,test:z.test,isAny:z.isAny,conversion:V,conversionIndex:V.index}});return{types:E.types.concat(O),name:U,hasAny:I,hasConversion:O.length>0,restParam:E.restParam}}function C(E){return E.typeSet||(E.typeSet=new Set,E.types.forEach(T=>E.typeSet.add(T.name))),E.typeSet}function P(E){let T=[];if(typeof E!="string")throw new TypeError("Signatures must be strings");let A=E.trim();if(A==="")return T;let I=A.split(",");for(let U=0;U<I.length;++U){let O=M(I[U].trim());if(O.restParam&&U!==I.length-1)throw new SyntaxError('Unexpected rest parameter "'+I[U]+'": only allowed for the last parameter');if(O.types.length===0)return null;T.push(O)}return T}function D(E){let T=zt(E);return T?T.restParam:!1}function R(E){if(!E||E.types.length===0)return r;if(E.types.length===1)return d(E.types[0].name).test;if(E.types.length===2){let T=d(E.types[0].name).test,A=d(E.types[1].name).test;return function(U){return T(U)||A(U)}}else{let T=E.types.map(function(A){return d(A.name).test});return function(I){for(let U=0;U<T.length;U++)if(T[U](I))return!0;return!1}}}function W(E){let T,A,I;if(D(E)){T=It(E).map(R);let U=T.length,O=R(zt(E)),V=function(z){for(let H=U;H<z.length;H++)if(!O(z[H]))return!1;return!0};return function(H){for(let B=0;B<T.length;B++)if(!T[B](H[B]))return!1;return V(H)&&H.length>=U+1}}else return E.length===0?function(O){return O.length===0}:E.length===1?(A=R(E[0]),function(O){return A(O[0])&&O.length===1}):E.length===2?(A=R(E[0]),I=R(E[1]),function(O){return A(O[0])&&I(O[1])&&O.length===2}):(T=E.map(R),function(O){for(let V=0;V<T.length;V++)if(!T[V](O[V]))return!1;return O.length===T.length})}function G(E,T){return T<E.length?E[T]:D(E)?zt(E):null}function k(E,T){let A=G(E,T);return A?C(A):new Set}function L(E){return E.conversion===null||E.conversion===void 0}function q(E,T){let A=new Set;return E.forEach(I=>{let U=k(I.params,T),O;for(O of U)A.add(O)}),A.has("any")?["any"]:Array.from(A)}function Y(E,T,A){let I,U,O=E||"unnamed",V=A,z;for(z=0;z<T.length;z++){let mt=[];if(V.forEach(Ct=>{let Zt=G(Ct.params,z),qt=R(Zt);(z<Ct.params.length||D(Ct.params))&&qt(T[z])&&mt.push(Ct)}),mt.length===0){if(U=q(V,z),U.length>0){let Ct=v(T[z]);return I=new TypeError("Unexpected type of argument in function "+O+" (expected: "+U.join(" or ")+", actual: "+Ct.join(" | ")+", index: "+z+")"),I.data={category:"wrongType",fn:O,index:z,actual:Ct,expected:U},I}}else V=mt}let H=V.map(function(mt){return D(mt.params)?1/0:mt.params.length});if(T.length<Math.min.apply(null,H))return U=q(V,z),I=new TypeError("Too few arguments in function "+O+" (expected: "+U.join(" or ")+", index: "+T.length+")"),I.data={category:"tooFewArgs",fn:O,index:T.length,expected:U},I;let B=Math.max.apply(null,H);if(T.length>B)return I=new TypeError("Too many arguments in function "+O+" (expected: "+B+", actual: "+T.length+")"),I.data={category:"tooManyArgs",fn:O,index:T.length,expectedLength:B},I;let ht=[];for(let mt=0;mt<T.length;++mt)ht.push(v(T[mt]).join("|"));return I=new TypeError('Arguments of type "'+ht.join(", ")+'" do not match any of the defined signatures of function '+O+"."),I.data={category:"mismatch",actual:ht},I}function j(E){let T=u.length+1;for(let A=0;A<E.types.length;A++)L(E.types[A])&&(T=Math.min(T,E.types[A].typeIndex));return T}function J(E){let T=h+1;for(let A=0;A<E.types.length;A++)L(E.types[A])||(T=Math.min(T,E.types[A].conversionIndex));return T}function lt(E,T){if(E.hasAny){if(!T.hasAny)return 1}else if(T.hasAny)return-1;if(E.restParam){if(!T.restParam)return 1}else if(T.restParam)return-1;if(E.hasConversion){if(!T.hasConversion)return 1}else if(T.hasConversion)return-1;let A=j(E)-j(T);if(A<0)return-1;if(A>0)return 1;let I=J(E)-J(T);return I<0?-1:I>0?1:0}function at(E,T){let A=E.params,I=T.params,U=zt(A),O=zt(I),V=D(A),z=D(I);if(V&&U.hasAny){if(!z||!O.hasAny)return 1}else if(z&&O.hasAny)return-1;let H=0,B=0,ht;for(ht of A)ht.hasAny&&++H,ht.hasConversion&&++B;let mt=0,Ct=0;for(ht of I)ht.hasAny&&++mt,ht.hasConversion&&++Ct;if(H!==mt)return H-mt;if(V&&U.hasConversion){if(!z||!O.hasConversion)return 1}else if(z&&O.hasConversion)return-1;if(B!==Ct)return B-Ct;if(V){if(!z)return 1}else if(z)return-1;let Zt=(A.length-I.length)*(V?-1:1);if(Zt!==0)return Zt;let qt=[],fe=0;for(let hn=0;hn<A.length;++hn){let sr=lt(A[hn],I[hn]);qt.push(sr),fe+=sr}if(fe!==0)return fe;let de;for(de of qt)if(de!==0)return de;return 0}function pt(E){if(E.length===0)return[];let T=E.map(d);E.length>1&&T.sort((U,O)=>U.index-O.index);let A=T[0].conversionsTo;if(E.length===1)return A;A=A.concat([]);let I=new Set(E);for(let U=1;U<T.length;++U){let O;for(O of T[U].conversionsTo)I.has(O.from)||(A.push(O),I.add(O.from))}return A}function Tt(E,T){let A=T;if(E.some(U=>U.hasConversion)){let U=D(E),O=E.map(wt);A=function(){let z=[],H=U?arguments.length-1:arguments.length;for(let B=0;B<H;B++)z[B]=O[B](arguments[B]);return U&&(z[H]=arguments[H].map(O[H])),T.apply(this,z)}}let I=A;if(D(E)){let U=E.length-1;I=function(){return A.apply(this,Ee(arguments,0,U).concat([Ee(arguments,U)]))}}return I}function wt(E){let T,A,I,U,O=[],V=[];switch(E.types.forEach(function(z){z.conversion&&(O.push(d(z.conversion.from).test),V.push(z.conversion.convert))}),V.length){case 0:return function(H){return H};case 1:return T=O[0],I=V[0],function(H){return T(H)?I(H):H};case 2:return T=O[0],A=O[1],I=V[0],U=V[1],function(H){return T(H)?I(H):A(H)?U(H):H};default:return function(H){for(let B=0;B<V.length;B++)if(O[B](H))return V[B](H);return H}}}function St(E){function T(A,I,U){if(I<A.length){let O=A[I],V=[];if(O.restParam){let z=O.types.filter(L);z.length<O.types.length&&V.push({types:z,name:"..."+z.map(H=>H.name).join("|"),hasAny:z.some(H=>H.isAny),hasConversion:!1,restParam:!0}),V.push(O)}else V=O.types.map(function(z){return{types:[z],name:z.name,hasAny:z.isAny,hasConversion:z.conversion,restParam:!1}});return Un(V,function(z){return T(A,I+1,U.concat([z]))})}else return[U]}return T(E,0,[])}function xt(E,T){let A=Math.max(E.length,T.length);for(let z=0;z<A;z++){let H=k(E,z),B=k(T,z),ht=!1,mt;for(mt of B)if(H.has(mt)){ht=!0;break}if(!ht)return!1}let I=E.length,U=T.length,O=D(E),V=D(T);return O?V?I===U:U>=I:V?I>=U:I===U}function $t(E){return E.map(T=>ds(T)?ps(T.referToSelf.callback):fs(T)?or(T.referTo.references,T.referTo.callback):T)}function Mt(E,T,A){let I=[],U;for(U of E){let O=A[U];if(typeof O!="number")throw new TypeError('No definition for referenced signature "'+U+'"');if(O=T[O],typeof O!="function")return!1;I.push(O)}return I}function gt(E,T,A){let I=$t(E),U=new Array(I.length).fill(!1),O=!0;for(;O;){O=!1;let V=!0;for(let z=0;z<I.length;++z){if(U[z])continue;let H=I[z];if(ds(H))I[z]=H.referToSelf.callback(A),I[z].referToSelf=H.referToSelf,U[z]=!0,V=!1;else if(fs(H)){let B=Mt(H.referTo.references,I,T);B?(I[z]=H.referTo.callback.apply(this,B),I[z].referTo=H.referTo,U[z]=!0,V=!1):O=!0}}if(V&&O)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return I}function se(E){let T=/\bthis(\(|\.signatures\b)/;Object.keys(E).forEach(A=>{let I=E[A];if(T.test(I.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Ot(E,T){if(f.createCount++,Object.keys(T).length===0)throw new SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&se(T);let A=[],I=[],U={},O=[],V;for(V in T){if(!Object.prototype.hasOwnProperty.call(T,V))continue;let ut=P(V);if(!ut)continue;A.forEach(function(zn){if(xt(zn,ut))throw new TypeError('Conflicting signatures "'+_(zn)+'" and "'+_(ut)+'".')}),A.push(ut);let Kt=I.length;I.push(T[V]);let th=ut.map(w),ar;for(ar of St(th)){let zn=_(ar);O.push({params:ar,name:zn,fn:Kt}),ar.every(eh=>!eh.hasConversion)&&(U[zn]=Kt)}}O.sort(at);let z=gt(I,U,Bn),H;for(H in U)Object.prototype.hasOwnProperty.call(U,H)&&(U[H]=z[U[H]]);let B=[],ht=new Map;for(H of O)ht.has(H.name)||(H.fn=z[H.fn],B.push(H),ht.set(H.name,H));let mt=B[0]&&B[0].params.length<=2&&!D(B[0].params),Ct=B[1]&&B[1].params.length<=2&&!D(B[1].params),Zt=B[2]&&B[2].params.length<=2&&!D(B[2].params),qt=B[3]&&B[3].params.length<=2&&!D(B[3].params),fe=B[4]&&B[4].params.length<=2&&!D(B[4].params),de=B[5]&&B[5].params.length<=2&&!D(B[5].params),hn=mt&&Ct&&Zt&&qt&&fe&&de;for(let ut=0;ut<B.length;++ut)B[ut].test=W(B[ut].params);let sr=mt?R(B[0].params[0]):e,Tc=Ct?R(B[1].params[0]):e,Cc=Zt?R(B[2].params[0]):e,Ac=qt?R(B[3].params[0]):e,Pc=fe?R(B[4].params[0]):e,Dc=de?R(B[5].params[0]):e,Ic=mt?R(B[0].params[1]):e,Rc=Ct?R(B[1].params[1]):e,Nc=Zt?R(B[2].params[1]):e,Lc=qt?R(B[3].params[1]):e,Oc=fe?R(B[4].params[1]):e,Fc=de?R(B[5].params[1]):e;for(let ut=0;ut<B.length;++ut)B[ut].implementation=Tt(B[ut].params,B[ut].fn);let Uc=mt?B[0].implementation:t,Bc=Ct?B[1].implementation:t,zc=Zt?B[2].implementation:t,Gc=qt?B[3].implementation:t,kc=fe?B[4].implementation:t,Vc=de?B[5].implementation:t,Hc=mt?B[0].params.length:-1,Wc=Ct?B[1].params.length:-1,qc=Zt?B[2].params.length:-1,Xc=qt?B[3].params.length:-1,jc=fe?B[4].params.length:-1,Yc=de?B[5].params.length:-1,$c=hn?6:0,Zc=B.length,Kc=B.map(ut=>ut.test),Jc=B.map(ut=>ut.implementation),Qc=function(){for(let Kt=$c;Kt<Zc;Kt++)if(Kc[Kt](arguments))return Jc[Kt].apply(this,arguments);return f.onMismatch(E,arguments,B)};function Bn(ut,Kt){return arguments.length===Hc&&sr(ut)&&Ic(Kt)?Uc.apply(this,arguments):arguments.length===Wc&&Tc(ut)&&Rc(Kt)?Bc.apply(this,arguments):arguments.length===qc&&Cc(ut)&&Nc(Kt)?zc.apply(this,arguments):arguments.length===Xc&&Ac(ut)&&Lc(Kt)?Gc.apply(this,arguments):arguments.length===jc&&Pc(ut)&&Oc(Kt)?kc.apply(this,arguments):arguments.length===Yc&&Dc(ut)&&Fc(Kt)?Vc.apply(this,arguments):Qc.apply(this,arguments)}try{Object.defineProperty(Bn,"name",{value:E})}catch{}return Bn.signatures=U,Bn._typedFunctionData={signatures:B,signatureMap:ht},Bn}function ct(E,T,A){throw Y(E,T,A)}function It(E){return Ee(E,0,E.length-1)}function zt(E){return E[E.length-1]}function Ee(E,T,A){return Array.prototype.slice.call(E,T,A)}function Ge(E,T){for(let A=0;A<E.length;A++)if(T(E[A]))return E[A]}function Un(E,T){return Array.prototype.concat.apply([],E.map(T))}function cn(){let E=It(arguments).map(A=>_(P(A))),T=zt(arguments);if(typeof T!="function")throw new TypeError("Callback function expected as last argument");return or(E,T)}function or(E,T){return{referTo:{references:E,callback:T}}}function ps(E){if(typeof E!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:E}}}function fs(E){return E&&typeof E.referTo=="object"&&Array.isArray(E.referTo.references)&&typeof E.referTo.callback=="function"}function ds(E){return E&&typeof E.referToSelf=="object"&&typeof E.referToSelf.callback=="function"}function gs(E,T){if(!E)return T;if(T&&T!==E){let A=new Error("Function names do not match (expected: "+E+", actual: "+T+")");throw A.data={actual:T,expected:E},A}return E}function Sc(E){let T;for(let A in E)Object.prototype.hasOwnProperty.call(E,A)&&(b(E[A])||typeof E[A].signature=="string")&&(T=gs(T,E[A].name));return T}function Mc(E,T){let A;for(A in T)if(Object.prototype.hasOwnProperty.call(T,A)){if(A in E&&T[A]!==E[A]){let I=new Error('Signature "'+A+'" is defined twice');throw I.data={signature:A,sourceFunction:T[A],destFunction:E[A]},I}E[A]=T[A]}}let wc=f;f=function(E){let T=typeof E=="string",A=T?1:0,I=T?E:"",U={};for(let O=A;O<arguments.length;++O){let V=arguments[O],z={},H;if(typeof V=="function"?(H=V.name,typeof V.signature=="string"?z[V.signature]=V:b(V)&&(z=V.signatures)):a(V)&&(z=V,T||(H=Sc(V))),Object.keys(z).length===0){let B=new TypeError("Argument to 'typed' at index "+O+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw B.data={index:O,argument:V},B}T||(I=gs(I,H)),Mc(U,z)}return Ot(I||"",U)},f.create=i,f.createCount=wc.createCount,f.onMismatch=ct,f.throwMismatchError=ct,f.createError=Y,f.clear=p,f.clearConversions=m,f.addTypes=g,f._findType=d,f.referTo=cn,f.referToSelf=ps,f.convert=x,f.findSignature=y,f.find=S,f.isTypedFunction=b,f.warnAgainstDeprecatedThis=!0,f.addType=function(E,T){let A="any";T!==!1&&s.has("Object")&&(A="Object"),f.addTypes([E],A)};function ms(E){if(!E||typeof E.from!="string"||typeof E.to!="string"||typeof E.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(E.to===E.from)throw new SyntaxError('Illegal to define conversion from "'+E.from+'" to itself.')}return f.addConversion=function(E){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};ms(E);let A=d(E.to),I=A.conversionsTo.find(U=>U.from===E.from);if(I)if(T&&T.override)f.removeConversion({from:I.from,to:E.to,convert:I.convert});else throw new Error('There is already a conversion from "'+E.from+'" to "'+A.name+'"');A.conversionsTo.push({from:E.from,convert:E.convert,index:h++})},f.addConversions=function(E,T){E.forEach(A=>f.addConversion(A,T))},f.removeConversion=function(E){ms(E);let T=d(E.to),A=Ge(T.conversionsTo,U=>U.from===E.from);if(!A)throw new Error("Attempt to remove nonexistent conversion from "+E.from+" to "+E.to);if(A.convert!==E.convert)throw new Error("Conversion to remove does not match existing conversion");let I=T.conversionsTo.indexOf(A);T.conversionsTo.splice(I,1)},f.resolve=function(E,T){if(!b(E))throw new TypeError(n);let A=E._typedFunctionData.signatures;for(let I=0;I<A.length;++I)if(A[I].test(T))return A[I];return null},f}var o=i();return o})});var qu=Re((no,Wu)=>{(function(r){"use strict";var e=Math.cosh||function(s){return Math.abs(s)<1e-9?1-s:(Math.exp(s)+Math.exp(-s))*.5},t=Math.sinh||function(s){return Math.abs(s)<1e-9?s:(Math.exp(s)-Math.exp(-s))*.5},n=function(s){var u=Math.PI/4;if(-u>s||s>u)return Math.cos(s)-1;var h=s*s;return h*(h*(h*(h*(h*(h*(h*(h/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},i=function(s,u){var h=Math.abs(s),f=Math.abs(u);return h<3e3&&f<3e3?Math.sqrt(h*h+f*f):(h<f?(h=f,f=s/u):f=u/s,h*Math.sqrt(1+f*f))},o=function(){throw SyntaxError("Invalid Param")};function a(s,u){var h=Math.abs(s),f=Math.abs(u);return s===0?Math.log(f):u===0?Math.log(h):h<3e3&&f<3e3?Math.log(s*s+u*u)*.5:(s=s/2,u=u/2,.5*Math.log(s*s+u*u)+Math.LN2)}var c=function(s,u){var h={re:0,im:0};if(s==null)h.re=h.im=0;else if(u!==void 0)h.re=s,h.im=u;else switch(typeof s){case"object":if("im"in s&&"re"in s)h.re=s.re,h.im=s.im;else if("abs"in s&&"arg"in s){if(!Number.isFinite(s.abs)&&Number.isFinite(s.arg))return l.INFINITY;h.re=s.abs*Math.cos(s.arg),h.im=s.abs*Math.sin(s.arg)}else if("r"in s&&"phi"in s){if(!Number.isFinite(s.r)&&Number.isFinite(s.phi))return l.INFINITY;h.re=s.r*Math.cos(s.phi),h.im=s.r*Math.sin(s.phi)}else s.length===2?(h.re=s[0],h.im=s[1]):o();break;case"string":h.im=h.re=0;var f=s.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),d=1,g=0;f===null&&o();for(var p=0;p<f.length;p++){var m=f[p];m===" "||m===" "||m===`
2
- `||(m==="+"?d++:m==="-"?g++:m==="i"||m==="I"?(d+g===0&&o(),f[p+1]!==" "&&!isNaN(f[p+1])?(h.im+=parseFloat((g%2?"-":"")+f[p+1]),p++):h.im+=parseFloat((g%2?"-":"")+"1"),d=g=0):((d+g===0||isNaN(m))&&o(),f[p+1]==="i"||f[p+1]==="I"?(h.im+=parseFloat((g%2?"-":"")+m),p++):h.re+=parseFloat((g%2?"-":"")+m),d=g=0))}d+g>0&&o();break;case"number":h.im=0,h.re=s;break;default:o()}return isNaN(h.re)||isNaN(h.im),h};function l(s,u){if(!(this instanceof l))return new l(s,u);var h=c(s,u);this.re=h.re,this.im=h.im}l.prototype={re:0,im:0,sign:function(){var s=this.abs();return new l(this.re/s,this.im/s)},add:function(s,u){var h=new l(s,u);return this.isInfinite()&&h.isInfinite()?l.NAN:this.isInfinite()||h.isInfinite()?l.INFINITY:new l(this.re+h.re,this.im+h.im)},sub:function(s,u){var h=new l(s,u);return this.isInfinite()&&h.isInfinite()?l.NAN:this.isInfinite()||h.isInfinite()?l.INFINITY:new l(this.re-h.re,this.im-h.im)},mul:function(s,u){var h=new l(s,u);return this.isInfinite()&&h.isZero()||this.isZero()&&h.isInfinite()?l.NAN:this.isInfinite()||h.isInfinite()?l.INFINITY:h.im===0&&this.im===0?new l(this.re*h.re,0):new l(this.re*h.re-this.im*h.im,this.re*h.im+this.im*h.re)},div:function(s,u){var h=new l(s,u);if(this.isZero()&&h.isZero()||this.isInfinite()&&h.isInfinite())return l.NAN;if(this.isInfinite()||h.isZero())return l.INFINITY;if(this.isZero()||h.isInfinite())return l.ZERO;s=this.re,u=this.im;var f=h.re,d=h.im,g,p;return d===0?new l(s/f,u/f):Math.abs(f)<Math.abs(d)?(p=f/d,g=f*p+d,new l((s*p+u)/g,(u*p-s)/g)):(p=d/f,g=d*p+f,new l((s+u*p)/g,(u-s*p)/g))},pow:function(s,u){var h=new l(s,u);if(s=this.re,u=this.im,h.isZero())return l.ONE;if(h.im===0){if(u===0&&s>0)return new l(Math.pow(s,h.re),0);if(s===0)switch((h.re%4+4)%4){case 0:return new l(Math.pow(u,h.re),0);case 1:return new l(0,Math.pow(u,h.re));case 2:return new l(-Math.pow(u,h.re),0);case 3:return new l(0,-Math.pow(u,h.re))}}if(s===0&&u===0&&h.re>0&&h.im>=0)return l.ZERO;var f=Math.atan2(u,s),d=a(s,u);return s=Math.exp(h.re*d-h.im*f),u=h.im*d+h.re*f,new l(s*Math.cos(u),s*Math.sin(u))},sqrt:function(){var s=this.re,u=this.im,h=this.abs(),f,d;if(s>=0){if(u===0)return new l(Math.sqrt(s),0);f=.5*Math.sqrt(2*(h+s))}else f=Math.abs(u)/Math.sqrt(2*(h-s));return s<=0?d=.5*Math.sqrt(2*(h-s)):d=Math.abs(u)/Math.sqrt(2*(h+s)),new l(f,u<0?-d:d)},exp:function(){var s=Math.exp(this.re);return this.im,new l(s*Math.cos(this.im),s*Math.sin(this.im))},expm1:function(){var s=this.re,u=this.im;return new l(Math.expm1(s)*Math.cos(u)+n(u),Math.exp(s)*Math.sin(u))},log:function(){var s=this.re,u=this.im;return u===0&&s>0,new l(a(s,u),Math.atan2(u,s))},abs:function(){return i(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var s=this.re,u=this.im;return new l(Math.sin(s)*e(u),Math.cos(s)*t(u))},cos:function(){var s=this.re,u=this.im;return new l(Math.cos(s)*e(u),-Math.sin(s)*t(u))},tan:function(){var s=2*this.re,u=2*this.im,h=Math.cos(s)+e(u);return new l(Math.sin(s)/h,t(u)/h)},cot:function(){var s=2*this.re,u=2*this.im,h=Math.cos(s)-e(u);return new l(-Math.sin(s)/h,t(u)/h)},sec:function(){var s=this.re,u=this.im,h=.5*e(2*u)+.5*Math.cos(2*s);return new l(Math.cos(s)*e(u)/h,Math.sin(s)*t(u)/h)},csc:function(){var s=this.re,u=this.im,h=.5*e(2*u)-.5*Math.cos(2*s);return new l(Math.sin(s)*e(u)/h,-Math.cos(s)*t(u)/h)},asin:function(){var s=this.re,u=this.im,h=new l(u*u-s*s+1,-2*s*u).sqrt(),f=new l(h.re-u,h.im+s).log();return new l(f.im,-f.re)},acos:function(){var s=this.re,u=this.im,h=new l(u*u-s*s+1,-2*s*u).sqrt(),f=new l(h.re-u,h.im+s).log();return new l(Math.PI/2-f.im,f.re)},atan:function(){var s=this.re,u=this.im;if(s===0){if(u===1)return new l(0,1/0);if(u===-1)return new l(0,-1/0)}var h=s*s+(1-u)*(1-u),f=new l((1-u*u-s*s)/h,-2*s/h).log();return new l(-.5*f.im,.5*f.re)},acot:function(){var s=this.re,u=this.im;if(u===0)return new l(Math.atan2(1,s),0);var h=s*s+u*u;return h!==0?new l(s/h,-u/h).atan():new l(s!==0?s/0:0,u!==0?-u/0:0).atan()},asec:function(){var s=this.re,u=this.im;if(s===0&&u===0)return new l(0,1/0);var h=s*s+u*u;return h!==0?new l(s/h,-u/h).acos():new l(s!==0?s/0:0,u!==0?-u/0:0).acos()},acsc:function(){var s=this.re,u=this.im;if(s===0&&u===0)return new l(Math.PI/2,1/0);var h=s*s+u*u;return h!==0?new l(s/h,-u/h).asin():new l(s!==0?s/0:0,u!==0?-u/0:0).asin()},sinh:function(){var s=this.re,u=this.im;return new l(t(s)*Math.cos(u),e(s)*Math.sin(u))},cosh:function(){var s=this.re,u=this.im;return new l(e(s)*Math.cos(u),t(s)*Math.sin(u))},tanh:function(){var s=2*this.re,u=2*this.im,h=e(s)+Math.cos(u);return new l(t(s)/h,Math.sin(u)/h)},coth:function(){var s=2*this.re,u=2*this.im,h=e(s)-Math.cos(u);return new l(t(s)/h,-Math.sin(u)/h)},csch:function(){var s=this.re,u=this.im,h=Math.cos(2*u)-e(2*s);return new l(-2*t(s)*Math.cos(u)/h,2*e(s)*Math.sin(u)/h)},sech:function(){var s=this.re,u=this.im,h=Math.cos(2*u)+e(2*s);return new l(2*e(s)*Math.cos(u)/h,-2*t(s)*Math.sin(u)/h)},asinh:function(){var s=this.im;this.im=-this.re,this.re=s;var u=this.asin();return this.re=-this.im,this.im=s,s=u.re,u.re=-u.im,u.im=s,u},acosh:function(){var s=this.acos();if(s.im<=0){var u=s.re;s.re=-s.im,s.im=u}else{var u=s.im;s.im=-s.re,s.re=u}return s},atanh:function(){var s=this.re,u=this.im,h=s>1&&u===0,f=1-s,d=1+s,g=f*f+u*u,p=g!==0?new l((d*f-u*u)/g,(u*f+d*u)/g):new l(s!==-1?s/0:0,u!==0?u/0:0),m=p.re;return p.re=a(p.re,p.im)/2,p.im=Math.atan2(p.im,m)/2,h&&(p.im=-p.im),p},acoth:function(){var s=this.re,u=this.im;if(s===0&&u===0)return new l(0,Math.PI/2);var h=s*s+u*u;return h!==0?new l(s/h,-u/h).atanh():new l(s!==0?s/0:0,u!==0?-u/0:0).atanh()},acsch:function(){var s=this.re,u=this.im;if(u===0)return new l(s!==0?Math.log(s+Math.sqrt(s*s+1)):1/0,0);var h=s*s+u*u;return h!==0?new l(s/h,-u/h).asinh():new l(s!==0?s/0:0,u!==0?-u/0:0).asinh()},asech:function(){var s=this.re,u=this.im;if(this.isZero())return l.INFINITY;var h=s*s+u*u;return h!==0?new l(s/h,-u/h).acosh():new l(s!==0?s/0:0,u!==0?-u/0:0).acosh()},inverse:function(){if(this.isZero())return l.INFINITY;if(this.isInfinite())return l.ZERO;var s=this.re,u=this.im,h=s*s+u*u;return new l(s/h,-u/h)},conjugate:function(){return new l(this.re,-this.im)},neg:function(){return new l(-this.re,-this.im)},ceil:function(s){return s=Math.pow(10,s||0),new l(Math.ceil(this.re*s)/s,Math.ceil(this.im*s)/s)},floor:function(s){return s=Math.pow(10,s||0),new l(Math.floor(this.re*s)/s,Math.floor(this.im*s)/s)},round:function(s){return s=Math.pow(10,s||0),new l(Math.round(this.re*s)/s,Math.round(this.im*s)/s)},equals:function(s,u){var h=new l(s,u);return Math.abs(h.re-this.re)<=l.EPSILON&&Math.abs(h.im-this.im)<=l.EPSILON},clone:function(){return new l(this.re,this.im)},toString:function(){var s=this.re,u=this.im,h="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(s)<l.EPSILON&&(s=0),Math.abs(u)<l.EPSILON&&(u=0),u===0?h+s:(s!==0?(h+=s,h+=" ",u<0?(u=-u,h+="-"):h+="+",h+=" "):u<0&&(u=-u,h+="-"),u!==1&&(h+=u),h+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},l.ZERO=new l(0,0),l.ONE=new l(1,0),l.I=new l(0,1),l.PI=new l(Math.PI,0),l.E=new l(Math.E,0),l.INFINITY=new l(1/0,1/0),l.NAN=new l(NaN,NaN),l.EPSILON=1e-15,typeof define=="function"&&define.amd?define([],function(){return l}):typeof no=="object"?(Object.defineProperty(l,"__esModule",{value:!0}),l.default=l,l.Complex=l,Wu.exports=l):r.Complex=l})(no)});import{EventDispatcher as Bf,Vector3 as zf}from"three";var Gt=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(e){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),e()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(e){this.tasks.requestAnimation.delete(e),window.cancelAnimationFrame(e)}setTimeout(e,t){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),e()},t);return this.tasks.timeout.add(n),n}clearTimeout(e){this.tasks.timeout.delete(e),window.clearTimeout(e)}setInterval(e,t){let n=window.setInterval(()=>{this.tasks.interval.delete(n),e()},t);return this.tasks.interval.add(n),n}clearInterval(e){this.tasks.interval.delete(e),window.clearInterval(e)}dispose(){this.tasks.requestAnimation.forEach(e=>{window.cancelAnimationFrame(e)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(e=>{window.clearTimeout(e)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(e=>{window.clearInterval(e)}),this.tasks.interval.clear()}};import{Shape as uh,Group as lh,DirectionalLight as ch,AmbientLight as hh,Path as ph,Vector2 as vs}from"three";function _s(){let r=new lh,e=new hh(16777215,2.6);return r.add(e),r}function be(r,e=[]){let t=new uh(r.map(n=>new vs(...n)));return e.length&&e.forEach(n=>{var i=new ph(n.map(o=>new vs(...o)));t.holes.push(i)}),t}function xs(r=16777215,e=1){let t=new ch(r,e);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function Jt(r,e){if(e&&r.children&&r.children.length&&r.children.forEach(t=>{Jt(t,e)}),r.isMesh){let t=r;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n.dispose()}):t.material.dispose())}r.isLight&&r.dispose?.()}function Es(r){return/[\u4E00-\u9FA5]+/g.test(r)}import{Vector3 as bi,Vector2 as Ne,Matrix3 as ur}from"three";import{point as fh,featureCollection as dh,center as gh}from"@turf/turf";function et(r,e,t,n){let i=r.clone().project(e),o=t/2,a=n/2,c=Math.round(i.x*o+o),l=Math.round(-i.y*a+a);return{x:c,y:l}}function lr(r){let e=dh(r.map(n=>fh(n)));return gh(e).geometry.coordinates}function ke(r,e,t){return r.x>=e.x&&r.x<=t.x&&r.y>=e.y&&r.y<=t.y}function yv(r){let e=0,t=new bi;for(let n=1;n<r.length;n++){let i=new bi(r[n-1][0],r[n-1][1],0),o=new bi(r[n][0],r[n][1],0),a=o.distanceTo(i);a>e&&(e=a,t=o.clone().sub(i).normalize())}return t}function kt(r,e){return Math.sqrt((e[0]-r[0])**2+(e[1]-r[1])**2)}function Se(r){let e=0;for(let t=0;t<r.length-1;t++)e+=kt(r[t],r[t+1]);return e}function bs(r,e,t){let n=new Ne(e[0]-r[0],e[1]-r[1]),i=new Ne(e[0]-t[0],e[1]-t[1]),a=n.angleTo(i)*180/Math.PI,c=new Ne(e[0]-r[0],e[1]-r[1]);return new Ne(t[0]-r[0],t[1]-r[1]).cross(c)>0?a:-a}function Ss(r,e){let t=Math.min(kt(r[0][0],r[0][1]),kt(r[0][2],r[0][1]))-1;e||(e=lr(r[0]));let n=mh(e,t),i=new Ne(r[0][0][0],r[0][0][1]),o=new Ne(r[0][1][0],r[0][1][1]),a=new Ne(r[0][2][0],r[0][2][1]),l=(i.distanceTo(o)>o.distanceTo(a)?o.clone().sub(i):a.clone().sub(o)).angleTo(new Ne(0,1)),s=new ur;return s.multiply(new ur().translate(e[0],e[1])).multiply(new ur().rotate(l)).multiply(new ur().translate(-e[0],-e[1])),[n.map(u=>{let h=new Ne(u[0],u[1]).applyMatrix3(s);return[h.x,h.y]})]}function mh(r,e){let t=e/2;return[[r[0]-t,r[1]+t],[r[0]+t,r[1]+t],[r[0]+t,r[1]-t],[r[0]-t,r[1]-t],[r[0]-t,r[1]+t]]}function fn(r,e){let t=0,n=1/0,[i,o]=e;for(let a=0;a<r.length-1;a++){let[c,l]=r[a],[s,u]=r[a+1],h=Math.min(c,s)<=i&&i<=Math.max(c,s),f=Math.min(l,u)<=o&&o<=Math.max(l,u);if(h&&f){let d=Math.abs((s-c)*(o-l)-(u-l)*(i-c));d<n&&(n=d,t=a)}}return t}function Ms(r,e){let t=r[0],n=r[1],i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let c=e[o][0],l=e[o][1],s=e[a][0],u=e[a][1];l>n!=u>n&&t<(s-c)*(n-l)/(u-l)+c&&(i=!i)}return i}function dn(r,e){return new Proxy(r,{get:(t,n,i)=>Reflect.get(t,n,i),set:(t,n,i,o)=>{let a=Reflect.get(t,n,o),c=Reflect.set(t,n,i,o);return a!==i&&e.dispatchEvent({type:`change-${n}`,value:i}),c}})}function tn(r,e){return Promise.race([r,new Promise((t,n)=>{setTimeout(()=>n(new Error("Promise timeout")),e)})])}function cr(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function ws(r,e){let t=cr("svg");return t.setAttribute("width",r),t.setAttribute("height",e),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function Gn(r="2",e){let t=cr("circle");return t.setAttribute("r",r),t.setAttribute("fill",e),t}function hr(r){let e=cr("line");return e.setAttribute("stroke",r),e}function Ve(r,e){let t=cr("rect");return t.setAttribute("stroke",r),t.setAttribute("fill",e),t}function en(r,e,t){r.setAttribute("cx",`${e}`),r.setAttribute("cy",`${t}`)}function ge(r,e,t){e&&(r.setAttribute("x1",`${e.x}`),r.setAttribute("y1",`${e.y}`)),t&&(r.setAttribute("x2",`${t.x}`),r.setAttribute("y2",`${t.y}`))}function Xt(r,e,t,n,i){r.setAttribute("x",`${e}`),r.setAttribute("y",`${t}`),r.setAttribute("width",`${n}`),r.setAttribute("height",`${i}`)}function Ts(){return Promise.resolve()}function bv(){return new Promise(r=>{requestAnimationFrame(r)})}function Mv(r){return parseInt(r.replace("#","0x"),16)}function wv(r,e){let t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(t*e),a=Math.round(n*e),c=Math.round(i*e);return`#${(1<<24|o<<16|a<<8|c).toString(16).slice(1)}`}function Le(r,e=.85){let t,n,i;if(r.startsWith("#"))t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let a=r.slice(4,-1).split(",");t=parseInt(a[0].trim()),n=parseInt(a[1].trim()),i=parseInt(a[2].trim())}return t=Math.min(Math.floor(t*e),255),n=Math.min(Math.floor(n*e),255),i=Math.min(Math.floor(i*e),255),"#"+((1<<24)+(t<<16)+(n<<8)+i).toString(16).slice(1)}function Si(r,e){r=r.replace(/^#/,"");let t=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return e!==void 0?`rgba(${t}, ${n}, ${i}, ${e})`:`rgb(${t}, ${n}, ${i})`}var gn=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,Cs=(window.navigator.userAgent||"").toLocaleLowerCase(),kn=/ios|iphone/i.test(Cs),Cv=/android|adr|linux/gi.test(Cs);function mn(r){return gn?r==="Meta":r==="Control"}var Mi="__once__",As=class{events=new Map;on(e,t){if(typeof t!="function")return;let n=this.events.get(e);return n?n.add(t):this.events.set(e,new Set([t]))}once(e,t){if(typeof t!="function")return;let n=`${Mi}${e}`,i=this.events.get(n);return i?i.add(t):this.events.set(n,new Set([t]))}off(e,t){let n=this.events.get(e),i=this.events.get(`${Mi}${e}`);!n&&!i||(t===void 0&&(n?.clear(),i?.clear()),n?.has(t)&&n.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(e,...t){let n=this.events.get(e),i=this.events.get(`${Mi}${e}`);!n&&!i||(n?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.clear())}};var Vn=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(Vn||{});function yn(r){return Object.keys(r).sort().map(e=>`${e}=${r[e]}`).join("&")}function Lv(r,e){return new Promise((t,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(e.headers||{}).forEach(o=>{i.setRequestHeader(o,e.headers[o])}),e.responseType&&(i.responseType=e.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(e.responseType==="arraybuffer")t(i.response);else try{let o=JSON.parse(i.responseText);t(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var Ls=pn(Ns(),1);import{Vector2 as Hn}from"three";function yh(r,e){let t=r.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function vh(r){let e=0;return r.reduce(([t,n],[i,o])=>(e+=Math.sqrt((i-t)**2+(o-n)**2),[i,o])),e/r.length}function Os(r,e=.25){if(vh(r)<e)return r;let t=(0,Ls.default)(r);return Os(t,e)}function Fs(r,e=!1,t=!0,n=5,i=150,o=3){let a=[],c=!e;if(a.push(r[0]),r.length<2)return a;for(let s=0;s<r.length-2;s+=1){let u=r[s],h=r[s+1],f=r[s+2],d=new Hn(u[0]-h[0],u[1]-h[1]),g=new Hn(f[0]-h[0],f[1]-h[1]),p=yh(d,g)/Math.PI*180,m=d.length()+g.length();(!c||p<i&&m>.01||m>n)&&(a.push(r[s+1]),c=!0)}if(a.push(r[r.length-1]),!t)return a;let l=[];l.push(a[0]);for(let s=0;s<a.length-2;s+=1){let u=new Hn(a[s][0],a[s][1]),h=new Hn(a[s+1][0],a[s+1][1]),f=new Hn(a[s+2][0],a[s+2][1]),d=u.distanceTo(h)/2,g=f.distanceTo(h)/2,p=h.clone(),m=h.clone();p.add(u.clone().sub(h).normalize().multiplyScalar(d>o?o/2:d)),m.add(f.clone().sub(h).normalize().multiplyScalar(g>o?o/2:g));let v=[[p.x,p.y],[h.x,h.y],[m.x,m.y]];l.push(...Os(v,o/25))}return l.push(a[a.length-1]),_h(l)}function _h(r){if(r.length<=1)return r;let e=[],t;return r.forEach(([n,i])=>{t?n===t[0]&&i===t[1]||(t=[n,i],e.push([n,i])):(t=[n,i],e.push([n,i]))}),e}function Us(r,e,t){let n=Math.sqrt((t[0]-e[0])**2+(t[1]-e[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2),closestPoint:e.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-e[0])*(t[0]-e[0])+(r[1]-e[1])*(t[1]-e[1]))/n**2)),o=[e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function Gv(r,e,t){let[n,i]=r,[o,a]=e,c=Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2));if(c===0||c<t)return[...e];let l=t/c,s=n+(o-n)*l,u=i+(a-i)*l;return[s,u]}var Bs=(s=>(s.START="start",s.END="end",s.FRONT="front",s.RIGHT="right",s.LEFT="left",s.RIGHT_FRONT="right_front",s.LEFT_FRONT="left_front",s.RIGHT_BACK="right_back",s.LEFT_BACK="left_back",s))(Bs||{});function wi(r,e,t){let n=bs(r,e,t);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function kv(r){if(!r.length)return[];let e=[{direction:"start",distance:kt(r[0],r[1]),points:[r[0],r[1]]}];for(let t=2;t<r.length;t++){let n=wi(r[t-2],r[t-1],r[t]);if(n==="front"){let i=e[e.length-1],o=kt(r[t-1],r[t]);i.distance+=o,t!==2&&i.points.push(r[t-1])}else e.push({direction:n,distance:kt(r[t-1],r[t]),points:[r[t-1],r[t]]})}return e.push({direction:"end",distance:0,points:[r[r.length-1]]}),e}function zs(r,e){if(r.length<2)return-1;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=[e[0]-i[0],e[1]-i[1]],c=[o[0]-i[0],o[1]-i[1]],l=Math.min(o[0],i[0])<=e[0]&&e[0]<=Math.max(o[0],i[0]),s=Math.min(o[1],i[1])<=e[1]&&e[1]<=Math.max(o[1],i[1]);if(l&&s){let u=a[0]*c[1]-a[1]*c[0];if(Math.abs(u)<1e-6){let h=Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2);return t+h}}t+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function pr(r,e){if(r.length<2)return r[0]??null;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2);if(t+=a,t>=e){let c=(e-(t-a))/a,l=i[0]+(o[0]-i[0])*c,s=i[1]+(o[1]-i[1])*c;return[l,s]}}return null}var Me=pn(Ai(),1);var ae="___",ta=class{constructor(e=3){this.lift_priority=e}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new Me.default;escalatorRoute=new Me.default;straightLadderRoute=new Me.default;initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(t=>{t.points.forEach(n=>{let i=`${t.floor}${ae}${n.id}`;if(this.pointMap.set(i,n),this.nodeMap.set(`${n.floor}${ae}${n.nodeId}`,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push({...n}),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push({...n}),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push({...n}),this.facilityMap.set(n.targetId,o)}}),t.lines.filter(n=>n.direction!=="no").forEach(n=>{let i=`${t.floor}${ae}${n.from}`,o=`${t.floor}${ae}${n.to}`,a=this.pointMap.get(i)?.cds,c=this.pointMap.get(o)?.cds;if(a?.length&&c?.length){let l=kt(a,c);this.addLineItem(i,o,l),n.direction==="double"&&this.addLineItem(o,i,l)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let c=0;c<a.length;c++){let l=`${a[c].floor}${ae}${a[c].id}`;for(let s=0;s<a.length;s++)if(c!==s){let u=`${a[s].floor}${ae}${a[s].id}`,h=this.pointMap.get(l)?.cds,f=this.pointMap.get(u)?.cds;if(h?.length&&f?.length)if(a[c].type==="straightLadder"){let d=t;this.addLineItem(l,u,d,i)}else{let d=n;this.addLineItem(l,u,d,i)}}}}),this.escalatorMap.forEach((o,a)=>{if(o.start&&o.end){let c=`${o.start.floor}${ae}${o.start.id}`,l=`${o.end.floor}${ae}${o.end.id}`,s=this.pointMap.get(c)?.cds,u=this.pointMap.get(l)?.cds;if(s?.length&&u?.length){let h=e;this.addLineItem(c,l,h,i)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new Me.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new Me.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new Me.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${ae}${e.nodeId}`);if(t){let[n,i]=t.split(ae);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{let a=kt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:n.point.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let c=this.facilityMap.get(o.facility).filter(s=>o.floor?s.floor===o.floor:!0);if(!c.length)return null;let l=c.map(s=>a(i,{floor:s.floor,id:s.id})).filter(s=>!!s);return l.reduce((s,u)=>{let h=u.reduce((f,d)=>f+Se(d.points),0);return h<s.distance&&(s.distance=h,s.path=u),s},{distance:1/0,path:l[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${ae}${e.id}`,o=`${t.floor}${ae}${t.id}`,a=n.path(i,o);if(!a)return null;let c=[];return a.map(l=>{let s=this.pointMap.get(l);if(s){let{floor:u}=s;if(c[c.length-1]?.floor===u){let h=c[c.length-1];h.points.push(s.cds),h.endType=s.type,h.destId=s.nodeId,h.distance=Se(h.points)}else c.push({floor:u,points:[s.cds],endType:s.type,destId:s.nodeId,distance:0})}}),c}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new Me.default,this.escalatorRoute=new Me.default,this.straightLadderRoute=new Me.default}};var ue=pn(Ai(),1);import{cloneDeep as Pi}from"lodash";var Vt="___",ea=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new ue.default;escalatorRoute=new ue.default;straightLadderRoute=new ue.default;forwardLineMap=new Map;forwardRoute=new ue.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(t=>{let n=[];try{n=JSON.parse(t.entry_end_floor)}catch{n=[]}let i=[];try{i=JSON.parse(t.entry_start_floor)}catch{i=[]}return{...t,entry_start_floor:i,entry_end_floor:n}})}initRoute(e,t){this.clear(),this.roadInfo=e,this.initFacilities(t),e.length&&(e.forEach(n=>{n.points.forEach(i=>{i.floor=n.floor;let o=`${n.floor}${Vt}${i.id}`;if(this.pointMap.set(o,i),this.nodeMap.set(`${n.floor}${Vt}${i.nodeId}`,o),this.isFacilityByType(i.type)){let a=this.facilities.find(c=>c.id===+i.targetId);if(a){switch(a.entry_infra_type){case"straightLadder":if(a.entry_end_floor.find(u=>u.floor===n.floor)&&a.entry_start_floor.find(u=>u.floor===n.floor)){let u=this.straightLadderMap.get(i.targetId)||[];u.push({...i}),this.straightLadderMap.set(i.targetId,u)}break;case"staircase":if(a.entry_end_floor.find(u=>u.floor===n.floor)&&a.entry_start_floor.find(u=>u.floor===n.floor)){let u=this.staircaseMap.get(i.targetId)||[];u.push({...i}),this.staircaseMap.set(i.targetId,u)}break;case"escalator":let l=this.escalatorMap.get(i.targetId)||[];if(a.entry_start_floor.find(u=>u.floor===n.floor)){let u=l.find(h=>h.end?.floor!==n.floor&&!h.start);u?u.start=i:l.push({start:i})}if(a.entry_end_floor.find(u=>u.floor===n.floor)){let u=l.find(h=>h.start?.floor!==n.floor&&!h.end);u?u.end=i:l.push({end:i})}this.escalatorMap.set(i.targetId,l);break;case"ramp":let s=this.rampMap.get(i.targetId)||[];if(a.entry_start_floor.find(u=>u.floor===n.floor)){let u=s.find(h=>h.end?.floor!==n.floor&&!h.start);u?u.start=i:s.push({start:i})}if(a.entry_end_floor.find(u=>u.floor===n.floor)){let u=s.find(h=>h.start?.floor!==n.floor&&!h.end);u?u.end=i:s.push({end:i})}this.rampMap.set(i.targetId,s);break}let c=this.facilityMap.get(i.targetId)||[];c.push({...i}),this.facilityMap.set(i.targetId,c)}}i.type==="parkingSpace"&&this.parkingMap.set(`${n.floor}${Vt}${i.name}`,i)}),n.lines.filter(i=>i.direction!=="no").forEach(i=>{let o=`${n.floor}${Vt}${i.from}`,a=`${n.floor}${Vt}${i.to}`,c=this.pointMap.get(o)?.cds,l=this.pointMap.get(a)?.cds;if(c?.length&&l?.length){let s=kt(c,l);switch(this.addLineItem(o,a,s),this.addLineItem(a,o,s),i.direction){case"double":this.addLineItem(o,a,s,this.forwardLineMap),this.addLineItem(a,o,s,this.forwardLineMap);break;case"single":this.addLineItem(o,a,s,this.forwardLineMap);break;case"back":this.addLineItem(a,o,s,this.forwardLineMap);break}}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let c=0;c<a.length;c++){let l=`${a[c].floor}${Vt}${a[c].id}`;for(let s=0;s<a.length;s++)if(c!==s){let u=`${a[s].floor}${Vt}${a[s].id}`,h=this.pointMap.get(l)?.cds,f=this.pointMap.get(u)?.cds;if(h?.length&&f?.length)if(a[c].type==="straightLadder"){let d=t;this.addLineItem(l,u,d,i)}else{let d=n;this.addLineItem(l,u,d,i)}}}}),this.escalatorMap.forEach((o,a)=>{o.forEach(c=>{if(c.start&&c.end){let l=`${c.start.floor}${Vt}${c.start.id}`,s=`${c.end.floor}${Vt}${c.end.id}`,u=this.pointMap.get(l)?.cds,h=this.pointMap.get(s)?.cds;if(u?.length&&h?.length){let f=e;this.addLineItem(l,s,f,i)}}})})}initBaseRoute(){let e=new Map(Pi([...this.lineMap]));this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new ue.default(e)}initEscalatorRoute(){let e=new Map(Pi([...this.lineMap])),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new ue.default(e)}initStraightLadderRoute(){let e=new Map(Pi([...this.lineMap])),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new ue.default(e)}initForwardRoute(){this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Vt}${n.start.id}`,o=`${n.end.floor}${Vt}${n.end.id}`,a=this.pointMap.get(i)?.cds,c=this.pointMap.get(o)?.cds;a?.length&&c?.length&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.forwardRoute=new ue.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${Vt}${e.nodeId}`);if(t){let[n,i]=t.split(Vt);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{let a=kt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:t.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let n=this.parkingMap.get(`${e.floor}${Vt}${e.parkingSpace}`);if(n)return{floor:e.floor,id:n.id}}let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;case"forward":a=this.getForwardPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let c=this.facilityMap.get(o.facility).filter(s=>o.floor?s.floor===o.floor:!0);if(!c.length)return null;let l=c.map(s=>a(i,{floor:s.floor,id:s.id})).filter(s=>!!s);return l.reduce((s,u)=>{let h=u.reduce((f,d)=>f+Se(d.points),0);return h<s.distance&&(s.distance=h,s.path=u),s},{distance:1/0,path:l[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${Vt}${e.id}`,o=`${t.floor}${Vt}${t.id}`,a=n.path(i,o);if(!a)return null;let c=[];return a.map(l=>{let s=this.pointMap.get(l);if(s){let{floor:u}=s,h=s.type;if(this.isFacilityByType(s.type)){let f=this.facilities.find(d=>d.id===+s.targetId);f&&(h=f.entry_infra_type)}if(c[c.length-1]?.floor===u){let f=c[c.length-1];f.points.push(s.cds),f.endType=h,f.destId=s.nodeId,f.distance=Se(f.points)}else c.push({floor:u,points:[s.cds],endType:h,destId:s.nodeId,distance:0})}}),c}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}getForwardPath(e,t){return this.getRoutePath(e,t,this.forwardRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new ue.default,this.escalatorRoute=new ue.default,this.straightLadderRoute=new ue.default}};var nn=class{static keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let e=this.createKey();for(;this.keySet.has(e);)e=this.createKey();return e}static removeKey(e){this.keySet.delete(e)}static dispose(){this.keySet.clear()}};function na(r){return r.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function we(r,e,t){return new Promise((n,i)=>{let o=nn.genUniqueKey(),a=({data:c})=>{c.type===`${e}_result`&&c.key===o&&(nn.removeKey(o),self.removeEventListener("message",a),c.error?i(c.error):n(c.data))};r.addEventListener("message",a),r.postMessage({type:e,key:o,data:t})})}function r_(r){let e={};for(let n in r)n.startsWith("on")&&(e[na(n.slice(2))]=r[n]);let t=async({data:n})=>{if(e[n.type])try{let i=await e[n.type](n.data);self.postMessage({type:`${n.type}_result`,key:n.key,data:i})}catch(i){self.postMessage({type:`${n.type}_result`,key:n.key,error:i})}else self.postMessage({type:`${n.type}_result`,key:n.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}import{BoxGeometry as Sh,BufferGeometry as Mh,Line as wh,LineBasicMaterial as ra,Mesh as Th}from"three";function a_(r,e=16711680){let t=new ra({color:e}),n=new Mh().setFromPoints(r);return new wh(n,t)}function u_(r,e=16711680){let t=new ra({color:e}),n=new Sh(1,1,1),i=new Th(n,t);return i.position.copy(r),i}function ee(r,e,t=0){r.forEach(n=>{n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"?(n.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=e[0],o[1]-=e[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(i=>i.map(o=>Te(o,e)))),n.doors?.length&&n.doors.map(i=>{i.coord=Te(i.coordinate,e)})):n.geometry.coords=Te(n.geometry.cds,e)});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(t+n+1)}}function Te(r,e){return[r[0]-e[0],r[1]-e[1]]}import{Group as Ch}from"@tweenjs/tween.js";var vn=class{pauseTween=!1;tweenStore=new Set;group=new Ch;constructor(){}update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(e=>{this.tweenStore.add(e),e.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(e=>{e.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(e){this.group.remove(e)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(e=>e.stop()),this.group.removeAll()}dispose(){this.clear()}};import{EventDispatcher as Df,Box2 as If,Vector3 as on,Vector2 as xn,Raycaster as Rf,Box3 as Nf,Color as Lf,AmbientLight as Of}from"three";import{EventDispatcher as _f}from"three";import{Object3D as zh,ExtrudeGeometry as Gh,Mesh as kh,Box3 as dr,Vector3 as me,BufferGeometry as Vh,LineSegments as Hh,Ray as aa,Vector2 as Oe}from"three";import{LineMaterial as Ah}from"three/examples/jsm/lines/LineMaterial";import{Color as fr,LineBasicMaterial as Ph,MeshStandardMaterial as Dh,MeshBasicMaterial as Ih,ShaderMaterial as Rh,DoubleSide as Nh}from"three";function ia(r){return`${r.x}-${r.y}-${r.z}`}var Rt=class{static lineMaterialMap=new Map;static meshStandardMaterialMap=new Map;static meshBasicMaterialMap=new Map;static shaderMaterialMap=new Map;static line2MaterialMap=new Map;static generateLineMaterialKey({color:e,opacity:t}){return`${e}-${t}`}static createLineMaterial({color:e,opacity:t}){let n=this.generateLineMaterialKey({color:e,opacity:t});if(this.lineMaterialMap.has(n))return this.lineMaterialMap.get(n);let i=new Ph({color:new fr(e).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(n,i),i}static createMeshStandardMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new Dh({color:new fr(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshBasicMaterialMap.has(n))return this.meshBasicMaterialMap.get(n);let i=new Ih({color:e,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(n,i),i}static createShaderMaterial({gradualColor:e,center:t,maxValue:n,opacity:i,direction:o,max:a,min:c}){let l=`${e.toString()}-${ia(t)}-${n}-${i}-${ia(o)}`;if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let s=`
1
+ var nh=Object.create;var ys=Object.defineProperty;var rh=Object.getOwnPropertyDescriptor;var ih=Object.getOwnPropertyNames;var oh=Object.getPrototypeOf,sh=Object.prototype.hasOwnProperty;var Re=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var ah=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ih(e))!sh.call(r,i)&&i!==t&&ys(r,i,{get:()=>e[i],enumerable:!(n=rh(e,i))||n.enumerable});return r};var pn=(r,e,t)=>(t=r!=null?nh(oh(r)):{},ah(e||!r||!r.__esModule?ys(t,"default",{value:r,enumerable:!0}):t,r));var Ds=Re((Fv,Ps)=>{Ps.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var Ns=Re((Uv,Rs)=>{var Is=Ds();Rs.exports=function(r,e){Array.isArray(e)||(e=[]),r.length>0&&e.push(Is([0,0],r[0]));for(var t=0;t<r.length-1;t++){var n=r[t],i=r[t+1],o=n[0],a=n[1],c=i[0],l=i[1],s=[.75*o+.25*c,.75*a+.25*l],u=[.25*o+.75*c,.25*a+.75*l];e.push(s),e.push(u)}return r.length>1&&e.push(Is([0,0],r[r.length-1])),e}});var ks=Re((Hv,Gs)=>{var Ti=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,t)=>e.priority-t.priority)}set(e,t){let n=Number(t);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(e)?this.queue.map(i=>(i.key===e&&Object.assign(i,{priority:n}),i)):(this.keys.add(e),this.queue.push({key:e,priority:n})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(t=>t.key===e)}};Gs.exports=Ti});var Ws=Re((Wv,Hs)=>{function Vs(r,e){let t=new Map;for(let[n,i]of r)n!==e&&i instanceof Map?t.set(n,Vs(i,e)):n!==e&&t.set(n,i);return t}Hs.exports=Vs});var js=Re((qv,Xs)=>{function xh(r){let e=Number(r);return!(isNaN(e)||e<=0)}function qs(r){let e=new Map;return Object.keys(r).forEach(n=>{let i=r[n];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return e.set(n,qs(i));if(!xh(i))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,i);return e.set(n,Number(i))}),e}Xs.exports=qs});var Zs=Re((Xv,$s)=>{function Ys(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((e,t)=>{if(typeof e=="object"&&e instanceof Map){Ys(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}$s.exports=Ys});var Ai=Re((jv,Qs)=>{var Eh=ks(),bh=Ws(),Ks=js(),Js=Zs(),Ci=class{constructor(e){e instanceof Map?(Js(e),this.graph=e):e?this.graph=Ks(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(Js(t),n=t):n=Ks(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=bh(this.graph,e),this}path(e,t,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let i=new Set,o=new Eh,a=new Map,c=[],l=0,s=[];if(n.avoid&&(s=[].concat(n.avoid)),s.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(s.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(o.set(e,0);!o.isEmpty();){let u=o.next();if(u.key===t){l=u.priority;let f=u.key;for(;a.has(f);)c.push(f),f=a.get(f);break}i.add(u.key),(this.graph.get(u.key)||new Map).forEach((f,d)=>{if(i.has(d)||s.includes(d))return null;if(!o.has(d))return a.set(d,u.key),o.set(d,u.priority+f);let g=o.get(d).priority,p=u.priority+f;return p<g?(a.set(d,u.key),o.set(d,p)):null})}return c.length?(n.trim?c.shift():c=c.concat([e]),n.reverse||(c=c.reverse()),n.cost?{path:c,cost:l}:c):n.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};Qs.exports=Ci});var Hi=Re((ki,Vi)=>{(function(r,e){typeof ki=="object"&&typeof Vi<"u"?Vi.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self,r["'typed'"]=e())})(ki,function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";function i(){function a(E){return typeof E=="object"&&E!==null&&E.constructor===Object}let c=[{name:"number",test:function(E){return typeof E=="number"}},{name:"string",test:function(E){return typeof E=="string"}},{name:"boolean",test:function(E){return typeof E=="boolean"}},{name:"Function",test:function(E){return typeof E=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(E){return E instanceof Date}},{name:"RegExp",test:function(E){return E instanceof RegExp}},{name:"Object",test:a},{name:"null",test:function(E){return E===null}},{name:"undefined",test:function(E){return E===void 0}}],l={name:"any",test:r,isAny:!0},s,u,h=0,f={createCount:0};function d(E){let T=s.get(E);if(T)return T;let A='Unknown type "'+E+'"',I=E.toLowerCase(),U;for(U of u)if(U.toLowerCase()===I){A+='. Did you mean "'+U+'" ?';break}throw new TypeError(A)}function g(E){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",A=T?d(T).index:u.length,I=[];for(let O=0;O<E.length;++O){if(!E[O]||typeof E[O].name!="string"||typeof E[O].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let V=E[O].name;if(s.has(V))throw new TypeError('Duplicate type name "'+V+'"');I.push(V),s.set(V,{name:V,test:E[O].test,isAny:E[O].isAny,index:A+O,conversionsTo:[]})}let U=u.slice(A);u=u.slice(0,A).concat(I).concat(U);for(let O=A+I.length;O<u.length;++O)s.get(u[O]).index=O}function p(){s=new Map,u=[],h=0,g([l],!1)}p(),g(c);function m(){let E;for(E of u)s.get(E).conversionsTo=[];h=0}function v(E){let T=u.filter(A=>{let I=s.get(A);return!I.isAny&&I.test(E)});return T.length?T:["any"]}function b(E){return E&&typeof E=="function"&&"_typedFunctionData"in E}function y(E,T,A){if(!b(E))throw new TypeError(n);let I=A&&A.exact,U=Array.isArray(T)?T.join(","):T,O=P(U),V=_(O);if(!I||V in E.signatures){let ht=E._typedFunctionData.signatureMap.get(V);if(ht)return ht}let z=O.length,H;if(I){H=[];let ht;for(ht in E.signatures)H.push(E._typedFunctionData.signatureMap.get(ht))}else H=E._typedFunctionData.signatures;for(let ht=0;ht<z;++ht){let mt=O[ht],Ct=[],Zt;for(Zt of H){let qt=G(Zt.params,ht);if(!(!qt||mt.restParam&&!qt.restParam)){if(!qt.hasAny){let fe=C(qt);if(mt.types.some(de=>!fe.has(de.name)))continue}Ct.push(Zt)}}if(H=Ct,H.length===0)break}let B;for(B of H)if(B.params.length<=z)return B;throw new TypeError("Signature not found (signature: "+(E.name||"unnamed")+"("+_(O,", ")+"))")}function S(E,T,A){return y(E,T,A).implementation}function x(E,T){let A=d(T);if(A.test(E))return E;let I=A.conversionsTo;if(I.length===0)throw new Error("There are no conversions to "+T+" defined.");for(let U=0;U<I.length;U++)if(d(I[U].from).test(E))return I[U].convert(E);throw new Error("Cannot convert "+E+" to "+T)}function _(E){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return E.map(A=>A.name).join(T)}function M(E){let T=E.indexOf("...")===0,I=(T?E.length>3?E.slice(3):"any":E).split("|").map(z=>d(z.trim())),U=!1,O=T?"...":"";return{types:I.map(function(z){return U=z.isAny||U,O+=z.name+"|",{name:z.name,typeIndex:z.index,test:z.test,isAny:z.isAny,conversion:null,conversionIndex:-1}}),name:O.slice(0,-1),hasAny:U,hasConversion:!1,restParam:T}}function w(E){let T=E.types.map(V=>V.name),A=pt(T),I=E.hasAny,U=E.name,O=A.map(function(V){let z=d(V.from);return I=z.isAny||I,U+="|"+V.from,{name:V.from,typeIndex:z.index,test:z.test,isAny:z.isAny,conversion:V,conversionIndex:V.index}});return{types:E.types.concat(O),name:U,hasAny:I,hasConversion:O.length>0,restParam:E.restParam}}function C(E){return E.typeSet||(E.typeSet=new Set,E.types.forEach(T=>E.typeSet.add(T.name))),E.typeSet}function P(E){let T=[];if(typeof E!="string")throw new TypeError("Signatures must be strings");let A=E.trim();if(A==="")return T;let I=A.split(",");for(let U=0;U<I.length;++U){let O=M(I[U].trim());if(O.restParam&&U!==I.length-1)throw new SyntaxError('Unexpected rest parameter "'+I[U]+'": only allowed for the last parameter');if(O.types.length===0)return null;T.push(O)}return T}function D(E){let T=zt(E);return T?T.restParam:!1}function R(E){if(!E||E.types.length===0)return r;if(E.types.length===1)return d(E.types[0].name).test;if(E.types.length===2){let T=d(E.types[0].name).test,A=d(E.types[1].name).test;return function(U){return T(U)||A(U)}}else{let T=E.types.map(function(A){return d(A.name).test});return function(I){for(let U=0;U<T.length;U++)if(T[U](I))return!0;return!1}}}function W(E){let T,A,I;if(D(E)){T=It(E).map(R);let U=T.length,O=R(zt(E)),V=function(z){for(let H=U;H<z.length;H++)if(!O(z[H]))return!1;return!0};return function(H){for(let B=0;B<T.length;B++)if(!T[B](H[B]))return!1;return V(H)&&H.length>=U+1}}else return E.length===0?function(O){return O.length===0}:E.length===1?(A=R(E[0]),function(O){return A(O[0])&&O.length===1}):E.length===2?(A=R(E[0]),I=R(E[1]),function(O){return A(O[0])&&I(O[1])&&O.length===2}):(T=E.map(R),function(O){for(let V=0;V<T.length;V++)if(!T[V](O[V]))return!1;return O.length===T.length})}function G(E,T){return T<E.length?E[T]:D(E)?zt(E):null}function k(E,T){let A=G(E,T);return A?C(A):new Set}function L(E){return E.conversion===null||E.conversion===void 0}function q(E,T){let A=new Set;return E.forEach(I=>{let U=k(I.params,T),O;for(O of U)A.add(O)}),A.has("any")?["any"]:Array.from(A)}function Y(E,T,A){let I,U,O=E||"unnamed",V=A,z;for(z=0;z<T.length;z++){let mt=[];if(V.forEach(Ct=>{let Zt=G(Ct.params,z),qt=R(Zt);(z<Ct.params.length||D(Ct.params))&&qt(T[z])&&mt.push(Ct)}),mt.length===0){if(U=q(V,z),U.length>0){let Ct=v(T[z]);return I=new TypeError("Unexpected type of argument in function "+O+" (expected: "+U.join(" or ")+", actual: "+Ct.join(" | ")+", index: "+z+")"),I.data={category:"wrongType",fn:O,index:z,actual:Ct,expected:U},I}}else V=mt}let H=V.map(function(mt){return D(mt.params)?1/0:mt.params.length});if(T.length<Math.min.apply(null,H))return U=q(V,z),I=new TypeError("Too few arguments in function "+O+" (expected: "+U.join(" or ")+", index: "+T.length+")"),I.data={category:"tooFewArgs",fn:O,index:T.length,expected:U},I;let B=Math.max.apply(null,H);if(T.length>B)return I=new TypeError("Too many arguments in function "+O+" (expected: "+B+", actual: "+T.length+")"),I.data={category:"tooManyArgs",fn:O,index:T.length,expectedLength:B},I;let ht=[];for(let mt=0;mt<T.length;++mt)ht.push(v(T[mt]).join("|"));return I=new TypeError('Arguments of type "'+ht.join(", ")+'" do not match any of the defined signatures of function '+O+"."),I.data={category:"mismatch",actual:ht},I}function j(E){let T=u.length+1;for(let A=0;A<E.types.length;A++)L(E.types[A])&&(T=Math.min(T,E.types[A].typeIndex));return T}function J(E){let T=h+1;for(let A=0;A<E.types.length;A++)L(E.types[A])||(T=Math.min(T,E.types[A].conversionIndex));return T}function lt(E,T){if(E.hasAny){if(!T.hasAny)return 1}else if(T.hasAny)return-1;if(E.restParam){if(!T.restParam)return 1}else if(T.restParam)return-1;if(E.hasConversion){if(!T.hasConversion)return 1}else if(T.hasConversion)return-1;let A=j(E)-j(T);if(A<0)return-1;if(A>0)return 1;let I=J(E)-J(T);return I<0?-1:I>0?1:0}function at(E,T){let A=E.params,I=T.params,U=zt(A),O=zt(I),V=D(A),z=D(I);if(V&&U.hasAny){if(!z||!O.hasAny)return 1}else if(z&&O.hasAny)return-1;let H=0,B=0,ht;for(ht of A)ht.hasAny&&++H,ht.hasConversion&&++B;let mt=0,Ct=0;for(ht of I)ht.hasAny&&++mt,ht.hasConversion&&++Ct;if(H!==mt)return H-mt;if(V&&U.hasConversion){if(!z||!O.hasConversion)return 1}else if(z&&O.hasConversion)return-1;if(B!==Ct)return B-Ct;if(V){if(!z)return 1}else if(z)return-1;let Zt=(A.length-I.length)*(V?-1:1);if(Zt!==0)return Zt;let qt=[],fe=0;for(let hn=0;hn<A.length;++hn){let ar=lt(A[hn],I[hn]);qt.push(ar),fe+=ar}if(fe!==0)return fe;let de;for(de of qt)if(de!==0)return de;return 0}function pt(E){if(E.length===0)return[];let T=E.map(d);E.length>1&&T.sort((U,O)=>U.index-O.index);let A=T[0].conversionsTo;if(E.length===1)return A;A=A.concat([]);let I=new Set(E);for(let U=1;U<T.length;++U){let O;for(O of T[U].conversionsTo)I.has(O.from)||(A.push(O),I.add(O.from))}return A}function Tt(E,T){let A=T;if(E.some(U=>U.hasConversion)){let U=D(E),O=E.map(wt);A=function(){let z=[],H=U?arguments.length-1:arguments.length;for(let B=0;B<H;B++)z[B]=O[B](arguments[B]);return U&&(z[H]=arguments[H].map(O[H])),T.apply(this,z)}}let I=A;if(D(E)){let U=E.length-1;I=function(){return A.apply(this,Ee(arguments,0,U).concat([Ee(arguments,U)]))}}return I}function wt(E){let T,A,I,U,O=[],V=[];switch(E.types.forEach(function(z){z.conversion&&(O.push(d(z.conversion.from).test),V.push(z.conversion.convert))}),V.length){case 0:return function(H){return H};case 1:return T=O[0],I=V[0],function(H){return T(H)?I(H):H};case 2:return T=O[0],A=O[1],I=V[0],U=V[1],function(H){return T(H)?I(H):A(H)?U(H):H};default:return function(H){for(let B=0;B<V.length;B++)if(O[B](H))return V[B](H);return H}}}function St(E){function T(A,I,U){if(I<A.length){let O=A[I],V=[];if(O.restParam){let z=O.types.filter(L);z.length<O.types.length&&V.push({types:z,name:"..."+z.map(H=>H.name).join("|"),hasAny:z.some(H=>H.isAny),hasConversion:!1,restParam:!0}),V.push(O)}else V=O.types.map(function(z){return{types:[z],name:z.name,hasAny:z.isAny,hasConversion:z.conversion,restParam:!1}});return Un(V,function(z){return T(A,I+1,U.concat([z]))})}else return[U]}return T(E,0,[])}function xt(E,T){let A=Math.max(E.length,T.length);for(let z=0;z<A;z++){let H=k(E,z),B=k(T,z),ht=!1,mt;for(mt of B)if(H.has(mt)){ht=!0;break}if(!ht)return!1}let I=E.length,U=T.length,O=D(E),V=D(T);return O?V?I===U:U>=I:V?I>=U:I===U}function $t(E){return E.map(T=>ds(T)?ps(T.referToSelf.callback):fs(T)?sr(T.referTo.references,T.referTo.callback):T)}function Mt(E,T,A){let I=[],U;for(U of E){let O=A[U];if(typeof O!="number")throw new TypeError('No definition for referenced signature "'+U+'"');if(O=T[O],typeof O!="function")return!1;I.push(O)}return I}function gt(E,T,A){let I=$t(E),U=new Array(I.length).fill(!1),O=!0;for(;O;){O=!1;let V=!0;for(let z=0;z<I.length;++z){if(U[z])continue;let H=I[z];if(ds(H))I[z]=H.referToSelf.callback(A),I[z].referToSelf=H.referToSelf,U[z]=!0,V=!1;else if(fs(H)){let B=Mt(H.referTo.references,I,T);B?(I[z]=H.referTo.callback.apply(this,B),I[z].referTo=H.referTo,U[z]=!0,V=!1):O=!0}}if(V&&O)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return I}function se(E){let T=/\bthis(\(|\.signatures\b)/;Object.keys(E).forEach(A=>{let I=E[A];if(T.test(I.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Ot(E,T){if(f.createCount++,Object.keys(T).length===0)throw new SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&se(T);let A=[],I=[],U={},O=[],V;for(V in T){if(!Object.prototype.hasOwnProperty.call(T,V))continue;let ut=P(V);if(!ut)continue;A.forEach(function(zn){if(xt(zn,ut))throw new TypeError('Conflicting signatures "'+_(zn)+'" and "'+_(ut)+'".')}),A.push(ut);let Kt=I.length;I.push(T[V]);let th=ut.map(w),ur;for(ur of St(th)){let zn=_(ur);O.push({params:ur,name:zn,fn:Kt}),ur.every(eh=>!eh.hasConversion)&&(U[zn]=Kt)}}O.sort(at);let z=gt(I,U,Bn),H;for(H in U)Object.prototype.hasOwnProperty.call(U,H)&&(U[H]=z[U[H]]);let B=[],ht=new Map;for(H of O)ht.has(H.name)||(H.fn=z[H.fn],B.push(H),ht.set(H.name,H));let mt=B[0]&&B[0].params.length<=2&&!D(B[0].params),Ct=B[1]&&B[1].params.length<=2&&!D(B[1].params),Zt=B[2]&&B[2].params.length<=2&&!D(B[2].params),qt=B[3]&&B[3].params.length<=2&&!D(B[3].params),fe=B[4]&&B[4].params.length<=2&&!D(B[4].params),de=B[5]&&B[5].params.length<=2&&!D(B[5].params),hn=mt&&Ct&&Zt&&qt&&fe&&de;for(let ut=0;ut<B.length;++ut)B[ut].test=W(B[ut].params);let ar=mt?R(B[0].params[0]):e,Tc=Ct?R(B[1].params[0]):e,Cc=Zt?R(B[2].params[0]):e,Ac=qt?R(B[3].params[0]):e,Pc=fe?R(B[4].params[0]):e,Dc=de?R(B[5].params[0]):e,Ic=mt?R(B[0].params[1]):e,Rc=Ct?R(B[1].params[1]):e,Nc=Zt?R(B[2].params[1]):e,Lc=qt?R(B[3].params[1]):e,Oc=fe?R(B[4].params[1]):e,Fc=de?R(B[5].params[1]):e;for(let ut=0;ut<B.length;++ut)B[ut].implementation=Tt(B[ut].params,B[ut].fn);let Uc=mt?B[0].implementation:t,Bc=Ct?B[1].implementation:t,zc=Zt?B[2].implementation:t,Gc=qt?B[3].implementation:t,kc=fe?B[4].implementation:t,Vc=de?B[5].implementation:t,Hc=mt?B[0].params.length:-1,Wc=Ct?B[1].params.length:-1,qc=Zt?B[2].params.length:-1,Xc=qt?B[3].params.length:-1,jc=fe?B[4].params.length:-1,Yc=de?B[5].params.length:-1,$c=hn?6:0,Zc=B.length,Kc=B.map(ut=>ut.test),Jc=B.map(ut=>ut.implementation),Qc=function(){for(let Kt=$c;Kt<Zc;Kt++)if(Kc[Kt](arguments))return Jc[Kt].apply(this,arguments);return f.onMismatch(E,arguments,B)};function Bn(ut,Kt){return arguments.length===Hc&&ar(ut)&&Ic(Kt)?Uc.apply(this,arguments):arguments.length===Wc&&Tc(ut)&&Rc(Kt)?Bc.apply(this,arguments):arguments.length===qc&&Cc(ut)&&Nc(Kt)?zc.apply(this,arguments):arguments.length===Xc&&Ac(ut)&&Lc(Kt)?Gc.apply(this,arguments):arguments.length===jc&&Pc(ut)&&Oc(Kt)?kc.apply(this,arguments):arguments.length===Yc&&Dc(ut)&&Fc(Kt)?Vc.apply(this,arguments):Qc.apply(this,arguments)}try{Object.defineProperty(Bn,"name",{value:E})}catch{}return Bn.signatures=U,Bn._typedFunctionData={signatures:B,signatureMap:ht},Bn}function ct(E,T,A){throw Y(E,T,A)}function It(E){return Ee(E,0,E.length-1)}function zt(E){return E[E.length-1]}function Ee(E,T,A){return Array.prototype.slice.call(E,T,A)}function Ge(E,T){for(let A=0;A<E.length;A++)if(T(E[A]))return E[A]}function Un(E,T){return Array.prototype.concat.apply([],E.map(T))}function cn(){let E=It(arguments).map(A=>_(P(A))),T=zt(arguments);if(typeof T!="function")throw new TypeError("Callback function expected as last argument");return sr(E,T)}function sr(E,T){return{referTo:{references:E,callback:T}}}function ps(E){if(typeof E!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:E}}}function fs(E){return E&&typeof E.referTo=="object"&&Array.isArray(E.referTo.references)&&typeof E.referTo.callback=="function"}function ds(E){return E&&typeof E.referToSelf=="object"&&typeof E.referToSelf.callback=="function"}function gs(E,T){if(!E)return T;if(T&&T!==E){let A=new Error("Function names do not match (expected: "+E+", actual: "+T+")");throw A.data={actual:T,expected:E},A}return E}function Sc(E){let T;for(let A in E)Object.prototype.hasOwnProperty.call(E,A)&&(b(E[A])||typeof E[A].signature=="string")&&(T=gs(T,E[A].name));return T}function Mc(E,T){let A;for(A in T)if(Object.prototype.hasOwnProperty.call(T,A)){if(A in E&&T[A]!==E[A]){let I=new Error('Signature "'+A+'" is defined twice');throw I.data={signature:A,sourceFunction:T[A],destFunction:E[A]},I}E[A]=T[A]}}let wc=f;f=function(E){let T=typeof E=="string",A=T?1:0,I=T?E:"",U={};for(let O=A;O<arguments.length;++O){let V=arguments[O],z={},H;if(typeof V=="function"?(H=V.name,typeof V.signature=="string"?z[V.signature]=V:b(V)&&(z=V.signatures)):a(V)&&(z=V,T||(H=Sc(V))),Object.keys(z).length===0){let B=new TypeError("Argument to 'typed' at index "+O+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw B.data={index:O,argument:V},B}T||(I=gs(I,H)),Mc(U,z)}return Ot(I||"",U)},f.create=i,f.createCount=wc.createCount,f.onMismatch=ct,f.throwMismatchError=ct,f.createError=Y,f.clear=p,f.clearConversions=m,f.addTypes=g,f._findType=d,f.referTo=cn,f.referToSelf=ps,f.convert=x,f.findSignature=y,f.find=S,f.isTypedFunction=b,f.warnAgainstDeprecatedThis=!0,f.addType=function(E,T){let A="any";T!==!1&&s.has("Object")&&(A="Object"),f.addTypes([E],A)};function ms(E){if(!E||typeof E.from!="string"||typeof E.to!="string"||typeof E.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(E.to===E.from)throw new SyntaxError('Illegal to define conversion from "'+E.from+'" to itself.')}return f.addConversion=function(E){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};ms(E);let A=d(E.to),I=A.conversionsTo.find(U=>U.from===E.from);if(I)if(T&&T.override)f.removeConversion({from:I.from,to:E.to,convert:I.convert});else throw new Error('There is already a conversion from "'+E.from+'" to "'+A.name+'"');A.conversionsTo.push({from:E.from,convert:E.convert,index:h++})},f.addConversions=function(E,T){E.forEach(A=>f.addConversion(A,T))},f.removeConversion=function(E){ms(E);let T=d(E.to),A=Ge(T.conversionsTo,U=>U.from===E.from);if(!A)throw new Error("Attempt to remove nonexistent conversion from "+E.from+" to "+E.to);if(A.convert!==E.convert)throw new Error("Conversion to remove does not match existing conversion");let I=T.conversionsTo.indexOf(A);T.conversionsTo.splice(I,1)},f.resolve=function(E,T){if(!b(E))throw new TypeError(n);let A=E._typedFunctionData.signatures;for(let I=0;I<A.length;++I)if(A[I].test(T))return A[I];return null},f}var o=i();return o})});var qu=Re((no,Wu)=>{(function(r){"use strict";var e=Math.cosh||function(s){return Math.abs(s)<1e-9?1-s:(Math.exp(s)+Math.exp(-s))*.5},t=Math.sinh||function(s){return Math.abs(s)<1e-9?s:(Math.exp(s)-Math.exp(-s))*.5},n=function(s){var u=Math.PI/4;if(-u>s||s>u)return Math.cos(s)-1;var h=s*s;return h*(h*(h*(h*(h*(h*(h*(h/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},i=function(s,u){var h=Math.abs(s),f=Math.abs(u);return h<3e3&&f<3e3?Math.sqrt(h*h+f*f):(h<f?(h=f,f=s/u):f=u/s,h*Math.sqrt(1+f*f))},o=function(){throw SyntaxError("Invalid Param")};function a(s,u){var h=Math.abs(s),f=Math.abs(u);return s===0?Math.log(f):u===0?Math.log(h):h<3e3&&f<3e3?Math.log(s*s+u*u)*.5:(s=s/2,u=u/2,.5*Math.log(s*s+u*u)+Math.LN2)}var c=function(s,u){var h={re:0,im:0};if(s==null)h.re=h.im=0;else if(u!==void 0)h.re=s,h.im=u;else switch(typeof s){case"object":if("im"in s&&"re"in s)h.re=s.re,h.im=s.im;else if("abs"in s&&"arg"in s){if(!Number.isFinite(s.abs)&&Number.isFinite(s.arg))return l.INFINITY;h.re=s.abs*Math.cos(s.arg),h.im=s.abs*Math.sin(s.arg)}else if("r"in s&&"phi"in s){if(!Number.isFinite(s.r)&&Number.isFinite(s.phi))return l.INFINITY;h.re=s.r*Math.cos(s.phi),h.im=s.r*Math.sin(s.phi)}else s.length===2?(h.re=s[0],h.im=s[1]):o();break;case"string":h.im=h.re=0;var f=s.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),d=1,g=0;f===null&&o();for(var p=0;p<f.length;p++){var m=f[p];m===" "||m===" "||m===`
2
+ `||(m==="+"?d++:m==="-"?g++:m==="i"||m==="I"?(d+g===0&&o(),f[p+1]!==" "&&!isNaN(f[p+1])?(h.im+=parseFloat((g%2?"-":"")+f[p+1]),p++):h.im+=parseFloat((g%2?"-":"")+"1"),d=g=0):((d+g===0||isNaN(m))&&o(),f[p+1]==="i"||f[p+1]==="I"?(h.im+=parseFloat((g%2?"-":"")+m),p++):h.re+=parseFloat((g%2?"-":"")+m),d=g=0))}d+g>0&&o();break;case"number":h.im=0,h.re=s;break;default:o()}return isNaN(h.re)||isNaN(h.im),h};function l(s,u){if(!(this instanceof l))return new l(s,u);var h=c(s,u);this.re=h.re,this.im=h.im}l.prototype={re:0,im:0,sign:function(){var s=this.abs();return new l(this.re/s,this.im/s)},add:function(s,u){var h=new l(s,u);return this.isInfinite()&&h.isInfinite()?l.NAN:this.isInfinite()||h.isInfinite()?l.INFINITY:new l(this.re+h.re,this.im+h.im)},sub:function(s,u){var h=new l(s,u);return this.isInfinite()&&h.isInfinite()?l.NAN:this.isInfinite()||h.isInfinite()?l.INFINITY:new l(this.re-h.re,this.im-h.im)},mul:function(s,u){var h=new l(s,u);return this.isInfinite()&&h.isZero()||this.isZero()&&h.isInfinite()?l.NAN:this.isInfinite()||h.isInfinite()?l.INFINITY:h.im===0&&this.im===0?new l(this.re*h.re,0):new l(this.re*h.re-this.im*h.im,this.re*h.im+this.im*h.re)},div:function(s,u){var h=new l(s,u);if(this.isZero()&&h.isZero()||this.isInfinite()&&h.isInfinite())return l.NAN;if(this.isInfinite()||h.isZero())return l.INFINITY;if(this.isZero()||h.isInfinite())return l.ZERO;s=this.re,u=this.im;var f=h.re,d=h.im,g,p;return d===0?new l(s/f,u/f):Math.abs(f)<Math.abs(d)?(p=f/d,g=f*p+d,new l((s*p+u)/g,(u*p-s)/g)):(p=d/f,g=d*p+f,new l((s+u*p)/g,(u-s*p)/g))},pow:function(s,u){var h=new l(s,u);if(s=this.re,u=this.im,h.isZero())return l.ONE;if(h.im===0){if(u===0&&s>0)return new l(Math.pow(s,h.re),0);if(s===0)switch((h.re%4+4)%4){case 0:return new l(Math.pow(u,h.re),0);case 1:return new l(0,Math.pow(u,h.re));case 2:return new l(-Math.pow(u,h.re),0);case 3:return new l(0,-Math.pow(u,h.re))}}if(s===0&&u===0&&h.re>0&&h.im>=0)return l.ZERO;var f=Math.atan2(u,s),d=a(s,u);return s=Math.exp(h.re*d-h.im*f),u=h.im*d+h.re*f,new l(s*Math.cos(u),s*Math.sin(u))},sqrt:function(){var s=this.re,u=this.im,h=this.abs(),f,d;if(s>=0){if(u===0)return new l(Math.sqrt(s),0);f=.5*Math.sqrt(2*(h+s))}else f=Math.abs(u)/Math.sqrt(2*(h-s));return s<=0?d=.5*Math.sqrt(2*(h-s)):d=Math.abs(u)/Math.sqrt(2*(h+s)),new l(f,u<0?-d:d)},exp:function(){var s=Math.exp(this.re);return this.im,new l(s*Math.cos(this.im),s*Math.sin(this.im))},expm1:function(){var s=this.re,u=this.im;return new l(Math.expm1(s)*Math.cos(u)+n(u),Math.exp(s)*Math.sin(u))},log:function(){var s=this.re,u=this.im;return u===0&&s>0,new l(a(s,u),Math.atan2(u,s))},abs:function(){return i(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var s=this.re,u=this.im;return new l(Math.sin(s)*e(u),Math.cos(s)*t(u))},cos:function(){var s=this.re,u=this.im;return new l(Math.cos(s)*e(u),-Math.sin(s)*t(u))},tan:function(){var s=2*this.re,u=2*this.im,h=Math.cos(s)+e(u);return new l(Math.sin(s)/h,t(u)/h)},cot:function(){var s=2*this.re,u=2*this.im,h=Math.cos(s)-e(u);return new l(-Math.sin(s)/h,t(u)/h)},sec:function(){var s=this.re,u=this.im,h=.5*e(2*u)+.5*Math.cos(2*s);return new l(Math.cos(s)*e(u)/h,Math.sin(s)*t(u)/h)},csc:function(){var s=this.re,u=this.im,h=.5*e(2*u)-.5*Math.cos(2*s);return new l(Math.sin(s)*e(u)/h,-Math.cos(s)*t(u)/h)},asin:function(){var s=this.re,u=this.im,h=new l(u*u-s*s+1,-2*s*u).sqrt(),f=new l(h.re-u,h.im+s).log();return new l(f.im,-f.re)},acos:function(){var s=this.re,u=this.im,h=new l(u*u-s*s+1,-2*s*u).sqrt(),f=new l(h.re-u,h.im+s).log();return new l(Math.PI/2-f.im,f.re)},atan:function(){var s=this.re,u=this.im;if(s===0){if(u===1)return new l(0,1/0);if(u===-1)return new l(0,-1/0)}var h=s*s+(1-u)*(1-u),f=new l((1-u*u-s*s)/h,-2*s/h).log();return new l(-.5*f.im,.5*f.re)},acot:function(){var s=this.re,u=this.im;if(u===0)return new l(Math.atan2(1,s),0);var h=s*s+u*u;return h!==0?new l(s/h,-u/h).atan():new l(s!==0?s/0:0,u!==0?-u/0:0).atan()},asec:function(){var s=this.re,u=this.im;if(s===0&&u===0)return new l(0,1/0);var h=s*s+u*u;return h!==0?new l(s/h,-u/h).acos():new l(s!==0?s/0:0,u!==0?-u/0:0).acos()},acsc:function(){var s=this.re,u=this.im;if(s===0&&u===0)return new l(Math.PI/2,1/0);var h=s*s+u*u;return h!==0?new l(s/h,-u/h).asin():new l(s!==0?s/0:0,u!==0?-u/0:0).asin()},sinh:function(){var s=this.re,u=this.im;return new l(t(s)*Math.cos(u),e(s)*Math.sin(u))},cosh:function(){var s=this.re,u=this.im;return new l(e(s)*Math.cos(u),t(s)*Math.sin(u))},tanh:function(){var s=2*this.re,u=2*this.im,h=e(s)+Math.cos(u);return new l(t(s)/h,Math.sin(u)/h)},coth:function(){var s=2*this.re,u=2*this.im,h=e(s)-Math.cos(u);return new l(t(s)/h,-Math.sin(u)/h)},csch:function(){var s=this.re,u=this.im,h=Math.cos(2*u)-e(2*s);return new l(-2*t(s)*Math.cos(u)/h,2*e(s)*Math.sin(u)/h)},sech:function(){var s=this.re,u=this.im,h=Math.cos(2*u)+e(2*s);return new l(2*e(s)*Math.cos(u)/h,-2*t(s)*Math.sin(u)/h)},asinh:function(){var s=this.im;this.im=-this.re,this.re=s;var u=this.asin();return this.re=-this.im,this.im=s,s=u.re,u.re=-u.im,u.im=s,u},acosh:function(){var s=this.acos();if(s.im<=0){var u=s.re;s.re=-s.im,s.im=u}else{var u=s.im;s.im=-s.re,s.re=u}return s},atanh:function(){var s=this.re,u=this.im,h=s>1&&u===0,f=1-s,d=1+s,g=f*f+u*u,p=g!==0?new l((d*f-u*u)/g,(u*f+d*u)/g):new l(s!==-1?s/0:0,u!==0?u/0:0),m=p.re;return p.re=a(p.re,p.im)/2,p.im=Math.atan2(p.im,m)/2,h&&(p.im=-p.im),p},acoth:function(){var s=this.re,u=this.im;if(s===0&&u===0)return new l(0,Math.PI/2);var h=s*s+u*u;return h!==0?new l(s/h,-u/h).atanh():new l(s!==0?s/0:0,u!==0?-u/0:0).atanh()},acsch:function(){var s=this.re,u=this.im;if(u===0)return new l(s!==0?Math.log(s+Math.sqrt(s*s+1)):1/0,0);var h=s*s+u*u;return h!==0?new l(s/h,-u/h).asinh():new l(s!==0?s/0:0,u!==0?-u/0:0).asinh()},asech:function(){var s=this.re,u=this.im;if(this.isZero())return l.INFINITY;var h=s*s+u*u;return h!==0?new l(s/h,-u/h).acosh():new l(s!==0?s/0:0,u!==0?-u/0:0).acosh()},inverse:function(){if(this.isZero())return l.INFINITY;if(this.isInfinite())return l.ZERO;var s=this.re,u=this.im,h=s*s+u*u;return new l(s/h,-u/h)},conjugate:function(){return new l(this.re,-this.im)},neg:function(){return new l(-this.re,-this.im)},ceil:function(s){return s=Math.pow(10,s||0),new l(Math.ceil(this.re*s)/s,Math.ceil(this.im*s)/s)},floor:function(s){return s=Math.pow(10,s||0),new l(Math.floor(this.re*s)/s,Math.floor(this.im*s)/s)},round:function(s){return s=Math.pow(10,s||0),new l(Math.round(this.re*s)/s,Math.round(this.im*s)/s)},equals:function(s,u){var h=new l(s,u);return Math.abs(h.re-this.re)<=l.EPSILON&&Math.abs(h.im-this.im)<=l.EPSILON},clone:function(){return new l(this.re,this.im)},toString:function(){var s=this.re,u=this.im,h="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(s)<l.EPSILON&&(s=0),Math.abs(u)<l.EPSILON&&(u=0),u===0?h+s:(s!==0?(h+=s,h+=" ",u<0?(u=-u,h+="-"):h+="+",h+=" "):u<0&&(u=-u,h+="-"),u!==1&&(h+=u),h+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},l.ZERO=new l(0,0),l.ONE=new l(1,0),l.I=new l(0,1),l.PI=new l(Math.PI,0),l.E=new l(Math.E,0),l.INFINITY=new l(1/0,1/0),l.NAN=new l(NaN,NaN),l.EPSILON=1e-15,typeof define=="function"&&define.amd?define([],function(){return l}):typeof no=="object"?(Object.defineProperty(l,"__esModule",{value:!0}),l.default=l,l.Complex=l,Wu.exports=l):r.Complex=l})(no)});import{EventDispatcher as Bf,Vector3 as zf}from"three";var Gt=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(e){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),e()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(e){this.tasks.requestAnimation.delete(e),window.cancelAnimationFrame(e)}setTimeout(e,t){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),e()},t);return this.tasks.timeout.add(n),n}clearTimeout(e){this.tasks.timeout.delete(e),window.clearTimeout(e)}setInterval(e,t){let n=window.setInterval(()=>{this.tasks.interval.delete(n),e()},t);return this.tasks.interval.add(n),n}clearInterval(e){this.tasks.interval.delete(e),window.clearInterval(e)}dispose(){this.tasks.requestAnimation.forEach(e=>{window.cancelAnimationFrame(e)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(e=>{window.clearTimeout(e)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(e=>{window.clearInterval(e)}),this.tasks.interval.clear()}};import{Shape as uh,Group as lh,DirectionalLight as ch,AmbientLight as hh,Path as ph,Vector2 as vs}from"three";function _s(){let r=new lh,e=new hh(16777215,2.6);return r.add(e),r}function be(r,e=[]){let t=new uh(r.map(n=>new vs(...n)));return e.length&&e.forEach(n=>{var i=new ph(n.map(o=>new vs(...o)));t.holes.push(i)}),t}function xs(r=16777215,e=1){let t=new ch(r,e);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function Jt(r,e){if(e&&r.children&&r.children.length&&r.children.forEach(t=>{Jt(t,e)}),r.isMesh){let t=r;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n.dispose()}):t.material.dispose())}r.isLight&&r.dispose?.()}function Es(r){return/[\u4E00-\u9FA5]+/g.test(r)}import{Vector3 as bi,Vector2 as Ne,Matrix3 as lr}from"three";import{point as fh,featureCollection as dh,center as gh}from"@turf/turf";function et(r,e,t,n){let i=r.clone().project(e),o=t/2,a=n/2,c=Math.round(i.x*o+o),l=Math.round(-i.y*a+a);return{x:c,y:l}}function cr(r){let e=dh(r.map(n=>fh(n)));return gh(e).geometry.coordinates}function ke(r,e,t){return r.x>=e.x&&r.x<=t.x&&r.y>=e.y&&r.y<=t.y}function yv(r){let e=0,t=new bi;for(let n=1;n<r.length;n++){let i=new bi(r[n-1][0],r[n-1][1],0),o=new bi(r[n][0],r[n][1],0),a=o.distanceTo(i);a>e&&(e=a,t=o.clone().sub(i).normalize())}return t}function kt(r,e){return Math.sqrt((e[0]-r[0])**2+(e[1]-r[1])**2)}function Se(r){let e=0;for(let t=0;t<r.length-1;t++)e+=kt(r[t],r[t+1]);return e}function bs(r,e,t){let n=new Ne(e[0]-r[0],e[1]-r[1]),i=new Ne(e[0]-t[0],e[1]-t[1]),a=n.angleTo(i)*180/Math.PI,c=new Ne(e[0]-r[0],e[1]-r[1]);return new Ne(t[0]-r[0],t[1]-r[1]).cross(c)>0?a:-a}function Ss(r,e){let t=Math.min(kt(r[0][0],r[0][1]),kt(r[0][2],r[0][1]))-1;e||(e=cr(r[0]));let n=mh(e,t),i=new Ne(r[0][0][0],r[0][0][1]),o=new Ne(r[0][1][0],r[0][1][1]),a=new Ne(r[0][2][0],r[0][2][1]),l=(i.distanceTo(o)>o.distanceTo(a)?o.clone().sub(i):a.clone().sub(o)).angleTo(new Ne(0,1)),s=new lr;return s.multiply(new lr().translate(e[0],e[1])).multiply(new lr().rotate(l)).multiply(new lr().translate(-e[0],-e[1])),[n.map(u=>{let h=new Ne(u[0],u[1]).applyMatrix3(s);return[h.x,h.y]})]}function mh(r,e){let t=e/2;return[[r[0]-t,r[1]+t],[r[0]+t,r[1]+t],[r[0]+t,r[1]-t],[r[0]-t,r[1]-t],[r[0]-t,r[1]+t]]}function fn(r,e){let t=0,n=1/0,[i,o]=e;for(let a=0;a<r.length-1;a++){let[c,l]=r[a],[s,u]=r[a+1],h=Math.min(c,s)<=i&&i<=Math.max(c,s),f=Math.min(l,u)<=o&&o<=Math.max(l,u);if(h&&f){let d=Math.abs((s-c)*(o-l)-(u-l)*(i-c));d<n&&(n=d,t=a)}}return t}function Ms(r,e){let t=r[0],n=r[1],i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let c=e[o][0],l=e[o][1],s=e[a][0],u=e[a][1];l>n!=u>n&&t<(s-c)*(n-l)/(u-l)+c&&(i=!i)}return i}function dn(r,e){return new Proxy(r,{get:(t,n,i)=>Reflect.get(t,n,i),set:(t,n,i,o)=>{let a=Reflect.get(t,n,o),c=Reflect.set(t,n,i,o);return a!==i&&e.dispatchEvent({type:`change-${n}`,value:i}),c}})}function tn(r,e){return Promise.race([r,new Promise((t,n)=>{setTimeout(()=>n(new Error("Promise timeout")),e)})])}function hr(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function ws(r,e){let t=hr("svg");return t.setAttribute("width",r),t.setAttribute("height",e),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function Gn(r="2",e){let t=hr("circle");return t.setAttribute("r",r),t.setAttribute("fill",e),t}function pr(r){let e=hr("line");return e.setAttribute("stroke",r),e}function Ve(r,e){let t=hr("rect");return t.setAttribute("stroke",r),t.setAttribute("fill",e),t}function en(r,e,t){r.setAttribute("cx",`${e}`),r.setAttribute("cy",`${t}`)}function ge(r,e,t){e&&(r.setAttribute("x1",`${e.x}`),r.setAttribute("y1",`${e.y}`)),t&&(r.setAttribute("x2",`${t.x}`),r.setAttribute("y2",`${t.y}`))}function Xt(r,e,t,n,i){r.setAttribute("x",`${e}`),r.setAttribute("y",`${t}`),r.setAttribute("width",`${n}`),r.setAttribute("height",`${i}`)}function Ts(){return Promise.resolve()}function bv(){return new Promise(r=>{requestAnimationFrame(r)})}function Mv(r){return parseInt(r.replace("#","0x"),16)}function wv(r,e){let t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(t*e),a=Math.round(n*e),c=Math.round(i*e);return`#${(1<<24|o<<16|a<<8|c).toString(16).slice(1)}`}function Le(r,e=.85){let t,n,i;if(r.startsWith("#"))t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let a=r.slice(4,-1).split(",");t=parseInt(a[0].trim()),n=parseInt(a[1].trim()),i=parseInt(a[2].trim())}return t=Math.min(Math.floor(t*e),255),n=Math.min(Math.floor(n*e),255),i=Math.min(Math.floor(i*e),255),"#"+((1<<24)+(t<<16)+(n<<8)+i).toString(16).slice(1)}function Si(r,e){r=r.replace(/^#/,"");let t=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return e!==void 0?`rgba(${t}, ${n}, ${i}, ${e})`:`rgb(${t}, ${n}, ${i})`}var gn=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,Cs=(window.navigator.userAgent||"").toLocaleLowerCase(),kn=/ios|iphone/i.test(Cs),Cv=/android|adr|linux/gi.test(Cs);function mn(r){return gn?r==="Meta":r==="Control"}var Mi="__once__",As=class{events=new Map;on(e,t){if(typeof t!="function")return;let n=this.events.get(e);return n?n.add(t):this.events.set(e,new Set([t]))}once(e,t){if(typeof t!="function")return;let n=`${Mi}${e}`,i=this.events.get(n);return i?i.add(t):this.events.set(n,new Set([t]))}off(e,t){let n=this.events.get(e),i=this.events.get(`${Mi}${e}`);!n&&!i||(t===void 0&&(n?.clear(),i?.clear()),n?.has(t)&&n.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(e,...t){let n=this.events.get(e),i=this.events.get(`${Mi}${e}`);!n&&!i||(n?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.clear())}};var Vn=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(Vn||{});function yn(r){return Object.keys(r).sort().map(e=>`${e}=${r[e]}`).join("&")}function Lv(r,e){return new Promise((t,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(e.headers||{}).forEach(o=>{i.setRequestHeader(o,e.headers[o])}),e.responseType&&(i.responseType=e.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(e.responseType==="arraybuffer")t(i.response);else try{let o=JSON.parse(i.responseText);t(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var Ls=pn(Ns(),1);import{Vector2 as Hn}from"three";function yh(r,e){let t=r.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function vh(r){let e=0;return r.reduce(([t,n],[i,o])=>(e+=Math.sqrt((i-t)**2+(o-n)**2),[i,o])),e/r.length}function Os(r,e=.25){if(vh(r)<e)return r;let t=(0,Ls.default)(r);return Os(t,e)}function Fs(r,e=!1,t=!0,n=5,i=150,o=3){let a=[],c=!e;if(a.push(r[0]),r.length<2)return a;for(let s=0;s<r.length-2;s+=1){let u=r[s],h=r[s+1],f=r[s+2],d=new Hn(u[0]-h[0],u[1]-h[1]),g=new Hn(f[0]-h[0],f[1]-h[1]),p=yh(d,g)/Math.PI*180,m=d.length()+g.length();(!c||p<i&&m>.01||m>n)&&(a.push(r[s+1]),c=!0)}if(a.push(r[r.length-1]),!t)return a;let l=[];l.push(a[0]);for(let s=0;s<a.length-2;s+=1){let u=new Hn(a[s][0],a[s][1]),h=new Hn(a[s+1][0],a[s+1][1]),f=new Hn(a[s+2][0],a[s+2][1]),d=u.distanceTo(h)/2,g=f.distanceTo(h)/2,p=h.clone(),m=h.clone();p.add(u.clone().sub(h).normalize().multiplyScalar(d>o?o/2:d)),m.add(f.clone().sub(h).normalize().multiplyScalar(g>o?o/2:g));let v=[[p.x,p.y],[h.x,h.y],[m.x,m.y]];l.push(...Os(v,o/25))}return l.push(a[a.length-1]),_h(l)}function _h(r){if(r.length<=1)return r;let e=[],t;return r.forEach(([n,i])=>{t?n===t[0]&&i===t[1]||(t=[n,i],e.push([n,i])):(t=[n,i],e.push([n,i]))}),e}function Us(r,e,t){let n=Math.sqrt((t[0]-e[0])**2+(t[1]-e[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2),closestPoint:e.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-e[0])*(t[0]-e[0])+(r[1]-e[1])*(t[1]-e[1]))/n**2)),o=[e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function Gv(r,e,t){let[n,i]=r,[o,a]=e,c=Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2));if(c===0||c<t)return[...e];let l=t/c,s=n+(o-n)*l,u=i+(a-i)*l;return[s,u]}var Bs=(s=>(s.START="start",s.END="end",s.FRONT="front",s.RIGHT="right",s.LEFT="left",s.RIGHT_FRONT="right_front",s.LEFT_FRONT="left_front",s.RIGHT_BACK="right_back",s.LEFT_BACK="left_back",s))(Bs||{});function wi(r,e,t){let n=bs(r,e,t);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function kv(r){if(!r.length)return[];let e=[{direction:"start",distance:kt(r[0],r[1]),points:[r[0],r[1]]}];for(let t=2;t<r.length;t++){let n=wi(r[t-2],r[t-1],r[t]);if(n==="front"){let i=e[e.length-1],o=kt(r[t-1],r[t]);i.distance+=o,t!==2&&i.points.push(r[t-1])}else e.push({direction:n,distance:kt(r[t-1],r[t]),points:[r[t-1],r[t]]})}return e.push({direction:"end",distance:0,points:[r[r.length-1]]}),e}function zs(r,e){if(r.length<2)return-1;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=[e[0]-i[0],e[1]-i[1]],c=[o[0]-i[0],o[1]-i[1]],l=Math.min(o[0],i[0])<=e[0]&&e[0]<=Math.max(o[0],i[0]),s=Math.min(o[1],i[1])<=e[1]&&e[1]<=Math.max(o[1],i[1]);if(l&&s){let u=a[0]*c[1]-a[1]*c[0];if(Math.abs(u)<1e-6){let h=Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2);return t+h}}t+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function fr(r,e){if(r.length<2)return r[0]??null;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2);if(t+=a,t>=e){let c=(e-(t-a))/a,l=i[0]+(o[0]-i[0])*c,s=i[1]+(o[1]-i[1])*c;return[l,s]}}return null}var Me=pn(Ai(),1);var ae="___",ta=class{constructor(e=3){this.lift_priority=e}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new Me.default;escalatorRoute=new Me.default;straightLadderRoute=new Me.default;initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(t=>{t.points.forEach(n=>{let i=`${t.floor}${ae}${n.id}`;if(this.pointMap.set(i,n),this.nodeMap.set(`${n.floor}${ae}${n.nodeId}`,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push({...n}),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push({...n}),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push({...n}),this.facilityMap.set(n.targetId,o)}}),t.lines.filter(n=>n.direction!=="no").forEach(n=>{let i=`${t.floor}${ae}${n.from}`,o=`${t.floor}${ae}${n.to}`,a=this.pointMap.get(i)?.cds,c=this.pointMap.get(o)?.cds;if(a?.length&&c?.length){let l=kt(a,c);this.addLineItem(i,o,l),n.direction==="double"&&this.addLineItem(o,i,l)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let c=0;c<a.length;c++){let l=`${a[c].floor}${ae}${a[c].id}`;for(let s=0;s<a.length;s++)if(c!==s){let u=`${a[s].floor}${ae}${a[s].id}`,h=this.pointMap.get(l)?.cds,f=this.pointMap.get(u)?.cds;if(h?.length&&f?.length)if(a[c].type==="straightLadder"){let d=t;this.addLineItem(l,u,d,i)}else{let d=n;this.addLineItem(l,u,d,i)}}}}),this.escalatorMap.forEach((o,a)=>{if(o.start&&o.end){let c=`${o.start.floor}${ae}${o.start.id}`,l=`${o.end.floor}${ae}${o.end.id}`,s=this.pointMap.get(c)?.cds,u=this.pointMap.get(l)?.cds;if(s?.length&&u?.length){let h=e;this.addLineItem(c,l,h,i)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new Me.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new Me.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new Me.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${ae}${e.nodeId}`);if(t){let[n,i]=t.split(ae);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{let a=kt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:n.point.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let c=this.facilityMap.get(o.facility).filter(s=>o.floor?s.floor===o.floor:!0);if(!c.length)return null;let l=c.map(s=>a(i,{floor:s.floor,id:s.id})).filter(s=>!!s);return l.reduce((s,u)=>{let h=u.reduce((f,d)=>f+Se(d.points),0);return h<s.distance&&(s.distance=h,s.path=u),s},{distance:1/0,path:l[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${ae}${e.id}`,o=`${t.floor}${ae}${t.id}`,a=n.path(i,o);if(!a)return null;let c=[];return a.map(l=>{let s=this.pointMap.get(l);if(s){let{floor:u}=s;if(c[c.length-1]?.floor===u){let h=c[c.length-1];h.points.push(s.cds),h.endType=s.type,h.destId=s.nodeId,h.distance=Se(h.points)}else c.push({floor:u,points:[s.cds],endType:s.type,destId:s.nodeId,distance:0})}}),c}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new Me.default,this.escalatorRoute=new Me.default,this.straightLadderRoute=new Me.default}};var ue=pn(Ai(),1);import{cloneDeep as Pi}from"lodash";var Vt="___",ea=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new ue.default;escalatorRoute=new ue.default;straightLadderRoute=new ue.default;forwardLineMap=new Map;forwardRoute=new ue.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(t=>{let n=[];try{n=JSON.parse(t.entry_end_floor)}catch{n=[]}let i=[];try{i=JSON.parse(t.entry_start_floor)}catch{i=[]}return{...t,entry_start_floor:i,entry_end_floor:n}})}initRoute(e,t){this.clear(),this.roadInfo=e,this.initFacilities(t),e.length&&(e.forEach(n=>{n.points.forEach(i=>{i.floor=n.floor;let o=`${n.floor}${Vt}${i.id}`;if(this.pointMap.set(o,i),this.nodeMap.set(`${n.floor}${Vt}${i.nodeId}`,o),this.isFacilityByType(i.type)){let a=this.facilities.find(c=>c.id===+i.targetId);if(a){switch(a.entry_infra_type){case"straightLadder":if(a.entry_end_floor.find(u=>u.floor===n.floor)&&a.entry_start_floor.find(u=>u.floor===n.floor)){let u=this.straightLadderMap.get(i.targetId)||[];u.push({...i}),this.straightLadderMap.set(i.targetId,u)}break;case"staircase":if(a.entry_end_floor.find(u=>u.floor===n.floor)&&a.entry_start_floor.find(u=>u.floor===n.floor)){let u=this.staircaseMap.get(i.targetId)||[];u.push({...i}),this.staircaseMap.set(i.targetId,u)}break;case"escalator":let l=this.escalatorMap.get(i.targetId)||[];if(a.entry_start_floor.find(u=>u.floor===n.floor)){let u=l.find(h=>h.end?.floor!==n.floor&&!h.start);u?u.start=i:l.push({start:i})}if(a.entry_end_floor.find(u=>u.floor===n.floor)){let u=l.find(h=>h.start?.floor!==n.floor&&!h.end);u?u.end=i:l.push({end:i})}this.escalatorMap.set(i.targetId,l);break;case"ramp":let s=this.rampMap.get(i.targetId)||[];if(a.entry_start_floor.find(u=>u.floor===n.floor)){let u=s.find(h=>h.end?.floor!==n.floor&&!h.start);u?u.start=i:s.push({start:i})}if(a.entry_end_floor.find(u=>u.floor===n.floor)){let u=s.find(h=>h.start?.floor!==n.floor&&!h.end);u?u.end=i:s.push({end:i})}this.rampMap.set(i.targetId,s);break}let c=this.facilityMap.get(i.targetId)||[];c.push({...i}),this.facilityMap.set(i.targetId,c)}}i.type==="parkingSpace"&&this.parkingMap.set(`${n.floor}${Vt}${i.name}`,i)}),n.lines.filter(i=>i.direction!=="no").forEach(i=>{let o=`${n.floor}${Vt}${i.from}`,a=`${n.floor}${Vt}${i.to}`,c=this.pointMap.get(o)?.cds,l=this.pointMap.get(a)?.cds;if(c?.length&&l?.length){let s=kt(c,l);switch(this.addLineItem(o,a,s),this.addLineItem(a,o,s),i.direction){case"double":this.addLineItem(o,a,s,this.forwardLineMap),this.addLineItem(a,o,s,this.forwardLineMap);break;case"single":this.addLineItem(o,a,s,this.forwardLineMap);break;case"back":this.addLineItem(a,o,s,this.forwardLineMap);break}}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let c=0;c<a.length;c++){let l=`${a[c].floor}${Vt}${a[c].id}`;for(let s=0;s<a.length;s++)if(c!==s){let u=`${a[s].floor}${Vt}${a[s].id}`,h=this.pointMap.get(l)?.cds,f=this.pointMap.get(u)?.cds;if(h?.length&&f?.length)if(a[c].type==="straightLadder"){let d=t;this.addLineItem(l,u,d,i)}else{let d=n;this.addLineItem(l,u,d,i)}}}}),this.escalatorMap.forEach((o,a)=>{o.forEach(c=>{if(c.start&&c.end){let l=`${c.start.floor}${Vt}${c.start.id}`,s=`${c.end.floor}${Vt}${c.end.id}`,u=this.pointMap.get(l)?.cds,h=this.pointMap.get(s)?.cds;if(u?.length&&h?.length){let f=e;this.addLineItem(l,s,f,i)}}})})}initBaseRoute(){let e=new Map(Pi([...this.lineMap]));this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new ue.default(e)}initEscalatorRoute(){let e=new Map(Pi([...this.lineMap])),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new ue.default(e)}initStraightLadderRoute(){let e=new Map(Pi([...this.lineMap])),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new ue.default(e)}initForwardRoute(){this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Vt}${n.start.id}`,o=`${n.end.floor}${Vt}${n.end.id}`,a=this.pointMap.get(i)?.cds,c=this.pointMap.get(o)?.cds;a?.length&&c?.length&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.forwardRoute=new ue.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${Vt}${e.nodeId}`);if(t){let[n,i]=t.split(Vt);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{let a=kt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:t.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let n=this.parkingMap.get(`${e.floor}${Vt}${e.parkingSpace}`);if(n)return{floor:e.floor,id:n.id}}let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;case"forward":a=this.getForwardPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let c=this.facilityMap.get(o.facility).filter(s=>o.floor?s.floor===o.floor:!0);if(!c.length)return null;let l=c.map(s=>a(i,{floor:s.floor,id:s.id})).filter(s=>!!s);return l.reduce((s,u)=>{let h=u.reduce((f,d)=>f+Se(d.points),0);return h<s.distance&&(s.distance=h,s.path=u),s},{distance:1/0,path:l[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${Vt}${e.id}`,o=`${t.floor}${Vt}${t.id}`,a=n.path(i,o);if(!a)return null;let c=[];return a.map(l=>{let s=this.pointMap.get(l);if(s){let{floor:u}=s,h=s.type;if(this.isFacilityByType(s.type)){let f=this.facilities.find(d=>d.id===+s.targetId);f&&(h=f.entry_infra_type)}if(c[c.length-1]?.floor===u){let f=c[c.length-1];f.points.push(s.cds),f.endType=h,f.destId=s.nodeId,f.distance=Se(f.points)}else c.push({floor:u,points:[s.cds],endType:h,destId:s.nodeId,distance:0})}}),c}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}getForwardPath(e,t){return this.getRoutePath(e,t,this.forwardRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new ue.default,this.escalatorRoute=new ue.default,this.straightLadderRoute=new ue.default}};var nn=class{static keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let e=this.createKey();for(;this.keySet.has(e);)e=this.createKey();return e}static removeKey(e){this.keySet.delete(e)}static dispose(){this.keySet.clear()}};function na(r){return r.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function we(r,e,t){return new Promise((n,i)=>{let o=nn.genUniqueKey(),a=({data:c})=>{c.type===`${e}_result`&&c.key===o&&(nn.removeKey(o),self.removeEventListener("message",a),c.error?i(c.error):n(c.data))};r.addEventListener("message",a),r.postMessage({type:e,key:o,data:t})})}function r_(r){let e={};for(let n in r)n.startsWith("on")&&(e[na(n.slice(2))]=r[n]);let t=async({data:n})=>{if(e[n.type])try{let i=await e[n.type](n.data);self.postMessage({type:`${n.type}_result`,key:n.key,data:i})}catch(i){self.postMessage({type:`${n.type}_result`,key:n.key,error:i})}else self.postMessage({type:`${n.type}_result`,key:n.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}import{BoxGeometry as Sh,BufferGeometry as Mh,Line as wh,LineBasicMaterial as ra,Mesh as Th}from"three";function a_(r,e=16711680){let t=new ra({color:e}),n=new Mh().setFromPoints(r);return new wh(n,t)}function u_(r,e=16711680){let t=new ra({color:e}),n=new Sh(1,1,1),i=new Th(n,t);return i.position.copy(r),i}function ee(r,e,t=0){r.forEach(n=>{n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"?(n.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=e[0],o[1]-=e[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(i=>i.map(o=>Te(o,e)))),n.doors?.length&&n.doors.map(i=>{i.coord=Te(i.coordinate,e)})):n.geometry.coords=Te(n.geometry.cds,e)});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(t+n+1)}}function Te(r,e){return[r[0]-e[0],r[1]-e[1]]}import{Group as Ch}from"@tweenjs/tween.js";var vn=class{pauseTween=!1;tweenStore=new Set;group=new Ch;constructor(){}update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(e=>{this.tweenStore.add(e),e.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(e=>{e.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(e){this.group.remove(e)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(e=>e.stop()),this.group.removeAll()}dispose(){this.clear()}};import{EventDispatcher as Df,Box2 as If,Vector3 as on,Vector2 as xn,Raycaster as Rf,Box3 as Nf,Color as Lf,AmbientLight as Of}from"three";import{EventDispatcher as _f}from"three";import{Object3D as zh,ExtrudeGeometry as Gh,Mesh as kh,Box3 as gr,Vector3 as me,BufferGeometry as Vh,LineSegments as Hh,Ray as aa,Vector2 as Oe}from"three";import{LineMaterial as Ah}from"three/examples/jsm/lines/LineMaterial";import{Color as dr,LineBasicMaterial as Ph,MeshStandardMaterial as Dh,MeshBasicMaterial as Ih,ShaderMaterial as Rh,DoubleSide as Nh}from"three";function ia(r){return`${r.x}-${r.y}-${r.z}`}var Rt=class{static lineMaterialMap=new Map;static meshStandardMaterialMap=new Map;static meshBasicMaterialMap=new Map;static shaderMaterialMap=new Map;static line2MaterialMap=new Map;static generateLineMaterialKey({color:e,opacity:t}){return`${e}-${t}`}static createLineMaterial({color:e,opacity:t}){let n=this.generateLineMaterialKey({color:e,opacity:t});if(this.lineMaterialMap.has(n))return this.lineMaterialMap.get(n);let i=new Ph({color:new dr(e).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(n,i),i}static createMeshStandardMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new Dh({color:new dr(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshBasicMaterialMap.has(n))return this.meshBasicMaterialMap.get(n);let i=new Ih({color:e,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(n,i),i}static createShaderMaterial({gradualColor:e,center:t,maxValue:n,opacity:i,direction:o,max:a,min:c}){let l=`${e.toString()}-${ia(t)}-${n}-${i}-${ia(o)}`;if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let s=`
3
3
  uniform vec3 uColor;
4
4
  uniform vec3 uGradualColor;
5
5
  uniform vec3 center;
@@ -36,7 +36,7 @@ var nh=Object.create;var ys=Object.defineProperty;var rh=Object.getOwnPropertyDe
36
36
  void main() {
37
37
  gl_FragColor = vec4(vColor.x, vColor.y, vColor.z, opacity);
38
38
  }
39
- `,h=new Rh({uniforms:{uColor:{value:new fr(e[0]).convertLinearToSRGB()},uGradualColor:{value:new fr(e[1]).convertLinearToSRGB()},center:{value:t},maxValue:{value:n},opacity:{value:i},uDirection:{value:o},uMax:{value:a},uMin:{value:c}},vertexShader:s,fragmentShader:u,side:Nh});return this.shaderMaterialMap.set(l,h),h}static createLine2MaterialMap({color:e,width:t,dashed:n,resolution:i}){let o=`${e}-${t}-${n}-${i.x}-${i.y}`;if(this.line2MaterialMap.has(o))return this.line2MaterialMap.get(o);let a=new Ah({color:parseInt(e.slice(1),16),dashed:n,linewidth:t,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:i});return this.line2MaterialMap.set(o,a),a}static dispose(){this.lineMaterialMap.forEach((e,t)=>{e.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((e,t)=>{e.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((e,t)=>{e.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((e,t)=>{e.dispose()}),this.shaderMaterialMap.clear(),this.line2MaterialMap.forEach((e,t)=>{e.dispose()}),this.line2MaterialMap.clear()}};import{DataTexture as Lh,LinearFilter as oa,RGBAFormat as Oh}from"three";var He=class{static canvas=document.createElement("canvas");static ctx=this.canvas.getContext("2d");static cacheMap=new Map;static options={width:1024,height:64,font:"54px sans-serif",textBaseline:"hanging",lineWidth:12,fillStyle:"rgba(0,0,0,1)",strokeStyle:"white"};static getCanvas(){if(this.canvas)return this.canvas;{let e=document.createElement("canvas");return this.canvas=e,e}}static getCtx(){if(this.ctx)return this.ctx;let t=this.getCanvas().getContext("2d");return this.ctx=t,t}static getMergedOptions(e){return{...this.options,...e}}static setCtxStyle(e){let t=this.getCanvas(),n=this.getCtx();t.width=e.width,t.height=e.height,n.font=e.font,n.textBaseline=e.textBaseline,n.lineWidth=e.lineWidth,n.fillStyle=e.fillStyle,n.strokeStyle=e.strokeStyle}static getTextureByText(e,t){let n=this.getMergedOptions(t),i=yn({...n,text:e});if(this.cacheMap.has(i))return this.cacheMap.get(i);let o=this.getCanvas(),a=this.getCtx();a.clearRect(0,0,o.width,o.height),this.setCtxStyle(n);let c=Es(e)?4:8;n.lineWidth&&a.strokeText(e,2,c),a.fillText(e,2,c);let l=Math.ceil(a.measureText(e).width);l=l%2===0?l:l+1,l+=2;let s=a.getImageData(0,0,l,64),u=new Lh(Uint8Array.from(s.data),l,64,Oh);return u.flipY=!0,u.minFilter=oa,u.magFilter=oa,this.cacheMap.set(i,u),u}static dispose(){this.ctx=null,this.canvas=null,this.cacheMap.forEach(e=>e.dispose()),this.cacheMap.clear()}};import{LinearFilter as sa,RGBAFormat as Fh,TextureLoader as Uh}from"three";var We=class{static textureLoader=new Uh;static urlTextureMap=new Map;static getTextureByUrl(e){if(this.urlTextureMap.has(e))return this.urlTextureMap.get(e);let t=this.textureLoader.loadAsync(e);return t.then(n=>{n.format=Fh,n.magFilter=sa,n.minFilter=sa,n.colorSpace="srgb",this.urlTextureMap.set(e,n)}),this.urlTextureMap.set(e,t),t}static dispose(){this.urlTextureMap.forEach(e=>{e instanceof Promise?e.then(t=>t.dispose()):e.dispose()}),this.urlTextureMap.clear()}};import{GLTFLoader as Bh}from"three/examples/jsm/loaders/GLTFLoader";var qe=class{static loader=new Bh;static modelMap=new Map;static async loadModel(e){if(this.modelMap.has(e)){let n=this.modelMap.get(e);if(n instanceof Promise)n.then(i=>({...i,scene:i.scene.clone()}));else return{...n,scene:n.scene.clone()}}let t=new Promise((n,i)=>{this.loader.load(e,o=>{n(o),this.modelMap.set(e,o)},void 0,i)});return this.modelMap.set(e,t),t.then(n=>({...n,scene:n.scene.clone()}))}static dispose(){this.modelMap.forEach(e=>{e instanceof Promise?e.then(t=>Jt(t.scene)):Jt(e.scene)}),this.modelMap.clear()}};import{cloneDeep as Wh}from"lodash";var Di={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],locked:!1,visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9},Ft=class extends zh{constructor(t,n){super();this.context=t;if(this.options=dn(Wh({...Di,...n}),this),this.options.geometry.type==="point"){let[i,o]=this.options.geometry.coords;return this.position.set(i,o,this.options.height+this.options.airHeight),this}this.initDoor(),this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",({value:i})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",({value:i})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",({value:i})=>{this.dispose(),this.init()}),this.addEventListener("change-strokeColor",({value:i})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",({value:i})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-airHeight",({value:i})=>{this.position.z=i}),this.addEventListener("change-visible",({value:i})=>{this.visible=i}),this.addEventListener("change-stroke",({value:i})=>{if(i){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else this.line&&(this.remove(this.line),this.lineGeometry?.dispose())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}geometry;material;mesh;line;lineMaterial;lineGeometry;options;getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new me,n=new dr;return n.setFromObject(this),n.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new me(0,0,0);let t=new dr,n=new me;return t.setFromObject(this),t.getSize(n),n}getPosition(){let t=this.getCenter();return t.setZ(t.z+this.options.height/2),t}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&this.options.strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){if(this.options.doors?.length&&this.options.geometry.type==="polygon"){let t=this.options.geometry.coords[0];this.options.doors.forEach(n=>{let i=n.type==="single"?.5:1,o=.5,a=fn(t,n.coord),c=new Oe(...n.coord),l=new Oe(...t[a]).sub(new Oe(...n.coord)).normalize(),s=new Oe().addVectors(c,l.clone().multiplyScalar(i)),u=new Oe().addVectors(c,l.clone().multiplyScalar(-i)),h=new Oe(-l.y,l.x),f=new Oe().addVectors(s,h.clone().multiplyScalar(o));Ms([f.x,f.y],t)||(h.multiplyScalar(-1),f=new Oe().addVectors(s,h.clone().multiplyScalar(o)));let d=new Oe().addVectors(u,h.clone().multiplyScalar(o)),g=[[s.x,s.y],[f.x,f.y],[d.x,d.y],[u.x,u.y]];this.options.geometry.coords=[[...t.slice(0,a+1),...g,...t.slice(a+1)]],t=this.options.geometry.coords[0]})}}initGeometry(){let t=be(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new Gh(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=Rt.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.height<=.1)return this.material=t,t;let n=Rt.createMeshBasicMaterial({color:Le(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,n],[t,n]}getMaxAndMin(t,n){let i=new dr().setFromObject(this),o=t.clone().add(n.clone().multiplyScalar(1e3)),a=new aa(o,n.clone().multiplyScalar(-1)),c=new me;a.intersectBox(i,c);let l=t.clone().add(n.clone().multiplyScalar(-1e3)),s=new aa(l,n.clone()),u=new me;return s.intersectBox(i,u),{max:u,min:c}}initGradualMaterial(){let{max:t,min:n}=new dr().setFromObject(this),i=t.clone().sub(n),o=Math.max(i.x,i.y,i.z)/2,a=this.getPosition(),c=new me(-1,.2,0).normalize(),{max:l,min:s}=this.getMaxAndMin(a,c),u=Rt.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:o,opacity:this.options.fillOpacity,direction:new me(-1,.2,0),max:l,min:s});if(this.options.height<=.1)return this.material=u,u;let h=this.getCenter(),f=new me(-1,.2,1).normalize(),{max:d,min:g}=this.getMaxAndMin(h,f),p=Rt.createShaderMaterial({gradualColor:[Le(this.options.gradualColor[0],this.options.colorFactor),Le(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:o,opacity:this.options.fillOpacity,direction:new me(-1,.2,1),max:d,min:g});return this.material=[u,p],[u,p]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){let t=Rt.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new kh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],n=this.options.height+this.options.deltaHeight,{coords:i}=this.options.geometry;for(let o=0;o<i.length;o++){let a=i[o];for(let c=0;c<a.length;c++){let l=a[c],s=c+1===a.length?a[0]:a[c+1];t.push(new me(l[0],l[1],n)),t.push(new me(s[0],s[1],n))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),n=new Vh().setFromPoints(t);this.lineGeometry=n}createBorder(){this.line&&this.remove(this.line);let t=new Hh(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.line=t,this.add(t),t}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;this.mesh.updateMatrixWorld(!0);let n=t.intersectObject(this.mesh);if(n[0]){let{point:i,distance:o}=n[0];return{position:i,distance:o}}return!1}dispose(){this.geometry?.dispose(),this.line?.geometry.dispose(),this.clear()}};import{Object3D as qh,PlaneGeometry as Xh,Mesh as jh,ShadowMaterial as Yh,Color as $h,DoubleSide as Zh}from"three";var gr=class extends qh{directionalLight;plane;basicOpacity=.07;constructor(){super(),this.directionalLight=this.initLight(),this.initPlane()}initLight(){let e=xs(16777215,.5);return e.position.set(0,0,100),this.add(e),e}changeLightCamera(e){let t=e.x,n=e.y;this.directionalLight.shadow.camera.left=-t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.top=n,this.directionalLight.shadow.camera.bottom=-n,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(t,n)}changeLightColor(e){this.directionalLight.color=new $h(e)}setPosition(e){this.position.copy(e),this.directionalLight.position.set(-e.x/2,-e.y/2,100)}initPlane(e=1e3,t=1e3){let n=new Xh(e,t),i=new Yh({transparent:!0,opacity:0,side:Zh}),o=new jh(n,i);return o.receiveShadow=!0,o.position.z=-10,this.add(o),this.plane=o,o}setTarget(e){this.directionalLight.target=e}transformOpacity(e){return e*this.basicOpacity}setOpacity(e){this.plane.material.opacity=this.transformOpacity(e)}dispose(){Jt(this,!0)}};import{EventDispatcher as tp,Vector3 as ep}from"three";import{Box3 as ua,EventDispatcher as Kh,Vector3 as At}from"three";import{debounce as Jh}from"lodash";var Qh={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},mr=class extends Kh{constructor(t,n={}){super();this.context=t;this.options={...Qh,...n},this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}div;element;position=new At;clientPos={x:0,y:0};visible=!0;options;placement="top";observer=null;initObserver(){let t=new MutationObserver(Jh(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){if(this.element instanceof Ft&&this.element.options.geometry.type==="polygon"){let{max:o,min:a}=new ua().setFromObject(this.element),c=(o.x+a.x)/2,l=(o.y+a.y)/2;return{left:new At(a.x,l,o.z),leftTop:new At(a.x,o.y,o.z),top:new At(c,o.y,o.z),rightTop:new At(o.x,o.y,o.z),right:new At(o.x,l,o.z),rightBottom:new At(o.x,a.y,o.z),bottom:new At(c,a.y,o.z),leftBottom:new At(a.x,a.y,o.z),center:new At(c,l,o.z)}}let{x:t,y:n,z:i}=this.element?.getPosition?.()||this.position;return{left:new At(t,n,i),leftTop:new At(t,n,i),top:new At(t,n,i),rightTop:new At(t,n,i),right:new At(t,n,i),rightBottom:new At(t,n,i),bottom:new At(t,n,i),leftBottom:new At(t,n,i),center:new At(t,n,i)}}getPlacementScreenPosition(){let{width:t,height:n}=this.context.clientSize,i=this.getPlacementPosition();return Object.keys(i).reduce((o,a)=>{let{x:c,y:l}=et(i[a],this.context.camera,t,n);return o[a]={x:c,y:l},o},{})}checkOverflow(t,n){let{width:i,height:o}=this.context.clientSize;return n.x>0&&t.x<i&&n.y<o&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:n}=this.div,i=this.getPlacementScreenPosition(),o=t/2,a=n/2,c=[{type:"center",getBox(l,s){return{max:{x:o+l,y:s-n},min:{x:l-o,y:s}}}},{type:"left",getBox(l,s){return{max:{x:l,y:s-a},min:{x:l-t,y:s+a}}}},{type:"leftTop",getBox(l,s){return{max:{x:l,y:s-n},min:{x:l-t,y:s}}}},{type:"top",getBox(l,s){return{max:{x:l+o,y:s-n},min:{x:l-o,y:s}}}},{type:"rightTop",getBox(l,s){return{max:{x:l+t,y:s-n},min:{x:l,y:s}}}},{type:"right",getBox(l,s){return{max:{x:l+t,y:s-a},min:{x:l,y:s+a}}}},{type:"rightBottom",getBox(l,s){return{max:{x:l+t,y:s},min:{x:l,y:s+n}}}},{type:"bottom",getBox(l,s){return{max:{x:l+o,y:s},min:{x:l-o,y:s+n}}}},{type:"leftBottom",getBox(l,s){return{max:{x:l,y:s},min:{x:l-t,y:s+a}}}}];for(let l=0;l<c.length;l++){let s=c[l],u=i[s.type],{max:h,min:f}=s.getBox(u.x,u.y);if(this.checkOverflow(h,f))return{type:s.type,position:u}}return{type:"center",position:i.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className=`overlay_${t.type}`,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,n="block"){t!==this.visible&&(this.div.style.display=t?n:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=`${t}`}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new ua().setFromObject(this.element).getCenter(new At):this.position}get withinDisplayRange(){let{x:t,y:n}=this.clientPos,{width:i,height:o}=this.context.clientSize;return t>=0&&t<=i&&n>=0&&n<=o}_updatePosition(t,n){this.clientPos={x:t,y:n};let{width:i,height:o,x:a,y:c}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=`${a}px`,this.div.style.top=`${c+o}px`),this.options.autoUpdate?this.div.style.transform=`translate3d(${t}px, ${-o+n}px, 0)`:this.dispatchEvent({type:"update-position",x:t,y:n,width:i,height:o})}updatePosition(t=!1){let n=this.getPosition(),{width:i,height:o}=this.context.clientSize,{x:a,y:c}=et(n,this.context.camera,i,o);this.clientPos.x===a&&this.clientPos.y===c&&!t||this._updatePosition(a,c)}onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()};registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.unRegistryEvent(),this.unBindElement(),this.observer?.disconnect(),this.div?.remove(),this.div=null}};var np={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},rn=class extends tp{constructor(t,n){super();this.context=t;this.options=dn({...np,...n},this),this.position.set(n.position?.x||0,n.position?.y||0,n.position?.z||0),this.overlay=new mr(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",({x:i,y:o,height:a})=>{this.overlay.div.style.transform=`translate3d(calc(${i}px - 50%), calc(${-a+o}px - ${this.options.icon&&this.options.icon_position!=="center"?"100%":"50%"}), 0)`}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",({value:i})=>{i?this.img?this.img.setAttribute("src",i):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",({value:i})=>{let o=this.textDiv;if(o){let a=this.initText();this.div.replaceChild(a,o)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",({value:i})=>{this.overlay.setOpacity(i)}),this.addEventListener("change-icon_size",({value:i})=>{this.img&&(this.img.style.width=`${i?.[0]||32}px`,this.img.style.height=`${i?.[1]||32}px`,this.resetSize())}),this.addEventListener("change-icon_opacity",({value:i})=>{this.img&&(this.img.style.opacity=`${i}`)}),this.addEventListener("change-icon_border",({value:i})=>{this.img&&(this.img.style.border=`${i.width}px solid ${i.color}`)}),this.addEventListener("change-background",({value:i})=>{this.div.style.background=i})}div;textDiv;img;overlay;options;visible=!0;size={width:0,height:0};position=new ep;userData={};showTextStatus=!0;disposed=!1;get withinDisplayRange(){return this.overlay.withinDisplayRange}async resetSize(){if(await Ts(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:n}=this.img.getBoundingClientRect();this.size={width:t+2,height:n+2}}else{let{width:t,height:n}=this.div.getBoundingClientRect();this.size={width:t+2,height:n+2}}}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(n=>{let i=document.createElement("div");if(i.style.whiteSpace="nowrap",n.styles)for(let[o,a]of Object.entries(n.styles))i.style[o]=a;i.textContent=n.text,t.appendChild(i)}),t}initIcon(){let t=document.createElement("img");return t.setAttribute("src",this.options.icon),t.style.width=`${this.options.icon_size?.[0]||32}px`,t.style.height=`${this.options.icon_size?.[1]||32}px`,t.style.opacity=`${this.options.icon_opacity}px`,t.style.borderRadius="50%",this.options.icon_border.width&&(t.style.border=`${this.options.icon_border.width}px solid ${this.options.icon_border.color}`),t.onload=()=>{this.resetSize()},this.img=t,t}_changePosition=()=>{this.overlay.updatePosition(!0)};registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t=this.context.config.poi.boxScale){let{width:n,height:i}=this.size,o=n*t,a=i*t,{x:c,y:l}=this.overlay.clientPos;return{left:c-o/2,right:c+o/2,top:this.options.icon?l-a:l-a/2,bottom:this.options.icon?l:l+a/2}}getOriginBox(){return this.getBox(1)}isContain(t,n){if(!this.overlay.visible||!this.visible)return!1;let i=this.getOriginBox();return t>=i.left&&t<=i.right&&n>=i.top&&n<=i.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}};import{Box3 as Er,Object3D as Ii,Vector3 as br}from"three";import{MeshBasicMaterial as rp,Object3D as ip,PlaneGeometry as op,Texture as sp,DoubleSide as ap,Mesh as up,Matrix3 as la,Vector2 as lp}from"three";import{create as cp}from"@mars3d/heatmap.js";import{featureCollection as hp,point as pp,bbox as fp,center as dp}from"@turf/turf";var yr=class extends ip{constructor(t){super();this.context=t;this.div=document.createElement("div")}heatmap;div;plane;clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){this.clearHeatmap();let{width:n,height:i,leftTop:o,center:a}=this.getBox(t);this.heatmap=cp({width:n,height:i,container:this.div,...this.context.config.heatMap}),this.heatmap.setData(this.transformData(t,o)),this.initPlane(n,i),this.position.set(a[0],a[1],this.position.z)}initPlane(t,n){this.plane&&this.remove(this.plane);let i=new op(t,n),o=new sp(this.div.firstChild);o.needsUpdate=!0;let a=new rp({transparent:!0,side:ap,map:o});a.needsUpdate=!0,this.plane=new up(i,a),this.add(this.plane)}getTransMatrix({x:t,y:n}){return new la().makeScale(1,-1).multiply(new la().makeTranslation(0-t,0-n))}transformData(t,n){let i=this.getTransMatrix(n);return{data:t.data.map(a=>{let c=new lp(a.x,a.y).applyMatrix3(i);return{x:c.x,y:c.y,value:a.value}}),max:t.max,min:t.min}}getBox(t){let n=hp(t.data.map(s=>pp([s.x,s.y]))),i=fp(n),o=i[2]-i[0],a=i[3]-i[1],c={x:i[0],y:i[3]},l=dp(n);return{width:o,height:a,leftTop:c,center:l.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}};import{Object3D as gp,Vector3 as mp}from"three";var vr=class extends gp{constructor(t,n){super();this.context=t;this.options=n;this.position.copy(n.position||new mp(0,0,0)),this.loadModel()}model=null;async loadModel(){let t=await qe.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t}dispose(){Jt(this),this.model=null}};import{Box3 as vp,Vector3 as _p}from"three";import{Object3D as yp}from"three";var Ht=class extends yp{constructor(t){super();this.context=t}dispose(){Jt(this),this.children.forEach(t=>t.dispose?.()),this.clear()}};var _r=class extends Ht{graphicMap=new Map;constructor(e){super(e)}getCenter(){return new vp().setFromObject(this).getCenter(new _p)}createGraphic(e){let t=new Ft(this.context,e);return this.add(t),this.graphicMap.set(e.id,t),t}removeGraphic(e){this.remove(e),this.graphicMap.delete(e.options.id),e.dispose()}removeGraphicById(e){this.graphicMap.has(e)&&this.removeGraphic(this.graphicMap.get(e))}getGraphicByNodeId(e){return this.graphicMap.get(e)||null}getGraphicByRaycaster(e){let t={distance:1e4,graphic:null,position:null},n=this.children.reduce((i,o)=>{if(o instanceof Ft){let a=o.raycast(e);if(a){let{distance:c}=a;if(c<i.distance)return{distance:a.distance,position:a.position,graphic:o}}return i}else return i},t);return n===t?{graphics:[],position:null}:{graphics:[n.graphic],position:n.position}}};import{debounce as xp}from"lodash";var _n=class extends Ht{pois=[];debounceCollisionDetection;timer=new Gt;constructor(e){super(e),this.registryEvent(),this.debounceCollisionDetection=xp(this.collisionDetection,10)}clear(e=!1){return this.pois.forEach(t=>{t.options.built_in&&!e||t.dispose()}),this.pois=e?[]:this.pois.filter(t=>t.options.built_in),this}createPoi(e){let t=new rn(this.context,e);return this.pushPoi(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),t}changePoiLevelOrCollisionEnable(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.pois.splice(t,1),this.pushPoi(e))}removePoi(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.pois.splice(t,1),e.dispose())}removePoiById(e){let t=this.pois.find(n=>n.options.id===e);t&&this.removePoi(t)}getPoiById(e){return this.pois.find(n=>n.options.id===e)||null}pushPoi(e){if(!e.options.collision_enable){this.pois.unshift(e);return}if(e.options.level===0){this.pois.push(e);return}for(let t=0;t<this.pois.length;t++){let n=this.pois[t];if(n.options.collision_enable&&n.options.level<=e.options.level){this.pois.splice(t,0,e);return}}this.pois.push(e)}getPoiByDeviceXy(e,t){return this.pois.filter(i=>i instanceof rn&&i.isContain(e,t))}onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let e=[];this.pois.filter(n=>n.visible&&n.withinDisplayRange).forEach((n,i)=>{let{left:o,right:a,top:c,bottom:l}=n.getBox();if(i===0||!n.options.collision_enable){e.push({left:o,right:a,top:c,bottom:l}),n.parentSetVisible(!0);return}let s=e.some(u=>u.left<a&&u.right>o&&u.top<l&&u.bottom>c);n.parentSetVisible(!s),s||e.push({left:o,right:a,top:c,bottom:l})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(e=>e.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};import{debounce as Ep}from"lodash";import{Vector2 as bp,Vector3 as Sp}from"three";var xr=class extends Ht{pois=[];debounceCollisionDetection;timer=new Gt;constructor(e){super(e),this.registryEvent(),this.debounceCollisionDetection=Ep(this.collisionDetection,10)}clear(){return this.pois.forEach(e=>{e.dispose()}),this.pois=[],this}createPoi(e){let t=new ne(this.context,e);return this.pushPoi(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),t}changePoiLevelOrCollisionEnable(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.pois.splice(t,1),this.pushPoi(e))}removePoi(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.remove(e),this.pois.splice(t,1),e.dispose())}removePoiById(e){let t=this.pois.find(n=>n.options.id===e);t&&this.removePoi(t)}getPoiById(e){return this.pois.find(n=>n.options.id===e)||null}pushPoi(e){if(this.add(e),!e.options.collision_enable){this.pois.unshift(e);return}if(e.options.level===0){this.pois.push(e);return}for(let t=0;t<this.pois.length;t++){let n=this.pois[t];if(n.options.collision_enable&&n.options.level<=e.options.level){this.pois.splice(t,0,e);return}}this.pois.push(e)}getPoiByDeviceXy(e,t){let n=new bp(e,t);return this.pois.filter(o=>o instanceof ne&&o.canSelect&&o.box.containsPoint(n))}changeParkingSpaceVisibleByZoom=()=>{let e=this.parent?.parent;if(e&&e instanceof Ce){let{clientSize:{width:t,height:n}}=this.context,{max:i,min:o}=e.box,c=Math.min(t/(i.x-o.x),n/(i.y-o.y))*(i.x-o.x)/45;this.pois.filter(l=>l.userData.type==="parkingSpace").map(l=>{let s=this.context.camera.zoom>=c;l.visible=s,s||l.parentSetVisible(s)})}};onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let e=[],{camera:t}=this.context;t.updateMatrixWorld();let n=a=>a<=1&&a>=-1,i=t.projectionMatrix.clone();i.multiply(t.matrixWorldInverse),this.pois.filter(a=>{if(a.visible){let c=new Sp().setFromMatrixPosition(a.matrixWorld);return c.applyMatrix4(i),a.screenPosition=c,n(c.x)&&n(c.y)&&n(c.z)}return!1}).forEach((a,c)=>{let l=a.getBox(a.screenPosition);if(c===0||!a.options.collision_enable){e.push(l),a.parentSetVisible(!0);return}let s=e.some(u=>u.intersectsBox(l));a.parentSetVisible(!s),s||e.push(l)})}registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}dispose(){this.timer.dispose(),this.pois.forEach(e=>e.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var Ce=class extends Ii{constructor(t){super();this.context=t;this.groundLayer=new Ht(this.context),this.graphicLayer=new _r(this.context),this.poiLayer=new _n(this.context),this.poiLayer2=new xr(this.context),this.wallLayer=new Ht(this.context),this.textureLayer=new Ht(this.context),this.glbModelLayer=new Ht(this.context),this.laneLayer=new Ht(this.context),this.mergeGraphicLayer=new Ht(this.context),this.textTextureLayer=new Ht(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}graphicLayer;poiLayer;poiLayer2;wallLayer;textureLayer;glbModelLayer;laneLayer;mergeGraphicLayer;textTextureLayer;grounds=new Set;groundLayer;shadow=new gr;heatmap;groundUpper=new Ii;models=new Ii;modelMap=new Map;groundMaxHeight=0;name="";key="";box=new Er;getPosition(){return this.box.getCenter(new br)}createGround(t){let n=new Ft(this.context,t);this.addGrounds([n])}addGrounds(t){t.forEach(n=>{this.grounds.has(n)||(n.mesh.castShadow=!0,this.grounds.add(n),this.groundLayer.add(n))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(n=>n.options.height+n.options.airHeight+n.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new Er().setFromObject(this).getCenter(new br)}addModel(t){let n=new vr(this.context,t);return this.models.add(n),this.modelMap.set(t.id,n),n}addShadow(){let t=new Er().setFromObject(this.groundUpper),n=t.getCenter(new br),i=t.getSize(new br);this.shadow.setPosition(n),this.shadow.changeLightCamera(i)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addHeatmap(t){this.heatmap||(this.heatmap=new yr(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let n=new Er().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(n.max.z),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}updateBox(){this.box.setFromObject(this)}dispose(){console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.heatmap?.dispose(),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}};import{EventDispatcher as Mp,Vector3 as wp}from"three";var le=class extends Mp{constructor(t){super();this.context=t;this.svg=ws(`${t.container.clientWidth}`,`${t.container.clientHeight}`),t.container.appendChild(this.svg),this._registryEvent()}points=[];svg;enable=!0;_onResize=({width:t,height:n})=>{this.svg&&(this.svg.setAttribute("width",`${t}`),this.svg.setAttribute("height",`${n}`))};_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:n,renderer:i}=this.context,{offsetX:o,offsetY:a}=t,{clientWidth:c,clientHeight:l}=i.domElement,s=o/c*2-1,u=1-a/l*2;return new wp(s,u,0).unproject(n)}getSvgCoordinate(t){let{camera:n,container:i}=this.context;return et(t,n,i.clientWidth,i.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}};var Sr=class extends le{constructor(t){super(t);this.context=t;let{config:{svg:{circle:n,line:i}}}=t;this.circles=[Gn(n.radius,n.fill),Gn(n.radius,n.fill)],this.line=hr(i.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}circles;line;setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{if(this.points[0]){let t=this.getSvgCoordinate(this.points[0]);en(this.circles[0],t.x,t.y),ge(this.line,t)}if(this.points[1]){let t=this.getSvgCoordinate(this.points[1]);en(this.circles[1],t.x,t.y),ge(this.line,void 0,t)}};onPointermove=t=>{this.points.length===1&&(this.line.style.display="block",ge(this.line,void 0,{x:t.offsetX,y:t.offsetY}))};onPointerleave=()=>{this.points[1]||(this.line.style.display="none")};onPointerdown=t=>{if(this.points[1])return;let n=this.getIntersectByPointerEvent(t);if(n){let{offsetX:i,offsetY:o}=t,a=this.circles[this.points.length];en(a,i,o),this.points.length||ge(this.line,{x:i,y:o},{x:i,y:o}),this.addPoint(n)}};addPoint(t){if(this.points.push(t),this.points.length>=2){let n=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:n})}}calculatedDistance(){let[{x:t,y:n},{x:i,y:o}]=this.points;return Math.sqrt((i-t)**2+(o-n)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}};var Mr=class extends le{circles=[];lines=[];isClose=!1;constructor(e){super(e),this.registryEvent()}setEnable(e){super.setEnable(e),e?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(e){this.circles.push(e),this.svg.appendChild(e)}addLine(e){this.lines.push(e),this.svg.appendChild(e)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{this.points.length&&this.points.forEach((e,t)=>{let n=this.getSvgCoordinate(e);this.circles[t]&&en(this.circles[t],n.x,n.y),t!==0&&ge(this.lines[t-1],void 0,n),this.lines[t]&&ge(this.lines[t],n)})};onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",ge(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))};onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")};onPointerdown=e=>{if(this.isClose)return;let t=this.getIntersectByPointerEvent(e);if(t){let{offsetX:n,offsetY:i}=e;this.checkAdsorb(n,i)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(t);let{circle:{fill:o,radius:a},line:{stroke:c}}=this.context.config.svg;if(!this.isClose){let l=Gn(a,o);en(l,n,i),this.addCircle(l)}if(this.lines.length&&ge(this.lastLine,void 0,{x:n,y:i}),!this.isClose){let l=hr(c);ge(l,{x:n,y:i},{x:n,y:i}),this.addLine(l)}}};checkAdsorb(e,t){if(this.points.length<3)return!1;let n=this.circles[0],i=+n.getAttribute("cx"),o=+n.getAttribute("cy");return Math.sqrt((e-i)**2+(t-o)**2)<=5}addPoint(e){if(this.points.push(e),this.isClose){let t=this.calculatedArea();this.dispatchEvent({type:"area",area:t})}}calculatedArea(){let e=this.points.map(i=>[i.x,i.y]),t=0,n=e.length;for(let i=0;i<n;i++){let o=(i+1)%n;t+=e[i][0]*e[o][1]-e[o][0]*e[i][1]}return Math.abs(t/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}};import{Box3 as Tp}from"three";var ca=class extends le{constructor(t){super(t);this.context=t;let{config:{svg:{line:n}}}=t;this.rect=Ve(n.stroke,"transparent"),this.svg.appendChild(this.rect);for(let i=0;i<4;i++)this.cornerRect[i]=Ve(n.stroke,"#ffffff"),this.centerRect[i]=Ve(n.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[i]),this.svg.appendChild(this.centerRect[i]);this.registryEvent()}rect;cornerRect=[];centerRect=[];graphic;setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{if(this.graphic){let t=new Tp().setFromObject(this.graphic),{camera:n,container:{clientWidth:i,clientHeight:o}}=this.context,{min:a,max:c}=t,l=et(a,n,i,o),s=et(c,n,i,o);Xt(this.rect,l.x,s.y,Math.abs(s.x-l.x),Math.abs(s.y-l.y));let{x:u,y:h}=l,{x:f,y:d}=s,g=5,p=[{x:u-g,y:d-g},{x:f-g,y:d-g},{x:u-g,y:h-g},{x:f-g,y:h-g}];for(let S=0;S<p.length;S++)Xt(this.cornerRect[S],p[S].x,p[S].y,g*2,g*2);let m=4,v=(u+f)/2,b=(h+d)/2,y=[{x:v-m,y:d-m},{x:u-m,y:b-m},{x:f-m,y:b-m},{x:v-m,y:h-m}];for(let S=0;S<y.length;S++)Xt(this.centerRect[S],y[S].x,y[S].y,m*2,m*2)}else{Xt(this.rect,0,0,0,0);for(let t=0;t<this.cornerRect.length;t++)Xt(this.cornerRect[t],0,0,0,0),Xt(this.centerRect[t],0,0,0,0)}};selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}};import{BufferGeometry as Cp,Color as Ri,ExtrudeGeometry as Ap,LineSegments as Pp,Mesh as Dp,Object3D as Ip,ShaderMaterial as Rp,Vector3 as ha}from"three";import{mergeGeometries as pa}from"three/examples/jsm/utils/BufferGeometryUtils";var wr=class extends Ip{constructor(t,n){super();this.context=t;this.options=n;n.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;initGeometry(){let t=this.options.map(n=>{let i=be(n.geometry.coords[0],n.geometry.coords.slice(1));return new Ap(i,{steps:1,bevelEnabled:!1,depth:n.height,curveSegments:4})});this.geometry=pa(t),t.forEach(n=>n.dispose())}initMaterial(){let t=`
39
+ `,h=new Rh({uniforms:{uColor:{value:new dr(e[0]).convertLinearToSRGB()},uGradualColor:{value:new dr(e[1]).convertLinearToSRGB()},center:{value:t},maxValue:{value:n},opacity:{value:i},uDirection:{value:o},uMax:{value:a},uMin:{value:c}},vertexShader:s,fragmentShader:u,side:Nh});return this.shaderMaterialMap.set(l,h),h}static createLine2MaterialMap({color:e,width:t,dashed:n,resolution:i}){let o=`${e}-${t}-${n}-${i.x}-${i.y}`;if(this.line2MaterialMap.has(o))return this.line2MaterialMap.get(o);let a=new Ah({color:parseInt(e.slice(1),16),dashed:n,linewidth:t,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:i});return this.line2MaterialMap.set(o,a),a}static dispose(){this.lineMaterialMap.forEach((e,t)=>{e.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((e,t)=>{e.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((e,t)=>{e.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((e,t)=>{e.dispose()}),this.shaderMaterialMap.clear(),this.line2MaterialMap.forEach((e,t)=>{e.dispose()}),this.line2MaterialMap.clear()}};import{DataTexture as Lh,LinearFilter as oa,RGBAFormat as Oh}from"three";var He=class{static canvas=document.createElement("canvas");static ctx=this.canvas.getContext("2d");static cacheMap=new Map;static options={width:1024,height:64,font:"54px sans-serif",textBaseline:"hanging",lineWidth:12,fillStyle:"rgba(0,0,0,1)",strokeStyle:"white"};static getCanvas(){if(this.canvas)return this.canvas;{let e=document.createElement("canvas");return this.canvas=e,e}}static getCtx(){if(this.ctx)return this.ctx;let t=this.getCanvas().getContext("2d");return this.ctx=t,t}static getMergedOptions(e){return{...this.options,...e}}static setCtxStyle(e){let t=this.getCanvas(),n=this.getCtx();t.width=e.width,t.height=e.height,n.font=e.font,n.textBaseline=e.textBaseline,n.lineWidth=e.lineWidth,n.fillStyle=e.fillStyle,n.strokeStyle=e.strokeStyle}static getTextureByText(e,t){let n=this.getMergedOptions(t),i=yn({...n,text:e});if(this.cacheMap.has(i))return this.cacheMap.get(i);let o=this.getCanvas(),a=this.getCtx();a.clearRect(0,0,o.width,o.height),this.setCtxStyle(n);let c=Es(e)?4:8;n.lineWidth&&a.strokeText(e,2,c),a.fillText(e,2,c);let l=Math.ceil(a.measureText(e).width);l=l%2===0?l:l+1,l+=2;let s=a.getImageData(0,0,l,64),u=new Lh(Uint8Array.from(s.data),l,64,Oh);return u.flipY=!0,u.minFilter=oa,u.magFilter=oa,this.cacheMap.set(i,u),u}static dispose(){this.ctx=null,this.canvas=null,this.cacheMap.forEach(e=>e.dispose()),this.cacheMap.clear()}};import{LinearFilter as sa,RGBAFormat as Fh,TextureLoader as Uh}from"three";var We=class{static textureLoader=new Uh;static urlTextureMap=new Map;static getTextureByUrl(e){if(this.urlTextureMap.has(e))return this.urlTextureMap.get(e);let t=this.textureLoader.loadAsync(e);return t.then(n=>{n.format=Fh,n.magFilter=sa,n.minFilter=sa,n.colorSpace="srgb",this.urlTextureMap.set(e,n)}),this.urlTextureMap.set(e,t),t}static dispose(){this.urlTextureMap.forEach(e=>{e instanceof Promise?e.then(t=>t.dispose()):e.dispose()}),this.urlTextureMap.clear()}};import{GLTFLoader as Bh}from"three/examples/jsm/loaders/GLTFLoader";var qe=class{static loader=new Bh;static modelMap=new Map;static async loadModel(e){if(this.modelMap.has(e)){let n=this.modelMap.get(e);if(n instanceof Promise)n.then(i=>({...i,scene:i.scene.clone()}));else return{...n,scene:n.scene.clone()}}let t=new Promise((n,i)=>{this.loader.load(e,o=>{n(o),this.modelMap.set(e,o)},void 0,i)});return this.modelMap.set(e,t),t.then(n=>({...n,scene:n.scene.clone()}))}static dispose(){this.modelMap.forEach(e=>{e instanceof Promise?e.then(t=>Jt(t.scene)):Jt(e.scene)}),this.modelMap.clear()}};import{cloneDeep as Wh}from"lodash";var Di={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],locked:!1,visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9},Ft=class extends zh{constructor(t,n){super();this.context=t;if(this.options=dn(Wh({...Di,...n}),this),this.options.geometry.type==="point"){let[i,o]=this.options.geometry.coords;return this.position.set(i,o,this.options.height+this.options.airHeight),this}this.initDoor(),this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",({value:i})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",({value:i})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",({value:i})=>{this.dispose(),this.init()}),this.addEventListener("change-strokeColor",({value:i})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",({value:i})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-airHeight",({value:i})=>{this.position.z=i}),this.addEventListener("change-visible",({value:i})=>{this.visible=i}),this.addEventListener("change-stroke",({value:i})=>{if(i){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else this.line&&(this.remove(this.line),this.lineGeometry?.dispose())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}geometry;material;mesh;line;lineMaterial;lineGeometry;options;getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new me,n=new gr;return n.setFromObject(this),n.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new me(0,0,0);let t=new gr,n=new me;return t.setFromObject(this),t.getSize(n),n}getPosition(){let t=this.getCenter();return t.setZ(t.z+this.options.height/2),t}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&this.options.strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){if(this.options.doors?.length&&this.options.geometry.type==="polygon"){let t=this.options.geometry.coords[0];this.options.doors.forEach(n=>{let i=n.type==="single"?.5:1,o=.5,a=fn(t,n.coord),c=new Oe(...n.coord),l=new Oe(...t[a]).sub(new Oe(...n.coord)).normalize(),s=new Oe().addVectors(c,l.clone().multiplyScalar(i)),u=new Oe().addVectors(c,l.clone().multiplyScalar(-i)),h=new Oe(-l.y,l.x),f=new Oe().addVectors(s,h.clone().multiplyScalar(o));Ms([f.x,f.y],t)||(h.multiplyScalar(-1),f=new Oe().addVectors(s,h.clone().multiplyScalar(o)));let d=new Oe().addVectors(u,h.clone().multiplyScalar(o)),g=[[s.x,s.y],[f.x,f.y],[d.x,d.y],[u.x,u.y]];this.options.geometry.coords=[[...t.slice(0,a+1),...g,...t.slice(a+1)]],t=this.options.geometry.coords[0]})}}initGeometry(){let t=be(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new Gh(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=Rt.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.height<=.1)return this.material=t,t;let n=Rt.createMeshBasicMaterial({color:Le(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,n],[t,n]}getMaxAndMin(t,n){let i=new gr().setFromObject(this),o=t.clone().add(n.clone().multiplyScalar(1e3)),a=new aa(o,n.clone().multiplyScalar(-1)),c=new me;a.intersectBox(i,c);let l=t.clone().add(n.clone().multiplyScalar(-1e3)),s=new aa(l,n.clone()),u=new me;return s.intersectBox(i,u),{max:u,min:c}}initGradualMaterial(){let{max:t,min:n}=new gr().setFromObject(this),i=t.clone().sub(n),o=Math.max(i.x,i.y,i.z)/2,a=this.getPosition(),c=new me(-1,.2,0).normalize(),{max:l,min:s}=this.getMaxAndMin(a,c),u=Rt.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:o,opacity:this.options.fillOpacity,direction:new me(-1,.2,0),max:l,min:s});if(this.options.height<=.1)return this.material=u,u;let h=this.getCenter(),f=new me(-1,.2,1).normalize(),{max:d,min:g}=this.getMaxAndMin(h,f),p=Rt.createShaderMaterial({gradualColor:[Le(this.options.gradualColor[0],this.options.colorFactor),Le(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:o,opacity:this.options.fillOpacity,direction:new me(-1,.2,1),max:d,min:g});return this.material=[u,p],[u,p]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){let t=Rt.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new kh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],n=this.options.height+this.options.deltaHeight,{coords:i}=this.options.geometry;for(let o=0;o<i.length;o++){let a=i[o];for(let c=0;c<a.length;c++){let l=a[c],s=c+1===a.length?a[0]:a[c+1];t.push(new me(l[0],l[1],n)),t.push(new me(s[0],s[1],n))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),n=new Vh().setFromPoints(t);this.lineGeometry=n}createBorder(){this.line&&this.remove(this.line);let t=new Hh(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.line=t,this.add(t),t}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;this.mesh.updateMatrixWorld(!0);let n=t.intersectObject(this.mesh);if(n[0]){let{point:i,distance:o}=n[0];return{position:i,distance:o}}return!1}dispose(){this.geometry?.dispose(),this.line?.geometry.dispose(),this.clear()}};import{Object3D as qh,PlaneGeometry as Xh,Mesh as jh,ShadowMaterial as Yh,Color as $h,DoubleSide as Zh}from"three";var mr=class extends qh{directionalLight;plane;basicOpacity=.07;constructor(){super(),this.directionalLight=this.initLight(),this.initPlane()}initLight(){let e=xs(16777215,.5);return e.position.set(0,0,100),this.add(e),e}changeLightCamera(e){let t=e.x,n=e.y;this.directionalLight.shadow.camera.left=-t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.top=n,this.directionalLight.shadow.camera.bottom=-n,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(t,n)}changeLightColor(e){this.directionalLight.color=new $h(e)}setPosition(e){this.position.copy(e),this.directionalLight.position.set(-e.x/2,-e.y/2,100)}initPlane(e=1e3,t=1e3){let n=new Xh(e,t),i=new Yh({transparent:!0,opacity:0,side:Zh}),o=new jh(n,i);return o.receiveShadow=!0,o.position.z=-10,this.add(o),this.plane=o,o}setTarget(e){this.directionalLight.target=e}transformOpacity(e){return e*this.basicOpacity}setOpacity(e){this.plane.material.opacity=this.transformOpacity(e)}dispose(){Jt(this,!0)}};import{EventDispatcher as tp,Vector3 as ep}from"three";import{Box3 as ua,EventDispatcher as Kh,Vector3 as At}from"three";import{debounce as Jh}from"lodash";var Qh={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},yr=class extends Kh{constructor(t,n={}){super();this.context=t;this.options={...Qh,...n},this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}div;element;position=new At;clientPos={x:0,y:0};visible=!0;options;placement="top";observer=null;initObserver(){let t=new MutationObserver(Jh(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){if(this.element instanceof Ft&&this.element.options.geometry.type==="polygon"){let{max:o,min:a}=new ua().setFromObject(this.element),c=(o.x+a.x)/2,l=(o.y+a.y)/2;return{left:new At(a.x,l,o.z),leftTop:new At(a.x,o.y,o.z),top:new At(c,o.y,o.z),rightTop:new At(o.x,o.y,o.z),right:new At(o.x,l,o.z),rightBottom:new At(o.x,a.y,o.z),bottom:new At(c,a.y,o.z),leftBottom:new At(a.x,a.y,o.z),center:new At(c,l,o.z)}}let{x:t,y:n,z:i}=this.element?.getPosition?.()||this.position;return{left:new At(t,n,i),leftTop:new At(t,n,i),top:new At(t,n,i),rightTop:new At(t,n,i),right:new At(t,n,i),rightBottom:new At(t,n,i),bottom:new At(t,n,i),leftBottom:new At(t,n,i),center:new At(t,n,i)}}getPlacementScreenPosition(){let{width:t,height:n}=this.context.clientSize,i=this.getPlacementPosition();return Object.keys(i).reduce((o,a)=>{let{x:c,y:l}=et(i[a],this.context.camera,t,n);return o[a]={x:c,y:l},o},{})}checkOverflow(t,n){let{width:i,height:o}=this.context.clientSize;return n.x>0&&t.x<i&&n.y<o&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:n}=this.div,i=this.getPlacementScreenPosition(),o=t/2,a=n/2,c=[{type:"center",getBox(l,s){return{max:{x:o+l,y:s-n},min:{x:l-o,y:s}}}},{type:"left",getBox(l,s){return{max:{x:l,y:s-a},min:{x:l-t,y:s+a}}}},{type:"leftTop",getBox(l,s){return{max:{x:l,y:s-n},min:{x:l-t,y:s}}}},{type:"top",getBox(l,s){return{max:{x:l+o,y:s-n},min:{x:l-o,y:s}}}},{type:"rightTop",getBox(l,s){return{max:{x:l+t,y:s-n},min:{x:l,y:s}}}},{type:"right",getBox(l,s){return{max:{x:l+t,y:s-a},min:{x:l,y:s+a}}}},{type:"rightBottom",getBox(l,s){return{max:{x:l+t,y:s},min:{x:l,y:s+n}}}},{type:"bottom",getBox(l,s){return{max:{x:l+o,y:s},min:{x:l-o,y:s+n}}}},{type:"leftBottom",getBox(l,s){return{max:{x:l,y:s},min:{x:l-t,y:s+a}}}}];for(let l=0;l<c.length;l++){let s=c[l],u=i[s.type],{max:h,min:f}=s.getBox(u.x,u.y);if(this.checkOverflow(h,f))return{type:s.type,position:u}}return{type:"center",position:i.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className=`overlay_${t.type}`,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,n="block"){t!==this.visible&&(this.div.style.display=t?n:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=`${t}`}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new ua().setFromObject(this.element).getCenter(new At):this.position}get withinDisplayRange(){let{x:t,y:n}=this.clientPos,{width:i,height:o}=this.context.clientSize;return t>=0&&t<=i&&n>=0&&n<=o}_updatePosition(t,n){this.clientPos={x:t,y:n};let{width:i,height:o,x:a,y:c}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=`${a}px`,this.div.style.top=`${c+o}px`),this.options.autoUpdate?this.div.style.transform=`translate3d(${t}px, ${-o+n}px, 0)`:this.dispatchEvent({type:"update-position",x:t,y:n,width:i,height:o})}updatePosition(t=!1){let n=this.getPosition(),{width:i,height:o}=this.context.clientSize,{x:a,y:c}=et(n,this.context.camera,i,o);this.clientPos.x===a&&this.clientPos.y===c&&!t||this._updatePosition(a,c)}onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()};registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.unRegistryEvent(),this.unBindElement(),this.observer?.disconnect(),this.div?.remove(),this.div=null}};var np={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},rn=class extends tp{constructor(t,n){super();this.context=t;this.options=dn({...np,...n},this),this.position.set(n.position?.x||0,n.position?.y||0,n.position?.z||0),this.overlay=new yr(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",({x:i,y:o,height:a})=>{this.overlay.div.style.transform=`translate3d(calc(${i}px - 50%), calc(${-a+o}px - ${this.options.icon&&this.options.icon_position!=="center"?"100%":"50%"}), 0)`}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",({value:i})=>{i?this.img?this.img.setAttribute("src",i):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",({value:i})=>{let o=this.textDiv;if(o){let a=this.initText();this.div.replaceChild(a,o)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",({value:i})=>{this.overlay.setOpacity(i)}),this.addEventListener("change-icon_size",({value:i})=>{this.img&&(this.img.style.width=`${i?.[0]||32}px`,this.img.style.height=`${i?.[1]||32}px`,this.resetSize())}),this.addEventListener("change-icon_opacity",({value:i})=>{this.img&&(this.img.style.opacity=`${i}`)}),this.addEventListener("change-icon_border",({value:i})=>{this.img&&(this.img.style.border=`${i.width}px solid ${i.color}`)}),this.addEventListener("change-background",({value:i})=>{this.div.style.background=i})}div;textDiv;img;overlay;options;visible=!0;size={width:0,height:0};position=new ep;userData={};showTextStatus=!0;disposed=!1;get withinDisplayRange(){return this.overlay.withinDisplayRange}async resetSize(){if(await Ts(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:n}=this.img.getBoundingClientRect();this.size={width:t+2,height:n+2}}else{let{width:t,height:n}=this.div.getBoundingClientRect();this.size={width:t+2,height:n+2}}}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(n=>{let i=document.createElement("div");if(i.style.whiteSpace="nowrap",n.styles)for(let[o,a]of Object.entries(n.styles))i.style[o]=a;i.textContent=n.text,t.appendChild(i)}),t}initIcon(){let t=document.createElement("img");return t.setAttribute("src",this.options.icon),t.style.width=`${this.options.icon_size?.[0]||32}px`,t.style.height=`${this.options.icon_size?.[1]||32}px`,t.style.opacity=`${this.options.icon_opacity}px`,t.style.borderRadius="50%",this.options.icon_border.width&&(t.style.border=`${this.options.icon_border.width}px solid ${this.options.icon_border.color}`),t.onload=()=>{this.resetSize()},this.img=t,t}_changePosition=()=>{this.overlay.updatePosition(!0)};registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t=this.context.config.poi.boxScale){let{width:n,height:i}=this.size,o=n*t,a=i*t,{x:c,y:l}=this.overlay.clientPos;return{left:c-o/2,right:c+o/2,top:this.options.icon?l-a:l-a/2,bottom:this.options.icon?l:l+a/2}}getOriginBox(){return this.getBox(1)}isContain(t,n){if(!this.overlay.visible||!this.visible)return!1;let i=this.getOriginBox();return t>=i.left&&t<=i.right&&n>=i.top&&n<=i.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}};import{Box3 as br,Object3D as Ii,Vector3 as Sr}from"three";import{MeshBasicMaterial as rp,Object3D as ip,PlaneGeometry as op,Texture as sp,DoubleSide as ap,Mesh as up,Matrix3 as la,Vector2 as lp}from"three";import{create as cp}from"@mars3d/heatmap.js";import{featureCollection as hp,point as pp,bbox as fp,center as dp}from"@turf/turf";var vr=class extends ip{constructor(t){super();this.context=t;this.div=document.createElement("div")}heatmap;div;plane;clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){this.clearHeatmap();let{width:n,height:i,leftTop:o,center:a}=this.getBox(t);this.heatmap=cp({width:n,height:i,container:this.div,...this.context.config.heatMap}),this.heatmap.setData(this.transformData(t,o)),this.initPlane(n,i),this.position.set(a[0],a[1],this.position.z)}initPlane(t,n){this.plane&&this.remove(this.plane);let i=new op(t,n),o=new sp(this.div.firstChild);o.needsUpdate=!0;let a=new rp({transparent:!0,side:ap,map:o});a.needsUpdate=!0,this.plane=new up(i,a),this.add(this.plane)}getTransMatrix({x:t,y:n}){return new la().makeScale(1,-1).multiply(new la().makeTranslation(0-t,0-n))}transformData(t,n){let i=this.getTransMatrix(n);return{data:t.data.map(a=>{let c=new lp(a.x,a.y).applyMatrix3(i);return{x:c.x,y:c.y,value:a.value}}),max:t.max,min:t.min}}getBox(t){let n=hp(t.data.map(s=>pp([s.x,s.y]))),i=fp(n),o=i[2]-i[0],a=i[3]-i[1],c={x:i[0],y:i[3]},l=dp(n);return{width:o,height:a,leftTop:c,center:l.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}};import{Object3D as gp,Vector3 as mp}from"three";var _r=class extends gp{constructor(t,n){super();this.context=t;this.options=n;this.position.copy(n.position||new mp(0,0,0)),this.loadModel()}model=null;async loadModel(){let t=await qe.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t}dispose(){Jt(this),this.model=null}};import{Box3 as vp,Vector3 as _p}from"three";import{Object3D as yp}from"three";var Ht=class extends yp{constructor(t){super();this.context=t}dispose(){Jt(this),this.children.forEach(t=>t.dispose?.()),this.clear()}};var xr=class extends Ht{graphicMap=new Map;constructor(e){super(e)}getCenter(){return new vp().setFromObject(this).getCenter(new _p)}createGraphic(e){let t=new Ft(this.context,e);return this.add(t),this.graphicMap.set(e.id,t),t}removeGraphic(e){this.remove(e),this.graphicMap.delete(e.options.id),e.dispose()}removeGraphicById(e){this.graphicMap.has(e)&&this.removeGraphic(this.graphicMap.get(e))}getGraphicByNodeId(e){return this.graphicMap.get(e)||null}getGraphicByRaycaster(e){let t={distance:1e4,graphic:null,position:null},n=this.children.reduce((i,o)=>{if(o instanceof Ft){let a=o.raycast(e);if(a){let{distance:c}=a;if(c<i.distance)return{distance:a.distance,position:a.position,graphic:o}}return i}else return i},t);return n===t?{graphics:[],position:null}:{graphics:[n.graphic],position:n.position}}};import{debounce as xp}from"lodash";var _n=class extends Ht{pois=[];debounceCollisionDetection;timer=new Gt;constructor(e){super(e),this.registryEvent(),this.debounceCollisionDetection=xp(this.collisionDetection,10)}clear(e=!1){return this.pois.forEach(t=>{t.options.built_in&&!e||t.dispose()}),this.pois=e?[]:this.pois.filter(t=>t.options.built_in),this}createPoi(e){let t=new rn(this.context,e);return this.pushPoi(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),t}changePoiLevelOrCollisionEnable(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.pois.splice(t,1),this.pushPoi(e))}removePoi(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.pois.splice(t,1),e.dispose())}removePoiById(e){let t=this.pois.find(n=>n.options.id===e);t&&this.removePoi(t)}getPoiById(e){return this.pois.find(n=>n.options.id===e)||null}pushPoi(e){if(!e.options.collision_enable){this.pois.unshift(e);return}if(e.options.level===0){this.pois.push(e);return}for(let t=0;t<this.pois.length;t++){let n=this.pois[t];if(n.options.collision_enable&&n.options.level<=e.options.level){this.pois.splice(t,0,e);return}}this.pois.push(e)}getPoiByDeviceXy(e,t){return this.pois.filter(i=>i instanceof rn&&i.isContain(e,t))}onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let e=[];this.pois.filter(n=>n.visible&&n.withinDisplayRange).forEach((n,i)=>{let{left:o,right:a,top:c,bottom:l}=n.getBox();if(i===0||!n.options.collision_enable){e.push({left:o,right:a,top:c,bottom:l}),n.parentSetVisible(!0);return}let s=e.some(u=>u.left<a&&u.right>o&&u.top<l&&u.bottom>c);n.parentSetVisible(!s),s||e.push({left:o,right:a,top:c,bottom:l})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(e=>e.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};import{debounce as Ep}from"lodash";import{Vector2 as bp,Vector3 as Sp}from"three";var Er=class extends Ht{pois=[];debounceCollisionDetection;timer=new Gt;constructor(e){super(e),this.registryEvent(),this.debounceCollisionDetection=Ep(this.collisionDetection,10)}clear(){return this.pois.forEach(e=>{e.dispose()}),this.pois=[],this}createPoi(e){let t=new ne(this.context,e);return this.pushPoi(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),t}changePoiLevelOrCollisionEnable(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.pois.splice(t,1),this.pushPoi(e))}removePoi(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.remove(e),this.pois.splice(t,1),e.dispose())}removePoiById(e){let t=this.pois.find(n=>n.options.id===e);t&&this.removePoi(t)}getPoiById(e){return this.pois.find(n=>n.options.id===e)||null}pushPoi(e){if(this.add(e),!e.options.collision_enable){this.pois.unshift(e);return}if(e.options.level===0){this.pois.push(e);return}for(let t=0;t<this.pois.length;t++){let n=this.pois[t];if(n.options.collision_enable&&n.options.level<=e.options.level){this.pois.splice(t,0,e);return}}this.pois.push(e)}getPoiByDeviceXy(e,t){let n=new bp(e,t);return this.pois.filter(o=>o instanceof ne&&o.canSelect&&o.box.containsPoint(n))}changeParkingSpaceVisibleByZoom=()=>{let e=this.parent?.parent;if(e&&e instanceof Ce){let{clientSize:{width:t,height:n}}=this.context,{max:i,min:o}=e.box,c=Math.min(t/(i.x-o.x),n/(i.y-o.y))*(i.x-o.x)/45;this.pois.filter(l=>l.userData.type==="parkingSpace").map(l=>{let s=this.context.camera.zoom>=c;l.visible=s,s||l.parentSetVisible(s)})}};onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let e=[],{camera:t}=this.context;t.updateMatrixWorld();let n=a=>a<=1&&a>=-1,i=t.projectionMatrix.clone();i.multiply(t.matrixWorldInverse),this.pois.filter(a=>{if(a.visible){let c=new Sp().setFromMatrixPosition(a.matrixWorld);return c.applyMatrix4(i),a.screenPosition=c,n(c.x)&&n(c.y)&&n(c.z)}return!1}).forEach((a,c)=>{let l=a.getBox(a.screenPosition);if(c===0||!a.options.collision_enable){e.push(l),a.parentSetVisible(!0);return}let s=e.some(u=>u.intersectsBox(l));a.parentSetVisible(!s),s||e.push(l)})}registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}dispose(){this.timer.dispose(),this.pois.forEach(e=>e.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var Ce=class extends Ii{constructor(t){super();this.context=t;this.groundLayer=new Ht(this.context),this.graphicLayer=new xr(this.context),this.poiLayer=new _n(this.context),this.poiLayer2=new Er(this.context),this.wallLayer=new Ht(this.context),this.textureLayer=new Ht(this.context),this.glbModelLayer=new Ht(this.context),this.laneLayer=new Ht(this.context),this.mergeGraphicLayer=new Ht(this.context),this.textTextureLayer=new Ht(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}graphicLayer;poiLayer;poiLayer2;wallLayer;textureLayer;glbModelLayer;laneLayer;mergeGraphicLayer;textTextureLayer;grounds=new Set;groundLayer;shadow=new mr;heatmap;groundUpper=new Ii;models=new Ii;modelMap=new Map;groundMaxHeight=0;name="";key="";box=new br;getPosition(){return this.box.getCenter(new Sr)}createGround(t){let n=new Ft(this.context,t);this.addGrounds([n])}addGrounds(t){t.forEach(n=>{this.grounds.has(n)||(n.mesh.castShadow=!0,this.grounds.add(n),this.groundLayer.add(n))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(n=>n.options.height+n.options.airHeight+n.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new br().setFromObject(this).getCenter(new Sr)}addModel(t){let n=new _r(this.context,t);return this.models.add(n),this.modelMap.set(t.id,n),n}addShadow(){let t=new br().setFromObject(this.groundUpper),n=t.getCenter(new Sr),i=t.getSize(new Sr);this.shadow.setPosition(n),this.shadow.changeLightCamera(i)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addHeatmap(t){this.heatmap||(this.heatmap=new vr(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let n=new br().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(n.max.z),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}updateBox(){this.box.setFromObject(this)}dispose(){console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.heatmap?.dispose(),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}};import{EventDispatcher as Mp,Vector3 as wp}from"three";var le=class extends Mp{constructor(t){super();this.context=t;this.svg=ws(`${t.container.clientWidth}`,`${t.container.clientHeight}`),t.container.appendChild(this.svg),this._registryEvent()}points=[];svg;enable=!0;_onResize=({width:t,height:n})=>{this.svg&&(this.svg.setAttribute("width",`${t}`),this.svg.setAttribute("height",`${n}`))};_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:n,renderer:i}=this.context,{offsetX:o,offsetY:a}=t,{clientWidth:c,clientHeight:l}=i.domElement,s=o/c*2-1,u=1-a/l*2;return new wp(s,u,0).unproject(n)}getSvgCoordinate(t){let{camera:n,container:i}=this.context;return et(t,n,i.clientWidth,i.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}};var Mr=class extends le{constructor(t){super(t);this.context=t;let{config:{svg:{circle:n,line:i}}}=t;this.circles=[Gn(n.radius,n.fill),Gn(n.radius,n.fill)],this.line=pr(i.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}circles;line;setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{if(this.points[0]){let t=this.getSvgCoordinate(this.points[0]);en(this.circles[0],t.x,t.y),ge(this.line,t)}if(this.points[1]){let t=this.getSvgCoordinate(this.points[1]);en(this.circles[1],t.x,t.y),ge(this.line,void 0,t)}};onPointermove=t=>{this.points.length===1&&(this.line.style.display="block",ge(this.line,void 0,{x:t.offsetX,y:t.offsetY}))};onPointerleave=()=>{this.points[1]||(this.line.style.display="none")};onPointerdown=t=>{if(this.points[1])return;let n=this.getIntersectByPointerEvent(t);if(n){let{offsetX:i,offsetY:o}=t,a=this.circles[this.points.length];en(a,i,o),this.points.length||ge(this.line,{x:i,y:o},{x:i,y:o}),this.addPoint(n)}};addPoint(t){if(this.points.push(t),this.points.length>=2){let n=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:n})}}calculatedDistance(){let[{x:t,y:n},{x:i,y:o}]=this.points;return Math.sqrt((i-t)**2+(o-n)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}};var wr=class extends le{circles=[];lines=[];isClose=!1;constructor(e){super(e),this.registryEvent()}setEnable(e){super.setEnable(e),e?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(e){this.circles.push(e),this.svg.appendChild(e)}addLine(e){this.lines.push(e),this.svg.appendChild(e)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{this.points.length&&this.points.forEach((e,t)=>{let n=this.getSvgCoordinate(e);this.circles[t]&&en(this.circles[t],n.x,n.y),t!==0&&ge(this.lines[t-1],void 0,n),this.lines[t]&&ge(this.lines[t],n)})};onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",ge(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))};onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")};onPointerdown=e=>{if(this.isClose)return;let t=this.getIntersectByPointerEvent(e);if(t){let{offsetX:n,offsetY:i}=e;this.checkAdsorb(n,i)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(t);let{circle:{fill:o,radius:a},line:{stroke:c}}=this.context.config.svg;if(!this.isClose){let l=Gn(a,o);en(l,n,i),this.addCircle(l)}if(this.lines.length&&ge(this.lastLine,void 0,{x:n,y:i}),!this.isClose){let l=pr(c);ge(l,{x:n,y:i},{x:n,y:i}),this.addLine(l)}}};checkAdsorb(e,t){if(this.points.length<3)return!1;let n=this.circles[0],i=+n.getAttribute("cx"),o=+n.getAttribute("cy");return Math.sqrt((e-i)**2+(t-o)**2)<=5}addPoint(e){if(this.points.push(e),this.isClose){let t=this.calculatedArea();this.dispatchEvent({type:"area",area:t})}}calculatedArea(){let e=this.points.map(i=>[i.x,i.y]),t=0,n=e.length;for(let i=0;i<n;i++){let o=(i+1)%n;t+=e[i][0]*e[o][1]-e[o][0]*e[i][1]}return Math.abs(t/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}};import{Box3 as Tp}from"three";var ca=class extends le{constructor(t){super(t);this.context=t;let{config:{svg:{line:n}}}=t;this.rect=Ve(n.stroke,"transparent"),this.svg.appendChild(this.rect);for(let i=0;i<4;i++)this.cornerRect[i]=Ve(n.stroke,"#ffffff"),this.centerRect[i]=Ve(n.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[i]),this.svg.appendChild(this.centerRect[i]);this.registryEvent()}rect;cornerRect=[];centerRect=[];graphic;setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{if(this.graphic){let t=new Tp().setFromObject(this.graphic),{camera:n,container:{clientWidth:i,clientHeight:o}}=this.context,{min:a,max:c}=t,l=et(a,n,i,o),s=et(c,n,i,o);Xt(this.rect,l.x,s.y,Math.abs(s.x-l.x),Math.abs(s.y-l.y));let{x:u,y:h}=l,{x:f,y:d}=s,g=5,p=[{x:u-g,y:d-g},{x:f-g,y:d-g},{x:u-g,y:h-g},{x:f-g,y:h-g}];for(let S=0;S<p.length;S++)Xt(this.cornerRect[S],p[S].x,p[S].y,g*2,g*2);let m=4,v=(u+f)/2,b=(h+d)/2,y=[{x:v-m,y:d-m},{x:u-m,y:b-m},{x:f-m,y:b-m},{x:v-m,y:h-m}];for(let S=0;S<y.length;S++)Xt(this.centerRect[S],y[S].x,y[S].y,m*2,m*2)}else{Xt(this.rect,0,0,0,0);for(let t=0;t<this.cornerRect.length;t++)Xt(this.cornerRect[t],0,0,0,0),Xt(this.centerRect[t],0,0,0,0)}};selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}};import{BufferGeometry as Cp,Color as Ri,ExtrudeGeometry as Ap,LineSegments as Pp,Mesh as Dp,Object3D as Ip,ShaderMaterial as Rp,Vector3 as ha}from"three";import{mergeGeometries as pa}from"three/examples/jsm/utils/BufferGeometryUtils";var Tr=class extends Ip{constructor(t,n){super();this.context=t;this.options=n;n.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;initGeometry(){let t=this.options.map(n=>{let i=be(n.geometry.coords[0],n.geometry.coords.slice(1));return new Ap(i,{steps:1,bevelEnabled:!1,depth:n.height,curveSegments:4})});this.geometry=pa(t),t.forEach(n=>n.dispose())}initMaterial(){let t=`
40
40
  varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
41
41
  uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
42
42
  uniform vec3 uColor;
@@ -75,7 +75,7 @@ var nh=Object.create;var ys=Object.defineProperty;var rh=Object.getOwnPropertyDe
75
75
  gl_FragColor = vec4(vColor, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
76
76
  }
77
77
  }
78
- `,i=-1/0,o=1/0,a=this.geometry.getAttribute("position");if(a)for(let l=0;l<a.count;l++){let s=a.getZ(l);s>i&&(i=s),s<o&&(o=s)}let c=new Rp({uniforms:{maxZ:{value:i},uColor:{value:new Ri(this.options[0].fillColor)},uGradualColor1:{value:new Ri(Le(this.options[0].fillColor,.99))},uGradualColor2:{value:new Ri(Le(this.options[0].fillColor,.9))},uOpacity:{value:this.options[0].fillOpacity},minZ:{value:o}},vertexShader:t,fragmentShader:n,transparent:!0});this.material=c}initLineMaterial(){let{strokeColor:t,strokeOpacity:n}=this.options[0],i=Rt.createLineMaterial({color:t,opacity:n});return this.lineMaterial=i,i}getBorderPoints(t){let{height:n,deltaHeight:i,geometry:o}=t,a=[],c=n+(i||0),{coords:l}=o;for(let s=0;s<l.length;s++){let u=l[s];for(let h=0;h<u.length;h++){let f=u[h],d=h+1===u.length?u[0]:u[h+1];a.push(new ha(f[0],f[1],c)),a.push(new ha(d[0],d[1],c))}}return a}initLineGeometry(){let t=this.options.map(n=>{let i=this.getBorderPoints(n);return new Cp().setFromPoints(i)});this.lineGeometry=pa(t)}createBorder(){let t=new Pp(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new Dp(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}dispose(){this.geometry?.dispose(),this.material?.dispose(),this.lineGeometry?.dispose(),this.clear()}};import{DoubleSide as Np,Float32BufferAttribute as Lp,Mesh as Op,MeshBasicMaterial as Fp,Object3D as Up,ShapeGeometry as Bp}from"three";import{mergeGeometries as zp}from"three/examples/jsm/utils/BufferGeometryUtils";var Gp={uuid:"",iconUrl:"",name:"",airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},Wn=class extends Up{constructor(t,n){super();this.context=t;this.options=n.map(i=>({...Gp,...i})),this.init()}options;mesh;async init(){let t=this.options.map(a=>{let{geometry:c}=a,l=be(c.coords[0],c.coords.slice(1)),s=new Bp(l,4),u=a.height+a.deltaHeight+a.airHeight,h=s.getAttribute("position");for(let d=0;d<h.count;d++)h.setZ(d,u);let f=[0,1,1,1,1,0,0,0];return s.setAttribute("uv",new Lp(f,2)),s}),n=zp(t,!0);t.forEach(a=>a.dispose());let i=await Promise.all(this.options.map(async a=>{let{iconUrl:c}=a,l=await We.getTextureByUrl(c);return new Fp({map:l,alphaTest:1,side:Np})})),o=new Op(n,i);this.mesh=o,this.position.z+=.004,this.add(o)}dispose(){this.mesh?.geometry.dispose(),(this.mesh?.material).forEach(t=>t.dispose()),this.clear()}};import{Box3 as kp,Mesh as Vp,Object3D as Hp,Vector3 as Wp}from"three";var qp={url:"",geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},id:"",width:0,rotate:1,airHeight:1,deltaHeight:0,center_x:0,center_y:0},Tr=class extends Hp{constructor(t,n){super();this.context=t;this.options=Object.assign({},qp,n),this.loadModel()}model=null;options;async loadModel(){let t=await qe.loadModel(this.options.url);t.scene.rotation.set(Math.PI/2,0,0);let i=new kp().setFromObject(t.scene).getSize(new Wp),o=Math.max(i.x,i.y),a=this.options.width/o;this.scale.set(a,a,a),this.meshSetMaterial(t.scene),this.add(t.scene),this.position.set(this.options.center_x,this.options.center_y,0),this.position.z+=this.options.airHeight+this.options.deltaHeight,this.model=t,this.rotateZ(this.options.rotate)}meshSetMaterial(t){t instanceof Vp&&(t.frustumCulled=!1,t.castShadow=!0,t.material.emissiveIntensity*=.95,t.material.emissive=t.material.color,t.material.emissiveMap=t.material.map),t.children.forEach(i=>{this.meshSetMaterial(i)})}dispose(){Jt(this),this.model=null}};import{BufferGeometry as Xp,LineSegments as jp,Mesh as Yp,Object3D as $p,ShapeGeometry as Zp,Vector2 as Kp,Vector3 as fa}from"three";import{mergeGeometries as da}from"three/examples/jsm/utils/BufferGeometryUtils";import{Line2 as Jp}from"three/examples/jsm/lines/Line2";import{LineGeometry as Qp}from"three/examples/jsm/lines/LineGeometry";var Cr=class extends $p{constructor(t,n){super();this.context=t;this.options=n;n.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;doubleLines=[];initGeometry(){let t=this.options.map(n=>{let i=be(n.geometry.coords[0].slice(0,-1),n.geometry.coords.slice(1)),o=new Zp(i,4),a=o.getAttribute("position");for(let c=0;c<a.count;c++)a.setZ(c,n.airHeight+(n.deltaHeight||0));return o});this.geometry=da(t),t.forEach(n=>n.dispose())}initMaterial(){let{fillColor:t,fillOpacity:n}=this.options[0],i=Rt.createMeshBasicMaterial({color:t,opacity:n});return this.material=i,i}initLineMaterial(){let{strokeColor:t,strokeOpacity:n}=this.options[0],i=Rt.createLineMaterial({color:t,opacity:n});return this.lineMaterial=i,i}getBorderPoints(t){let{deltaHeight:n,geometry:i}=t,o=[],a=n||0,{coords:c}=i;for(let l=0;l<c.length;l++){let s=c[l];for(let u=0;u<s.length;u++){let h=s[u],f=u+1===s.length?s[0]:s[u+1];o.push(new fa(h[0],h[1],a)),o.push(new fa(f[0],f[1],a))}}return o}initDoubleLine(){let t=this.options.filter(i=>i.double&&i.geometry.otherCoords?.[1]?.length);if(!t.length)return;let n=t.reduce((i,o)=>{let a=`${o.secondColor}-${o.dashed}`;return i[a]&&i[a].push(o),i[a]||(i[a]=[o]),i},{});this.doubleLines=Object.values(n).map(i=>{let o=Rt.createLine2MaterialMap({color:i[0].secondColor,width:.2,dashed:i[0].dashed,resolution:new Kp(this.context.clientSize.width,this.context.clientSize.height)});return i.map(a=>{let c=new Qp,l=a.geometry.otherCoords[1].map(u=>[...u,a.airHeight+(a.deltaHeight||0)]).flat(2);c.setPositions(l);let s=new Jp(c,o);return s.computeLineDistances(),s.position.z+=.001,this.add(s),s})}).flat(2)}initLineGeometry(){let t=this.options.map(n=>{let i=this.getBorderPoints(n);return new Xp().setFromPoints(i)});this.lineGeometry=da(t)}createBorder(){let t=new jp(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new Yp(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder()),this.initDoubleLine(),this.position.z+=.002+(this.options[0].deltaHeight||0)}dispose(){this.geometry?.dispose(),this.lineGeometry?.dispose(),this.doubleLines.map(t=>t.geometry.dispose()),this.clear()}};import{Object3D as tf,ExtrudeGeometry as ef,Mesh as nf,Vector3 as ga,BufferGeometry as rf,LineSegments as of,ShaderMaterial as sf,Color as ma}from"three";import{mergeGeometries as af}from"three/examples/jsm/utils/BufferGeometryUtils";var Ar=class extends tf{constructor(t,n){super();this.context=t;this.options=n.map(i=>({...Di,...i})),this.init()}geometry;material;mesh;line;lineMaterial;lineGeometry;options;init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options[0].deltaHeight,this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initGeometry(){let t=this.options.map(i=>{let o=be(i.geometry.coords[0],i.geometry.coords.slice(1));return new ef(o,{steps:1,bevelEnabled:!1,depth:i.height,curveSegments:4})}),n=af(t);return t.forEach(i=>i.dispose()),n}initMaterial(){let t=`
78
+ `,i=-1/0,o=1/0,a=this.geometry.getAttribute("position");if(a)for(let l=0;l<a.count;l++){let s=a.getZ(l);s>i&&(i=s),s<o&&(o=s)}let c=new Rp({uniforms:{maxZ:{value:i},uColor:{value:new Ri(this.options[0].fillColor)},uGradualColor1:{value:new Ri(Le(this.options[0].fillColor,.99))},uGradualColor2:{value:new Ri(Le(this.options[0].fillColor,.9))},uOpacity:{value:this.options[0].fillOpacity},minZ:{value:o}},vertexShader:t,fragmentShader:n,transparent:!0});this.material=c}initLineMaterial(){let{strokeColor:t,strokeOpacity:n}=this.options[0],i=Rt.createLineMaterial({color:t,opacity:n});return this.lineMaterial=i,i}getBorderPoints(t){let{height:n,deltaHeight:i,geometry:o}=t,a=[],c=n+(i||0),{coords:l}=o;for(let s=0;s<l.length;s++){let u=l[s];for(let h=0;h<u.length;h++){let f=u[h],d=h+1===u.length?u[0]:u[h+1];a.push(new ha(f[0],f[1],c)),a.push(new ha(d[0],d[1],c))}}return a}initLineGeometry(){let t=this.options.map(n=>{let i=this.getBorderPoints(n);return new Cp().setFromPoints(i)});this.lineGeometry=pa(t)}createBorder(){let t=new Pp(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new Dp(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}dispose(){this.geometry?.dispose(),this.material?.dispose(),this.lineGeometry?.dispose(),this.clear()}};import{DoubleSide as Np,Float32BufferAttribute as Lp,Mesh as Op,MeshBasicMaterial as Fp,Object3D as Up,ShapeGeometry as Bp}from"three";import{mergeGeometries as zp}from"three/examples/jsm/utils/BufferGeometryUtils";var Gp={uuid:"",iconUrl:"",name:"",airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},Wn=class extends Up{constructor(t,n){super();this.context=t;this.options=n.map(i=>({...Gp,...i})),this.init()}options;mesh;async init(){let t=this.options.map(a=>{let{geometry:c}=a,l=be(c.coords[0],c.coords.slice(1)),s=new Bp(l,4),u=a.height+a.deltaHeight+a.airHeight,h=s.getAttribute("position");for(let d=0;d<h.count;d++)h.setZ(d,u);let f=[0,1,1,1,1,0,0,0];return s.setAttribute("uv",new Lp(f,2)),s}),n=zp(t,!0);t.forEach(a=>a.dispose());let i=await Promise.all(this.options.map(async a=>{let{iconUrl:c}=a,l=await We.getTextureByUrl(c);return new Fp({map:l,alphaTest:1,side:Np})})),o=new Op(n,i);this.mesh=o,this.position.z+=.004,this.add(o)}dispose(){this.mesh?.geometry.dispose(),(this.mesh?.material).forEach(t=>t.dispose()),this.clear()}};import{Box3 as kp,Mesh as Vp,Object3D as Hp,Vector3 as Wp}from"three";var qp={url:"",geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},id:"",width:0,rotate:1,airHeight:1,deltaHeight:0,center_x:0,center_y:0},Cr=class extends Hp{constructor(t,n){super();this.context=t;this.options=Object.assign({},qp,n),this.loadModel()}model=null;options;async loadModel(){let t=await qe.loadModel(this.options.url);t.scene.rotation.set(Math.PI/2,0,0);let i=new kp().setFromObject(t.scene).getSize(new Wp),o=Math.max(i.x,i.y),a=this.options.width/o;this.scale.set(a,a,a),this.meshSetMaterial(t.scene),this.add(t.scene),this.position.set(this.options.center_x,this.options.center_y,0),this.position.z+=this.options.airHeight+this.options.deltaHeight,this.model=t,this.rotateZ(this.options.rotate)}meshSetMaterial(t){t instanceof Vp&&(t.frustumCulled=!1,t.castShadow=!0,t.material.emissiveIntensity*=.95,t.material.emissive=t.material.color,t.material.emissiveMap=t.material.map),t.children.forEach(i=>{this.meshSetMaterial(i)})}dispose(){Jt(this),this.model=null}};import{BufferGeometry as Xp,LineSegments as jp,Mesh as Yp,Object3D as $p,ShapeGeometry as Zp,Vector2 as Kp,Vector3 as fa}from"three";import{mergeGeometries as da}from"three/examples/jsm/utils/BufferGeometryUtils";import{Line2 as Jp}from"three/examples/jsm/lines/Line2";import{LineGeometry as Qp}from"three/examples/jsm/lines/LineGeometry";var Ar=class extends $p{constructor(t,n){super();this.context=t;this.options=n;n.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;doubleLines=[];initGeometry(){let t=this.options.map(n=>{let i=be(n.geometry.coords[0].slice(0,-1),n.geometry.coords.slice(1)),o=new Zp(i,4),a=o.getAttribute("position");for(let c=0;c<a.count;c++)a.setZ(c,n.airHeight+(n.deltaHeight||0));return o});this.geometry=da(t),t.forEach(n=>n.dispose())}initMaterial(){let{fillColor:t,fillOpacity:n}=this.options[0],i=Rt.createMeshBasicMaterial({color:t,opacity:n});return this.material=i,i}initLineMaterial(){let{strokeColor:t,strokeOpacity:n}=this.options[0],i=Rt.createLineMaterial({color:t,opacity:n});return this.lineMaterial=i,i}getBorderPoints(t){let{deltaHeight:n,geometry:i}=t,o=[],a=n||0,{coords:c}=i;for(let l=0;l<c.length;l++){let s=c[l];for(let u=0;u<s.length;u++){let h=s[u],f=u+1===s.length?s[0]:s[u+1];o.push(new fa(h[0],h[1],a)),o.push(new fa(f[0],f[1],a))}}return o}initDoubleLine(){let t=this.options.filter(i=>i.double&&i.geometry.otherCoords?.[1]?.length);if(!t.length)return;let n=t.reduce((i,o)=>{let a=`${o.secondColor}-${o.dashed}`;return i[a]&&i[a].push(o),i[a]||(i[a]=[o]),i},{});this.doubleLines=Object.values(n).map(i=>{let o=Rt.createLine2MaterialMap({color:i[0].secondColor,width:.2,dashed:i[0].dashed,resolution:new Kp(this.context.clientSize.width,this.context.clientSize.height)});return i.map(a=>{let c=new Qp,l=a.geometry.otherCoords[1].map(u=>[...u,a.airHeight+(a.deltaHeight||0)]).flat(2);c.setPositions(l);let s=new Jp(c,o);return s.computeLineDistances(),s.position.z+=.001,this.add(s),s})}).flat(2)}initLineGeometry(){let t=this.options.map(n=>{let i=this.getBorderPoints(n);return new Xp().setFromPoints(i)});this.lineGeometry=da(t)}createBorder(){let t=new jp(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new Yp(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder()),this.initDoubleLine(),this.position.z+=.002+(this.options[0].deltaHeight||0)}dispose(){this.geometry?.dispose(),this.lineGeometry?.dispose(),this.doubleLines.map(t=>t.geometry.dispose()),this.clear()}};import{Object3D as tf,ExtrudeGeometry as ef,Mesh as nf,Vector3 as ga,BufferGeometry as rf,LineSegments as of,ShaderMaterial as sf,Color as ma}from"three";import{mergeGeometries as af}from"three/examples/jsm/utils/BufferGeometryUtils";var Pr=class extends tf{constructor(t,n){super();this.context=t;this.options=n.map(i=>({...Di,...i})),this.init()}geometry;material;mesh;line;lineMaterial;lineGeometry;options;init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options[0].deltaHeight,this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initGeometry(){let t=this.options.map(i=>{let o=be(i.geometry.coords[0],i.geometry.coords.slice(1));return new ef(o,{steps:1,bevelEnabled:!1,depth:i.height,curveSegments:4})}),n=af(t);return t.forEach(i=>i.dispose()),n}initMaterial(){let t=`
79
79
  varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
80
80
  uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
81
81
  uniform vec3 uColor;
@@ -101,9 +101,9 @@ var nh=Object.create;var ys=Object.defineProperty;var rh=Object.getOwnPropertyDe
101
101
  gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
102
102
  }
103
103
  }
104
- `,i=-1/0,o=this.geometry.getAttribute("position");if(o)for(let c=0;c<o.count;c++){let l=o.getZ(c);l>i&&(i=l)}let a=new sf({uniforms:{maxZ:{value:i},uColor:{value:new ma(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new ma(Le(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:n,transparent:!0});this.material=a}initLineMaterial(){let t=Rt.createLineMaterial({color:this.options[0].strokeColor,opacity:this.options[0].strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new nf(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],n=this.options[0].height+this.options[0].deltaHeight;return this.options.map(i=>{let{coords:o}=i.geometry;for(let a=0;a<o.length;a++){let c=o[a];for(let l=0;l<c.length;l++){let s=c[l],u=l+1===c.length?c[0]:c[l+1];t.push(new ga(s[0],s[1],n)),t.push(new ga(u[0],u[1],n))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),n=new rf().setFromPoints(t);this.lineGeometry=n}createBorder(){this.line&&this.remove(this.line);let t=new of(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){this.geometry.dispose(),this.material.dispose(),this.line?.geometry.dispose(),this.clear()}};import{Box2 as Ni,Object3D as uf,Sprite as ya,SpriteMaterial as va,Vector2 as Pr}from"three";import{cloneDeep as lf}from"lodash";var cf={text:"",icon:"",icon_size:[18,18],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0},ne=class extends uf{constructor(t,n){super();this.context=t;this.options=dn(lf({...cf,...n}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}options;textAspect=1;spriteText;spriteIcon;box=new Ni;boxHelper;_initIconPromise=null;get durIconAndText(){return this.options.icon&&this.options.text?2:0}get offset(){return this.options.icon&&this.options.text?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.options.text?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.options.text?this.options.text_font_size:0}get deltaZ(){return .1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",async({value:t})=>{this._initIconPromise&&await this._initIconPromise,this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),await this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text",({value:t})=>{this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",({value:t})=>{this.spriteIcon&&(this.spriteIcon.material.rotation=t/180*Math.PI)}),this.addEventListener("change-icon_size",({value:t})=>{this.spriteIcon&&this._initScale({zoom:this.context.camera.zoom})})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}async initIcon(){if(this.options.icon)return this._initIconPromise=new Promise(async t=>{let n=await We.getTextureByUrl(this.options.icon),i=new ya(new va({map:n,transparent:!0,alphaTest:.2,depthTest:!1,rotation:this.options.icon_rotate/180*Math.PI}));i.visible=!1,i.renderOrder=1e5,n.needsUpdate=!0,this.add(i),this.spriteIcon=i,t(i)}).then(()=>{this._initIconPromise=null})}initText(){if(this.options.text){let t=He.getTextureByText(this.options.text);this.textAspect=t.image.width/t.image.height;let n=new ya(new va({map:t,transparent:!0,alphaTest:.2,depthTest:!1}));n.visible=!1,n.renderOrder=100001,t.needsUpdate=!0,this.spriteText=n,this.add(n)}}initSize(){let t=0,n=0,{icon:i,text:o}=this.options;i?o?(t=0,n=t*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(t=.5,n=0):o?(n=.5,t=0):(t=0,n=0),this.spriteIcon?.center.set(.5,t),this.spriteText?.center.set(.5,n)}async init(){await this.initIcon(),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}_initScale=({zoom:t})=>{if(this.spriteText){let n=this.textHeight/t;this.spriteText.scale.set(this.textAspect*n,n,.1)}this.spriteIcon&&this.spriteIcon?.scale.set(this.options.icon_size[0]/t,this.options.icon_size[1]/t,.1),this.resetZ()};resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:n,height:i}}=this.context,o=n*(t.x+1)/2,a=i*(-t.y+1)/2;a+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let c=this.iconWidth/2,l=new Ni(new Pr(o-c,a-this.iconHeight),new Pr(o+c,a)),s=this.textWidth/2,u=new Ni(new Pr(o-s,a-this.textHeight-this.durIconAndText-this.iconHeight),new Pr(o+s,a-this.iconHeight-this.durIconAndText));return this.box=u.union(l),this.box}renderBoxHelper(){if(!this.boxHelper){let t=document.createElement("div");t.style.position="fixed",t.style.border="1px solid red",t.style.pointerEvents="none",this.boxHelper=t,this.context.container.appendChild(t)}this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px"}parentSetVisible(t){this.spriteText&&(this.spriteText.visible=t),this.spriteIcon&&(this.spriteIcon.visible=t),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.unRegistryEvent(),this.spriteText=void 0}};import{DoubleSide as hf,Matrix4 as _a,Mesh as pf,MeshBasicMaterial as ff,Object3D as df,PlaneGeometry as gf}from"three";import{mergeGeometries as mf}from"three/examples/jsm/utils/BufferGeometryUtils";var yf={airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},texts:[],fillColor:"#ffffff",fillOpacity:0,strokeColor:"#ffffff",strokeOpacity:0,secondHeight:0,secondRotate:0,center_x:0,center_y:0},Dr=class extends df{constructor(t,n){super();this.context=t;this.options=n.map(i=>({...yf,...i})),this.init()}options;mesh;async init(){let t=this.options.map(c=>He.getTextureByText(c.texts[0],{fillStyle:Si(c.fillColor,c.fillOpacity),strokeStyle:Si(c.strokeColor,c.strokeOpacity),lineWidth:6,font:"54px sans-serif"})),n=t.map((c,l)=>{let s=this.options[l],{width:u,height:h}=c.image,f=u/h,d=s.secondHeight*f,g=new gf(d,s.secondHeight),p=new _a().makeTranslation(s.center_x,s.center_y,s.airHeight+s.deltaHeight+s.height).multiply(new _a().makeRotationZ(s.secondRotate));return g.applyMatrix4(p),g}),i=mf(n,!0);n.forEach(c=>c.dispose());let o=t.map(c=>{let l=new ff({map:c,alphaTest:1,side:hf});return c.needsUpdate=!0,l}),a=new pf(i,o);this.mesh=a,this.position.z+=.004,this.add(a)}dispose(){this.mesh?.geometry.dispose(),(this.mesh?.material).forEach(t=>t.dispose()),this.clear()}};import{Frustum as vf}from"three";var Ir=class extends le{startPoint;endPoint;rect;frustum=new vf;constructor(e){super(e);let{config:{selectBox:{fill:t,stroke:n}}}=e;this.rect=Ve(n,t),this.svg.appendChild(this.rect),this.registryEvent()}setEnable(e){super.setEnable(e),Xt(this.rect,0,0,0,0),e?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}onPointerDown=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.startPoint=t),this.endPoint=void 0};onPointerMove=e=>{if(!this.enable||!this.startPoint)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t)};onPointerUp=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t),this.doSelect(),this.startPoint=void 0};onUpdate=()=>{if(this.startPoint){let e=this.getSvgCoordinate(this.startPoint),t={...e};this.endPoint&&(t=this.getSvgCoordinate(this.endPoint));let n={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y)},i=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y);Xt(this.rect,n.x,n.y,i,o)}else Xt(this.rect,0,0,0,0)};registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:t,container:{clientWidth:n,clientHeight:i}}}=this,o=et(this.startPoint,t,n,i),a=et(this.endPoint,t,n,i),c={x:Math.min(o.x,a.x),y:Math.min(o.y,a.y)},l={x:Math.max(o.x,a.x),y:Math.max(o.y,a.y)},s=this.searchMapInFrustum(c,l);this.dispatchEvent({type:"selected",list:s})}}searchMapInFrustum(e,t){let{context:n}=this;return n.currentFloor?.graphicLayer.children.filter(i=>i instanceof Ft&&this.searchChildInFrustum(i,e,t))||[]}searchChildInFrustum(e,t,n){let{context:{camera:i,container:{clientWidth:o,clientHeight:a}}}=this;if(!e)return!1;if(!e.mesh){let f=e.getPosition();if(f){let d=et(f,i,o,a);return ke(d,t,n)}return!1}e.mesh.geometry.boundingBox||e.mesh.geometry.computeBoundingBox();let c=e.mesh.geometry.boundingBox;if(!c)return!1;let{min:l,max:s}=c,u=et(l,i,o,a),h=et(s,i,o,a);return!(!ke(u,t,n)||!ke(h,t,n))}dispose(){this.unRegistryEvent()}};var Rr=class extends _f{constructor(t){super();this.context=t;this.boxSelection=new Ir(t),this.boxSelection.setEnable(!1),this.registryEvent()}_list=new Set;boxSelection;prevPanStatus;prevRotateStatus;downPoint=null;isMultipleSelect=!1;get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.context.config.enableBoxSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}onPointerDown=t=>{this.downPoint={x:t.offsetX,y:t.offsetY}};onPointerUp=t=>{if(!this.downPoint)return;let{offsetX:n,offsetY:i}=t,{x:o,y:a}=this.downPoint;if(Math.sqrt((o-n)**2+(a-i)**2)>3)return;let{graphics:c}=this.context.getGraphicsByDeviceXy(n,i),l=new Set(c.map(u=>u.options.id));this.context.getPoisByDeviceXy(n,i).forEach(u=>{if(!l.has(u.options.id)){let h=this.context.currentFloor?.graphicLayer.graphicMap.get(u.options.id)||null;h&&h.options.geometry.type==="point"&&(c.push(h),l.add(u.options.id))}}),(gn?t.metaKey:t.ctrlKey)||this._list.clear(),c.forEach(u=>this._list.add(u)),this.selectEnd(),this.downPoint=null};onPointerOut=t=>{this.disableBoxSelection()};onKeyDown=t=>{mn(t.key)&&this.enableBoxSelection()};onKeyUp=t=>{mn(t.key)&&this.disableBoxSelection()};onBoxSelected=({list:t})=>{this._list.clear(),t.forEach(n=>{this._list.add(n)}),this.selectEnd()};selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}};import{EventDispatcher as xf,Vector2 as Ef}from"three";var Nr=class extends xf{constructor(t){super();this.context=t;this.registryEvent()}curGraphics=new Set;timer=new Gt;graphicTimerMap=new Map;onPointerMove=({graphics:t,pois:n,e:i})=>{let o=n.map(s=>this.context.currentFloor?.graphicLayer.graphicMap.get(s.options.id)).filter(s=>s&&s.options.geometry.type==="point");if(!t.length&&!o.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:a}=this.context.config.hover,c=new Set;if(o.length){let s,u=1e4;o.forEach(h=>{let f=n.find(d=>d.options.id===h.options.id);if(f instanceof rn){let{x:d,y:g}=f.clientPos,p=Math.sqrt((d-i.offsetX)**2+(g-i.offsetY)**2);p<u&&(u=p,s=h)}else if(f instanceof ne){let{x:d,y:g}=f.box.getCenter(new Ef),p=Math.sqrt((d-i.offsetX)**2+(g-i.offsetY)**2);p<u&&(u=p,s=h)}}),c.add(s)}c.size||t.forEach(s=>c.add(s)),c.forEach(s=>{if(this.graphicTimerMap.get(s)||this.curGraphics.has(s))return;let u=this.timer.setTimeout(()=>{this.curGraphics.add(s),this.graphicTimerMap.delete(s),this.timer.clearTimeout(u),this.handleHoverGraphicsChange()},a);this.graphicTimerMap.set(s,u)}),this.graphicTimerMap.forEach((s,u)=>{c.has(u)||(this.timer.clearTimeout(s),this.graphicTimerMap.delete(u))});let l=this.curGraphics.size;this.curGraphics.forEach(s=>{c.has(s)||this.curGraphics.delete(s)}),l!==this.curGraphics.size&&this.handleHoverGraphicsChange()};onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()};onBodyPointerMove=t=>{if(this.curGraphics.size){let n=this.context.container.getBoundingClientRect();(t.clientX<n.left||t.clientX>n.right||t.clientY<n.top||t.clientY>n.bottom)&&this.onPointerLevel()}};handleHoverGraphicsChange(t=this.curGraphics){this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}};import{Box3 as bf,Vector3 as Lr}from"three";var Or=class{constructor(e){this.context=e;this.registryEvent(),this.changePrevCamera()}prevCamera={position:new Lr,zoom:1,target:new Lr};enable=!0;box=new bf;updateBox(){this.box.setFromObject(this.context.scene)}setEnable(e){this.enable=e,e?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.scene.children.filter(m=>m instanceof Ce).length)return null;let t=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:a,max:c}=t,l=et(a,n,i,o),s=et(c,n,i,o),u=et(new Lr(a.x,c.y,c.z),n,i,o),h=et(new Lr(c.x,a.y,a.z),n,i,o),f=Math.min(l.x,s.x,u.x,h.x),d=Math.max(l.x,s.x,u.x,h.x),g=Math.min(l.y,s.y,u.y,h.y),p=Math.max(l.y,s.y,u.y,h.y);return{left:f,right:d,top:g,bottom:p}}checkDistanceToScreenEdge({left:e,right:t,top:n,bottom:i}){let{width:o,height:a}=this.context.clientSize,[c,l,s,u]=this.context.config.cameraBound.padding,h=t>=u,f=o-e>=l,d=a-n>=s,g=i>=c;return h&&f&&d&&g}onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:t,right:n,top:i,bottom:o}=e;this.checkDistanceToScreenEdge({left:t,right:n,top:i,bottom:o})?this.changePrevCamera():this.backToPrevCamera()}};dispose(){this.unRegistryEvent()}};import{Vector3 as xa}from"three";import{MapControls as Sf}from"three/examples/jsm/controls/MapControls";import{Tween as Fr,Group as Mf}from"@tweenjs/tween.js";var Ur=class extends Sf{constructor(t,n,i){super(n,i);this.context=t;this.camera=n;this.domElement=i;this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=n.zoom,this.registryEvent()}prevCameraZoom=1;tweenGroup=new Mf;offsetY=0;registryEvent(){this.addEventListener("change",()=>{let t=this.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.dispatchEvent({type:"change-zoom",zoom:t}))}),this.context.addEventListener("update",this.tweenUpdate)}tweenUpdate=()=>{this.tweenGroup.update()};setPolarAngle(t,n=!1){let{maxPolarAngle:i,minPolarAngle:o}=this,a=i===o;(n||t<=i&&t>=o)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),a||(this.maxPolarAngle=i,this.minPolarAngle=o)}async setPolarAngleByDuration(t,n=!1,i=500){return i<=0?this.setPolarAngle(t,n):tn(new Promise(o=>{let a={polar:this.getPolarAngle()},c={polar:t},l=new Fr(a,this.tweenGroup).to(c,i).onUpdate(()=>{this.setPolarAngle(a.polar,n)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(l),o(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)}setAzimuthalAngle(t,n){let{maxAzimuthAngle:i,minAzimuthAngle:o,maxPolarAngle:a,minPolarAngle:c}=this,l=i===o;if(n||t<=i&&t>=o){this.maxAzimuthAngle=t,this.minAzimuthAngle=t;let s=this.getPolarAngle();this.maxPolarAngle=s,this.minPolarAngle=s,this.update(),this.maxPolarAngle=a,this.minPolarAngle=c}l||(this.maxAzimuthAngle=i,this.minAzimuthAngle=o)}setAzimuthalAngleDuration(t,n=!1,i=500){return i<=0?this.setAzimuthalAngle(t,n):tn(new Promise(o=>{let a={azimuthal:this.getAzimuthalAngle()},c={azimuthal:t},l=new Fr(a,this.tweenGroup).to(c,i).onUpdate(()=>{this.setAzimuthalAngle(a.azimuthal,n)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(l),o(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)}getCameraLookAt(){return new xa().subVectors(this.target,this.camera.position)}async setCameraPositionByTarget(t,n){let i=this.target.clone(),o=this.getCameraLookAt();if(!n){this.camera.position.copy(t.clone().sub(o)),this.target.copy(t.clone()),this.update();return}return tn(new Promise(a=>{let c=new Fr(i,this.tweenGroup).to(t,n).onUpdate(()=>{this.camera.position.copy(i.clone().sub(o)),this.target.copy(i.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(c),this.camera.position.copy(t.clone().sub(o)),this.target.copy(t.clone()),this.update(),this.enabled=!0,a(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}setZoom(t,n,i=!1){let{minZoom:o,maxZoom:a}=this;(i||t>=o&&t<=a)&&(this.camera.position.copy(n.clone().sub(this.getCameraLookAt())),this.target.copy(n),this.camera.zoom=t,this.update())}setZoomByDuration(t,n,i=!1,o=500){let a=this.getCameraLookAt(),c={zoom:this.camera.zoom,target:this.target.clone()};return o?tn(new Promise(l=>{let s=new Fr(c,this.tweenGroup).to({zoom:t,target:n},o).onUpdate(()=>{this.setZoom(c.zoom,c.target,i)}).onComplete(()=>{this.tweenGroup.remove(s),this.enabled=!0,l(!0)}).onStart(()=>{this.enabled=!1}).start()}),o+500):this.setZoom(t,n,i)}setTargetByOffset(t,n=this.target.clone()){if(!t)return;let i=new xa;i.setFromMatrixColumn(this.camera.matrix,1),i.normalize(),i.multiplyScalar(t/this.camera.zoom),n.add(i),this.setCameraPositionByTarget(n,0)}dispose(){this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll()}};import{EventDispatcher as wf,PCFSoftShadowMap as Tf,WebGLRenderer as Cf}from"three";var Br=class extends Cf{event=new wf;scene;camera;enable=!0;timer=new Gt;constructor(e){super({antialias:!0,alpha:!0,...e}),this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=Tf}setCameraAndScene(e,t){this.scene=e,this.camera=t}autoRender(){this.scene&&this.camera&&this.enable&&(this.event.dispatchEvent({type:"update"}),this.render(this.scene,this.camera)),this.timer.requestAnimationFrame(()=>{this.autoRender()})}pauseRender(){this.enable=!1}continueRender(){this.enable=!0}addEventListener(e,t){this.event.addEventListener(e,t)}removeEventListener(e,t){this.event.removeEventListener(e,t)}dispose(){this.timer.dispose(),this.enable=!1,super.dispose()}};import{Scene as Af}from"three";var zr=class extends Af{constructor(){super()}};import{OrthographicCamera as Pf}from"three";var Gr=class extends Pf{constructor(e,t){super(-e/2,e/2,t/2,-t/2,-1e3,5e3),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var kr=class extends Df{constructor(t,n){super();this.container=t;this.config=n;this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new Rr(this),this.hoverHelper=new Nr(this),this.resizeClientSize(),this.registryEvent()}scene=new zr;renderer=new Br;camera;control;lights=_s();currentFloor;selection;hoverHelper;basicRatio;cameraBound;clientSize={width:0,height:0,x:0,y:0};renderRf=0;resizeClientSize(){let{x:t,y:n,width:i,height:o}=this.container.getBoundingClientRect();this.clientSize={width:i||this.container.clientWidth,height:o||this.container.clientHeight,x:t,y:n}}init(){let{clientWidth:t,clientHeight:n}=this.container;this.camera=new Gr(t,n),this.renderer.setSize(t,n),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new Ur(this,this.camera,this.renderer.domElement),this.control.maxPolarAngle=this.config.control.maxPolar,this.container.appendChild(this.renderer.domElement),this.scene.add(this.lights),this.basicRatio=this.getRatio(),this.control.addEventListener("change",()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})}),this.control.addEventListener("change-zoom",({zoom:i})=>{this.dispatchEvent({type:"control-zoom-change",zoom:i})}),this.renderer.addEventListener("update",()=>{this.dispatchEvent({type:"update"})}),this.cameraBound=new Or(this)}getRatio(t=new on(0,0,0),n=new on(100,0,0)){let{clientWidth:i,clientHeight:o}=this.container,a=et(t,this.camera,i,o),c=et(n,this.camera,i,o);return Math.ceil(Math.sqrt((c.x-a.x)**2+(c.y-a.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(n=>{n instanceof Of&&(n.color=new Lf(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let n=t.getCenter();n&&(this.lights.position.x=n.x,this.lights.position.y=n.y),this.cameraBound.updateBox()}onWindowResize=()=>{let{container:t,camera:n,renderer:i}=this,{clientWidth:o,clientHeight:a}=t;o=Math.max(1,o),a=Math.max(1,a),n.left=-o/2,n.right=o/2,n.top=a/2,n.bottom=-a/2,n.updateProjectionMatrix(),i.setSize(o,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:o,height:a})};onClick=t=>{let{graphics:n,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY);n.length&&this.dispatchEvent({type:"graphic-click",graphics:n,position:i});let o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);o.length&&this.dispatchEvent({type:"poi-click",pois:o})};getGraphicsByDeviceXy(t,n){let i=new xn;i.x=t/this.clientSize.width*2-1,i.y=n/this.clientSize.height*-2+1;let o=new Rf;return o.setFromCamera(i,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),this.currentFloor?.graphicLayer.getGraphicByRaycaster(o)||{graphics:[],position:null}}getPoisByDeviceXy(t,n){let i=this.currentFloor?.poiLayer.getPoiByDeviceXy(t,n),o=this.currentFloor?.poiLayer2.getPoiByDeviceXy(t,n);return(i||[]).concat(o||[])}onPointerover=t=>{let{graphics:n,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-over",e:t,graphics:n,pois:o,position:i})};onPointermove=t=>{let{graphics:n,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-move",e:t,graphics:n,pois:o,position:i})};onPointerleave=t=>{this.dispatchEvent({type:"pointer-level"})};onSelectionSelect=({graphics:t,isMultipleSelect:n})=>{this.dispatchEvent({type:"select-graphic",graphics:t,isMultipleSelect:n})};onHoverChange=({graphics:t})=>{this.dispatchEvent({type:"hover",graphics:t})};registryEvent(){window.addEventListener("resize",this.onWindowResize),this.container.addEventListener("click",this.onClick),this.container.addEventListener("pointerover",this.onPointerover),this.container.addEventListener("pointermove",this.onPointermove),this.container.addEventListener("pointerleave",this.onPointerleave),this.container.addEventListener("pointercancel",this.onPointerleave),this.container.addEventListener("pointerout",this.onPointerleave),this.selection.addEventListener("select",this.onSelectionSelect),this.hoverHelper.addEventListener("hover-change",this.onHoverChange)}unRegistryEvent(){window.removeEventListener("resize",this.onWindowResize),this.container.removeEventListener("click",this.onClick),this.container.removeEventListener("pointerover",this.onPointerover),this.container.removeEventListener("pointermove",this.onPointermove),this.container.removeEventListener("pointerleave",this.onPointerleave),this.container.removeEventListener("pointercancel",this.onPointerleave),this.container.removeEventListener("pointerout",this.onPointerleave),this.selection.removeEventListener("select",this.onSelectionSelect),this.hoverHelper.removeEventListener("hover-change",this.onHoverChange)}setPolarAngle(t,n=500){return this.control.setPolarAngleByDuration(t,!0,n)}setAzimuthalAngle(t,n=500){return this.control.setAzimuthalAngleDuration(t,!0,n)}getCameraLookAt(){return this.control.getCameraLookAt()}setZoom(t,n,i=500){return this.control.setZoomByDuration(t,n,!0,i)}getFitCameraToObjectZoom(t,n=[20,20,20,20],i=500,o=!0){let[a,c,l,s]=n,{clientSize:{width:u,height:h}}=this,f=this.control.getPolarAngle();o&&this.setPolarAngle(0,0);let d=new Nf().setFromObject(t);this.setPolarAngle(f,0);let{max:g,min:p}=d,m=new on(p.x,g.y,g.z),v=new on(g.x,g.y,g.z),b=new on(g.x,p.y,p.z),y=new on(p.x,p.y,p.z),S=et(m,this.camera,u,h),x=et(v,this.camera,u,h),_=et(y,this.camera,u,h),M=et(b,this.camera,u,h),C=new If().setFromPoints([new xn(S.x,S.y),new xn(x.x,x.y),new xn(_.x,_.y),new xn(M.x,M.y)]).getSize(new xn),P=(u-c-s)/C.x,D=(h-a-l)/C.y,R=Math.min(P,D),W=new on((g.x+p.x)/2,(g.y+p.y)/2,(g.z+p.z)/2);return{zoom:R*this.camera.zoom,center:W}}fitCameraToObject(t,n=[20,20,20,20],i=500,o=!0){let{zoom:a,center:c}=this.getFitCameraToObjectZoom(t,n,i,o);return this.setZoom(a,c,i)}getFitCameraToGroundZoom(t=[20,20,20,20],n=500,i=!0){if(this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,n,i).zoom}fitCameraToGround(t=[20,20,20,20],n=500,i=!0){return this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundUpper,t,n,i):Promise.resolve(!1)}async setCameraPosition(t,n){return this.control.setCameraPositionByTarget(t,n)}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.renderer.dispose(),this.lights.children.forEach(t=>t.dispose()),Jt(this.scene)}};import{merge as Ff}from"lodash";var Uf={apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get"},enableBoxSelect:!0,resizeObserver:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1}};function Ea(r){return Ff({},Uf,r)}import{debounce as Gf}from"lodash";var kf=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(kf||{}),ba=class extends Bf{constructor(t,n={}){super();this.container=t;this.config=Ea(n),this.context=new kr(t,this.config),this.registryEvent()}config;context;polarKeys=[];azimuthalKeys=[];svgLine;svgPolygon;basicZoom=1;prevCameraZoom=1;type="2d";currentBuildGround=null;observe=null;buildingCenter=[0,0];timer=new Gt;plugins=[];changeBuildingCenter(t,{brand:n,project:i}){let o=t?lr(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(n=>n!==t)}triggerHooks(t,n){this.dispatchEvent({type:t,data:n})}switchFloorByFloor(t,n=t.graphicLayer.children){this.triggerHooks("switch_floor_before",{curFloor:t,graphics:n}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks("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(void 0,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*30,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()}onControlChange=()=>{let{camera:{zoom:t}}=this.context;t!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=t)};addModel(t,n){if(t.options.geometry.type==="polygon"){let i=this.context.currentFloor?.addModel({...n,position:t.getPosition().setZ(.1),id:t.options.id});if(i){let{facilityAngle:o=0,facilityXScale:a=1,facilityYScale:c=1}=t.options.userData;i.rotateZ((180-o)/180*Math.PI),i.scale.set(a,c,1)}}}addHeatmap(t){return this.context.currentFloor?.addHeatmap(t)}getLegacyToGraphicMap(){return this.context.currentFloor?.userData.legacyToGraphicMap||new Map}getFloorAllGraphics(){return this.context.currentFloor?.graphicLayer.children.filter(t=>t instanceof Ft)||[]}createGraphicPoi(t,n){if(this.context.currentFloor){n.id===void 0&&(n.id=t.options.id);let i=t.getCenter();return this.context.currentFloor.addPoi({...n,position:{...i,z:i.z+t.options.height/2}})}return null}removeHeatMap(){this.context.currentFloor?.removeHeatMap()}translateElementToCenter(t,n=500){let i=t.getPosition();return this.context.setCameraPosition(i,n)}async translateElementToCenterX(t,n=500){return tn(new Promise(i=>{let o=this.context.control.target.clone(),a=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:c,height:l},camera:s}=this.context,h=et(a,s,c,l).x-c/2,f=new zf;f.setFromMatrixColumn(this.context.camera.matrix,0),f.normalize(),f.multiplyScalar(h/this.context.camera.zoom),o.add(f),this.context.setCameraPosition(o,n).then(i)})}),n+500)}getElementDeviceCoordinate(t){let n=t.position.clone(),{clientWidth:i,clientHeight:o}=this.container;return et(n,this.context.camera,i,o)}changeMapType(t,n=500){return this.type=t,t==="2d"?this.context.setPolarAngle(0,n):this.context.setPolarAngle(1.1,n)}async resetView(t=300){let n=t/3;await this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,n),await this.context.setPolarAngle(this.config.control.defaultPolar,n),await this.context.fitCameraToGround(this.config.defaultPadding,n,!1)}reduceMap(t=.5,n=500){let i=this.context.camera.zoom;return this.context.setZoom(i-t,this.context.control.target,n)}enlargeMap(t=.5,n=500){let i=this.context.camera.zoom;return this.context.setZoom(i+t,this.context.control.target,n)}onKeydown=t=>{this.polarKeys.includes(t.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(t.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)};onKeyUp=t=>{if(this.polarKeys.includes(t.code)){let n=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=n,this.context.control.minPolarAngle=n}if(this.azimuthalKeys.includes(t.code)){let n=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=n,this.context.control.minAzimuthAngle=n}};registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver(Gf(this.resize,5));t.observe(this.container),this.observe=t}}unRegistryEvent(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),this.observe?.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t=.1){let n=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(n+t,500)}async measureDistance(){return this.cancelDistance(),new Promise((t,n)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Sr(this.context);let i=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){i(),n("cancel")},this.svgLine.addEventListener("distance",({distance:o})=>{t(o)})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,n)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new Mr(this.context);let i=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){i(),n("cancel")},this.svgPolygon.addEventListener("area",({area:o})=>{t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){return this.context.currentFloor?.graphicLayer.getGraphicByNodeId(t)||null}deleteGraphic(t){this.context.currentFloor?.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){if(!t.transformToBuildingGround&&this.currentBuildGround){let n=lr(this.currentBuildGround.info.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 this.context.currentFloor?.graphicLayer.createGraphic(t)}removePoiById(t){this.context.currentFloor?.poiLayer.removePoiById(t),this.context.currentFloor?.poiLayer2.removePoiById(t)}getPoiById(t){return this.context.currentFloor?.poiLayer.getPoiById(t)||this.context.currentFloor?.poiLayer2.getPoiById(t)}getPois(){return[...(this.context.currentFloor?.poiLayer.pois||[]).filter(t=>!t.options.built_in),...this.context.currentFloor?.poiLayer2.pois||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let t=this.context.control.getAzimuthalAngle(),n=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(void 0,0)||1;this.context.camera.zoom=n,this.context.control.minZoom=i,this.context.control.maxZoom=i*25,this.basicZoom=n,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(t,0),this.context.cameraBound.setEnable(!0)};dispose(){this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.context.dispose(),this.unRegistryEvent(),He.dispose(),We.dispose(),nn.dispose(),qe.dispose(),Rt.dispose()}};import{EventDispatcher as Vf}from"three";var Ae=class extends Vf{bmap;constructor(e){super(),this.bmap=e}dispose(){}};var Sa=class extends Ae{equipmentList=[];equipmentMap=new Map;constructor(e){super(e),this.fetchEquipment(),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}async fetchEquipment(){let{apiDomain:e,apiPath:{equipmentList:t},apiInfo:n}=this.bmap.config,i=`${e}${t}`;await 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)}onSwitchFloor=({data:{graphics:e}})=>{this.equipmentList.length&&this.changeGraphicToEquipment(e)};getGraphicEquipment(e){return e.userData.data.info.userData.equipment}changeGraphicToEquipment(e){e.filter(t=>{let n=this.getGraphicEquipment(t);return n&&this.equipmentMap.has(n)}).forEach(t=>{let n=this.equipmentMap.get(this.getGraphicEquipment(t)),i=this.bmap.createGraphicPoi(t,{icon:n?.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=n,i.userData.type="equipment")})}dispose(){this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),Array.from(this.bmap.context.currentFloor?.poiLayer.pois||[]).forEach(e=>{e.userData.type==="equipment"&&this.bmap.context.currentFloor?.poiLayer.removePoi(e)})}};import{Mesh as Kf,Object3D as Jf,TextureLoader as Qf,Color as td,Vector2 as Oi,Vector3 as ed,NormalBlending as nd,RepeatWrapping as rd}from"three";import{BufferGeometry as Hf,Matrix4 as wa,Vector3 as sn,Ray as Wf,Sphere as qf,LineSegments as Xf,BufferAttribute as Xe,ShaderChunk as re,ShaderMaterial as Ta,UniformsLib as jf,Color as Yf,Vector2 as Ma}from"three";var ie=class extends Hf{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 wa,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(e){this.setGeometry(e,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(e){this.setPoints(e,this.widthCallback)}}})}};ie.prototype.setMatrixWorld=function(r){this.matrixWorld=r};ie.prototype.setGeometry=function(r,e){this._geometry=r,this.setPoints(r.getAttribute("position").array,e)};ie.prototype.setPoints=function(r,e){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=e,this.positions=[],this.counters=[],r.length&&r[0]instanceof sn)for(var t=0;t<r.length;t++){var n=r[t],i=t/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 t=0;t<r.length;t+=3){var i=t/r.length;this.positions.push(r[t],r[t+1],r[t+2]),this.positions.push(r[t],r[t+1],r[t+2]),this.counters.push(i),this.counters.push(i)}this.process()};function $f(r,e){var t=new wa,n=new Wf,i=new qf,o=new sn,a=this.geometry;if(a.boundingSphere||a.computeBoundingSphere(),i.copy(a.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,o)!==!1){t.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(t);var c=new sn,l=new sn,s=new sn,u=this instanceof Xf?2:1,h=a.index,f=a.attributes;if(h!==null)for(var d=h.array,g=f.position.array,p=f.width.array,m=0,v=d.length-1;m<v;m+=u){var b=d[m],y=d[m+1];c.fromArray(g,b*3),l.fromArray(g,y*3);var S=p[Math.floor(m/3)]!==void 0?p[Math.floor(m/3)]:1,x=r.params.Line.threshold+this.material.lineWidth*S/2,_=x*x,M=n.distanceSqToSegment(c,l,o,s);if(!(M>_)){o.applyMatrix4(this.matrixWorld);var w=r.ray.origin.distanceTo(o);w<r.near||w>r.far||(e.push({distance:w,point:s.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}),m=v)}}}}ie.prototype.raycast=$f;ie.prototype.compareV3=function(r,e){var t=r*6,n=e*6;return this.positions[t]===this.positions[n]&&this.positions[t+1]===this.positions[n+1]&&this.positions[t+2]===this.positions[n+2]};ie.prototype.copyV3=function(r){var e=r*6;return[this.positions[e],this.positions[e+1],this.positions[e+2]]};ie.prototype.getDistance=function(r){let e=0;for(let t=0;t<r;t++){let n=6*t,i=new sn(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new sn(this.positions[n+6],this.positions[n+7],this.positions[n+8]),a=i.distanceTo(o);e+=a}return e};ie.prototype.process=function(){var r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var e;let t=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?e=this.widthCallback(i/(r-1)):e=1,this.width.push(e),this.width.push(e),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)/t;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 Xe(new Float32Array(this.positions),3),previous:new Xe(new Float32Array(this.previous),3),next:new Xe(new Float32Array(this.next),3),side:new Xe(new Float32Array(this.side),1),width:new Xe(new Float32Array(this.width),1),uv:new Xe(new Float32Array(this.uvs),2),index:new Xe(new Uint16Array(this.indices_array),1),counters:new Xe(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 Li(r,e,t,n,i){var o;if(r=r.subarray||r.slice?r:r.buffer,t=t.subarray||t.slice?t:t.buffer,r=e?r.subarray?r.subarray(e,i&&e+i):r.slice(e,i&&e+i):r,t.set)t.set(r,n);else for(o=0;o<r.length;o++)t[o+n]=r[o];return t}ie.prototype.advance=function(r){var e=this._attributes.position.array,t=this._attributes.previous.array,n=this._attributes.next.array,i=e.length;Li(e,0,t,0,i),Li(e,6,e,0,i-6),e[i-6]=r.x,e[i-5]=r.y,e[i-4]=r.z,e[i-3]=r.x,e[i-2]=r.y,e[i-1]=r.z,Li(e,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};re.meshline_vert=["",re.logdepthbuf_pars_vertex,re.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;","",re.logdepthbuf_vertex,re.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",re.fog_vertex,"}"].join(`
104
+ `,i=-1/0,o=this.geometry.getAttribute("position");if(o)for(let c=0;c<o.count;c++){let l=o.getZ(c);l>i&&(i=l)}let a=new sf({uniforms:{maxZ:{value:i},uColor:{value:new ma(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new ma(Le(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:n,transparent:!0});this.material=a}initLineMaterial(){let t=Rt.createLineMaterial({color:this.options[0].strokeColor,opacity:this.options[0].strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new nf(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],n=this.options[0].height+this.options[0].deltaHeight;return this.options.map(i=>{let{coords:o}=i.geometry;for(let a=0;a<o.length;a++){let c=o[a];for(let l=0;l<c.length;l++){let s=c[l],u=l+1===c.length?c[0]:c[l+1];t.push(new ga(s[0],s[1],n)),t.push(new ga(u[0],u[1],n))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),n=new rf().setFromPoints(t);this.lineGeometry=n}createBorder(){this.line&&this.remove(this.line);let t=new of(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){this.geometry.dispose(),this.material.dispose(),this.line?.geometry.dispose(),this.clear()}};import{Box2 as Ni,Object3D as uf,Sprite as ya,SpriteMaterial as va,Vector2 as Dr}from"three";import{cloneDeep as lf}from"lodash";var cf={text:"",icon:"",icon_size:[18,18],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0},ne=class extends uf{constructor(t,n){super();this.context=t;this.options=dn(lf({...cf,...n}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}options;textAspect=1;spriteText;spriteIcon;box=new Ni;boxHelper;_initIconPromise=null;get durIconAndText(){return this.options.icon&&this.options.text?2:0}get offset(){return this.options.icon&&this.options.text?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.options.text?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.options.text?this.options.text_font_size:0}get deltaZ(){return .1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",async({value:t})=>{this._initIconPromise&&await this._initIconPromise,this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),await this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text",({value:t})=>{this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",({value:t})=>{this.spriteIcon&&(this.spriteIcon.material.rotation=t/180*Math.PI)}),this.addEventListener("change-icon_size",({value:t})=>{this.spriteIcon&&this._initScale({zoom:this.context.camera.zoom})})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}async initIcon(){if(this.options.icon)return this._initIconPromise=new Promise(async t=>{let n=await We.getTextureByUrl(this.options.icon),i=new ya(new va({map:n,transparent:!0,alphaTest:.2,depthTest:!1,rotation:this.options.icon_rotate/180*Math.PI}));i.visible=!1,i.renderOrder=1e5,n.needsUpdate=!0,this.add(i),this.spriteIcon=i,t(i)}).then(()=>{this._initIconPromise=null})}initText(){if(this.options.text){let t=He.getTextureByText(this.options.text);this.textAspect=t.image.width/t.image.height;let n=new ya(new va({map:t,transparent:!0,alphaTest:.2,depthTest:!1}));n.visible=!1,n.renderOrder=100001,t.needsUpdate=!0,this.spriteText=n,this.add(n)}}initSize(){let t=0,n=0,{icon:i,text:o}=this.options;i?o?(t=0,n=t*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(t=.5,n=0):o?(n=.5,t=0):(t=0,n=0),this.spriteIcon?.center.set(.5,t),this.spriteText?.center.set(.5,n)}async init(){await this.initIcon(),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}_initScale=({zoom:t})=>{if(this.spriteText){let n=this.textHeight/t;this.spriteText.scale.set(this.textAspect*n,n,.1)}this.spriteIcon&&this.spriteIcon?.scale.set(this.options.icon_size[0]/t,this.options.icon_size[1]/t,.1),this.resetZ()};resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:n,height:i}}=this.context,o=n*(t.x+1)/2,a=i*(-t.y+1)/2;a+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let c=this.iconWidth/2,l=new Ni(new Dr(o-c,a-this.iconHeight),new Dr(o+c,a)),s=this.textWidth/2,u=new Ni(new Dr(o-s,a-this.textHeight-this.durIconAndText-this.iconHeight),new Dr(o+s,a-this.iconHeight-this.durIconAndText));return this.box=u.union(l),this.box}renderBoxHelper(){if(!this.boxHelper){let t=document.createElement("div");t.style.position="fixed",t.style.border="1px solid red",t.style.pointerEvents="none",this.boxHelper=t,this.context.container.appendChild(t)}this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px"}parentSetVisible(t){this.spriteText&&(this.spriteText.visible=t),this.spriteIcon&&(this.spriteIcon.visible=t),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.unRegistryEvent(),this.spriteText=void 0}};import{DoubleSide as hf,Matrix4 as _a,Mesh as pf,MeshBasicMaterial as ff,Object3D as df,PlaneGeometry as gf}from"three";import{mergeGeometries as mf}from"three/examples/jsm/utils/BufferGeometryUtils";var yf={airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},texts:[],fillColor:"#ffffff",fillOpacity:0,strokeColor:"#ffffff",strokeOpacity:0,secondHeight:0,secondRotate:0,center_x:0,center_y:0},Ir=class extends df{constructor(t,n){super();this.context=t;this.options=n.map(i=>({...yf,...i})),this.init()}options;mesh;async init(){let t=this.options.map(c=>He.getTextureByText(c.texts[0],{fillStyle:Si(c.fillColor,c.fillOpacity),strokeStyle:Si(c.strokeColor,c.strokeOpacity),lineWidth:6,font:"54px sans-serif"})),n=t.map((c,l)=>{let s=this.options[l],{width:u,height:h}=c.image,f=u/h,d=s.secondHeight*f,g=new gf(d,s.secondHeight),p=new _a().makeTranslation(s.center_x,s.center_y,s.airHeight+s.deltaHeight+s.height).multiply(new _a().makeRotationZ(s.secondRotate));return g.applyMatrix4(p),g}),i=mf(n,!0);n.forEach(c=>c.dispose());let o=t.map(c=>{let l=new ff({map:c,alphaTest:1,side:hf});return c.needsUpdate=!0,l}),a=new pf(i,o);this.mesh=a,this.position.z+=.004,this.add(a)}dispose(){this.mesh?.geometry.dispose(),(this.mesh?.material).forEach(t=>t.dispose()),this.clear()}};import{Frustum as vf}from"three";var Rr=class extends le{startPoint;endPoint;rect;frustum=new vf;constructor(e){super(e);let{config:{selectBox:{fill:t,stroke:n}}}=e;this.rect=Ve(n,t),this.svg.appendChild(this.rect),this.registryEvent()}setEnable(e){super.setEnable(e),Xt(this.rect,0,0,0,0),e?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}onPointerDown=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.startPoint=t),this.endPoint=void 0};onPointerMove=e=>{if(!this.enable||!this.startPoint)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t)};onPointerUp=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t),this.doSelect(),this.startPoint=void 0};onUpdate=()=>{if(this.startPoint){let e=this.getSvgCoordinate(this.startPoint),t={...e};this.endPoint&&(t=this.getSvgCoordinate(this.endPoint));let n={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y)},i=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y);Xt(this.rect,n.x,n.y,i,o)}else Xt(this.rect,0,0,0,0)};registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:t,container:{clientWidth:n,clientHeight:i}}}=this,o=et(this.startPoint,t,n,i),a=et(this.endPoint,t,n,i),c={x:Math.min(o.x,a.x),y:Math.min(o.y,a.y)},l={x:Math.max(o.x,a.x),y:Math.max(o.y,a.y)},s=this.searchMapInFrustum(c,l);this.dispatchEvent({type:"selected",list:s})}}searchMapInFrustum(e,t){let{context:n}=this;return n.currentFloor?.graphicLayer.children.filter(i=>i instanceof Ft&&this.searchChildInFrustum(i,e,t))||[]}searchChildInFrustum(e,t,n){let{context:{camera:i,container:{clientWidth:o,clientHeight:a}}}=this;if(!e)return!1;if(!e.mesh){let f=e.getPosition();if(f){let d=et(f,i,o,a);return ke(d,t,n)}return!1}e.mesh.geometry.boundingBox||e.mesh.geometry.computeBoundingBox();let c=e.mesh.geometry.boundingBox;if(!c)return!1;let{min:l,max:s}=c,u=et(l,i,o,a),h=et(s,i,o,a);return!(!ke(u,t,n)||!ke(h,t,n))}dispose(){this.unRegistryEvent()}};var Nr=class extends _f{constructor(t){super();this.context=t;this.boxSelection=new Rr(t),this.boxSelection.setEnable(!1),this.registryEvent()}_list=new Set;boxSelection;prevPanStatus;prevRotateStatus;downPoint=null;isMultipleSelect=!1;get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.context.config.enableBoxSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}onPointerDown=t=>{this.downPoint={x:t.offsetX,y:t.offsetY}};onPointerUp=t=>{if(!this.downPoint)return;let{offsetX:n,offsetY:i}=t,{x:o,y:a}=this.downPoint;if(Math.sqrt((o-n)**2+(a-i)**2)>3)return;let{graphics:c}=this.context.getGraphicsByDeviceXy(n,i),l=new Set(c.map(u=>u.options.id));this.context.getPoisByDeviceXy(n,i).forEach(u=>{if(!l.has(u.options.id)){let h=this.context.currentFloor?.graphicLayer.graphicMap.get(u.options.id)||null;h&&h.options.geometry.type==="point"&&(c.push(h),l.add(u.options.id))}}),(gn?t.metaKey:t.ctrlKey)||this._list.clear(),c.forEach(u=>this._list.add(u)),this.selectEnd(),this.downPoint=null};onPointerOut=t=>{this.disableBoxSelection()};onKeyDown=t=>{mn(t.key)&&this.enableBoxSelection()};onKeyUp=t=>{mn(t.key)&&this.disableBoxSelection()};onBoxSelected=({list:t})=>{this._list.clear(),t.forEach(n=>{this._list.add(n)}),this.selectEnd()};selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}};import{EventDispatcher as xf,Vector2 as Ef}from"three";var Lr=class extends xf{constructor(t){super();this.context=t;this.registryEvent()}curGraphics=new Set;timer=new Gt;graphicTimerMap=new Map;onPointerMove=({graphics:t,pois:n,e:i})=>{let o=n.map(s=>this.context.currentFloor?.graphicLayer.graphicMap.get(s.options.id)).filter(s=>s&&s.options.geometry.type==="point");if(!t.length&&!o.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:a}=this.context.config.hover,c=new Set;if(o.length){let s,u=1e4;o.forEach(h=>{let f=n.find(d=>d.options.id===h.options.id);if(f instanceof rn){let{x:d,y:g}=f.clientPos,p=Math.sqrt((d-i.offsetX)**2+(g-i.offsetY)**2);p<u&&(u=p,s=h)}else if(f instanceof ne){let{x:d,y:g}=f.box.getCenter(new Ef),p=Math.sqrt((d-i.offsetX)**2+(g-i.offsetY)**2);p<u&&(u=p,s=h)}}),c.add(s)}c.size||t.forEach(s=>c.add(s)),c.forEach(s=>{if(this.graphicTimerMap.get(s)||this.curGraphics.has(s))return;let u=this.timer.setTimeout(()=>{this.curGraphics.add(s),this.graphicTimerMap.delete(s),this.timer.clearTimeout(u),this.handleHoverGraphicsChange()},a);this.graphicTimerMap.set(s,u)}),this.graphicTimerMap.forEach((s,u)=>{c.has(u)||(this.timer.clearTimeout(s),this.graphicTimerMap.delete(u))});let l=this.curGraphics.size;this.curGraphics.forEach(s=>{c.has(s)||this.curGraphics.delete(s)}),l!==this.curGraphics.size&&this.handleHoverGraphicsChange()};onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()};onBodyPointerMove=t=>{if(this.curGraphics.size){let n=this.context.container.getBoundingClientRect();(t.clientX<n.left||t.clientX>n.right||t.clientY<n.top||t.clientY>n.bottom)&&this.onPointerLevel()}};handleHoverGraphicsChange(t=this.curGraphics){this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}};import{Box3 as bf,Vector3 as Or}from"three";var Fr=class{constructor(e){this.context=e;this.registryEvent(),this.changePrevCamera()}prevCamera={position:new Or,zoom:1,target:new Or};enable=!0;box=new bf;updateBox(){this.box.setFromObject(this.context.scene)}setEnable(e){this.enable=e,e?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.scene.children.filter(m=>m instanceof Ce).length)return null;let t=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:a,max:c}=t,l=et(a,n,i,o),s=et(c,n,i,o),u=et(new Or(a.x,c.y,c.z),n,i,o),h=et(new Or(c.x,a.y,a.z),n,i,o),f=Math.min(l.x,s.x,u.x,h.x),d=Math.max(l.x,s.x,u.x,h.x),g=Math.min(l.y,s.y,u.y,h.y),p=Math.max(l.y,s.y,u.y,h.y);return{left:f,right:d,top:g,bottom:p}}checkDistanceToScreenEdge({left:e,right:t,top:n,bottom:i}){let{width:o,height:a}=this.context.clientSize,[c,l,s,u]=this.context.config.cameraBound.padding,h=t>=u,f=o-e>=l,d=a-n>=s,g=i>=c;return h&&f&&d&&g}onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:t,right:n,top:i,bottom:o}=e;this.checkDistanceToScreenEdge({left:t,right:n,top:i,bottom:o})?this.changePrevCamera():this.backToPrevCamera()}};dispose(){this.unRegistryEvent()}};import{Vector3 as xa}from"three";import{MapControls as Sf}from"three/examples/jsm/controls/MapControls";import{Tween as Ur,Group as Mf}from"@tweenjs/tween.js";var Br=class extends Sf{constructor(t,n,i){super(n,i);this.context=t;this.camera=n;this.domElement=i;this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=n.zoom,this.registryEvent()}prevCameraZoom=1;tweenGroup=new Mf;offsetY=0;registryEvent(){this.addEventListener("change",()=>{let t=this.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.dispatchEvent({type:"change-zoom",zoom:t}))}),this.context.addEventListener("update",this.tweenUpdate)}tweenUpdate=()=>{this.tweenGroup.update()};setPolarAngle(t,n=!1){let{maxPolarAngle:i,minPolarAngle:o}=this,a=i===o;(n||t<=i&&t>=o)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),a||(this.maxPolarAngle=i,this.minPolarAngle=o)}async setPolarAngleByDuration(t,n=!1,i=500){return i<=0?this.setPolarAngle(t,n):tn(new Promise(o=>{let a={polar:this.getPolarAngle()},c={polar:t},l=new Ur(a,this.tweenGroup).to(c,i).onUpdate(()=>{this.setPolarAngle(a.polar,n)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(l),o(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)}setAzimuthalAngle(t,n){let{maxAzimuthAngle:i,minAzimuthAngle:o,maxPolarAngle:a,minPolarAngle:c}=this,l=i===o;if(n||t<=i&&t>=o){this.maxAzimuthAngle=t,this.minAzimuthAngle=t;let s=this.getPolarAngle();this.maxPolarAngle=s,this.minPolarAngle=s,this.update(),this.maxPolarAngle=a,this.minPolarAngle=c}l||(this.maxAzimuthAngle=i,this.minAzimuthAngle=o)}setAzimuthalAngleDuration(t,n=!1,i=500){return i<=0?this.setAzimuthalAngle(t,n):tn(new Promise(o=>{let a={azimuthal:this.getAzimuthalAngle()},c={azimuthal:t},l=new Ur(a,this.tweenGroup).to(c,i).onUpdate(()=>{this.setAzimuthalAngle(a.azimuthal,n)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(l),o(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500)}getCameraLookAt(){return new xa().subVectors(this.target,this.camera.position)}async setCameraPositionByTarget(t,n){let i=this.target.clone(),o=this.getCameraLookAt();if(!n){this.camera.position.copy(t.clone().sub(o)),this.target.copy(t.clone()),this.update();return}return tn(new Promise(a=>{let c=new Ur(i,this.tweenGroup).to(t,n).onUpdate(()=>{this.camera.position.copy(i.clone().sub(o)),this.target.copy(i.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(c),this.camera.position.copy(t.clone().sub(o)),this.target.copy(t.clone()),this.update(),this.enabled=!0,a(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}setZoom(t,n,i=!1){let{minZoom:o,maxZoom:a}=this;(i||t>=o&&t<=a)&&(this.camera.position.copy(n.clone().sub(this.getCameraLookAt())),this.target.copy(n),this.camera.zoom=t,this.update())}setZoomByDuration(t,n,i=!1,o=500){let a=this.getCameraLookAt(),c={zoom:this.camera.zoom,target:this.target.clone()};return o?tn(new Promise(l=>{let s=new Ur(c,this.tweenGroup).to({zoom:t,target:n},o).onUpdate(()=>{this.setZoom(c.zoom,c.target,i)}).onComplete(()=>{this.tweenGroup.remove(s),this.enabled=!0,l(!0)}).onStart(()=>{this.enabled=!1}).start()}),o+500):this.setZoom(t,n,i)}setTargetByOffset(t,n=this.target.clone()){if(!t)return;let i=new xa;i.setFromMatrixColumn(this.camera.matrix,1),i.normalize(),i.multiplyScalar(t/this.camera.zoom),n.add(i),this.setCameraPositionByTarget(n,0)}dispose(){this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll()}};import{EventDispatcher as wf,PCFSoftShadowMap as Tf,WebGLRenderer as Cf}from"three";var zr=class extends Cf{event=new wf;scene;camera;enable=!0;timer=new Gt;constructor(e){super({antialias:!0,alpha:!0,...e}),this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=Tf}setCameraAndScene(e,t){this.scene=e,this.camera=t}autoRender(){this.scene&&this.camera&&this.enable&&(this.event.dispatchEvent({type:"update"}),this.render(this.scene,this.camera)),this.timer.requestAnimationFrame(()=>{this.autoRender()})}pauseRender(){this.enable=!1}continueRender(){this.enable=!0}addEventListener(e,t){this.event.addEventListener(e,t)}removeEventListener(e,t){this.event.removeEventListener(e,t)}dispose(){this.timer.dispose(),this.enable=!1,super.dispose()}};import{Scene as Af}from"three";var Gr=class extends Af{constructor(){super()}};import{OrthographicCamera as Pf}from"three";var kr=class extends Pf{constructor(e,t){super(-e/2,e/2,t/2,-t/2,-1e3,5e3),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var Vr=class extends Df{constructor(t,n){super();this.container=t;this.config=n;this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new Nr(this),this.hoverHelper=new Lr(this),this.resizeClientSize(),this.registryEvent()}scene=new Gr;renderer=new zr;camera;control;lights=_s();currentFloor;selection;hoverHelper;basicRatio;cameraBound;clientSize={width:0,height:0,x:0,y:0};renderRf=0;resizeClientSize(){let{x:t,y:n,width:i,height:o}=this.container.getBoundingClientRect();this.clientSize={width:i||this.container.clientWidth,height:o||this.container.clientHeight,x:t,y:n}}init(){let{clientWidth:t,clientHeight:n}=this.container;this.camera=new kr(t,n),this.renderer.setSize(t,n),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new Br(this,this.camera,this.renderer.domElement),this.control.maxPolarAngle=this.config.control.maxPolar,this.container.appendChild(this.renderer.domElement),this.scene.add(this.lights),this.basicRatio=this.getRatio(),this.control.addEventListener("change",()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})}),this.control.addEventListener("change-zoom",({zoom:i})=>{this.dispatchEvent({type:"control-zoom-change",zoom:i})}),this.renderer.addEventListener("update",()=>{this.dispatchEvent({type:"update"})}),this.cameraBound=new Fr(this)}getRatio(t=new on(0,0,0),n=new on(100,0,0)){let{clientWidth:i,clientHeight:o}=this.container,a=et(t,this.camera,i,o),c=et(n,this.camera,i,o);return Math.ceil(Math.sqrt((c.x-a.x)**2+(c.y-a.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(n=>{n instanceof Of&&(n.color=new Lf(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let n=t.getCenter();n&&(this.lights.position.x=n.x,this.lights.position.y=n.y),this.cameraBound.updateBox()}onWindowResize=()=>{let{container:t,camera:n,renderer:i}=this,{clientWidth:o,clientHeight:a}=t;o=Math.max(1,o),a=Math.max(1,a),n.left=-o/2,n.right=o/2,n.top=a/2,n.bottom=-a/2,n.updateProjectionMatrix(),i.setSize(o,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:o,height:a})};onClick=t=>{let{graphics:n,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY);n.length&&this.dispatchEvent({type:"graphic-click",graphics:n,position:i});let o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);o.length&&this.dispatchEvent({type:"poi-click",pois:o})};getGraphicsByDeviceXy(t,n){let i=new xn;i.x=t/this.clientSize.width*2-1,i.y=n/this.clientSize.height*-2+1;let o=new Rf;return o.setFromCamera(i,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),this.currentFloor?.graphicLayer.getGraphicByRaycaster(o)||{graphics:[],position:null}}getPoisByDeviceXy(t,n){let i=this.currentFloor?.poiLayer.getPoiByDeviceXy(t,n),o=this.currentFloor?.poiLayer2.getPoiByDeviceXy(t,n);return(i||[]).concat(o||[])}onPointerover=t=>{let{graphics:n,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-over",e:t,graphics:n,pois:o,position:i})};onPointermove=t=>{let{graphics:n,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-move",e:t,graphics:n,pois:o,position:i})};onPointerleave=t=>{this.dispatchEvent({type:"pointer-level"})};onSelectionSelect=({graphics:t,isMultipleSelect:n})=>{this.dispatchEvent({type:"select-graphic",graphics:t,isMultipleSelect:n})};onHoverChange=({graphics:t})=>{this.dispatchEvent({type:"hover",graphics:t})};registryEvent(){window.addEventListener("resize",this.onWindowResize),this.container.addEventListener("click",this.onClick),this.container.addEventListener("pointerover",this.onPointerover),this.container.addEventListener("pointermove",this.onPointermove),this.container.addEventListener("pointerleave",this.onPointerleave),this.container.addEventListener("pointercancel",this.onPointerleave),this.container.addEventListener("pointerout",this.onPointerleave),this.selection.addEventListener("select",this.onSelectionSelect),this.hoverHelper.addEventListener("hover-change",this.onHoverChange)}unRegistryEvent(){window.removeEventListener("resize",this.onWindowResize),this.container.removeEventListener("click",this.onClick),this.container.removeEventListener("pointerover",this.onPointerover),this.container.removeEventListener("pointermove",this.onPointermove),this.container.removeEventListener("pointerleave",this.onPointerleave),this.container.removeEventListener("pointercancel",this.onPointerleave),this.container.removeEventListener("pointerout",this.onPointerleave),this.selection.removeEventListener("select",this.onSelectionSelect),this.hoverHelper.removeEventListener("hover-change",this.onHoverChange)}setPolarAngle(t,n=500){return this.control.setPolarAngleByDuration(t,!0,n)}setAzimuthalAngle(t,n=500){return this.control.setAzimuthalAngleDuration(t,!0,n)}getCameraLookAt(){return this.control.getCameraLookAt()}setZoom(t,n,i=500){return this.control.setZoomByDuration(t,n,!0,i)}getFitCameraToObjectZoom(t,n=[20,20,20,20],i=500,o=!0){let[a,c,l,s]=n,{clientSize:{width:u,height:h}}=this,f=this.control.getPolarAngle();o&&this.setPolarAngle(0,0);let d=new Nf().setFromObject(t);this.setPolarAngle(f,0);let{max:g,min:p}=d,m=new on(p.x,g.y,g.z),v=new on(g.x,g.y,g.z),b=new on(g.x,p.y,p.z),y=new on(p.x,p.y,p.z),S=et(m,this.camera,u,h),x=et(v,this.camera,u,h),_=et(y,this.camera,u,h),M=et(b,this.camera,u,h),C=new If().setFromPoints([new xn(S.x,S.y),new xn(x.x,x.y),new xn(_.x,_.y),new xn(M.x,M.y)]).getSize(new xn),P=(u-c-s)/C.x,D=(h-a-l)/C.y,R=Math.min(P,D),W=new on((g.x+p.x)/2,(g.y+p.y)/2,(g.z+p.z)/2);return{zoom:R*this.camera.zoom,center:W}}fitCameraToObject(t,n=[20,20,20,20],i=500,o=!0){let{zoom:a,center:c}=this.getFitCameraToObjectZoom(t,n,i,o);return this.setZoom(a,c,i)}getFitCameraToGroundZoom(t=[20,20,20,20],n=500,i=!0){if(this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,n,i).zoom}fitCameraToGround(t=[20,20,20,20],n=500,i=!0){return this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundUpper,t,n,i):Promise.resolve(!1)}async setCameraPosition(t,n){return this.control.setCameraPositionByTarget(t,n)}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.renderer.dispose(),this.lights.children.forEach(t=>t.dispose()),Jt(this.scene)}};import{merge as Ff}from"lodash";var Uf={apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get"},enableBoxSelect:!0,resizeObserver:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1}};function Ea(r){return Ff({},Uf,r)}import{debounce as Gf}from"lodash";var kf=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(kf||{}),ba=class extends Bf{constructor(t,n={}){super();this.container=t;this.config=Ea(n),this.context=new Vr(t,this.config),this.registryEvent()}config;context;polarKeys=[];azimuthalKeys=[];svgLine;svgPolygon;basicZoom=1;prevCameraZoom=1;type="2d";currentBuildGround=null;observe=null;buildingCenter=[0,0];timer=new Gt;plugins=[];changeBuildingCenter(t,{brand:n,project:i}){let o=t?cr(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(n=>n!==t)}triggerHooks(t,n){this.dispatchEvent({type:t,data:n})}switchFloorByFloor(t,n=t.graphicLayer.children){this.triggerHooks("switch_floor_before",{curFloor:t,graphics:n}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks("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(void 0,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*30,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()}onControlChange=()=>{let{camera:{zoom:t}}=this.context;t!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=t)};addModel(t,n){if(t.options.geometry.type==="polygon"){let i=this.context.currentFloor?.addModel({...n,position:t.getPosition().setZ(.1),id:t.options.id});if(i){let{facilityAngle:o=0,facilityXScale:a=1,facilityYScale:c=1}=t.options.userData;i.rotateZ((180-o)/180*Math.PI),i.scale.set(a,c,1)}}}addHeatmap(t){return this.context.currentFloor?.addHeatmap(t)}getLegacyToGraphicMap(){return this.context.currentFloor?.userData.legacyToGraphicMap||new Map}getFloorAllGraphics(){return this.context.currentFloor?.graphicLayer.children.filter(t=>t instanceof Ft)||[]}createGraphicPoi(t,n){if(this.context.currentFloor){n.id===void 0&&(n.id=t.options.id);let i=t.getCenter();return this.context.currentFloor.addPoi({...n,position:{...i,z:i.z+t.options.height/2}})}return null}removeHeatMap(){this.context.currentFloor?.removeHeatMap()}translateElementToCenter(t,n=500){let i=t.getPosition();return this.context.setCameraPosition(i,n)}async translateElementToCenterX(t,n=500){return tn(new Promise(i=>{let o=this.context.control.target.clone(),a=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:c,height:l},camera:s}=this.context,h=et(a,s,c,l).x-c/2,f=new zf;f.setFromMatrixColumn(this.context.camera.matrix,0),f.normalize(),f.multiplyScalar(h/this.context.camera.zoom),o.add(f),this.context.setCameraPosition(o,n).then(i)})}),n+500)}getElementDeviceCoordinate(t){let n=t.position.clone(),{clientWidth:i,clientHeight:o}=this.container;return et(n,this.context.camera,i,o)}changeMapType(t,n=500){return this.type=t,t==="2d"?this.context.setPolarAngle(0,n):this.context.setPolarAngle(1.1,n)}async resetView(t=300){let n=t/3;await this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,n),await this.context.setPolarAngle(this.config.control.defaultPolar,n),await this.context.fitCameraToGround(this.config.defaultPadding,n,!1)}reduceMap(t=.5,n=500){let i=this.context.camera.zoom;return this.context.setZoom(i-t,this.context.control.target,n)}enlargeMap(t=.5,n=500){let i=this.context.camera.zoom;return this.context.setZoom(i+t,this.context.control.target,n)}onKeydown=t=>{this.polarKeys.includes(t.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(t.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)};onKeyUp=t=>{if(this.polarKeys.includes(t.code)){let n=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=n,this.context.control.minPolarAngle=n}if(this.azimuthalKeys.includes(t.code)){let n=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=n,this.context.control.minAzimuthAngle=n}};registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver(Gf(this.resize,5));t.observe(this.container),this.observe=t}}unRegistryEvent(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),this.observe?.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t=.1){let n=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(n+t,500)}async measureDistance(){return this.cancelDistance(),new Promise((t,n)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Mr(this.context);let i=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){i(),n("cancel")},this.svgLine.addEventListener("distance",({distance:o})=>{t(o)})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,n)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new wr(this.context);let i=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){i(),n("cancel")},this.svgPolygon.addEventListener("area",({area:o})=>{t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){return this.context.currentFloor?.graphicLayer.getGraphicByNodeId(t)||null}deleteGraphic(t){this.context.currentFloor?.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){if(!t.transformToBuildingGround&&this.currentBuildGround){let n=cr(this.currentBuildGround.info.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 this.context.currentFloor?.graphicLayer.createGraphic(t)}removePoiById(t){this.context.currentFloor?.poiLayer.removePoiById(t),this.context.currentFloor?.poiLayer2.removePoiById(t)}getPoiById(t){return this.context.currentFloor?.poiLayer.getPoiById(t)||this.context.currentFloor?.poiLayer2.getPoiById(t)}getPois(){return[...(this.context.currentFloor?.poiLayer.pois||[]).filter(t=>!t.options.built_in),...this.context.currentFloor?.poiLayer2.pois||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let t=this.context.control.getAzimuthalAngle(),n=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(void 0,0)||1;this.context.camera.zoom=n,this.context.control.minZoom=i,this.context.control.maxZoom=i*25,this.basicZoom=n,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(t,0),this.context.cameraBound.setEnable(!0)};dispose(){this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.context.dispose(),this.unRegistryEvent(),He.dispose(),We.dispose(),nn.dispose(),qe.dispose(),Rt.dispose()}};import{EventDispatcher as Vf}from"three";var Ae=class extends Vf{bmap;constructor(e){super(),this.bmap=e}dispose(){}};var Sa=class extends Ae{equipmentList=[];equipmentMap=new Map;constructor(e){super(e),this.fetchEquipment(),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}async fetchEquipment(){let{apiDomain:e,apiPath:{equipmentList:t},apiInfo:n}=this.bmap.config,i=`${e}${t}`;await 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)}onSwitchFloor=({data:{graphics:e}})=>{this.equipmentList.length&&this.changeGraphicToEquipment(e)};getGraphicEquipment(e){return e.userData.data.info.userData.equipment}changeGraphicToEquipment(e){e.filter(t=>{let n=this.getGraphicEquipment(t);return n&&this.equipmentMap.has(n)}).forEach(t=>{let n=this.equipmentMap.get(this.getGraphicEquipment(t)),i=this.bmap.createGraphicPoi(t,{icon:n?.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=n,i.userData.type="equipment")})}dispose(){this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),Array.from(this.bmap.context.currentFloor?.poiLayer.pois||[]).forEach(e=>{e.userData.type==="equipment"&&this.bmap.context.currentFloor?.poiLayer.removePoi(e)})}};import{Mesh as Kf,Object3D as Jf,TextureLoader as Qf,Color as td,Vector2 as Oi,Vector3 as ed,NormalBlending as nd,RepeatWrapping as rd}from"three";import{BufferGeometry as Hf,Matrix4 as wa,Vector3 as sn,Ray as Wf,Sphere as qf,LineSegments as Xf,BufferAttribute as Xe,ShaderChunk as re,ShaderMaterial as Ta,UniformsLib as jf,Color as Yf,Vector2 as Ma}from"three";var ie=class extends Hf{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 wa,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(e){this.setGeometry(e,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(e){this.setPoints(e,this.widthCallback)}}})}};ie.prototype.setMatrixWorld=function(r){this.matrixWorld=r};ie.prototype.setGeometry=function(r,e){this._geometry=r,this.setPoints(r.getAttribute("position").array,e)};ie.prototype.setPoints=function(r,e){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=e,this.positions=[],this.counters=[],r.length&&r[0]instanceof sn)for(var t=0;t<r.length;t++){var n=r[t],i=t/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 t=0;t<r.length;t+=3){var i=t/r.length;this.positions.push(r[t],r[t+1],r[t+2]),this.positions.push(r[t],r[t+1],r[t+2]),this.counters.push(i),this.counters.push(i)}this.process()};function $f(r,e){var t=new wa,n=new Wf,i=new qf,o=new sn,a=this.geometry;if(a.boundingSphere||a.computeBoundingSphere(),i.copy(a.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,o)!==!1){t.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(t);var c=new sn,l=new sn,s=new sn,u=this instanceof Xf?2:1,h=a.index,f=a.attributes;if(h!==null)for(var d=h.array,g=f.position.array,p=f.width.array,m=0,v=d.length-1;m<v;m+=u){var b=d[m],y=d[m+1];c.fromArray(g,b*3),l.fromArray(g,y*3);var S=p[Math.floor(m/3)]!==void 0?p[Math.floor(m/3)]:1,x=r.params.Line.threshold+this.material.lineWidth*S/2,_=x*x,M=n.distanceSqToSegment(c,l,o,s);if(!(M>_)){o.applyMatrix4(this.matrixWorld);var w=r.ray.origin.distanceTo(o);w<r.near||w>r.far||(e.push({distance:w,point:s.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}),m=v)}}}}ie.prototype.raycast=$f;ie.prototype.compareV3=function(r,e){var t=r*6,n=e*6;return this.positions[t]===this.positions[n]&&this.positions[t+1]===this.positions[n+1]&&this.positions[t+2]===this.positions[n+2]};ie.prototype.copyV3=function(r){var e=r*6;return[this.positions[e],this.positions[e+1],this.positions[e+2]]};ie.prototype.getDistance=function(r){let e=0;for(let t=0;t<r;t++){let n=6*t,i=new sn(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new sn(this.positions[n+6],this.positions[n+7],this.positions[n+8]),a=i.distanceTo(o);e+=a}return e};ie.prototype.process=function(){var r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var e;let t=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?e=this.widthCallback(i/(r-1)):e=1,this.width.push(e),this.width.push(e),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)/t;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 Xe(new Float32Array(this.positions),3),previous:new Xe(new Float32Array(this.previous),3),next:new Xe(new Float32Array(this.next),3),side:new Xe(new Float32Array(this.side),1),width:new Xe(new Float32Array(this.width),1),uv:new Xe(new Float32Array(this.uvs),2),index:new Xe(new Uint16Array(this.indices_array),1),counters:new Xe(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 Li(r,e,t,n,i){var o;if(r=r.subarray||r.slice?r:r.buffer,t=t.subarray||t.slice?t:t.buffer,r=e?r.subarray?r.subarray(e,i&&e+i):r.slice(e,i&&e+i):r,t.set)t.set(r,n);else for(o=0;o<r.length;o++)t[o+n]=r[o];return t}ie.prototype.advance=function(r){var e=this._attributes.position.array,t=this._attributes.previous.array,n=this._attributes.next.array,i=e.length;Li(e,0,t,0,i),Li(e,6,e,0,i-6),e[i-6]=r.x,e[i-5]=r.y,e[i-4]=r.z,e[i-3]=r.x,e[i-2]=r.y,e[i-1]=r.z,Li(e,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};re.meshline_vert=["",re.logdepthbuf_pars_vertex,re.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;","",re.logdepthbuf_vertex,re.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",re.fog_vertex,"}"].join(`
105
105
  `);re.meshline_frag=["",re.fog_pars_fragment,re.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() {","",re.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);","",re.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
106
- `);var qn=class extends Ta{constructor(e){super({uniforms:Object.assign({},jf.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new Yf(16777215)},opacity:{value:1},resolution:{value:new Ma(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 Ma(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:re.meshline_vert,fragmentShader:re.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(t){this.uniforms.map.value=t}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(t){this.uniforms.color.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(t){this.uniforms.dashArray.value=t,this.useDash=t!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(t){this.uniforms.useDash.value=t}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(t){this.uniforms.repeat.value.copy(t)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(t){this.uniforms.thresholdRatio.value=t}}}),this.setValues(e)}};qn.prototype.copy=function(r){return Ta.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 Ca="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAMAAACROYkbAAABrVBMVEVsjPdsjPdqi/doifdpivdrjPdsjPdsjPd/m/igtfqTq/lykfdri/dsjPdtjfe/zPv8/f/w8/6zw/p0kvdri/dsjPdtjffU3vz////////3+f62xfpzkfdri/dsjPdsjPeZr/nr8P7////////4+f62xfp0kvdri/dsjPdsjPdujveXrvne5v3////////3+f63x/t2lPdri/dsjPdsjPdsjPdri/eMpfjb4/3+/v/////4+v+7yft1k/dri/dsjPdsjPdri/eJovjl6/3////////3+f6Jo/lqivdsjPdri/dvjveluPry9f7////////i6f2BnPhqi/dsjPdrjPdvjveluPrv8v7////////l6/6Uq/lsjPdsjPdsjPdvjveluPrv8v7////////m6/6Uq/lsjPdsjPdsjPdsjPeZr/nv8v7////////s8f6XrvlsjPdsjPdtjffS2/z////////w9P6bsfltjfdsjPdtjffBz/v7/P/y9f6svvpxkPdrjPdsjPdsjPd+mviftPqVrPlykfdri/dsjPdsjPdri/doifdpifdrjPdsjPclkRlrAAAAx0lEQVQ4y2NgwAsYmZhZWNkYyAfsHJxc3Dy85BvAxy8gKCQsIkq2AWLiEpJS0jKycuQaIK+gqKSsoqqmrkGmAZpa2jq6evoGhkbG5BlgYmpmbmFpZW1ja0emE+wdHJ2cXVzd3D3INMDTy9vH188/IDCIPP3BIaFh4RGRUdExseQZEBefkJiUnJKalp5BngGZWdk5uXn5BemFZAZBUXFJaVl5RSWZ9jMwVFXX1NbVNzSSq5+hqbmlta29g2z9DJ1d3T29ffhUAABKPSh5Xst3GwAAAABJRU5ErkJggg==";var Aa={texture_url:Ca,lineWidth:8,color:16777215},Vr=class extends Jf{constructor(t,n){super();this.navigation=t;this.config=Object.assign({},Aa,n),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}mesh=null;geometry=null;material=null;texture=null;config=Aa;points=[];basicRepeat=1;prevCameraZoom=0;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)}onControlChange=()=>{let t=this.navigation.bmap.context.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.changeRepeat())};onUpdate=()=>{this.texture};onResize=()=>{if(this.material){let{width:t,height:n}=this.navigation.bmap.context.clientSize;this.material.resolution.set(t,n)}};getRepeat(){let{points:t,navigation:{bmap:{context:{camera:n,clientSize:{width:i,height:o}}}}}=this,a=t.map(([l,s])=>et(new ed(l,s,0),n,i,o)).map(({x:l,y:s})=>[l,s]);return Se(a)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new Oi(t,1)}loadTexture(t){return new Promise((n,i)=>{new Qf().load(t,n,void 0,i)})}transformPoints(t){let n=[];for(let i=0;i<t.length;i++)n.push(...t[i],0);return n}updatePoints(t){this.points=t,this.changeRepeat();let n=this.transformPoints(t);this.geometry&&this.geometry.setPoints(n)}movePath(t){this.material&&(this.material.thresholdRatio=t)}async create(t){let n=this.geometry=new ie;if(this.updatePoints(t),!this.texture){let a=this.texture=await this.loadTexture(this.config.texture_url);a.wrapS=a.wrapT=rd}let i=this.material=new qn({useMap:!0,color:new td(this.config.color),transparent:!0,resolution:new Oi(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:nd,repeat:new Oi(this.getRepeat(),1)}),o=this.mesh=new Kf(n,i);return o.renderOrder=9,this.add(o),o}dispose(){this.unRegistryEvent(),this.clear(),this.geometry?.dispose(),this.material?.dispose(),this.texture?.dispose()}};import{Tween as Pa,Easing as ad}from"@tweenjs/tween.js";import{Vector3 as an}from"three";import{EventDispatcher as id}from"three";import{Tween as od}from"@tweenjs/tween.js";var sd={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},Hr=class extends id{constructor(t,n){super();this.navigation=t;this.options=Object.assign({},sd,n),this.registryEvent()}offset=!1;reset=!1;position=[0,0];routeIndex=0;pointIndex=0;paths=[];options;timer=new Gt;resetTimer=null;tweenUtil=new vn;simulationTween;get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){return this.curRoutePath?.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)}onAddPaths=({paths:t})=>{this.paths=t,this.resetStatus(t),this.emitNavigationStatus()};onUpdate=()=>{this.tweenUtil.update()};resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,n){let{curRoutePathPoints:i,position:o,curRoutePath:a,paths:c,routeIndex:l}=this;if(!i.length)return null;let s=i;if(o){let p=fn(i,o);s=s.slice(p+1),s.unshift(o)}let u=[{floor:a?.floor,points:s},...c.slice(l+1)].filter(p=>p.floor===t),{distance:h,closestPoint:f,index:d,i:g}=u.reduce((p,m,v)=>{let{distance:b,closestPoint:y,index:S}=m.points.reduce((x,_,M,w)=>{if(!w[M+1])return x;let{distance:C,closestPoint:P}=Us(n,_,w[M+1]);return C<x.distance?{distance:C,closestPoint:P,index:M}:x},{distance:1/0,closestPoint:m.points[0],index:0});return b<p.distance?{distance:b,closestPoint:y,index:v,i:S}:p},{distance:1/0,closestPoint:s[0],index:0,i:0});return{distance:h,closestPoint:f,routeIndex:d+l,pointIndex:d===0?g+this.pointIndex:g}}toPosition(t,n){let i=this.adsorb(t,n);if(!i)return;let{distance:o,closestPoint:a,routeIndex:c,pointIndex:l}=i;o>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.routeIndex=c,this.pointIndex=l,this.position=a,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}async startCurRouteSimulation(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let n=[];return new Promise(i=>{let o=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],a=this.getCurRouteRemainDistance(),c=a/this.options.simulationSpeed,l=this.simulationTween=new od({distance:0},this.tweenUtil.group).to({distance:a},c*1e3).onUpdate(s=>{let u=pr(o,s.distance);u&&(n.push({floor:t.floor,pos:u}),this.toPosition(t.floor,u))}).onComplete(()=>{this.tweenUtil.remove(l),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,i(this.startCurRouteSimulation())):(i(!0),console.log(n))}).start()})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:n,position:i}=this;if(!t.length)return 0;let o=[i,...t.slice(n+1)];return Se(o)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((o,a)=>o+a.distance,0)+t,curRoute:t}}getNextDirDistance(){if(!this.position)return null;let{pointIndex:t,curRoutePathPoints:n,position:i}=this,o=n[t],a=n[t+1],c=n[t+2];if(!o||!a)return null;let l=kt(i,a);return t===0&&kt(o,i)<5?{dir:"start",distance:l}:c?{dir:wi(o,a,c),distance:l}:{dir:"end",distance:l}}getNavigationInfo(){let{total:t,curRoute:n}=this.getRemainDistance(),i=this.getNextDirDistance();if(!i)return null;let{dir:o,distance:a}=i;return o==="end"&&a>15&&(o="front"),o!=="start"&&a>=this.options.directionEmitThreshold&&(o="front"),n<=5&&(o="end"),{distance:t,curRouteDistance:n,nextDirDistance:a,dir:o,pos:this.position,routeIndex:this.routeIndex,offset:this.offset,reset:this.reset}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear()}};var ud={path:{},cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},positionNavigation:{},offsetY:150,directionEmitThreshold:5,disablePathAnimation:!1,speed:1},Da=class extends Ae{path=null;fetchRoadStatus=!1;paths=[];curPathIndex=0;curFloorPath=null;translatePath=null;currentPathPosition=null;options;pathTween=null;startPoi=null;movedDistance=0;pathStart=[0,0];tweenUtil=new vn;animationPathOptions={cPathIndex:0};cPath=[];positionNavigation;pathMoving=!1;nextPoint=null;constructor(e,t={},n){super(e),!n&&typeof t=="object"&&(n=t),this.options=Object.assign({},ud,n);let{apiDomain:i,apiPath:{roadNetwork:o},apiInfo:a}=this.bmap.config;this.positionNavigation=new Hr(this,{simulationSpeed:this.options.speed,...this.options.positionNavigation}),this.registryEvent()}get curFloorPathLength(){return this.curFloorPath?.distance??0}get curFloorPathPoints(){return this.curFloorPath?.points??[]}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor),this.positionNavigation.addEventListener("navigation-info",this.onNavigationInfo)}onNavigationInfo=({info:e})=>{if(this.dispatchEvent({type:"navigation-info",info:e}),!e.offset){if(e.routeIndex!==this.curPathIndex)return;this.pathMoving?this.nextPoint=e.pos:(this.toPositionBySpeed(e.pos,this.options.speed).then(()=>{this.pathMoving=!1}),this.nextPoint=null)}};pauseAnimation(){this.tweenUtil.pause(),this.positionNavigation.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue(),this.positionNavigation.tweenUtil.continue()}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),this.positionNavigation.removeEventListener("navigation-info",this.onNavigationInfo)}onUpdate=()=>{this.tweenUtil.update()};clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.tweenUtil.clear()),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null),this.translatePath=null}setCurFloorPath(e){e===null?(this.curFloorPath=null,this.currentPathPosition=null):(this.curFloorPath=e,this.currentPathPosition=e.points[0]),this.movedDistance=0}setCurPathIndex(e){this.curPathIndex=e,this.paths[e]?.floor===this.bmap.context.currentFloor?.name?(this.setCurFloorPath(this.paths[e]),this.renderPath(this.translatePoints(this.curFloorPathPoints))):this.clearPath()}onSwitchFloor=({data:{curFloor:e}})=>{if(this.tweenUtil.clear(),this.nextPoint=null,this.pathMoving=!1,this.paths[this.curPathIndex]){let t=this.paths[this.curPathIndex];this.setCurFloorPath(t??null),t?this.renderPath(this.translatePoints(t.points)):this.clearPath()}else this.clearPath()};addPath(e,t=0){this.paths=e,this.curPathIndex=t;let n=this.bmap.context.currentFloor?.name,i=e[t];if(n&&i?.floor===n)if(this.setCurFloorPath(i),this.bmap.currentBuildGround)this.renderPath(this.translatePoints(i.points));else{let o=()=>{this.bmap.removeEventListener("center-change",o),this.renderPath(this.translatePoints(i.points))};this.bmap.addEventListener("center-change",o)}else this.clearPath();this.dispatchEvent({type:"add-path",paths:e})}translatePoints(e){let[t,n]=this.bmap.buildingCenter;return e.map(i=>[i[0]-t,i[1]-n])}renderPath(e){this.translatePath=e;let t=this.catmullRomCurve3(e);this.cPath=t,this.animationPathOptions={cPathIndex:0},this.pathStart=t[0],this.path?this.path.updatePoints(t):(this.path=new Vr(this,this.options.path),this.path.create(t),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null),this.options.needStartPoi&&(this.startPoi=new ne(this.bmap.context,{...this.options.startPoi,id:"navigation_start_poi",position:{x:t[0][0],y:t[0][1],z:.51},collision_enable:!1})||null,this.bmap.context.currentFloor?.poiLayer2.pushPoi(this.startPoi)),this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(e){return Fs(e,!1,!0,.1,170,2.5)}getPathDirection(){if(!this.curFloorPath||!this.currentPathPosition||this.curFloorPathPoints.length<2)return null;let e=fn(this.curFloorPathPoints,this.currentPathPosition),t=this.curFloorPathPoints[e],n=this.curFloorPathPoints[e+1],i=new an(n[0]-t[0],n[1]-t[1],0).normalize(),o=new an(0,1,0).normalize(),a=i.angleTo(o),c=new an().crossVectors(o,i);return(Object.is(c.y,0)?-1:1)*a}async changeCameraToPathUp(e=100){let t=this.getPathDirection();if(t===null)return;let n=this.bmap.context.control.getAzimuthalAngle();Math.abs(n-t)>Math.PI&&(n>0?t=Math.PI*2+t:t=t-Math.PI*2);let i=Math.abs(t-this.bmap.context.control.getAzimuthalAngle());if(i<.01)return;let{control:o}=this.bmap.context,a=e/Math.PI*6*i;return new Promise(c=>{let l={azimuthal:o.getAzimuthalAngle()},s={azimuthal:t},u=new Pa(l,this.tweenUtil.group).to(s,a).easing(ad.Quadratic.InOut).onUpdate(async()=>{o.target.copy(this.startPoi.position),o.setAzimuthalAngle(l.azimuthal,!0),o.setTargetByOffset(this.options.offsetY)}).onComplete(()=>{o.enabled=!0,this.tweenUtil.remove(u),c(!0)}).onStart(()=>{o.enabled=!1}).start()})}async initNavigationCamera(){await this.translateCameraToStartPoi(300),await this.changeCameraToPathUp(300)}async translateCameraToStartPoi(e=100){if(!this.startPoi)return;let{clientSize:{width:t,height:n},camera:i,control:o}=this.bmap.context,a=Math.round(t/2),c=Math.round(n/2),l=o.target.clone(),s=et(this.startPoi.position,i,t,n),u=s.x-a,h=c-s.y+this.options.offsetY;if(!(Math.abs(u)<1&&Math.abs(h)<1)){if(Math.abs(u)>=1){let f=new an;f.setFromMatrixColumn(i.matrix,0),f.normalize(),f.multiplyScalar(u/i.zoom),l.add(new an(f.x,0,0))}if(Math.abs(h)>=1){let f=new an;f.setFromMatrixColumn(i.matrix,1),f.normalize(),f.multiplyScalar(h/i.zoom),l.add(new an(0,f.y,0))}return this.bmap.context.setCameraPosition(l,e)}}async initCameraZoom(e=100){if(!this.startPoi)return;let{clientSize:{width:t,height:n},currentFloor:i}=this.bmap.context,{max:o,min:a}=i.box,l=Math.min(t/(o.x-a.x),n/(o.y-a.y))*(o.x-a.x)/20;return this.bmap.context.setZoom(l,this.startPoi.position,e)}toPosition(e,t){this.positionNavigation.toPosition(e,t)}startSimulation(){this.positionNavigation.startSimulation()}setSimulationSpeed(e){this.positionNavigation.changeSimulationSpeed(e)}async toPositionBySpeed(e,t){let{currentPathPosition:n,curFloorPath:i,curFloorPathPoints:o}=this;if(!i||!n)return null;let a=this.movedDistance,c=zs(o,e);if(a===-1||c===-1||c<=a)return null;let l=c-a;if(!l)return;let s=Math.min(l/t,3);return this.pathTween&&this.tweenUtil.clear(),this.pathMoving=!0,new Promise(u=>{let h=this.pathTween=new Pa({distance:0},this.tweenUtil.group).to({distance:l},s*1e3).onUpdate(async f=>{this.moveDistance(f.distance+a,h)}).onComplete(()=>{if(this.tweenUtil.remove(h),this.nextPoint){let f=this.nextPoint;this.nextPoint=null,u(this.toPositionBySpeed(f,this.options.speed))}else u(!0)}).start()})}async moveDistance(e,t){this.movedDistance=e,this.path?.movePath(this.movedDistance/this.curFloorPathLength);let n=pr(this.curFloorPathPoints,this.movedDistance);if(n===null)return;this.currentPathPosition=n;let i=this.translatePoints([n])[0];this.startPoi&&(this.startPoi.position.setX(i[0]).setY(i[1]),this.options.disablePathAnimation||this.bmap.context.control.setTargetByOffset(this.options.offsetY,this.startPoi.position.clone())),this.options.disablePathAnimation||(t?.pause(),this.positionNavigation.tweenUtil.pause(),await this.changeCameraToPathUp(500/this.options.speed),this.positionNavigation.tweenUtil.continue(),t?.resume())}setStartPoiRotate(e){if(this.startPoi){let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(180-e-n)%360}}dispose(){this.tweenUtil.dispose(),this.unRegistryEvent(),this.path?.dispose(),this.startPoi?.dispose(),this.positionNavigation.dispose()}};import{Group as ld}from"three";var Ia=class extends Ae{poiLayer;floors=[];group=new ld;constructor(e){super(e),this.poiLayer=new _n(e.context)}show(e){let t=e[0].userData.height;e.forEach(o=>{o.poiLayer.pois.forEach(a=>{this.poiLayer.pushPoi(a)}),o.poiLayer.pois.length=0,o.poiLayer.dispose(),o.position.z=t,t+=o.userData.height});let{scene:n,currentFloor:i}=this.bmap.context;i&&(n.remove(i),i.dispose()),this.group.add(this.poiLayer,...e),n.add(this.group),this.floors=e,this.bmap.context.cameraBound.updateBox()}hide(){let{scene:e}=this.bmap.context;e.remove(this.group),this.poiLayer.clear(!0),this.floors.forEach(t=>{t.dispose()}),this.floors=[],this.group.clear()}fitCamera(){let{context:e,config:t,type:n}=this.bmap;e.cameraBound.setEnable(!1),e.control.minZoom=0,e.control.maxZoom=1/0,e.camera.zoom=1,e.setAzimuthalAngle(t.control.defaultAzimuthal,0),e.setPolarAngle(t.control.defaultPolar,0),e.fitCameraToObject(this.group,void 0,0);let i=e.camera.zoom;e.control.minZoom=i,e.control.maxZoom=i*25,n==="3d"&&e.fitCameraToObject(this.group,t.defaultPadding,0,!1),this.bmap.basicZoom=e.camera.zoom,e.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),e.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(e=>e.dispose()),this.floors=[]}};import{EventDispatcher as cd}from"three";function Xn(r){let e=new Blob([r],{type:"text/javascript"}),t=URL.createObjectURL(e),n=new Worker(t);return URL.revokeObjectURL(t),n}function Fi(){return Xn(`var RP=Object.create;var Zd=Object.defineProperty,LP=Object.defineProperties,NP=Object.getOwnPropertyDescriptor,OP=Object.getOwnPropertyDescriptors,DP=Object.getOwnPropertyNames,Wv=Object.getOwnPropertySymbols,FP=Object.getPrototypeOf,qv=Object.prototype.hasOwnProperty,UP=Object.prototype.propertyIsEnumerable;var $d=(r,t,e)=>t in r?Zd(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Wc=(r,t)=>{for(var e in t||(t={}))qv.call(t,e)&&$d(r,e,t[e]);if(Wv)for(var e of Wv(t))UP.call(t,e)&&$d(r,e,t[e]);return r},Xv=(r,t)=>LP(r,OP(t));var ye=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var BP=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of DP(t))!qv.call(r,a)&&a!==e&&Zd(r,a,{get:()=>t[a],enumerable:!(o=NP(t,a))||o.enumerable});return r};var Er=(r,t,e)=>(e=r!=null?RP(FP(r)):{},BP(t||!r||!r.__esModule?Zd(e,"default",{value:r,enumerable:!0}):e,r));var Ei=(r,t,e)=>$d(r,typeof t!="symbol"?t+"":t,e);var $v=ye((lz,Yv)=>{var Jd=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};Yv.exports=Jd});var Kv=ye((cz,Jv)=>{function Zv(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,Zv(a,t)):o!==t&&e.set(o,a);return e}Jv.exports=Zv});var t_=ye((fz,jv)=>{function zP(r){let t=Number(r);return!(isNaN(t)||t<=0)}function Qv(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,Qv(a));if(!zP(a))throw new Error(\`Could not add node at key "\${o}", make sure it's a valid node\`,a);return t.set(o,Number(a))}),t}jv.exports=Qv});var r_=ye((hz,n_)=>{function e_(r){if(!(r instanceof Map))throw new Error(\`Invalid graph: Expected Map instead found \${typeof r}\`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){e_(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}n_.exports=e_});var a_=ye((pz,s_)=>{var kP=$v(),GP=Kv(),i_=t_(),o_=r_(),Kd=class{constructor(t){t instanceof Map?(o_(t),this.graph=t):t?this.graph=i_(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(o_(e),o=e):o=i_(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=GP(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,c=new kP,p=new Map,d=[],g=0,y=[];if(o.avoid&&(y=[].concat(o.avoid)),y.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(y.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(c.set(t,0);!c.isEmpty();){let _=c.next();if(_.key===e){g=_.priority;let x=_.key;for(;p.has(x);)d.push(x),x=p.get(x);break}a.add(_.key),(this.graph.get(_.key)||new Map).forEach((x,T)=>{if(a.has(T)||y.includes(T))return null;if(!c.has(T))return p.set(T,_.key),c.set(T,_.priority+x);let C=c.get(T).priority,I=_.priority+x;return I<C?(p.set(T,_.key),c.set(T,I)):null})}return d.length?(o.trim?d.shift():d=d.concat([t]),o.reverse||(d=d.reverse()),o.cost?{path:d,cost:g}:d):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};s_.exports=Kd});var tp=ye((wz,K1)=>{"use strict";var J1=Object.getOwnPropertySymbols,HO=Object.prototype.hasOwnProperty,VO=Object.prototype.propertyIsEnumerable;function WO(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function qO(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(c){return t[c]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(c){a[c]=c}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(c){return!1}}K1.exports=qO()?Object.assign:function(r,t){for(var e,o=WO(r),a,c=1;c<arguments.length;c++){e=Object(arguments[c]);for(var p in e)HO.call(e,p)&&(o[p]=e[p]);if(J1){a=J1(e);for(var d=0;d<a.length;d++)VO.call(e,a[d])&&(o[a[d]]=e[a[d]])}}return o}});var Mm=ye((Em,wm)=>{(function(r,t){typeof Em=="object"&&typeof wm!="undefined"?wm.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(Em,function(){"use strict";function r(M,E,L,A,z){(function G(Y,X,U,H,Q){for(;H>U;){if(H-U>600){var gt=H-U+1,$=X-U+1,Nt=Math.log(gt),j=.5*Math.exp(2*Nt/3),pt=.5*Math.sqrt(Nt*j*(gt-j)/gt)*($-gt/2<0?-1:1),Ct=Math.max(U,Math.floor(X-$*j/gt+pt)),Tt=Math.min(H,Math.floor(X+(gt-$)*j/gt+pt));G(Y,X,Ct,Tt,Q)}var ft=Y[X],dt=U,Z=H;for(t(Y,U,X),Q(Y[H],ft)>0&&t(Y,U,H);dt<Z;){for(t(Y,dt,Z),dt++,Z--;Q(Y[dt],ft)<0;)dt++;for(;Q(Y[Z],ft)>0;)Z--}Q(Y[U],ft)===0?t(Y,U,Z):t(Y,++Z,H),Z<=X&&(U=Z+1),X<=Z&&(H=Z-1)}})(M,E,L||0,A||M.length-1,z||e)}function t(M,E,L){var A=M[E];M[E]=M[L],M[L]=A}function e(M,E){return M<E?-1:M>E?1:0}var o=function(M){M===void 0&&(M=9),this._maxEntries=Math.max(4,M),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(M,E,L){if(!L)return E.indexOf(M);for(var A=0;A<E.length;A++)if(L(M,E[A]))return A;return-1}function c(M,E){p(M,0,M.children.length,E,M)}function p(M,E,L,A,z){z||(z=C(null)),z.minX=1/0,z.minY=1/0,z.maxX=-1/0,z.maxY=-1/0;for(var G=E;G<L;G++){var Y=M.children[G];d(z,M.leaf?A(Y):Y)}return z}function d(M,E){return M.minX=Math.min(M.minX,E.minX),M.minY=Math.min(M.minY,E.minY),M.maxX=Math.max(M.maxX,E.maxX),M.maxY=Math.max(M.maxY,E.maxY),M}function g(M,E){return M.minX-E.minX}function y(M,E){return M.minY-E.minY}function _(M){return(M.maxX-M.minX)*(M.maxY-M.minY)}function w(M){return M.maxX-M.minX+(M.maxY-M.minY)}function x(M,E){return M.minX<=E.minX&&M.minY<=E.minY&&E.maxX<=M.maxX&&E.maxY<=M.maxY}function T(M,E){return E.minX<=M.maxX&&E.minY<=M.maxY&&E.maxX>=M.minX&&E.maxY>=M.minY}function C(M){return{children:M,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function I(M,E,L,A,z){for(var G=[E,L];G.length;)if(!((L=G.pop())-(E=G.pop())<=A)){var Y=E+Math.ceil((L-E)/A/2)*A;r(M,Y,E,L,z),G.push(E,Y,Y,L)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(M){var E=this.data,L=[];if(!T(M,E))return L;for(var A=this.toBBox,z=[];E;){for(var G=0;G<E.children.length;G++){var Y=E.children[G],X=E.leaf?A(Y):Y;T(M,X)&&(E.leaf?L.push(Y):x(M,X)?this._all(Y,L):z.push(Y))}E=z.pop()}return L},o.prototype.collides=function(M){var E=this.data;if(!T(M,E))return!1;for(var L=[];E;){for(var A=0;A<E.children.length;A++){var z=E.children[A],G=E.leaf?this.toBBox(z):z;if(T(M,G)){if(E.leaf||x(M,G))return!0;L.push(z)}}E=L.pop()}return!1},o.prototype.load=function(M){if(!M||!M.length)return this;if(M.length<this._minEntries){for(var E=0;E<M.length;E++)this.insert(M[E]);return this}var L=this._build(M.slice(),0,M.length-1,0);if(this.data.children.length)if(this.data.height===L.height)this._splitRoot(this.data,L);else{if(this.data.height<L.height){var A=this.data;this.data=L,L=A}this._insert(L,this.data.height-L.height-1,!0)}else this.data=L;return this},o.prototype.insert=function(M){return M&&this._insert(M,this.data.height-1),this},o.prototype.clear=function(){return this.data=C([]),this},o.prototype.remove=function(M,E){if(!M)return this;for(var L,A,z,G=this.data,Y=this.toBBox(M),X=[],U=[];G||X.length;){if(G||(G=X.pop(),A=X[X.length-1],L=U.pop(),z=!0),G.leaf){var H=a(M,G.children,E);if(H!==-1)return G.children.splice(H,1),X.push(G),this._condense(X),this}z||G.leaf||!x(G,Y)?A?(L++,G=A.children[L],z=!1):G=null:(X.push(G),U.push(L),L=0,A=G,G=G.children[0])}return this},o.prototype.toBBox=function(M){return M},o.prototype.compareMinX=function(M,E){return M.minX-E.minX},o.prototype.compareMinY=function(M,E){return M.minY-E.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(M){return this.data=M,this},o.prototype._all=function(M,E){for(var L=[];M;)M.leaf?E.push.apply(E,M.children):L.push.apply(L,M.children),M=L.pop();return E},o.prototype._build=function(M,E,L,A){var z,G=L-E+1,Y=this._maxEntries;if(G<=Y)return c(z=C(M.slice(E,L+1)),this.toBBox),z;A||(A=Math.ceil(Math.log(G)/Math.log(Y)),Y=Math.ceil(G/Math.pow(Y,A-1))),(z=C([])).leaf=!1,z.height=A;var X=Math.ceil(G/Y),U=X*Math.ceil(Math.sqrt(Y));I(M,E,L,U,this.compareMinX);for(var H=E;H<=L;H+=U){var Q=Math.min(H+U-1,L);I(M,H,Q,X,this.compareMinY);for(var gt=H;gt<=Q;gt+=X){var $=Math.min(gt+X-1,Q);z.children.push(this._build(M,gt,$,A-1))}}return c(z,this.toBBox),z},o.prototype._chooseSubtree=function(M,E,L,A){for(;A.push(E),!E.leaf&&A.length-1!==L;){for(var z=1/0,G=1/0,Y=void 0,X=0;X<E.children.length;X++){var U=E.children[X],H=_(U),Q=(gt=M,$=U,(Math.max($.maxX,gt.maxX)-Math.min($.minX,gt.minX))*(Math.max($.maxY,gt.maxY)-Math.min($.minY,gt.minY))-H);Q<G?(G=Q,z=H<z?H:z,Y=U):Q===G&&H<z&&(z=H,Y=U)}E=Y||E.children[0]}var gt,$;return E},o.prototype._insert=function(M,E,L){var A=L?M:this.toBBox(M),z=[],G=this._chooseSubtree(A,this.data,E,z);for(G.children.push(M),d(G,A);E>=0&&z[E].children.length>this._maxEntries;)this._split(z,E),E--;this._adjustParentBBoxes(A,z,E)},o.prototype._split=function(M,E){var L=M[E],A=L.children.length,z=this._minEntries;this._chooseSplitAxis(L,z,A);var G=this._chooseSplitIndex(L,z,A),Y=C(L.children.splice(G,L.children.length-G));Y.height=L.height,Y.leaf=L.leaf,c(L,this.toBBox),c(Y,this.toBBox),E?M[E-1].children.push(Y):this._splitRoot(L,Y)},o.prototype._splitRoot=function(M,E){this.data=C([M,E]),this.data.height=M.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(M,E,L){for(var A,z,G,Y,X,U,H,Q=1/0,gt=1/0,$=E;$<=L-E;$++){var Nt=p(M,0,$,this.toBBox),j=p(M,$,L,this.toBBox),pt=(z=Nt,G=j,Y=void 0,X=void 0,U=void 0,H=void 0,Y=Math.max(z.minX,G.minX),X=Math.max(z.minY,G.minY),U=Math.min(z.maxX,G.maxX),H=Math.min(z.maxY,G.maxY),Math.max(0,U-Y)*Math.max(0,H-X)),Ct=_(Nt)+_(j);pt<Q?(Q=pt,A=$,gt=Ct<gt?Ct:gt):pt===Q&&Ct<gt&&(gt=Ct,A=$)}return A||L-E},o.prototype._chooseSplitAxis=function(M,E,L){var A=M.leaf?this.compareMinX:g,z=M.leaf?this.compareMinY:y;this._allDistMargin(M,E,L,A)<this._allDistMargin(M,E,L,z)&&M.children.sort(A)},o.prototype._allDistMargin=function(M,E,L,A){M.children.sort(A);for(var z=this.toBBox,G=p(M,0,E,z),Y=p(M,L-E,L,z),X=w(G)+w(Y),U=E;U<L-E;U++){var H=M.children[U];d(G,M.leaf?z(H):H),X+=w(G)}for(var Q=L-E-1;Q>=E;Q--){var gt=M.children[Q];d(Y,M.leaf?z(gt):gt),X+=w(Y)}return X},o.prototype._adjustParentBBoxes=function(M,E,L){for(var A=L;A>=0;A--)d(E[A],M)},o.prototype._condense=function(M){for(var E=M.length-1,L=void 0;E>=0;E--)M[E].children.length===0?E>0?(L=M[E-1].children).splice(L.indexOf(M[E]),1):this.clear():c(M[E],this.toBBox)},o})});var Q1=ye((Sm,bm)=>{(function(r,t){typeof Sm=="object"&&typeof bm!="undefined"?bm.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(Sm,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var c=(this.length>>1)-1;c>=0;c--)this._down(c)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,c=a.data,p=a.compare,d=c[o];o>0;){var g=o-1>>1,y=c[g];if(p(d,y)>=0)break;c[o]=y,o=g}c[o]=d},r.prototype._down=function(o){for(var a=this,c=a.data,p=a.compare,d=this.length>>1,g=c[o];o<d;){var y=(o<<1)+1,_=c[y],w=y+1;if(w<this.length&&p(c[w],_)<0&&(y=w,_=c[w]),p(_,g)>=0)break;c[o]=_,o=y}c[o]=g};function t(e,o){return e<o?-1:e>o?1:0}return r})});var tx=ye((Cz,j1)=>{j1.exports=function(t,e,o,a){var c=t[0],p=t[1],d=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var g=(a-o)/2,y=0,_=g-1;y<g;_=y++){var w=e[o+y*2+0],x=e[o+y*2+1],T=e[o+_*2+0],C=e[o+_*2+1],I=x>p!=C>p&&c<(T-w)*(p-x)/(C-x)+w;I&&(d=!d)}return d}});var nx=ye((Pz,ex)=>{ex.exports=function(t,e,o,a){var c=t[0],p=t[1],d=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var g=a-o,y=0,_=g-1;y<g;_=y++){var w=e[y+o][0],x=e[y+o][1],T=e[_+o][0],C=e[_+o][1],I=x>p!=C>p&&c<(T-w)*(p-x)/(C-x)+w;I&&(d=!d)}return d}});var ox=ye((Iz,rp)=>{var rx=tx(),ix=nx();rp.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?ix(t,e,o,a):rx(t,e,o,a)};rp.exports.nested=ix;rp.exports.flat=rx});var ax=ye((ip,sx)=>{(function(r,t){typeof ip=="object"&&typeof sx!="undefined"?t(ip):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(ip,function(r){"use strict";let e=33306690738754706e-32;function o(T,C,I,M,E){let L,A,z,G,Y=C[0],X=M[0],U=0,H=0;X>Y==X>-Y?(L=Y,Y=C[++U]):(L=X,X=M[++H]);let Q=0;if(U<T&&H<I)for(X>Y==X>-Y?(z=L-((A=Y+L)-Y),Y=C[++U]):(z=L-((A=X+L)-X),X=M[++H]),L=A,z!==0&&(E[Q++]=z);U<T&&H<I;)X>Y==X>-Y?(z=L-((A=L+Y)-(G=A-L))+(Y-G),Y=C[++U]):(z=L-((A=L+X)-(G=A-L))+(X-G),X=M[++H]),L=A,z!==0&&(E[Q++]=z);for(;U<T;)z=L-((A=L+Y)-(G=A-L))+(Y-G),Y=C[++U],L=A,z!==0&&(E[Q++]=z);for(;H<I;)z=L-((A=L+X)-(G=A-L))+(X-G),X=M[++H],L=A,z!==0&&(E[Q++]=z);return L===0&&Q!==0||(E[Q++]=L),Q}function a(T){return new Float64Array(T)}let c=33306690738754716e-32,p=22204460492503146e-32,d=11093356479670487e-47,g=a(4),y=a(8),_=a(12),w=a(16),x=a(4);r.orient2d=function(T,C,I,M,E,L){let A=(C-L)*(I-E),z=(T-E)*(M-L),G=A-z;if(A===0||z===0||A>0!=z>0)return G;let Y=Math.abs(A+z);return Math.abs(G)>=c*Y?G:-function(X,U,H,Q,gt,$,Nt){let j,pt,Ct,Tt,ft,dt,Z,st,vt,zt,bt,qt,le,se,Zt,_e,Vt,pe,at=X-gt,He=H-gt,ae=U-$,ce=Q-$;ft=(Zt=(st=at-(Z=(dt=134217729*at)-(dt-at)))*(zt=ce-(vt=(dt=134217729*ce)-(dt-ce)))-((se=at*ce)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=ae-(Z=(dt=134217729*ae)-(dt-ae)))*(zt=He-(vt=(dt=134217729*He)-(dt-He)))-((_e=ae*He)-Z*vt-st*vt-Z*zt))),g[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),g[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,g[2]=qt-(pe-ft)+(bt-ft),g[3]=pe;let fe=function(J,rt){let D=rt[0];for(let N=1;N<J;N++)D+=rt[N];return D}(4,g),it=p*Nt;if(fe>=it||-fe>=it||(j=X-(at+(ft=X-at))+(ft-gt),Ct=H-(He+(ft=H-He))+(ft-gt),pt=U-(ae+(ft=U-ae))+(ft-$),Tt=Q-(ce+(ft=Q-ce))+(ft-$),j===0&&pt===0&&Ct===0&&Tt===0)||(it=d*Nt+e*Math.abs(fe),(fe+=at*Tt+ce*j-(ae*Ct+He*pt))>=it||-fe>=it))return fe;ft=(Zt=(st=j-(Z=(dt=134217729*j)-(dt-j)))*(zt=ce-(vt=(dt=134217729*ce)-(dt-ce)))-((se=j*ce)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=pt-(Z=(dt=134217729*pt)-(dt-pt)))*(zt=He-(vt=(dt=134217729*He)-(dt-He)))-((_e=pt*He)-Z*vt-st*vt-Z*zt))),x[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),x[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,x[2]=qt-(pe-ft)+(bt-ft),x[3]=pe;let B=o(4,g,4,x,y);ft=(Zt=(st=at-(Z=(dt=134217729*at)-(dt-at)))*(zt=Tt-(vt=(dt=134217729*Tt)-(dt-Tt)))-((se=at*Tt)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=ae-(Z=(dt=134217729*ae)-(dt-ae)))*(zt=Ct-(vt=(dt=134217729*Ct)-(dt-Ct)))-((_e=ae*Ct)-Z*vt-st*vt-Z*zt))),x[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),x[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,x[2]=qt-(pe-ft)+(bt-ft),x[3]=pe;let P=o(B,y,4,x,_);ft=(Zt=(st=j-(Z=(dt=134217729*j)-(dt-j)))*(zt=Tt-(vt=(dt=134217729*Tt)-(dt-Tt)))-((se=j*Tt)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=pt-(Z=(dt=134217729*pt)-(dt-pt)))*(zt=Ct-(vt=(dt=134217729*Ct)-(dt-Ct)))-((_e=pt*Ct)-Z*vt-st*vt-Z*zt))),x[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),x[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,x[2]=qt-(pe-ft)+(bt-ft),x[3]=pe;let F=o(P,_,4,x,w);return w[F-1]}(T,C,I,M,E,L,Y)},r.orient2dfast=function(T,C,I,M,E,L){return(C-L)*(I-E)-(T-E)*(M-L)},Object.defineProperty(r,"__esModule",{value:!0})})});var px=ye((Rz,Pm)=>{"use strict";var ux=Mm(),sp=Q1(),YO=ox(),$O=ax().orient2d;sp.default&&(sp=sp.default);Pm.exports=hx;Pm.exports.default=hx;function hx(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=jO(r),a=new ux(16);a.toBBox=function(L){return{minX:L[0],minY:L[1],maxX:L[0],maxY:L[1]}},a.compareMinX=function(L,A){return L[0]-A[0]},a.compareMinY=function(L,A){return L[1]-A[1]},a.load(r);for(var c=[],p=0,d;p<o.length;p++){var g=o[p];a.remove(g),d=fx(g,d),c.push(d)}var y=new ux(16);for(p=0;p<c.length;p++)y.insert(Tm(c[p]));for(var _=t*t,w=e*e;c.length;){var x=c.shift(),T=x.p,C=x.next.p,I=Am(T,C);if(!(I<w)){var M=I/_;g=ZO(a,x.prev.p,T,C,x.next.next.p,M,y),g&&Math.min(Am(g,T),Am(g,C))<=M&&(c.push(x),c.push(fx(g,x)),a.remove(g),y.remove(x),y.insert(Tm(x)),y.insert(Tm(x.next)))}}x=d;var E=[];do E.push(x.p),x=x.next;while(x!==d);return E.push(x.p),E}function ZO(r,t,e,o,a,c,p){for(var d=new sp([],JO),g=r.data;g;){for(var y=0;y<g.children.length;y++){var _=g.children[y],w=g.leaf?Cm(_,e,o):KO(e,o,_);w>c||d.push({node:_,dist:w})}for(;d.length&&!d.peek().node.children;){var x=d.pop(),T=x.node,C=Cm(T,t,e),I=Cm(T,o,a);if(x.dist<C&&x.dist<I&&cx(e,T,p)&&cx(o,T,p))return T}g=d.pop(),g&&(g=g.node)}return null}function JO(r,t){return r.dist-t.dist}function KO(r,t,e){if(lx(r,e)||lx(t,e))return 0;var o=op(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=op(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var c=op(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(c===0)return 0;var p=op(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return p===0?0:Math.min(o,a,c,p)}function lx(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function cx(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),c=Math.max(r[0],t[0]),p=Math.max(r[1],t[1]),d=e.search({minX:o,minY:a,maxX:c,maxY:p}),g=0;g<d.length;g++)if(QO(d[g].p,d[g].next.p,r,t))return!1;return!0}function rc(r,t,e){return $O(r[0],r[1],t[0],t[1],e[0],e[1])}function QO(r,t,e,o){return r!==o&&t!==e&&rc(r,t,e)>0!=rc(r,t,o)>0&&rc(e,o,r)>0!=rc(e,o,t)>0}function Tm(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function jO(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],c=0;c<r.length;c++){var p=r[c];p[0]<t[0]&&(t=p),p[0]>o[0]&&(o=p),p[1]<e[1]&&(e=p),p[1]>a[1]&&(a=p)}var d=[t,e,o,a],g=d.slice();for(c=0;c<r.length;c++)YO(r[c],d)||g.push(r[c]);return eD(g)}function fx(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function Am(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function Cm(r,t,e){var o=t[0],a=t[1],c=e[0]-o,p=e[1]-a;if(c!==0||p!==0){var d=((r[0]-o)*c+(r[1]-a)*p)/(c*c+p*p);d>1?(o=e[0],a=e[1]):d>0&&(o+=c*d,a+=p*d)}return c=r[0]-o,p=r[1]-a,c*c+p*p}function op(r,t,e,o,a,c,p,d){var g=e-r,y=o-t,_=p-a,w=d-c,x=r-a,T=t-c,C=g*g+y*y,I=g*_+y*w,M=_*_+w*w,E=g*x+y*T,L=_*x+w*T,A=C*M-I*I,z,G,Y,X,U=A,H=A;A===0?(G=0,U=1,X=L,H=M):(G=I*L-M*E,X=C*L-I*E,G<0?(G=0,X=L,H=M):G>U&&(G=U,X=L+I,H=M)),X<0?(X=0,-E<0?G=0:-E>C?G=U:(G=-E,U=C)):X>H&&(X=H,-E+I<0?G=0:-E+I>C?G=U:(G=-E+I,U=C)),z=G===0?0:G/U,Y=X===0?0:X/H;var Q=(1-z)*r+z*e,gt=(1-z)*t+z*o,$=(1-Y)*a+Y*p,Nt=(1-Y)*c+Y*d,j=$-Q,pt=Nt-gt;return j*j+pt*pt}function tD(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function eD(r){r.sort(tD);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&rc(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&rc(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var _x=ye((Rm,Lm)=>{(function(r,t){typeof Rm=="object"&&typeof Lm!="undefined"?Lm.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(Rm,function(){"use strict";function r(a,c,p,d,g){t(a,c,p||0,d||a.length-1,g||o)}function t(a,c,p,d,g){for(;d>p;){if(d-p>600){var y=d-p+1,_=c-p+1,w=Math.log(y),x=.5*Math.exp(2*w/3),T=.5*Math.sqrt(w*x*(y-x)/y)*(_-y/2<0?-1:1),C=Math.max(p,Math.floor(c-_*x/y+T)),I=Math.min(d,Math.floor(c+(y-_)*x/y+T));t(a,c,C,I,g)}var M=a[c],E=p,L=d;for(e(a,p,c),g(a[d],M)>0&&e(a,p,d);E<L;){for(e(a,E,L),E++,L--;g(a[E],M)<0;)E++;for(;g(a[L],M)>0;)L--}g(a[p],M)===0?e(a,p,L):(L++,e(a,L,d)),L<=c&&(p=L+1),c<=L&&(d=L-1)}}function e(a,c,p){var d=a[c];a[c]=a[p],a[p]=d}function o(a,c){return a<c?-1:a>c?1:0}return r})});var Fm=ye((rG,Dm)=>{"use strict";Dm.exports=uf;Dm.exports.default=uf;var dD=_x();function uf(r,t){if(!(this instanceof uf))return new uf(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}uf.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!up(r,t))return e;for(var a=[],c,p,d,g;t;){for(c=0,p=t.children.length;c<p;c++)d=t.children[c],g=t.leaf?o(d):d,up(r,g)&&(t.leaf?e.push(d):Om(r,g)?this._all(d,e):a.push(d));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!up(r,t))return!1;for(var o=[],a,c,p,d;t;){for(a=0,c=t.children.length;a<c;a++)if(p=t.children[a],d=t.leaf?e(p):p,up(r,d)){if(t.leaf||Om(r,d))return!0;o.push(p)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=sc([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],c=[],p,d,g,y;e||a.length;){if(e||(e=a.pop(),d=a[a.length-1],p=c.pop(),y=!0),e.leaf&&(g=gD(r,e.children,t),g!==-1))return e.children.splice(g,1),a.push(e),this._condense(a),this;!y&&!e.leaf&&Om(e,o)?(a.push(e),c.push(p),p=0,d=e,e=e.children[0]):d?(p++,e=d.children[p],y=!1):e=null}return this},toBBox:function(r){return r},compareMinX:xx,compareMinY:Ex,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,c=this._maxEntries,p;if(a<=c)return p=sc(r.slice(t,e+1)),oc(p,this.toBBox),p;o||(o=Math.ceil(Math.log(a)/Math.log(c)),c=Math.ceil(a/Math.pow(c,o-1))),p=sc([]),p.leaf=!1,p.height=o;var d=Math.ceil(a/c),g=d*Math.ceil(Math.sqrt(c)),y,_,w,x;for(wx(r,t,e,g,this.compareMinX),y=t;y<=e;y+=g)for(w=Math.min(y+g-1,e),wx(r,y,w,d,this.compareMinY),_=y;_<=w;_+=d)x=Math.min(_+d-1,w),p.children.push(this._build(r,_,x,o-1));return oc(p,this.toBBox),p},_chooseSubtree:function(r,t,e,o){for(var a,c,p,d,g,y,_,w;o.push(t),!(t.leaf||o.length-1===e);){for(_=w=1/0,a=0,c=t.children.length;a<c;a++)p=t.children[a],g=Nm(p),y=mD(r,p)-g,y<w?(w=y,_=g<_?g:_,d=p):y===w&&g<_&&(_=g,d=p);t=d||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),c=[],p=this._chooseSubtree(a,this.data,t,c);for(p.children.push(r),af(p,a);t>=0&&c[t].children.length>this._maxEntries;)this._split(c,t),t--;this._adjustParentBBoxes(a,c,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var c=this._chooseSplitIndex(e,a,o),p=sc(e.children.splice(c,e.children.length-c));p.height=e.height,p.leaf=e.leaf,oc(e,this.toBBox),oc(p,this.toBBox),t?r[t-1].children.push(p):this._splitRoot(e,p)},_splitRoot:function(r,t){this.data=sc([r,t]),this.data.height=r.height+1,this.data.leaf=!1,oc(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,c,p,d,g,y,_;for(g=y=1/0,o=t;o<=e-t;o++)a=sf(r,0,o,this.toBBox),c=sf(r,o,e,this.toBBox),p=yD(a,c),d=Nm(a)+Nm(c),p<g?(g=p,_=o,y=d<y?d:y):p===g&&d<y&&(y=d,_=o);return _},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:xx,a=r.leaf?this.compareMinY:Ex,c=this._allDistMargin(r,t,e,o),p=this._allDistMargin(r,t,e,a);c<p&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,c=sf(r,0,t,a),p=sf(r,e-t,e,a),d=ap(c)+ap(p),g,y;for(g=t;g<e-t;g++)y=r.children[g],af(c,r.leaf?a(y):y),d+=ap(c);for(g=e-t-1;g>=t;g--)y=r.children[g],af(p,r.leaf?a(y):y),d+=ap(p);return d},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)af(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():oc(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function gD(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function oc(r,t){sf(r,0,r.children.length,t,r)}function sf(r,t,e,o,a){a||(a=sc(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var c=t,p;c<e;c++)p=r.children[c],af(a,r.leaf?o(p):p);return a}function af(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function xx(r,t){return r.minX-t.minX}function Ex(r,t){return r.minY-t.minY}function Nm(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function ap(r){return r.maxX-r.minX+(r.maxY-r.minY)}function mD(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function yD(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),c=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,c-o)}function Om(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function up(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function sc(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function wx(r,t,e,o,a){for(var c=[t,e],p;c.length;)e=c.pop(),t=c.pop(),!(e-t<=o)&&(p=t+Math.ceil((e-t)/o/2)*o,dD(r,p,t,e,a),c.push(t,p,p,e))}});var Cx=ye((m5,Hm)=>{"use strict";Hm.exports=hp;Hm.exports.default=hp;function hp(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,c=bx(r,0,a,e,!0),p=[];if(!c||c.next===c.prev)return p;var d,g,y,_,w,x,T;if(o&&(c=AD(r,t,c,e)),r.length>80*e){d=y=r[0],g=_=r[1];for(var C=e;C<a;C+=e)w=r[C],x=r[C+1],w<d&&(d=w),x<g&&(g=x),w>y&&(y=w),x>_&&(_=x);T=Math.max(y-d,_-g),T=T!==0?32767/T:0}return ff(c,p,e,d,g,T,0),p}function bx(r,t,e,o,a){var c,p;if(a===Gm(r,t,e,o)>0)for(c=t;c<e;c+=o)p=Sx(c,r[c],r[c+1],p);else for(c=e-o;c>=t;c-=o)p=Sx(c,r[c],r[c+1],p);return p&&pp(p,p.next)&&(pf(p),p=p.next),p}function sl(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(pp(e,e.next)||Lr(e.prev,e,e.next)===0)){if(pf(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function ff(r,t,e,o,a,c,p){if(r){!p&&c&&LD(r,o,a,c);for(var d=r,g,y;r.prev!==r.next;){if(g=r.prev,y=r.next,c?SD(r,o,a,c):MD(r)){t.push(g.i/e|0),t.push(r.i/e|0),t.push(y.i/e|0),pf(r),r=y.next,d=y.next;continue}if(r=y,r===d){p?p===1?(r=bD(sl(r),t,e),ff(r,t,e,o,a,c,2)):p===2&&TD(r,t,e,o,a,c):ff(sl(r),t,e,o,a,c,1);break}}}}function MD(r){var t=r.prev,e=r,o=r.next;if(Lr(t,e,o)>=0)return!1;for(var a=t.x,c=e.x,p=o.x,d=t.y,g=e.y,y=o.y,_=a<c?a<p?a:p:c<p?c:p,w=d<g?d<y?d:y:g<y?g:y,x=a>c?a>p?a:p:c>p?c:p,T=d>g?d>y?d:y:g>y?g:y,C=o.next;C!==t;){if(C.x>=_&&C.x<=x&&C.y>=w&&C.y<=T&&lc(a,d,c,g,p,y,C.x,C.y)&&Lr(C.prev,C,C.next)>=0)return!1;C=C.next}return!0}function SD(r,t,e,o){var a=r.prev,c=r,p=r.next;if(Lr(a,c,p)>=0)return!1;for(var d=a.x,g=c.x,y=p.x,_=a.y,w=c.y,x=p.y,T=d<g?d<y?d:y:g<y?g:y,C=_<w?_<x?_:x:w<x?w:x,I=d>g?d>y?d:y:g>y?g:y,M=_>w?_>x?_:x:w>x?w:x,E=zm(T,C,t,e,o),L=zm(I,M,t,e,o),A=r.prevZ,z=r.nextZ;A&&A.z>=E&&z&&z.z<=L;){if(A.x>=T&&A.x<=I&&A.y>=C&&A.y<=M&&A!==a&&A!==p&&lc(d,_,g,w,y,x,A.x,A.y)&&Lr(A.prev,A,A.next)>=0||(A=A.prevZ,z.x>=T&&z.x<=I&&z.y>=C&&z.y<=M&&z!==a&&z!==p&&lc(d,_,g,w,y,x,z.x,z.y)&&Lr(z.prev,z,z.next)>=0))return!1;z=z.nextZ}for(;A&&A.z>=E;){if(A.x>=T&&A.x<=I&&A.y>=C&&A.y<=M&&A!==a&&A!==p&&lc(d,_,g,w,y,x,A.x,A.y)&&Lr(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;z&&z.z<=L;){if(z.x>=T&&z.x<=I&&z.y>=C&&z.y<=M&&z!==a&&z!==p&&lc(d,_,g,w,y,x,z.x,z.y)&&Lr(z.prev,z,z.next)>=0)return!1;z=z.nextZ}return!0}function bD(r,t,e){var o=r;do{var a=o.prev,c=o.next.next;!pp(a,c)&&Tx(a,o,o.next,c)&&hf(a,c)&&hf(c,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(c.i/e|0),pf(o),pf(o.next),o=r=c),o=o.next}while(o!==r);return sl(o)}function TD(r,t,e,o,a,c){var p=r;do{for(var d=p.next.next;d!==p.prev;){if(p.i!==d.i&&DD(p,d)){var g=Ax(p,d);p=sl(p,p.next),g=sl(g,g.next),ff(p,t,e,o,a,c,0),ff(g,t,e,o,a,c,0);return}d=d.next}p=p.next}while(p!==r)}function AD(r,t,e,o){var a=[],c,p,d,g,y;for(c=0,p=t.length;c<p;c++)d=t[c]*o,g=c<p-1?t[c+1]*o:r.length,y=bx(r,d,g,o,!1),y===y.next&&(y.steiner=!0),a.push(OD(y));for(a.sort(CD),c=0;c<a.length;c++)e=PD(a[c],e);return e}function CD(r,t){return r.x-t.x}function PD(r,t){var e=ID(r,t);if(!e)return t;var o=Ax(e,r);return sl(o,o.next),sl(e,e.next)}function ID(r,t){var e=t,o=r.x,a=r.y,c=-1/0,p;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var d=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=o&&d>c&&(c=d,p=e.x<e.next.x?e:e.next,d===o))return p}e=e.next}while(e!==t);if(!p)return null;var g=p,y=p.x,_=p.y,w=1/0,x;e=p;do o>=e.x&&e.x>=y&&o!==e.x&&lc(a<_?o:c,a,y,_,a<_?c:o,a,e.x,e.y)&&(x=Math.abs(a-e.y)/(o-e.x),hf(e,r)&&(x<w||x===w&&(e.x>p.x||e.x===p.x&&RD(p,e)))&&(p=e,w=x)),e=e.next;while(e!==g);return p}function RD(r,t){return Lr(r.prev,r,t.prev)<0&&Lr(t.next,r,r.next)<0}function LD(r,t,e,o){var a=r;do a.z===0&&(a.z=zm(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,ND(a)}function ND(r){var t,e,o,a,c,p,d,g,y=1;do{for(e=r,r=null,c=null,p=0;e;){for(p++,o=e,d=0,t=0;t<y&&(d++,o=o.nextZ,!!o);t++);for(g=y;d>0||g>0&&o;)d!==0&&(g===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,d--):(a=o,o=o.nextZ,g--),c?c.nextZ=a:r=a,a.prevZ=c,c=a;e=o}c.nextZ=null,y*=2}while(p>1);return r}function zm(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function OD(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function lc(r,t,e,o,a,c,p,d){return(a-p)*(t-d)>=(r-p)*(c-d)&&(r-p)*(o-d)>=(e-p)*(t-d)&&(e-p)*(c-d)>=(a-p)*(o-d)}function DD(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!FD(r,t)&&(hf(r,t)&&hf(t,r)&&UD(r,t)&&(Lr(r.prev,r,t.prev)||Lr(r,t.prev,t))||pp(r,t)&&Lr(r.prev,r,r.next)>0&&Lr(t.prev,t,t.next)>0)}function Lr(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function pp(r,t){return r.x===t.x&&r.y===t.y}function Tx(r,t,e,o){var a=fp(Lr(r,t,e)),c=fp(Lr(r,t,o)),p=fp(Lr(e,o,r)),d=fp(Lr(e,o,t));return!!(a!==c&&p!==d||a===0&&cp(r,e,t)||c===0&&cp(r,o,t)||p===0&&cp(e,r,o)||d===0&&cp(e,t,o))}function cp(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function fp(r){return r>0?1:r<0?-1:0}function FD(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Tx(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function hf(r,t){return Lr(r.prev,r,r.next)<0?Lr(r,t,r.next)>=0&&Lr(r,r.prev,t)>=0:Lr(r,t,r.prev)<0||Lr(r,r.next,t)<0}function UD(r,t){var e=r,o=!1,a=(r.x+t.x)/2,c=(r.y+t.y)/2;do e.y>c!=e.next.y>c&&e.next.y!==e.y&&a<(e.next.x-e.x)*(c-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function Ax(r,t){var e=new km(r.i,r.x,r.y),o=new km(t.i,t.x,t.y),a=r.next,c=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,c.next=o,o.prev=c,o}function Sx(r,t,e,o){var a=new km(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function pf(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function km(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}hp.deviation=function(r,t,e,o){var a=t&&t.length,c=a?t[0]*e:r.length,p=Math.abs(Gm(r,0,c,e));if(a)for(var d=0,g=t.length;d<g;d++){var y=t[d]*e,_=d<g-1?t[d+1]*e:r.length;p-=Math.abs(Gm(r,y,_,e))}var w=0;for(d=0;d<o.length;d+=3){var x=o[d]*e,T=o[d+1]*e,C=o[d+2]*e;w+=Math.abs((r[x]-r[C])*(r[T+1]-r[x+1])-(r[x]-r[T])*(r[C+1]-r[x+1]))}return p===0&&w===0?0:Math.abs((w-p)/p)};function Gm(r,t,e,o){for(var a=0,c=t,p=e-o;c<e;c+=o)a+=(r[p]-r[c])*(r[c+1]+r[p+1]),p=c;return a}hp.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var c=0;c<r[a].length;c++)for(var p=0;p<t;p++)e.vertices.push(r[a][c][p]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var Ym=ye(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.earthRadius=63710088e-1;Ie.factors={centimeters:Ie.earthRadius*100,centimetres:Ie.earthRadius*100,degrees:Ie.earthRadius/111325,feet:Ie.earthRadius*3.28084,inches:Ie.earthRadius*39.37,kilometers:Ie.earthRadius/1e3,kilometres:Ie.earthRadius/1e3,meters:Ie.earthRadius,metres:Ie.earthRadius,miles:Ie.earthRadius/1609.344,millimeters:Ie.earthRadius*1e3,millimetres:Ie.earthRadius*1e3,nauticalmiles:Ie.earthRadius/1852,radians:1,yards:Ie.earthRadius*1.0936};Ie.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Ie.earthRadius,yards:1.0936133};Ie.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Au(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}Ie.feature=Au;function zD(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Vm(t).geometry;case"LineString":return qm(t).geometry;case"Polygon":return Wm(t).geometry;case"MultiPoint":return Ix(t).geometry;case"MultiLineString":return Px(t).geometry;case"MultiPolygon":return Rx(t).geometry;default:throw new Error(r+" is invalid")}}Ie.geometry=zD;function Vm(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!dp(r[0])||!dp(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Au(o,t,e)}Ie.point=Vm;function kD(r,t,e){return e===void 0&&(e={}),gp(r.map(function(o){return Vm(o,t)}),e)}Ie.points=kD;function Wm(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var c=a[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<c[c.length-1].length;p++)if(c[c.length-1][p]!==c[0][p])throw new Error("First and last Position are not equivalent.")}var d={type:"Polygon",coordinates:r};return Au(d,t,e)}Ie.polygon=Wm;function GD(r,t,e){return e===void 0&&(e={}),gp(r.map(function(o){return Wm(o,t)}),e)}Ie.polygons=GD;function qm(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return Au(o,t,e)}Ie.lineString=qm;function HD(r,t,e){return e===void 0&&(e={}),gp(r.map(function(o){return qm(o,t)}),e)}Ie.lineStrings=HD;function gp(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}Ie.featureCollection=gp;function Px(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Au(o,t,e)}Ie.multiLineString=Px;function Ix(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Au(o,t,e)}Ie.multiPoint=Ix;function Rx(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Au(o,t,e)}Ie.multiPolygon=Rx;function VD(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Au(o,t,e)}Ie.geometryCollection=VD;function WD(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}Ie.round=WD;function Lx(r,t){t===void 0&&(t="kilometers");var e=Ie.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}Ie.radiansToLength=Lx;function Xm(r,t){t===void 0&&(t="kilometers");var e=Ie.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}Ie.lengthToRadians=Xm;function qD(r,t){return Nx(Xm(r,t))}Ie.lengthToDegrees=qD;function XD(r){var t=r%360;return t<0&&(t+=360),t}Ie.bearingToAzimuth=XD;function Nx(r){var t=r%(2*Math.PI);return t*180/Math.PI}Ie.radiansToDegrees=Nx;function YD(r){var t=r%360;return t*Math.PI/180}Ie.degreesToRadians=YD;function $D(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return Lx(Xm(r,t),e)}Ie.convertLength=$D;function ZD(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=Ie.areaFactors[t];if(!o)throw new Error("invalid original units");var a=Ie.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}Ie.convertArea=ZD;function dp(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}Ie.isNumber=dp;function JD(r){return!!r&&r.constructor===Object}Ie.isObject=JD;function KD(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!dp(t))throw new Error("bbox must only contain numbers")})}Ie.validateBBox=KD;function QD(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}Ie.validateId=QD});var Zm=ye(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});var ji=Ym();function df(r,t,e){if(r!==null)for(var o,a,c,p,d,g,y,_=0,w=0,x,T=r.type,C=T==="FeatureCollection",I=T==="Feature",M=C?r.features.length:1,E=0;E<M;E++){y=C?r.features[E].geometry:I?r.geometry:r,x=y?y.type==="GeometryCollection":!1,d=x?y.geometries.length:1;for(var L=0;L<d;L++){var A=0,z=0;if(p=x?y.geometries[L]:y,p!==null){g=p.coordinates;var G=p.type;switch(_=e&&(G==="Polygon"||G==="MultiPolygon")?1:0,G){case null:break;case"Point":if(t(g,w,E,A,z)===!1)return!1;w++,A++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],w,E,A,z)===!1)return!1;w++,G==="MultiPoint"&&A++}G==="LineString"&&A++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(a=0;a<g[o].length-_;a++){if(t(g[o][a],w,E,A,z)===!1)return!1;w++}G==="MultiLineString"&&A++,G==="Polygon"&&z++}G==="Polygon"&&A++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(z=0,a=0;a<g[o].length;a++){for(c=0;c<g[o][a].length-_;c++){if(t(g[o][a][c],w,E,A,z)===!1)return!1;w++}z++}A++}break;case"GeometryCollection":for(o=0;o<p.geometries.length;o++)if(df(p.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function jD(r,t,e,o){var a=e;return df(r,function(c,p,d,g,y){p===0&&e===void 0?a=c:a=t(a,c,p,d,g,y)},o),a}function Ox(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function t3(r,t,e){var o=e;return Ox(r,function(a,c){c===0&&e===void 0?o=a:o=t(o,a,c)}),o}function Dx(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function e3(r,t,e){var o=e;return Dx(r,function(a,c){c===0&&e===void 0?o=a:o=t(o,a,c)}),o}function n3(r){var t=[];return df(r,function(e){t.push(e)}),t}function $m(r,t){var e,o,a,c,p,d,g,y,_,w,x=0,T=r.type==="FeatureCollection",C=r.type==="Feature",I=T?r.features.length:1;for(e=0;e<I;e++){for(d=T?r.features[e].geometry:C?r.geometry:r,y=T?r.features[e].properties:C?r.properties:{},_=T?r.features[e].bbox:C?r.bbox:void 0,w=T?r.features[e].id:C?r.id:void 0,g=d?d.type==="GeometryCollection":!1,p=g?d.geometries.length:1,a=0;a<p;a++){if(c=g?d.geometries[a]:d,c===null){if(t(null,x,y,_,w)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,y,_,w)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,y,_,w)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function r3(r,t,e){var o=e;return $m(r,function(a,c,p,d,g){c===0&&e===void 0?o=a:o=t(o,a,c,p,d,g)}),o}function mp(r,t){$m(r,function(e,o,a,c,p){var d=e===null?null:e.type;switch(d){case null:case"Point":case"LineString":case"Polygon":return t(ji.feature(e,a,{bbox:c,id:p}),o,0)===!1?!1:void 0}var g;switch(d){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var y=0;y<e.coordinates.length;y++){var _=e.coordinates[y],w={type:g,coordinates:_};if(t(ji.feature(w,a),o,y)===!1)return!1}})}function i3(r,t,e){var o=e;return mp(r,function(a,c,p){c===0&&p===0&&e===void 0?o=a:o=t(o,a,c,p)}),o}function Fx(r,t){mp(r,function(e,o,a){var c=0;if(e.geometry){var p=e.geometry.type;if(!(p==="Point"||p==="MultiPoint")){var d,g=0,y=0,_=0;if(df(e,function(w,x,T,C,I){if(d===void 0||o>g||C>y||I>_){d=w,g=o,y=C,_=I,c=0;return}var M=ji.lineString([d,w],e.properties);if(t(M,o,a,I,c)===!1)return!1;c++,d=w})===!1)return!1}}})}function o3(r,t,e){var o=e,a=!1;return Fx(r,function(c,p,d,g,y){a===!1&&e===void 0?o=c:o=t(o,c,p,d,g,y),a=!0}),o}function Ux(r,t){if(!r)throw new Error("geojson is required");mp(r,function(e,o,a){if(e.geometry!==null){var c=e.geometry.type,p=e.geometry.coordinates;switch(c){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var d=0;d<p.length;d++)if(t(ji.lineString(p[d],e.properties),o,a,d)===!1)return!1;break}}})}function s3(r,t,e){var o=e;return Ux(r,function(a,c,p,d){c===0&&e===void 0?o=a:o=t(o,a,c,p,d)}),o}function a3(r,t){if(t=t||{},!ji.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,c=t.segmentIndex||0,p=t.properties,d;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),p=p||r.features[e].properties,d=r.features[e].geometry;break;case"Feature":p=p||r.properties,d=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":d=r;break;default:throw new Error("geojson is invalid")}if(d===null)return null;var g=d.coordinates;switch(d.type){case"Point":case"MultiPoint":return null;case"LineString":return c<0&&(c=g.length+c-1),ji.lineString([g[c],g[c+1]],p,t);case"Polygon":return a<0&&(a=g.length+a),c<0&&(c=g[a].length+c-1),ji.lineString([g[a][c],g[a][c+1]],p,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c-1),ji.lineString([g[o][c],g[o][c+1]],p,t);case"MultiPolygon":return o<0&&(o=g.length+o),a<0&&(a=g[o].length+a),c<0&&(c=g[o][a].length-c-1),ji.lineString([g[o][a][c],g[o][a][c+1]],p,t)}throw new Error("geojson is invalid")}function u3(r,t){if(t=t||{},!ji.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,c=t.coordIndex||0,p=t.properties,d;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),p=p||r.features[e].properties,d=r.features[e].geometry;break;case"Feature":p=p||r.properties,d=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":d=r;break;default:throw new Error("geojson is invalid")}if(d===null)return null;var g=d.coordinates;switch(d.type){case"Point":return ji.point(g,p,t);case"MultiPoint":return o<0&&(o=g.length+o),ji.point(g[o],p,t);case"LineString":return c<0&&(c=g.length+c),ji.point(g[c],p,t);case"Polygon":return a<0&&(a=g.length+a),c<0&&(c=g[a].length+c),ji.point(g[a][c],p,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c),ji.point(g[o][c],p,t);case"MultiPolygon":return o<0&&(o=g.length+o),a<0&&(a=g[o].length+a),c<0&&(c=g[o][a].length-c),ji.point(g[o][a][c],p,t)}throw new Error("geojson is invalid")}li.coordAll=n3;li.coordEach=df;li.coordReduce=jD;li.featureEach=Dx;li.featureReduce=e3;li.findPoint=u3;li.findSegment=a3;li.flattenEach=mp;li.flattenReduce=i3;li.geomEach=$m;li.geomReduce=r3;li.lineEach=Ux;li.lineReduce=s3;li.propEach=Ox;li.propReduce=t3;li.segmentEach=Fx;li.segmentReduce=o3});var Bx=ye(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});var l3=Zm();function Jm(r){var t=[1/0,1/0,-1/0,-1/0];return l3.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Jm.default=Jm;Km.default=Jm});var yp=ye((L5,Qm)=>{var ha=Mm(),kx=Ym(),Gx=Zm(),cc=Bx().default,c3=Gx.featureEach,I5=Gx.coordEach,R5=kx.polygon,zx=kx.featureCollection;function Hx(r){var t=new ha(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:cc(e),ha.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:cc(a),o.push(a)}):c3(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:cc(a),o.push(a)}),ha.prototype.load.call(this,o)},t.remove=function(e,o){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:cc(e),ha.prototype.remove.call(this,e,o)},t.clear=function(){return ha.prototype.clear.call(this)},t.search=function(e){var o=ha.prototype.search.call(this,this.toBBox(e));return zx(o)},t.collides=function(e){return ha.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=ha.prototype.all.call(this);return zx(e)},t.toJSON=function(){return ha.prototype.toJSON.call(this)},t.fromJSON=function(e){return ha.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var o;if(e.bbox)o=e.bbox;else if(Array.isArray(e)&&e.length===4)o=e;else if(Array.isArray(e)&&e.length===6)o=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")o=cc(e);else if(e.type==="FeatureCollection")o=cc(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Qm.exports=Hx;Qm.exports.default=Hx});var i0=ye((GV,Qx)=>{"use strict";var Kx=Object.prototype.toString;Qx.exports=function(t){var e=Kx.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Kx.call(t.callee)==="[object Function]"),o}});var aE=ye((HV,sE)=>{"use strict";var oE;Object.keys||(yf=Object.prototype.hasOwnProperty,o0=Object.prototype.toString,jx=i0(),s0=Object.prototype.propertyIsEnumerable,tE=!s0.call({toString:null},"toString"),eE=s0.call(function(){},"prototype"),vf=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],wp=function(r){var t=r.constructor;return t&&t.prototype===r},nE={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},rE=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!nE["$"+r]&&yf.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{wp(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),iE=function(r){if(typeof window=="undefined"||!rE)return wp(r);try{return wp(r)}catch(t){return!1}},oE=function(t){var e=t!==null&&typeof t=="object",o=o0.call(t)==="[object Function]",a=jx(t),c=e&&o0.call(t)==="[object String]",p=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var d=eE&&o;if(c&&t.length>0&&!yf.call(t,0))for(var g=0;g<t.length;++g)p.push(String(g));if(a&&t.length>0)for(var y=0;y<t.length;++y)p.push(String(y));else for(var _ in t)!(d&&_==="prototype")&&yf.call(t,_)&&p.push(String(_));if(tE)for(var w=iE(t),x=0;x<vf.length;++x)!(w&&vf[x]==="constructor")&&yf.call(t,vf[x])&&p.push(vf[x]);return p});var yf,o0,jx,s0,tE,eE,vf,wp,nE,rE,iE;sE.exports=oE});var a0=ye((VV,cE)=>{"use strict";var x3=Array.prototype.slice,E3=i0(),uE=Object.keys,Mp=uE?function(t){return uE(t)}:aE(),lE=Object.keys;Mp.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(o){return E3(o)?lE(x3.call(o)):lE(o)})}else Object.keys=Mp;return Object.keys||Mp};cE.exports=Mp});var u0=ye((WV,fE)=>{"use strict";fE.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var c=Object.getOwnPropertySymbols(t);if(c.length!==1||c[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var p=Object.getOwnPropertyDescriptor(t,e);if(p.value!==a||p.enumerable!==!0)return!1}return!0}});var Sp=ye((qV,hE)=>{"use strict";var w3=u0();hE.exports=function(){return w3()&&!!Symbol.toStringTag}});var gE=ye((XV,dE)=>{"use strict";var pE=typeof Symbol!="undefined"&&Symbol,M3=u0();dE.exports=function(){return typeof pE!="function"||typeof Symbol!="function"||typeof pE("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:M3()}});var vE=ye((YV,yE)=>{"use strict";var mE={foo:{}},S3=Object;yE.exports=function(){return{__proto__:mE}.foo===mE.foo&&!({__proto__:null}instanceof S3)}});var EE=ye(($V,xE)=>{"use strict";var b3="Function.prototype.bind called on incompatible ",T3=Object.prototype.toString,A3=Math.max,C3="[object Function]",_E=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var c=0;c<e.length;c+=1)o[c+t.length]=e[c];return o},P3=function(t,e){for(var o=[],a=e||0,c=0;a<t.length;a+=1,c+=1)o[c]=t[a];return o},I3=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};xE.exports=function(t){var e=this;if(typeof e!="function"||T3.apply(e)!==C3)throw new TypeError(b3+e);for(var o=P3(arguments,1),a,c=function(){if(this instanceof a){var _=e.apply(this,_E(o,arguments));return Object(_)===_?_:this}return e.apply(t,_E(o,arguments))},p=A3(0,e.length-o.length),d=[],g=0;g<p;g++)d[g]="$"+g;if(a=Function("binder","return function ("+I3(d,",")+"){ return binder.apply(this,arguments); }")(c),e.prototype){var y=function(){};y.prototype=e.prototype,a.prototype=new y,y.prototype=null}return a}});var bp=ye((ZV,wE)=>{"use strict";var R3=EE();wE.exports=Function.prototype.bind||R3});var SE=ye((JV,ME)=>{"use strict";var L3=Function.prototype.call,N3=Object.prototype.hasOwnProperty,O3=bp();ME.exports=O3.call(L3,N3)});var ll=ye((KV,PE)=>{"use strict";var Bn,dc=SyntaxError,CE=Function,pc=TypeError,l0=function(r){try{return CE('"use strict"; return ('+r+").constructor;")()}catch(t){}},al=Object.getOwnPropertyDescriptor;if(al)try{al({},"")}catch(r){al=null}var c0=function(){throw new pc},D3=al?function(){try{return arguments.callee,c0}catch(r){try{return al(arguments,"callee").get}catch(t){return c0}}}():c0,fc=gE()(),F3=vE()(),Ti=Object.getPrototypeOf||(F3?function(r){return r.__proto__}:null),hc={},U3=typeof Uint8Array=="undefined"||!Ti?Bn:Ti(Uint8Array),ul={"%AggregateError%":typeof AggregateError=="undefined"?Bn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Bn:ArrayBuffer,"%ArrayIteratorPrototype%":fc&&Ti?Ti([][Symbol.iterator]()):Bn,"%AsyncFromSyncIteratorPrototype%":Bn,"%AsyncFunction%":hc,"%AsyncGenerator%":hc,"%AsyncGeneratorFunction%":hc,"%AsyncIteratorPrototype%":hc,"%Atomics%":typeof Atomics=="undefined"?Bn:Atomics,"%BigInt%":typeof BigInt=="undefined"?Bn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Bn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Bn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Bn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?Bn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Bn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Bn:FinalizationRegistry,"%Function%":CE,"%GeneratorFunction%":hc,"%Int8Array%":typeof Int8Array=="undefined"?Bn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Bn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Bn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":fc&&Ti?Ti(Ti([][Symbol.iterator]())):Bn,"%JSON%":typeof JSON=="object"?JSON:Bn,"%Map%":typeof Map=="undefined"?Bn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!fc||!Ti?Bn:Ti(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Bn:Promise,"%Proxy%":typeof Proxy=="undefined"?Bn:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?Bn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Bn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!fc||!Ti?Bn:Ti(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Bn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":fc&&Ti?Ti(""[Symbol.iterator]()):Bn,"%Symbol%":fc?Symbol:Bn,"%SyntaxError%":dc,"%ThrowTypeError%":D3,"%TypedArray%":U3,"%TypeError%":pc,"%Uint8Array%":typeof Uint8Array=="undefined"?Bn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Bn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Bn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Bn:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?Bn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Bn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Bn:WeakSet};if(Ti)try{null.error}catch(r){bE=Ti(Ti(r)),ul["%Error.prototype%"]=bE}var bE,B3=function r(t){var e;if(t==="%AsyncFunction%")e=l0("async function () {}");else if(t==="%GeneratorFunction%")e=l0("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=l0("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&Ti&&(e=Ti(a.prototype))}return ul[t]=e,e},TE={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},_f=bp(),Tp=SE(),z3=_f.call(Function.call,Array.prototype.concat),k3=_f.call(Function.apply,Array.prototype.splice),AE=_f.call(Function.call,String.prototype.replace),Ap=_f.call(Function.call,String.prototype.slice),G3=_f.call(Function.call,RegExp.prototype.exec),H3=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,V3=/\\\\(\\\\)?/g,W3=function(t){var e=Ap(t,0,1),o=Ap(t,-1);if(e==="%"&&o!=="%")throw new dc("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new dc("invalid intrinsic syntax, expected opening \`%\`");var a=[];return AE(t,H3,function(c,p,d,g){a[a.length]=d?AE(g,V3,"$1"):p||c}),a},q3=function(t,e){var o=t,a;if(Tp(TE,o)&&(a=TE[o],o="%"+a[0]+"%"),Tp(ul,o)){var c=ul[o];if(c===hc&&(c=B3(o)),typeof c=="undefined"&&!e)throw new pc("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:c}}throw new dc("intrinsic "+t+" does not exist!")};PE.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new pc("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new pc('"allowMissing" argument must be a boolean');if(G3(/^%?[^%]*%?$/,t)===null)throw new dc("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=W3(t),a=o.length>0?o[0]:"",c=q3("%"+a+"%",e),p=c.name,d=c.value,g=!1,y=c.alias;y&&(a=y[0],k3(o,z3([0,1],y)));for(var _=1,w=!0;_<o.length;_+=1){var x=o[_],T=Ap(x,0,1),C=Ap(x,-1);if((T==='"'||T==="'"||T==="\`"||C==='"'||C==="'"||C==="\`")&&T!==C)throw new dc("property names with quotes must have matching quotes");if((x==="constructor"||!w)&&(g=!0),a+="."+x,p="%"+a+"%",Tp(ul,p))d=ul[p];else if(d!=null){if(!(x in d)){if(!e)throw new pc("base intrinsic for "+t+" exists, but the property is not available.");return}if(al&&_+1>=o.length){var I=al(d,x);w=!!I,w&&"get"in I&&!("originalValue"in I.get)?d=I.get:d=d[x]}else w=Tp(d,x),d=d[x];w&&!g&&(ul[p]=d)}}return d}});var xf=ye((QV,IE)=>{"use strict";var X3=ll(),f0=X3("%Object.defineProperty%",!0),h0=function(){if(f0)try{return f0({},"a",{value:1}),!0}catch(t){return!1}return!1};h0.hasArrayLengthDefineBug=function(){if(!h0())return null;try{return f0([],"length",{value:1}).length!==1}catch(t){return!0}};IE.exports=h0});var p0=ye((jV,RE)=>{"use strict";var Y3=ll(),Cp=Y3("%Object.getOwnPropertyDescriptor%",!0);if(Cp)try{Cp([],"length")}catch(r){Cp=null}RE.exports=Cp});var Pp=ye((t6,NE)=>{"use strict";var $3=xf()(),d0=ll(),Ef=$3&&d0("%Object.defineProperty%",!0);if(Ef)try{Ef({},"a",{value:1})}catch(r){Ef=!1}var Z3=d0("%SyntaxError%"),gc=d0("%TypeError%"),LE=p0();NE.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new gc("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new gc("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new gc("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new gc("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new gc("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new gc("\`loose\`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,g=!!LE&&LE(t,e);if(Ef)Ef(t,e,{configurable:p===null&&g?g.configurable:!p,enumerable:a===null&&g?g.enumerable:!a,value:o,writable:c===null&&g?g.writable:!c});else if(d||!a&&!c&&!p)t[e]=o;else throw new Z3("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var zE=ye((e6,BE)=>{"use strict";var UE=ll(),OE=Pp(),J3=xf()(),DE=p0(),FE=UE("%TypeError%"),K3=UE("%Math.floor%");BE.exports=function(t,e){if(typeof t!="function")throw new FE("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||K3(e)!==e)throw new FE("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,c=!0;if("length"in t&&DE){var p=DE(t,"length");p&&!p.configurable&&(a=!1),p&&!p.writable&&(c=!1)}return(a||c||!o)&&(J3?OE(t,"length",e,!0,!0):OE(t,"length",e)),t}});var Rp=ye((n6,Ip)=>{"use strict";var g0=bp(),mc=ll(),Q3=zE(),j3=mc("%TypeError%"),GE=mc("%Function.prototype.apply%"),HE=mc("%Function.prototype.call%"),VE=mc("%Reflect.apply%",!0)||g0.call(HE,GE),wf=mc("%Object.defineProperty%",!0),tF=mc("%Math.max%");if(wf)try{wf({},"a",{value:1})}catch(r){wf=null}Ip.exports=function(t){if(typeof t!="function")throw new j3("a function is required");var e=VE(g0,HE,arguments);return Q3(e,1+tF(0,t.length-(arguments.length-1)),!0)};var kE=function(){return VE(g0,GE,arguments)};wf?wf(Ip.exports,"apply",{value:kE}):Ip.exports.apply=kE});var m0=ye((r6,XE)=>{"use strict";var WE=ll(),qE=Rp(),eF=qE(WE("String.prototype.indexOf"));XE.exports=function(t,e){var o=WE(t,!!e);return typeof o=="function"&&eF(t,".prototype.")>-1?qE(o):o}});var ZE=ye((i6,$E)=>{"use strict";var nF=Sp()(),rF=m0(),y0=rF("Object.prototype.toString"),Lp=function(t){return nF&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:y0(t)==="[object Arguments]"},YE=function(t){return Lp(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&y0(t)!=="[object Array]"&&y0(t.callee)==="[object Function]"},iF=function(){return Lp(arguments)}();Lp.isLegacyArguments=YE;$E.exports=iF?Lp:YE});var yc=ye((o6,jE)=>{"use strict";var oF=a0(),sF=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",aF=Object.prototype.toString,uF=Array.prototype.concat,JE=Pp(),lF=function(r){return typeof r=="function"&&aF.call(r)==="[object Function]"},KE=xf()(),cF=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!lF(o)||!o())return}KE?JE(r,t,e,!0):JE(r,t,e)},QE=function(r,t){var e=arguments.length>2?arguments[2]:{},o=oF(t);sF&&(o=uF.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)cF(r,o[a],t[o[a]],e[o[a]])};QE.supportsDescriptors=!!KE;jE.exports=QE});var v0=ye((s6,ew)=>{"use strict";var tw=function(r){return r!==r};ew.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||tw(t)&&tw(e))}});var _0=ye((a6,nw)=>{"use strict";var fF=v0();nw.exports=function(){return typeof Object.is=="function"?Object.is:fF}});var iw=ye((u6,rw)=>{"use strict";var hF=_0(),pF=yc();rw.exports=function(){var t=hF();return pF(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var uw=ye((l6,aw)=>{"use strict";var dF=yc(),gF=Rp(),mF=v0(),ow=_0(),yF=iw(),sw=gF(ow(),Object);dF(sw,{getPolyfill:ow,implementation:mF,shim:yF});aw.exports=sw});var pw=ye((c6,hw)=>{"use strict";var x0=m0(),lw=Sp()(),cw,fw,E0,w0;lw&&(cw=x0("Object.prototype.hasOwnProperty"),fw=x0("RegExp.prototype.exec"),E0={},Np=function(){throw E0},w0={toString:Np,valueOf:Np},typeof Symbol.toPrimitive=="symbol"&&(w0[Symbol.toPrimitive]=Np));var Np,vF=x0("Object.prototype.toString"),_F=Object.getOwnPropertyDescriptor,xF="[object RegExp]";hw.exports=lw?function(t){if(!t||typeof t!="object")return!1;var e=_F(t,"lastIndex"),o=e&&cw(e,"value");if(!o)return!1;try{fw(t,w0)}catch(a){return a===E0}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:vF(t)===xF}});var gw=ye((f6,dw)=>{"use strict";var Sf=function(){return typeof function(){}.name=="string"},Mf=Object.getOwnPropertyDescriptor;if(Mf)try{Mf([],"length")}catch(r){Mf=null}Sf.functionsHaveConfigurableNames=function(){if(!Sf()||!Mf)return!1;var t=Mf(function(){},"name");return!!t&&!!t.configurable};var EF=Function.prototype.bind;Sf.boundFunctionsHaveNames=function(){return Sf()&&typeof EF=="function"&&function(){}.bind().name!==""};dw.exports=Sf});var vw=ye((h6,yw)=>{"use strict";var mw=Pp(),wF=xf()(),MF=gw().functionsHaveConfigurableNames(),SF=TypeError;yw.exports=function(t,e){if(typeof t!="function")throw new SF("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||MF)&&(wF?mw(t,"name",e,!0,!0):mw(t,"name",e)),t}});var M0=ye((p6,_w)=>{"use strict";var bF=vw(),TF=Object,AF=TypeError;_w.exports=bF(function(){if(this!=null&&this!==TF(this))throw new AF("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var S0=ye((d6,xw)=>{"use strict";var CF=M0(),PF=yc().supportsDescriptors,IF=Object.getOwnPropertyDescriptor;xw.exports=function(){if(PF&&/a/mig.flags==="gim"){var t=IF(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return CF}});var Mw=ye((g6,ww)=>{"use strict";var RF=yc().supportsDescriptors,LF=S0(),NF=Object.getOwnPropertyDescriptor,OF=Object.defineProperty,DF=TypeError,Ew=Object.getPrototypeOf,FF=/a/;ww.exports=function(){if(!RF||!Ew)throw new DF("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=LF(),e=Ew(FF),o=NF(e,"flags");return(!o||o.get!==t)&&OF(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Aw=ye((m6,Tw)=>{"use strict";var UF=yc(),BF=Rp(),zF=M0(),Sw=S0(),kF=Mw(),bw=BF(Sw());UF(bw,{getPolyfill:Sw,implementation:zF,shim:kF});Tw.exports=bw});var Pw=ye((y6,Cw)=>{"use strict";var GF=Date.prototype.getDay,HF=function(t){try{return GF.call(t),!0}catch(e){return!1}},VF=Object.prototype.toString,WF="[object Date]",qF=Sp()();Cw.exports=function(t){return typeof t!="object"||t===null?!1:qF?HF(t):VF.call(t)===WF}});var b0=ye((v6,kw)=>{var Iw=a0(),Rw=ZE(),Lw=uw(),Nw=pw(),Ow=Aw(),Dw=Pw(),Fw=Date.prototype.getTime;function zw(r,t,e){var o=e||{};return(o.strict?Lw(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?Lw(r,t):r==t:XF(r,t,o)}function Uw(r){return r==null}function Bw(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function XF(r,t,e){var o,a;if(typeof r!=typeof t||Uw(r)||Uw(t)||r.prototype!==t.prototype||Rw(r)!==Rw(t))return!1;var c=Nw(r),p=Nw(t);if(c!==p)return!1;if(c||p)return r.source===t.source&&Ow(r)===Ow(t);if(Dw(r)&&Dw(t))return Fw.call(r)===Fw.call(t);var d=Bw(r),g=Bw(t);if(d!==g)return!1;if(d||g){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var y=Iw(r),_=Iw(t)}catch(w){return!1}if(y.length!==_.length)return!1;for(y.sort(),_.sort(),o=y.length-1;o>=0;o--)if(y[o]!=_[o])return!1;for(o=y.length-1;o>=0;o--)if(a=y[o],!zw(r[a],t[a],e))return!1;return!0}kw.exports=zw});var U0=ye((SW,Yw)=>{var FU=b0(),pa=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:UU};pa.prototype.compare=function(r,t){if(r.type!==t.type||!Xw(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=qw(r),a=qw(t);return o.every(function(c){return this.some(function(p){return e.compare(c,p)})},a)}}return!1};function qw(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function Xw(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}pa.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};pa.prototype.compareLine=function(r,t,e,o){if(!Xw(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),c=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],c[0])&&(c=this.fixStartIndex(c,a),!c))){var p=this.compareCoord(a[e],c[e]);return this.direction||p?this.comparePath(a,c):this.compareCoord(a[e],c[c.length-(1+e)])?this.comparePath(a.slice().reverse(),c):!1}};pa.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};pa.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};pa.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(c){return this.some(function(p){return a.compareLine(c,p,1,!0)})},o)}else return!1};pa.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};pa.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};pa.prototype.removePseudo=function(r){return r};function UU(r,t){return FU(r,t,{strict:!0})}Yw.exports=pa});var $w=ye((FW,Fp)=>{function Pu(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}Pu.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var c=this._regionQuery(a);if(c.length<this.minPts)this.noise.push(a);else{var p=this.clusters.length;this.clusters.push([]),this._addToCluster(a,p),this._expandCluster(p,c)}}return this.clusters};Pu.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Pu.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};Pu.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};Pu.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};Pu.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};Pu.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Fp!="undefined"&&Fp.exports&&(Fp.exports=Pu)});var Zw=ye((UW,Up)=>{function Iu(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}Iu.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};Iu.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var c=0;c<this.k;c++){for(var p=new Array(_),d=0,g=0;g<_;g++)p[g]=0;for(var y=0;y<e;y++){var _=this.dataset[y].length;if(c===this.assignments[y]){for(var g=0;g<_;g++)p[g]+=this.dataset[y][g];d++}}if(d>0){for(var g=0;g<_;g++)p[g]/=d;this.centroids[c]=p}else this.centroids[c]=this.randomCentroid(),a=!0}}return this.getClusters()};Iu.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};Iu.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};Iu.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};Iu.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,c=t.length,p,d=0;d<c;d++)p=e(r,t[d]),p<o&&(o=p,a=d);return a};Iu.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof Up!="undefined"&&Up.exports&&(Up.exports=Iu)});var B0=ye((BW,Bp)=>{function da(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}da.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};da.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};da.prototype.forEach=function(r){this._queue.forEach(r)};da.prototype.getElements=function(){return this._queue};da.prototype.getElementPriority=function(r){return this._priorities[r]};da.prototype.getPriorities=function(){return this._priorities};da.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};da.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};da.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof Bp!="undefined"&&Bp.exports&&(Bp.exports=da)});var Kw=ye((zW,_c)=>{typeof _c!="undefined"&&_c.exports&&(Jw=B0());var Jw;function Za(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}Za.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,c=this.dataset.length;a<c;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var p=this.clusters.length-1;this._orderedList.push(a);var d=new Jw(null,null,"asc"),g=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,g,d),this._expandCluster(p,d))}return this.clusters};Za.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};Za.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Za.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var c=o.distance(o.dataset[r],o.dataset[a]),p=Math.max(o._coreDistance,c);o._reachability[a]===void 0?(o._reachability[a]=p,e.insert(a,p)):p<o._reachability[a]&&(o._reachability[a]=p,e.remove(a),e.insert(a,p))}})};Za.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var c=e[o];if(this._processed[c]===void 0){var p=this._regionQuery(c);this._processed[c]=1,this.clusters[r].push(c),this._orderedList.push(c),this._distanceToCore(c)!==void 0&&(this._updateQueue(c,p,t),this._expandCluster(r,t))}}};Za.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};Za.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};Za.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof _c!="undefined"&&_c.exports&&(_c.exports=Za)});var Qw=ye((kW,zp)=>{typeof zp!="undefined"&&zp.exports&&(zp.exports={DBSCAN:$w(),KMEANS:Zw(),OPTICS:Kw(),PriorityQueue:B0()})});var z0=ye((XW,tM)=>{"use strict";tM.exports={eudist:function(t,e,o){for(var a=t.length,c=0,p=0;p<a;p++){var d=(t[p]||0)-(e[p]||0);c+=d*d}return o?Math.sqrt(c):c},mandist:function(t,e,o){for(var a=t.length,c=0,p=0;p<a;p++)c+=Math.abs((t[p]||0)-(e[p]||0));return o?Math.sqrt(c):c},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var rM=ye((YW,nM)=>{"use strict";var eM=z0(),VU=eM.eudist,WU=eM.dist;nM.exports={kmrand:function(t,e){for(var o={},a=[],c=e<<2,p=t.length,d=t[0].length>0;a.length<e&&c-- >0;){var g=t[Math.floor(Math.random()*p)],y=d?g.join("_"):""+g;o[y]||(o[y]=!0,a.push(g))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?VU:WU,a=[],c=t.length,p=t[0].length>0,d={},g=t[Math.floor(Math.random()*c)],y=p?g.join("_"):""+g;for(a.push(g),d[y]=!0;a.length<e;){for(var _=[],w=a.length,x=0,T=[],C=0;C<c;C++){for(var I=1/0,M=0;M<w;M++){var E=o(t[C],a[M]);E<=I&&(I=E)}_[C]=I}for(var L=0;L<c;L++)x+=_[L];for(var A=0;A<c;A++)T[A]={i:A,v:t[A],pr:_[A]/x,cs:0};T.sort(function(X,U){return X.pr-U.pr}),T[0].cs=T[0].pr;for(var z=1;z<c;z++)T[z].cs=T[z-1].cs+T[z].pr;for(var G=Math.random(),Y=0;Y<c-1&&T[Y++].cs<G;);a.push(T[Y-1].v)}return a}}});var uM=ye((JW,aM)=>{"use strict";var k0=z0(),sM=rM(),qU=k0.eudist,$W=k0.mandist,ZW=k0.dist,XU=sM.kmrand,YU=sM.kmpp,iM=1e4;function oM(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function $U(r,t,e,o){var a=[],c=[],p=[],d=[],g=!1,y=o||iM,_=r.length,w=r[0].length,x=w>0,T=[];if(e)e=="kmrand"?a=XU(r,t):e=="kmpp"?a=YU(r,t):a=e;else for(var C={};a.length<t;){var I=Math.floor(Math.random()*_);C[I]||(C[I]=!0,a.push(r[I]))}do{oM(t,0,T);for(var M=0;M<_;M++){for(var E=1/0,L=0,A=0;A<t;A++){var d=x?qU(r[M],a[A]):Math.abs(r[M]-a[A]);d<=E&&(E=d,L=A)}p[M]=L,T[L]++}for(var z=[],c=[],G=0,Y=0;Y<t;Y++)z[Y]=x?oM(w,0,z[Y]):0,c[Y]=a[Y];if(x){for(var X=0;X<t;X++)a[X]=[];for(var U=0;U<_;U++)for(var H=p[U],Q=z[H],gt=r[U],$=0;$<w;$++)Q[$]+=gt[$];g=!0;for(var Nt=0;Nt<t;Nt++){for(var j=a[Nt],pt=z[Nt],Ct=c[Nt],Tt=T[Nt],ft=0;ft<w;ft++)j[ft]=pt[ft]/Tt||0;if(g){for(var dt=0;dt<w;dt++)if(Ct[dt]!=j[dt]){g=!1;break}}}}else{for(var Z=0;Z<_;Z++){var st=p[Z];z[st]+=r[Z]}for(var vt=0;vt<t;vt++)a[vt]=z[vt]/T[vt]||0;g=!0;for(var zt=0;zt<t;zt++)if(c[zt]!=a[zt]){g=!1;break}}g=g||--y<=0}while(!g);return{it:iM-y,k:t,idxs:p,centroids:a}}aM.exports=$U});var Sc=ye((X0,Y0)=>{(function(r,t){typeof X0=="object"&&typeof Y0!="undefined"?Y0.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(X0,function(){"use strict";function r(it,B){if(!(it instanceof B))throw new TypeError("Cannot call a class as a function")}function t(it,B){for(var P=0;P<B.length;P++){var F=B[P];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(it,F.key,F)}}function e(it,B,P){return B&&t(it.prototype,B),P&&t(it,P),it}var o=function(){function it(B,P){this.next=null,this.key=B,this.data=P,this.left=null,this.right=null}return it}();function a(it,B){return it>B?1:it<B?-1:0}function c(it,B,P){for(var F=new o(null,null),J=F,rt=F;;){var D=P(it,B.key);if(D<0){if(B.left===null)break;if(P(it,B.left.key)<0){var N=B.left;if(B.left=N.right,N.right=B,B=N,B.left===null)break}rt.left=B,rt=B,B=B.left}else if(D>0){if(B.right===null)break;if(P(it,B.right.key)>0){var N=B.right;if(B.right=N.left,N.left=B,B=N,B.right===null)break}J.right=B,J=B,B=B.right}else break}return J.right=B.left,rt.left=B.right,B.left=F.right,B.right=F.left,B}function p(it,B,P,F){var J=new o(it,B);if(P===null)return J.left=J.right=null,J;P=c(it,P,F);var rt=F(it,P.key);return rt<0?(J.left=P.left,J.right=P,P.left=null):rt>=0&&(J.right=P.right,J.left=P,P.right=null),J}function d(it,B,P){var F=null,J=null;if(B){B=c(it,B,P);var rt=P(B.key,it);rt===0?(F=B.left,J=B.right):rt<0?(J=B.right,B.right=null,F=B):(F=B.left,B.left=null,J=B)}return{left:F,right:J}}function g(it,B,P){return B===null?it:(it===null||(B=c(it.key,B,P),B.left=it),B)}function y(it,B,P,F,J){if(it){F(""+B+(P?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+J(it)+\`
106
+ `);var qn=class extends Ta{constructor(e){super({uniforms:Object.assign({},jf.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new Yf(16777215)},opacity:{value:1},resolution:{value:new Ma(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 Ma(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:re.meshline_vert,fragmentShader:re.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(t){this.uniforms.map.value=t}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(t){this.uniforms.color.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(t){this.uniforms.dashArray.value=t,this.useDash=t!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(t){this.uniforms.useDash.value=t}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(t){this.uniforms.repeat.value.copy(t)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(t){this.uniforms.thresholdRatio.value=t}}}),this.setValues(e)}};qn.prototype.copy=function(r){return Ta.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 Ca="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAMAAACROYkbAAABrVBMVEVsjPdsjPdqi/doifdpivdrjPdsjPdsjPd/m/igtfqTq/lykfdri/dsjPdtjfe/zPv8/f/w8/6zw/p0kvdri/dsjPdtjffU3vz////////3+f62xfpzkfdri/dsjPdsjPeZr/nr8P7////////4+f62xfp0kvdri/dsjPdsjPdujveXrvne5v3////////3+f63x/t2lPdri/dsjPdsjPdsjPdri/eMpfjb4/3+/v/////4+v+7yft1k/dri/dsjPdsjPdri/eJovjl6/3////////3+f6Jo/lqivdsjPdri/dvjveluPry9f7////////i6f2BnPhqi/dsjPdrjPdvjveluPrv8v7////////l6/6Uq/lsjPdsjPdsjPdvjveluPrv8v7////////m6/6Uq/lsjPdsjPdsjPdsjPeZr/nv8v7////////s8f6XrvlsjPdsjPdtjffS2/z////////w9P6bsfltjfdsjPdtjffBz/v7/P/y9f6svvpxkPdrjPdsjPdsjPd+mviftPqVrPlykfdri/dsjPdsjPdri/doifdpifdrjPdsjPclkRlrAAAAx0lEQVQ4y2NgwAsYmZhZWNkYyAfsHJxc3Dy85BvAxy8gKCQsIkq2AWLiEpJS0jKycuQaIK+gqKSsoqqmrkGmAZpa2jq6evoGhkbG5BlgYmpmbmFpZW1ja0emE+wdHJ2cXVzd3D3INMDTy9vH188/IDCIPP3BIaFh4RGRUdExseQZEBefkJiUnJKalp5BngGZWdk5uXn5BemFZAZBUXFJaVl5RSWZ9jMwVFXX1NbVNzSSq5+hqbmlta29g2z9DJ1d3T29ffhUAABKPSh5Xst3GwAAAABJRU5ErkJggg==";var Aa={texture_url:Ca,lineWidth:8,color:16777215},Hr=class extends Jf{constructor(t,n){super();this.navigation=t;this.config=Object.assign({},Aa,n),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}mesh=null;geometry=null;material=null;texture=null;config=Aa;points=[];basicRepeat=1;prevCameraZoom=0;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)}onControlChange=()=>{let t=this.navigation.bmap.context.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.changeRepeat())};onUpdate=()=>{this.texture};onResize=()=>{if(this.material){let{width:t,height:n}=this.navigation.bmap.context.clientSize;this.material.resolution.set(t,n)}};getRepeat(){let{points:t,navigation:{bmap:{context:{camera:n,clientSize:{width:i,height:o}}}}}=this,a=t.map(([l,s])=>et(new ed(l,s,0),n,i,o)).map(({x:l,y:s})=>[l,s]);return Se(a)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new Oi(t,1)}loadTexture(t){return new Promise((n,i)=>{new Qf().load(t,n,void 0,i)})}transformPoints(t){let n=[];for(let i=0;i<t.length;i++)n.push(...t[i],0);return n}updatePoints(t){this.points=t,this.changeRepeat();let n=this.transformPoints(t);this.geometry&&this.geometry.setPoints(n)}movePath(t){this.material&&(this.material.thresholdRatio=t)}async create(t){let n=this.geometry=new ie;if(this.updatePoints(t),!this.texture){let a=this.texture=await this.loadTexture(this.config.texture_url);a.wrapS=a.wrapT=rd}let i=this.material=new qn({useMap:!0,color:new td(this.config.color),transparent:!0,resolution:new Oi(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:nd,repeat:new Oi(this.getRepeat(),1)}),o=this.mesh=new Kf(n,i);return o.renderOrder=9,this.add(o),o}dispose(){this.unRegistryEvent(),this.clear(),this.geometry?.dispose(),this.material?.dispose(),this.texture?.dispose()}};import{Tween as Pa,Easing as ad}from"@tweenjs/tween.js";import{Vector3 as an}from"three";import{EventDispatcher as id}from"three";import{Tween as od}from"@tweenjs/tween.js";var sd={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},Wr=class extends id{constructor(t,n){super();this.navigation=t;this.options=Object.assign({},sd,n),this.registryEvent()}offset=!1;reset=!1;position=[0,0];routeIndex=0;pointIndex=0;paths=[];options;timer=new Gt;resetTimer=null;tweenUtil=new vn;simulationTween;get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){return this.curRoutePath?.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)}onAddPaths=({paths:t})=>{this.paths=t,this.resetStatus(t),this.emitNavigationStatus()};onUpdate=()=>{this.tweenUtil.update()};resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,n){let{curRoutePathPoints:i,position:o,curRoutePath:a,paths:c,routeIndex:l}=this;if(!i.length)return null;let s=i;if(o){let p=fn(i,o);s=s.slice(p+1),s.unshift(o)}let u=[{floor:a?.floor,points:s},...c.slice(l+1)].filter(p=>p.floor===t),{distance:h,closestPoint:f,index:d,i:g}=u.reduce((p,m,v)=>{let{distance:b,closestPoint:y,index:S}=m.points.reduce((x,_,M,w)=>{if(!w[M+1])return x;let{distance:C,closestPoint:P}=Us(n,_,w[M+1]);return C<x.distance?{distance:C,closestPoint:P,index:M}:x},{distance:1/0,closestPoint:m.points[0],index:0});return b<p.distance?{distance:b,closestPoint:y,index:v,i:S}:p},{distance:1/0,closestPoint:s[0],index:0,i:0});return{distance:h,closestPoint:f,routeIndex:d+l,pointIndex:d===0?g+this.pointIndex:g}}toPosition(t,n){let i=this.adsorb(t,n);if(!i)return;let{distance:o,closestPoint:a,routeIndex:c,pointIndex:l}=i;o>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.routeIndex=c,this.pointIndex=l,this.position=a,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}async startCurRouteSimulation(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let n=[];return new Promise(i=>{let o=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],a=this.getCurRouteRemainDistance(),c=a/this.options.simulationSpeed,l=this.simulationTween=new od({distance:0},this.tweenUtil.group).to({distance:a},c*1e3).onUpdate(s=>{let u=fr(o,s.distance);u&&(n.push({floor:t.floor,pos:u}),this.toPosition(t.floor,u))}).onComplete(()=>{this.tweenUtil.remove(l),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,i(this.startCurRouteSimulation())):(i(!0),console.log(n))}).start()})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:n,position:i}=this;if(!t.length)return 0;let o=[i,...t.slice(n+1)];return Se(o)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((o,a)=>o+a.distance,0)+t,curRoute:t}}getNextDirDistance(){if(!this.position)return null;let{pointIndex:t,curRoutePathPoints:n,position:i}=this,o=n[t],a=n[t+1],c=n[t+2];if(!o||!a)return null;let l=kt(i,a);return t===0&&kt(o,i)<5?{dir:"start",distance:l}:c?{dir:wi(o,a,c),distance:l}:{dir:"end",distance:l}}getNavigationInfo(){let{total:t,curRoute:n}=this.getRemainDistance(),i=this.getNextDirDistance();if(!i)return null;let{dir:o,distance:a}=i;return o==="end"&&a>15&&(o="front"),o!=="start"&&a>=this.options.directionEmitThreshold&&(o="front"),n<=5&&(o="end"),{distance:t,curRouteDistance:n,nextDirDistance:a,dir:o,pos:this.position,routeIndex:this.routeIndex,offset:this.offset,reset:this.reset}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear()}};var ud={path:{},cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},positionNavigation:{},offsetY:150,directionEmitThreshold:5,disablePathAnimation:!1,speed:1},Da=class extends Ae{path=null;fetchRoadStatus=!1;paths=[];curPathIndex=0;curFloorPath=null;translatePath=null;currentPathPosition=null;options;pathTween=null;startPoi=null;movedDistance=0;pathStart=[0,0];tweenUtil=new vn;animationPathOptions={cPathIndex:0};cPath=[];positionNavigation;pathMoving=!1;nextPoint=null;constructor(e,t={},n){super(e),!n&&typeof t=="object"&&(n=t),this.options=Object.assign({},ud,n);let{apiDomain:i,apiPath:{roadNetwork:o},apiInfo:a}=this.bmap.config;this.positionNavigation=new Wr(this,{simulationSpeed:this.options.speed,...this.options.positionNavigation}),this.registryEvent()}get curFloorPathLength(){return this.curFloorPath?.distance??0}get curFloorPathPoints(){return this.curFloorPath?.points??[]}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor),this.positionNavigation.addEventListener("navigation-info",this.onNavigationInfo)}onNavigationInfo=({info:e})=>{if(this.dispatchEvent({type:"navigation-info",info:e}),!e.offset){if(e.routeIndex!==this.curPathIndex)return;this.pathMoving?this.nextPoint=e.pos:(this.toPositionBySpeed(e.pos,this.options.speed).then(()=>{this.pathMoving=!1}),this.nextPoint=null)}};pauseAnimation(){this.tweenUtil.pause(),this.positionNavigation.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue(),this.positionNavigation.tweenUtil.continue()}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),this.positionNavigation.removeEventListener("navigation-info",this.onNavigationInfo)}onUpdate=()=>{this.tweenUtil.update()};clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.tweenUtil.clear()),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null),this.translatePath=null}setCurFloorPath(e){e===null?(this.curFloorPath=null,this.currentPathPosition=null):(this.curFloorPath=e,this.currentPathPosition=e.points[0]),this.movedDistance=0}setCurPathIndex(e){this.curPathIndex=e,this.paths[e]?.floor===this.bmap.context.currentFloor?.name?(this.setCurFloorPath(this.paths[e]),this.renderPath(this.translatePoints(this.curFloorPathPoints))):this.clearPath()}onSwitchFloor=({data:{curFloor:e}})=>{if(this.tweenUtil.clear(),this.nextPoint=null,this.pathMoving=!1,this.paths[this.curPathIndex]){let t=this.paths[this.curPathIndex];this.setCurFloorPath(t??null),t?this.renderPath(this.translatePoints(t.points)):this.clearPath()}else this.clearPath()};addPath(e,t=0){this.paths=e,this.curPathIndex=t;let n=this.bmap.context.currentFloor?.name,i=e[t];if(n&&i?.floor===n)if(this.setCurFloorPath(i),this.bmap.currentBuildGround)this.renderPath(this.translatePoints(i.points));else{let o=()=>{this.bmap.removeEventListener("center-change",o),this.renderPath(this.translatePoints(i.points))};this.bmap.addEventListener("center-change",o)}else this.clearPath();this.dispatchEvent({type:"add-path",paths:e})}translatePoints(e){let[t,n]=this.bmap.buildingCenter;return e.map(i=>[i[0]-t,i[1]-n])}renderPath(e){this.translatePath=e;let t=this.catmullRomCurve3(e);this.cPath=t,this.animationPathOptions={cPathIndex:0},this.pathStart=t[0],this.path?this.path.updatePoints(t):(this.path=new Hr(this,this.options.path),this.path.create(t),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null),this.options.needStartPoi&&(this.startPoi=new ne(this.bmap.context,{...this.options.startPoi,id:"navigation_start_poi",position:{x:t[0][0],y:t[0][1],z:.51},collision_enable:!1})||null,this.bmap.context.currentFloor?.poiLayer2.pushPoi(this.startPoi)),this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(e){return Fs(e,!1,!0,.1,170,2.5)}getPathDirection(){if(!this.curFloorPath||!this.currentPathPosition||this.curFloorPathPoints.length<2)return null;let e=fn(this.curFloorPathPoints,this.currentPathPosition),t=this.curFloorPathPoints[e],n=this.curFloorPathPoints[e+1],i=new an(n[0]-t[0],n[1]-t[1],0).normalize(),o=new an(0,1,0).normalize(),a=i.angleTo(o),c=new an().crossVectors(o,i);return(Object.is(c.y,0)?-1:1)*a}async changeCameraToPathUp(e=100){let t=this.getPathDirection();if(t===null)return;let n=this.bmap.context.control.getAzimuthalAngle();Math.abs(n-t)>Math.PI&&(n>0?t=Math.PI*2+t:t=t-Math.PI*2);let i=Math.abs(t-this.bmap.context.control.getAzimuthalAngle());if(i<.01)return;let{control:o}=this.bmap.context,a=e/Math.PI*6*i;return new Promise(c=>{let l={azimuthal:o.getAzimuthalAngle()},s={azimuthal:t},u=new Pa(l,this.tweenUtil.group).to(s,a).easing(ad.Quadratic.InOut).onUpdate(async()=>{o.target.copy(this.startPoi.position),o.setAzimuthalAngle(l.azimuthal,!0),o.setTargetByOffset(this.options.offsetY)}).onComplete(()=>{o.enabled=!0,this.tweenUtil.remove(u),c(!0)}).onStart(()=>{o.enabled=!1}).start()})}async initNavigationCamera(){await this.translateCameraToStartPoi(300),await this.changeCameraToPathUp(300)}async translateCameraToStartPoi(e=100){if(!this.startPoi)return;let{clientSize:{width:t,height:n},camera:i,control:o}=this.bmap.context,a=Math.round(t/2),c=Math.round(n/2),l=o.target.clone(),s=et(this.startPoi.position,i,t,n),u=s.x-a,h=c-s.y+this.options.offsetY;if(!(Math.abs(u)<1&&Math.abs(h)<1)){if(Math.abs(u)>=1){let f=new an;f.setFromMatrixColumn(i.matrix,0),f.normalize(),f.multiplyScalar(u/i.zoom),l.add(new an(f.x,0,0))}if(Math.abs(h)>=1){let f=new an;f.setFromMatrixColumn(i.matrix,1),f.normalize(),f.multiplyScalar(h/i.zoom),l.add(new an(0,f.y,0))}return this.bmap.context.setCameraPosition(l,e)}}async initCameraZoom(e=100){if(!this.startPoi)return;let{clientSize:{width:t,height:n},currentFloor:i}=this.bmap.context,{max:o,min:a}=i.box,l=Math.min(t/(o.x-a.x),n/(o.y-a.y))*(o.x-a.x)/20;return this.bmap.context.setZoom(l,this.startPoi.position,e)}toPosition(e,t){this.positionNavigation.toPosition(e,t)}startSimulation(){this.positionNavigation.startSimulation()}setSimulationSpeed(e){this.positionNavigation.changeSimulationSpeed(e)}async toPositionBySpeed(e,t){let{currentPathPosition:n,curFloorPath:i,curFloorPathPoints:o}=this;if(!i||!n)return null;let a=this.movedDistance,c=zs(o,e);if(a===-1||c===-1||c<=a)return null;let l=c-a;if(!l)return;let s=Math.min(l/t,3);return this.pathTween&&this.tweenUtil.clear(),this.pathMoving=!0,new Promise(u=>{let h=this.pathTween=new Pa({distance:0},this.tweenUtil.group).to({distance:l},s*1e3).onUpdate(async f=>{this.moveDistance(f.distance+a,h)}).onComplete(()=>{if(this.tweenUtil.remove(h),this.nextPoint){let f=this.nextPoint;this.nextPoint=null,u(this.toPositionBySpeed(f,this.options.speed))}else u(!0)}).start()})}async moveDistance(e,t){this.movedDistance=e,this.path?.movePath(this.movedDistance/this.curFloorPathLength);let n=fr(this.curFloorPathPoints,this.movedDistance);if(n===null)return;this.currentPathPosition=n;let i=this.translatePoints([n])[0];this.startPoi&&(this.startPoi.position.setX(i[0]).setY(i[1]),this.options.disablePathAnimation||this.bmap.context.control.setTargetByOffset(this.options.offsetY,this.startPoi.position.clone())),this.options.disablePathAnimation||(t?.pause(),this.positionNavigation.tweenUtil.pause(),await this.changeCameraToPathUp(500/this.options.speed),this.positionNavigation.tweenUtil.continue(),t?.resume())}setStartPoiRotate(e){if(this.startPoi){let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(180-e-n)%360}}dispose(){this.tweenUtil.dispose(),this.unRegistryEvent(),this.path?.dispose(),this.startPoi?.dispose(),this.positionNavigation.dispose()}};import{Group as ld}from"three";var Ia=class extends Ae{poiLayer;floors=[];group=new ld;constructor(e){super(e),this.poiLayer=new _n(e.context)}show(e){let t=e[0].userData.height;e.forEach(o=>{o.poiLayer.pois.forEach(a=>{this.poiLayer.pushPoi(a)}),o.poiLayer.pois.length=0,o.poiLayer.dispose(),o.position.z=t,t+=o.userData.height});let{scene:n,currentFloor:i}=this.bmap.context;i&&(n.remove(i),i.dispose()),this.group.add(this.poiLayer,...e),n.add(this.group),this.floors=e,this.bmap.context.cameraBound.updateBox()}hide(){let{scene:e}=this.bmap.context;e.remove(this.group),this.poiLayer.clear(!0),this.floors.forEach(t=>{t.dispose()}),this.floors=[],this.group.clear()}fitCamera(){let{context:e,config:t,type:n}=this.bmap;e.cameraBound.setEnable(!1),e.control.minZoom=0,e.control.maxZoom=1/0,e.camera.zoom=1,e.setAzimuthalAngle(t.control.defaultAzimuthal,0),e.setPolarAngle(t.control.defaultPolar,0),e.fitCameraToObject(this.group,void 0,0);let i=e.camera.zoom;e.control.minZoom=i,e.control.maxZoom=i*25,n==="3d"&&e.fitCameraToObject(this.group,t.defaultPadding,0,!1),this.bmap.basicZoom=e.camera.zoom,e.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),e.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(e=>e.dispose()),this.floors=[]}};import{EventDispatcher as cd}from"three";function Xn(r){let e=new Blob([r],{type:"text/javascript"}),t=URL.createObjectURL(e),n=new Worker(t);return URL.revokeObjectURL(t),n}function Fi(){return Xn(`var RP=Object.create;var Zd=Object.defineProperty,LP=Object.defineProperties,NP=Object.getOwnPropertyDescriptor,OP=Object.getOwnPropertyDescriptors,DP=Object.getOwnPropertyNames,Wv=Object.getOwnPropertySymbols,FP=Object.getPrototypeOf,qv=Object.prototype.hasOwnProperty,UP=Object.prototype.propertyIsEnumerable;var $d=(r,t,e)=>t in r?Zd(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Wc=(r,t)=>{for(var e in t||(t={}))qv.call(t,e)&&$d(r,e,t[e]);if(Wv)for(var e of Wv(t))UP.call(t,e)&&$d(r,e,t[e]);return r},Xv=(r,t)=>LP(r,OP(t));var ye=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var BP=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of DP(t))!qv.call(r,a)&&a!==e&&Zd(r,a,{get:()=>t[a],enumerable:!(o=NP(t,a))||o.enumerable});return r};var Er=(r,t,e)=>(e=r!=null?RP(FP(r)):{},BP(t||!r||!r.__esModule?Zd(e,"default",{value:r,enumerable:!0}):e,r));var Ei=(r,t,e)=>$d(r,typeof t!="symbol"?t+"":t,e);var $v=ye((lz,Yv)=>{var Jd=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};Yv.exports=Jd});var Kv=ye((cz,Jv)=>{function Zv(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,Zv(a,t)):o!==t&&e.set(o,a);return e}Jv.exports=Zv});var t_=ye((fz,jv)=>{function zP(r){let t=Number(r);return!(isNaN(t)||t<=0)}function Qv(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,Qv(a));if(!zP(a))throw new Error(\`Could not add node at key "\${o}", make sure it's a valid node\`,a);return t.set(o,Number(a))}),t}jv.exports=Qv});var r_=ye((hz,n_)=>{function e_(r){if(!(r instanceof Map))throw new Error(\`Invalid graph: Expected Map instead found \${typeof r}\`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){e_(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}n_.exports=e_});var a_=ye((pz,s_)=>{var kP=$v(),GP=Kv(),i_=t_(),o_=r_(),Kd=class{constructor(t){t instanceof Map?(o_(t),this.graph=t):t?this.graph=i_(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(o_(e),o=e):o=i_(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=GP(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,c=new kP,p=new Map,d=[],g=0,y=[];if(o.avoid&&(y=[].concat(o.avoid)),y.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(y.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(c.set(t,0);!c.isEmpty();){let _=c.next();if(_.key===e){g=_.priority;let x=_.key;for(;p.has(x);)d.push(x),x=p.get(x);break}a.add(_.key),(this.graph.get(_.key)||new Map).forEach((x,T)=>{if(a.has(T)||y.includes(T))return null;if(!c.has(T))return p.set(T,_.key),c.set(T,_.priority+x);let C=c.get(T).priority,I=_.priority+x;return I<C?(p.set(T,_.key),c.set(T,I)):null})}return d.length?(o.trim?d.shift():d=d.concat([t]),o.reverse||(d=d.reverse()),o.cost?{path:d,cost:g}:d):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};s_.exports=Kd});var tp=ye((wz,K1)=>{"use strict";var J1=Object.getOwnPropertySymbols,HO=Object.prototype.hasOwnProperty,VO=Object.prototype.propertyIsEnumerable;function WO(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function qO(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(c){return t[c]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(c){a[c]=c}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(c){return!1}}K1.exports=qO()?Object.assign:function(r,t){for(var e,o=WO(r),a,c=1;c<arguments.length;c++){e=Object(arguments[c]);for(var p in e)HO.call(e,p)&&(o[p]=e[p]);if(J1){a=J1(e);for(var d=0;d<a.length;d++)VO.call(e,a[d])&&(o[a[d]]=e[a[d]])}}return o}});var Mm=ye((Em,wm)=>{(function(r,t){typeof Em=="object"&&typeof wm!="undefined"?wm.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(Em,function(){"use strict";function r(M,E,L,A,z){(function G(Y,X,U,H,Q){for(;H>U;){if(H-U>600){var gt=H-U+1,$=X-U+1,Nt=Math.log(gt),j=.5*Math.exp(2*Nt/3),pt=.5*Math.sqrt(Nt*j*(gt-j)/gt)*($-gt/2<0?-1:1),Ct=Math.max(U,Math.floor(X-$*j/gt+pt)),Tt=Math.min(H,Math.floor(X+(gt-$)*j/gt+pt));G(Y,X,Ct,Tt,Q)}var ft=Y[X],dt=U,Z=H;for(t(Y,U,X),Q(Y[H],ft)>0&&t(Y,U,H);dt<Z;){for(t(Y,dt,Z),dt++,Z--;Q(Y[dt],ft)<0;)dt++;for(;Q(Y[Z],ft)>0;)Z--}Q(Y[U],ft)===0?t(Y,U,Z):t(Y,++Z,H),Z<=X&&(U=Z+1),X<=Z&&(H=Z-1)}})(M,E,L||0,A||M.length-1,z||e)}function t(M,E,L){var A=M[E];M[E]=M[L],M[L]=A}function e(M,E){return M<E?-1:M>E?1:0}var o=function(M){M===void 0&&(M=9),this._maxEntries=Math.max(4,M),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(M,E,L){if(!L)return E.indexOf(M);for(var A=0;A<E.length;A++)if(L(M,E[A]))return A;return-1}function c(M,E){p(M,0,M.children.length,E,M)}function p(M,E,L,A,z){z||(z=C(null)),z.minX=1/0,z.minY=1/0,z.maxX=-1/0,z.maxY=-1/0;for(var G=E;G<L;G++){var Y=M.children[G];d(z,M.leaf?A(Y):Y)}return z}function d(M,E){return M.minX=Math.min(M.minX,E.minX),M.minY=Math.min(M.minY,E.minY),M.maxX=Math.max(M.maxX,E.maxX),M.maxY=Math.max(M.maxY,E.maxY),M}function g(M,E){return M.minX-E.minX}function y(M,E){return M.minY-E.minY}function _(M){return(M.maxX-M.minX)*(M.maxY-M.minY)}function w(M){return M.maxX-M.minX+(M.maxY-M.minY)}function x(M,E){return M.minX<=E.minX&&M.minY<=E.minY&&E.maxX<=M.maxX&&E.maxY<=M.maxY}function T(M,E){return E.minX<=M.maxX&&E.minY<=M.maxY&&E.maxX>=M.minX&&E.maxY>=M.minY}function C(M){return{children:M,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function I(M,E,L,A,z){for(var G=[E,L];G.length;)if(!((L=G.pop())-(E=G.pop())<=A)){var Y=E+Math.ceil((L-E)/A/2)*A;r(M,Y,E,L,z),G.push(E,Y,Y,L)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(M){var E=this.data,L=[];if(!T(M,E))return L;for(var A=this.toBBox,z=[];E;){for(var G=0;G<E.children.length;G++){var Y=E.children[G],X=E.leaf?A(Y):Y;T(M,X)&&(E.leaf?L.push(Y):x(M,X)?this._all(Y,L):z.push(Y))}E=z.pop()}return L},o.prototype.collides=function(M){var E=this.data;if(!T(M,E))return!1;for(var L=[];E;){for(var A=0;A<E.children.length;A++){var z=E.children[A],G=E.leaf?this.toBBox(z):z;if(T(M,G)){if(E.leaf||x(M,G))return!0;L.push(z)}}E=L.pop()}return!1},o.prototype.load=function(M){if(!M||!M.length)return this;if(M.length<this._minEntries){for(var E=0;E<M.length;E++)this.insert(M[E]);return this}var L=this._build(M.slice(),0,M.length-1,0);if(this.data.children.length)if(this.data.height===L.height)this._splitRoot(this.data,L);else{if(this.data.height<L.height){var A=this.data;this.data=L,L=A}this._insert(L,this.data.height-L.height-1,!0)}else this.data=L;return this},o.prototype.insert=function(M){return M&&this._insert(M,this.data.height-1),this},o.prototype.clear=function(){return this.data=C([]),this},o.prototype.remove=function(M,E){if(!M)return this;for(var L,A,z,G=this.data,Y=this.toBBox(M),X=[],U=[];G||X.length;){if(G||(G=X.pop(),A=X[X.length-1],L=U.pop(),z=!0),G.leaf){var H=a(M,G.children,E);if(H!==-1)return G.children.splice(H,1),X.push(G),this._condense(X),this}z||G.leaf||!x(G,Y)?A?(L++,G=A.children[L],z=!1):G=null:(X.push(G),U.push(L),L=0,A=G,G=G.children[0])}return this},o.prototype.toBBox=function(M){return M},o.prototype.compareMinX=function(M,E){return M.minX-E.minX},o.prototype.compareMinY=function(M,E){return M.minY-E.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(M){return this.data=M,this},o.prototype._all=function(M,E){for(var L=[];M;)M.leaf?E.push.apply(E,M.children):L.push.apply(L,M.children),M=L.pop();return E},o.prototype._build=function(M,E,L,A){var z,G=L-E+1,Y=this._maxEntries;if(G<=Y)return c(z=C(M.slice(E,L+1)),this.toBBox),z;A||(A=Math.ceil(Math.log(G)/Math.log(Y)),Y=Math.ceil(G/Math.pow(Y,A-1))),(z=C([])).leaf=!1,z.height=A;var X=Math.ceil(G/Y),U=X*Math.ceil(Math.sqrt(Y));I(M,E,L,U,this.compareMinX);for(var H=E;H<=L;H+=U){var Q=Math.min(H+U-1,L);I(M,H,Q,X,this.compareMinY);for(var gt=H;gt<=Q;gt+=X){var $=Math.min(gt+X-1,Q);z.children.push(this._build(M,gt,$,A-1))}}return c(z,this.toBBox),z},o.prototype._chooseSubtree=function(M,E,L,A){for(;A.push(E),!E.leaf&&A.length-1!==L;){for(var z=1/0,G=1/0,Y=void 0,X=0;X<E.children.length;X++){var U=E.children[X],H=_(U),Q=(gt=M,$=U,(Math.max($.maxX,gt.maxX)-Math.min($.minX,gt.minX))*(Math.max($.maxY,gt.maxY)-Math.min($.minY,gt.minY))-H);Q<G?(G=Q,z=H<z?H:z,Y=U):Q===G&&H<z&&(z=H,Y=U)}E=Y||E.children[0]}var gt,$;return E},o.prototype._insert=function(M,E,L){var A=L?M:this.toBBox(M),z=[],G=this._chooseSubtree(A,this.data,E,z);for(G.children.push(M),d(G,A);E>=0&&z[E].children.length>this._maxEntries;)this._split(z,E),E--;this._adjustParentBBoxes(A,z,E)},o.prototype._split=function(M,E){var L=M[E],A=L.children.length,z=this._minEntries;this._chooseSplitAxis(L,z,A);var G=this._chooseSplitIndex(L,z,A),Y=C(L.children.splice(G,L.children.length-G));Y.height=L.height,Y.leaf=L.leaf,c(L,this.toBBox),c(Y,this.toBBox),E?M[E-1].children.push(Y):this._splitRoot(L,Y)},o.prototype._splitRoot=function(M,E){this.data=C([M,E]),this.data.height=M.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(M,E,L){for(var A,z,G,Y,X,U,H,Q=1/0,gt=1/0,$=E;$<=L-E;$++){var Nt=p(M,0,$,this.toBBox),j=p(M,$,L,this.toBBox),pt=(z=Nt,G=j,Y=void 0,X=void 0,U=void 0,H=void 0,Y=Math.max(z.minX,G.minX),X=Math.max(z.minY,G.minY),U=Math.min(z.maxX,G.maxX),H=Math.min(z.maxY,G.maxY),Math.max(0,U-Y)*Math.max(0,H-X)),Ct=_(Nt)+_(j);pt<Q?(Q=pt,A=$,gt=Ct<gt?Ct:gt):pt===Q&&Ct<gt&&(gt=Ct,A=$)}return A||L-E},o.prototype._chooseSplitAxis=function(M,E,L){var A=M.leaf?this.compareMinX:g,z=M.leaf?this.compareMinY:y;this._allDistMargin(M,E,L,A)<this._allDistMargin(M,E,L,z)&&M.children.sort(A)},o.prototype._allDistMargin=function(M,E,L,A){M.children.sort(A);for(var z=this.toBBox,G=p(M,0,E,z),Y=p(M,L-E,L,z),X=w(G)+w(Y),U=E;U<L-E;U++){var H=M.children[U];d(G,M.leaf?z(H):H),X+=w(G)}for(var Q=L-E-1;Q>=E;Q--){var gt=M.children[Q];d(Y,M.leaf?z(gt):gt),X+=w(Y)}return X},o.prototype._adjustParentBBoxes=function(M,E,L){for(var A=L;A>=0;A--)d(E[A],M)},o.prototype._condense=function(M){for(var E=M.length-1,L=void 0;E>=0;E--)M[E].children.length===0?E>0?(L=M[E-1].children).splice(L.indexOf(M[E]),1):this.clear():c(M[E],this.toBBox)},o})});var Q1=ye((Sm,bm)=>{(function(r,t){typeof Sm=="object"&&typeof bm!="undefined"?bm.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(Sm,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var c=(this.length>>1)-1;c>=0;c--)this._down(c)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,c=a.data,p=a.compare,d=c[o];o>0;){var g=o-1>>1,y=c[g];if(p(d,y)>=0)break;c[o]=y,o=g}c[o]=d},r.prototype._down=function(o){for(var a=this,c=a.data,p=a.compare,d=this.length>>1,g=c[o];o<d;){var y=(o<<1)+1,_=c[y],w=y+1;if(w<this.length&&p(c[w],_)<0&&(y=w,_=c[w]),p(_,g)>=0)break;c[o]=_,o=y}c[o]=g};function t(e,o){return e<o?-1:e>o?1:0}return r})});var tx=ye((Cz,j1)=>{j1.exports=function(t,e,o,a){var c=t[0],p=t[1],d=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var g=(a-o)/2,y=0,_=g-1;y<g;_=y++){var w=e[o+y*2+0],x=e[o+y*2+1],T=e[o+_*2+0],C=e[o+_*2+1],I=x>p!=C>p&&c<(T-w)*(p-x)/(C-x)+w;I&&(d=!d)}return d}});var nx=ye((Pz,ex)=>{ex.exports=function(t,e,o,a){var c=t[0],p=t[1],d=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var g=a-o,y=0,_=g-1;y<g;_=y++){var w=e[y+o][0],x=e[y+o][1],T=e[_+o][0],C=e[_+o][1],I=x>p!=C>p&&c<(T-w)*(p-x)/(C-x)+w;I&&(d=!d)}return d}});var ox=ye((Iz,rp)=>{var rx=tx(),ix=nx();rp.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?ix(t,e,o,a):rx(t,e,o,a)};rp.exports.nested=ix;rp.exports.flat=rx});var ax=ye((ip,sx)=>{(function(r,t){typeof ip=="object"&&typeof sx!="undefined"?t(ip):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(ip,function(r){"use strict";let e=33306690738754706e-32;function o(T,C,I,M,E){let L,A,z,G,Y=C[0],X=M[0],U=0,H=0;X>Y==X>-Y?(L=Y,Y=C[++U]):(L=X,X=M[++H]);let Q=0;if(U<T&&H<I)for(X>Y==X>-Y?(z=L-((A=Y+L)-Y),Y=C[++U]):(z=L-((A=X+L)-X),X=M[++H]),L=A,z!==0&&(E[Q++]=z);U<T&&H<I;)X>Y==X>-Y?(z=L-((A=L+Y)-(G=A-L))+(Y-G),Y=C[++U]):(z=L-((A=L+X)-(G=A-L))+(X-G),X=M[++H]),L=A,z!==0&&(E[Q++]=z);for(;U<T;)z=L-((A=L+Y)-(G=A-L))+(Y-G),Y=C[++U],L=A,z!==0&&(E[Q++]=z);for(;H<I;)z=L-((A=L+X)-(G=A-L))+(X-G),X=M[++H],L=A,z!==0&&(E[Q++]=z);return L===0&&Q!==0||(E[Q++]=L),Q}function a(T){return new Float64Array(T)}let c=33306690738754716e-32,p=22204460492503146e-32,d=11093356479670487e-47,g=a(4),y=a(8),_=a(12),w=a(16),x=a(4);r.orient2d=function(T,C,I,M,E,L){let A=(C-L)*(I-E),z=(T-E)*(M-L),G=A-z;if(A===0||z===0||A>0!=z>0)return G;let Y=Math.abs(A+z);return Math.abs(G)>=c*Y?G:-function(X,U,H,Q,gt,$,Nt){let j,pt,Ct,Tt,ft,dt,Z,st,vt,zt,bt,qt,le,se,Zt,_e,Vt,pe,at=X-gt,He=H-gt,ae=U-$,ce=Q-$;ft=(Zt=(st=at-(Z=(dt=134217729*at)-(dt-at)))*(zt=ce-(vt=(dt=134217729*ce)-(dt-ce)))-((se=at*ce)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=ae-(Z=(dt=134217729*ae)-(dt-ae)))*(zt=He-(vt=(dt=134217729*He)-(dt-He)))-((_e=ae*He)-Z*vt-st*vt-Z*zt))),g[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),g[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,g[2]=qt-(pe-ft)+(bt-ft),g[3]=pe;let fe=function(J,rt){let D=rt[0];for(let N=1;N<J;N++)D+=rt[N];return D}(4,g),it=p*Nt;if(fe>=it||-fe>=it||(j=X-(at+(ft=X-at))+(ft-gt),Ct=H-(He+(ft=H-He))+(ft-gt),pt=U-(ae+(ft=U-ae))+(ft-$),Tt=Q-(ce+(ft=Q-ce))+(ft-$),j===0&&pt===0&&Ct===0&&Tt===0)||(it=d*Nt+e*Math.abs(fe),(fe+=at*Tt+ce*j-(ae*Ct+He*pt))>=it||-fe>=it))return fe;ft=(Zt=(st=j-(Z=(dt=134217729*j)-(dt-j)))*(zt=ce-(vt=(dt=134217729*ce)-(dt-ce)))-((se=j*ce)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=pt-(Z=(dt=134217729*pt)-(dt-pt)))*(zt=He-(vt=(dt=134217729*He)-(dt-He)))-((_e=pt*He)-Z*vt-st*vt-Z*zt))),x[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),x[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,x[2]=qt-(pe-ft)+(bt-ft),x[3]=pe;let B=o(4,g,4,x,y);ft=(Zt=(st=at-(Z=(dt=134217729*at)-(dt-at)))*(zt=Tt-(vt=(dt=134217729*Tt)-(dt-Tt)))-((se=at*Tt)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=ae-(Z=(dt=134217729*ae)-(dt-ae)))*(zt=Ct-(vt=(dt=134217729*Ct)-(dt-Ct)))-((_e=ae*Ct)-Z*vt-st*vt-Z*zt))),x[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),x[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,x[2]=qt-(pe-ft)+(bt-ft),x[3]=pe;let P=o(B,y,4,x,_);ft=(Zt=(st=j-(Z=(dt=134217729*j)-(dt-j)))*(zt=Tt-(vt=(dt=134217729*Tt)-(dt-Tt)))-((se=j*Tt)-Z*vt-st*vt-Z*zt))-(bt=Zt-(Vt=(st=pt-(Z=(dt=134217729*pt)-(dt-pt)))*(zt=Ct-(vt=(dt=134217729*Ct)-(dt-Ct)))-((_e=pt*Ct)-Z*vt-st*vt-Z*zt))),x[0]=Zt-(bt+ft)+(ft-Vt),ft=(le=se-((qt=se+bt)-(ft=qt-se))+(bt-ft))-(bt=le-_e),x[1]=le-(bt+ft)+(ft-_e),ft=(pe=qt+bt)-qt,x[2]=qt-(pe-ft)+(bt-ft),x[3]=pe;let F=o(P,_,4,x,w);return w[F-1]}(T,C,I,M,E,L,Y)},r.orient2dfast=function(T,C,I,M,E,L){return(C-L)*(I-E)-(T-E)*(M-L)},Object.defineProperty(r,"__esModule",{value:!0})})});var px=ye((Rz,Pm)=>{"use strict";var ux=Mm(),sp=Q1(),YO=ox(),$O=ax().orient2d;sp.default&&(sp=sp.default);Pm.exports=hx;Pm.exports.default=hx;function hx(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=jO(r),a=new ux(16);a.toBBox=function(L){return{minX:L[0],minY:L[1],maxX:L[0],maxY:L[1]}},a.compareMinX=function(L,A){return L[0]-A[0]},a.compareMinY=function(L,A){return L[1]-A[1]},a.load(r);for(var c=[],p=0,d;p<o.length;p++){var g=o[p];a.remove(g),d=fx(g,d),c.push(d)}var y=new ux(16);for(p=0;p<c.length;p++)y.insert(Tm(c[p]));for(var _=t*t,w=e*e;c.length;){var x=c.shift(),T=x.p,C=x.next.p,I=Am(T,C);if(!(I<w)){var M=I/_;g=ZO(a,x.prev.p,T,C,x.next.next.p,M,y),g&&Math.min(Am(g,T),Am(g,C))<=M&&(c.push(x),c.push(fx(g,x)),a.remove(g),y.remove(x),y.insert(Tm(x)),y.insert(Tm(x.next)))}}x=d;var E=[];do E.push(x.p),x=x.next;while(x!==d);return E.push(x.p),E}function ZO(r,t,e,o,a,c,p){for(var d=new sp([],JO),g=r.data;g;){for(var y=0;y<g.children.length;y++){var _=g.children[y],w=g.leaf?Cm(_,e,o):KO(e,o,_);w>c||d.push({node:_,dist:w})}for(;d.length&&!d.peek().node.children;){var x=d.pop(),T=x.node,C=Cm(T,t,e),I=Cm(T,o,a);if(x.dist<C&&x.dist<I&&cx(e,T,p)&&cx(o,T,p))return T}g=d.pop(),g&&(g=g.node)}return null}function JO(r,t){return r.dist-t.dist}function KO(r,t,e){if(lx(r,e)||lx(t,e))return 0;var o=op(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=op(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var c=op(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(c===0)return 0;var p=op(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return p===0?0:Math.min(o,a,c,p)}function lx(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function cx(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),c=Math.max(r[0],t[0]),p=Math.max(r[1],t[1]),d=e.search({minX:o,minY:a,maxX:c,maxY:p}),g=0;g<d.length;g++)if(QO(d[g].p,d[g].next.p,r,t))return!1;return!0}function rc(r,t,e){return $O(r[0],r[1],t[0],t[1],e[0],e[1])}function QO(r,t,e,o){return r!==o&&t!==e&&rc(r,t,e)>0!=rc(r,t,o)>0&&rc(e,o,r)>0!=rc(e,o,t)>0}function Tm(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function jO(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],c=0;c<r.length;c++){var p=r[c];p[0]<t[0]&&(t=p),p[0]>o[0]&&(o=p),p[1]<e[1]&&(e=p),p[1]>a[1]&&(a=p)}var d=[t,e,o,a],g=d.slice();for(c=0;c<r.length;c++)YO(r[c],d)||g.push(r[c]);return eD(g)}function fx(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function Am(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function Cm(r,t,e){var o=t[0],a=t[1],c=e[0]-o,p=e[1]-a;if(c!==0||p!==0){var d=((r[0]-o)*c+(r[1]-a)*p)/(c*c+p*p);d>1?(o=e[0],a=e[1]):d>0&&(o+=c*d,a+=p*d)}return c=r[0]-o,p=r[1]-a,c*c+p*p}function op(r,t,e,o,a,c,p,d){var g=e-r,y=o-t,_=p-a,w=d-c,x=r-a,T=t-c,C=g*g+y*y,I=g*_+y*w,M=_*_+w*w,E=g*x+y*T,L=_*x+w*T,A=C*M-I*I,z,G,Y,X,U=A,H=A;A===0?(G=0,U=1,X=L,H=M):(G=I*L-M*E,X=C*L-I*E,G<0?(G=0,X=L,H=M):G>U&&(G=U,X=L+I,H=M)),X<0?(X=0,-E<0?G=0:-E>C?G=U:(G=-E,U=C)):X>H&&(X=H,-E+I<0?G=0:-E+I>C?G=U:(G=-E+I,U=C)),z=G===0?0:G/U,Y=X===0?0:X/H;var Q=(1-z)*r+z*e,gt=(1-z)*t+z*o,$=(1-Y)*a+Y*p,Nt=(1-Y)*c+Y*d,j=$-Q,pt=Nt-gt;return j*j+pt*pt}function tD(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function eD(r){r.sort(tD);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&rc(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&rc(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var _x=ye((Rm,Lm)=>{(function(r,t){typeof Rm=="object"&&typeof Lm!="undefined"?Lm.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(Rm,function(){"use strict";function r(a,c,p,d,g){t(a,c,p||0,d||a.length-1,g||o)}function t(a,c,p,d,g){for(;d>p;){if(d-p>600){var y=d-p+1,_=c-p+1,w=Math.log(y),x=.5*Math.exp(2*w/3),T=.5*Math.sqrt(w*x*(y-x)/y)*(_-y/2<0?-1:1),C=Math.max(p,Math.floor(c-_*x/y+T)),I=Math.min(d,Math.floor(c+(y-_)*x/y+T));t(a,c,C,I,g)}var M=a[c],E=p,L=d;for(e(a,p,c),g(a[d],M)>0&&e(a,p,d);E<L;){for(e(a,E,L),E++,L--;g(a[E],M)<0;)E++;for(;g(a[L],M)>0;)L--}g(a[p],M)===0?e(a,p,L):(L++,e(a,L,d)),L<=c&&(p=L+1),c<=L&&(d=L-1)}}function e(a,c,p){var d=a[c];a[c]=a[p],a[p]=d}function o(a,c){return a<c?-1:a>c?1:0}return r})});var Fm=ye((rG,Dm)=>{"use strict";Dm.exports=uf;Dm.exports.default=uf;var dD=_x();function uf(r,t){if(!(this instanceof uf))return new uf(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}uf.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!up(r,t))return e;for(var a=[],c,p,d,g;t;){for(c=0,p=t.children.length;c<p;c++)d=t.children[c],g=t.leaf?o(d):d,up(r,g)&&(t.leaf?e.push(d):Om(r,g)?this._all(d,e):a.push(d));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!up(r,t))return!1;for(var o=[],a,c,p,d;t;){for(a=0,c=t.children.length;a<c;a++)if(p=t.children[a],d=t.leaf?e(p):p,up(r,d)){if(t.leaf||Om(r,d))return!0;o.push(p)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=sc([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],c=[],p,d,g,y;e||a.length;){if(e||(e=a.pop(),d=a[a.length-1],p=c.pop(),y=!0),e.leaf&&(g=gD(r,e.children,t),g!==-1))return e.children.splice(g,1),a.push(e),this._condense(a),this;!y&&!e.leaf&&Om(e,o)?(a.push(e),c.push(p),p=0,d=e,e=e.children[0]):d?(p++,e=d.children[p],y=!1):e=null}return this},toBBox:function(r){return r},compareMinX:xx,compareMinY:Ex,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,c=this._maxEntries,p;if(a<=c)return p=sc(r.slice(t,e+1)),oc(p,this.toBBox),p;o||(o=Math.ceil(Math.log(a)/Math.log(c)),c=Math.ceil(a/Math.pow(c,o-1))),p=sc([]),p.leaf=!1,p.height=o;var d=Math.ceil(a/c),g=d*Math.ceil(Math.sqrt(c)),y,_,w,x;for(wx(r,t,e,g,this.compareMinX),y=t;y<=e;y+=g)for(w=Math.min(y+g-1,e),wx(r,y,w,d,this.compareMinY),_=y;_<=w;_+=d)x=Math.min(_+d-1,w),p.children.push(this._build(r,_,x,o-1));return oc(p,this.toBBox),p},_chooseSubtree:function(r,t,e,o){for(var a,c,p,d,g,y,_,w;o.push(t),!(t.leaf||o.length-1===e);){for(_=w=1/0,a=0,c=t.children.length;a<c;a++)p=t.children[a],g=Nm(p),y=mD(r,p)-g,y<w?(w=y,_=g<_?g:_,d=p):y===w&&g<_&&(_=g,d=p);t=d||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),c=[],p=this._chooseSubtree(a,this.data,t,c);for(p.children.push(r),af(p,a);t>=0&&c[t].children.length>this._maxEntries;)this._split(c,t),t--;this._adjustParentBBoxes(a,c,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var c=this._chooseSplitIndex(e,a,o),p=sc(e.children.splice(c,e.children.length-c));p.height=e.height,p.leaf=e.leaf,oc(e,this.toBBox),oc(p,this.toBBox),t?r[t-1].children.push(p):this._splitRoot(e,p)},_splitRoot:function(r,t){this.data=sc([r,t]),this.data.height=r.height+1,this.data.leaf=!1,oc(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,c,p,d,g,y,_;for(g=y=1/0,o=t;o<=e-t;o++)a=sf(r,0,o,this.toBBox),c=sf(r,o,e,this.toBBox),p=yD(a,c),d=Nm(a)+Nm(c),p<g?(g=p,_=o,y=d<y?d:y):p===g&&d<y&&(y=d,_=o);return _},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:xx,a=r.leaf?this.compareMinY:Ex,c=this._allDistMargin(r,t,e,o),p=this._allDistMargin(r,t,e,a);c<p&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,c=sf(r,0,t,a),p=sf(r,e-t,e,a),d=ap(c)+ap(p),g,y;for(g=t;g<e-t;g++)y=r.children[g],af(c,r.leaf?a(y):y),d+=ap(c);for(g=e-t-1;g>=t;g--)y=r.children[g],af(p,r.leaf?a(y):y),d+=ap(p);return d},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)af(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():oc(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function gD(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function oc(r,t){sf(r,0,r.children.length,t,r)}function sf(r,t,e,o,a){a||(a=sc(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var c=t,p;c<e;c++)p=r.children[c],af(a,r.leaf?o(p):p);return a}function af(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function xx(r,t){return r.minX-t.minX}function Ex(r,t){return r.minY-t.minY}function Nm(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function ap(r){return r.maxX-r.minX+(r.maxY-r.minY)}function mD(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function yD(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),c=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,c-o)}function Om(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function up(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function sc(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function wx(r,t,e,o,a){for(var c=[t,e],p;c.length;)e=c.pop(),t=c.pop(),!(e-t<=o)&&(p=t+Math.ceil((e-t)/o/2)*o,dD(r,p,t,e,a),c.push(t,p,p,e))}});var Cx=ye((m5,Hm)=>{"use strict";Hm.exports=hp;Hm.exports.default=hp;function hp(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,c=bx(r,0,a,e,!0),p=[];if(!c||c.next===c.prev)return p;var d,g,y,_,w,x,T;if(o&&(c=AD(r,t,c,e)),r.length>80*e){d=y=r[0],g=_=r[1];for(var C=e;C<a;C+=e)w=r[C],x=r[C+1],w<d&&(d=w),x<g&&(g=x),w>y&&(y=w),x>_&&(_=x);T=Math.max(y-d,_-g),T=T!==0?32767/T:0}return ff(c,p,e,d,g,T,0),p}function bx(r,t,e,o,a){var c,p;if(a===Gm(r,t,e,o)>0)for(c=t;c<e;c+=o)p=Sx(c,r[c],r[c+1],p);else for(c=e-o;c>=t;c-=o)p=Sx(c,r[c],r[c+1],p);return p&&pp(p,p.next)&&(pf(p),p=p.next),p}function sl(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(pp(e,e.next)||Lr(e.prev,e,e.next)===0)){if(pf(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function ff(r,t,e,o,a,c,p){if(r){!p&&c&&LD(r,o,a,c);for(var d=r,g,y;r.prev!==r.next;){if(g=r.prev,y=r.next,c?SD(r,o,a,c):MD(r)){t.push(g.i/e|0),t.push(r.i/e|0),t.push(y.i/e|0),pf(r),r=y.next,d=y.next;continue}if(r=y,r===d){p?p===1?(r=bD(sl(r),t,e),ff(r,t,e,o,a,c,2)):p===2&&TD(r,t,e,o,a,c):ff(sl(r),t,e,o,a,c,1);break}}}}function MD(r){var t=r.prev,e=r,o=r.next;if(Lr(t,e,o)>=0)return!1;for(var a=t.x,c=e.x,p=o.x,d=t.y,g=e.y,y=o.y,_=a<c?a<p?a:p:c<p?c:p,w=d<g?d<y?d:y:g<y?g:y,x=a>c?a>p?a:p:c>p?c:p,T=d>g?d>y?d:y:g>y?g:y,C=o.next;C!==t;){if(C.x>=_&&C.x<=x&&C.y>=w&&C.y<=T&&lc(a,d,c,g,p,y,C.x,C.y)&&Lr(C.prev,C,C.next)>=0)return!1;C=C.next}return!0}function SD(r,t,e,o){var a=r.prev,c=r,p=r.next;if(Lr(a,c,p)>=0)return!1;for(var d=a.x,g=c.x,y=p.x,_=a.y,w=c.y,x=p.y,T=d<g?d<y?d:y:g<y?g:y,C=_<w?_<x?_:x:w<x?w:x,I=d>g?d>y?d:y:g>y?g:y,M=_>w?_>x?_:x:w>x?w:x,E=zm(T,C,t,e,o),L=zm(I,M,t,e,o),A=r.prevZ,z=r.nextZ;A&&A.z>=E&&z&&z.z<=L;){if(A.x>=T&&A.x<=I&&A.y>=C&&A.y<=M&&A!==a&&A!==p&&lc(d,_,g,w,y,x,A.x,A.y)&&Lr(A.prev,A,A.next)>=0||(A=A.prevZ,z.x>=T&&z.x<=I&&z.y>=C&&z.y<=M&&z!==a&&z!==p&&lc(d,_,g,w,y,x,z.x,z.y)&&Lr(z.prev,z,z.next)>=0))return!1;z=z.nextZ}for(;A&&A.z>=E;){if(A.x>=T&&A.x<=I&&A.y>=C&&A.y<=M&&A!==a&&A!==p&&lc(d,_,g,w,y,x,A.x,A.y)&&Lr(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;z&&z.z<=L;){if(z.x>=T&&z.x<=I&&z.y>=C&&z.y<=M&&z!==a&&z!==p&&lc(d,_,g,w,y,x,z.x,z.y)&&Lr(z.prev,z,z.next)>=0)return!1;z=z.nextZ}return!0}function bD(r,t,e){var o=r;do{var a=o.prev,c=o.next.next;!pp(a,c)&&Tx(a,o,o.next,c)&&hf(a,c)&&hf(c,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(c.i/e|0),pf(o),pf(o.next),o=r=c),o=o.next}while(o!==r);return sl(o)}function TD(r,t,e,o,a,c){var p=r;do{for(var d=p.next.next;d!==p.prev;){if(p.i!==d.i&&DD(p,d)){var g=Ax(p,d);p=sl(p,p.next),g=sl(g,g.next),ff(p,t,e,o,a,c,0),ff(g,t,e,o,a,c,0);return}d=d.next}p=p.next}while(p!==r)}function AD(r,t,e,o){var a=[],c,p,d,g,y;for(c=0,p=t.length;c<p;c++)d=t[c]*o,g=c<p-1?t[c+1]*o:r.length,y=bx(r,d,g,o,!1),y===y.next&&(y.steiner=!0),a.push(OD(y));for(a.sort(CD),c=0;c<a.length;c++)e=PD(a[c],e);return e}function CD(r,t){return r.x-t.x}function PD(r,t){var e=ID(r,t);if(!e)return t;var o=Ax(e,r);return sl(o,o.next),sl(e,e.next)}function ID(r,t){var e=t,o=r.x,a=r.y,c=-1/0,p;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var d=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=o&&d>c&&(c=d,p=e.x<e.next.x?e:e.next,d===o))return p}e=e.next}while(e!==t);if(!p)return null;var g=p,y=p.x,_=p.y,w=1/0,x;e=p;do o>=e.x&&e.x>=y&&o!==e.x&&lc(a<_?o:c,a,y,_,a<_?c:o,a,e.x,e.y)&&(x=Math.abs(a-e.y)/(o-e.x),hf(e,r)&&(x<w||x===w&&(e.x>p.x||e.x===p.x&&RD(p,e)))&&(p=e,w=x)),e=e.next;while(e!==g);return p}function RD(r,t){return Lr(r.prev,r,t.prev)<0&&Lr(t.next,r,r.next)<0}function LD(r,t,e,o){var a=r;do a.z===0&&(a.z=zm(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,ND(a)}function ND(r){var t,e,o,a,c,p,d,g,y=1;do{for(e=r,r=null,c=null,p=0;e;){for(p++,o=e,d=0,t=0;t<y&&(d++,o=o.nextZ,!!o);t++);for(g=y;d>0||g>0&&o;)d!==0&&(g===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,d--):(a=o,o=o.nextZ,g--),c?c.nextZ=a:r=a,a.prevZ=c,c=a;e=o}c.nextZ=null,y*=2}while(p>1);return r}function zm(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function OD(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function lc(r,t,e,o,a,c,p,d){return(a-p)*(t-d)>=(r-p)*(c-d)&&(r-p)*(o-d)>=(e-p)*(t-d)&&(e-p)*(c-d)>=(a-p)*(o-d)}function DD(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!FD(r,t)&&(hf(r,t)&&hf(t,r)&&UD(r,t)&&(Lr(r.prev,r,t.prev)||Lr(r,t.prev,t))||pp(r,t)&&Lr(r.prev,r,r.next)>0&&Lr(t.prev,t,t.next)>0)}function Lr(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function pp(r,t){return r.x===t.x&&r.y===t.y}function Tx(r,t,e,o){var a=fp(Lr(r,t,e)),c=fp(Lr(r,t,o)),p=fp(Lr(e,o,r)),d=fp(Lr(e,o,t));return!!(a!==c&&p!==d||a===0&&cp(r,e,t)||c===0&&cp(r,o,t)||p===0&&cp(e,r,o)||d===0&&cp(e,t,o))}function cp(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function fp(r){return r>0?1:r<0?-1:0}function FD(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Tx(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function hf(r,t){return Lr(r.prev,r,r.next)<0?Lr(r,t,r.next)>=0&&Lr(r,r.prev,t)>=0:Lr(r,t,r.prev)<0||Lr(r,r.next,t)<0}function UD(r,t){var e=r,o=!1,a=(r.x+t.x)/2,c=(r.y+t.y)/2;do e.y>c!=e.next.y>c&&e.next.y!==e.y&&a<(e.next.x-e.x)*(c-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function Ax(r,t){var e=new km(r.i,r.x,r.y),o=new km(t.i,t.x,t.y),a=r.next,c=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,c.next=o,o.prev=c,o}function Sx(r,t,e,o){var a=new km(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function pf(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function km(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}hp.deviation=function(r,t,e,o){var a=t&&t.length,c=a?t[0]*e:r.length,p=Math.abs(Gm(r,0,c,e));if(a)for(var d=0,g=t.length;d<g;d++){var y=t[d]*e,_=d<g-1?t[d+1]*e:r.length;p-=Math.abs(Gm(r,y,_,e))}var w=0;for(d=0;d<o.length;d+=3){var x=o[d]*e,T=o[d+1]*e,C=o[d+2]*e;w+=Math.abs((r[x]-r[C])*(r[T+1]-r[x+1])-(r[x]-r[T])*(r[C+1]-r[x+1]))}return p===0&&w===0?0:Math.abs((w-p)/p)};function Gm(r,t,e,o){for(var a=0,c=t,p=e-o;c<e;c+=o)a+=(r[p]-r[c])*(r[c+1]+r[p+1]),p=c;return a}hp.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var c=0;c<r[a].length;c++)for(var p=0;p<t;p++)e.vertices.push(r[a][c][p]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var Ym=ye(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.earthRadius=63710088e-1;Ie.factors={centimeters:Ie.earthRadius*100,centimetres:Ie.earthRadius*100,degrees:Ie.earthRadius/111325,feet:Ie.earthRadius*3.28084,inches:Ie.earthRadius*39.37,kilometers:Ie.earthRadius/1e3,kilometres:Ie.earthRadius/1e3,meters:Ie.earthRadius,metres:Ie.earthRadius,miles:Ie.earthRadius/1609.344,millimeters:Ie.earthRadius*1e3,millimetres:Ie.earthRadius*1e3,nauticalmiles:Ie.earthRadius/1852,radians:1,yards:Ie.earthRadius*1.0936};Ie.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Ie.earthRadius,yards:1.0936133};Ie.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Au(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}Ie.feature=Au;function zD(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Vm(t).geometry;case"LineString":return qm(t).geometry;case"Polygon":return Wm(t).geometry;case"MultiPoint":return Ix(t).geometry;case"MultiLineString":return Px(t).geometry;case"MultiPolygon":return Rx(t).geometry;default:throw new Error(r+" is invalid")}}Ie.geometry=zD;function Vm(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!dp(r[0])||!dp(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Au(o,t,e)}Ie.point=Vm;function kD(r,t,e){return e===void 0&&(e={}),gp(r.map(function(o){return Vm(o,t)}),e)}Ie.points=kD;function Wm(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var c=a[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<c[c.length-1].length;p++)if(c[c.length-1][p]!==c[0][p])throw new Error("First and last Position are not equivalent.")}var d={type:"Polygon",coordinates:r};return Au(d,t,e)}Ie.polygon=Wm;function GD(r,t,e){return e===void 0&&(e={}),gp(r.map(function(o){return Wm(o,t)}),e)}Ie.polygons=GD;function qm(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return Au(o,t,e)}Ie.lineString=qm;function HD(r,t,e){return e===void 0&&(e={}),gp(r.map(function(o){return qm(o,t)}),e)}Ie.lineStrings=HD;function gp(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}Ie.featureCollection=gp;function Px(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Au(o,t,e)}Ie.multiLineString=Px;function Ix(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Au(o,t,e)}Ie.multiPoint=Ix;function Rx(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Au(o,t,e)}Ie.multiPolygon=Rx;function VD(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Au(o,t,e)}Ie.geometryCollection=VD;function WD(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}Ie.round=WD;function Lx(r,t){t===void 0&&(t="kilometers");var e=Ie.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}Ie.radiansToLength=Lx;function Xm(r,t){t===void 0&&(t="kilometers");var e=Ie.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}Ie.lengthToRadians=Xm;function qD(r,t){return Nx(Xm(r,t))}Ie.lengthToDegrees=qD;function XD(r){var t=r%360;return t<0&&(t+=360),t}Ie.bearingToAzimuth=XD;function Nx(r){var t=r%(2*Math.PI);return t*180/Math.PI}Ie.radiansToDegrees=Nx;function YD(r){var t=r%360;return t*Math.PI/180}Ie.degreesToRadians=YD;function $D(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return Lx(Xm(r,t),e)}Ie.convertLength=$D;function ZD(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=Ie.areaFactors[t];if(!o)throw new Error("invalid original units");var a=Ie.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}Ie.convertArea=ZD;function dp(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}Ie.isNumber=dp;function JD(r){return!!r&&r.constructor===Object}Ie.isObject=JD;function KD(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!dp(t))throw new Error("bbox must only contain numbers")})}Ie.validateBBox=KD;function QD(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}Ie.validateId=QD});var Zm=ye(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});var ji=Ym();function df(r,t,e){if(r!==null)for(var o,a,c,p,d,g,y,_=0,w=0,x,T=r.type,C=T==="FeatureCollection",I=T==="Feature",M=C?r.features.length:1,E=0;E<M;E++){y=C?r.features[E].geometry:I?r.geometry:r,x=y?y.type==="GeometryCollection":!1,d=x?y.geometries.length:1;for(var L=0;L<d;L++){var A=0,z=0;if(p=x?y.geometries[L]:y,p!==null){g=p.coordinates;var G=p.type;switch(_=e&&(G==="Polygon"||G==="MultiPolygon")?1:0,G){case null:break;case"Point":if(t(g,w,E,A,z)===!1)return!1;w++,A++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],w,E,A,z)===!1)return!1;w++,G==="MultiPoint"&&A++}G==="LineString"&&A++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(a=0;a<g[o].length-_;a++){if(t(g[o][a],w,E,A,z)===!1)return!1;w++}G==="MultiLineString"&&A++,G==="Polygon"&&z++}G==="Polygon"&&A++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(z=0,a=0;a<g[o].length;a++){for(c=0;c<g[o][a].length-_;c++){if(t(g[o][a][c],w,E,A,z)===!1)return!1;w++}z++}A++}break;case"GeometryCollection":for(o=0;o<p.geometries.length;o++)if(df(p.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function jD(r,t,e,o){var a=e;return df(r,function(c,p,d,g,y){p===0&&e===void 0?a=c:a=t(a,c,p,d,g,y)},o),a}function Ox(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function t3(r,t,e){var o=e;return Ox(r,function(a,c){c===0&&e===void 0?o=a:o=t(o,a,c)}),o}function Dx(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function e3(r,t,e){var o=e;return Dx(r,function(a,c){c===0&&e===void 0?o=a:o=t(o,a,c)}),o}function n3(r){var t=[];return df(r,function(e){t.push(e)}),t}function $m(r,t){var e,o,a,c,p,d,g,y,_,w,x=0,T=r.type==="FeatureCollection",C=r.type==="Feature",I=T?r.features.length:1;for(e=0;e<I;e++){for(d=T?r.features[e].geometry:C?r.geometry:r,y=T?r.features[e].properties:C?r.properties:{},_=T?r.features[e].bbox:C?r.bbox:void 0,w=T?r.features[e].id:C?r.id:void 0,g=d?d.type==="GeometryCollection":!1,p=g?d.geometries.length:1,a=0;a<p;a++){if(c=g?d.geometries[a]:d,c===null){if(t(null,x,y,_,w)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,y,_,w)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,y,_,w)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function r3(r,t,e){var o=e;return $m(r,function(a,c,p,d,g){c===0&&e===void 0?o=a:o=t(o,a,c,p,d,g)}),o}function mp(r,t){$m(r,function(e,o,a,c,p){var d=e===null?null:e.type;switch(d){case null:case"Point":case"LineString":case"Polygon":return t(ji.feature(e,a,{bbox:c,id:p}),o,0)===!1?!1:void 0}var g;switch(d){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var y=0;y<e.coordinates.length;y++){var _=e.coordinates[y],w={type:g,coordinates:_};if(t(ji.feature(w,a),o,y)===!1)return!1}})}function i3(r,t,e){var o=e;return mp(r,function(a,c,p){c===0&&p===0&&e===void 0?o=a:o=t(o,a,c,p)}),o}function Fx(r,t){mp(r,function(e,o,a){var c=0;if(e.geometry){var p=e.geometry.type;if(!(p==="Point"||p==="MultiPoint")){var d,g=0,y=0,_=0;if(df(e,function(w,x,T,C,I){if(d===void 0||o>g||C>y||I>_){d=w,g=o,y=C,_=I,c=0;return}var M=ji.lineString([d,w],e.properties);if(t(M,o,a,I,c)===!1)return!1;c++,d=w})===!1)return!1}}})}function o3(r,t,e){var o=e,a=!1;return Fx(r,function(c,p,d,g,y){a===!1&&e===void 0?o=c:o=t(o,c,p,d,g,y),a=!0}),o}function Ux(r,t){if(!r)throw new Error("geojson is required");mp(r,function(e,o,a){if(e.geometry!==null){var c=e.geometry.type,p=e.geometry.coordinates;switch(c){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var d=0;d<p.length;d++)if(t(ji.lineString(p[d],e.properties),o,a,d)===!1)return!1;break}}})}function s3(r,t,e){var o=e;return Ux(r,function(a,c,p,d){c===0&&e===void 0?o=a:o=t(o,a,c,p,d)}),o}function a3(r,t){if(t=t||{},!ji.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,c=t.segmentIndex||0,p=t.properties,d;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),p=p||r.features[e].properties,d=r.features[e].geometry;break;case"Feature":p=p||r.properties,d=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":d=r;break;default:throw new Error("geojson is invalid")}if(d===null)return null;var g=d.coordinates;switch(d.type){case"Point":case"MultiPoint":return null;case"LineString":return c<0&&(c=g.length+c-1),ji.lineString([g[c],g[c+1]],p,t);case"Polygon":return a<0&&(a=g.length+a),c<0&&(c=g[a].length+c-1),ji.lineString([g[a][c],g[a][c+1]],p,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c-1),ji.lineString([g[o][c],g[o][c+1]],p,t);case"MultiPolygon":return o<0&&(o=g.length+o),a<0&&(a=g[o].length+a),c<0&&(c=g[o][a].length-c-1),ji.lineString([g[o][a][c],g[o][a][c+1]],p,t)}throw new Error("geojson is invalid")}function u3(r,t){if(t=t||{},!ji.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,c=t.coordIndex||0,p=t.properties,d;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),p=p||r.features[e].properties,d=r.features[e].geometry;break;case"Feature":p=p||r.properties,d=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":d=r;break;default:throw new Error("geojson is invalid")}if(d===null)return null;var g=d.coordinates;switch(d.type){case"Point":return ji.point(g,p,t);case"MultiPoint":return o<0&&(o=g.length+o),ji.point(g[o],p,t);case"LineString":return c<0&&(c=g.length+c),ji.point(g[c],p,t);case"Polygon":return a<0&&(a=g.length+a),c<0&&(c=g[a].length+c),ji.point(g[a][c],p,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c),ji.point(g[o][c],p,t);case"MultiPolygon":return o<0&&(o=g.length+o),a<0&&(a=g[o].length+a),c<0&&(c=g[o][a].length-c),ji.point(g[o][a][c],p,t)}throw new Error("geojson is invalid")}li.coordAll=n3;li.coordEach=df;li.coordReduce=jD;li.featureEach=Dx;li.featureReduce=e3;li.findPoint=u3;li.findSegment=a3;li.flattenEach=mp;li.flattenReduce=i3;li.geomEach=$m;li.geomReduce=r3;li.lineEach=Ux;li.lineReduce=s3;li.propEach=Ox;li.propReduce=t3;li.segmentEach=Fx;li.segmentReduce=o3});var Bx=ye(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});var l3=Zm();function Jm(r){var t=[1/0,1/0,-1/0,-1/0];return l3.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Jm.default=Jm;Km.default=Jm});var yp=ye((L5,Qm)=>{var ha=Mm(),kx=Ym(),Gx=Zm(),cc=Bx().default,c3=Gx.featureEach,I5=Gx.coordEach,R5=kx.polygon,zx=kx.featureCollection;function Hx(r){var t=new ha(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:cc(e),ha.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:cc(a),o.push(a)}):c3(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:cc(a),o.push(a)}),ha.prototype.load.call(this,o)},t.remove=function(e,o){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:cc(e),ha.prototype.remove.call(this,e,o)},t.clear=function(){return ha.prototype.clear.call(this)},t.search=function(e){var o=ha.prototype.search.call(this,this.toBBox(e));return zx(o)},t.collides=function(e){return ha.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=ha.prototype.all.call(this);return zx(e)},t.toJSON=function(){return ha.prototype.toJSON.call(this)},t.fromJSON=function(e){return ha.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var o;if(e.bbox)o=e.bbox;else if(Array.isArray(e)&&e.length===4)o=e;else if(Array.isArray(e)&&e.length===6)o=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")o=cc(e);else if(e.type==="FeatureCollection")o=cc(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Qm.exports=Hx;Qm.exports.default=Hx});var i0=ye((GV,Qx)=>{"use strict";var Kx=Object.prototype.toString;Qx.exports=function(t){var e=Kx.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Kx.call(t.callee)==="[object Function]"),o}});var aE=ye((HV,sE)=>{"use strict";var oE;Object.keys||(yf=Object.prototype.hasOwnProperty,o0=Object.prototype.toString,jx=i0(),s0=Object.prototype.propertyIsEnumerable,tE=!s0.call({toString:null},"toString"),eE=s0.call(function(){},"prototype"),vf=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],wp=function(r){var t=r.constructor;return t&&t.prototype===r},nE={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},rE=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!nE["$"+r]&&yf.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{wp(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),iE=function(r){if(typeof window=="undefined"||!rE)return wp(r);try{return wp(r)}catch(t){return!1}},oE=function(t){var e=t!==null&&typeof t=="object",o=o0.call(t)==="[object Function]",a=jx(t),c=e&&o0.call(t)==="[object String]",p=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var d=eE&&o;if(c&&t.length>0&&!yf.call(t,0))for(var g=0;g<t.length;++g)p.push(String(g));if(a&&t.length>0)for(var y=0;y<t.length;++y)p.push(String(y));else for(var _ in t)!(d&&_==="prototype")&&yf.call(t,_)&&p.push(String(_));if(tE)for(var w=iE(t),x=0;x<vf.length;++x)!(w&&vf[x]==="constructor")&&yf.call(t,vf[x])&&p.push(vf[x]);return p});var yf,o0,jx,s0,tE,eE,vf,wp,nE,rE,iE;sE.exports=oE});var a0=ye((VV,cE)=>{"use strict";var x3=Array.prototype.slice,E3=i0(),uE=Object.keys,Mp=uE?function(t){return uE(t)}:aE(),lE=Object.keys;Mp.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(o){return E3(o)?lE(x3.call(o)):lE(o)})}else Object.keys=Mp;return Object.keys||Mp};cE.exports=Mp});var u0=ye((WV,fE)=>{"use strict";fE.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var c=Object.getOwnPropertySymbols(t);if(c.length!==1||c[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var p=Object.getOwnPropertyDescriptor(t,e);if(p.value!==a||p.enumerable!==!0)return!1}return!0}});var Sp=ye((qV,hE)=>{"use strict";var w3=u0();hE.exports=function(){return w3()&&!!Symbol.toStringTag}});var gE=ye((XV,dE)=>{"use strict";var pE=typeof Symbol!="undefined"&&Symbol,M3=u0();dE.exports=function(){return typeof pE!="function"||typeof Symbol!="function"||typeof pE("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:M3()}});var vE=ye((YV,yE)=>{"use strict";var mE={foo:{}},S3=Object;yE.exports=function(){return{__proto__:mE}.foo===mE.foo&&!({__proto__:null}instanceof S3)}});var EE=ye(($V,xE)=>{"use strict";var b3="Function.prototype.bind called on incompatible ",T3=Object.prototype.toString,A3=Math.max,C3="[object Function]",_E=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var c=0;c<e.length;c+=1)o[c+t.length]=e[c];return o},P3=function(t,e){for(var o=[],a=e||0,c=0;a<t.length;a+=1,c+=1)o[c]=t[a];return o},I3=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};xE.exports=function(t){var e=this;if(typeof e!="function"||T3.apply(e)!==C3)throw new TypeError(b3+e);for(var o=P3(arguments,1),a,c=function(){if(this instanceof a){var _=e.apply(this,_E(o,arguments));return Object(_)===_?_:this}return e.apply(t,_E(o,arguments))},p=A3(0,e.length-o.length),d=[],g=0;g<p;g++)d[g]="$"+g;if(a=Function("binder","return function ("+I3(d,",")+"){ return binder.apply(this,arguments); }")(c),e.prototype){var y=function(){};y.prototype=e.prototype,a.prototype=new y,y.prototype=null}return a}});var bp=ye((ZV,wE)=>{"use strict";var R3=EE();wE.exports=Function.prototype.bind||R3});var SE=ye((JV,ME)=>{"use strict";var L3=Function.prototype.call,N3=Object.prototype.hasOwnProperty,O3=bp();ME.exports=O3.call(L3,N3)});var ll=ye((KV,PE)=>{"use strict";var Bn,dc=SyntaxError,CE=Function,pc=TypeError,l0=function(r){try{return CE('"use strict"; return ('+r+").constructor;")()}catch(t){}},al=Object.getOwnPropertyDescriptor;if(al)try{al({},"")}catch(r){al=null}var c0=function(){throw new pc},D3=al?function(){try{return arguments.callee,c0}catch(r){try{return al(arguments,"callee").get}catch(t){return c0}}}():c0,fc=gE()(),F3=vE()(),Ti=Object.getPrototypeOf||(F3?function(r){return r.__proto__}:null),hc={},U3=typeof Uint8Array=="undefined"||!Ti?Bn:Ti(Uint8Array),ul={"%AggregateError%":typeof AggregateError=="undefined"?Bn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Bn:ArrayBuffer,"%ArrayIteratorPrototype%":fc&&Ti?Ti([][Symbol.iterator]()):Bn,"%AsyncFromSyncIteratorPrototype%":Bn,"%AsyncFunction%":hc,"%AsyncGenerator%":hc,"%AsyncGeneratorFunction%":hc,"%AsyncIteratorPrototype%":hc,"%Atomics%":typeof Atomics=="undefined"?Bn:Atomics,"%BigInt%":typeof BigInt=="undefined"?Bn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Bn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Bn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Bn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?Bn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Bn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Bn:FinalizationRegistry,"%Function%":CE,"%GeneratorFunction%":hc,"%Int8Array%":typeof Int8Array=="undefined"?Bn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Bn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Bn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":fc&&Ti?Ti(Ti([][Symbol.iterator]())):Bn,"%JSON%":typeof JSON=="object"?JSON:Bn,"%Map%":typeof Map=="undefined"?Bn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!fc||!Ti?Bn:Ti(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Bn:Promise,"%Proxy%":typeof Proxy=="undefined"?Bn:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?Bn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Bn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!fc||!Ti?Bn:Ti(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Bn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":fc&&Ti?Ti(""[Symbol.iterator]()):Bn,"%Symbol%":fc?Symbol:Bn,"%SyntaxError%":dc,"%ThrowTypeError%":D3,"%TypedArray%":U3,"%TypeError%":pc,"%Uint8Array%":typeof Uint8Array=="undefined"?Bn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Bn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Bn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Bn:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?Bn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Bn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Bn:WeakSet};if(Ti)try{null.error}catch(r){bE=Ti(Ti(r)),ul["%Error.prototype%"]=bE}var bE,B3=function r(t){var e;if(t==="%AsyncFunction%")e=l0("async function () {}");else if(t==="%GeneratorFunction%")e=l0("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=l0("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&Ti&&(e=Ti(a.prototype))}return ul[t]=e,e},TE={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},_f=bp(),Tp=SE(),z3=_f.call(Function.call,Array.prototype.concat),k3=_f.call(Function.apply,Array.prototype.splice),AE=_f.call(Function.call,String.prototype.replace),Ap=_f.call(Function.call,String.prototype.slice),G3=_f.call(Function.call,RegExp.prototype.exec),H3=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,V3=/\\\\(\\\\)?/g,W3=function(t){var e=Ap(t,0,1),o=Ap(t,-1);if(e==="%"&&o!=="%")throw new dc("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new dc("invalid intrinsic syntax, expected opening \`%\`");var a=[];return AE(t,H3,function(c,p,d,g){a[a.length]=d?AE(g,V3,"$1"):p||c}),a},q3=function(t,e){var o=t,a;if(Tp(TE,o)&&(a=TE[o],o="%"+a[0]+"%"),Tp(ul,o)){var c=ul[o];if(c===hc&&(c=B3(o)),typeof c=="undefined"&&!e)throw new pc("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:c}}throw new dc("intrinsic "+t+" does not exist!")};PE.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new pc("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new pc('"allowMissing" argument must be a boolean');if(G3(/^%?[^%]*%?$/,t)===null)throw new dc("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=W3(t),a=o.length>0?o[0]:"",c=q3("%"+a+"%",e),p=c.name,d=c.value,g=!1,y=c.alias;y&&(a=y[0],k3(o,z3([0,1],y)));for(var _=1,w=!0;_<o.length;_+=1){var x=o[_],T=Ap(x,0,1),C=Ap(x,-1);if((T==='"'||T==="'"||T==="\`"||C==='"'||C==="'"||C==="\`")&&T!==C)throw new dc("property names with quotes must have matching quotes");if((x==="constructor"||!w)&&(g=!0),a+="."+x,p="%"+a+"%",Tp(ul,p))d=ul[p];else if(d!=null){if(!(x in d)){if(!e)throw new pc("base intrinsic for "+t+" exists, but the property is not available.");return}if(al&&_+1>=o.length){var I=al(d,x);w=!!I,w&&"get"in I&&!("originalValue"in I.get)?d=I.get:d=d[x]}else w=Tp(d,x),d=d[x];w&&!g&&(ul[p]=d)}}return d}});var xf=ye((QV,IE)=>{"use strict";var X3=ll(),f0=X3("%Object.defineProperty%",!0),h0=function(){if(f0)try{return f0({},"a",{value:1}),!0}catch(t){return!1}return!1};h0.hasArrayLengthDefineBug=function(){if(!h0())return null;try{return f0([],"length",{value:1}).length!==1}catch(t){return!0}};IE.exports=h0});var p0=ye((jV,RE)=>{"use strict";var Y3=ll(),Cp=Y3("%Object.getOwnPropertyDescriptor%",!0);if(Cp)try{Cp([],"length")}catch(r){Cp=null}RE.exports=Cp});var Pp=ye((t6,NE)=>{"use strict";var $3=xf()(),d0=ll(),Ef=$3&&d0("%Object.defineProperty%",!0);if(Ef)try{Ef({},"a",{value:1})}catch(r){Ef=!1}var Z3=d0("%SyntaxError%"),gc=d0("%TypeError%"),LE=p0();NE.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new gc("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new gc("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new gc("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new gc("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new gc("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new gc("\`loose\`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,g=!!LE&&LE(t,e);if(Ef)Ef(t,e,{configurable:p===null&&g?g.configurable:!p,enumerable:a===null&&g?g.enumerable:!a,value:o,writable:c===null&&g?g.writable:!c});else if(d||!a&&!c&&!p)t[e]=o;else throw new Z3("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var zE=ye((e6,BE)=>{"use strict";var UE=ll(),OE=Pp(),J3=xf()(),DE=p0(),FE=UE("%TypeError%"),K3=UE("%Math.floor%");BE.exports=function(t,e){if(typeof t!="function")throw new FE("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||K3(e)!==e)throw new FE("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,c=!0;if("length"in t&&DE){var p=DE(t,"length");p&&!p.configurable&&(a=!1),p&&!p.writable&&(c=!1)}return(a||c||!o)&&(J3?OE(t,"length",e,!0,!0):OE(t,"length",e)),t}});var Rp=ye((n6,Ip)=>{"use strict";var g0=bp(),mc=ll(),Q3=zE(),j3=mc("%TypeError%"),GE=mc("%Function.prototype.apply%"),HE=mc("%Function.prototype.call%"),VE=mc("%Reflect.apply%",!0)||g0.call(HE,GE),wf=mc("%Object.defineProperty%",!0),tF=mc("%Math.max%");if(wf)try{wf({},"a",{value:1})}catch(r){wf=null}Ip.exports=function(t){if(typeof t!="function")throw new j3("a function is required");var e=VE(g0,HE,arguments);return Q3(e,1+tF(0,t.length-(arguments.length-1)),!0)};var kE=function(){return VE(g0,GE,arguments)};wf?wf(Ip.exports,"apply",{value:kE}):Ip.exports.apply=kE});var m0=ye((r6,XE)=>{"use strict";var WE=ll(),qE=Rp(),eF=qE(WE("String.prototype.indexOf"));XE.exports=function(t,e){var o=WE(t,!!e);return typeof o=="function"&&eF(t,".prototype.")>-1?qE(o):o}});var ZE=ye((i6,$E)=>{"use strict";var nF=Sp()(),rF=m0(),y0=rF("Object.prototype.toString"),Lp=function(t){return nF&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:y0(t)==="[object Arguments]"},YE=function(t){return Lp(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&y0(t)!=="[object Array]"&&y0(t.callee)==="[object Function]"},iF=function(){return Lp(arguments)}();Lp.isLegacyArguments=YE;$E.exports=iF?Lp:YE});var yc=ye((o6,jE)=>{"use strict";var oF=a0(),sF=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",aF=Object.prototype.toString,uF=Array.prototype.concat,JE=Pp(),lF=function(r){return typeof r=="function"&&aF.call(r)==="[object Function]"},KE=xf()(),cF=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!lF(o)||!o())return}KE?JE(r,t,e,!0):JE(r,t,e)},QE=function(r,t){var e=arguments.length>2?arguments[2]:{},o=oF(t);sF&&(o=uF.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)cF(r,o[a],t[o[a]],e[o[a]])};QE.supportsDescriptors=!!KE;jE.exports=QE});var v0=ye((s6,ew)=>{"use strict";var tw=function(r){return r!==r};ew.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||tw(t)&&tw(e))}});var _0=ye((a6,nw)=>{"use strict";var fF=v0();nw.exports=function(){return typeof Object.is=="function"?Object.is:fF}});var iw=ye((u6,rw)=>{"use strict";var hF=_0(),pF=yc();rw.exports=function(){var t=hF();return pF(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var uw=ye((l6,aw)=>{"use strict";var dF=yc(),gF=Rp(),mF=v0(),ow=_0(),yF=iw(),sw=gF(ow(),Object);dF(sw,{getPolyfill:ow,implementation:mF,shim:yF});aw.exports=sw});var pw=ye((c6,hw)=>{"use strict";var x0=m0(),lw=Sp()(),cw,fw,E0,w0;lw&&(cw=x0("Object.prototype.hasOwnProperty"),fw=x0("RegExp.prototype.exec"),E0={},Np=function(){throw E0},w0={toString:Np,valueOf:Np},typeof Symbol.toPrimitive=="symbol"&&(w0[Symbol.toPrimitive]=Np));var Np,vF=x0("Object.prototype.toString"),_F=Object.getOwnPropertyDescriptor,xF="[object RegExp]";hw.exports=lw?function(t){if(!t||typeof t!="object")return!1;var e=_F(t,"lastIndex"),o=e&&cw(e,"value");if(!o)return!1;try{fw(t,w0)}catch(a){return a===E0}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:vF(t)===xF}});var gw=ye((f6,dw)=>{"use strict";var Sf=function(){return typeof function(){}.name=="string"},Mf=Object.getOwnPropertyDescriptor;if(Mf)try{Mf([],"length")}catch(r){Mf=null}Sf.functionsHaveConfigurableNames=function(){if(!Sf()||!Mf)return!1;var t=Mf(function(){},"name");return!!t&&!!t.configurable};var EF=Function.prototype.bind;Sf.boundFunctionsHaveNames=function(){return Sf()&&typeof EF=="function"&&function(){}.bind().name!==""};dw.exports=Sf});var vw=ye((h6,yw)=>{"use strict";var mw=Pp(),wF=xf()(),MF=gw().functionsHaveConfigurableNames(),SF=TypeError;yw.exports=function(t,e){if(typeof t!="function")throw new SF("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||MF)&&(wF?mw(t,"name",e,!0,!0):mw(t,"name",e)),t}});var M0=ye((p6,_w)=>{"use strict";var bF=vw(),TF=Object,AF=TypeError;_w.exports=bF(function(){if(this!=null&&this!==TF(this))throw new AF("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var S0=ye((d6,xw)=>{"use strict";var CF=M0(),PF=yc().supportsDescriptors,IF=Object.getOwnPropertyDescriptor;xw.exports=function(){if(PF&&/a/mig.flags==="gim"){var t=IF(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return CF}});var Mw=ye((g6,ww)=>{"use strict";var RF=yc().supportsDescriptors,LF=S0(),NF=Object.getOwnPropertyDescriptor,OF=Object.defineProperty,DF=TypeError,Ew=Object.getPrototypeOf,FF=/a/;ww.exports=function(){if(!RF||!Ew)throw new DF("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=LF(),e=Ew(FF),o=NF(e,"flags");return(!o||o.get!==t)&&OF(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Aw=ye((m6,Tw)=>{"use strict";var UF=yc(),BF=Rp(),zF=M0(),Sw=S0(),kF=Mw(),bw=BF(Sw());UF(bw,{getPolyfill:Sw,implementation:zF,shim:kF});Tw.exports=bw});var Pw=ye((y6,Cw)=>{"use strict";var GF=Date.prototype.getDay,HF=function(t){try{return GF.call(t),!0}catch(e){return!1}},VF=Object.prototype.toString,WF="[object Date]",qF=Sp()();Cw.exports=function(t){return typeof t!="object"||t===null?!1:qF?HF(t):VF.call(t)===WF}});var b0=ye((v6,kw)=>{var Iw=a0(),Rw=ZE(),Lw=uw(),Nw=pw(),Ow=Aw(),Dw=Pw(),Fw=Date.prototype.getTime;function zw(r,t,e){var o=e||{};return(o.strict?Lw(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?Lw(r,t):r==t:XF(r,t,o)}function Uw(r){return r==null}function Bw(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function XF(r,t,e){var o,a;if(typeof r!=typeof t||Uw(r)||Uw(t)||r.prototype!==t.prototype||Rw(r)!==Rw(t))return!1;var c=Nw(r),p=Nw(t);if(c!==p)return!1;if(c||p)return r.source===t.source&&Ow(r)===Ow(t);if(Dw(r)&&Dw(t))return Fw.call(r)===Fw.call(t);var d=Bw(r),g=Bw(t);if(d!==g)return!1;if(d||g){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var y=Iw(r),_=Iw(t)}catch(w){return!1}if(y.length!==_.length)return!1;for(y.sort(),_.sort(),o=y.length-1;o>=0;o--)if(y[o]!=_[o])return!1;for(o=y.length-1;o>=0;o--)if(a=y[o],!zw(r[a],t[a],e))return!1;return!0}kw.exports=zw});var U0=ye((SW,Yw)=>{var FU=b0(),pa=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:UU};pa.prototype.compare=function(r,t){if(r.type!==t.type||!Xw(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=qw(r),a=qw(t);return o.every(function(c){return this.some(function(p){return e.compare(c,p)})},a)}}return!1};function qw(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function Xw(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}pa.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};pa.prototype.compareLine=function(r,t,e,o){if(!Xw(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),c=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],c[0])&&(c=this.fixStartIndex(c,a),!c))){var p=this.compareCoord(a[e],c[e]);return this.direction||p?this.comparePath(a,c):this.compareCoord(a[e],c[c.length-(1+e)])?this.comparePath(a.slice().reverse(),c):!1}};pa.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};pa.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};pa.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(c){return this.some(function(p){return a.compareLine(c,p,1,!0)})},o)}else return!1};pa.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};pa.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};pa.prototype.removePseudo=function(r){return r};function UU(r,t){return FU(r,t,{strict:!0})}Yw.exports=pa});var $w=ye((FW,Fp)=>{function Pu(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}Pu.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var c=this._regionQuery(a);if(c.length<this.minPts)this.noise.push(a);else{var p=this.clusters.length;this.clusters.push([]),this._addToCluster(a,p),this._expandCluster(p,c)}}return this.clusters};Pu.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Pu.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};Pu.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};Pu.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};Pu.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};Pu.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Fp!="undefined"&&Fp.exports&&(Fp.exports=Pu)});var Zw=ye((UW,Up)=>{function Iu(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}Iu.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};Iu.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var c=0;c<this.k;c++){for(var p=new Array(_),d=0,g=0;g<_;g++)p[g]=0;for(var y=0;y<e;y++){var _=this.dataset[y].length;if(c===this.assignments[y]){for(var g=0;g<_;g++)p[g]+=this.dataset[y][g];d++}}if(d>0){for(var g=0;g<_;g++)p[g]/=d;this.centroids[c]=p}else this.centroids[c]=this.randomCentroid(),a=!0}}return this.getClusters()};Iu.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};Iu.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};Iu.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};Iu.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,c=t.length,p,d=0;d<c;d++)p=e(r,t[d]),p<o&&(o=p,a=d);return a};Iu.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof Up!="undefined"&&Up.exports&&(Up.exports=Iu)});var B0=ye((BW,Bp)=>{function da(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}da.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};da.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};da.prototype.forEach=function(r){this._queue.forEach(r)};da.prototype.getElements=function(){return this._queue};da.prototype.getElementPriority=function(r){return this._priorities[r]};da.prototype.getPriorities=function(){return this._priorities};da.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};da.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};da.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof Bp!="undefined"&&Bp.exports&&(Bp.exports=da)});var Kw=ye((zW,_c)=>{typeof _c!="undefined"&&_c.exports&&(Jw=B0());var Jw;function Za(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}Za.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,c=this.dataset.length;a<c;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var p=this.clusters.length-1;this._orderedList.push(a);var d=new Jw(null,null,"asc"),g=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,g,d),this._expandCluster(p,d))}return this.clusters};Za.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};Za.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Za.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var c=o.distance(o.dataset[r],o.dataset[a]),p=Math.max(o._coreDistance,c);o._reachability[a]===void 0?(o._reachability[a]=p,e.insert(a,p)):p<o._reachability[a]&&(o._reachability[a]=p,e.remove(a),e.insert(a,p))}})};Za.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var c=e[o];if(this._processed[c]===void 0){var p=this._regionQuery(c);this._processed[c]=1,this.clusters[r].push(c),this._orderedList.push(c),this._distanceToCore(c)!==void 0&&(this._updateQueue(c,p,t),this._expandCluster(r,t))}}};Za.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};Za.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};Za.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof _c!="undefined"&&_c.exports&&(_c.exports=Za)});var Qw=ye((kW,zp)=>{typeof zp!="undefined"&&zp.exports&&(zp.exports={DBSCAN:$w(),KMEANS:Zw(),OPTICS:Kw(),PriorityQueue:B0()})});var z0=ye((XW,tM)=>{"use strict";tM.exports={eudist:function(t,e,o){for(var a=t.length,c=0,p=0;p<a;p++){var d=(t[p]||0)-(e[p]||0);c+=d*d}return o?Math.sqrt(c):c},mandist:function(t,e,o){for(var a=t.length,c=0,p=0;p<a;p++)c+=Math.abs((t[p]||0)-(e[p]||0));return o?Math.sqrt(c):c},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var rM=ye((YW,nM)=>{"use strict";var eM=z0(),VU=eM.eudist,WU=eM.dist;nM.exports={kmrand:function(t,e){for(var o={},a=[],c=e<<2,p=t.length,d=t[0].length>0;a.length<e&&c-- >0;){var g=t[Math.floor(Math.random()*p)],y=d?g.join("_"):""+g;o[y]||(o[y]=!0,a.push(g))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?VU:WU,a=[],c=t.length,p=t[0].length>0,d={},g=t[Math.floor(Math.random()*c)],y=p?g.join("_"):""+g;for(a.push(g),d[y]=!0;a.length<e;){for(var _=[],w=a.length,x=0,T=[],C=0;C<c;C++){for(var I=1/0,M=0;M<w;M++){var E=o(t[C],a[M]);E<=I&&(I=E)}_[C]=I}for(var L=0;L<c;L++)x+=_[L];for(var A=0;A<c;A++)T[A]={i:A,v:t[A],pr:_[A]/x,cs:0};T.sort(function(X,U){return X.pr-U.pr}),T[0].cs=T[0].pr;for(var z=1;z<c;z++)T[z].cs=T[z-1].cs+T[z].pr;for(var G=Math.random(),Y=0;Y<c-1&&T[Y++].cs<G;);a.push(T[Y-1].v)}return a}}});var uM=ye((JW,aM)=>{"use strict";var k0=z0(),sM=rM(),qU=k0.eudist,$W=k0.mandist,ZW=k0.dist,XU=sM.kmrand,YU=sM.kmpp,iM=1e4;function oM(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function $U(r,t,e,o){var a=[],c=[],p=[],d=[],g=!1,y=o||iM,_=r.length,w=r[0].length,x=w>0,T=[];if(e)e=="kmrand"?a=XU(r,t):e=="kmpp"?a=YU(r,t):a=e;else for(var C={};a.length<t;){var I=Math.floor(Math.random()*_);C[I]||(C[I]=!0,a.push(r[I]))}do{oM(t,0,T);for(var M=0;M<_;M++){for(var E=1/0,L=0,A=0;A<t;A++){var d=x?qU(r[M],a[A]):Math.abs(r[M]-a[A]);d<=E&&(E=d,L=A)}p[M]=L,T[L]++}for(var z=[],c=[],G=0,Y=0;Y<t;Y++)z[Y]=x?oM(w,0,z[Y]):0,c[Y]=a[Y];if(x){for(var X=0;X<t;X++)a[X]=[];for(var U=0;U<_;U++)for(var H=p[U],Q=z[H],gt=r[U],$=0;$<w;$++)Q[$]+=gt[$];g=!0;for(var Nt=0;Nt<t;Nt++){for(var j=a[Nt],pt=z[Nt],Ct=c[Nt],Tt=T[Nt],ft=0;ft<w;ft++)j[ft]=pt[ft]/Tt||0;if(g){for(var dt=0;dt<w;dt++)if(Ct[dt]!=j[dt]){g=!1;break}}}}else{for(var Z=0;Z<_;Z++){var st=p[Z];z[st]+=r[Z]}for(var vt=0;vt<t;vt++)a[vt]=z[vt]/T[vt]||0;g=!0;for(var zt=0;zt<t;zt++)if(c[zt]!=a[zt]){g=!1;break}}g=g||--y<=0}while(!g);return{it:iM-y,k:t,idxs:p,centroids:a}}aM.exports=$U});var Sc=ye((X0,Y0)=>{(function(r,t){typeof X0=="object"&&typeof Y0!="undefined"?Y0.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(X0,function(){"use strict";function r(it,B){if(!(it instanceof B))throw new TypeError("Cannot call a class as a function")}function t(it,B){for(var P=0;P<B.length;P++){var F=B[P];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(it,F.key,F)}}function e(it,B,P){return B&&t(it.prototype,B),P&&t(it,P),it}var o=function(){function it(B,P){this.next=null,this.key=B,this.data=P,this.left=null,this.right=null}return it}();function a(it,B){return it>B?1:it<B?-1:0}function c(it,B,P){for(var F=new o(null,null),J=F,rt=F;;){var D=P(it,B.key);if(D<0){if(B.left===null)break;if(P(it,B.left.key)<0){var N=B.left;if(B.left=N.right,N.right=B,B=N,B.left===null)break}rt.left=B,rt=B,B=B.left}else if(D>0){if(B.right===null)break;if(P(it,B.right.key)>0){var N=B.right;if(B.right=N.left,N.left=B,B=N,B.right===null)break}J.right=B,J=B,B=B.right}else break}return J.right=B.left,rt.left=B.right,B.left=F.right,B.right=F.left,B}function p(it,B,P,F){var J=new o(it,B);if(P===null)return J.left=J.right=null,J;P=c(it,P,F);var rt=F(it,P.key);return rt<0?(J.left=P.left,J.right=P,P.left=null):rt>=0&&(J.right=P.right,J.left=P,P.right=null),J}function d(it,B,P){var F=null,J=null;if(B){B=c(it,B,P);var rt=P(B.key,it);rt===0?(F=B.left,J=B.right):rt<0?(J=B.right,B.right=null,F=B):(F=B.left,B.left=null,J=B)}return{left:F,right:J}}function g(it,B,P){return B===null?it:(it===null||(B=c(it.key,B,P),B.left=it),B)}function y(it,B,P,F,J){if(it){F(""+B+(P?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+J(it)+\`
107
107
  \`);var rt=B+(P?" ":"\\u2502 ");it.left&&y(it.left,rt,!1,F,J),it.right&&y(it.right,rt,!0,F,J)}}var _=function(){function it(B){B===void 0&&(B=a),this._root=null,this._size=0,this._comparator=B}return it.prototype.insert=function(B,P){return this._size++,this._root=p(B,P,this._root,this._comparator)},it.prototype.add=function(B,P){var F=new o(B,P);this._root===null&&(F.left=F.right=null,this._size++,this._root=F);var J=this._comparator,rt=c(B,this._root,J),D=J(B,rt.key);return D===0?this._root=rt:(D<0?(F.left=rt.left,F.right=rt,rt.left=null):D>0&&(F.right=rt.right,F.left=rt,rt.right=null),this._size++,this._root=F),this._root},it.prototype.remove=function(B){this._root=this._remove(B,this._root,this._comparator)},it.prototype._remove=function(B,P,F){var J;if(P===null)return null;P=c(B,P,F);var rt=F(B,P.key);return rt===0?(P.left===null?J=P.right:(J=c(B,P.left,F),J.right=P.right),this._size--,J):P},it.prototype.pop=function(){var B=this._root;if(B){for(;B.left;)B=B.left;return this._root=c(B.key,this._root,this._comparator),this._root=this._remove(B.key,this._root,this._comparator),{key:B.key,data:B.data}}return null},it.prototype.findStatic=function(B){for(var P=this._root,F=this._comparator;P;){var J=F(B,P.key);if(J===0)return P;J<0?P=P.left:P=P.right}return null},it.prototype.find=function(B){return this._root&&(this._root=c(B,this._root,this._comparator),this._comparator(B,this._root.key)!==0)?null:this._root},it.prototype.contains=function(B){for(var P=this._root,F=this._comparator;P;){var J=F(B,P.key);if(J===0)return!0;J<0?P=P.left:P=P.right}return!1},it.prototype.forEach=function(B,P){for(var F=this._root,J=[],rt=!1;!rt;)F!==null?(J.push(F),F=F.left):J.length!==0?(F=J.pop(),B.call(P,F),F=F.right):rt=!0;return this},it.prototype.range=function(B,P,F,J){for(var rt=[],D=this._comparator,N=this._root,W;rt.length!==0||N;)if(N)rt.push(N),N=N.left;else{if(N=rt.pop(),W=D(N.key,P),W>0)break;if(D(N.key,B)>=0&&F.call(J,N))return this;N=N.right}return this},it.prototype.keys=function(){var B=[];return this.forEach(function(P){var F=P.key;return B.push(F)}),B},it.prototype.values=function(){var B=[];return this.forEach(function(P){var F=P.data;return B.push(F)}),B},it.prototype.min=function(){return this._root?this.minNode(this._root).key:null},it.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},it.prototype.minNode=function(B){if(B===void 0&&(B=this._root),B)for(;B.left;)B=B.left;return B},it.prototype.maxNode=function(B){if(B===void 0&&(B=this._root),B)for(;B.right;)B=B.right;return B},it.prototype.at=function(B){for(var P=this._root,F=!1,J=0,rt=[];!F;)if(P)rt.push(P),P=P.left;else if(rt.length>0){if(P=rt.pop(),J===B)return P;J++,P=P.right}else F=!0;return null},it.prototype.next=function(B){var P=this._root,F=null;if(B.right){for(F=B.right;F.left;)F=F.left;return F}for(var J=this._comparator;P;){var rt=J(B.key,P.key);if(rt===0)break;rt<0?(F=P,P=P.left):P=P.right}return F},it.prototype.prev=function(B){var P=this._root,F=null;if(B.left!==null){for(F=B.left;F.right;)F=F.right;return F}for(var J=this._comparator;P;){var rt=J(B.key,P.key);if(rt===0)break;rt<0?P=P.left:(F=P,P=P.right)}return F},it.prototype.clear=function(){return this._root=null,this._size=0,this},it.prototype.toList=function(){return T(this._root)},it.prototype.load=function(B,P,F){P===void 0&&(P=[]),F===void 0&&(F=!1);var J=B.length,rt=this._comparator;if(F&&M(B,P,0,J-1,rt),this._root===null)this._root=w(B,P,0,J),this._size=J;else{var D=I(this.toList(),x(B,P),rt);J=this._size+J,this._root=C({head:D},0,J)}return this},it.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(it.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(it.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),it.prototype.toString=function(B){B===void 0&&(B=function(J){return String(J.key)});var P=[];return y(this._root,"",!0,function(F){return P.push(F)},B),P.join("")},it.prototype.update=function(B,P,F){var J=this._comparator,rt=d(B,this._root,J),D=rt.left,N=rt.right;J(B,P)<0?N=p(P,F,N,J):D=p(P,F,D,J),this._root=g(D,N,J)},it.prototype.split=function(B){return d(B,this._root,this._comparator)},it}();function w(it,B,P,F){var J=F-P;if(J>0){var rt=P+Math.floor(J/2),D=it[rt],N=B[rt],W=new o(D,N);return W.left=w(it,B,P,rt),W.right=w(it,B,rt+1,F),W}return null}function x(it,B){for(var P=new o(null,null),F=P,J=0;J<it.length;J++)F=F.next=new o(it[J],B[J]);return F.next=null,P.next}function T(it){for(var B=it,P=[],F=!1,J=new o(null,null),rt=J;!F;)B?(P.push(B),B=B.left):P.length>0?(B=rt=rt.next=P.pop(),B=B.right):F=!0;return rt.next=null,J.next}function C(it,B,P){var F=P-B;if(F>0){var J=B+Math.floor(F/2),rt=C(it,B,J),D=it.head;return D.left=rt,it.head=it.head.next,D.right=C(it,J+1,P),D}return null}function I(it,B,P){for(var F=new o(null,null),J=F,rt=it,D=B;rt!==null&&D!==null;)P(rt.key,D.key)<0?(J.next=rt,rt=rt.next):(J.next=D,D=D.next),J=J.next;return rt!==null?J.next=rt:D!==null&&(J.next=D),F.next}function M(it,B,P,F,J){if(!(P>=F)){for(var rt=it[P+F>>1],D=P-1,N=F+1;;){do D++;while(J(it[D],rt)<0);do N--;while(J(it[N],rt)>0);if(D>=N)break;var W=it[D];it[D]=it[N],it[N]=W,W=B[D],B[D]=B[N],B[N]=W}M(it,B,P,N,J),M(it,B,N+1,F,J)}}var E=function(B,P){return B.ll.x<=P.x&&P.x<=B.ur.x&&B.ll.y<=P.y&&P.y<=B.ur.y},L=function(B,P){if(P.ur.x<B.ll.x||B.ur.x<P.ll.x||P.ur.y<B.ll.y||B.ur.y<P.ll.y)return null;var F=B.ll.x<P.ll.x?P.ll.x:B.ll.x,J=B.ur.x<P.ur.x?B.ur.x:P.ur.x,rt=B.ll.y<P.ll.y?P.ll.y:B.ll.y,D=B.ur.y<P.ur.y?B.ur.y:P.ur.y;return{ll:{x:F,y:rt},ur:{x:J,y:D}}},A=Number.EPSILON;A===void 0&&(A=Math.pow(2,-52));var z=A*A,G=function(B,P){if(-A<B&&B<A&&-A<P&&P<A)return 0;var F=B-P;return F*F<z*B*P?0:B<P?-1:1},Y=function(){function it(){r(this,it),this.reset()}return e(it,[{key:"reset",value:function(){this.xRounder=new X,this.yRounder=new X}},{key:"round",value:function(P,F){return{x:this.xRounder.round(P),y:this.yRounder.round(F)}}}]),it}(),X=function(){function it(){r(this,it),this.tree=new _,this.round(0)}return e(it,[{key:"round",value:function(P){var F=this.tree.add(P),J=this.tree.prev(F);if(J!==null&&G(F.key,J.key)===0)return this.tree.remove(P),J.key;var rt=this.tree.next(F);return rt!==null&&G(F.key,rt.key)===0?(this.tree.remove(P),rt.key):P}}]),it}(),U=new Y,H=function(B,P){return B.x*P.y-B.y*P.x},Q=function(B,P){return B.x*P.x+B.y*P.y},gt=function(B,P,F){var J={x:P.x-B.x,y:P.y-B.y},rt={x:F.x-B.x,y:F.y-B.y},D=H(J,rt);return G(D,0)},$=function(B){return Math.sqrt(Q(B,B))},Nt=function(B,P,F){var J={x:P.x-B.x,y:P.y-B.y},rt={x:F.x-B.x,y:F.y-B.y};return H(rt,J)/$(rt)/$(J)},j=function(B,P,F){var J={x:P.x-B.x,y:P.y-B.y},rt={x:F.x-B.x,y:F.y-B.y};return Q(rt,J)/$(rt)/$(J)},pt=function(B,P,F){return P.y===0?null:{x:B.x+P.x/P.y*(F-B.y),y:F}},Ct=function(B,P,F){return P.x===0?null:{x:F,y:B.y+P.y/P.x*(F-B.x)}},Tt=function(B,P,F,J){if(P.x===0)return Ct(F,J,B.x);if(J.x===0)return Ct(B,P,F.x);if(P.y===0)return pt(F,J,B.y);if(J.y===0)return pt(B,P,F.y);var rt=H(P,J);if(rt==0)return null;var D={x:F.x-B.x,y:F.y-B.y},N=H(D,P)/rt,W=H(D,J)/rt,xt=B.x+W*P.x,wt=F.x+N*J.x,lt=B.y+W*P.y,Bt=F.y+N*J.y,Lt=(xt+wt)/2,Ut=(lt+Bt)/2;return{x:Lt,y:Ut}},ft=function(){e(it,null,[{key:"compare",value:function(P,F){var J=it.comparePoints(P.point,F.point);return J!==0?J:(P.point!==F.point&&P.link(F),P.isLeft!==F.isLeft?P.isLeft?1:-1:Z.compare(P.segment,F.segment))}},{key:"comparePoints",value:function(P,F){return P.x<F.x?-1:P.x>F.x?1:P.y<F.y?-1:P.y>F.y?1:0}}]);function it(B,P){r(this,it),B.events===void 0?B.events=[this]:B.events.push(this),this.point=B,this.isLeft=P}return e(it,[{key:"link",value:function(P){if(P.point===this.point)throw new Error("Tried to link already linked events");for(var F=P.point.events,J=0,rt=F.length;J<rt;J++){var D=F[J];this.point.events.push(D),D.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var P=this.point.events.length,F=0;F<P;F++){var J=this.point.events[F];if(J.segment.consumedBy===void 0)for(var rt=F+1;rt<P;rt++){var D=this.point.events[rt];D.consumedBy===void 0&&J.otherSE.point.events===D.otherSE.point.events&&J.segment.consume(D.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var P=[],F=0,J=this.point.events.length;F<J;F++){var rt=this.point.events[F];rt!==this&&!rt.segment.ringOut&&rt.segment.isInResult()&&P.push(rt)}return P}},{key:"getLeftmostComparator",value:function(P){var F=this,J=new Map,rt=function(N){var W=N.otherSE;J.set(N,{sine:Nt(F.point,P.point,W.point),cosine:j(F.point,P.point,W.point)})};return function(D,N){J.has(D)||rt(D),J.has(N)||rt(N);var W=J.get(D),xt=W.sine,wt=W.cosine,lt=J.get(N),Bt=lt.sine,Lt=lt.cosine;return xt>=0&&Bt>=0?wt<Lt?1:wt>Lt?-1:0:xt<0&&Bt<0?wt<Lt?-1:wt>Lt?1:0:Bt<xt?-1:Bt>xt?1:0}}}]),it}(),dt=0,Z=function(){e(it,null,[{key:"compare",value:function(P,F){var J=P.leftSE.point.x,rt=F.leftSE.point.x,D=P.rightSE.point.x,N=F.rightSE.point.x;if(N<J)return 1;if(D<rt)return-1;var W=P.leftSE.point.y,xt=F.leftSE.point.y,wt=P.rightSE.point.y,lt=F.rightSE.point.y;if(J<rt){if(xt<W&&xt<wt)return 1;if(xt>W&&xt>wt)return-1;var Bt=P.comparePoint(F.leftSE.point);if(Bt<0)return 1;if(Bt>0)return-1;var Lt=F.comparePoint(P.rightSE.point);return Lt!==0?Lt:-1}if(J>rt){if(W<xt&&W<lt)return-1;if(W>xt&&W>lt)return 1;var Ut=F.comparePoint(P.leftSE.point);if(Ut!==0)return Ut;var Xt=P.comparePoint(F.rightSE.point);return Xt<0?1:Xt>0?-1:1}if(W<xt)return-1;if(W>xt)return 1;if(D<N){var de=F.comparePoint(P.rightSE.point);if(de!==0)return de}if(D>N){var Ft=P.comparePoint(F.rightSE.point);if(Ft<0)return 1;if(Ft>0)return-1}if(D!==N){var Se=wt-W,xe=D-J,he=lt-xt,Jt=N-rt;if(Se>xe&&he<Jt)return 1;if(Se<xe&&he>Jt)return-1}return D>N?1:D<N||wt<lt?-1:wt>lt?1:P.id<F.id?-1:P.id>F.id?1:0}}]);function it(B,P,F,J){r(this,it),this.id=++dt,this.leftSE=B,B.segment=this,B.otherSE=P,this.rightSE=P,P.segment=this,P.otherSE=B,this.rings=F,this.windings=J}return e(it,[{key:"replaceRightSE",value:function(P){this.rightSE=P,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var P=this.leftSE.point.y,F=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:P<F?P:F},ur:{x:this.rightSE.point.x,y:P>F?P:F}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(P){return P.x===this.leftSE.point.x&&P.y===this.leftSE.point.y||P.x===this.rightSE.point.x&&P.y===this.rightSE.point.y}},{key:"comparePoint",value:function(P){if(this.isAnEndpoint(P))return 0;var F=this.leftSE.point,J=this.rightSE.point,rt=this.vector();if(F.x===J.x)return P.x===F.x?0:P.x<F.x?1:-1;var D=(P.y-F.y)/rt.y,N=F.x+D*rt.x;if(P.x===N)return 0;var W=(P.x-F.x)/rt.x,xt=F.y+W*rt.y;return P.y===xt?0:P.y<xt?-1:1}},{key:"getIntersection",value:function(P){var F=this.bbox(),J=P.bbox(),rt=L(F,J);if(rt===null)return null;var D=this.leftSE.point,N=this.rightSE.point,W=P.leftSE.point,xt=P.rightSE.point,wt=E(F,W)&&this.comparePoint(W)===0,lt=E(J,D)&&P.comparePoint(D)===0,Bt=E(F,xt)&&this.comparePoint(xt)===0,Lt=E(J,N)&&P.comparePoint(N)===0;if(lt&&wt)return Lt&&!Bt?N:!Lt&&Bt?xt:null;if(lt)return Bt&&D.x===xt.x&&D.y===xt.y?null:D;if(wt)return Lt&&N.x===W.x&&N.y===W.y?null:W;if(Lt&&Bt)return null;if(Lt)return N;if(Bt)return xt;var Ut=Tt(D,this.vector(),W,P.vector());return Ut===null||!E(rt,Ut)?null:U.round(Ut.x,Ut.y)}},{key:"split",value:function(P){var F=[],J=P.events!==void 0,rt=new ft(P,!0),D=new ft(P,!1),N=this.rightSE;this.replaceRightSE(D),F.push(D),F.push(rt);var W=new it(rt,N,this.rings.slice(),this.windings.slice());return ft.comparePoints(W.leftSE.point,W.rightSE.point)>0&&W.swapEvents(),ft.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),J&&(rt.checkForConsuming(),D.checkForConsuming()),F}},{key:"swapEvents",value:function(){var P=this.rightSE;this.rightSE=this.leftSE,this.leftSE=P,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var F=0,J=this.windings.length;F<J;F++)this.windings[F]*=-1}},{key:"consume",value:function(P){for(var F=this,J=P;F.consumedBy;)F=F.consumedBy;for(;J.consumedBy;)J=J.consumedBy;var rt=it.compare(F,J);if(rt!==0){if(rt>0){var D=F;F=J,J=D}if(F.prev===J){var N=F;F=J,J=N}for(var W=0,xt=J.rings.length;W<xt;W++){var wt=J.rings[W],lt=J.windings[W],Bt=F.rings.indexOf(wt);Bt===-1?(F.rings.push(wt),F.windings.push(lt)):F.windings[Bt]+=lt}J.rings=null,J.windings=null,J.consumedBy=F,J.leftSE.consumedBy=F.leftSE,J.rightSE.consumedBy=F.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var P=this.prev.consumedBy||this.prev;this._beforeState=P.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var P=this.beforeState();this._afterState={rings:P.rings.slice(0),windings:P.windings.slice(0),multiPolys:[]};for(var F=this._afterState.rings,J=this._afterState.windings,rt=this._afterState.multiPolys,D=0,N=this.rings.length;D<N;D++){var W=this.rings[D],xt=this.windings[D],wt=F.indexOf(W);wt===-1?(F.push(W),J.push(xt)):J[wt]+=xt}for(var lt=[],Bt=[],Lt=0,Ut=F.length;Lt<Ut;Lt++)if(J[Lt]!==0){var Xt=F[Lt],de=Xt.poly;if(Bt.indexOf(de)===-1)if(Xt.isExterior)lt.push(de);else{Bt.indexOf(de)===-1&&Bt.push(de);var Ft=lt.indexOf(Xt.poly);Ft!==-1&&lt.splice(Ft,1)}}for(var Se=0,xe=lt.length;Se<xe;Se++){var he=lt[Se].multiPoly;rt.indexOf(he)===-1&&rt.push(he)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var P=this.beforeState().multiPolys,F=this.afterState().multiPolys;switch(pe.type){case"union":{var J=P.length===0,rt=F.length===0;this._isInResult=J!==rt;break}case"intersection":{var D,N;P.length<F.length?(D=P.length,N=F.length):(D=F.length,N=P.length),this._isInResult=N===pe.numMultiPolys&&D<N;break}case"xor":{var W=Math.abs(P.length-F.length);this._isInResult=W%2===1;break}case"difference":{var xt=function(lt){return lt.length===1&&lt[0].isSubject};this._isInResult=xt(P)!==xt(F);break}default:throw new Error("Unrecognized operation type found ".concat(pe.type))}return this._isInResult}}],[{key:"fromRing",value:function(P,F,J){var rt,D,N,W=ft.comparePoints(P,F);if(W<0)rt=P,D=F,N=1;else if(W>0)rt=F,D=P,N=-1;else throw new Error("Tried to create degenerate segment at [".concat(P.x,", ").concat(P.y,"]"));var xt=new ft(rt,!0),wt=new ft(D,!1);return new it(xt,wt,[J],[N])}}]),it}(),st=function(){function it(B,P,F){if(r(this,it),!Array.isArray(B)||B.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=P,this.isExterior=F,this.segments=[],typeof B[0][0]!="number"||typeof B[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var J=U.round(B[0][0],B[0][1]);this.bbox={ll:{x:J.x,y:J.y},ur:{x:J.x,y:J.y}};for(var rt=J,D=1,N=B.length;D<N;D++){if(typeof B[D][0]!="number"||typeof B[D][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var W=U.round(B[D][0],B[D][1]);W.x===rt.x&&W.y===rt.y||(this.segments.push(Z.fromRing(rt,W,this)),W.x<this.bbox.ll.x&&(this.bbox.ll.x=W.x),W.y<this.bbox.ll.y&&(this.bbox.ll.y=W.y),W.x>this.bbox.ur.x&&(this.bbox.ur.x=W.x),W.y>this.bbox.ur.y&&(this.bbox.ur.y=W.y),rt=W)}(J.x!==rt.x||J.y!==rt.y)&&this.segments.push(Z.fromRing(rt,J,this))}return e(it,[{key:"getSweepEvents",value:function(){for(var P=[],F=0,J=this.segments.length;F<J;F++){var rt=this.segments[F];P.push(rt.leftSE),P.push(rt.rightSE)}return P}}]),it}(),vt=function(){function it(B,P){if(r(this,it),!Array.isArray(B))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new st(B[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var F=1,J=B.length;F<J;F++){var rt=new st(B[F],this,!1);rt.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=rt.bbox.ll.x),rt.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=rt.bbox.ll.y),rt.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=rt.bbox.ur.x),rt.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=rt.bbox.ur.y),this.interiorRings.push(rt)}this.multiPoly=P}return e(it,[{key:"getSweepEvents",value:function(){for(var P=this.exteriorRing.getSweepEvents(),F=0,J=this.interiorRings.length;F<J;F++)for(var rt=this.interiorRings[F].getSweepEvents(),D=0,N=rt.length;D<N;D++)P.push(rt[D]);return P}}]),it}(),zt=function(){function it(B,P){if(r(this,it),!Array.isArray(B))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof B[0][0][0]=="number"&&(B=[B])}catch(D){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var F=0,J=B.length;F<J;F++){var rt=new vt(B[F],this);rt.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=rt.bbox.ll.x),rt.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=rt.bbox.ll.y),rt.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=rt.bbox.ur.x),rt.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=rt.bbox.ur.y),this.polys.push(rt)}this.isSubject=P}return e(it,[{key:"getSweepEvents",value:function(){for(var P=[],F=0,J=this.polys.length;F<J;F++)for(var rt=this.polys[F].getSweepEvents(),D=0,N=rt.length;D<N;D++)P.push(rt[D]);return P}}]),it}(),bt=function(){e(it,null,[{key:"factory",value:function(P){for(var F=[],J=0,rt=P.length;J<rt;J++){var D=P[J];if(!(!D.isInResult()||D.ringOut)){for(var N=null,W=D.leftSE,xt=D.rightSE,wt=[W],lt=W.point,Bt=[];N=W,W=xt,wt.push(W),W.point!==lt;)for(;;){var Lt=W.getAvailableLinkedEvents();if(Lt.length===0){var Ut=wt[0].point,Xt=wt[wt.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(Ut.x,",")+" ".concat(Ut.y,"]. Last matching segment found ends at")+" [".concat(Xt.x,", ").concat(Xt.y,"]."))}if(Lt.length===1){xt=Lt[0].otherSE;break}for(var de=null,Ft=0,Se=Bt.length;Ft<Se;Ft++)if(Bt[Ft].point===W.point){de=Ft;break}if(de!==null){var xe=Bt.splice(de)[0],he=wt.splice(xe.index);he.unshift(he[0].otherSE),F.push(new it(he.reverse()));continue}Bt.push({index:wt.length,point:W.point});var Jt=W.getLeftmostComparator(N);xt=Lt.sort(Jt)[0].otherSE;break}F.push(new it(wt))}}return F}}]);function it(B){r(this,it),this.events=B;for(var P=0,F=B.length;P<F;P++)B[P].segment.ringOut=this;this.poly=null}return e(it,[{key:"getGeom",value:function(){for(var P=this.events[0].point,F=[P],J=1,rt=this.events.length-1;J<rt;J++){var D=this.events[J].point,N=this.events[J+1].point;gt(D,P,N)!==0&&(F.push(D),P=D)}if(F.length===1)return null;var W=F[0],xt=F[1];gt(W,P,xt)===0&&F.shift(),F.push(F[0]);for(var wt=this.isExteriorRing()?1:-1,lt=this.isExteriorRing()?0:F.length-1,Bt=this.isExteriorRing()?F.length:-1,Lt=[],Ut=lt;Ut!=Bt;Ut+=wt)Lt.push([F[Ut].x,F[Ut].y]);return Lt}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var P=this.enclosingRing();this._isExteriorRing=P?!P.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var P=this.events[0],F=1,J=this.events.length;F<J;F++){var rt=this.events[F];ft.compare(P,rt)>0&&(P=rt)}for(var D=P.segment.prevInResult(),N=D?D.prevInResult():null;;){if(!D)return null;if(!N)return D.ringOut;if(N.ringOut!==D.ringOut)return N.ringOut.enclosingRing()!==D.ringOut?D.ringOut:D.ringOut.enclosingRing();D=N.prevInResult(),N=D?D.prevInResult():null}}}]),it}(),qt=function(){function it(B){r(this,it),this.exteriorRing=B,B.poly=this,this.interiorRings=[]}return e(it,[{key:"addInterior",value:function(P){this.interiorRings.push(P),P.poly=this}},{key:"getGeom",value:function(){var P=[this.exteriorRing.getGeom()];if(P[0]===null)return null;for(var F=0,J=this.interiorRings.length;F<J;F++){var rt=this.interiorRings[F].getGeom();rt!==null&&P.push(rt)}return P}}]),it}(),le=function(){function it(B){r(this,it),this.rings=B,this.polys=this._composePolys(B)}return e(it,[{key:"getGeom",value:function(){for(var P=[],F=0,J=this.polys.length;F<J;F++){var rt=this.polys[F].getGeom();rt!==null&&P.push(rt)}return P}},{key:"_composePolys",value:function(P){for(var F=[],J=0,rt=P.length;J<rt;J++){var D=P[J];if(!D.poly)if(D.isExteriorRing())F.push(new qt(D));else{var N=D.enclosingRing();N.poly||F.push(new qt(N)),N.poly.addInterior(D)}}return F}}]),it}(),se=function(){function it(B){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Z.compare;r(this,it),this.queue=B,this.tree=new _(P),this.segments=[]}return e(it,[{key:"process",value:function(P){var F=P.segment,J=[];if(P.consumedBy)return P.isLeft?this.queue.remove(P.otherSE):this.tree.remove(F),J;var rt=P.isLeft?this.tree.insert(F):this.tree.find(F);if(!rt)throw new Error("Unable to find segment #".concat(F.id," ")+"[".concat(F.leftSE.point.x,", ").concat(F.leftSE.point.y,"] -> ")+"[".concat(F.rightSE.point.x,", ").concat(F.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var D=rt,N=rt,W=void 0,xt=void 0;W===void 0;)D=this.tree.prev(D),D===null?W=null:D.key.consumedBy===void 0&&(W=D.key);for(;xt===void 0;)N=this.tree.next(N),N===null?xt=null:N.key.consumedBy===void 0&&(xt=N.key);if(P.isLeft){var wt=null;if(W){var lt=W.getIntersection(F);if(lt!==null&&(F.isAnEndpoint(lt)||(wt=lt),!W.isAnEndpoint(lt)))for(var Bt=this._splitSafely(W,lt),Lt=0,Ut=Bt.length;Lt<Ut;Lt++)J.push(Bt[Lt])}var Xt=null;if(xt){var de=xt.getIntersection(F);if(de!==null&&(F.isAnEndpoint(de)||(Xt=de),!xt.isAnEndpoint(de)))for(var Ft=this._splitSafely(xt,de),Se=0,xe=Ft.length;Se<xe;Se++)J.push(Ft[Se])}if(wt!==null||Xt!==null){var he=null;if(wt===null)he=Xt;else if(Xt===null)he=wt;else{var Jt=ft.comparePoints(wt,Xt);he=Jt<=0?wt:Xt}this.queue.remove(F.rightSE),J.push(F.rightSE);for(var et=F.split(he),kt=0,ct=et.length;kt<ct;kt++)J.push(et[kt])}J.length>0?(this.tree.remove(F),J.push(P)):(this.segments.push(F),F.prev=W)}else{if(W&&xt){var jt=W.getIntersection(xt);if(jt!==null){if(!W.isAnEndpoint(jt))for(var Kt=this._splitSafely(W,jt),Mt=0,me=Kt.length;Mt<me;Mt++)J.push(Kt[Mt]);if(!xt.isAnEndpoint(jt))for(var be=this._splitSafely(xt,jt),Jn=0,$e=be.length;Jn<$e;Jn++)J.push(be[Jn])}}this.tree.remove(F)}return J}},{key:"_splitSafely",value:function(P,F){this.tree.remove(P);var J=P.rightSE;this.queue.remove(J);var rt=P.split(F);return rt.push(J),P.consumedBy===void 0&&this.tree.insert(P),rt}}]),it}(),Zt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,_e=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Vt=function(){function it(){r(this,it)}return e(it,[{key:"run",value:function(P,F,J){pe.type=P,U.reset();for(var rt=[new zt(F,!0)],D=0,N=J.length;D<N;D++)rt.push(new zt(J[D],!1));if(pe.numMultiPolys=rt.length,pe.type==="difference")for(var W=rt[0],xt=1;xt<rt.length;)L(rt[xt].bbox,W.bbox)!==null?xt++:rt.splice(xt,1);if(pe.type==="intersection"){for(var wt=0,lt=rt.length;wt<lt;wt++)for(var Bt=rt[wt],Lt=wt+1,Ut=rt.length;Lt<Ut;Lt++)if(L(Bt.bbox,rt[Lt].bbox)===null)return[]}for(var Xt=new _(ft.compare),de=0,Ft=rt.length;de<Ft;de++)for(var Se=rt[de].getSweepEvents(),xe=0,he=Se.length;xe<he;xe++)if(Xt.insert(Se[xe]),Xt.size>Zt)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var Jt=new se(Xt),et=Xt.size,kt=Xt.pop();kt;){var ct=kt.key;if(Xt.size===et){var jt=ct.segment;throw new Error("Unable to pop() ".concat(ct.isLeft?"left":"right"," SweepEvent ")+"[".concat(ct.point.x,", ").concat(ct.point.y,"] from segment #").concat(jt.id," ")+"[".concat(jt.leftSE.point.x,", ").concat(jt.leftSE.point.y,"] -> ")+"[".concat(jt.rightSE.point.x,", ").concat(jt.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(Xt.size>Zt)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(Jt.segments.length>_e)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var Kt=Jt.process(ct),Mt=0,me=Kt.length;Mt<me;Mt++){var be=Kt[Mt];be.consumedBy===void 0&&Xt.insert(be)}et=Xt.size,kt=Xt.pop()}U.reset();var Jn=bt.factory(Jt.segments),$e=new le(Jn);return $e.getGeom()}}]),it}(),pe=new Vt,at=function(B){for(var P=arguments.length,F=new Array(P>1?P-1:0),J=1;J<P;J++)F[J-1]=arguments[J];return pe.run("union",B,F)},He=function(B){for(var P=arguments.length,F=new Array(P>1?P-1:0),J=1;J<P;J++)F[J-1]=arguments[J];return pe.run("intersection",B,F)},ae=function(B){for(var P=arguments.length,F=new Array(P>1?P-1:0),J=1;J<P;J++)F[J-1]=arguments[J];return pe.run("xor",B,F)},ce=function(B){for(var P=arguments.length,F=new Array(P>1?P-1:0),J=1;J<P;J++)F[J-1]=arguments[J];return pe.run("difference",B,F)},fe={union:at,intersection:He,xor:ae,difference:ce};return fe})});var AM=ye((Vp,TM)=>{(function(r,t){typeof Vp=="object"&&typeof TM!="undefined"?t(Vp):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(Vp,function(r){"use strict";function t(){}function e(n){this.message=n||""}function o(n){this.message=n||""}function a(n){this.message=n||""}function c(){}function p(n){return n===null?eo:n.color}function d(n){return n===null?null:n.parent}function g(n,i){n!==null&&(n.color=i)}function y(n){return n===null?null:n.left}function _(n){return n===null?null:n.right}function w(){this.root_=null,this.size_=0}function x(){}function T(){this.array_=[],arguments[0]instanceof Jt&&this.addAll(arguments[0])}function C(){}function I(n){this.message=n||""}function M(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(n){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),s=Math.max(Math.min(i.length,9007199254740991),0)||0,l=1 in arguments&&parseInt(Number(arguments[1]),10)||0;l=l<0?Math.max(s+l,0):Math.min(l,s);var h=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:s;for(h=h<0?Math.max(s+arguments[2],0):Math.min(h,s);l<h;)i[l]=n,++l;return i},writable:!0}),Number.isFinite=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},Number.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(n){return n!=n},Math.trunc=Math.trunc||function(n){return n<0?Math.ceil(n):Math.floor(n)};var E=function(){};E.prototype.interfaces_=function(){return[]},E.prototype.getClass=function(){return E},E.prototype.equalsWithTolerance=function(n,i,s){return Math.abs(n-i)<=s};var L=function(n){function i(s){n.call(this,s),this.name="IllegalArgumentException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),A=function(){},z={MAX_VALUE:{configurable:!0}};A.isNaN=function(n){return Number.isNaN(n)},A.doubleToLongBits=function(n){return n},A.longBitsToDouble=function(n){return n},A.isInfinite=function(n){return!Number.isFinite(n)},z.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(A,z);var G=function(){},Y=function(){},X=function(){},U=function n(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=n.NULL_ORDINATE;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.z=i.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=n.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},H={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};U.prototype.setOrdinate=function(n,i){switch(n){case U.X:this.x=i;break;case U.Y:this.y=i;break;case U.Z:this.z=i;break;default:throw new L("Invalid ordinate index: "+n)}},U.prototype.equals2D=function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var i=arguments[0],s=arguments[1];return!!E.equalsWithTolerance(this.x,i.x,s)&&!!E.equalsWithTolerance(this.y,i.y,s)}},U.prototype.getOrdinate=function(n){switch(n){case U.X:return this.x;case U.Y:return this.y;case U.Z:return this.z}throw new L("Invalid ordinate index: "+n)},U.prototype.equals3D=function(n){return this.x===n.x&&this.y===n.y&&(this.z===n.z||A.isNaN(this.z))&&A.isNaN(n.z)},U.prototype.equals=function(n){return n instanceof U&&this.equals2D(n)},U.prototype.equalInZ=function(n,i){return E.equalsWithTolerance(this.z,n.z,i)},U.prototype.compareTo=function(n){var i=n;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},U.prototype.clone=function(){},U.prototype.copy=function(){return new U(this)},U.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},U.prototype.distance3D=function(n){var i=this.x-n.x,s=this.y-n.y,l=this.z-n.z;return Math.sqrt(i*i+s*s+l*l)},U.prototype.distance=function(n){var i=this.x-n.x,s=this.y-n.y;return Math.sqrt(i*i+s*s)},U.prototype.hashCode=function(){var n=17;return n=37*n+U.hashCode(this.x),n=37*n+U.hashCode(this.y)},U.prototype.setCoordinate=function(n){this.x=n.x,this.y=n.y,this.z=n.z},U.prototype.interfaces_=function(){return[G,Y,t]},U.prototype.getClass=function(){return U},U.hashCode=function(){if(arguments.length===1){var n=arguments[0],i=A.doubleToLongBits(n);return Math.trunc((i^i)>>>32)}},H.DimensionalComparator.get=function(){return Q},H.serialVersionUID.get=function(){return 6683108902428367e3},H.NULL_ORDINATE.get=function(){return A.NaN},H.X.get=function(){return 0},H.Y.get=function(){return 1},H.Z.get=function(){return 2},Object.defineProperties(U,H);var Q=function(n){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new L("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};Q.prototype.compare=function(n,i){var s=n,l=i,h=Q.compare(s.x,l.x);if(h!==0)return h;var v=Q.compare(s.y,l.y);return v!==0?v:this._dimensionsToTest<=2?0:Q.compare(s.z,l.z)},Q.prototype.interfaces_=function(){return[X]},Q.prototype.getClass=function(){return Q},Q.compare=function(n,i){return n<i?-1:n>i?1:A.isNaN(n)?A.isNaN(i)?0:-1:A.isNaN(i)?1:0};var gt=function(){};gt.prototype.create=function(){},gt.prototype.interfaces_=function(){return[]},gt.prototype.getClass=function(){return gt};var $=function(){},Nt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};$.prototype.interfaces_=function(){return[]},$.prototype.getClass=function(){return $},$.toLocationSymbol=function(n){switch(n){case $.EXTERIOR:return"e";case $.BOUNDARY:return"b";case $.INTERIOR:return"i";case $.NONE:return"-"}throw new L("Unknown location value: "+n)},Nt.INTERIOR.get=function(){return 0},Nt.BOUNDARY.get=function(){return 1},Nt.EXTERIOR.get=function(){return 2},Nt.NONE.get=function(){return-1},Object.defineProperties($,Nt);var j=function(n,i){return n.interfaces_&&n.interfaces_().indexOf(i)>-1},pt=function(){},Ct={LOG_10:{configurable:!0}};pt.prototype.interfaces_=function(){return[]},pt.prototype.getClass=function(){return pt},pt.log10=function(n){var i=Math.log(n);return A.isInfinite(i)||A.isNaN(i)?i:i/pt.LOG_10},pt.min=function(n,i,s,l){var h=n;return i<h&&(h=i),s<h&&(h=s),l<h&&(h=l),h},pt.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1],s=arguments[2];return n<i?i:n>s?s:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var l=arguments[0],h=arguments[1],v=arguments[2];return l<h?h:l>v?v:l}},pt.wrap=function(n,i){return n<0?i- -n%i:n%i},pt.max=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],l=n;return i>l&&(l=i),s>l&&(l=s),l}if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3],V=h;return v>V&&(V=v),S>V&&(V=S),R>V&&(V=R),V}},pt.average=function(n,i){return(n+i)/2},Ct.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(pt,Ct);var Tt=function(n){this.str=n};Tt.prototype.append=function(n){this.str+=n},Tt.prototype.setCharAt=function(n,i){this.str=this.str.substr(0,n)+i+this.str.substr(n+1)},Tt.prototype.toString=function(n){return this.str};var ft=function(n){this.value=n};ft.prototype.intValue=function(){return this.value},ft.prototype.compareTo=function(n){return this.value<n?-1:this.value>n?1:0},ft.isNaN=function(n){return Number.isNaN(n)};var dt=function(){};dt.isWhitespace=function(n){return n<=32&&n>=0||n===127},dt.toUpperCase=function(n){return n.toUpperCase()};var Z=function n(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}else if(typeof arguments[0]=="string"){var l=arguments[0];n.call(this,n.parse(l))}}else if(arguments.length===2){var h=arguments[0],v=arguments[1];this.init(h,v)}},st={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};Z.prototype.le=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<=n._lo},Z.prototype.extractSignificantDigits=function(n,i){var s=this.abs(),l=Z.magnitude(s._hi),h=Z.TEN.pow(l);(s=s.divide(h)).gt(Z.TEN)?(s=s.divide(Z.TEN),l+=1):s.lt(Z.ONE)&&(s=s.multiply(Z.TEN),l-=1);for(var v=l+1,S=new Tt,R=Z.MAX_PRINT_DIGITS-1,V=0;V<=R;V++){n&&V===v&&S.append(".");var nt=Math.trunc(s._hi);if(nt<0)break;var _t=!1,Et=0;nt>9?(_t=!0,Et="9"):Et="0"+nt,S.append(Et),s=s.subtract(Z.valueOf(nt)).multiply(Z.TEN),_t&&s.selfAdd(Z.TEN);var Wt=!0,$t=Z.magnitude(s._hi);if($t<0&&Math.abs($t)>=R-V&&(Wt=!1),!Wt)break}return i[0]=l,S.toString()},Z.prototype.sqr=function(){return this.multiply(this)},Z.prototype.doubleValue=function(){return this._hi+this._lo},Z.prototype.subtract=function(){if(arguments[0]instanceof Z){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},Z.prototype.equals=function(){if(arguments.length===1){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}},Z.prototype.isZero=function(){return this._hi===0&&this._lo===0},Z.prototype.selfSubtract=function(){if(arguments[0]instanceof Z){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},Z.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},Z.prototype.min=function(n){return this.le(n)?this:n},Z.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof Z){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1],h=null,v=null,S=null,R=null,V=null,nt=null,_t=null,Et=null;return V=this._hi/s,nt=Z.SPLIT*V,h=nt-V,Et=Z.SPLIT*s,h=nt-h,v=V-h,S=Et-s,_t=V*s,S=Et-S,R=s-S,Et=h*S-_t+h*R+v*S+v*R,nt=(this._hi-_t-Et+this._lo-V*l)/s,Et=V+nt,this._hi=Et,this._lo=V-Et+nt,this}},Z.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},Z.prototype.divide=function(){if(arguments[0]instanceof Z){var n=arguments[0],i=null,s=null,l=null,h=null,v=null,S=null,R=null,V=null;return s=(v=this._hi/n._hi)-(i=(S=Z.SPLIT*v)-(i=S-v)),V=i*(l=(V=Z.SPLIT*n._hi)-(l=V-n._hi))-(R=v*n._hi)+i*(h=n._hi-l)+s*l+s*h,S=(this._hi-R-V+this._lo-v*n._lo)/n._hi,new Z(V=v+S,v-V+S)}if(typeof arguments[0]=="number"){var nt=arguments[0];return A.isNaN(nt)?Z.createNaN():Z.copy(this).selfDivide(nt,0)}},Z.prototype.ge=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>=n._lo},Z.prototype.pow=function(n){if(n===0)return Z.valueOf(1);var i=new Z(this),s=Z.valueOf(1),l=Math.abs(n);if(l>1)for(;l>0;)l%2==1&&s.selfMultiply(i),(l/=2)>0&&(i=i.sqr());else s=i;return n<0?s.reciprocal():s},Z.prototype.ceil=function(){if(this.isNaN())return Z.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new Z(n,i)},Z.prototype.compareTo=function(n){var i=n;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},Z.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},Z.prototype.setValue=function(){if(arguments[0]instanceof Z){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},Z.prototype.max=function(n){return this.ge(n)?this:n},Z.prototype.sqrt=function(){if(this.isZero())return Z.valueOf(0);if(this.isNegative())return Z.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,s=Z.valueOf(i),l=this.subtract(s.sqr())._hi*(.5*n);return s.add(l)},Z.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof Z){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],s=null,l=null,h=null,v=null,S=null,R=null;return h=this._hi+i,S=h-this._hi,v=h-S,v=i-S+(this._hi-v),R=v+this._lo,s=h+R,l=R+(h-s),this._hi=s+l,this._lo=l+(s-this._hi),this}}else if(arguments.length===2){var V=arguments[0],nt=arguments[1],_t=null,Et=null,Wt=null,$t=null,ie=null,Ee=null,An=null;$t=this._hi+V,Et=this._lo+nt,ie=$t-(Ee=$t-this._hi),Wt=Et-(An=Et-this._lo);var Wn=(_t=$t+(Ee=(ie=V-Ee+(this._hi-ie))+Et))+(Ee=(Wt=nt-An+(this._lo-Wt))+(Ee+($t-_t))),Qr=Ee+(_t-Wn);return this._hi=Wn,this._lo=Qr,this}},Z.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof Z){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1],h=null,v=null,S=null,R=null,V=null,nt=null;h=(V=Z.SPLIT*this._hi)-this._hi,nt=Z.SPLIT*s,h=V-h,v=this._hi-h,S=nt-s;var _t=(V=this._hi*s)+(nt=h*(S=nt-S)-V+h*(R=s-S)+v*S+v*R+(this._hi*l+this._lo*s)),Et=nt+(h=V-_t);return this._hi=_t,this._lo=Et,this}},Z.prototype.selfSqr=function(){return this.selfMultiply(this)},Z.prototype.floor=function(){if(this.isNaN())return Z.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new Z(n,i)},Z.prototype.negate=function(){return this.isNaN()?this:new Z(-this._hi,-this._lo)},Z.prototype.clone=function(){},Z.prototype.multiply=function(){if(arguments[0]instanceof Z){var n=arguments[0];return n.isNaN()?Z.createNaN():Z.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return A.isNaN(i)?Z.createNaN():Z.copy(this).selfMultiply(i,0)}},Z.prototype.isNaN=function(){return A.isNaN(this._hi)},Z.prototype.intValue=function(){return Math.trunc(this._hi)},Z.prototype.toString=function(){var n=Z.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()},Z.prototype.toStandardNotation=function(){var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!0,i),l=i[0]+1,h=s;if(s.charAt(0)===".")h="0"+s;else if(l<0)h="0."+Z.stringOfChar("0",-l)+s;else if(s.indexOf(".")===-1){var v=l-s.length;h=s+Z.stringOfChar("0",v)+".0"}return this.isNegative()?"-"+h:h},Z.prototype.reciprocal=function(){var n=null,i=null,s=null,l=null,h=null,v=null,S=null,R=null;i=(h=1/this._hi)-(n=(v=Z.SPLIT*h)-(n=v-h)),s=(R=Z.SPLIT*this._hi)-this._hi;var V=h+(v=(1-(S=h*this._hi)-(R=n*(s=R-s)-S+n*(l=this._hi-s)+i*s+i*l)-h*this._lo)/this._hi);return new Z(V,h-V+v)},Z.prototype.toSciNotation=function(){if(this.isZero())return Z.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!1,i),l=Z.SCI_NOT_EXPONENT_CHAR+i[0];if(s.charAt(0)==="0")throw new Error("Found leading zero: "+s);var h="";s.length>1&&(h=s.substring(1));var v=s.charAt(0)+"."+h;return this.isNegative()?"-"+v+l:v+l},Z.prototype.abs=function(){return this.isNaN()?Z.NaN:this.isNegative()?this.negate():new Z(this)},Z.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},Z.prototype.lt=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<n._lo},Z.prototype.add=function(){if(arguments[0]instanceof Z){var n=arguments[0];return Z.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return Z.copy(this).selfAdd(i)}},Z.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof Z){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this._hi=s,this._lo=l}},Z.prototype.gt=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>n._lo},Z.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},Z.prototype.trunc=function(){return this.isNaN()?Z.NaN:this.isPositive()?this.floor():this.ceil()},Z.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},Z.prototype.interfaces_=function(){return[t,G,Y]},Z.prototype.getClass=function(){return Z},Z.sqr=function(n){return Z.valueOf(n).selfMultiply(n)},Z.valueOf=function(){if(typeof arguments[0]=="string"){var n=arguments[0];return Z.parse(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return new Z(i)}},Z.sqrt=function(n){return Z.valueOf(n).sqrt()},Z.parse=function(n){for(var i=0,s=n.length;dt.isWhitespace(n.charAt(i));)i++;var l=!1;if(i<s){var h=n.charAt(i);h!=="-"&&h!=="+"||(i++,h==="-"&&(l=!0))}for(var v=new Z,S=0,R=0,V=0;!(i>=s);){var nt=n.charAt(i);if(i++,dt.isDigit(nt)){var _t=nt-"0";v.selfMultiply(Z.TEN),v.selfAdd(_t),S++}else{if(nt!=="."){if(nt==="e"||nt==="E"){var Et=n.substring(i);try{V=ft.parseInt(Et)}catch(An){throw An instanceof Error?new Error("Invalid exponent "+Et+" in string "+n):An}break}throw new Error("Unexpected character '"+nt+"' at position "+i+" in string "+n)}R=S}}var Wt=v,$t=S-R-V;if($t===0)Wt=v;else if($t>0){var ie=Z.TEN.pow($t);Wt=v.divide(ie)}else if($t<0){var Ee=Z.TEN.pow(-$t);Wt=v.multiply(Ee)}return l?Wt.negate():Wt},Z.createNaN=function(){return new Z(A.NaN,A.NaN)},Z.copy=function(n){return new Z(n)},Z.magnitude=function(n){var i=Math.abs(n),s=Math.log(i)/Math.log(10),l=Math.trunc(Math.floor(s));return 10*Math.pow(10,l)<=i&&(l+=1),l},Z.stringOfChar=function(n,i){for(var s=new Tt,l=0;l<i;l++)s.append(n);return s.toString()},st.PI.get=function(){return new Z(3.141592653589793,12246467991473532e-32)},st.TWO_PI.get=function(){return new Z(6.283185307179586,24492935982947064e-32)},st.PI_2.get=function(){return new Z(1.5707963267948966,6123233995736766e-32)},st.E.get=function(){return new Z(2.718281828459045,14456468917292502e-32)},st.NaN.get=function(){return new Z(A.NaN,A.NaN)},st.EPS.get=function(){return 123259516440783e-46},st.SPLIT.get=function(){return 134217729},st.MAX_PRINT_DIGITS.get=function(){return 32},st.TEN.get=function(){return Z.valueOf(10)},st.ONE.get=function(){return Z.valueOf(1)},st.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},st.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(Z,st);var vt=function(){},zt={DP_SAFE_EPSILON:{configurable:!0}};vt.prototype.interfaces_=function(){return[]},vt.prototype.getClass=function(){return vt},vt.orientationIndex=function(n,i,s){var l=vt.orientationIndexFilter(n,i,s);if(l<=1)return l;var h=Z.valueOf(i.x).selfAdd(-n.x),v=Z.valueOf(i.y).selfAdd(-n.y),S=Z.valueOf(s.x).selfAdd(-i.x),R=Z.valueOf(s.y).selfAdd(-i.y);return h.selfMultiply(R).selfSubtract(v.selfMultiply(S)).signum()},vt.signOfDet2x2=function(n,i,s,l){return n.multiply(l).selfSubtract(i.multiply(s)).signum()},vt.intersection=function(n,i,s,l){var h=Z.valueOf(l.y).selfSubtract(s.y).selfMultiply(Z.valueOf(i.x).selfSubtract(n.x)),v=Z.valueOf(l.x).selfSubtract(s.x).selfMultiply(Z.valueOf(i.y).selfSubtract(n.y)),S=h.subtract(v),R=Z.valueOf(l.x).selfSubtract(s.x).selfMultiply(Z.valueOf(n.y).selfSubtract(s.y)),V=Z.valueOf(l.y).selfSubtract(s.y).selfMultiply(Z.valueOf(n.x).selfSubtract(s.x)),nt=R.subtract(V).selfDivide(S).doubleValue(),_t=Z.valueOf(n.x).selfAdd(Z.valueOf(i.x).selfSubtract(n.x).selfMultiply(nt)).doubleValue(),Et=Z.valueOf(i.x).selfSubtract(n.x).selfMultiply(Z.valueOf(n.y).selfSubtract(s.y)),Wt=Z.valueOf(i.y).selfSubtract(n.y).selfMultiply(Z.valueOf(n.x).selfSubtract(s.x)),$t=Et.subtract(Wt).selfDivide(S).doubleValue(),ie=Z.valueOf(s.y).selfAdd(Z.valueOf(l.y).selfSubtract(s.y).selfMultiply($t)).doubleValue();return new U(_t,ie)},vt.orientationIndexFilter=function(n,i,s){var l=null,h=(n.x-s.x)*(i.y-s.y),v=(n.y-s.y)*(i.x-s.x),S=h-v;if(h>0){if(v<=0)return vt.signum(S);l=h+v}else{if(!(h<0)||v>=0)return vt.signum(S);l=-h-v}var R=vt.DP_SAFE_EPSILON*l;return S>=R||-S>=R?vt.signum(S):2},vt.signum=function(n){return n>0?1:n<0?-1:0},zt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(vt,zt);var bt=function(){},qt={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};qt.X.get=function(){return 0},qt.Y.get=function(){return 1},qt.Z.get=function(){return 2},qt.M.get=function(){return 3},bt.prototype.setOrdinate=function(n,i,s){},bt.prototype.size=function(){},bt.prototype.getOrdinate=function(n,i){},bt.prototype.getCoordinate=function(){},bt.prototype.getCoordinateCopy=function(n){},bt.prototype.getDimension=function(){},bt.prototype.getX=function(n){},bt.prototype.clone=function(){},bt.prototype.expandEnvelope=function(n){},bt.prototype.copy=function(){},bt.prototype.getY=function(n){},bt.prototype.toCoordinateArray=function(){},bt.prototype.interfaces_=function(){return[Y]},bt.prototype.getClass=function(){return bt},Object.defineProperties(bt,qt);var le=function(){},se=function(n){function i(){n.call(this,"Projective point not representable on the Cartesian plane.")}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(le),Zt=function(){};Zt.arraycopy=function(n,i,s,l,h){for(var v=0,S=i;S<i+h;S++)s[l+v]=n[S],v++},Zt.getProperty=function(n){return{"line.separator":\`
108
108
  \`}[n]};var _e=function n(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],l=arguments[1];this.x=s,this.y=l,this.w=1}else if(arguments[0]instanceof n&&arguments[1]instanceof n){var h=arguments[0],v=arguments[1];this.x=h.y*v.w-v.y*h.w,this.y=v.x*h.w-h.x*v.w,this.w=h.x*v.y-v.x*h.y}else if(arguments[0]instanceof U&&arguments[1]instanceof U){var S=arguments[0],R=arguments[1];this.x=S.y-R.y,this.y=R.x-S.x,this.w=S.x*R.y-R.x*S.y}}else if(arguments.length===3){var V=arguments[0],nt=arguments[1],_t=arguments[2];this.x=V,this.y=nt,this.w=_t}else if(arguments.length===4){var Et=arguments[0],Wt=arguments[1],$t=arguments[2],ie=arguments[3],Ee=Et.y-Wt.y,An=Wt.x-Et.x,Wn=Et.x*Wt.y-Wt.x*Et.y,Qr=$t.y-ie.y,jo=ie.x-$t.x,Os=$t.x*ie.y-ie.x*$t.y;this.x=An*Os-jo*Wn,this.y=Qr*Wn-Ee*Os,this.w=Ee*jo-Qr*An}};_e.prototype.getY=function(){var n=this.y/this.w;if(A.isNaN(n)||A.isInfinite(n))throw new se;return n},_e.prototype.getX=function(){var n=this.x/this.w;if(A.isNaN(n)||A.isInfinite(n))throw new se;return n},_e.prototype.getCoordinate=function(){var n=new U;return n.x=this.getX(),n.y=this.getY(),n},_e.prototype.interfaces_=function(){return[]},_e.prototype.getClass=function(){return _e},_e.intersection=function(n,i,s,l){var h=n.y-i.y,v=i.x-n.x,S=n.x*i.y-i.x*n.y,R=s.y-l.y,V=l.x-s.x,nt=s.x*l.y-l.x*s.y,_t=h*V-R*v,Et=(v*nt-V*S)/_t,Wt=(R*S-h*nt)/_t;if(A.isNaN(Et)||A.isInfinite(Et)||A.isNaN(Wt)||A.isInfinite(Wt))throw new se;return new U(Et,Wt)};var Vt=function n(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof U){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.init(l.x,h.x,l.y,h.y)}else if(arguments.length===4){var v=arguments[0],S=arguments[1],R=arguments[2],V=arguments[3];this.init(v,S,R,V)}},pe={serialVersionUID:{configurable:!0}};Vt.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Vt.prototype.equals=function(n){if(!(n instanceof Vt))return!1;var i=n;return this.isNull()?i.isNull():this._maxx===i.getMaxX()&&this._maxy===i.getMaxY()&&this._minx===i.getMinX()&&this._miny===i.getMinY()},Vt.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new Vt;var i=this._minx>n._minx?this._minx:n._minx,s=this._miny>n._miny?this._miny:n._miny,l=this._maxx<n._maxx?this._maxx:n._maxx,h=this._maxy<n._maxy?this._maxy:n._maxy;return new Vt(i,l,s,h)},Vt.prototype.isNull=function(){return this._maxx<this._minx},Vt.prototype.getMaxX=function(){return this._maxx},Vt.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof U){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof Vt){var i=arguments[0];return!this.isNull()&&!i.isNull()&&i.getMinX()>=this._minx&&i.getMaxX()<=this._maxx&&i.getMinY()>=this._miny&&i.getMaxY()<=this._maxy}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return!this.isNull()&&s>=this._minx&&s<=this._maxx&&l>=this._miny&&l<=this._maxy}},Vt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Vt){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof U){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||l>this._maxy||l<this._miny)}},Vt.prototype.getMinY=function(){return this._miny},Vt.prototype.getMinX=function(){return this._minx},Vt.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof U){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof Vt){var i=arguments[0];if(i.isNull())return null;this.isNull()?(this._minx=i.getMinX(),this._maxx=i.getMaxX(),this._miny=i.getMinY(),this._maxy=i.getMaxY()):(i._minx<this._minx&&(this._minx=i._minx),i._maxx>this._maxx&&(this._maxx=i._maxx),i._miny<this._miny&&(this._miny=i._miny),i._maxy>this._maxy&&(this._maxy=i._maxy))}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.isNull()?(this._minx=s,this._maxx=s,this._miny=l,this._maxy=l):(s<this._minx&&(this._minx=s),s>this._maxx&&(this._maxx=s),l<this._miny&&(this._miny=l),l>this._maxy&&(this._maxy=l))}},Vt.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},Vt.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Vt.prototype.compareTo=function(n){var i=n;return this.isNull()?i.isNull()?0:-1:i.isNull()?1:this._minx<i._minx?-1:this._minx>i._minx?1:this._miny<i._miny?-1:this._miny>i._miny?1:this._maxx<i._maxx?-1:this._maxx>i._maxx?1:this._maxy<i._maxy?-1:this._maxy>i._maxy?1:0},Vt.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},Vt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Vt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Vt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Vt.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},Vt.prototype.expandBy=function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.isNull())return null;this._minx-=i,this._maxx+=i,this._miny-=s,this._maxy+=s,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},Vt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Vt){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof U){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return this.covers(s,l)}},Vt.prototype.centre=function(){return this.isNull()?null:new U((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Vt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof U){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof Vt){var i=arguments[0];this._minx=i._minx,this._maxx=i._maxx,this._miny=i._miny,this._maxy=i._maxy}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.init(s.x,l.x,s.y,l.y)}else if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3];h<v?(this._minx=h,this._maxx=v):(this._minx=v,this._maxx=h),S<R?(this._miny=S,this._maxy=R):(this._miny=R,this._maxy=S)}},Vt.prototype.getMaxY=function(){return this._maxy},Vt.prototype.distance=function(n){if(this.intersects(n))return 0;var i=0;this._maxx<n._minx?i=n._minx-this._maxx:this._minx>n._maxx&&(i=this._minx-n._maxx);var s=0;return this._maxy<n._miny?s=n._miny-this._maxy:this._miny>n._maxy&&(s=this._miny-n._maxy),i===0?s:s===0?i:Math.sqrt(i*i+s*s)},Vt.prototype.hashCode=function(){var n=17;return n=37*n+U.hashCode(this._minx),n=37*n+U.hashCode(this._maxx),n=37*n+U.hashCode(this._miny),n=37*n+U.hashCode(this._maxy)},Vt.prototype.interfaces_=function(){return[G,t]},Vt.prototype.getClass=function(){return Vt},Vt.intersects=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];return s.x>=(n.x<i.x?n.x:i.x)&&s.x<=(n.x>i.x?n.x:i.x)&&s.y>=(n.y<i.y?n.y:i.y)&&s.y<=(n.y>i.y?n.y:i.y)}if(arguments.length===4){var l=arguments[0],h=arguments[1],v=arguments[2],S=arguments[3],R=Math.min(v.x,S.x),V=Math.max(v.x,S.x),nt=Math.min(l.x,h.x),_t=Math.max(l.x,h.x);return!(nt>V)&&!(_t<R)&&(R=Math.min(v.y,S.y),V=Math.max(v.y,S.y),nt=Math.min(l.y,h.y),_t=Math.max(l.y,h.y),!(nt>V)&&!(_t<R))}},pe.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Vt,pe);var at={typeStr:/^\\s*(\\w+)\\s*\\(\\s*(.*)\\s*\\)\\s*$/,emptyTypeStr:/^\\s*(\\w+)\\s*EMPTY\\s*$/,spaces:/\\s+/,parenComma:/\\)\\s*,\\s*\\(/,doubleParenComma:/\\)\\s*\\)\\s*,\\s*\\(\\s*\\(/,trimParens:/^\\s*\\(?(.*?)\\)?\\s*$/},He=function(n){this.geometryFactory=n||new Ce};He.prototype.read=function(n){var i,s,l;n=n.replace(/[\\n\\r]/g," ");var h=at.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((h=at.emptyTypeStr.exec(n))[2]=void 0),h&&(s=h[1].toLowerCase(),l=h[2],ce[s]&&(i=ce[s].apply(this,[l]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},He.prototype.write=function(n){return this.extractGeometry(n)},He.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!ae[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+ae[i].apply(this,[n])+")"};var ae={coordinate:function(n){return n.x+" "+n.y},point:function(n){return ae.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push("("+ae.point.apply(this,[n._geometries[s]])+")");return i.join(",")},linestring:function(n){for(var i=[],s=0,l=n._points._coordinates.length;s<l;++s)i.push(ae.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},linearring:function(n){for(var i=[],s=0,l=n._points._coordinates.length;s<l;++s)i.push(ae.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},multilinestring:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push("("+ae.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+ae.linestring.apply(this,[n._shell])+")");for(var s=0,l=n._holes.length;s<l;++s)i.push("("+ae.linestring.apply(this,[n._holes[s]])+")");return i.join(",")},multipolygon:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push("("+ae.polygon.apply(this,[n._geometries[s]])+")");return i.join(",")},geometrycollection:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push(this.extractGeometry(n._geometries[s]));return i.join(",")}},ce={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(at.spaces);return this.geometryFactory.createPoint(new U(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(n){if(n===void 0)return this.geometryFactory.createMultiPoint();for(var i,s=n.trim().split(","),l=[],h=0,v=s.length;h<v;++h)i=s[h].replace(at.trimParens,"$1"),l.push(ce.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(l)},linestring:function(n){if(n===void 0)return this.geometryFactory.createLineString();for(var i,s=n.trim().split(","),l=[],h=0,v=s.length;h<v;++h)i=s[h].trim().split(at.spaces),l.push(new U(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(l)},linearring:function(n){if(n===void 0)return this.geometryFactory.createLinearRing();for(var i,s=n.trim().split(","),l=[],h=0,v=s.length;h<v;++h)i=s[h].trim().split(at.spaces),l.push(new U(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(l)},multilinestring:function(n){if(n===void 0)return this.geometryFactory.createMultiLineString();for(var i,s=n.trim().split(at.parenComma),l=[],h=0,v=s.length;h<v;++h)i=s[h].replace(at.trimParens,"$1"),l.push(ce.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(l)},polygon:function(n){if(n===void 0)return this.geometryFactory.createPolygon();for(var i,s,l,h,v=n.trim().split(at.parenComma),S=[],R=0,V=v.length;R<V;++R)i=v[R].replace(at.trimParens,"$1"),s=ce.linestring.apply(this,[i]),l=this.geometryFactory.createLinearRing(s._points),R===0?h=l:S.push(l);return this.geometryFactory.createPolygon(h,S)},multipolygon:function(n){if(n===void 0)return this.geometryFactory.createMultiPolygon();for(var i,s=n.trim().split(at.doubleParenComma),l=[],h=0,v=s.length;h<v;++h)i=s[h].replace(at.trimParens,"$1"),l.push(ce.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(l)},geometrycollection:function(n){if(n===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(n=n.replace(/,\\s*([A-Za-z])/g,"|$1")).trim().split("|"),s=[],l=0,h=i.length;l<h;++l)s.push(this.read(i[l]));return this.geometryFactory.createGeometryCollection(s)}},fe=function(n){this.parser=new He(n)};fe.prototype.write=function(n){return this.parser.write(n)},fe.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var it=function(n){function i(s){n.call(this,s),this.name="RuntimeException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),B=function(n){function i(){if(n.call(this),arguments.length===0)n.call(this);else if(arguments.length===1){var s=arguments[0];n.call(this,s)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(it),P=function(){};P.prototype.interfaces_=function(){return[]},P.prototype.getClass=function(){return P},P.shouldNeverReachHere=function(){if(arguments.length===0)P.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new B("Should never reach here"+(n!==null?": "+n:""))}},P.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],P.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new B:new B(i)},P.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],P.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new B("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var F=function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new U,this._intPt[1]=new U,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},J={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};F.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},F.prototype.getTopologySummary=function(){var n=new Tt;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},F.prototype.computeIntersection=function(n,i,s,l){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=s,this._inputLines[1][1]=l,this._result=this.computeIntersect(n,i,s,l)},F.prototype.getIntersectionNum=function(){return this._result},F.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}},F.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},F.prototype.setPrecisionModel=function(n){this._precisionModel=n},F.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],i=0;i<this._result;i++)if(!this._intPt[i].equals2D(this._inputLines[n][0])&&!this._intPt[i].equals2D(this._inputLines[n][1]))return!0;return!1}},F.prototype.getIntersection=function(n){return this._intPt[n]},F.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},F.prototype.hasIntersection=function(){return this._result!==F.NO_INTERSECTION},F.prototype.getEdgeDistance=function(n,i){return F.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},F.prototype.isCollinear=function(){return this._result===F.COLLINEAR_INTERSECTION},F.prototype.toString=function(){return fe.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+fe.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},F.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},F.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},F.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},F.prototype.interfaces_=function(){return[]},F.prototype.getClass=function(){return F},F.computeEdgeDistance=function(n,i,s){var l=Math.abs(s.x-i.x),h=Math.abs(s.y-i.y),v=-1;if(n.equals(i))v=0;else if(n.equals(s))v=l>h?l:h;else{var S=Math.abs(n.x-i.x),R=Math.abs(n.y-i.y);(v=l>h?S:R)!==0||n.equals(i)||(v=Math.max(S,R))}return P.isTrue(!(v===0&&!n.equals(i)),"Bad distance calculation"),v},F.nonRobustComputeEdgeDistance=function(n,i,s){var l=n.x-i.x,h=n.y-i.y,v=Math.sqrt(l*l+h*h);return P.isTrue(!(v===0&&!n.equals(i)),"Invalid distance calculation"),v},J.DONT_INTERSECT.get=function(){return 0},J.DO_INTERSECT.get=function(){return 1},J.COLLINEAR.get=function(){return 2},J.NO_INTERSECTION.get=function(){return 0},J.POINT_INTERSECTION.get=function(){return 1},J.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(F,J);var rt=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(s){var l=new Vt(this._inputLines[0][0],this._inputLines[0][1]),h=new Vt(this._inputLines[1][0],this._inputLines[1][1]);return l.contains(s)&&h.contains(s)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return n.prototype.computeIntersection.apply(this,arguments);var s=arguments[0],l=arguments[1],h=arguments[2];if(this._isProper=!1,Vt.intersects(l,h,s)&&W.orientationIndex(l,h,s)===0&&W.orientationIndex(h,l,s)===0)return this._isProper=!0,(s.equals(l)||s.equals(h))&&(this._isProper=!1),this._result=n.POINT_INTERSECTION,null;this._result=n.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(s,l,h,v,S){S.x=this.smallestInAbsValue(s.x,l.x,h.x,v.x),S.y=this.smallestInAbsValue(s.y,l.y,h.y,v.y),s.x-=S.x,s.y-=S.y,l.x-=S.x,l.y-=S.y,h.x-=S.x,h.y-=S.y,v.x-=S.x,v.y-=S.y},i.prototype.safeHCoordinateIntersection=function(s,l,h,v){var S=null;try{S=_e.intersection(s,l,h,v)}catch(R){if(!(R instanceof se))throw R;S=i.nearestEndpoint(s,l,h,v)}return S},i.prototype.intersection=function(s,l,h,v){var S=this.intersectionWithNormalization(s,l,h,v);return this.isInSegmentEnvelopes(S)||(S=new U(i.nearestEndpoint(s,l,h,v))),this._precisionModel!==null&&this._precisionModel.makePrecise(S),S},i.prototype.smallestInAbsValue=function(s,l,h,v){var S=s,R=Math.abs(S);return Math.abs(l)<R&&(S=l,R=Math.abs(l)),Math.abs(h)<R&&(S=h,R=Math.abs(h)),Math.abs(v)<R&&(S=v),S},i.prototype.checkDD=function(s,l,h,v,S){var R=vt.intersection(s,l,h,v),V=this.isInSegmentEnvelopes(R);Zt.out.println("DD in env = "+V+" --------------------- "+R),S.distance(R)>1e-4&&Zt.out.println("Distance = "+S.distance(R))},i.prototype.intersectionWithNormalization=function(s,l,h,v){var S=new U(s),R=new U(l),V=new U(h),nt=new U(v),_t=new U;this.normalizeToEnvCentre(S,R,V,nt,_t);var Et=this.safeHCoordinateIntersection(S,R,V,nt);return Et.x+=_t.x,Et.y+=_t.y,Et},i.prototype.computeCollinearIntersection=function(s,l,h,v){var S=Vt.intersects(s,l,h),R=Vt.intersects(s,l,v),V=Vt.intersects(h,v,s),nt=Vt.intersects(h,v,l);return S&&R?(this._intPt[0]=h,this._intPt[1]=v,n.COLLINEAR_INTERSECTION):V&&nt?(this._intPt[0]=s,this._intPt[1]=l,n.COLLINEAR_INTERSECTION):S&&V?(this._intPt[0]=h,this._intPt[1]=s,!h.equals(s)||R||nt?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):S&&nt?(this._intPt[0]=h,this._intPt[1]=l,!h.equals(l)||R||V?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):R&&V?(this._intPt[0]=v,this._intPt[1]=s,!v.equals(s)||S||nt?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):R&&nt?(this._intPt[0]=v,this._intPt[1]=l,!v.equals(l)||S||V?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):n.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(s,l,h,v,S){var R=s.x<l.x?s.x:l.x,V=s.y<l.y?s.y:l.y,nt=s.x>l.x?s.x:l.x,_t=s.y>l.y?s.y:l.y,Et=h.x<v.x?h.x:v.x,Wt=h.y<v.y?h.y:v.y,$t=h.x>v.x?h.x:v.x,ie=h.y>v.y?h.y:v.y,Ee=((R>Et?R:Et)+(nt<$t?nt:$t))/2,An=((V>Wt?V:Wt)+(_t<ie?_t:ie))/2;S.x=Ee,S.y=An,s.x-=S.x,s.y-=S.y,l.x-=S.x,l.y-=S.y,h.x-=S.x,h.y-=S.y,v.x-=S.x,v.y-=S.y},i.prototype.computeIntersect=function(s,l,h,v){if(this._isProper=!1,!Vt.intersects(s,l,h,v))return n.NO_INTERSECTION;var S=W.orientationIndex(s,l,h),R=W.orientationIndex(s,l,v);if(S>0&&R>0||S<0&&R<0)return n.NO_INTERSECTION;var V=W.orientationIndex(h,v,s),nt=W.orientationIndex(h,v,l);return V>0&&nt>0||V<0&&nt<0?n.NO_INTERSECTION:S===0&&R===0&&V===0&&nt===0?this.computeCollinearIntersection(s,l,h,v):(S===0||R===0||V===0||nt===0?(this._isProper=!1,s.equals2D(h)||s.equals2D(v)?this._intPt[0]=s:l.equals2D(h)||l.equals2D(v)?this._intPt[0]=l:S===0?this._intPt[0]=new U(h):R===0?this._intPt[0]=new U(v):V===0?this._intPt[0]=new U(s):nt===0&&(this._intPt[0]=new U(l))):(this._isProper=!0,this._intPt[0]=this.intersection(s,l,h,v)),n.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(s,l,h,v){var S=s,R=W.distancePointLine(s,h,v),V=W.distancePointLine(l,h,v);return V<R&&(R=V,S=l),(V=W.distancePointLine(h,s,l))<R&&(R=V,S=h),(V=W.distancePointLine(v,s,l))<R&&(R=V,S=v),S},i}(F),D=function(){};D.prototype.interfaces_=function(){return[]},D.prototype.getClass=function(){return D},D.orientationIndex=function(n,i,s){var l=i.x-n.x,h=i.y-n.y,v=s.x-i.x,S=s.y-i.y;return D.signOfDet2x2(l,h,v,S)},D.signOfDet2x2=function(n,i,s,l){var h=null,v=null,S=null;if(h=1,n===0||l===0)return i===0||s===0?0:i>0?s>0?-h:h:s>0?h:-h;if(i===0||s===0)return l>0?n>0?h:-h:n>0?-h:h;if(i>0?l>0?i<=l||(h=-h,v=n,n=s,s=v,v=i,i=l,l=v):i<=-l?(h=-h,s=-s,l=-l):(v=n,n=-s,s=v,v=i,i=-l,l=v):l>0?-i<=l?(h=-h,n=-n,i=-i):(v=-n,n=s,s=v,v=-i,i=l,l=v):i>=l?(n=-n,i=-i,s=-s,l=-l):(h=-h,v=-n,n=-s,s=v,v=-i,i=-l,l=v),n>0){if(!(s>0)||!(n<=s))return h}else{if(s>0||!(n>=s))return-h;h=-h,n=-n,s=-s}for(;;){if(S=Math.floor(s/n),s-=S*n,(l-=S*i)<0)return-h;if(l>i)return h;if(n>s+s){if(i<l+l)return h}else{if(i>l+l)return-h;s=n-s,l=i-l,h=-h}if(l===0)return s===0?0:-h;if(s===0||(S=Math.floor(n/s),n-=S*s,(i-=S*l)<0))return h;if(i>l)return-h;if(s>n+n){if(l<i+i)return-h}else{if(l>i+i)return h;n=s-n,i=l-i,h=-h}if(i===0)return n===0?0:h;if(n===0)return-h}};var N=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};N.prototype.countSegment=function(n,i){if(n.x<this._p.x&&i.x<this._p.x)return null;if(this._p.x===i.x&&this._p.y===i.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&i.y===this._p.y){var s=n.x,l=i.x;return s>l&&(s=i.x,l=n.x),this._p.x>=s&&this._p.x<=l&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&n.y<=this._p.y){var h=n.x-this._p.x,v=n.y-this._p.y,S=i.x-this._p.x,R=i.y-this._p.y,V=D.signOfDet2x2(h,v,S,R);if(V===0)return this._isPointOnSegment=!0,null;R<v&&(V=-V),V>0&&this._crossingCount++}},N.prototype.isPointInPolygon=function(){return this.getLocation()!==$.EXTERIOR},N.prototype.getLocation=function(){return this._isPointOnSegment?$.BOUNDARY:this._crossingCount%2==1?$.INTERIOR:$.EXTERIOR},N.prototype.isOnSegment=function(){return this._isPointOnSegment},N.prototype.interfaces_=function(){return[]},N.prototype.getClass=function(){return N},N.locatePointInRing=function(){if(arguments[0]instanceof U&&j(arguments[1],bt)){for(var n=arguments[0],i=arguments[1],s=new N(n),l=new U,h=new U,v=1;v<i.size();v++)if(i.getCoordinate(v,l),i.getCoordinate(v-1,h),s.countSegment(l,h),s.isOnSegment())return s.getLocation();return s.getLocation()}if(arguments[0]instanceof U&&arguments[1]instanceof Array){for(var S=arguments[0],R=arguments[1],V=new N(S),nt=1;nt<R.length;nt++){var _t=R[nt],Et=R[nt-1];if(V.countSegment(_t,Et),V.isOnSegment())return V.getLocation()}return V.getLocation()}};var W=function(){},xt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};W.prototype.interfaces_=function(){return[]},W.prototype.getClass=function(){return W},W.orientationIndex=function(n,i,s){return vt.orientationIndex(n,i,s)},W.signedArea=function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var i=0,s=n[0].x,l=1;l<n.length-1;l++){var h=n[l].x-s,v=n[l+1].y;i+=h*(n[l-1].y-v)}return i/2}if(j(arguments[0],bt)){var S=arguments[0],R=S.size();if(R<3)return 0;var V=new U,nt=new U,_t=new U;S.getCoordinate(0,nt),S.getCoordinate(1,_t);var Et=nt.x;_t.x-=Et;for(var Wt=0,$t=1;$t<R-1;$t++)V.y=nt.y,nt.x=_t.x,nt.y=_t.y,S.getCoordinate($t+1,_t),_t.x-=Et,Wt+=nt.x*(V.y-_t.y);return Wt/2}},W.distanceLineLine=function(n,i,s,l){if(n.equals(i))return W.distancePointLine(n,s,l);if(s.equals(l))return W.distancePointLine(l,n,i);var h=!1;if(Vt.intersects(n,i,s,l)){var v=(i.x-n.x)*(l.y-s.y)-(i.y-n.y)*(l.x-s.x);if(v===0)h=!0;else{var S=(n.y-s.y)*(l.x-s.x)-(n.x-s.x)*(l.y-s.y),R=((n.y-s.y)*(i.x-n.x)-(n.x-s.x)*(i.y-n.y))/v,V=S/v;(V<0||V>1||R<0||R>1)&&(h=!0)}}else h=!0;return h?pt.min(W.distancePointLine(n,s,l),W.distancePointLine(i,s,l),W.distancePointLine(s,n,i),W.distancePointLine(l,n,i)):0},W.isPointInRing=function(n,i){return W.locatePointInRing(n,i)!==$.EXTERIOR},W.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,l=new U;n.getCoordinate(0,l);for(var h=l.x,v=l.y,S=1;S<i;S++){n.getCoordinate(S,l);var R=l.x,V=l.y,nt=R-h,_t=V-v;s+=Math.sqrt(nt*nt+_t*_t),h=R,v=V}return s},W.isCCW=function(n){var i=n.length-1;if(i<3)throw new L("Ring has fewer than 4 points, so orientation cannot be determined");for(var s=n[0],l=0,h=1;h<=i;h++){var v=n[h];v.y>s.y&&(s=v,l=h)}var S=l;do(S-=1)<0&&(S=i);while(n[S].equals2D(s)&&S!==l);var R=l;do R=(R+1)%i;while(n[R].equals2D(s)&&R!==l);var V=n[S],nt=n[R];if(V.equals2D(s)||nt.equals2D(s)||V.equals2D(nt))return!1;var _t=W.computeOrientation(V,s,nt),Et=!1;return Et=_t===0?V.x>nt.x:_t>0,Et},W.locatePointInRing=function(n,i){return N.locatePointInRing(n,i)},W.distancePointLinePerpendicular=function(n,i,s){var l=(s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.y-i.y),h=((i.y-n.y)*(s.x-i.x)-(i.x-n.x)*(s.y-i.y))/l;return Math.abs(h)*Math.sqrt(l)},W.computeOrientation=function(n,i,s){return W.orientationIndex(n,i,s)},W.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new L("Line array must contain at least one vertex");for(var s=n.distance(i[0]),l=0;l<i.length-1;l++){var h=W.distancePointLine(n,i[l],i[l+1]);h<s&&(s=h)}return s}if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];if(S.x===R.x&&S.y===R.y)return v.distance(S);var V=(R.x-S.x)*(R.x-S.x)+(R.y-S.y)*(R.y-S.y),nt=((v.x-S.x)*(R.x-S.x)+(v.y-S.y)*(R.y-S.y))/V;if(nt<=0)return v.distance(S);if(nt>=1)return v.distance(R);var _t=((S.y-v.y)*(R.x-S.x)-(S.x-v.x)*(R.y-S.y))/V;return Math.abs(_t)*Math.sqrt(V)}},W.isOnLine=function(n,i){for(var s=new rt,l=1;l<i.length;l++){var h=i[l-1],v=i[l];if(s.computeIntersection(n,h,v),s.hasIntersection())return!0}return!1},xt.CLOCKWISE.get=function(){return-1},xt.RIGHT.get=function(){return W.CLOCKWISE},xt.COUNTERCLOCKWISE.get=function(){return 1},xt.LEFT.get=function(){return W.COUNTERCLOCKWISE},xt.COLLINEAR.get=function(){return 0},xt.STRAIGHT.get=function(){return W.COLLINEAR},Object.defineProperties(W,xt);var wt=function(){};wt.prototype.filter=function(n){},wt.prototype.interfaces_=function(){return[]},wt.prototype.getClass=function(){return wt};var lt=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},Bt={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};lt.prototype.isGeometryCollection=function(){return this.getSortIndex()===lt.SORTINDEX_GEOMETRYCOLLECTION},lt.prototype.getFactory=function(){return this._factory},lt.prototype.getGeometryN=function(n){return this},lt.prototype.getArea=function(){return 0},lt.prototype.isRectangle=function(){return!1},lt.prototype.equals=function(){if(arguments[0]instanceof lt){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof lt))return!1;var s=i;return this.equalsExact(s)}},lt.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},lt.prototype.geometryChanged=function(){this.apply(lt.geometryChangedFilter)},lt.prototype.geometryChangedAction=function(){this._envelope=null},lt.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},lt.prototype.getLength=function(){return 0},lt.prototype.getNumGeometries=function(){return 1},lt.prototype.compareTo=function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(n)}if(arguments.length===2){var s=arguments[0],l=arguments[1];return this.getSortIndex()!==s.getSortIndex()?this.getSortIndex()-s.getSortIndex():this.isEmpty()&&s.isEmpty()?0:this.isEmpty()?-1:s.isEmpty()?1:this.compareToSameClass(s,l)}},lt.prototype.getUserData=function(){return this._userData},lt.prototype.getSRID=function(){return this._SRID},lt.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},lt.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===lt.SORTINDEX_GEOMETRYCOLLECTION)throw new L("This method does not support GeometryCollection arguments")},lt.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},lt.prototype.norm=function(){var n=this.copy();return n.normalize(),n},lt.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},lt.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Vt(this._envelope)},lt.prototype.setSRID=function(n){this._SRID=n},lt.prototype.setUserData=function(n){this._userData=n},lt.prototype.compare=function(n,i){for(var s=n.iterator(),l=i.iterator();s.hasNext()&&l.hasNext();){var h=s.next(),v=l.next(),S=h.compareTo(v);if(S!==0)return S}return s.hasNext()?1:l.hasNext()?-1:0},lt.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},lt.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===lt.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===lt.SORTINDEX_MULTIPOINT||this.getSortIndex()===lt.SORTINDEX_MULTILINESTRING||this.getSortIndex()===lt.SORTINDEX_MULTIPOLYGON},lt.prototype.interfaces_=function(){return[Y,G,t]},lt.prototype.getClass=function(){return lt},lt.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},lt.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},Bt.serialVersionUID.get=function(){return 8763622679187377e3},Bt.SORTINDEX_POINT.get=function(){return 0},Bt.SORTINDEX_MULTIPOINT.get=function(){return 1},Bt.SORTINDEX_LINESTRING.get=function(){return 2},Bt.SORTINDEX_LINEARRING.get=function(){return 3},Bt.SORTINDEX_MULTILINESTRING.get=function(){return 4},Bt.SORTINDEX_POLYGON.get=function(){return 5},Bt.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Bt.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Bt.geometryChangedFilter.get=function(){return Lt},Object.defineProperties(lt,Bt);var Lt=function(){};Lt.interfaces_=function(){return[wt]},Lt.filter=function(n){n.geometryChangedAction()};var Ut=function(){};Ut.prototype.filter=function(n){},Ut.prototype.interfaces_=function(){return[]},Ut.prototype.getClass=function(){return Ut};var Xt=function(){},de={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};Xt.prototype.isInBoundary=function(n){},Xt.prototype.interfaces_=function(){return[]},Xt.prototype.getClass=function(){return Xt},de.Mod2BoundaryNodeRule.get=function(){return Ft},de.EndPointBoundaryNodeRule.get=function(){return Se},de.MultiValentEndPointBoundaryNodeRule.get=function(){return xe},de.MonoValentEndPointBoundaryNodeRule.get=function(){return he},de.MOD2_BOUNDARY_RULE.get=function(){return new Ft},de.ENDPOINT_BOUNDARY_RULE.get=function(){return new Se},de.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new xe},de.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new he},de.OGC_SFS_BOUNDARY_RULE.get=function(){return Xt.MOD2_BOUNDARY_RULE},Object.defineProperties(Xt,de);var Ft=function(){};Ft.prototype.isInBoundary=function(n){return n%2==1},Ft.prototype.interfaces_=function(){return[Xt]},Ft.prototype.getClass=function(){return Ft};var Se=function(){};Se.prototype.isInBoundary=function(n){return n>0},Se.prototype.interfaces_=function(){return[Xt]},Se.prototype.getClass=function(){return Se};var xe=function(){};xe.prototype.isInBoundary=function(n){return n>1},xe.prototype.interfaces_=function(){return[Xt]},xe.prototype.getClass=function(){return xe};var he=function(){};he.prototype.isInBoundary=function(n){return n===1},he.prototype.interfaces_=function(){return[Xt]},he.prototype.getClass=function(){return he};var Jt=function(){};Jt.prototype.add=function(){},Jt.prototype.addAll=function(){},Jt.prototype.isEmpty=function(){},Jt.prototype.iterator=function(){},Jt.prototype.size=function(){},Jt.prototype.toArray=function(){},Jt.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var et=function(){};et.prototype.hasNext=function(){},et.prototype.next=function(){},et.prototype.remove=function(){};var kt=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(){},i.prototype.set=function(){},i.prototype.isEmpty=function(){},i}(Jt);(o.prototype=new Error).name="NoSuchElementException";var ct=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Jt&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.ensureCapacity=function(){},i.prototype.interfaces_=function(){return[n,Jt]},i.prototype.add=function(s){return arguments.length===1?this.array_.push(s):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(s){for(var l=s.iterator();l.hasNext();)this.add(l.next());return!0},i.prototype.set=function(s,l){var h=this.array_[s];return this.array_[s]=l,h},i.prototype.iterator=function(){return new jt(this)},i.prototype.get=function(s){if(s<0||s>=this.size())throw new e;return this.array_[s]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var s=[],l=0,h=this.array_.length;l<h;l++)s.push(this.array_[l]);return s},i.prototype.remove=function(s){for(var l=!1,h=0,v=this.array_.length;h<v;h++)if(this.array_[h]===s){this.array_.splice(h,1),l=!0;break}return l},i}(kt),jt=function(n){function i(s){n.call(this),this.arrayList_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new o;return this.arrayList_.get(this.position_++)},i.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},i.prototype.set=function(s){return this.arrayList_.set(this.position_-1,s)},i.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},i}(et),Kt=function(n){function i(){if(n.call(this),arguments.length!==0){if(arguments.length===1){var l=arguments[0];this.ensureCapacity(l.length),this.add(l,!0)}else if(arguments.length===2){var h=arguments[0],v=arguments[1];this.ensureCapacity(h.length),this.add(h,v)}}}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={coordArrayType:{configurable:!0}};return s.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(l){return this.get(l)},i.prototype.addAll=function(){if(arguments.length===2){for(var l=arguments[0],h=arguments[1],v=!1,S=l.iterator();S.hasNext();)this.add(S.next(),h),v=!0;return v}return n.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var l=n.prototype.clone.call(this),h=0;h<this.size();h++)l.add(h,this.get(h).copy());return l},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var l=arguments[0];n.prototype.add.call(this,l)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var h=arguments[0],v=arguments[1];return this.add(h,v,!0),!0}if(arguments[0]instanceof U&&typeof arguments[1]=="boolean"){var S=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(S))return null;n.prototype.add.call(this,S)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var R=arguments[0],V=arguments[1];return this.add(R,V),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var nt=arguments[0],_t=arguments[1];if(arguments[2])for(var Et=0;Et<nt.length;Et++)this.add(nt[Et],_t);else for(var Wt=nt.length-1;Wt>=0;Wt--)this.add(nt[Wt],_t);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof U){var $t=arguments[0],ie=arguments[1];if(!arguments[2]){var Ee=this.size();if(Ee>0&&($t>0&&this.get($t-1).equals2D(ie)||$t<Ee&&this.get($t).equals2D(ie)))return null}n.prototype.add.call(this,$t,ie)}}else if(arguments.length===4){var An=arguments[0],Wn=arguments[1],Qr=arguments[2],jo=arguments[3],Os=1;Qr>jo&&(Os=-1);for(var Oc=Qr;Oc!==jo;Oc+=Os)this.add(An[Oc],Wn);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new U(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(ct),Mt=function(){},me={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};me.ForwardComparator.get=function(){return be},me.BidirectionalComparator.get=function(){return Jn},me.coordArrayType.get=function(){return new Array(0).fill(null)},Mt.prototype.interfaces_=function(){return[]},Mt.prototype.getClass=function(){return Mt},Mt.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},Mt.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var l=n[s];if(Mt.indexOf(l,i)<0)return l}return null},Mt.scroll=function(n,i){var s=Mt.indexOf(i,n);if(s<0)return null;var l=new Array(n.length).fill(null);Zt.arraycopy(n,s,l,0,n.length-s),Zt.arraycopy(n,0,l,n.length-s,s),Zt.arraycopy(l,0,n,0,n.length)},Mt.equals=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(n===i)return!0;if(n===null||i===null||n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(!n[s].equals(i[s]))return!1;return!0}if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2];if(l===h)return!0;if(l===null||h===null||l.length!==h.length)return!1;for(var S=0;S<l.length;S++)if(v.compare(l[S],h[S])!==0)return!1;return!0}},Mt.intersection=function(n,i){for(var s=new Kt,l=0;l<n.length;l++)i.intersects(n[l])&&s.add(n[l],!0);return s.toCoordinateArray()},Mt.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},Mt.removeRepeatedPoints=function(n){return Mt.hasRepeatedPoints(n)?new Kt(n,!1).toCoordinateArray():n},Mt.reverse=function(n){for(var i=n.length-1,s=Math.trunc(i/2),l=0;l<=s;l++){var h=n[l];n[l]=n[i-l],n[i-l]=h}},Mt.removeNull=function(n){for(var i=0,s=0;s<n.length;s++)n[s]!==null&&i++;var l=new Array(i).fill(null);if(i===0)return l;for(var h=0,v=0;v<n.length;v++)n[v]!==null&&(l[h++]=n[v]);return l},Mt.copyDeep=function(){if(arguments.length===1){for(var n=arguments[0],i=new Array(n.length).fill(null),s=0;s<n.length;s++)i[s]=new U(n[s]);return i}if(arguments.length===5)for(var l=arguments[0],h=arguments[1],v=arguments[2],S=arguments[3],R=arguments[4],V=0;V<R;V++)v[S+V]=new U(l[h+V])},Mt.isEqualReversed=function(n,i){for(var s=0;s<n.length;s++){var l=n[s],h=i[n.length-s-1];if(l.compareTo(h)!==0)return!1}return!0},Mt.envelope=function(n){for(var i=new Vt,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},Mt.toCoordinateArray=function(n){return n.toArray(Mt.coordArrayType)},Mt.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},Mt.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},Mt.increasingDirection=function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var s=n.length-1-i,l=n[i].compareTo(n[s]);if(l!==0)return l}return 1},Mt.compare=function(n,i){for(var s=0;s<n.length&&s<i.length;){var l=n[s].compareTo(i[s]);if(l!==0)return l;s++}return s<i.length?-1:s<n.length?1:0},Mt.minCoordinate=function(n){for(var i=null,s=0;s<n.length;s++)(i===null||i.compareTo(n[s])>0)&&(i=n[s]);return i},Mt.extract=function(n,i,s){i=pt.clamp(i,0,n.length);var l=(s=pt.clamp(s,-1,n.length))-i+1;s<0&&(l=0),i>=n.length&&(l=0),s<i&&(l=0);var h=new Array(l).fill(null);if(l===0)return h;for(var v=0,S=i;S<=s;S++)h[v++]=n[S];return h},Object.defineProperties(Mt,me);var be=function(){};be.prototype.compare=function(n,i){return Mt.compare(n,i)},be.prototype.interfaces_=function(){return[X]},be.prototype.getClass=function(){return be};var Jn=function(){};Jn.prototype.compare=function(n,i){var s=n,l=i;if(s.length<l.length)return-1;if(s.length>l.length)return 1;if(s.length===0)return 0;var h=Mt.compare(s,l);return Mt.isEqualReversed(s,l)?0:h},Jn.prototype.OLDcompare=function(n,i){var s=n,l=i;if(s.length<l.length)return-1;if(s.length>l.length)return 1;if(s.length===0)return 0;for(var h=Mt.increasingDirection(s),v=Mt.increasingDirection(l),S=h>0?0:s.length-1,R=v>0?0:s.length-1,V=0;V<s.length;V++){var nt=s[S].compareTo(l[R]);if(nt!==0)return nt;S+=h,R+=v}return 0},Jn.prototype.interfaces_=function(){return[X]},Jn.prototype.getClass=function(){return Jn};var $e=function(){};$e.prototype.get=function(){},$e.prototype.put=function(){},$e.prototype.size=function(){},$e.prototype.values=function(){},$e.prototype.entrySet=function(){};var Vi=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}($e);(a.prototype=new Error).name="OperationNotSupported",(c.prototype=new Jt).contains=function(){};var zr=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Jt&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.contains=function(s){for(var l=0,h=this.array_.length;l<h;l++)if(this.array_[l]===s)return!0;return!1},i.prototype.add=function(s){return!this.contains(s)&&(this.array_.push(s),!0)},i.prototype.addAll=function(s){for(var l=s.iterator();l.hasNext();)this.add(l.next());return!0},i.prototype.remove=function(s){throw new Error},i.prototype.size=function(){return this.array_.length},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.toArray=function(){for(var s=[],l=0,h=this.array_.length;l<h;l++)s.push(this.array_[l]);return s},i.prototype.iterator=function(){return new Ja(this)},i}(c),Ja=function(n){function i(s){n.call(this),this.hashSet_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new o;return this.hashSet_.array_[this.position_++]},i.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},i.prototype.remove=function(){throw new a},i}(et),eo=0;(w.prototype=new Vi).get=function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return i.value;i=i.right}}return null},w.prototype.put=function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:eo,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,l,h=this.root_;do if(s=h,(l=n.compareTo(h.key))<0)h=h.left;else{if(!(l>0)){var v=h.value;return h.value=i,v}h=h.right}while(h!==null);var S={key:n,left:null,right:null,value:i,parent:s,color:eo,getValue:function(){return this.value},getKey:function(){return this.key}};return l<0?s.left=S:s.right=S,this.fixAfterInsertion(S),this.size_++,null},w.prototype.fixAfterInsertion=function(n){for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)if(d(n)===y(d(d(n)))){var i=_(d(d(n)));p(i)===1?(g(d(n),eo),g(i,eo),g(d(d(n)),1),n=d(d(n))):(n===_(d(n))&&(n=d(n),this.rotateLeft(n)),g(d(n),eo),g(d(d(n)),1),this.rotateRight(d(d(n))))}else{var s=y(d(d(n)));p(s)===1?(g(d(n),eo),g(s,eo),g(d(d(n)),1),n=d(d(n))):(n===y(d(n))&&(n=d(n),this.rotateRight(n)),g(d(n),eo),g(d(d(n)),1),this.rotateLeft(d(d(n))))}this.root_.color=eo},w.prototype.values=function(){var n=new ct,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=w.successor(i))!==null;)n.add(i.value);return n},w.prototype.entrySet=function(){var n=new zr,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=w.successor(i))!==null;)n.add(i);return n},w.prototype.rotateLeft=function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}},w.prototype.rotateRight=function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}},w.prototype.getFirstEntry=function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n},w.successor=function(n){if(n===null)return null;if(n.right!==null){for(var i=n.right;i.left!==null;)i=i.left;return i}for(var s=n.parent,l=n;s!==null&&l===s.right;)l=s,s=s.parent;return s},w.prototype.size=function(){return this.size_};var ya=function(){};ya.prototype.interfaces_=function(){return[]},ya.prototype.getClass=function(){return ya},x.prototype=new c,(T.prototype=new x).contains=function(n){for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===0)return!0;return!1},T.prototype.add=function(n){if(this.contains(n))return!1;for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===1)return this.array_.splice(i,0,n),!0;return this.array_.push(n),!0},T.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next());return!0},T.prototype.remove=function(n){throw new a},T.prototype.size=function(){return this.array_.length},T.prototype.isEmpty=function(){return this.array_.length===0},T.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n},T.prototype.iterator=function(){return new As(this)};var As=function(n){this.treeSet_=n,this.position_=0};As.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},As.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},As.prototype.remove=function(){throw new a};var Ho=function(){};Ho.sort=function(){var n,i,s,l,h=arguments[0];if(arguments.length===1)l=function(S,R){return S.compareTo(R)},h.sort(l);else if(arguments.length===2)s=arguments[1],l=function(S,R){return s.compare(S,R)},h.sort(l);else if(arguments.length===3){(i=h.slice(arguments[1],arguments[2])).sort();var v=h.slice(0,arguments[1]).concat(i,h.slice(arguments[2],h.length));for(h.splice(0,h.length),n=0;n<v.length;n++)h.push(v[n])}else if(arguments.length===4)for(i=h.slice(arguments[1],arguments[2]),s=arguments[3],l=function(S,R){return s.compare(S,R)},i.sort(l),v=h.slice(0,arguments[1]).concat(i,h.slice(arguments[2],h.length)),h.splice(0,h.length),n=0;n<v.length;n++)h.push(v[n])},Ho.asList=function(n){for(var i=new ct,s=0,l=n.length;s<l;s++)i.add(n[s]);return i};var Be=function(){},fi={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};fi.P.get=function(){return 0},fi.L.get=function(){return 1},fi.A.get=function(){return 2},fi.FALSE.get=function(){return-1},fi.TRUE.get=function(){return-2},fi.DONTCARE.get=function(){return-3},fi.SYM_FALSE.get=function(){return"F"},fi.SYM_TRUE.get=function(){return"T"},fi.SYM_DONTCARE.get=function(){return"*"},fi.SYM_P.get=function(){return"0"},fi.SYM_L.get=function(){return"1"},fi.SYM_A.get=function(){return"2"},Be.prototype.interfaces_=function(){return[]},Be.prototype.getClass=function(){return Be},Be.toDimensionSymbol=function(n){switch(n){case Be.FALSE:return Be.SYM_FALSE;case Be.TRUE:return Be.SYM_TRUE;case Be.DONTCARE:return Be.SYM_DONTCARE;case Be.P:return Be.SYM_P;case Be.L:return Be.SYM_L;case Be.A:return Be.SYM_A}throw new L("Unknown dimension value: "+n)},Be.toDimensionValue=function(n){switch(dt.toUpperCase(n)){case Be.SYM_FALSE:return Be.FALSE;case Be.SYM_TRUE:return Be.TRUE;case Be.SYM_DONTCARE:return Be.DONTCARE;case Be.SYM_P:return Be.P;case Be.SYM_L:return Be.L;case Be.SYM_A:return Be.A}throw new L("Unknown dimension symbol: "+n)},Object.defineProperties(Be,fi);var Wi=function(){};Wi.prototype.filter=function(n){},Wi.prototype.interfaces_=function(){return[]},Wi.prototype.getClass=function(){return Wi};var Ci=function(){};Ci.prototype.filter=function(n,i){},Ci.prototype.isDone=function(){},Ci.prototype.isGeometryChanged=function(){},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci};var Sr=function(n){function i(l,h){if(n.call(this,h),this._geometries=l||[],n.hasNullElements(this._geometries))throw new L("geometries must not contain null elements")}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var l=new Vt,h=0;h<this._geometries.length;h++)l.expandToInclude(this._geometries[h].getEnvelopeInternal());return l},i.prototype.getGeometryN=function(l){return this._geometries[l]},i.prototype.getSortIndex=function(){return n.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var l=new Array(this.getNumPoints()).fill(null),h=-1,v=0;v<this._geometries.length;v++)for(var S=this._geometries[v].getCoordinates(),R=0;R<S.length;R++)l[++h]=S[R];return l},i.prototype.getArea=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getArea();return l},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var v=l;if(this._geometries.length!==v._geometries.length)return!1;for(var S=0;S<this._geometries.length;S++)if(!this._geometries[S].equalsExact(v._geometries[S],h))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var l=0;l<this._geometries.length;l++)this._geometries[l].normalize();Ho.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var l=Be.FALSE,h=0;h<this._geometries.length;h++)l=Math.max(l,this._geometries[h].getBoundaryDimension());return l},i.prototype.getDimension=function(){for(var l=Be.FALSE,h=0;h<this._geometries.length;h++)l=Math.max(l,this._geometries[h].getDimension());return l},i.prototype.getLength=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getLength();return l},i.prototype.getNumPoints=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getNumPoints();return l},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),v=0;v<this._geometries.length;v++)h[v]=this._geometries[v].reverse();return this.getFactory().createGeometryCollection(h)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0],h=new T(Ho.asList(this._geometries)),v=new T(Ho.asList(l._geometries));return this.compare(h,v)}if(arguments.length===2){for(var S=arguments[0],R=arguments[1],V=S,nt=this.getNumGeometries(),_t=V.getNumGeometries(),Et=0;Et<nt&&Et<_t;){var Wt=this.getGeometryN(Et),$t=V.getGeometryN(Et),ie=Wt.compareToSameClass($t,R);if(ie!==0)return ie;Et++}return Et<nt?1:Et<_t?-1:0}},i.prototype.apply=function(){if(j(arguments[0],Ut))for(var l=arguments[0],h=0;h<this._geometries.length;h++)this._geometries[h].apply(l);else if(j(arguments[0],Ci)){var v=arguments[0];if(this._geometries.length===0)return null;for(var S=0;S<this._geometries.length&&(this._geometries[S].apply(v),!v.isDone());S++);v.isGeometryChanged()&&this.geometryChanged()}else if(j(arguments[0],Wi)){var R=arguments[0];R.filter(this);for(var V=0;V<this._geometries.length;V++)this._geometries[V].apply(R)}else if(j(arguments[0],wt)){var nt=arguments[0];nt.filter(this);for(var _t=0;_t<this._geometries.length;_t++)this._geometries[_t].apply(nt)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),P.shouldNeverReachHere(),null},i.prototype.clone=function(){var l=n.prototype.clone.call(this);l._geometries=new Array(this._geometries.length).fill(null);for(var h=0;h<this._geometries.length;h++)l._geometries[h]=this._geometries[h].clone();return l},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.isEmpty=function(){for(var l=0;l<this._geometries.length;l++)if(!this._geometries[l].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,s),i}(lt),K=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return lt.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&n.prototype.equalsExact.call(this,l,h)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?Be.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var l=0;l<this._geometries.length;l++)if(!this._geometries[l].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),v=0;v<this._geometries.length;v++)h[l-1-v]=this._geometries[v].reverse();return this.getFactory().createMultiLineString(h)},i.prototype.getBoundary=function(){return new mt(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.interfaces_=function(){return[ya]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(Sr),mt=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=Xt.MOD2_BOUNDARY_RULE;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this._geom=s,this._geomFact=s.getFactory(),this._bnRule=l}};mt.prototype.boundaryMultiLineString=function(n){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var i=this.computeBoundaryCoordinates(n);return i.length===1?this._geomFact.createPoint(i[0]):this._geomFact.createMultiPointFromCoords(i)},mt.prototype.getBoundary=function(){return this._geom instanceof Qt?this.boundaryLineString(this._geom):this._geom instanceof K?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},mt.prototype.boundaryLineString=function(n){return this._geom.isEmpty()?this.getEmptyMultiPoint():n.isClosed()?this._bnRule.isInBoundary(2)?n.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([n.getStartPoint(),n.getEndPoint()])},mt.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},mt.prototype.computeBoundaryCoordinates=function(n){var i=new ct;this._endpointMap=new w;for(var s=0;s<n.getNumGeometries();s++){var l=n.getGeometryN(s);l.getNumPoints()!==0&&(this.addEndpoint(l.getCoordinateN(0)),this.addEndpoint(l.getCoordinateN(l.getNumPoints()-1)))}for(var h=this._endpointMap.entrySet().iterator();h.hasNext();){var v=h.next(),S=v.getValue().count;this._bnRule.isInBoundary(S)&&i.add(v.getKey())}return Mt.toCoordinateArray(i)},mt.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new Pt,this._endpointMap.put(n,i)),i.count++},mt.prototype.interfaces_=function(){return[]},mt.prototype.getClass=function(){return mt},mt.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new mt(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new mt(i,s).getBoundary()}};var Pt=function(){this.count=null};Pt.prototype.interfaces_=function(){return[]},Pt.prototype.getClass=function(){return Pt};var yt=function(){},Rt={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};yt.prototype.interfaces_=function(){return[]},yt.prototype.getClass=function(){return yt},yt.chars=function(n,i){for(var s=new Array(i).fill(null),l=0;l<i;l++)s[l]=n;return String(s)},yt.getStackTrace=function(){if(arguments.length===1){var n=arguments[0],i=new function(){},s=new function(){}(i);return n.printStackTrace(s),i.toString()}if(arguments.length===2){for(var l=arguments[0],h=arguments[1],v="",S=new function(){}(new function(){}(yt.getStackTrace(l))),R=0;R<h;R++)try{v+=S.readLine()+yt.NEWLINE}catch(V){if(!(V instanceof C))throw V;P.shouldNeverReachHere()}return v}},yt.split=function(n,i){for(var s=i.length,l=new ct,h=""+n,v=h.indexOf(i);v>=0;){var S=h.substring(0,v);l.add(S),v=(h=h.substring(v+s)).indexOf(i)}h.length>0&&l.add(h);for(var R=new Array(l.size()).fill(null),V=0;V<R.length;V++)R[V]=l.get(V);return R},yt.toString=function(){if(arguments.length===1){var n=arguments[0];return yt.SIMPLE_ORDINATE_FORMAT.format(n)}},yt.spaces=function(n){return yt.chars(" ",n)},Rt.NEWLINE.get=function(){return Zt.getProperty("line.separator")},Rt.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(yt,Rt);var Yt=function(){};Yt.prototype.interfaces_=function(){return[]},Yt.prototype.getClass=function(){return Yt},Yt.copyCoord=function(n,i,s,l){for(var h=Math.min(n.getDimension(),s.getDimension()),v=0;v<h;v++)s.setOrdinate(l,v,n.getOrdinate(i,v))},Yt.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,bt.X)===n.getOrdinate(i-1,bt.X)&&n.getOrdinate(0,bt.Y)===n.getOrdinate(i-1,bt.Y)},Yt.isEqual=function(n,i){var s=n.size();if(s!==i.size())return!1;for(var l=Math.min(n.getDimension(),i.getDimension()),h=0;h<s;h++)for(var v=0;v<l;v++){var S=n.getOrdinate(h,v),R=i.getOrdinate(h,v);if(n.getOrdinate(h,v)!==i.getOrdinate(h,v)&&(!A.isNaN(S)||!A.isNaN(R)))return!1}return!0},Yt.extend=function(n,i,s){var l=n.create(s,i.getDimension()),h=i.size();if(Yt.copy(i,0,l,0,h),h>0)for(var v=h;v<s;v++)Yt.copy(i,h-1,l,v,1);return l},Yt.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),l=0;l<=s;l++)Yt.swap(n,l,i-l)},Yt.swap=function(n,i,s){if(i===s)return null;for(var l=0;l<n.getDimension();l++){var h=n.getOrdinate(i,l);n.setOrdinate(i,l,n.getOrdinate(s,l)),n.setOrdinate(s,l,h)}},Yt.copy=function(n,i,s,l,h){for(var v=0;v<h;v++)Yt.copyCoord(n,i+v,s,l+v)},Yt.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),l=new Tt;l.append("(");for(var h=0;h<i;h++){h>0&&l.append(" ");for(var v=0;v<s;v++)v>0&&l.append(","),l.append(yt.toString(n.getOrdinate(h,v)))}return l.append(")"),l.toString()}},Yt.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?Yt.createClosedRing(n,i,4):i.getOrdinate(0,bt.X)===i.getOrdinate(s-1,bt.X)&&i.getOrdinate(0,bt.Y)===i.getOrdinate(s-1,bt.Y)?i:Yt.createClosedRing(n,i,s+1)},Yt.createClosedRing=function(n,i,s){var l=n.create(s,i.getDimension()),h=i.size();Yt.copy(i,0,l,0,h);for(var v=h;v<s;v++)Yt.copy(i,0,l,v,1);return l};var Qt=function(n){function i(l,h){n.call(this,h),this._points=null,this.init(l)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Vt:this._points.expandEnvelope(new Vt)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return n.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var v=l;if(this._points.size()!==v._points.size())return!1;for(var S=0;S<this._points.size();S++)if(!this.equal(this._points.getCoordinate(S),v._points.getCoordinate(S),h))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var l=0;l<Math.trunc(this._points.size()/2);l++){var h=this._points.size()-1-l;if(!this._points.getCoordinate(l).equals(this._points.getCoordinate(h)))return this._points.getCoordinate(l).compareTo(this._points.getCoordinate(h))>0&&Yt.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?Be.FALSE:0},i.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},i.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},i.prototype.getDimension=function(){return 1},i.prototype.getLength=function(){return W.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var l=this._points.copy();return Yt.reverse(l),this.getFactory().createLineString(l)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var l=arguments[0],h=0,v=0;h<this._points.size()&&v<l._points.size();){var S=this._points.getCoordinate(h).compareTo(l._points.getCoordinate(v));if(S!==0)return S;h++,v++}return h<this._points.size()?1:v<l._points.size()?-1:0}if(arguments.length===2){var R=arguments[0];return arguments[1].compare(this._points,R._points)}},i.prototype.apply=function(){if(j(arguments[0],Ut))for(var l=arguments[0],h=0;h<this._points.size();h++)l.filter(this._points.getCoordinate(h));else if(j(arguments[0],Ci)){var v=arguments[0];if(this._points.size()===0)return null;for(var S=0;S<this._points.size()&&(v.filter(this._points,S),!v.isDone());S++);v.isGeometryChanged()&&this.geometryChanged()}else j(arguments[0],Wi)?arguments[0].filter(this):j(arguments[0],wt)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new mt(this).getBoundary()},i.prototype.isEquivalentClass=function(l){return l instanceof i},i.prototype.clone=function(){var l=n.prototype.clone.call(this);return l._points=this._points.clone(),l},i.prototype.getCoordinateN=function(l){return this._points.getCoordinate(l)},i.prototype.getGeometryType=function(){return"LineString"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._points},i.prototype.isEmpty=function(){return this._points.size()===0},i.prototype.init=function(l){if(l===null&&(l=this.getFactory().getCoordinateSequenceFactory().create([])),l.size()===1)throw new L("Invalid number of points in LineString (found "+l.size()+" - must be 0 or >= 2)");this._points=l},i.prototype.isCoordinate=function(l){for(var h=0;h<this._points.size();h++)if(this._points.getCoordinate(h).equals(l))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(l){return this.getFactory().createPoint(this._points.getCoordinate(l))},i.prototype.interfaces_=function(){return[ya]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(lt),Te=function(){};Te.prototype.interfaces_=function(){return[]},Te.prototype.getClass=function(){return Te};var ge=function(n){function i(l,h){n.call(this,h),this._coordinates=l||null,this.init(this._coordinates)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Vt;var l=new Vt;return l.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),l},i.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&(!(!this.isEmpty()||!l.isEmpty())||this.isEmpty()===l.isEmpty()&&this.equal(l.getCoordinate(),this.getCoordinate(),h))}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){},i.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},i.prototype.getBoundaryDimension=function(){return Be.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getNumPoints=function(){return this.isEmpty()?0:1},i.prototype.reverse=function(){return this.copy()},i.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},i.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0];return this.getCoordinate().compareTo(l.getCoordinate())}if(arguments.length===2){var h=arguments[0];return arguments[1].compare(this._coordinates,h._coordinates)}},i.prototype.apply=function(){if(j(arguments[0],Ut)){var l=arguments[0];if(this.isEmpty())return null;l.filter(this.getCoordinate())}else if(j(arguments[0],Ci)){var h=arguments[0];if(this.isEmpty())return null;h.filter(this._coordinates,0),h.isGeometryChanged()&&this.geometryChanged()}else j(arguments[0],Wi)?arguments[0].filter(this):j(arguments[0],wt)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var l=n.prototype.clone.call(this);return l._coordinates=this._coordinates.clone(),l},i.prototype.getGeometryType=function(){return"Point"},i.prototype.copy=function(){return new i(this._coordinates.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._coordinates},i.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},i.prototype.isEmpty=function(){return this._coordinates.size()===0},i.prototype.init=function(l){l===null&&(l=this.getFactory().getCoordinateSequenceFactory().create([])),P.isTrue(l.size()<=1),this._coordinates=l},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[Te]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(lt),Ne=function(){};Ne.prototype.interfaces_=function(){return[]},Ne.prototype.getClass=function(){return Ne};var ue=function(n){function i(l,h,v){if(n.call(this,v),this._shell=null,this._holes=null,l===null&&(l=this.getFactory().createLinearRing()),h===null&&(h=[]),n.hasNullElements(h))throw new L("holes must not contain null elements");if(l.isEmpty()&&n.hasNonEmptyElements(h))throw new L("shell is empty but holes are not");this._shell=l,this._holes=h}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return n.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var l=new Array(this.getNumPoints()).fill(null),h=-1,v=this._shell.getCoordinates(),S=0;S<v.length;S++)l[++h]=v[S];for(var R=0;R<this._holes.length;R++)for(var V=this._holes[R].getCoordinates(),nt=0;nt<V.length;nt++)l[++h]=V[nt];return l},i.prototype.getArea=function(){var l=0;l+=Math.abs(W.signedArea(this._shell.getCoordinateSequence()));for(var h=0;h<this._holes.length;h++)l-=Math.abs(W.signedArea(this._holes[h].getCoordinateSequence()));return l},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var l=this._shell.getCoordinateSequence(),h=this.getEnvelopeInternal(),v=0;v<5;v++){var S=l.getX(v);if(S!==h.getMinX()&&S!==h.getMaxX())return!1;var R=l.getY(v);if(R!==h.getMinY()&&R!==h.getMaxY())return!1}for(var V=l.getX(0),nt=l.getY(0),_t=1;_t<=4;_t++){var Et=l.getX(_t),Wt=l.getY(_t);if(Et!==V==(Wt!==nt))return!1;V=Et,nt=Wt}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var v=l,S=this._shell,R=v._shell;if(!S.equalsExact(R,h)||this._holes.length!==v._holes.length)return!1;for(var V=0;V<this._holes.length;V++)if(!this._holes[V].equalsExact(v._holes[V],h))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var l=0;l<this._holes.length;l++)this.normalize(this._holes[l],!1);Ho.sort(this._holes)}else if(arguments.length===2){var h=arguments[0],v=arguments[1];if(h.isEmpty())return null;var S=new Array(h.getCoordinates().length-1).fill(null);Zt.arraycopy(h.getCoordinates(),0,S,0,S.length);var R=Mt.minCoordinate(h.getCoordinates());Mt.scroll(S,R),Zt.arraycopy(S,0,h.getCoordinates(),0,S.length),h.getCoordinates()[S.length]=S[0],W.isCCW(h.getCoordinates())===v&&Mt.reverse(h.getCoordinates())}},i.prototype.getCoordinate=function(){return this._shell.getCoordinate()},i.prototype.getNumInteriorRing=function(){return this._holes.length},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.getLength=function(){var l=0;l+=this._shell.getLength();for(var h=0;h<this._holes.length;h++)l+=this._holes[h].getLength();return l},i.prototype.getNumPoints=function(){for(var l=this._shell.getNumPoints(),h=0;h<this._holes.length;h++)l+=this._holes[h].getNumPoints();return l},i.prototype.reverse=function(){var l=this.copy();l._shell=this._shell.copy().reverse(),l._holes=new Array(this._holes.length).fill(null);for(var h=0;h<this._holes.length;h++)l._holes[h]=this._holes[h].copy().reverse();return l},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0],h=this._shell,v=l._shell;return h.compareToSameClass(v)}if(arguments.length===2){var S=arguments[0],R=arguments[1],V=S,nt=this._shell,_t=V._shell,Et=nt.compareToSameClass(_t,R);if(Et!==0)return Et;for(var Wt=this.getNumInteriorRing(),$t=V.getNumInteriorRing(),ie=0;ie<Wt&&ie<$t;){var Ee=this.getInteriorRingN(ie),An=V.getInteriorRingN(ie),Wn=Ee.compareToSameClass(An,R);if(Wn!==0)return Wn;ie++}return ie<Wt?1:ie<$t?-1:0}},i.prototype.apply=function(l){if(j(l,Ut)){this._shell.apply(l);for(var h=0;h<this._holes.length;h++)this._holes[h].apply(l)}else if(j(l,Ci)){if(this._shell.apply(l),!l.isDone())for(var v=0;v<this._holes.length&&(this._holes[v].apply(l),!l.isDone());v++);l.isGeometryChanged()&&this.geometryChanged()}else if(j(l,Wi))l.filter(this);else if(j(l,wt)){l.filter(this),this._shell.apply(l);for(var S=0;S<this._holes.length;S++)this._holes[S].apply(l)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var l=new Array(this._holes.length+1).fill(null);l[0]=this._shell;for(var h=0;h<this._holes.length;h++)l[h+1]=this._holes[h];return l.length<=1?this.getFactory().createLinearRing(l[0].getCoordinateSequence()):this.getFactory().createMultiLineString(l)},i.prototype.clone=function(){var l=n.prototype.clone.call(this);l._shell=this._shell.clone(),l._holes=new Array(this._holes.length).fill(null);for(var h=0;h<this._holes.length;h++)l._holes[h]=this._holes[h].clone();return l},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var l=this._shell.copy(),h=new Array(this._holes.length).fill(null),v=0;v<h.length;v++)h[v]=this._holes[v].copy();return new i(l,h,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(l){return this._holes[l]},i.prototype.interfaces_=function(){return[Ne]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,s),i}(lt),Oe=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return lt.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&n.prototype.equalsExact.call(this,l,h)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var l=arguments[0];return this._geometries[l].getCoordinate()}return n.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return Be.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.getGeometryType=function(){return"MultiPoint"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.interfaces_=function(){return[Te]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(Sr),bn=function(n){function i(l,h){l instanceof U&&h instanceof Ce&&(l=h.getCoordinateSequenceFactory().create(l)),n.call(this,l,h),this.validateConstruction()}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return lt.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return Be.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var l=this._points.copy();return Yt.reverse(l),this.getFactory().createLinearRing(l)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new L("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new L("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},i.prototype.getGeometryType=function(){return"LinearRing"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.MINIMUM_VALID_SIZE.get=function(){return 4},s.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(i,s),i}(Qt),Un=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return lt.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&n.prototype.equalsExact.call(this,l,h)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),v=0;v<this._geometries.length;v++)h[v]=this._geometries[v].reverse();return this.getFactory().createMultiPolygon(h)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var l=new ct,h=0;h<this._geometries.length;h++)for(var v=this._geometries[h].getBoundary(),S=0;S<v.getNumGeometries();S++)l.add(v.getGeometryN(S));var R=new Array(l.size()).fill(null);return this.getFactory().createMultiLineString(l.toArray(R))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.interfaces_=function(){return[Ne]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,s),i}(Sr),Kn=function(n){this._factory=n||null,this._isUserDataCopied=!1},qi={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Kn.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},Kn.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},Kn.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof Sr?this.editGeometryCollection(n,i):n instanceof ue?this.editPolygon(n,i):n instanceof ge?i.edit(n,this._factory):n instanceof Qt?i.edit(n,this._factory):(P.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},Kn.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),l=new ct,h=0;h<s.getNumGeometries();h++){var v=this.edit(s.getGeometryN(h),i);v===null||v.isEmpty()||l.add(v)}return s.getClass()===Oe?this._factory.createMultiPoint(l.toArray([])):s.getClass()===K?this._factory.createMultiLineString(l.toArray([])):s.getClass()===Un?this._factory.createMultiPolygon(l.toArray([])):this._factory.createGeometryCollection(l.toArray([]))},Kn.prototype.editPolygon=function(n,i){var s=i.edit(n,this._factory);if(s===null&&(s=this._factory.createPolygon(null)),s.isEmpty())return s;var l=this.edit(s.getExteriorRing(),i);if(l===null||l.isEmpty())return this._factory.createPolygon();for(var h=new ct,v=0;v<s.getNumInteriorRing();v++){var S=this.edit(s.getInteriorRingN(v),i);S===null||S.isEmpty()||h.add(S)}return this._factory.createPolygon(l,h.toArray([]))},Kn.prototype.interfaces_=function(){return[]},Kn.prototype.getClass=function(){return Kn},Kn.GeometryEditorOperation=function(){},qi.NoOpGeometryOperation.get=function(){return ir},qi.CoordinateOperation.get=function(){return ze},qi.CoordinateSequenceOperation.get=function(){return Cs},Object.defineProperties(Kn,qi);var ir=function(){};ir.prototype.edit=function(n,i){return n},ir.prototype.interfaces_=function(){return[Kn.GeometryEditorOperation]},ir.prototype.getClass=function(){return ir};var ze=function(){};ze.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof bn?i.createLinearRing(s):n instanceof Qt?i.createLineString(s):n instanceof ge?s.length>0?i.createPoint(s[0]):i.createPoint():n},ze.prototype.interfaces_=function(){return[Kn.GeometryEditorOperation]},ze.prototype.getClass=function(){return ze};var Cs=function(){};Cs.prototype.edit=function(n,i){return n instanceof bn?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof Qt?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof ge?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},Cs.prototype.interfaces_=function(){return[Kn.GeometryEditorOperation]},Cs.prototype.getClass=function(){return Cs};var De=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var i=0;i<n;i++)this._coordinates[i]=new U}else if(j(arguments[0],bt)){var s=arguments[0];if(s===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=s.getDimension(),this._coordinates=new Array(s.size()).fill(null);for(var l=0;l<this._coordinates.length;l++)this._coordinates[l]=s.getCoordinateCopy(l)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var h=arguments[0],v=arguments[1];this._coordinates=h,this._dimension=v,h===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var S=arguments[0],R=arguments[1];this._coordinates=new Array(S).fill(null),this._dimension=R;for(var V=0;V<S;V++)this._coordinates[V]=new U}}},Vo={serialVersionUID:{configurable:!0}};De.prototype.setOrdinate=function(n,i,s){switch(i){case bt.X:this._coordinates[n].x=s;break;case bt.Y:this._coordinates[n].y=s;break;case bt.Z:this._coordinates[n].z=s;break;default:throw new L("invalid ordinateIndex")}},De.prototype.size=function(){return this._coordinates.length},De.prototype.getOrdinate=function(n,i){switch(i){case bt.X:return this._coordinates[n].x;case bt.Y:return this._coordinates[n].y;case bt.Z:return this._coordinates[n].z}return A.NaN},De.prototype.getCoordinate=function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var i=arguments[0],s=arguments[1];s.x=this._coordinates[i].x,s.y=this._coordinates[i].y,s.z=this._coordinates[i].z}},De.prototype.getCoordinateCopy=function(n){return new U(this._coordinates[n])},De.prototype.getDimension=function(){return this._dimension},De.prototype.getX=function(n){return this._coordinates[n].x},De.prototype.clone=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].clone();return new De(n,this._dimension)},De.prototype.expandEnvelope=function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n},De.prototype.copy=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].copy();return new De(n,this._dimension)},De.prototype.toString=function(){if(this._coordinates.length>0){var n=new Tt(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)n.append(", "),n.append(this._coordinates[i]);return n.append(")"),n.toString()}return"()"},De.prototype.getY=function(n){return this._coordinates[n].y},De.prototype.toCoordinateArray=function(){return this._coordinates},De.prototype.interfaces_=function(){return[bt,t]},De.prototype.getClass=function(){return De},Vo.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(De,Vo);var Pi=function(){},Wo={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};Pi.prototype.readResolve=function(){return Pi.instance()},Pi.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new De(n)}if(j(arguments[0],bt)){var i=arguments[0];return new De(i)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return l>3&&(l=3),l<2?new De(s):new De(s,l)}},Pi.prototype.interfaces_=function(){return[gt,t]},Pi.prototype.getClass=function(){return Pi},Pi.instance=function(){return Pi.instanceObject},Wo.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Wo.instanceObject.get=function(){return new Pi},Object.defineProperties(Pi,Wo);var Ka=function(n){function i(){n.call(this),this.map_=new Map}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(s){return this.map_.get(s)||null},i.prototype.put=function(s,l){return this.map_.set(s,l),l},i.prototype.values=function(){for(var s=new ct,l=this.map_.values(),h=l.next();!h.done;)s.add(h.value),h=l.next();return s},i.prototype.entrySet=function(){var s=new zr;return this.map_.entries().forEach(function(l){return s.add(l)}),s},i.prototype.size=function(){return this.map_.size()},i}($e),Me=function n(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=n.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ti){var i=arguments[0];this._modelType=i,i===n.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var s=arguments[0];this._modelType=n.FIXED,this.setScale(s)}else if(arguments[0]instanceof n){var l=arguments[0];this._modelType=l._modelType,this._scale=l._scale}}},Xi={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Me.prototype.equals=function(n){if(!(n instanceof Me))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale},Me.prototype.compareTo=function(n){var i=n,s=this.getMaximumSignificantDigits(),l=i.getMaximumSignificantDigits();return new ft(s).compareTo(new ft(l))},Me.prototype.getScale=function(){return this._scale},Me.prototype.isFloating=function(){return this._modelType===Me.FLOATING||this._modelType===Me.FLOATING_SINGLE},Me.prototype.getType=function(){return this._modelType},Me.prototype.toString=function(){var n="UNKNOWN";return this._modelType===Me.FLOATING?n="Floating":this._modelType===Me.FLOATING_SINGLE?n="Floating-Single":this._modelType===Me.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n},Me.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var n=arguments[0];return A.isNaN(n)||this._modelType===Me.FLOATING_SINGLE?n:this._modelType===Me.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof U){var i=arguments[0];if(this._modelType===Me.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},Me.prototype.getMaximumSignificantDigits=function(){var n=16;return this._modelType===Me.FLOATING?n=16:this._modelType===Me.FLOATING_SINGLE?n=6:this._modelType===Me.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n},Me.prototype.setScale=function(n){this._scale=Math.abs(n)},Me.prototype.interfaces_=function(){return[t,G]},Me.prototype.getClass=function(){return Me},Me.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Xi.serialVersionUID.get=function(){return 7777263578777804e3},Xi.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(Me,Xi);var ti=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},ei={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ti.prototype.readResolve=function(){return ti.nameToTypeMap.get(this._name)},ti.prototype.toString=function(){return this._name},ti.prototype.interfaces_=function(){return[t]},ti.prototype.getClass=function(){return ti},ei.serialVersionUID.get=function(){return-552860263173159e4},ei.nameToTypeMap.get=function(){return new Ka},Object.defineProperties(ti,ei),Me.Type=ti,Me.FIXED=new ti("FIXED"),Me.FLOATING=new ti("FLOATING"),Me.FLOATING_SINGLE=new ti("FLOATING SINGLE");var Ce=function n(){this._precisionModel=new Me,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?j(arguments[0],gt)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Me&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},Ou={serialVersionUID:{configurable:!0}};Ce.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new U(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new U(n.getMinX(),n.getMinY()),new U(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new U(n.getMinX(),n.getMinY()),new U(n.getMinX(),n.getMaxY()),new U(n.getMaxX(),n.getMaxY()),new U(n.getMaxX(),n.getMinY()),new U(n.getMinX(),n.getMinY())]),null)},Ce.prototype.createLineString=function(n){return n?n instanceof Array?new Qt(this.getCoordinateSequenceFactory().create(n),this):j(n,bt)?new Qt(n,this):void 0:new Qt(this.getCoordinateSequenceFactory().create([]),this)},Ce.prototype.createMultiLineString=function(){if(arguments.length===0)return new K(null,this);if(arguments.length===1){var n=arguments[0];return new K(n,this)}},Ce.prototype.buildGeometry=function(n){for(var i=null,s=!1,l=!1,h=n.iterator();h.hasNext();){var v=h.next(),S=v.getClass();i===null&&(i=S),S!==i&&(s=!0),v.isGeometryCollectionOrDerived()&&(l=!0)}if(i===null)return this.createGeometryCollection();if(s||l)return this.createGeometryCollection(Ce.toGeometryArray(n));var R=n.iterator().next();if(n.size()>1){if(R instanceof ue)return this.createMultiPolygon(Ce.toPolygonArray(n));if(R instanceof Qt)return this.createMultiLineString(Ce.toLineStringArray(n));if(R instanceof ge)return this.createMultiPoint(Ce.toPointArray(n));P.shouldNeverReachHere("Unhandled class: "+R.getClass().getName())}return R},Ce.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},Ce.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof U){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(j(arguments[0],bt)){var i=arguments[0];return new ge(i,this)}}},Ce.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Ce.prototype.createPolygon=function(){if(arguments.length===0)return new ue(null,null,this);if(arguments.length===1){if(j(arguments[0],bt)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var i=arguments[0];return this.createPolygon(this.createLinearRing(i))}if(arguments[0]instanceof bn){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];return new ue(l,h,this)}},Ce.prototype.getSRID=function(){return this._SRID},Ce.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Sr(null,this);if(arguments.length===1){var n=arguments[0];return new Sr(n,this)}},Ce.prototype.createGeometry=function(n){return new Kn(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},Ce.prototype.getPrecisionModel=function(){return this._precisionModel},Ce.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(j(arguments[0],bt)){var i=arguments[0];return new bn(i,this)}}},Ce.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Un(null,this);if(arguments.length===1){var n=arguments[0];return new Un(n,this)}},Ce.prototype.createMultiPoint=function(){if(arguments.length===0)return new Oe(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new Oe(n,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if(j(arguments[0],bt)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var l=new Array(s.size()).fill(null),h=0;h<s.size();h++){var v=this.getCoordinateSequenceFactory().create(1,s.getDimension());Yt.copy(s,h,v,0,1),l[h]=this.createPoint(v)}return this.createMultiPoint(l)}}},Ce.prototype.interfaces_=function(){return[t]},Ce.prototype.getClass=function(){return Ce},Ce.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.getDefaultCoordinateSequenceFactory=function(){return Pi.instance()},Ce.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},Ou.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(Ce,Ou);var Qa=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],gl=function(n){this.geometryFactory=n||new Ce};gl.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!no[s])throw new Error("Unknown GeoJSON type: "+i.type);return Qa.indexOf(s)!==-1?no[s].apply(this,[i.coordinates]):s==="GeometryCollection"?no[s].apply(this,[i.geometries]):no[s].apply(this,[i])},gl.prototype.write=function(n){var i=n.getGeometryType();if(!_o[i])throw new Error("Geometry is not supported");return _o[i].apply(this,[n])};var no={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var l=n.geometry.type;if(!no[l])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=no.bbox.apply(this,[n.bbox])),i},FeatureCollection:function(n){var i={};if(n.features){i.features=[];for(var s=0;s<n.features.length;++s)i.features.push(this.read(n.features[s]))}return n.bbox&&(i.bbox=this.parse.bbox.apply(this,[n.bbox])),i},coordinates:function(n){for(var i=[],s=0;s<n.length;++s){var l=n[s];i.push(new U(l[0],l[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new U(n[0],n[1]),new U(n[2],n[1]),new U(n[2],n[3]),new U(n[0],n[3]),new U(n[0],n[1])])},Point:function(n){var i=new U(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(no.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=no.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(no.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=no.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),l=[],h=1;h<n.length;++h){var v=n[h],S=no.coordinates.apply(this,[v]),R=this.geometryFactory.createLinearRing(S);l.push(R)}return this.geometryFactory.createPolygon(s,l)},MultiPolygon:function(n){for(var i=[],s=0;s<n.length;++s){var l=n[s];i.push(no.Polygon.apply(this,[l]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(n){for(var i=[],s=0;s<n.length;++s){var l=n[s];i.push(this.read(l))}return this.geometryFactory.createGeometryCollection(i)}},_o={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:_o.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=_o.Point.apply(this,[l]);i.push(h.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(n){for(var i=[],s=n.getCoordinates(),l=0;l<s.length;++l){var h=s[l];i.push(_o.coordinate.apply(this,[h]))}return{type:"LineString",coordinates:i}},MultiLineString:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=_o.LineString.apply(this,[l]);i.push(h.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=_o.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var l=0;l<n._holes.length;++l){var h=n._holes[l],v=_o.LineString.apply(this,[h]);i.push(v.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=_o.Polygon.apply(this,[l]);i.push(h.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=l.getGeometryType();i.push(_o[h].apply(this,[l]))}return{type:"GeometryCollection",geometries:i}}},Du=function(n){this.geometryFactory=n||new Ce,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new gl(this.geometryFactory)};Du.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===Me.FIXED&&this.reducePrecision(i),i},Du.prototype.reducePrecision=function(n){var i,s;if(n.coordinate)this.precisionModel.makePrecise(n.coordinate);else if(n.points)for(i=0,s=n.points.length;i<s;i++)this.precisionModel.makePrecise(n.points[i]);else if(n.geometries)for(i=0,s=n.geometries.length;i<s;i++)this.reducePrecision(n.geometries[i])};var va=function(){this.parser=new gl(this.geometryFactory)};va.prototype.write=function(n){return this.parser.write(n)};var Gt=function(){},Fu={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};Gt.prototype.interfaces_=function(){return[]},Gt.prototype.getClass=function(){return Gt},Gt.opposite=function(n){return n===Gt.LEFT?Gt.RIGHT:n===Gt.RIGHT?Gt.LEFT:n},Fu.ON.get=function(){return 0},Fu.LEFT.get=function(){return 1},Fu.RIGHT.get=function(){return 2},Object.defineProperties(Gt,Fu),(I.prototype=new Error).name="EmptyStackException",(M.prototype=new kt).add=function(n){return this.array_.push(n),!0},M.prototype.get=function(n){if(n<0||n>=this.size())throw new Error;return this.array_[n]},M.prototype.push=function(n){return this.array_.push(n),n},M.prototype.pop=function(n){if(this.array_.length===0)throw new I;return this.array_.pop()},M.prototype.peek=function(){if(this.array_.length===0)throw new I;return this.array_[this.array_.length-1]},M.prototype.empty=function(){return this.array_.length===0},M.prototype.isEmpty=function(){return this.empty()},M.prototype.search=function(n){return this.array_.indexOf(n)},M.prototype.size=function(){return this.array_.length},M.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n};var xo=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};xo.prototype.getCoordinate=function(){return this._minCoord},xo.prototype.getRightmostSide=function(n,i){var s=this.getRightmostSideOfSegment(n,i);return s<0&&(s=this.getRightmostSideOfSegment(n,i-1)),s<0&&(this._minCoord=null,this.checkForRightmostCoordinate(n)),s},xo.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();P.isTrue(this._minIndex>0&&this._minIndex<n.length,"rightmost point expected to be interior vertex of edge");var i=n[this._minIndex-1],s=n[this._minIndex+1],l=W.computeOrientation(this._minCoord,s,i),h=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&l===W.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&l===W.CLOCKWISE)&&(h=!0),h&&(this._minIndex=this._minIndex-1)},xo.prototype.getRightmostSideOfSegment=function(n,i){var s=n.getEdge().getCoordinates();if(i<0||i+1>=s.length||s[i].y===s[i+1].y)return-1;var l=Gt.LEFT;return s[i].y<s[i+1].y&&(l=Gt.RIGHT),l},xo.prototype.getEdge=function(){return this._orientedDe},xo.prototype.checkForRightmostCoordinate=function(n){for(var i=n.getEdge().getCoordinates(),s=0;s<i.length-1;s++)(this._minCoord===null||i[s].x>this._minCoord.x)&&(this._minDe=n,this._minIndex=s,this._minCoord=i[s])},xo.prototype.findRightmostEdgeAtNode=function(){var n=this._minDe.getNode().getEdges();this._minDe=n.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},xo.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}P.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===Gt.LEFT&&(this._orientedDe=this._minDe.getSym())},xo.prototype.interfaces_=function(){return[]},xo.prototype.getClass=function(){return xo};var qo=function(n){function i(s,l){n.call(this,i.msgWithCoord(s,l)),this.pt=l?new U(l):null,this.name="TopologyException"}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getCoordinate=function(){return this.pt},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.msgWithCoord=function(s,l){return l?s:s+" [ "+l+" ]"},i}(it),Uu=function(){this.array_=[]};Uu.prototype.addLast=function(n){this.array_.push(n)},Uu.prototype.removeFirst=function(){return this.array_.shift()},Uu.prototype.isEmpty=function(){return this.array_.length===0};var kr=function(){this._finder=null,this._dirEdgeList=new ct,this._nodes=new ct,this._rightMostCoord=null,this._env=null,this._finder=new xo};kr.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},kr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},kr.prototype.computeNodeDepth=function(n){for(var i=null,s=n.getEdges().iterator();s.hasNext();){var l=s.next();if(l.isVisited()||l.getSym().isVisited()){i=l;break}}if(i===null)throw new qo("unable to find edge to compute depths at "+n.getCoordinate());n.getEdges().computeDepths(i);for(var h=n.getEdges().iterator();h.hasNext();){var v=h.next();v.setVisited(!0),this.copySymDepths(v)}},kr.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(Gt.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},kr.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},kr.prototype.findResultEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();){var i=n.next();i.getDepth(Gt.RIGHT)>=1&&i.getDepth(Gt.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},kr.prototype.computeDepths=function(n){var i=new zr,s=new Uu,l=n.getNode();for(s.addLast(l),i.add(l),n.setVisited(!0);!s.isEmpty();){var h=s.removeFirst();i.add(h),this.computeNodeDepth(h);for(var v=h.getEdges().iterator();v.hasNext();){var S=v.next().getSym();if(!S.isVisited()){var R=S.getNode();i.contains(R)||(s.addLast(R),i.add(R))}}}},kr.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},kr.prototype.getEnvelope=function(){if(this._env===null){for(var n=new Vt,i=this._dirEdgeList.iterator();i.hasNext();)for(var s=i.next().getEdge().getCoordinates(),l=0;l<s.length-1;l++)n.expandToInclude(s[l]);this._env=n}return this._env},kr.prototype.addReachable=function(n){var i=new M;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},kr.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(Gt.LEFT,n.getDepth(Gt.RIGHT)),i.setDepth(Gt.RIGHT,n.getDepth(Gt.LEFT))},kr.prototype.add=function(n,i){n.setVisited(!0),this._nodes.add(n);for(var s=n.getEdges().iterator();s.hasNext();){var l=s.next();this._dirEdgeList.add(l);var h=l.getSym().getNode();h.isVisited()||i.push(h)}},kr.prototype.getNodes=function(){return this._nodes},kr.prototype.getDirectedEdges=function(){return this._dirEdgeList},kr.prototype.interfaces_=function(){return[G]},kr.prototype.getClass=function(){return kr};var Hn=function n(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var i=arguments[0];this.init(i.length)}else if(Number.isInteger(arguments[0])){var s=arguments[0];this.init(1),this.location[Gt.ON]=s}else if(arguments[0]instanceof n){var l=arguments[0];if(this.init(l.location.length),l!==null)for(var h=0;h<this.location.length;h++)this.location[h]=l.location[h]}}else if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];this.init(3),this.location[Gt.ON]=v,this.location[Gt.LEFT]=S,this.location[Gt.RIGHT]=R}};Hn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},Hn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==$.NONE)return!1;return!0},Hn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===$.NONE&&(this.location[i]=n)},Hn.prototype.isLine=function(){return this.location.length===1},Hn.prototype.merge=function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[Gt.ON]=this.location[Gt.ON],i[Gt.LEFT]=$.NONE,i[Gt.RIGHT]=$.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===$.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},Hn.prototype.getLocations=function(){return this.location},Hn.prototype.flip=function(){if(this.location.length<=1)return null;var n=this.location[Gt.LEFT];this.location[Gt.LEFT]=this.location[Gt.RIGHT],this.location[Gt.RIGHT]=n},Hn.prototype.toString=function(){var n=new Tt;return this.location.length>1&&n.append($.toLocationSymbol(this.location[Gt.LEFT])),n.append($.toLocationSymbol(this.location[Gt.ON])),this.location.length>1&&n.append($.toLocationSymbol(this.location[Gt.RIGHT])),n.toString()},Hn.prototype.setLocations=function(n,i,s){this.location[Gt.ON]=n,this.location[Gt.LEFT]=i,this.location[Gt.RIGHT]=s},Hn.prototype.get=function(n){return n<this.location.length?this.location[n]:$.NONE},Hn.prototype.isArea=function(){return this.location.length>1},Hn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===$.NONE)return!0;return!1},Hn.prototype.setLocation=function(){if(arguments.length===1){var n=arguments[0];this.setLocation(Gt.ON,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.location[i]=s}},Hn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations($.NONE)},Hn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},Hn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},Hn.prototype.interfaces_=function(){return[]},Hn.prototype.getClass=function(){return Hn};var Tn=function n(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var i=arguments[0];this.elt[0]=new Hn(i),this.elt[1]=new Hn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new Hn(s.elt[0]),this.elt[1]=new Hn(s.elt[1])}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.elt[0]=new Hn($.NONE),this.elt[1]=new Hn($.NONE),this.elt[l].setLocation(h)}else if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];this.elt[0]=new Hn(v,S,R),this.elt[1]=new Hn(v,S,R)}else if(arguments.length===4){var V=arguments[0],nt=arguments[1],_t=arguments[2],Et=arguments[3];this.elt[0]=new Hn($.NONE,$.NONE,$.NONE),this.elt[1]=new Hn($.NONE,$.NONE,$.NONE),this.elt[V].setLocations(nt,_t,Et)}};Tn.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},Tn.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},Tn.prototype.isNull=function(n){return this.elt[n].isNull()},Tn.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.elt[i].setAllLocationsIfNull(s)}},Tn.prototype.isLine=function(n){return this.elt[n].isLine()},Tn.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new Hn(n.elt[i]):this.elt[i].merge(n.elt[i])},Tn.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},Tn.prototype.getLocation=function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(Gt.ON)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.elt[i].get(s)}},Tn.prototype.toString=function(){var n=new Tt;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()},Tn.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}},Tn.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},Tn.prototype.setLocation=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(Gt.ON,i)}else if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];this.elt[s].setLocation(l,h)}},Tn.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},Tn.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},Tn.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new Hn(this.elt[n].location[0]))},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn},Tn.toLineLabel=function(n){for(var i=new Tn($.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var pr=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new ct,this._pts=new ct,this._label=new Tn($.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new ct,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};pr.prototype.computeRing=function(){if(this._ring!==null)return null;for(var n=new Array(this._pts.size()).fill(null),i=0;i<this._pts.size();i++)n[i]=this._pts.get(i);this._ring=this._geometryFactory.createLinearRing(n),this._isHole=W.isCCW(this._ring.getCoordinates())},pr.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},pr.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new qo("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new qo("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var l=i.getLabel();P.isTrue(l.isArea()),this.mergeLabel(l),this.addPoints(i.getEdge(),i.isForward(),s),s=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},pr.prototype.getLinearRing=function(){return this._ring},pr.prototype.getCoordinate=function(n){return this._pts.get(n)},pr.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var n=this._startDe;do{var i=n.getNode().getEdges().getOutgoingDegree(this);i>this._maxNodeDegree&&(this._maxNodeDegree=i),n=this.getNext(n)}while(n!==this._startDe);this._maxNodeDegree*=2},pr.prototype.addPoints=function(n,i,s){var l=n.getCoordinates();if(i){var h=1;s&&(h=0);for(var v=h;v<l.length;v++)this._pts.add(l[v])}else{var S=l.length-2;s&&(S=l.length-1);for(var R=S;R>=0;R--)this._pts.add(l[R])}},pr.prototype.isHole=function(){return this._isHole},pr.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},pr.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!W.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},pr.prototype.addHole=function(n){this._holes.add(n)},pr.prototype.isShell=function(){return this._shell===null},pr.prototype.getLabel=function(){return this._label},pr.prototype.getEdges=function(){return this._edges},pr.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},pr.prototype.getShell=function(){return this._shell},pr.prototype.mergeLabel=function(){if(arguments.length===1){var n=arguments[0];this.mergeLabel(n,0),this.mergeLabel(n,1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],l=i.getLocation(s,Gt.RIGHT);if(l===$.NONE)return null;if(this._label.getLocation(s)===$.NONE)return this._label.setLocation(s,l),null}},pr.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},pr.prototype.toPolygon=function(n){for(var i=new Array(this._holes.size()).fill(null),s=0;s<this._holes.size();s++)i[s]=this._holes.get(s).getLinearRing();return n.createPolygon(this.getLinearRing(),i)},pr.prototype.interfaces_=function(){return[]},pr.prototype.getClass=function(){return pr};var nd=function(n){function i(){var s=arguments[0],l=arguments[1];n.call(this,s,l)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(s,l){s.setMinEdgeRing(l)},i.prototype.getNext=function(s){return s.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(pr),Of=function(n){function i(){var s=arguments[0],l=arguments[1];n.call(this,s,l)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var s=new ct,l=this._startDe;do{if(l.getMinEdgeRing()===null){var h=new nd(l,this._geometryFactory);s.add(h)}l=l.getNext()}while(l!==this._startDe);return s},i.prototype.setEdgeRing=function(s,l){s.setEdgeRing(l)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var s=this._startDe;do s.getNode().getEdges().linkMinimalDirectedEdges(this),s=s.getNext();while(s!==this._startDe)},i.prototype.getNext=function(s){return s.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(pr),Ii=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._label=n}}};Ii.prototype.setVisited=function(n){this._isVisited=n},Ii.prototype.setInResult=function(n){this._isInResult=n},Ii.prototype.isCovered=function(){return this._isCovered},Ii.prototype.isCoveredSet=function(){return this._isCoveredSet},Ii.prototype.setLabel=function(n){this._label=n},Ii.prototype.getLabel=function(){return this._label},Ii.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},Ii.prototype.updateIM=function(n){P.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},Ii.prototype.isInResult=function(){return this._isInResult},Ii.prototype.isVisited=function(){return this._isVisited},Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii};var ml=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var s=arguments[0],l=arguments[1];this._coord=s,this._edges=l,this._label=new Tn(0,$.NONE)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var s=this.getEdges().getEdges().iterator();s.hasNext();)if(s.next().getEdge().isInResult())return!0;return!1},i.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},i.prototype.getCoordinate=function(){return this._coord},i.prototype.print=function(s){s.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(s){},i.prototype.computeMergedLocation=function(s,l){var h=$.NONE;if(h=this._label.getLocation(l),!s.isNull(l)){var v=s.getLocation(l);h!==$.BOUNDARY&&(h=v)}return h},i.prototype.setLabel=function(){if(arguments.length!==2)return n.prototype.setLabel.apply(this,arguments);var s=arguments[0],l=arguments[1];this._label===null?this._label=new Tn(s,l):this._label.setLocation(s,l)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof Tn)for(var l=arguments[0],h=0;h<2;h++){var v=this.computeMergedLocation(l,h);this._label.getLocation(h)===$.NONE&&this._label.setLocation(h,v)}},i.prototype.add=function(s){this._edges.insert(s),s.setNode(this)},i.prototype.setLabelBoundary=function(s){if(this._label===null)return null;var l=$.NONE;this._label!==null&&(l=this._label.getLocation(s));var h=null;switch(l){case $.BOUNDARY:h=$.INTERIOR;break;case $.INTERIOR:default:h=$.BOUNDARY}this._label.setLocation(s,h)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Ii),Eo=function(){this.nodeMap=new w,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};Eo.prototype.find=function(n){return this.nodeMap.get(n)},Eo.prototype.addNode=function(){if(arguments[0]instanceof U){var n=arguments[0],i=this.nodeMap.get(n);return i===null&&(i=this.nodeFact.createNode(n),this.nodeMap.put(n,i)),i}if(arguments[0]instanceof ml){var s=arguments[0],l=this.nodeMap.get(s.getCoordinate());return l===null?(this.nodeMap.put(s.getCoordinate(),s),s):(l.mergeLabel(s),l)}},Eo.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},Eo.prototype.iterator=function(){return this.nodeMap.values().iterator()},Eo.prototype.values=function(){return this.nodeMap.values()},Eo.prototype.getBoundaryNodes=function(n){for(var i=new ct,s=this.iterator();s.hasNext();){var l=s.next();l.getLabel().getLocation(n)===$.BOUNDARY&&i.add(l)}return i},Eo.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},Eo.prototype.interfaces_=function(){return[]},Eo.prototype.getClass=function(){return Eo};var kn=function(){},_a={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};kn.prototype.interfaces_=function(){return[]},kn.prototype.getClass=function(){return kn},kn.isNorthern=function(n){return n===kn.NE||n===kn.NW},kn.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},kn.commonHalfPlane=function(n,i){if(n===i)return n;if((n-i+4)%4===2)return-1;var s=n<i?n:i;return s===0&&(n>i?n:i)===3?3:s},kn.isInHalfPlane=function(n,i){return i===kn.SE?n===kn.SE||n===kn.SW:n===i||n===i+1},kn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new L("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?kn.NE:kn.SE:i>=0?kn.NW:kn.SW}if(arguments[0]instanceof U&&arguments[1]instanceof U){var s=arguments[0],l=arguments[1];if(l.x===s.x&&l.y===s.y)throw new L("Cannot compute the quadrant for two identical points "+s);return l.x>=s.x?l.y>=s.y?kn.NE:kn.SE:l.y>=s.y?kn.NW:kn.SW}},_a.NE.get=function(){return 0},_a.NW.get=function(){return 1},_a.SW.get=function(){return 2},_a.SE.get=function(){return 3},Object.defineProperties(kn,_a);var Gr=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];this._edge=i,this.init(s,l),this._label=null}else if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3];this._edge=h,this.init(v,S),this._label=R}};Gr.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:W.computeOrientation(n._p0,n._p1,this._p1)},Gr.prototype.getDy=function(){return this._dy},Gr.prototype.getCoordinate=function(){return this._p0},Gr.prototype.setNode=function(n){this._node=n},Gr.prototype.print=function(n){var i=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),l=s.lastIndexOf("."),h=s.substring(l+1);n.print(" "+h+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},Gr.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},Gr.prototype.getDirectedCoordinate=function(){return this._p1},Gr.prototype.getDx=function(){return this._dx},Gr.prototype.getLabel=function(){return this._label},Gr.prototype.getEdge=function(){return this._edge},Gr.prototype.getQuadrant=function(){return this._quadrant},Gr.prototype.getNode=function(){return this._node},Gr.prototype.toString=function(){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),s=i.lastIndexOf(".");return" "+i.substring(s+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label},Gr.prototype.computeLabel=function(n){},Gr.prototype.init=function(n,i){this._p0=n,this._p1=i,this._dx=i.x-n.x,this._dy=i.y-n.y,this._quadrant=kn.quadrant(this._dx,this._dy),P.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},Gr.prototype.interfaces_=function(){return[G]},Gr.prototype.getClass=function(){return Gr};var Ac=function(n){function i(){var s=arguments[0],l=arguments[1];if(n.call(this,s),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=l,l)this.init(s.getCoordinate(0),s.getCoordinate(1));else{var h=s.getNumPoints()-1;this.init(s.getCoordinate(h),s.getCoordinate(h-1))}this.computeDirectedLabel()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(s){return this._depth[s]},i.prototype.setVisited=function(s){this._isVisited=s},i.prototype.computeDirectedLabel=function(){this._label=new Tn(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(s,l){if(this._depth[s]!==-999&&this._depth[s]!==l)throw new qo("assigned depths do not match",this.getCoordinate());this._depth[s]=l},i.prototype.isInteriorAreaEdge=function(){for(var s=!0,l=0;l<2;l++)this._label.isArea(l)&&this._label.getLocation(l,Gt.LEFT)===$.INTERIOR&&this._label.getLocation(l,Gt.RIGHT)===$.INTERIOR||(s=!1);return s},i.prototype.setNextMin=function(s){this._nextMin=s},i.prototype.print=function(s){n.prototype.print.call(this,s),s.print(" "+this._depth[Gt.LEFT]+"/"+this._depth[Gt.RIGHT]),s.print(" ("+this.getDepthDelta()+")"),this._isInResult&&s.print(" inResult")},i.prototype.setMinEdgeRing=function(s){this._minEdgeRing=s},i.prototype.isLineEdge=function(){var s=this._label.isLine(0)||this._label.isLine(1),l=!this._label.isArea(0)||this._label.allPositionsEqual(0,$.EXTERIOR),h=!this._label.isArea(1)||this._label.allPositionsEqual(1,$.EXTERIOR);return s&&l&&h},i.prototype.setEdgeRing=function(s){this._edgeRing=s},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var s=this._edge.getDepthDelta();return this._isForward||(s=-s),s},i.prototype.setInResult=function(s){this._isInResult=s},i.prototype.getSym=function(){return this._sym},i.prototype.isForward=function(){return this._isForward},i.prototype.getEdge=function(){return this._edge},i.prototype.printEdge=function(s){this.print(s),s.print(" "),this._isForward?this._edge.print(s):this._edge.printReverse(s)},i.prototype.setSym=function(s){this._sym=s},i.prototype.setVisitedEdge=function(s){this.setVisited(s),this._sym.setVisited(s)},i.prototype.setEdgeDepths=function(s,l){var h=this.getEdge().getDepthDelta();this._isForward||(h=-h);var v=1;s===Gt.LEFT&&(v=-1);var S=Gt.opposite(s),R=l+h*v;this.setDepth(s,l),this.setDepth(S,R)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(s){this._next=s},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(s,l){return s===$.EXTERIOR&&l===$.INTERIOR?1:s===$.INTERIOR&&l===$.EXTERIOR?-1:0},i}(Gr),ja=function(){};ja.prototype.createNode=function(n){return new ml(n,null)},ja.prototype.interfaces_=function(){return[]},ja.prototype.getClass=function(){return ja};var nr=function(){if(this._edges=new ct,this._nodes=null,this._edgeEndList=new ct,arguments.length===0)this._nodes=new Eo(new ja);else if(arguments.length===1){var n=arguments[0];this._nodes=new Eo(n)}};nr.prototype.printEdges=function(n){n.println("Edges:");for(var i=0;i<this._edges.size();i++){n.println("edge "+i+":");var s=this._edges.get(i);s.print(n),s.eiList.print(n)}},nr.prototype.find=function(n){return this._nodes.find(n)},nr.prototype.addNode=function(){if(arguments[0]instanceof ml){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof U){var i=arguments[0];return this._nodes.addNode(i)}},nr.prototype.getNodeIterator=function(){return this._nodes.iterator()},nr.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},nr.prototype.debugPrintln=function(n){Zt.out.println(n)},nr.prototype.isBoundaryNode=function(n,i){var s=this._nodes.find(i);if(s===null)return!1;var l=s.getLabel();return l!==null&&l.getLocation(n)===$.BOUNDARY},nr.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},nr.prototype.matchInSameDirection=function(n,i,s,l){return!!n.equals(s)&&W.computeOrientation(n,i,l)===W.COLLINEAR&&kn.quadrant(n,i)===kn.quadrant(s,l)},nr.prototype.getEdgeEnds=function(){return this._edgeEndList},nr.prototype.debugPrint=function(n){Zt.out.print(n)},nr.prototype.getEdgeIterator=function(){return this._edges.iterator()},nr.prototype.findEdgeInSameDirection=function(n,i){for(var s=0;s<this._edges.size();s++){var l=this._edges.get(s),h=l.getCoordinates();if(this.matchInSameDirection(n,i,h[0],h[1])||this.matchInSameDirection(n,i,h[h.length-1],h[h.length-2]))return l}return null},nr.prototype.insertEdge=function(n){this._edges.add(n)},nr.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},nr.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var l=new Ac(s,!0),h=new Ac(s,!1);l.setSym(h),h.setSym(l),this.add(l),this.add(h)}},nr.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},nr.prototype.getNodes=function(){return this._nodes.values()},nr.prototype.findEdge=function(n,i){for(var s=0;s<this._edges.size();s++){var l=this._edges.get(s),h=l.getCoordinates();if(n.equals(h[0])&&i.equals(h[1]))return l}return null},nr.prototype.interfaces_=function(){return[]},nr.prototype.getClass=function(){return nr},nr.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var hi=function(){this._geometryFactory=null,this._shellList=new ct;var n=arguments[0];this._geometryFactory=n};hi.prototype.sortShellsAndHoles=function(n,i,s){for(var l=n.iterator();l.hasNext();){var h=l.next();h.isHole()?s.add(h):i.add(h)}},hi.prototype.computePolygons=function(n){for(var i=new ct,s=n.iterator();s.hasNext();){var l=s.next().toPolygon(this._geometryFactory);i.add(l)}return i},hi.prototype.placeFreeHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var l=s.next();if(l.getShell()===null){var h=this.findEdgeRingContaining(l,n);if(h===null)throw new qo("unable to assign hole to a shell",l.getCoordinate(0));l.setShell(h)}}},hi.prototype.buildMinimalEdgeRings=function(n,i,s){for(var l=new ct,h=n.iterator();h.hasNext();){var v=h.next();if(v.getMaxNodeDegree()>2){v.linkDirectedEdgesForMinimalEdgeRings();var S=v.buildMinimalRings(),R=this.findShell(S);R!==null?(this.placePolygonHoles(R,S),i.add(R)):s.addAll(S)}else l.add(v)}return l},hi.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},hi.prototype.buildMaximalEdgeRings=function(n){for(var i=new ct,s=n.iterator();s.hasNext();){var l=s.next();if(l.isInResult()&&l.getLabel().isArea()&&l.getEdgeRing()===null){var h=new Of(l,this._geometryFactory);i.add(h),h.setInResult()}}return i},hi.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var l=s.next();l.isHole()&&l.setShell(n)}},hi.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},hi.prototype.findEdgeRingContaining=function(n,i){for(var s=n.getLinearRing(),l=s.getEnvelopeInternal(),h=s.getCoordinateN(0),v=null,S=null,R=i.iterator();R.hasNext();){var V=R.next(),nt=V.getLinearRing(),_t=nt.getEnvelopeInternal();v!==null&&(S=v.getLinearRing().getEnvelopeInternal());var Et=!1;_t.contains(l)&&W.isPointInRing(h,nt.getCoordinates())&&(Et=!0),Et&&(v===null||S.contains(_t))&&(v=V)}return v},hi.prototype.findShell=function(n){for(var i=0,s=null,l=n.iterator();l.hasNext();){var h=l.next();h.isHole()||(s=h,i++)}return P.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},hi.prototype.add=function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var i=arguments[0],s=arguments[1];nr.linkResultDirectedEdges(s);var l=this.buildMaximalEdgeRings(i),h=new ct,v=this.buildMinimalEdgeRings(l,this._shellList,h);this.sortShellsAndHoles(v,this._shellList,h),this.placeFreeHoles(this._shellList,h)}},hi.prototype.interfaces_=function(){return[]},hi.prototype.getClass=function(){return hi};var $n=function(){};$n.prototype.getBounds=function(){},$n.prototype.interfaces_=function(){return[]},$n.prototype.getClass=function(){return $n};var qe=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};qe.prototype.getItem=function(){return this._item},qe.prototype.getBounds=function(){return this._bounds},qe.prototype.interfaces_=function(){return[$n,t]},qe.prototype.getClass=function(){return qe};var us=function(){this._size=null,this._items=null,this._size=0,this._items=new ct,this._items.add(null)};us.prototype.poll=function(){if(this.isEmpty())return null;var n=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),n},us.prototype.size=function(){return this._size},us.prototype.reorder=function(n){for(var i=null,s=this._items.get(n);2*n<=this._size&&((i=2*n)!==this._size&&this._items.get(i+1).compareTo(this._items.get(i))<0&&i++,this._items.get(i).compareTo(s)<0);n=i)this._items.set(n,this._items.get(i));this._items.set(n,s)},us.prototype.clear=function(){this._size=0,this._items.clear()},us.prototype.isEmpty=function(){return this._size===0},us.prototype.add=function(n){this._items.add(null),this._size+=1;var i=this._size;for(this._items.set(0,n);n.compareTo(this._items.get(Math.trunc(i/2)))<0;i/=2)this._items.set(i,this._items.get(Math.trunc(i/2)));this._items.set(i,n)},us.prototype.interfaces_=function(){return[]},us.prototype.getClass=function(){return us};var Ps=function(){};Ps.prototype.visitItem=function(n){},Ps.prototype.interfaces_=function(){return[]},Ps.prototype.getClass=function(){return Ps};var xa=function(){};xa.prototype.insert=function(n,i){},xa.prototype.remove=function(n,i){},xa.prototype.query=function(){},xa.prototype.interfaces_=function(){return[]},xa.prototype.getClass=function(){return xa};var yr=function(){if(this._childBoundables=new ct,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},Df={serialVersionUID:{configurable:!0}};yr.prototype.getLevel=function(){return this._level},yr.prototype.size=function(){return this._childBoundables.size()},yr.prototype.getChildBoundables=function(){return this._childBoundables},yr.prototype.addChildBoundable=function(n){P.isTrue(this._bounds===null),this._childBoundables.add(n)},yr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},yr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},yr.prototype.interfaces_=function(){return[$n,t]},yr.prototype.getClass=function(){return yr},Df.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(yr,Df);var ro=function(){};ro.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},ro.min=function(n){return ro.sort(n),n.get(0)},ro.sort=function(n,i){var s=n.toArray();i?Ho.sort(s,i):Ho.sort(s);for(var l=n.iterator(),h=0,v=s.length;h<v;h++)l.next(),l.set(s[h])},ro.singletonList=function(n){var i=new ct;return i.add(n),i};var cr=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],i=arguments[1],s=arguments[2];this._boundable1=n,this._boundable2=i,this._itemDistance=s,this._distance=this.distance()};cr.prototype.expandToQueue=function(n,i){var s=cr.isComposite(this._boundable1),l=cr.isComposite(this._boundable2);if(s&&l)return cr.area(this._boundable1)>cr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,n,i),null):(this.expand(this._boundable2,this._boundable1,n,i),null);if(s)return this.expand(this._boundable1,this._boundable2,n,i),null;if(l)return this.expand(this._boundable2,this._boundable1,n,i),null;throw new L("neither boundable is composite")},cr.prototype.isLeaves=function(){return!(cr.isComposite(this._boundable1)||cr.isComposite(this._boundable2))},cr.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},cr.prototype.expand=function(n,i,s,l){for(var h=n.getChildBoundables().iterator();h.hasNext();){var v=h.next(),S=new cr(v,i,this._itemDistance);S.getDistance()<l&&s.add(S)}},cr.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},cr.prototype.getDistance=function(){return this._distance},cr.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},cr.prototype.interfaces_=function(){return[G]},cr.prototype.getClass=function(){return cr},cr.area=function(n){return n.getBounds().getArea()},cr.isComposite=function(n){return n instanceof yr};var br=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new ct,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];P.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},Tr={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};br.prototype.getNodeCapacity=function(){return this._nodeCapacity},br.prototype.lastNode=function(n){return n.get(n.size()-1)},br.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof yr?n+=this.size(s):s instanceof qe&&(n+=1)}return n}},br.prototype.removeItem=function(n,i){for(var s=null,l=n.getChildBoundables().iterator();l.hasNext();){var h=l.next();h instanceof qe&&h.getItem()===i&&(s=h)}return s!==null&&(n.getChildBoundables().remove(s),!0)},br.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new ct:n}if(arguments.length===1){for(var i=arguments[0],s=new ct,l=i.getChildBoundables().iterator();l.hasNext();){var h=l.next();if(h instanceof yr){var v=this.itemsTree(h);v!==null&&s.add(v)}else h instanceof qe?s.add(h.getItem()):P.shouldNeverReachHere()}return s.size()<=0?null:s}},br.prototype.insert=function(n,i){P.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new qe(n,i))},br.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new ct;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];if(P.isTrue(s>-2),l.getLevel()===s)return h.add(l),null;for(var v=l.getChildBoundables().iterator();v.hasNext();){var S=v.next();S instanceof yr?this.boundablesAtLevel(s,S,h):(P.isTrue(S instanceof qe),s===-1&&h.add(S))}return null}},br.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new ct;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i),i}if(arguments.length===2){var s=arguments[0],l=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,l)}else if(arguments.length===3){if(j(arguments[2],Ps)&&arguments[0]instanceof Object&&arguments[1]instanceof yr)for(var h=arguments[0],v=arguments[1],S=arguments[2],R=v.getChildBoundables(),V=0;V<R.size();V++){var nt=R.get(V);this.getIntersectsOp().intersects(nt.getBounds(),h)&&(nt instanceof yr?this.query(h,nt,S):nt instanceof qe?S.visitItem(nt.getItem()):P.shouldNeverReachHere())}else if(j(arguments[2],kt)&&arguments[0]instanceof Object&&arguments[1]instanceof yr)for(var _t=arguments[0],Et=arguments[1],Wt=arguments[2],$t=Et.getChildBoundables(),ie=0;ie<$t.size();ie++){var Ee=$t.get(ie);this.getIntersectsOp().intersects(Ee.getBounds(),_t)&&(Ee instanceof yr?this.query(_t,Ee,Wt):Ee instanceof qe?Wt.add(Ee.getItem()):P.shouldNeverReachHere())}}},br.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},br.prototype.getRoot=function(){return this.build(),this._root},br.prototype.remove=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,i)}if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2],v=this.removeItem(l,h);if(v)return!0;for(var S=null,R=l.getChildBoundables().iterator();R.hasNext();){var V=R.next();if(this.getIntersectsOp().intersects(V.getBounds(),s)&&V instanceof yr&&(v=this.remove(s,V,h))){S=V;break}}return S!==null&&S.getChildBoundables().isEmpty()&&l.getChildBoundables().remove(S),v}},br.prototype.createHigherLevels=function(n,i){P.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},br.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof yr){var l=this.depth(s);l>n&&(n=l)}}return n+1}},br.prototype.createParentBoundables=function(n,i){P.isTrue(!n.isEmpty());var s=new ct;s.add(this.createNode(i));var l=new ct(n);ro.sort(l,this.getComparator());for(var h=l.iterator();h.hasNext();){var v=h.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(i)),this.lastNode(s).addChildBoundable(v)}return s},br.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},br.prototype.interfaces_=function(){return[t]},br.prototype.getClass=function(){return br},br.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},Tr.IntersectsOp.get=function(){return Cc},Tr.serialVersionUID.get=function(){return-3886435814360241e3},Tr.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(br,Tr);var Cc=function(){},wo=function(){};wo.prototype.distance=function(n,i){},wo.prototype.interfaces_=function(){return[]},wo.prototype.getClass=function(){return wo};var Pc=function(n){function i(l){l=l||i.DEFAULT_NODE_CAPACITY,n.call(this,l)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return i.prototype.createParentBoundablesFromVerticalSlices=function(l,h){P.isTrue(l.length>0);for(var v=new ct,S=0;S<l.length;S++)v.addAll(this.createParentBoundablesFromVerticalSlice(l[S],h));return v},i.prototype.createNode=function(l){return new yl(l)},i.prototype.size=function(){return arguments.length===0?n.prototype.size.call(this):n.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return n.prototype.insert.apply(this,arguments);var l=arguments[0],h=arguments[1];if(l.isNull())return null;n.prototype.insert.call(this,l,h)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(l,h){for(var v=Math.trunc(Math.ceil(l.size()/h)),S=new Array(h).fill(null),R=l.iterator(),V=0;V<h;V++){S[V]=new ct;for(var nt=0;R.hasNext()&&nt<v;){var _t=R.next();S[V].add(_t),nt++}}return S},i.prototype.query=function(){if(arguments.length===1){var l=arguments[0];return n.prototype.query.call(this,l)}if(arguments.length===2){var h=arguments[0],v=arguments[1];n.prototype.query.call(this,h,v)}else if(arguments.length===3){if(j(arguments[2],Ps)&&arguments[0]instanceof Object&&arguments[1]instanceof yr){var S=arguments[0],R=arguments[1],V=arguments[2];n.prototype.query.call(this,S,R,V)}else if(j(arguments[2],kt)&&arguments[0]instanceof Object&&arguments[1]instanceof yr){var nt=arguments[0],_t=arguments[1],Et=arguments[2];n.prototype.query.call(this,nt,_t,Et)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(l,h){return n.prototype.createParentBoundables.call(this,l,h)},i.prototype.remove=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return n.prototype.remove.call(this,l,h)}return n.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?n.prototype.depth.call(this):n.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(l,h){P.isTrue(!l.isEmpty());var v=Math.trunc(Math.ceil(l.size()/this.getNodeCapacity())),S=new ct(l);ro.sort(S,i.xComparator);var R=this.verticalSlices(S,Math.trunc(Math.ceil(Math.sqrt(v))));return this.createParentBoundablesFromVerticalSlices(R,h)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if(j(arguments[0],wo)){var l=arguments[0],h=new cr(this.getRoot(),this.getRoot(),l);return this.nearestNeighbour(h)}if(arguments[0]instanceof cr){var v=arguments[0];return this.nearestNeighbour(v,A.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&j(arguments[1],wo)){var S=arguments[0],R=arguments[1],V=new cr(this.getRoot(),S.getRoot(),R);return this.nearestNeighbour(V)}if(arguments[0]instanceof cr&&typeof arguments[1]=="number"){var nt=arguments[0],_t=arguments[1],Et=null,Wt=new us;for(Wt.add(nt);!Wt.isEmpty()&&_t>0;){var $t=Wt.poll(),ie=$t.getDistance();if(ie>=_t)break;$t.isLeaves()?(_t=ie,Et=$t):$t.expandToQueue(Wt,_t)}return[Et.getBoundable(0).getItem(),Et.getBoundable(1).getItem()]}}else if(arguments.length===3){var Ee=arguments[0],An=arguments[1],Wn=arguments[2],Qr=new qe(Ee,An),jo=new cr(this.getRoot(),Qr,Wn);return this.nearestNeighbour(jo)[0]}},i.prototype.interfaces_=function(){return[xa,t]},i.prototype.getClass=function(){return i},i.centreX=function(l){return i.avg(l.getMinX(),l.getMaxX())},i.avg=function(l,h){return(l+h)/2},i.centreY=function(l){return i.avg(l.getMinY(),l.getMaxY())},s.STRtreeNode.get=function(){return yl},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[X]},compare:function(l,h){return n.compareDoubles(i.centreX(l.getBounds()),i.centreX(h.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[X]},compare:function(l,h){return n.compareDoubles(i.centreY(l.getBounds()),i.centreY(h.getBounds()))}}},s.intersectsOp.get=function(){return{interfaces_:function(){return[n.IntersectsOp]},intersects:function(l,h){return l.intersects(h)}}},s.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,s),i}(br),yl=function(n){function i(){var s=arguments[0];n.call(this,s)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var s=null,l=this.getChildBoundables().iterator();l.hasNext();){var h=l.next();s===null?s=new Vt(h.getBounds()):s.expandToInclude(h.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(yr),Qn=function(){};Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn},Qn.relativeSign=function(n,i){return n<i?-1:n>i?1:0},Qn.compare=function(n,i,s){if(i.equals2D(s))return 0;var l=Qn.relativeSign(i.x,s.x),h=Qn.relativeSign(i.y,s.y);switch(n){case 0:return Qn.compareValue(l,h);case 1:return Qn.compareValue(h,l);case 2:return Qn.compareValue(h,-l);case 3:return Qn.compareValue(-l,h);case 4:return Qn.compareValue(-l,-h);case 5:return Qn.compareValue(-h,-l);case 6:return Qn.compareValue(-h,l);case 7:return Qn.compareValue(l,-h)}return P.shouldNeverReachHere("invalid octant value"),0},Qn.compareValue=function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0};var ls=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];this._segString=n,this.coord=new U(i),this.segmentIndex=s,this._segmentOctant=l,this._isInterior=!i.equals2D(n.getCoordinate(s))};ls.prototype.getCoordinate=function(){return this.coord},ls.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},ls.prototype.compareTo=function(n){var i=n;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:Qn.compare(this._segmentOctant,this.coord,i.coord)},ls.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},ls.prototype.isInterior=function(){return this._isInterior},ls.prototype.interfaces_=function(){return[G]},ls.prototype.getClass=function(){return ls};var Hr=function(){this._nodeMap=new w,this._edge=null;var n=arguments[0];this._edge=n};Hr.prototype.getSplitCoordinates=function(){var n=new Kt;this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var l=i.next();this.addEdgeCoordinates(s,l,n),s=l}return n.toCoordinateArray()},Hr.prototype.addCollapsedNodes=function(){var n=new ct;this.findCollapsesFromInsertedNodes(n),this.findCollapsesFromExistingVertices(n);for(var i=n.iterator();i.hasNext();){var s=i.next().intValue();this.add(this._edge.getCoordinate(s),s)}},Hr.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},Hr.prototype.findCollapsesFromExistingVertices=function(n){for(var i=0;i<this._edge.size()-2;i++){var s=this._edge.getCoordinate(i),l=this._edge.getCoordinate(i+2);s.equals2D(l)&&n.add(new ft(i+1))}},Hr.prototype.addEdgeCoordinates=function(n,i,s){var l=this._edge.getCoordinate(i.segmentIndex),h=i.isInterior()||!i.coord.equals2D(l);s.add(new U(n.coord),!1);for(var v=n.segmentIndex+1;v<=i.segmentIndex;v++)s.add(this._edge.getCoordinate(v));h&&s.add(new U(i.coord))},Hr.prototype.iterator=function(){return this._nodeMap.values().iterator()},Hr.prototype.addSplitEdges=function(n){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),s=i.next();i.hasNext();){var l=i.next(),h=this.createSplitEdge(s,l);n.add(h),s=l}},Hr.prototype.findCollapseIndex=function(n,i,s){if(!n.coord.equals2D(i.coord))return!1;var l=i.segmentIndex-n.segmentIndex;return i.isInterior()||l--,l===1&&(s[0]=n.segmentIndex+1,!0)},Hr.prototype.findCollapsesFromInsertedNodes=function(n){for(var i=new Array(1).fill(null),s=this.iterator(),l=s.next();s.hasNext();){var h=s.next();this.findCollapseIndex(l,h,i)&&n.add(new ft(i[0])),l=h}},Hr.prototype.getEdge=function(){return this._edge},Hr.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},Hr.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,l=this._edge.getCoordinate(i.segmentIndex),h=i.isInterior()||!i.coord.equals2D(l);h||s--;var v=new Array(s).fill(null),S=0;v[S++]=new U(n.coord);for(var R=n.segmentIndex+1;R<=i.segmentIndex;R++)v[S++]=this._edge.getCoordinate(R);return h&&(v[S]=new U(i.coord)),new or(v,this._edge.getData())},Hr.prototype.add=function(n,i){var s=new ls(this._edge,n,i,this._edge.getSegmentOctant(i)),l=this._nodeMap.get(s);return l!==null?(P.isTrue(l.coord.equals2D(n),"Found equal nodes with different coordinates"),l):(this._nodeMap.put(s,s),s)},Hr.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new it("bad split edge start point at "+s);var l=n.get(n.size()-1).getCoordinates(),h=l[l.length-1];if(!h.equals2D(i[i.length-1]))throw new it("bad split edge end point at "+h)},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr};var Ys=function(){};Ys.prototype.interfaces_=function(){return[]},Ys.prototype.getClass=function(){return Ys},Ys.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new L("Cannot compute the octant for point ( "+n+", "+i+" )");var s=Math.abs(n),l=Math.abs(i);return n>=0?i>=0?s>=l?0:1:s>=l?7:6:i>=0?s>=l?3:2:s>=l?4:5}if(arguments[0]instanceof U&&arguments[1]instanceof U){var h=arguments[0],v=arguments[1],S=v.x-h.x,R=v.y-h.y;if(S===0&&R===0)throw new L("Cannot compute the octant for two identical points "+h);return Ys.octant(S,R)}};var Mo=function(){};Mo.prototype.getCoordinates=function(){},Mo.prototype.size=function(){},Mo.prototype.getCoordinate=function(n){},Mo.prototype.isClosed=function(){},Mo.prototype.setData=function(n){},Mo.prototype.getData=function(){},Mo.prototype.interfaces_=function(){return[]},Mo.prototype.getClass=function(){return Mo};var tu=function(){};tu.prototype.addIntersection=function(n,i){},tu.prototype.interfaces_=function(){return[Mo]},tu.prototype.getClass=function(){return tu};var or=function(){this._nodeList=new Hr(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};or.prototype.getCoordinates=function(){return this._pts},or.prototype.size=function(){return this._pts.length},or.prototype.getCoordinate=function(n){return this._pts[n]},or.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},or.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},or.prototype.setData=function(n){this._data=n},or.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:Ys.octant(n,i)},or.prototype.getData=function(){return this._data},or.prototype.addIntersection=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.addIntersectionNode(n,i)}else if(arguments.length===4){var s=arguments[0],l=arguments[1],h=arguments[3],v=new U(s.getIntersection(h));this.addIntersection(v,l)}},or.prototype.toString=function(){return fe.toLineString(new De(this._pts))},or.prototype.getNodeList=function(){return this._nodeList},or.prototype.addIntersectionNode=function(n,i){var s=i,l=s+1;if(l<this._pts.length){var h=this._pts[l];n.equals2D(h)&&(s=l)}return this._nodeList.add(n,s)},or.prototype.addIntersections=function(n,i,s){for(var l=0;l<n.getIntersectionNum();l++)this.addIntersection(n,i,s,l)},or.prototype.interfaces_=function(){return[tu]},or.prototype.getClass=function(){return or},or.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new ct;return or.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var s=arguments[0],l=arguments[1],h=s.iterator();h.hasNext();)h.next().getNodeList().addSplitEdges(l)};var ee=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new U,this.p1=new U;else if(arguments.length===1){var n=arguments[0];this.p0=new U(n.p0),this.p1=new U(n.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],s=arguments[1],l=arguments[2],h=arguments[3];this.p0=new U(i,s),this.p1=new U(l,h)}},Ff={serialVersionUID:{configurable:!0}};ee.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},ee.prototype.orientationIndex=function(){if(arguments[0]instanceof ee){var n=arguments[0],i=W.orientationIndex(this.p0,this.p1,n.p0),s=W.orientationIndex(this.p0,this.p1,n.p1);return i>=0&&s>=0||i<=0&&s<=0?Math.max(i,s):0}if(arguments[0]instanceof U){var l=arguments[0];return W.orientationIndex(this.p0,this.p1,l)}},ee.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},ee.prototype.isVertical=function(){return this.p0.x===this.p1.x},ee.prototype.equals=function(n){if(!(n instanceof ee))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},ee.prototype.intersection=function(n){var i=new rt;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},ee.prototype.project=function(){if(arguments[0]instanceof U){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new U(n);var i=this.projectionFactor(n),s=new U;return s.x=this.p0.x+i*(this.p1.x-this.p0.x),s.y=this.p0.y+i*(this.p1.y-this.p0.y),s}if(arguments[0]instanceof ee){var l=arguments[0],h=this.projectionFactor(l.p0),v=this.projectionFactor(l.p1);if(h>=1&&v>=1||h<=0&&v<=0)return null;var S=this.project(l.p0);h<0&&(S=this.p0),h>1&&(S=this.p1);var R=this.project(l.p1);return v<0&&(R=this.p0),v>1&&(R=this.p1),new ee(S,R)}},ee.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},ee.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},ee.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},ee.prototype.distancePerpendicular=function(n){return W.distancePointLinePerpendicular(n,this.p0,this.p1)},ee.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},ee.prototype.midPoint=function(){return ee.midPoint(this.p0,this.p1)},ee.prototype.projectionFactor=function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,l=i*i+s*s;return l<=0?A.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/l},ee.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),l=A.MAX_VALUE,h=null,v=this.closestPoint(n.p0);l=v.distance(n.p0),s[0]=v,s[1]=n.p0;var S=this.closestPoint(n.p1);(h=S.distance(n.p1))<l&&(l=h,s[0]=S,s[1]=n.p1);var R=n.closestPoint(this.p0);(h=R.distance(this.p0))<l&&(l=h,s[0]=this.p0,s[1]=R);var V=n.closestPoint(this.p1);return(h=V.distance(this.p1))<l&&(l=h,s[0]=this.p1,s[1]=V),s},ee.prototype.closestPoint=function(n){var i=this.projectionFactor(n);return i>0&&i<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1},ee.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},ee.prototype.getLength=function(){return this.p0.distance(this.p1)},ee.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},ee.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},ee.prototype.equalsTopo=function(n){return this.p0.equals(n.p0)&&(this.p1.equals(n.p1)||this.p0.equals(n.p1))&&this.p1.equals(n.p0)},ee.prototype.lineIntersection=function(n){try{return _e.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof se))throw i}return null},ee.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},ee.prototype.pointAlongOffset=function(n,i){var s=this.p0.x+n*(this.p1.x-this.p0.x),l=this.p0.y+n*(this.p1.y-this.p0.y),h=this.p1.x-this.p0.x,v=this.p1.y-this.p0.y,S=Math.sqrt(h*h+v*v),R=0,V=0;if(i!==0){if(S<=0)throw new Error("Cannot compute offset from zero-length line segment");R=i*h/S,V=i*v/S}return new U(s-V,l+R)},ee.prototype.setCoordinates=function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.p0.x=i.x,this.p0.y=i.y,this.p1.x=s.x,this.p1.y=s.y}},ee.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||A.isNaN(i))&&(i=1),i},ee.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},ee.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},ee.prototype.distance=function(){if(arguments[0]instanceof ee){var n=arguments[0];return W.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof U){var i=arguments[0];return W.distancePointLine(i,this.p0,this.p1)}},ee.prototype.pointAlong=function(n){var i=new U;return i.x=this.p0.x+n*(this.p1.x-this.p0.x),i.y=this.p0.y+n*(this.p1.y-this.p0.y),i},ee.prototype.hashCode=function(){var n=A.doubleToLongBits(this.p0.x);n^=31*A.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=A.doubleToLongBits(this.p1.x);return s^=31*A.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},ee.prototype.interfaces_=function(){return[G,t]},ee.prototype.getClass=function(){return ee},ee.midPoint=function(n,i){return new U((n.x+i.x)/2,(n.y+i.y)/2)},Ff.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(ee,Ff);var pi=function(){this.tempEnv1=new Vt,this.tempEnv2=new Vt,this._overlapSeg1=new ee,this._overlapSeg2=new ee};pi.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];n.getLineSegment(i,this._overlapSeg1),s.getLineSegment(l,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},pi.prototype.interfaces_=function(){return[]},pi.prototype.getClass=function(){return pi};var di=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];this._pts=n,this._start=i,this._end=s,this._context=l};di.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},di.prototype.computeSelect=function(n,i,s,l){var h=this._pts[i],v=this._pts[s];if(l.tempEnv1.init(h,v),s-i==1)return l.select(this,i),null;if(!n.intersects(l.tempEnv1))return null;var S=Math.trunc((i+s)/2);i<S&&this.computeSelect(n,i,S,l),S<s&&this.computeSelect(n,S,s,l)},di.prototype.getCoordinates=function(){for(var n=new Array(this._end-this._start+1).fill(null),i=0,s=this._start;s<=this._end;s++)n[i++]=this._pts[s];return n},di.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},di.prototype.setId=function(n){this._id=n},di.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},di.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new Vt(n,i)}return this._env},di.prototype.getEndIndex=function(){return this._end},di.prototype.getStartIndex=function(){return this._start},di.prototype.getContext=function(){return this._context},di.prototype.getId=function(){return this._id},di.prototype.computeOverlapsInternal=function(n,i,s,l,h,v){var S=this._pts[n],R=this._pts[i],V=s._pts[l],nt=s._pts[h];if(i-n==1&&h-l==1)return v.overlap(this,n,s,l),null;if(v.tempEnv1.init(S,R),v.tempEnv2.init(V,nt),!v.tempEnv1.intersects(v.tempEnv2))return null;var _t=Math.trunc((n+i)/2),Et=Math.trunc((l+h)/2);n<_t&&(l<Et&&this.computeOverlapsInternal(n,_t,s,l,Et,v),Et<h&&this.computeOverlapsInternal(n,_t,s,Et,h,v)),_t<i&&(l<Et&&this.computeOverlapsInternal(_t,i,s,l,Et,v),Et<h&&this.computeOverlapsInternal(_t,i,s,Et,h,v))},di.prototype.interfaces_=function(){return[]},di.prototype.getClass=function(){return di};var io=function(){};io.prototype.interfaces_=function(){return[]},io.prototype.getClass=function(){return io},io.getChainStartIndices=function(n){var i=0,s=new ct;s.add(new ft(i));do{var l=io.findChainEnd(n,i);s.add(new ft(l)),i=l}while(i<n.length-1);return io.toIntArray(s)},io.findChainEnd=function(n,i){for(var s=i;s<n.length-1&&n[s].equals2D(n[s+1]);)s++;if(s>=n.length-1)return n.length-1;for(var l=kn.quadrant(n[s],n[s+1]),h=i+1;h<n.length&&!(!n[h-1].equals2D(n[h])&&kn.quadrant(n[h-1],n[h])!==l);)h++;return h-1},io.getChains=function(){if(arguments.length===1){var n=arguments[0];return io.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],l=new ct,h=io.getChainStartIndices(i),v=0;v<h.length-1;v++){var S=new di(i,h[v],h[v+1],s);l.add(S)}return l}},io.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var Ri=function(){};Ri.prototype.computeNodes=function(n){},Ri.prototype.getNodedSubstrings=function(){},Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri};var $s=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};$s.prototype.setSegmentIntersector=function(n){this._segInt=n},$s.prototype.interfaces_=function(){return[Ri]},$s.prototype.getClass=function(){return $s};var Bu=function(n){function i(l){l?n.call(this,l):n.call(this),this._monoChains=new ct,this._index=new Pc,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={SegmentOverlapAction:{configurable:!0}};return i.prototype.getMonotoneChains=function(){return this._monoChains},i.prototype.getNodedSubstrings=function(){return or.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(l){for(var h=io.getChains(l.getCoordinates(),l).iterator();h.hasNext();){var v=h.next();v.setId(this._idCounter++),this._index.insert(v.getEnvelope(),v),this._monoChains.add(v)}},i.prototype.computeNodes=function(l){this._nodedSegStrings=l;for(var h=l.iterator();h.hasNext();)this.add(h.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var l=new fr(this._segInt),h=this._monoChains.iterator();h.hasNext();)for(var v=h.next(),S=this._index.query(v.getEnvelope()).iterator();S.hasNext();){var R=S.next();if(R.getId()>v.getId()&&(v.computeOverlaps(R,l),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.SegmentOverlapAction.get=function(){return fr},Object.defineProperties(i,s),i}($s),fr=function(n){function i(){n.call(this),this._si=null;var s=arguments[0];this._si=s}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return n.prototype.overlap.apply(this,arguments);var s=arguments[0],l=arguments[1],h=arguments[2],v=arguments[3],S=s.getContext(),R=h.getContext();this._si.processIntersections(S,l,R,v)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(pi),Fe=function n(){if(this._quadrantSegments=n.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=n.CAP_ROUND,this._joinStyle=n.JOIN_ROUND,this._mitreLimit=n.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=n.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.setQuadrantSegments(s),this.setEndCapStyle(l)}else if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3];this.setQuadrantSegments(h),this.setEndCapStyle(v),this.setJoinStyle(S),this.setMitreLimit(R)}}},So={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Fe.prototype.getEndCapStyle=function(){return this._endCapStyle},Fe.prototype.isSingleSided=function(){return this._isSingleSided},Fe.prototype.setQuadrantSegments=function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=Fe.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Fe.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==Fe.JOIN_ROUND&&(this._quadrantSegments=Fe.DEFAULT_QUADRANT_SEGMENTS)},Fe.prototype.getJoinStyle=function(){return this._joinStyle},Fe.prototype.setJoinStyle=function(n){this._joinStyle=n},Fe.prototype.setSimplifyFactor=function(n){this._simplifyFactor=n<0?0:n},Fe.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Fe.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Fe.prototype.setEndCapStyle=function(n){this._endCapStyle=n},Fe.prototype.getMitreLimit=function(){return this._mitreLimit},Fe.prototype.setMitreLimit=function(n){this._mitreLimit=n},Fe.prototype.setSingleSided=function(n){this._isSingleSided=n},Fe.prototype.interfaces_=function(){return[]},Fe.prototype.getClass=function(){return Fe},Fe.bufferDistanceError=function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)},So.CAP_ROUND.get=function(){return 1},So.CAP_FLAT.get=function(){return 2},So.CAP_SQUARE.get=function(){return 3},So.JOIN_ROUND.get=function(){return 1},So.JOIN_MITRE.get=function(){return 2},So.JOIN_BEVEL.get=function(){return 3},So.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},So.DEFAULT_MITRE_LIMIT.get=function(){return 5},So.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(Fe,So);var sr=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=W.COUNTERCLOCKWISE,this._inputLine=n||null},Ea={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};sr.prototype.isDeletable=function(n,i,s,l){var h=this._inputLine[n],v=this._inputLine[i],S=this._inputLine[s];return!!this.isConcave(h,v,S)&&!!this.isShallow(h,v,S,l)&&this.isShallowSampled(h,v,n,s,l)},sr.prototype.deleteShallowConcavities=function(){for(var n=1,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i),l=!1;s<this._inputLine.length;){var h=!1;this.isDeletable(n,i,s,this._distanceTol)&&(this._isDeleted[i]=sr.DELETE,h=!0,l=!0),n=h?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return l},sr.prototype.isShallowConcavity=function(n,i,s,l){return W.computeOrientation(n,i,s)!==this._angleOrientation?!1:W.distancePointLine(i,n,s)<l},sr.prototype.isShallowSampled=function(n,i,s,l,h){var v=Math.trunc((l-s)/sr.NUM_PTS_TO_CHECK);v<=0&&(v=1);for(var S=s;S<l;S+=v)if(!this.isShallow(n,i,this._inputLine[S],h))return!1;return!0},sr.prototype.isConcave=function(n,i,s){var l=W.computeOrientation(n,i,s)===this._angleOrientation;return l},sr.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=W.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},sr.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===sr.DELETE;)i++;return i},sr.prototype.isShallow=function(n,i,s,l){return W.distancePointLine(i,n,s)<l},sr.prototype.collapseLine=function(){for(var n=new Kt,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==sr.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},sr.prototype.interfaces_=function(){return[]},sr.prototype.getClass=function(){return sr},sr.simplify=function(n,i){return new sr(n).simplify(i)},Ea.INIT.get=function(){return 0},Ea.DELETE.get=function(){return 1},Ea.KEEP.get=function(){return 1},Ea.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(sr,Ea);var Li=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new ct},Uf={COORDINATE_ARRAY_TYPE:{configurable:!0}};Li.prototype.getCoordinates=function(){return this._ptList.toArray(Li.COORDINATE_ARRAY_TYPE)},Li.prototype.setPrecisionModel=function(n){this._precisionModel=n},Li.prototype.addPt=function(n){var i=new U(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},Li.prototype.revere=function(){},Li.prototype.addPts=function(n,i){if(i)for(var s=0;s<n.length;s++)this.addPt(n[s]);else for(var l=n.length-1;l>=0;l--)this.addPt(n[l])},Li.prototype.isRedundant=function(n){if(this._ptList.size()<1)return!1;var i=this._ptList.get(this._ptList.size()-1);return n.distance(i)<this._minimimVertexDistance},Li.prototype.toString=function(){return new Ce().createLineString(this.getCoordinates()).toString()},Li.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new U(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},Li.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},Li.prototype.interfaces_=function(){return[]},Li.prototype.getClass=function(){return Li},Uf.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Li,Uf);var ke=function(){},Zs={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};ke.prototype.interfaces_=function(){return[]},ke.prototype.getClass=function(){return ke},ke.toDegrees=function(n){return 180*n/Math.PI},ke.normalize=function(n){for(;n>Math.PI;)n-=ke.PI_TIMES_2;for(;n<=-Math.PI;)n+=ke.PI_TIMES_2;return n},ke.angle=function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var i=arguments[0],s=arguments[1],l=s.x-i.x,h=s.y-i.y;return Math.atan2(h,l)}},ke.isAcute=function(n,i,s){var l=n.x-i.x,h=n.y-i.y;return l*(s.x-i.x)+h*(s.y-i.y)>0},ke.isObtuse=function(n,i,s){var l=n.x-i.x,h=n.y-i.y;return l*(s.x-i.x)+h*(s.y-i.y)<0},ke.interiorAngle=function(n,i,s){var l=ke.angle(i,n),h=ke.angle(i,s);return Math.abs(h-l)},ke.normalizePositive=function(n){if(n<0){for(;n<0;)n+=ke.PI_TIMES_2;n>=ke.PI_TIMES_2&&(n=0)}else{for(;n>=ke.PI_TIMES_2;)n-=ke.PI_TIMES_2;n<0&&(n=0)}return n},ke.angleBetween=function(n,i,s){var l=ke.angle(i,n),h=ke.angle(i,s);return ke.diff(l,h)},ke.diff=function(n,i){var s=null;return(s=n<i?i-n:n-i)>Math.PI&&(s=2*Math.PI-s),s},ke.toRadians=function(n){return n*Math.PI/180},ke.getTurn=function(n,i){var s=Math.sin(i-n);return s>0?ke.COUNTERCLOCKWISE:s<0?ke.CLOCKWISE:ke.NONE},ke.angleBetweenOriented=function(n,i,s){var l=ke.angle(i,n),h=ke.angle(i,s)-l;return h<=-Math.PI?h+ke.PI_TIMES_2:h>Math.PI?h-ke.PI_TIMES_2:h},Zs.PI_TIMES_2.get=function(){return 2*Math.PI},Zs.PI_OVER_2.get=function(){return Math.PI/2},Zs.PI_OVER_4.get=function(){return Math.PI/4},Zs.COUNTERCLOCKWISE.get=function(){return W.COUNTERCLOCKWISE},Zs.CLOCKWISE.get=function(){return W.CLOCKWISE},Zs.NONE.get=function(){return W.COLLINEAR},Object.defineProperties(ke,Zs);var Vn=function n(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new ee,this._seg1=new ee,this._offset0=new ee,this._offset1=new ee,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],s=arguments[1],l=arguments[2];this._precisionModel=i,this._bufParams=s,this._li=new rt,this._filletAngleQuantum=Math.PI/2/s.getQuadrantSegments(),s.getQuadrantSegments()>=8&&s.getJoinStyle()===Fe.JOIN_ROUND&&(this._closingSegLengthFactor=n.MAX_CLOSING_SEG_LEN_FACTOR),this.init(l)},cs={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Vn.prototype.addNextSegment=function(n,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var s=W.computeOrientation(this._s0,this._s1,this._s2),l=s===W.CLOCKWISE&&this._side===Gt.LEFT||s===W.COUNTERCLOCKWISE&&this._side===Gt.RIGHT;s===0?this.addCollinear(i):l?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},Vn.prototype.addLineEndCap=function(n,i){var s=new ee(n,i),l=new ee;this.computeOffsetSegment(s,Gt.LEFT,this._distance,l);var h=new ee;this.computeOffsetSegment(s,Gt.RIGHT,this._distance,h);var v=i.x-n.x,S=i.y-n.y,R=Math.atan2(S,v);switch(this._bufParams.getEndCapStyle()){case Fe.CAP_ROUND:this._segList.addPt(l.p1),this.addFilletArc(i,R+Math.PI/2,R-Math.PI/2,W.CLOCKWISE,this._distance),this._segList.addPt(h.p1);break;case Fe.CAP_FLAT:this._segList.addPt(l.p1),this._segList.addPt(h.p1);break;case Fe.CAP_SQUARE:var V=new U;V.x=Math.abs(this._distance)*Math.cos(R),V.y=Math.abs(this._distance)*Math.sin(R);var nt=new U(l.p1.x+V.x,l.p1.y+V.y),_t=new U(h.p1.x+V.x,h.p1.y+V.y);this._segList.addPt(nt),this._segList.addPt(_t)}},Vn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Vn.prototype.addMitreJoin=function(n,i,s,l){var h=!0,v=null;try{v=_e.intersection(i.p0,i.p1,s.p0,s.p1),(l<=0?1:v.distance(n)/Math.abs(l))>this._bufParams.getMitreLimit()&&(h=!1)}catch(S){if(!(S instanceof se))throw S;v=new U(0,0),h=!1}h?this._segList.addPt(v):this.addLimitedMitreJoin(i,s,l,this._bufParams.getMitreLimit())},Vn.prototype.addFilletCorner=function(n,i,s,l,h){var v=i.x-n.x,S=i.y-n.y,R=Math.atan2(S,v),V=s.x-n.x,nt=s.y-n.y,_t=Math.atan2(nt,V);l===W.CLOCKWISE?R<=_t&&(R+=2*Math.PI):R>=_t&&(R-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,R,_t,l,h),this._segList.addPt(s)},Vn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*Vn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Fe.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Fe.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(i&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))},Vn.prototype.createSquare=function(n){this._segList.addPt(new U(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new U(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new U(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new U(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},Vn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},Vn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Vn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Vn.prototype.initSideSegments=function(n,i,s){this._s1=n,this._s2=i,this._side=s,this._seg1.setCoordinates(n,i),this.computeOffsetSegment(this._seg1,s,this._distance,this._offset1)},Vn.prototype.addLimitedMitreJoin=function(n,i,s,l){var h=this._seg0.p1,v=ke.angle(h,this._seg0.p0),S=ke.angleBetweenOriented(this._seg0.p0,h,this._seg1.p1)/2,R=ke.normalize(v+S),V=ke.normalize(R+Math.PI),nt=l*s,_t=s-nt*Math.abs(Math.sin(S)),Et=h.x+nt*Math.cos(V),Wt=h.y+nt*Math.sin(V),$t=new U(Et,Wt),ie=new ee(h,$t),Ee=ie.pointAlongOffset(1,_t),An=ie.pointAlongOffset(1,-_t);this._side===Gt.LEFT?(this._segList.addPt(Ee),this._segList.addPt(An)):(this._segList.addPt(An),this._segList.addPt(Ee))},Vn.prototype.computeOffsetSegment=function(n,i,s,l){var h=i===Gt.LEFT?1:-1,v=n.p1.x-n.p0.x,S=n.p1.y-n.p0.y,R=Math.sqrt(v*v+S*S),V=h*s*v/R,nt=h*s*S/R;l.p0.x=n.p0.x-nt,l.p0.y=n.p0.y+V,l.p1.x=n.p1.x-nt,l.p1.y=n.p1.y+V},Vn.prototype.addFilletArc=function(n,i,s,l,h){var v=l===W.CLOCKWISE?-1:1,S=Math.abs(i-s),R=Math.trunc(S/this._filletAngleQuantum+.5);if(R<1)return null;for(var V=S/R,nt=0,_t=new U;nt<S;){var Et=i+v*nt;_t.x=n.x+h*Math.cos(Et),_t.y=n.y+h*Math.sin(Et),this._segList.addPt(_t),nt+=V}},Vn.prototype.addInsideTurn=function(n,i){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*Vn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var s=new U((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s);var l=new U((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(l)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Vn.prototype.createCircle=function(n){var i=new U(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Vn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},Vn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Li,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*Vn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Vn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Fe.JOIN_BEVEL||this._bufParams.getJoinStyle()===Fe.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,W.CLOCKWISE,this._distance))},Vn.prototype.closeRing=function(){this._segList.closeRing()},Vn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Vn.prototype.interfaces_=function(){return[]},Vn.prototype.getClass=function(){return Vn},cs.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},cs.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},cs.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},cs.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Vn,cs);var ni=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};ni.prototype.getOffsetCurve=function(n,i){if(this._distance=i,i===0)return null;var s=i<0,l=Math.abs(i),h=this.getSegGen(l);n.length<=1?this.computePointCurve(n[0],h):this.computeOffsetCurve(n,s,h);var v=h.getCoordinates();return s&&Mt.reverse(v),v},ni.prototype.computeSingleSidedBufferCurve=function(n,i,s){var l=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var h=sr.simplify(n,-l),v=h.length-1;s.initSideSegments(h[v],h[v-1],Gt.LEFT),s.addFirstSegment();for(var S=v-2;S>=0;S--)s.addNextSegment(h[S],!0)}else{s.addSegments(n,!1);var R=sr.simplify(n,l),V=R.length-1;s.initSideSegments(R[0],R[1],Gt.LEFT),s.addFirstSegment();for(var nt=2;nt<=V;nt++)s.addNextSegment(R[nt],!0)}s.addLastSegment(),s.closeRing()},ni.prototype.computeRingBufferCurve=function(n,i,s){var l=this.simplifyTolerance(this._distance);i===Gt.RIGHT&&(l=-l);var h=sr.simplify(n,l),v=h.length-1;s.initSideSegments(h[v-1],h[0],i);for(var S=1;S<=v;S++){var R=S!==1;s.addNextSegment(h[S],R)}s.closeRing()},ni.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),l=sr.simplify(n,s),h=l.length-1;i.initSideSegments(l[0],l[1],Gt.LEFT);for(var v=2;v<=h;v++)i.addNextSegment(l[v],!0);i.addLastSegment(),i.addLineEndCap(l[h-1],l[h]);var S=sr.simplify(n,-s),R=S.length-1;i.initSideSegments(S[R],S[R-1],Gt.LEFT);for(var V=R-2;V>=0;V--)i.addNextSegment(S[V],!0);i.addLastSegment(),i.addLineEndCap(S[1],S[0]),i.closeRing()},ni.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case Fe.CAP_ROUND:i.createCircle(n);break;case Fe.CAP_SQUARE:i.createSquare(n)}},ni.prototype.getLineCurve=function(n,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var s=Math.abs(i),l=this.getSegGen(s);if(n.length<=1)this.computePointCurve(n[0],l);else if(this._bufParams.isSingleSided()){var h=i<0;this.computeSingleSidedBufferCurve(n,h,l)}else this.computeLineBufferCurve(n,l);return l.getCoordinates()},ni.prototype.getBufferParameters=function(){return this._bufParams},ni.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},ni.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return ni.copyCoordinates(n);var l=this.getSegGen(s);return this.computeRingBufferCurve(n,i,l),l.getCoordinates()},ni.prototype.computeOffsetCurve=function(n,i,s){var l=this.simplifyTolerance(this._distance);if(i){var h=sr.simplify(n,-l),v=h.length-1;s.initSideSegments(h[v],h[v-1],Gt.LEFT),s.addFirstSegment();for(var S=v-2;S>=0;S--)s.addNextSegment(h[S],!0)}else{var R=sr.simplify(n,l),V=R.length-1;s.initSideSegments(R[0],R[1],Gt.LEFT),s.addFirstSegment();for(var nt=2;nt<=V;nt++)s.addNextSegment(R[nt],!0)}s.addLastSegment()},ni.prototype.getSegGen=function(n){return new Vn(this._precisionModel,this._bufParams,n)},ni.prototype.interfaces_=function(){return[]},ni.prototype.getClass=function(){return ni},ni.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new U(n[s]);return i};var Js=function(){this._subgraphs=null,this._seg=new ee,this._cga=new W;var n=arguments[0];this._subgraphs=n},Ic={DepthSegment:{configurable:!0}};Js.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new ct,s=this._subgraphs.iterator();s.hasNext();){var l=s.next(),h=l.getEnvelope();n.y<h.getMinY()||n.y>h.getMaxY()||this.findStabbedSegments(n,l.getDirectedEdges(),i)}return i}if(arguments.length===3){if(j(arguments[2],kt)&&arguments[0]instanceof U&&arguments[1]instanceof Ac){for(var v=arguments[0],S=arguments[1],R=arguments[2],V=S.getEdge().getCoordinates(),nt=0;nt<V.length-1;nt++)if(this._seg.p0=V[nt],this._seg.p1=V[nt+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<v.x)&&!(this._seg.isHorizontal()||v.y<this._seg.p0.y||v.y>this._seg.p1.y||W.computeOrientation(this._seg.p0,this._seg.p1,v)===W.RIGHT)){var _t=S.getDepth(Gt.LEFT);this._seg.p0.equals(V[nt])||(_t=S.getDepth(Gt.RIGHT));var Et=new fs(this._seg,_t);R.add(Et)}}else if(j(arguments[2],kt)&&arguments[0]instanceof U&&j(arguments[1],kt))for(var Wt=arguments[0],$t=arguments[1],ie=arguments[2],Ee=$t.iterator();Ee.hasNext();){var An=Ee.next();An.isForward()&&this.findStabbedSegments(Wt,An,ie)}}},Js.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:ro.min(i)._leftDepth},Js.prototype.interfaces_=function(){return[]},Js.prototype.getClass=function(){return Js},Ic.DepthSegment.get=function(){return fs},Object.defineProperties(Js,Ic);var fs=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new ee(n),this._leftDepth=i};fs.prototype.compareTo=function(n){var i=n;if(this._upwardSeg.minX()>=i._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=i._upwardSeg.minX())return-1;var s=this._upwardSeg.orientationIndex(i._upwardSeg);return s!==0||(s=-1*i._upwardSeg.orientationIndex(this._upwardSeg))!=0?s:this._upwardSeg.compareTo(i._upwardSeg)},fs.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},fs.prototype.toString=function(){return this._upwardSeg.toString()},fs.prototype.interfaces_=function(){return[G]},fs.prototype.getClass=function(){return fs};var Ve=function(n,i,s){this.p0=n||null,this.p1=i||null,this.p2=s||null};Ve.prototype.area=function(){return Ve.area(this.p0,this.p1,this.p2)},Ve.prototype.signedArea=function(){return Ve.signedArea(this.p0,this.p1,this.p2)},Ve.prototype.interpolateZ=function(n){if(n===null)throw new L("Supplied point is null.");return Ve.interpolateZ(n,this.p0,this.p1,this.p2)},Ve.prototype.longestSideLength=function(){return Ve.longestSideLength(this.p0,this.p1,this.p2)},Ve.prototype.isAcute=function(){return Ve.isAcute(this.p0,this.p1,this.p2)},Ve.prototype.circumcentre=function(){return Ve.circumcentre(this.p0,this.p1,this.p2)},Ve.prototype.area3D=function(){return Ve.area3D(this.p0,this.p1,this.p2)},Ve.prototype.centroid=function(){return Ve.centroid(this.p0,this.p1,this.p2)},Ve.prototype.inCentre=function(){return Ve.inCentre(this.p0,this.p1,this.p2)},Ve.prototype.interfaces_=function(){return[]},Ve.prototype.getClass=function(){return Ve},Ve.area=function(n,i,s){return Math.abs(((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2)},Ve.signedArea=function(n,i,s){return((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2},Ve.det=function(n,i,s,l){return n*l-i*s},Ve.interpolateZ=function(n,i,s,l){var h=i.x,v=i.y,S=s.x-h,R=l.x-h,V=s.y-v,nt=l.y-v,_t=S*nt-R*V,Et=n.x-h,Wt=n.y-v,$t=(nt*Et-R*Wt)/_t,ie=(-V*Et+S*Wt)/_t;return i.z+$t*(s.z-i.z)+ie*(l.z-i.z)},Ve.longestSideLength=function(n,i,s){var l=n.distance(i),h=i.distance(s),v=s.distance(n),S=l;return h>S&&(S=h),v>S&&(S=v),S},Ve.isAcute=function(n,i,s){return!!ke.isAcute(n,i,s)&&!!ke.isAcute(i,s,n)&&!!ke.isAcute(s,n,i)},Ve.circumcentre=function(n,i,s){var l=s.x,h=s.y,v=n.x-l,S=n.y-h,R=i.x-l,V=i.y-h,nt=2*Ve.det(v,S,R,V),_t=Ve.det(S,v*v+S*S,V,R*R+V*V),Et=Ve.det(v,v*v+S*S,R,R*R+V*V);return new U(l-_t/nt,h+Et/nt)},Ve.perpendicularBisector=function(n,i){var s=i.x-n.x,l=i.y-n.y,h=new _e(n.x+s/2,n.y+l/2,1),v=new _e(n.x-l+s/2,n.y+s+l/2,1);return new _e(h,v)},Ve.angleBisector=function(n,i,s){var l=i.distance(n),h=l/(l+i.distance(s)),v=s.x-n.x,S=s.y-n.y;return new U(n.x+h*v,n.y+h*S)},Ve.area3D=function(n,i,s){var l=i.x-n.x,h=i.y-n.y,v=i.z-n.z,S=s.x-n.x,R=s.y-n.y,V=s.z-n.z,nt=h*V-v*R,_t=v*S-l*V,Et=l*R-h*S,Wt=nt*nt+_t*_t+Et*Et,$t=Math.sqrt(Wt)/2;return $t},Ve.centroid=function(n,i,s){var l=(n.x+i.x+s.x)/3,h=(n.y+i.y+s.y)/3;return new U(l,h)},Ve.inCentre=function(n,i,s){var l=i.distance(s),h=n.distance(s),v=n.distance(i),S=l+h+v,R=(l*n.x+h*i.x+v*s.x)/S,V=(l*n.y+h*i.y+v*s.y)/S;return new U(R,V)};var Ni=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new ct;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};Ni.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,$.EXTERIOR,$.INTERIOR)},Ni.prototype.addPolygon=function(n){var i=this._distance,s=Gt.LEFT;this._distance<0&&(i=-this._distance,s=Gt.RIGHT);var l=n.getExteriorRing(),h=Mt.removeRepeatedPoints(l.getCoordinates());if(this._distance<0&&this.isErodedCompletely(l,this._distance)||this._distance<=0&&h.length<3)return null;this.addPolygonRing(h,i,s,$.EXTERIOR,$.INTERIOR);for(var v=0;v<n.getNumInteriorRing();v++){var S=n.getInteriorRingN(v),R=Mt.removeRepeatedPoints(S.getCoordinates());this._distance>0&&this.isErodedCompletely(S,-this._distance)||this.addPolygonRing(R,i,Gt.opposite(s),$.INTERIOR,$.EXTERIOR)}},Ni.prototype.isTriangleErodedCompletely=function(n,i){var s=new Ve(n[0],n[1],n[2]),l=s.inCentre();return W.distancePointLine(l,s.p0,s.p1)<Math.abs(i)},Ni.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=Mt.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,$.EXTERIOR,$.INTERIOR)},Ni.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var l=new or(n,new Tn(0,$.BOUNDARY,i,s));this._curveList.add(l)},Ni.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Ni.prototype.addPolygonRing=function(n,i,s,l,h){if(i===0&&n.length<bn.MINIMUM_VALID_SIZE)return null;var v=l,S=h;n.length>=bn.MINIMUM_VALID_SIZE&&W.isCCW(n)&&(v=h,S=l,s=Gt.opposite(s));var R=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(R,v,S)},Ni.prototype.add=function(n){if(n.isEmpty())return null;n instanceof ue?this.addPolygon(n):n instanceof Qt?this.addLineString(n):n instanceof ge?this.addPoint(n):n instanceof Oe?this.addCollection(n):n instanceof K?this.addCollection(n):n instanceof Un?this.addCollection(n):n instanceof Sr&&this.addCollection(n)},Ni.prototype.isErodedCompletely=function(n,i){var s=n.getCoordinates();if(s.length<4)return i<0;if(s.length===4)return this.isTriangleErodedCompletely(s,i);var l=n.getEnvelopeInternal(),h=Math.min(l.getHeight(),l.getWidth());return i<0&&2*Math.abs(i)>h},Ni.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},Ni.prototype.interfaces_=function(){return[]},Ni.prototype.getClass=function(){return Ni};var eu=function(){};eu.prototype.locate=function(n){},eu.prototype.interfaces_=function(){return[]},eu.prototype.getClass=function(){return eu};var oo=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()};oo.prototype.next=function(){if(this._atStart)return this._atStart=!1,oo.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new o;var n=this._parent.getGeometryN(this._index++);return n instanceof Sr?(this._subcollectionIterator=new oo(n),this._subcollectionIterator.next()):n},oo.prototype.remove=function(){throw new Error(this.getClass().getName())},oo.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},oo.prototype.interfaces_=function(){return[et]},oo.prototype.getClass=function(){return oo},oo.isAtomic=function(n){return!(n instanceof Sr)};var ri=function(){this._geom=null;var n=arguments[0];this._geom=n};ri.prototype.locate=function(n){return ri.locate(n,this._geom)},ri.prototype.interfaces_=function(){return[eu]},ri.prototype.getClass=function(){return ri},ri.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&W.isPointInRing(n,i.getCoordinates())},ri.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!ri.isPointInRing(n,s))return!1;for(var l=0;l<i.getNumInteriorRing();l++){var h=i.getInteriorRingN(l);if(ri.isPointInRing(n,h))return!1}return!0},ri.containsPoint=function(n,i){if(i instanceof ue)return ri.containsPointInPolygon(n,i);if(i instanceof Sr)for(var s=new oo(i);s.hasNext();){var l=s.next();if(l!==i&&ri.containsPoint(n,l))return!0}return!1},ri.locate=function(n,i){return i.isEmpty()?$.EXTERIOR:ri.containsPoint(n,i)?$.INTERIOR:$.EXTERIOR};var Vr=function(){this._edgeMap=new w,this._edgeList=null,this._ptInAreaLocation=[$.NONE,$.NONE]};Vr.prototype.getNextCW=function(n){this.getEdges();var i=this._edgeList.indexOf(n),s=i-1;return i===0&&(s=this._edgeList.size()-1),this._edgeList.get(s)},Vr.prototype.propagateSideLabels=function(n){for(var i=$.NONE,s=this.iterator();s.hasNext();){var l=s.next().getLabel();l.isArea(n)&&l.getLocation(n,Gt.LEFT)!==$.NONE&&(i=l.getLocation(n,Gt.LEFT))}if(i===$.NONE)return null;for(var h=i,v=this.iterator();v.hasNext();){var S=v.next(),R=S.getLabel();if(R.getLocation(n,Gt.ON)===$.NONE&&R.setLocation(n,Gt.ON,h),R.isArea(n)){var V=R.getLocation(n,Gt.LEFT),nt=R.getLocation(n,Gt.RIGHT);if(nt!==$.NONE){if(nt!==h)throw new qo("side location conflict",S.getCoordinate());V===$.NONE&&P.shouldNeverReachHere("found single null side (at "+S.getCoordinate()+")"),h=V}else P.isTrue(R.getLocation(n,Gt.LEFT)===$.NONE,"found single null side"),R.setLocation(n,Gt.RIGHT,h),R.setLocation(n,Gt.LEFT,h)}}},Vr.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},Vr.prototype.print=function(n){Zt.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},Vr.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},Vr.prototype.checkAreaLabelsConsistent=function(n){var i=this.getEdges();if(i.size()<=0)return!0;var s=i.size()-1,l=i.get(s).getLabel().getLocation(n,Gt.LEFT);P.isTrue(l!==$.NONE,"Found unlabelled area edge");for(var h=l,v=this.iterator();v.hasNext();){var S=v.next().getLabel();P.isTrue(S.isArea(n),"Found non-area edge");var R=S.getLocation(n,Gt.LEFT),V=S.getLocation(n,Gt.RIGHT);if(R===V||V!==h)return!1;h=R}return!0},Vr.prototype.findIndex=function(n){this.iterator();for(var i=0;i<this._edgeList.size();i++)if(this._edgeList.get(i)===n)return i;return-1},Vr.prototype.iterator=function(){return this.getEdges().iterator()},Vr.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new ct(this._edgeMap.values())),this._edgeList},Vr.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===$.NONE&&(this._ptInAreaLocation[n]=ri.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},Vr.prototype.toString=function(){var n=new Tt;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(\`
109
109
  \`);for(var i=this.iterator();i.hasNext();){var s=i.next();n.append(s),n.append(\`
@@ -7504,16 +7504,16 @@ three/build/three.module.js:
7504
7504
  * along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.
7505
7505
  *)
7506
7506
  */
7507
- `)}var Na=class extends hd{worker=Ui();initRoadStatus=!1;constructor(){super()}async setRoadData(e){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),await we(this.worker,"set_road_info",{roadData:e}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})}async getPath(e,t,n=""){return new Promise((i,o)=>{let a=()=>{console.log("initRoadStatus",this.initRoadStatus),we(this.worker,"get_path",{start:e,end:t,type:n}).then(c=>{c?typeof c=="string"?o(c):i(c):o("no-path")})};if(this.initRoadStatus)a();else{let c=({status:l})=>{l&&(this.removeEventListener("init-road-status",c),a())};this.addEventListener("init-road-status",c)}})}getDirectionPath(e){return we(this.worker,"get_direction_path",e)}async dispose(){we(this.worker,"clear",""),this.worker.terminate()}};import{Frustum as pd}from"three";var Wr=class extends le{startPoint;endPoint;rect;frustum=new pd;constructor(e){super(e);let{config:{selectBox:{fill:t,stroke:n}}}=e;this.rect=Ve(n,t),this.svg.appendChild(this.rect),this.registryEvent()}setEnable(e){super.setEnable(e),Xt(this.rect,0,0,0,0),e?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}onPointerDown=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.startPoint=t),this.endPoint=void 0};onPointerMove=e=>{if(!this.enable||!this.startPoint)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t)};onPointerUp=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t),this.doSelect(),this.startPoint=void 0};onUpdate=()=>{if(this.startPoint){let e=this.getSvgCoordinate(this.startPoint),t={...e};this.endPoint&&(t=this.getSvgCoordinate(this.endPoint));let n={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y)},i=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y);Xt(this.rect,n.x,n.y,i,o)}else Xt(this.rect,0,0,0,0)};registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:t,container:{clientWidth:n,clientHeight:i}}}=this,o=et(this.startPoint,t,n,i),a=et(this.endPoint,t,n,i),c={x:Math.min(o.x,a.x),y:Math.min(o.y,a.y)},l={x:Math.max(o.x,a.x),y:Math.max(o.y,a.y)},s=this.searchMapInFrustum(c,l);this.dispatchEvent({type:"selected",list:s})}}searchMapInFrustum(e,t){let{context:n}=this;return n.currentFloor?.graphicLayer.children.filter(i=>i instanceof Ft&&this.searchChildInFrustum(i,e,t))||[]}searchChildInFrustum(e,t,n){let{context:{camera:i,container:{clientWidth:o,clientHeight:a}}}=this;if(!e)return!1;if(!e.mesh){let f=e.getPosition();if(f){let d=et(f,i,o,a);return ke(d,t,n)}return!1}e.mesh.geometry.boundingBox||e.mesh.geometry.computeBoundingBox();let c=e.mesh.geometry.boundingBox;if(!c)return!1;let{min:l,max:s}=c,u=et(l,i,o,a),h=et(s,i,o,a);return!(!ke(u,t,n)||!ke(h,t,n))}dispose(){this.unRegistryEvent()}};var fd={boxSelection:!1,elements:["graphic","poi"]},La=class extends Ae{options;_list=new Set;_poiList=new Set;boxSelection;prevPanStatus;prevRotateStatus;downPoint=null;isMultipleSelect=!1;constructor(e,t={}){super(e),this.options={...fd,...t},this.boxSelection=new Wr(this.bmap.context),this.boxSelection.setEnable(!1),this.registryEvent()}get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.options.boxSelection||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.bmap.context.control.enablePan,this.prevRotateStatus=this.bmap.context.control.enableRotate,this.bmap.context.control.enablePan=!1,this.bmap.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.bmap.context.control.enablePan=!!this.prevPanStatus,this.bmap.context.control.enableRotate=!!this.prevRotateStatus)}onPointerDown=e=>{this.downPoint={x:e.offsetX,y:e.offsetY}};onPointerUp=e=>{if(!this.downPoint)return;let{offsetX:t,offsetY:n}=e,{x:i,y:o}=this.downPoint;if(Math.sqrt((i-t)**2+(o-n)**2)>3)return;let a=new Set,c=[],l=[];if(this.options.elements.includes("graphic")){let{graphics:s}=this.bmap.context.getGraphicsByDeviceXy(t,n);s.map(u=>a.add(u.options.id)),c.push(...s)}if(this.options.elements.includes("poi")){let s=this.bmap.context.getPoisByDeviceXy(t,n);l.push(...s),s.forEach(u=>{if(!a.has(u.options.id)){let h=this.bmap.context.currentFloor?.graphicLayer.graphicMap.get(u.options.id)||null;h&&(a.add(u.options.id),c.push(h))}})}(!this.options.boxSelection||!(gn?e.metaKey:e.ctrlKey))&&(this._list.clear(),this._poiList.clear()),c.forEach(s=>this._list.add(s)),l.forEach(s=>this._poiList.add(s)),this.selectEnd(),this.downPoint=null};onPointerOut=e=>{this.disableBoxSelection()};onKeyDown=e=>{mn(e.key)&&this.enableBoxSelection()};onKeyUp=e=>{mn(e.key)&&this.disableBoxSelection()};onBoxSelected=({list:e})=>{this._list.clear(),e.forEach(t=>{this._list.add(t)}),this.selectEnd()};selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],pois:[...this._poiList],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.bmap.context.container.addEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.addEventListener("pointerup",this.onPointerUp),this.bmap.context.container.addEventListener("pointerout",this.onPointerOut),this.bmap.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.bmap.context.container.removeEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.removeEventListener("pointerup",this.onPointerUp),this.bmap.context.container.removeEventListener("pointerout",this.onPointerOut),this.bmap.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(e){this._list.delete(e)}dispose(){this.unRegistryEvent()}};import{cloneDeep as dd,isNil as je,throttle as Oa}from"lodash";import{EventDispatcher as gd}from"three";var md={time:1e3,elements:["compass","deviceMotion","acceleration","gps"]},qr=class extends gd{options;gpsTimer=null;data=[];timer=new Gt;dispatchTimer=null;constructor(e={}){super(),this.options={...md,...e}}start(){this.options.elements.some(e=>["deviceMotion","compass"].includes(e))&&this.listenDeviceOrientation(),this.options.elements.includes("acceleration")&&this.listenAcceleration(),this.options.elements.includes("gps")&&this.listenGps(),this.dispatchEvent({type:"start"}),this.dispatchTimer=this.timer.setInterval(()=>{this.dispatchEvent({type:"sensor-data",data:dd(this.data)}),this.data=[]},this.options.time)}addDataItem(e){this.data.push(e),this.dispatchEvent({type:"add-data-item",item:e})}addAcceleration=Oa(e=>{this.addDataItem(e)},20);deviceOrientationAbsHandler=Oa(e=>{let t=Date.now(),{alpha:n,beta:i,gamma:o}=e;if(je(n)||je(i)||je(o))return;let a;kn?a=e.webkitCompassHeading:a=360-n,this.options.elements.includes("deviceMotion")&&this.addDataItem({type:"deviceMotion",timestamp:t,res:[n,i,o]}),this.options.elements.includes("compass")&&this.addDataItem({type:"compass",timestamp:t,res:a})},200);listenDeviceOrientation(){kn?window.addEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.addEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0})}handleAcceleration=e=>{let t=e.accelerationIncludingGravity;je(t)||je(t.x)||je(t.y)||je(t.z)||this.addAcceleration({type:"acceleration",timestamp:Date.now(),res:[t.x,t.y,t.z]})};listenAcceleration(){window.addEventListener("devicemotion",this.handleAcceleration,!1)}listenGps(){this.gpsTimer=navigator.geolocation.watchPosition(e=>{e.coords.accuracy<=10&&this.addDataItem({type:"gps",timestamp:Date.now(),res:[e.coords.longitude,e.coords.latitude,e.coords.accuracy]})})}async checkSensor(){return{deviceOrientation:await this.checkDeviceOrientation()}}async checkDeviceOrientation(){if(!kn)return!0;if(typeof window.DeviceOrientationEvent<"u"&&typeof window.DeviceOrientationEvent?.requestPermission=="function")try{return await window.DeviceOrientationEvent?.requestPermission()==="granted"}catch{return!1}return!1}stop(){window.removeEventListener("devicemotion",this.handleAcceleration,!1),kn?window.removeEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.removeEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0}),je(this.gpsTimer)||navigator.geolocation.clearWatch(this.gpsTimer),this.dispatchTimer&&this.timer.clearInterval(this.dispatchTimer),this.data=[],this.dispatchEvent({type:"stop"})}};import{EventDispatcher as rv}from"three";function Xr(r,e){return 1/Math.sqrt(2*Math.PI*Math.pow(e,2))*Math.exp(-Math.pow(r,2)/(2*Math.pow(e,2)))}function jr(r){return(r+360)%360}function Ua(r,e){let n=6378137*r*Math.PI/180,i=6378137*Math.log(Math.tan(Math.PI/4+e*Math.PI/180/2));return{x:n,y:i}}function En(r,e,t,n){return Math.sqrt(Math.pow(Math.abs(r-t),2)+Math.pow(Math.abs(e-n),2))}function bn(){return bn=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},bn.apply(null,arguments)}var Bi={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null};function Ba(r,e){if(jn(r,e))return r[e];throw typeof r[e]=="function"&&yd(r,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function za(r,e,t){if(jn(r,e))return r[e]=t,t;throw new Error('No access to property "'+e+'"')}function jn(r,e){return!vd(r)&&!Array.isArray(r)?!1:Sn(_d,e)?!0:!(e in Object.prototype||e in Function.prototype)}function yd(r,e){return r==null||typeof r[e]!="function"||Sn(r,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(r)?!1:Sn(xd,e)?!0:!(e in Object.prototype||e in Function.prototype)}function vd(r){return typeof r=="object"&&r&&r.constructor===Object}var _d={length:!0,name:!0},xd={toString:!0,valueOf:!0,toLocaleString:!0};var Yr=class{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter(e=>this.has(e)).values()}get(e){return Ba(this.wrappedObject,e)}set(e,t){return za(this.wrappedObject,e,t),this}has(e){return jn(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return Ed(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){jn(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}};function Ed(r,e){return{next:()=>{var t=r.next();return t.done?t:{value:e(t.value),done:!1}}}}function nt(r){return typeof r=="number"}function it(r){return!r||typeof r!="object"||typeof r.constructor!="function"?!1:r.isBigNumber===!0&&typeof r.constructor.prototype=="object"&&r.constructor.prototype.isBigNumber===!0||typeof r.constructor.isDecimal=="function"&&r.constructor.isDecimal(r)===!0}function Ga(r){return typeof r=="bigint"}function zi(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isComplex===!0||!1}function Gi(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isFraction===!0||!1}function $r(r){return r&&r.constructor.prototype.isUnit===!0||!1}function jt(r){return typeof r=="string"}var yt=Array.isArray;function ot(r){return r&&r.constructor.prototype.isMatrix===!0||!1}function Fe(r){return Array.isArray(r)||ot(r)}function ka(r){return r&&r.isDenseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function Va(r){return r&&r.isSparseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function Ha(r){return r&&r.constructor.prototype.isRange===!0||!1}function Mn(r){return r&&r.constructor.prototype.isIndex===!0||!1}function Wa(r){return typeof r=="boolean"}function qa(r){return r&&r.constructor.prototype.isResultSet===!0||!1}function Xa(r){return r&&r.constructor.prototype.isHelp===!0||!1}function ja(r){return typeof r=="function"}function Ya(r){return r instanceof Date}function $a(r){return r instanceof RegExp}function wn(r){return!!(r&&typeof r=="object"&&r.constructor===Object&&!zi(r)&&!Gi(r))}function Za(r){return r?r instanceof Map||r instanceof Yr||typeof r.set=="function"&&typeof r.get=="function"&&typeof r.keys=="function"&&typeof r.has=="function":!1}function Ka(r){return r===null}function Ja(r){return r===void 0}function Qa(r){return r&&r.isAccessorNode===!0&&r.constructor.prototype.isNode===!0||!1}function tu(r){return r&&r.isArrayNode===!0&&r.constructor.prototype.isNode===!0||!1}function eu(r){return r&&r.isAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function nu(r){return r&&r.isBlockNode===!0&&r.constructor.prototype.isNode===!0||!1}function ru(r){return r&&r.isConditionalNode===!0&&r.constructor.prototype.isNode===!0||!1}function iu(r){return r&&r.isConstantNode===!0&&r.constructor.prototype.isNode===!0||!1}function ou(r){return r&&r.isFunctionAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function su(r){return r&&r.isFunctionNode===!0&&r.constructor.prototype.isNode===!0||!1}function au(r){return r&&r.isIndexNode===!0&&r.constructor.prototype.isNode===!0||!1}function uu(r){return r&&r.isNode===!0&&r.constructor.prototype.isNode===!0||!1}function lu(r){return r&&r.isObjectNode===!0&&r.constructor.prototype.isNode===!0||!1}function cu(r){return r&&r.isOperatorNode===!0&&r.constructor.prototype.isNode===!0||!1}function hu(r){return r&&r.isParenthesisNode===!0&&r.constructor.prototype.isNode===!0||!1}function pu(r){return r&&r.isRangeNode===!0&&r.constructor.prototype.isNode===!0||!1}function fu(r){return r&&r.isRelationalNode===!0&&r.constructor.prototype.isNode===!0||!1}function du(r){return r&&r.isSymbolNode===!0&&r.constructor.prototype.isNode===!0||!1}function gu(r){return r&&r.constructor.prototype.isChain===!0||!1}function Ut(r){var e=typeof r;return e==="object"?r===null?"null":it(r)?"BigNumber":r.constructor&&r.constructor.name?r.constructor.name:"Object":e}function ft(r){var e=typeof r;if(e==="number"||e==="bigint"||e==="string"||e==="boolean"||r===null||r===void 0)return r;if(typeof r.clone=="function")return r.clone();if(Array.isArray(r))return r.map(function(t){return ft(t)});if(r instanceof Date)return new Date(r.valueOf());if(it(r))return r;if(wn(r))return bd(r,ft);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(r,")"))}function bd(r,e){var t={};for(var n in r)Sn(r,n)&&(t[n]=e(r[n]));return t}function Zr(r,e){for(var t in e)Sn(e,t)&&(r[t]=e[t]);return r}function ce(r,e){var t,n,i;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(n=0,i=r.length;n<i;n++)if(!ce(r[n],e[n]))return!1;return!0}else{if(typeof r=="function")return r===e;if(r instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(t in r)if(!(t in e)||!ce(r[t],e[t]))return!1;for(t in e)if(!(t in r))return!1;return!0}else return r===e}}function Sn(r,e){return r&&Object.hasOwnProperty.call(r,e)}function mu(r,e){for(var t={},n=0;n<e.length;n++){var i=e[n],o=r[i];o!==void 0&&(t[i]=o)}return t}var yu=["Matrix","Array"],vu=["number","BigNumber","Fraction"];var he=function(e){if(e)throw new Error(`The global config is readonly.
7507
+ `)}var Na=class extends hd{worker=Ui();initRoadStatus=!1;constructor(){super()}async setRoadData(e){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),await we(this.worker,"set_road_info",{roadData:e}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})}async getPath(e,t,n=""){return new Promise((i,o)=>{let a=()=>{console.log("initRoadStatus",this.initRoadStatus),we(this.worker,"get_path",{start:e,end:t,type:n}).then(c=>{c?typeof c=="string"?o(c):i(c):o("no-path")})};if(this.initRoadStatus)a();else{let c=({status:l})=>{l&&(this.removeEventListener("init-road-status",c),a())};this.addEventListener("init-road-status",c)}})}getDirectionPath(e){return we(this.worker,"get_direction_path",e)}async dispose(){we(this.worker,"clear",""),this.worker.terminate()}};import{Frustum as pd}from"three";var qr=class extends le{startPoint;endPoint;rect;frustum=new pd;constructor(e){super(e);let{config:{selectBox:{fill:t,stroke:n}}}=e;this.rect=Ve(n,t),this.svg.appendChild(this.rect),this.registryEvent()}setEnable(e){super.setEnable(e),Xt(this.rect,0,0,0,0),e?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}onPointerDown=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.startPoint=t),this.endPoint=void 0};onPointerMove=e=>{if(!this.enable||!this.startPoint)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t)};onPointerUp=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t),this.doSelect(),this.startPoint=void 0};onUpdate=()=>{if(this.startPoint){let e=this.getSvgCoordinate(this.startPoint),t={...e};this.endPoint&&(t=this.getSvgCoordinate(this.endPoint));let n={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y)},i=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y);Xt(this.rect,n.x,n.y,i,o)}else Xt(this.rect,0,0,0,0)};registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:t,container:{clientWidth:n,clientHeight:i}}}=this,o=et(this.startPoint,t,n,i),a=et(this.endPoint,t,n,i),c={x:Math.min(o.x,a.x),y:Math.min(o.y,a.y)},l={x:Math.max(o.x,a.x),y:Math.max(o.y,a.y)},s=this.searchMapInFrustum(c,l);this.dispatchEvent({type:"selected",list:s})}}searchMapInFrustum(e,t){let{context:n}=this;return n.currentFloor?.graphicLayer.children.filter(i=>i instanceof Ft&&this.searchChildInFrustum(i,e,t))||[]}searchChildInFrustum(e,t,n){let{context:{camera:i,container:{clientWidth:o,clientHeight:a}}}=this;if(!e)return!1;if(!e.mesh){let f=e.getPosition();if(f){let d=et(f,i,o,a);return ke(d,t,n)}return!1}e.mesh.geometry.boundingBox||e.mesh.geometry.computeBoundingBox();let c=e.mesh.geometry.boundingBox;if(!c)return!1;let{min:l,max:s}=c,u=et(l,i,o,a),h=et(s,i,o,a);return!(!ke(u,t,n)||!ke(h,t,n))}dispose(){this.unRegistryEvent()}};var fd={boxSelection:!1,elements:["graphic","poi"]},La=class extends Ae{options;_list=new Set;_poiList=new Set;boxSelection;prevPanStatus;prevRotateStatus;downPoint=null;isMultipleSelect=!1;constructor(e,t={}){super(e),this.options={...fd,...t},this.boxSelection=new qr(this.bmap.context),this.boxSelection.setEnable(!1),this.registryEvent()}get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.options.boxSelection||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.bmap.context.control.enablePan,this.prevRotateStatus=this.bmap.context.control.enableRotate,this.bmap.context.control.enablePan=!1,this.bmap.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.bmap.context.control.enablePan=!!this.prevPanStatus,this.bmap.context.control.enableRotate=!!this.prevRotateStatus)}onPointerDown=e=>{this.downPoint={x:e.offsetX,y:e.offsetY}};onPointerUp=e=>{if(!this.downPoint)return;let{offsetX:t,offsetY:n}=e,{x:i,y:o}=this.downPoint;if(Math.sqrt((i-t)**2+(o-n)**2)>3)return;let a=new Set,c=[],l=[];if(this.options.elements.includes("graphic")){let{graphics:s}=this.bmap.context.getGraphicsByDeviceXy(t,n);s.map(u=>a.add(u.options.id)),c.push(...s)}if(this.options.elements.includes("poi")){let s=this.bmap.context.getPoisByDeviceXy(t,n);l.push(...s),s.forEach(u=>{if(!a.has(u.options.id)){let h=this.bmap.context.currentFloor?.graphicLayer.graphicMap.get(u.options.id)||null;h&&(a.add(u.options.id),c.push(h))}})}(!this.options.boxSelection||!(gn?e.metaKey:e.ctrlKey))&&(this._list.clear(),this._poiList.clear()),c.forEach(s=>this._list.add(s)),l.forEach(s=>this._poiList.add(s)),this.selectEnd(),this.downPoint=null};onPointerOut=e=>{this.disableBoxSelection()};onKeyDown=e=>{mn(e.key)&&this.enableBoxSelection()};onKeyUp=e=>{mn(e.key)&&this.disableBoxSelection()};onBoxSelected=({list:e})=>{this._list.clear(),e.forEach(t=>{this._list.add(t)}),this.selectEnd()};selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],pois:[...this._poiList],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.bmap.context.container.addEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.addEventListener("pointerup",this.onPointerUp),this.bmap.context.container.addEventListener("pointerout",this.onPointerOut),this.bmap.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.bmap.context.container.removeEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.removeEventListener("pointerup",this.onPointerUp),this.bmap.context.container.removeEventListener("pointerout",this.onPointerOut),this.bmap.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(e){this._list.delete(e)}dispose(){this.unRegistryEvent()}};import{cloneDeep as dd,isNil as je,throttle as Oa}from"lodash";import{EventDispatcher as gd}from"three";var md={time:1e3,elements:["compass","deviceMotion","acceleration","gps"]},Xr=class extends gd{options;gpsTimer=null;data=[];timer=new Gt;dispatchTimer=null;constructor(e={}){super(),this.options={...md,...e}}start(){this.options.elements.some(e=>["deviceMotion","compass"].includes(e))&&this.listenDeviceOrientation(),this.options.elements.includes("acceleration")&&this.listenAcceleration(),this.options.elements.includes("gps")&&this.listenGps(),this.dispatchEvent({type:"start"}),this.dispatchTimer=this.timer.setInterval(()=>{this.dispatchEvent({type:"sensor-data",data:dd(this.data)}),this.data=[]},this.options.time)}addDataItem(e){this.data.push(e),this.dispatchEvent({type:"add-data-item",item:e})}addAcceleration=Oa(e=>{this.addDataItem(e)},20);deviceOrientationAbsHandler=Oa(e=>{let t=Date.now(),{alpha:n,beta:i,gamma:o}=e;if(je(n)||je(i)||je(o))return;let a;kn?a=e.webkitCompassHeading:a=360-n,this.options.elements.includes("deviceMotion")&&this.addDataItem({type:"deviceMotion",timestamp:t,res:[n,i,o]}),this.options.elements.includes("compass")&&this.addDataItem({type:"compass",timestamp:t,res:a})},200);listenDeviceOrientation(){kn?window.addEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.addEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0})}handleAcceleration=e=>{let t=e.accelerationIncludingGravity;je(t)||je(t.x)||je(t.y)||je(t.z)||this.addAcceleration({type:"acceleration",timestamp:Date.now(),res:[t.x,t.y,t.z]})};listenAcceleration(){window.addEventListener("devicemotion",this.handleAcceleration,!1)}listenGps(){this.gpsTimer=navigator.geolocation.watchPosition(e=>{e.coords.accuracy<=10&&this.addDataItem({type:"gps",timestamp:Date.now(),res:[e.coords.longitude,e.coords.latitude,e.coords.accuracy]})})}async checkSensor(){return{deviceOrientation:await this.checkDeviceOrientation()}}async checkDeviceOrientation(){if(!kn)return!0;if(typeof window.DeviceOrientationEvent<"u"&&typeof window.DeviceOrientationEvent?.requestPermission=="function")try{return await window.DeviceOrientationEvent?.requestPermission()==="granted"}catch{return!1}return!1}stop(){window.removeEventListener("devicemotion",this.handleAcceleration,!1),kn?window.removeEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.removeEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0}),je(this.gpsTimer)||navigator.geolocation.clearWatch(this.gpsTimer),this.dispatchTimer&&this.timer.clearInterval(this.dispatchTimer),this.data=[],this.dispatchEvent({type:"stop"})}};import{EventDispatcher as rv}from"three";function jr(r,e){return 1/Math.sqrt(2*Math.PI*Math.pow(e,2))*Math.exp(-Math.pow(r,2)/(2*Math.pow(e,2)))}function jn(r){return(r+360)%360}function Ua(r,e){let n=6378137*r*Math.PI/180,i=6378137*Math.log(Math.tan(Math.PI/4+e*Math.PI/180/2));return{x:n,y:i}}function En(r,e,t,n){return Math.sqrt(Math.pow(Math.abs(r-t),2)+Math.pow(Math.abs(e-n),2))}function bn(){return bn=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},bn.apply(null,arguments)}var Bi={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null};function Ba(r,e){if(Yn(r,e))return r[e];throw typeof r[e]=="function"&&yd(r,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function za(r,e,t){if(Yn(r,e))return r[e]=t,t;throw new Error('No access to property "'+e+'"')}function Yn(r,e){return!vd(r)&&!Array.isArray(r)?!1:Sn(_d,e)?!0:!(e in Object.prototype||e in Function.prototype)}function yd(r,e){return r==null||typeof r[e]!="function"||Sn(r,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(r)?!1:Sn(xd,e)?!0:!(e in Object.prototype||e in Function.prototype)}function vd(r){return typeof r=="object"&&r&&r.constructor===Object}var _d={length:!0,name:!0},xd={toString:!0,valueOf:!0,toLocaleString:!0};var Yr=class{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter(e=>this.has(e)).values()}get(e){return Ba(this.wrappedObject,e)}set(e,t){return za(this.wrappedObject,e,t),this}has(e){return Yn(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return Ed(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){Yn(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}};function Ed(r,e){return{next:()=>{var t=r.next();return t.done?t:{value:e(t.value),done:!1}}}}function nt(r){return typeof r=="number"}function it(r){return!r||typeof r!="object"||typeof r.constructor!="function"?!1:r.isBigNumber===!0&&typeof r.constructor.prototype=="object"&&r.constructor.prototype.isBigNumber===!0||typeof r.constructor.isDecimal=="function"&&r.constructor.isDecimal(r)===!0}function Ga(r){return typeof r=="bigint"}function zi(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isComplex===!0||!1}function Gi(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isFraction===!0||!1}function $r(r){return r&&r.constructor.prototype.isUnit===!0||!1}function jt(r){return typeof r=="string"}var yt=Array.isArray;function ot(r){return r&&r.constructor.prototype.isMatrix===!0||!1}function Fe(r){return Array.isArray(r)||ot(r)}function ka(r){return r&&r.isDenseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function Va(r){return r&&r.isSparseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function Ha(r){return r&&r.constructor.prototype.isRange===!0||!1}function Mn(r){return r&&r.constructor.prototype.isIndex===!0||!1}function Wa(r){return typeof r=="boolean"}function qa(r){return r&&r.constructor.prototype.isResultSet===!0||!1}function Xa(r){return r&&r.constructor.prototype.isHelp===!0||!1}function ja(r){return typeof r=="function"}function Ya(r){return r instanceof Date}function $a(r){return r instanceof RegExp}function wn(r){return!!(r&&typeof r=="object"&&r.constructor===Object&&!zi(r)&&!Gi(r))}function Za(r){return r?r instanceof Map||r instanceof Yr||typeof r.set=="function"&&typeof r.get=="function"&&typeof r.keys=="function"&&typeof r.has=="function":!1}function Ka(r){return r===null}function Ja(r){return r===void 0}function Qa(r){return r&&r.isAccessorNode===!0&&r.constructor.prototype.isNode===!0||!1}function tu(r){return r&&r.isArrayNode===!0&&r.constructor.prototype.isNode===!0||!1}function eu(r){return r&&r.isAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function nu(r){return r&&r.isBlockNode===!0&&r.constructor.prototype.isNode===!0||!1}function ru(r){return r&&r.isConditionalNode===!0&&r.constructor.prototype.isNode===!0||!1}function iu(r){return r&&r.isConstantNode===!0&&r.constructor.prototype.isNode===!0||!1}function ou(r){return r&&r.isFunctionAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function su(r){return r&&r.isFunctionNode===!0&&r.constructor.prototype.isNode===!0||!1}function au(r){return r&&r.isIndexNode===!0&&r.constructor.prototype.isNode===!0||!1}function uu(r){return r&&r.isNode===!0&&r.constructor.prototype.isNode===!0||!1}function lu(r){return r&&r.isObjectNode===!0&&r.constructor.prototype.isNode===!0||!1}function cu(r){return r&&r.isOperatorNode===!0&&r.constructor.prototype.isNode===!0||!1}function hu(r){return r&&r.isParenthesisNode===!0&&r.constructor.prototype.isNode===!0||!1}function pu(r){return r&&r.isRangeNode===!0&&r.constructor.prototype.isNode===!0||!1}function fu(r){return r&&r.isRelationalNode===!0&&r.constructor.prototype.isNode===!0||!1}function du(r){return r&&r.isSymbolNode===!0&&r.constructor.prototype.isNode===!0||!1}function gu(r){return r&&r.constructor.prototype.isChain===!0||!1}function Ut(r){var e=typeof r;return e==="object"?r===null?"null":it(r)?"BigNumber":r.constructor&&r.constructor.name?r.constructor.name:"Object":e}function ft(r){var e=typeof r;if(e==="number"||e==="bigint"||e==="string"||e==="boolean"||r===null||r===void 0)return r;if(typeof r.clone=="function")return r.clone();if(Array.isArray(r))return r.map(function(t){return ft(t)});if(r instanceof Date)return new Date(r.valueOf());if(it(r))return r;if(wn(r))return bd(r,ft);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(r,")"))}function bd(r,e){var t={};for(var n in r)Sn(r,n)&&(t[n]=e(r[n]));return t}function Zr(r,e){for(var t in e)Sn(e,t)&&(r[t]=e[t]);return r}function ce(r,e){var t,n,i;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(n=0,i=r.length;n<i;n++)if(!ce(r[n],e[n]))return!1;return!0}else{if(typeof r=="function")return r===e;if(r instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(t in r)if(!(t in e)||!ce(r[t],e[t]))return!1;for(t in e)if(!(t in r))return!1;return!0}else return r===e}}function Sn(r,e){return r&&Object.hasOwnProperty.call(r,e)}function mu(r,e){for(var t={},n=0;n<e.length;n++){var i=e[n],o=r[i];o!==void 0&&(t[i]=o)}return t}var yu=["Matrix","Array"],vu=["number","BigNumber","Fraction"];var he=function(e){if(e)throw new Error(`The global config is readonly.
7508
7508
  Please create a mathjs instance if you want to change the default configuration.
7509
7509
  Example:
7510
7510
 
7511
7511
  import { create, all } from 'mathjs';
7512
7512
  const mathjs = create(all);
7513
7513
  mathjs.config({ number: 'BigNumber' });
7514
- `);return Object.freeze(Bi)};bn(he,Bi,{MATRIX_OPTIONS:yu,NUMBER_OPTIONS:vu});var ji=pn(Hi(),1);function N(r,e,t,n){function i(o){var a=mu(o,e.map(wd));return Sd(r,e,o),t(a)}return i.isFactory=!0,i.fn=r,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function Sd(r,e,t){var n=e.filter(o=>!Md(o)).every(o=>t[o]!==void 0);if(!n){var i=e.filter(o=>t[o]===void 0);throw new Error('Cannot create function "'.concat(r,'", ')+"some dependencies are missing: ".concat(i.map(o=>'"'.concat(o,'"')).join(", "),"."))}}function Md(r){return r&&r[0]==="?"}function wd(r){return r&&r[0]==="?"?r.slice(1):r}function tt(r){return typeof r=="boolean"?!0:isFinite(r)?r===Math.round(r):!1}var Eu=Math.sign||function(r){return r>0?1:r<0?-1:0},bu=Math.log2||function(e){return Math.log(e)/Math.LN2},Su=Math.log10||function(e){return Math.log(e)/Math.LN10},Mu=Math.log1p||function(r){return Math.log(r+1)},wu=Math.cbrt||function(e){if(e===0)return e;var t=e<0,n;return t&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,t?-n:n},Tu=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Wi(r,e,t){var n={2:"0b",8:"0o",16:"0x"},i=n[e],o="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!tt(t))throw new Error("size must be an integer");if(r>2**(t-1)-1||r<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!tt(r))throw new Error("Value must be an integer");r<0&&(r=r+2**t),o="i".concat(t)}var a="";return r<0&&(r=-r,a="-"),"".concat(a).concat(i).concat(r.toString(e)).concat(o)}function Yn(r,e){if(typeof e=="function")return e(r);if(r===1/0)return"Infinity";if(r===-1/0)return"-Infinity";if(isNaN(r))return"NaN";var{notation:t,precision:n,wordSize:i}=qi(e);switch(t){case"fixed":return Xi(r,n);case"exponential":return Cu(r,n);case"engineering":return Td(r,n);case"bin":return Wi(r,2,i);case"oct":return Wi(r,8,i);case"hex":return Wi(r,16,i);case"auto":return Cd(r,n,e).replace(/((\.\d*?)(0+))($|e)/,function(){var o=arguments[2],a=arguments[4];return o!=="."?o+a:a});default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function qi(r){var e="auto",t,n;if(r!==void 0)if(nt(r))t=r;else if(it(r))t=r.toNumber();else if(wn(r))r.precision!==void 0&&(t=_u(r.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),r.wordSize!==void 0&&(n=_u(r.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),r.notation&&(e=r.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:t,wordSize:n}}function Cn(r){var e=String(r).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+r);var t=e[1],n=e[2],i=parseFloat(e[4]||"0"),o=n.indexOf(".");i+=o!==-1?o-1:n.length-1;var a=n.replace(".","").replace(/^0*/,function(c){return i-=c.length,""}).replace(/0*$/,"").split("").map(function(c){return parseInt(c)});return a.length===0&&(a.push(0),i++),{sign:t,coefficients:a,exponent:i}}function Td(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=Cn(r),n=Kr(t,e),i=n.exponent,o=n.coefficients,a=i%3===0?i:i<0?i-3-i%3:i-i%3;if(nt(e))for(;e>o.length||i-a+1>o.length;)o.push(0);else for(var c=Math.abs(i-a)-(o.length-1),l=0;l<c;l++)o.push(0);for(var s=Math.abs(i-a),u=1;s>0;)u++,s--;var h=o.slice(u).join(""),f=nt(e)&&h.length||h.match(/[1-9]/)?"."+h:"",d=o.slice(0,u).join("")+f+"e"+(i>=0?"+":"")+a.toString();return n.sign+d}function Xi(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=Cn(r),n=typeof e=="number"?Kr(t,t.exponent+1+e):t,i=n.coefficients,o=n.exponent+1,a=o+(e||0);return i.length<a&&(i=i.concat(Tn(a-i.length))),o<0&&(i=Tn(-o+1).concat(i),o=1),o<i.length&&i.splice(o,0,o===0?"0.":"."),n.sign+i.join("")}function Cu(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=Cn(r),n=e?Kr(t,e):t,i=n.coefficients,o=n.exponent;i.length<e&&(i=i.concat(Tn(e-i.length)));var a=i.shift();return n.sign+a+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function Cd(r,e,t){if(isNaN(r)||!isFinite(r))return String(r);var n=xu(t?.lowerExp,-3),i=xu(t?.upperExp,5),o=Cn(r),a=e?Kr(o,e):o;if(a.exponent<n||a.exponent>=i)return Cu(r,e);var c=a.coefficients,l=a.exponent;c.length<e&&(c=c.concat(Tn(e-c.length))),c=c.concat(Tn(l-c.length+1+(c.length<e?e-c.length:0))),c=Tn(-l).concat(c);var s=l>0?l:0;return s<c.length-1&&c.splice(s+1,0,"."),a.sign+c.join("")}function Kr(r,e){for(var t={sign:r.sign,coefficients:r.coefficients,exponent:r.exponent},n=t.coefficients;e<=0;)n.unshift(0),t.exponent++,e++;if(n.length>e){var i=n.splice(e,n.length-e);if(i[0]>=5){var o=e-1;for(n[o]++;n[o]===10;)n.pop(),o===0&&(n.unshift(0),t.exponent++,o++),o--,n[o]++}}return t}function Tn(r){for(var e=[],t=0;t<r;t++)e.push(0);return e}function Au(r){return r.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var MM=Number.EPSILON||2220446049250313e-31;function pe(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-8,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(t<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return isNaN(r)||isNaN(e)?!1:!isFinite(r)||!isFinite(e)?r===e:r===e?!0:Math.abs(r-e)<=Math.max(t*Math.max(Math.abs(r),Math.abs(e)),n)}function _u(r,e){if(nt(r))return r;if(it(r))return r.toNumber();e()}function xu(r,e){return nt(r)?r:it(r)?r.toNumber():e}var Pu=function(){return Pu=ji.default.create,ji.default},Ad=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],Yi=N("typed",Ad,function(e){var{BigNumber:t,Complex:n,DenseMatrix:i,Fraction:o}=e,a=Pu();return a.clear(),a.addTypes([{name:"number",test:nt},{name:"Complex",test:zi},{name:"BigNumber",test:it},{name:"bigint",test:Ga},{name:"Fraction",test:Gi},{name:"Unit",test:$r},{name:"identifier",test:c=>jt&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uD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uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\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DD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCA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uDC00-\uDFAF])*$/.test(c)},{name:"string",test:jt},{name:"Chain",test:gu},{name:"Array",test:yt},{name:"Matrix",test:ot},{name:"DenseMatrix",test:ka},{name:"SparseMatrix",test:Va},{name:"Range",test:Ha},{name:"Index",test:Mn},{name:"boolean",test:Wa},{name:"ResultSet",test:qa},{name:"Help",test:Xa},{name:"function",test:ja},{name:"Date",test:Ya},{name:"RegExp",test:$a},{name:"null",test:Ka},{name:"undefined",test:Ja},{name:"AccessorNode",test:Qa},{name:"ArrayNode",test:tu},{name:"AssignmentNode",test:eu},{name:"BlockNode",test:nu},{name:"ConditionalNode",test:ru},{name:"ConstantNode",test:iu},{name:"FunctionNode",test:su},{name:"FunctionAssignmentNode",test:ou},{name:"IndexNode",test:au},{name:"Node",test:uu},{name:"ObjectNode",test:lu},{name:"OperatorNode",test:cu},{name:"ParenthesisNode",test:hu},{name:"RangeNode",test:pu},{name:"RelationalNode",test:fu},{name:"SymbolNode",test:du},{name:"Map",test:Za},{name:"Object",test:wn}]),a.addConversions([{from:"number",to:"BigNumber",convert:function(l){if(t||Jr(l),Au(l)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+l+"). Use function bignumber(x) to convert to BigNumber.");return new t(l)}},{from:"number",to:"Complex",convert:function(l){return n||Qr(l),new n(l,0)}},{from:"BigNumber",to:"Complex",convert:function(l){return n||Qr(l),new n(l.toNumber(),0)}},{from:"bigint",to:"number",convert:function(l){if(l>Number.MAX_SAFE_INTEGER)throw new TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: "+l+")");return Number(l)}},{from:"bigint",to:"BigNumber",convert:function(l){return t||Jr(l),new t(l.toString())}},{from:"bigint",to:"Fraction",convert:function(l){return o||ti(l),new o(l.toString())}},{from:"Fraction",to:"BigNumber",convert:function(l){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(l){return n||Qr(l),new n(l.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(l){o||ti(l);var s=new o(l);if(s.valueOf()!==l)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+l+"). Use function fraction(x) to convert to Fraction.");return s}},{from:"string",to:"number",convert:function(l){var s=Number(l);if(isNaN(s))throw new Error('Cannot convert "'+l+'" to a number');return s}},{from:"string",to:"BigNumber",convert:function(l){t||Jr(l);try{return new t(l)}catch{throw new Error('Cannot convert "'+l+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(l){try{return BigInt(l)}catch{throw new Error('Cannot convert "'+l+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(l){o||ti(l);try{return new o(l)}catch{throw new Error('Cannot convert "'+l+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(l){n||Qr(l);try{return new n(l)}catch{throw new Error('Cannot convert "'+l+'" to Complex')}}},{from:"boolean",to:"number",convert:function(l){return+l}},{from:"boolean",to:"BigNumber",convert:function(l){return t||Jr(l),new t(+l)}},{from:"boolean",to:"bigint",convert:function(l){return BigInt(+l)}},{from:"boolean",to:"Fraction",convert:function(l){return o||ti(l),new o(+l)}},{from:"boolean",to:"string",convert:function(l){return String(l)}},{from:"Array",to:"Matrix",convert:function(l){return i||Pd(),new i(l)}},{from:"Matrix",to:"Array",convert:function(l){return l.valueOf()}}]),a.onMismatch=(c,l,s)=>{var u=a.createError(c,l,s);if(["wrongType","mismatch"].includes(u.data.category)&&l.length===1&&Fe(l[0])&&s.some(f=>!f.params.includes(","))){var h=new TypeError("Function '".concat(c,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(c,")'."));throw h.data=u.data,h}throw u},a.onMismatch=(c,l,s)=>{var u=a.createError(c,l,s);if(["wrongType","mismatch"].includes(u.data.category)&&l.length===1&&Fe(l[0])&&s.some(f=>!f.params.includes(","))){var h=new TypeError("Function '".concat(c,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(c,")'."));throw h.data=u.data,h}throw u},a});function Jr(r){throw new Error("Cannot convert value ".concat(r," into a BigNumber: no class 'BigNumber' provided"))}function Qr(r){throw new Error("Cannot convert value ".concat(r," into a Complex number: no class 'Complex' provided"))}function Pd(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function ti(r){throw new Error("Cannot convert value ".concat(r," into a Fraction, no class 'Fraction' provided."))}var An=9e15,Ke=1e9,$i="0123456789abcdef",ni="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",ri="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Zi={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-An,maxE:An,crypto:!1},Nu,Ue,K=!0,oi="[DecimalError] ",Ze=oi+"Invalid argument: ",Lu=oi+"Precision limit exceeded",Ou=oi+"crypto unavailable",Fu="[object Decimal]",Wt=Math.floor,Pt=Math.pow,Dd=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Id=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Rd=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Uu=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ve=1e7,Z=7,Nd=9007199254740991,Ld=ni.length-1,Ki=ri.length-1,F={toStringTag:Fu};F.absoluteValue=F.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),$(r)};F.ceil=function(){return $(new this.constructor(this),this.e+1,2)};F.clampedTo=F.clamp=function(r,e){var t,n=this,i=n.constructor;if(r=new i(r),e=new i(e),!r.s||!e.s)return new i(NaN);if(r.gt(e))throw Error(Ze+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new i(n)};F.comparedTo=F.cmp=function(r){var e,t,n,i,o=this,a=o.d,c=(r=new o.constructor(r)).d,l=o.s,s=r.s;if(!a||!c)return!l||!s?NaN:l!==s?l:a===c?0:!a^l<0?1:-1;if(!a[0]||!c[0])return a[0]?l:c[0]?-s:0;if(l!==s)return l;if(o.e!==r.e)return o.e>r.e^l<0?1:-1;for(n=a.length,i=c.length,e=0,t=n<i?n:i;e<t;++e)if(a[e]!==c[e])return a[e]>c[e]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1};F.cosine=F.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+Z,n.rounding=1,t=Od(n,Vu(n,t)),n.precision=r,n.rounding=e,$(Ue==2||Ue==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};F.cubeRoot=F.cbrt=function(){var r,e,t,n,i,o,a,c,l,s,u=this,h=u.constructor;if(!u.isFinite()||u.isZero())return new h(u);for(K=!1,o=u.s*Pt(u.s*u,1/3),!o||Math.abs(o)==1/0?(t=Bt(u.d),r=u.e,(o=(r-t.length+1)%3)&&(t+=o==1||o==-2?"0":"00"),o=Pt(t,1/3),r=Wt((r+1)/3)-(r%3==(r<0?-1:2)),o==1/0?t="5e"+r:(t=o.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new h(t),n.s=u.s):n=new h(o.toString()),a=(r=h.precision)+3;;)if(c=n,l=c.times(c).times(c),s=l.plus(u),n=dt(s.plus(u).times(c),s.plus(l),a+2,1),Bt(c.d).slice(0,a)===(t=Bt(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!i&&t=="4999"){if(!i&&($(c,r+1,0),c.times(c).times(c).eq(u))){n=c;break}a+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&($(n,r+1,1),e=!n.times(n).times(n).eq(u));break}return K=!0,$(n,r,h.rounding,e)};F.decimalPlaces=F.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-Wt(this.e/Z))*Z,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};F.dividedBy=F.div=function(r){return dt(this,new this.constructor(r))};F.dividedToIntegerBy=F.divToInt=function(r){var e=this,t=e.constructor;return $(dt(e,new t(r),0,1,1),t.precision,t.rounding)};F.equals=F.eq=function(r){return this.cmp(r)===0};F.floor=function(){return $(new this.constructor(this),this.e+1,3)};F.greaterThan=F.gt=function(r){return this.cmp(r)>0};F.greaterThanOrEqualTo=F.gte=function(r){var e=this.cmp(r);return e==1||e===0};F.hyperbolicCosine=F.cosh=function(){var r,e,t,n,i,o=this,a=o.constructor,c=new a(1);if(!o.isFinite())return new a(o.s?1/0:NaN);if(o.isZero())return c;t=a.precision,n=a.rounding,a.precision=t+Math.max(o.e,o.sd())+4,a.rounding=1,i=o.d.length,i<32?(r=Math.ceil(i/3),e=(1/ai(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),o=Pn(a,1,o.times(e),new a(1),!0);for(var l,s=r,u=new a(8);s--;)l=o.times(o),o=c.minus(l.times(u.minus(l.times(u))));return $(o,a.precision=t,a.rounding=n,!0)};F.hyperbolicSine=F.sinh=function(){var r,e,t,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,t=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,n=i.d.length,n<3)i=Pn(o,2,i,i,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,i=i.times(1/ai(5,r)),i=Pn(o,2,i,i,!0);for(var a,c=new o(5),l=new o(16),s=new o(20);r--;)a=i.times(i),i=i.times(c.plus(a.times(l.times(a).plus(s))))}return o.precision=e,o.rounding=t,$(i,e,t,!0)};F.hyperbolicTangent=F.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,dt(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};F.inverseCosine=F.acos=function(){var r,e=this,t=e.constructor,n=e.abs().cmp(1),i=t.precision,o=t.rounding;return n!==-1?n===0?e.isNeg()?ye(t,i,o):new t(0):new t(NaN):e.isZero()?ye(t,i+4,o).times(.5):(t.precision=i+6,t.rounding=1,e=e.asin(),r=ye(t,i+4,o).times(.5),t.precision=i,t.rounding=o,r.minus(e))};F.inverseHyperbolicCosine=F.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,K=!1,t=t.times(t).minus(1).sqrt().plus(t),K=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};F.inverseHyperbolicSine=F.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,K=!1,t=t.times(t).plus(1).sqrt().plus(t),K=!0,n.precision=r,n.rounding=e,t.ln())};F.inverseHyperbolicTangent=F.atanh=function(){var r,e,t,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(r=o.precision,e=o.rounding,n=i.sd(),Math.max(n,r)<2*-i.e-1?$(new o(i),r,e,!0):(o.precision=t=n-i.e,i=dt(i.plus(1),new o(1).minus(i),t+r,1),o.precision=r+4,o.rounding=1,i=i.ln(),o.precision=r,o.rounding=e,i.times(.5))):new o(NaN)};F.inverseSine=F.asin=function(){var r,e,t,n,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),t=o.precision,n=o.rounding,e!==-1?e===0?(r=ye(o,t+4,n).times(.5),r.s=i.s,r):new o(NaN):(o.precision=t+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=t,o.rounding=n,i.times(2)))};F.inverseTangent=F.atan=function(){var r,e,t,n,i,o,a,c,l,s=this,u=s.constructor,h=u.precision,f=u.rounding;if(s.isFinite()){if(s.isZero())return new u(s);if(s.abs().eq(1)&&h+4<=Ki)return a=ye(u,h+4,f).times(.25),a.s=s.s,a}else{if(!s.s)return new u(NaN);if(h+4<=Ki)return a=ye(u,h+4,f).times(.5),a.s=s.s,a}for(u.precision=c=h+10,u.rounding=1,t=Math.min(28,c/Z+2|0),r=t;r;--r)s=s.div(s.times(s).plus(1).sqrt().plus(1));for(K=!1,e=Math.ceil(c/Z),n=1,l=s.times(s),a=new u(s),i=s;r!==-1;)if(i=i.times(l),o=a.minus(i.div(n+=2)),i=i.times(l),a=o.plus(i.div(n+=2)),a.d[e]!==void 0)for(r=e;a.d[r]===o.d[r]&&r--;);return t&&(a=a.times(2<<t-1)),K=!0,$(a,u.precision=h,u.rounding=f,!0)};F.isFinite=function(){return!!this.d};F.isInteger=F.isInt=function(){return!!this.d&&Wt(this.e/Z)>this.d.length-2};F.isNaN=function(){return!this.s};F.isNegative=F.isNeg=function(){return this.s<0};F.isPositive=F.isPos=function(){return this.s>0};F.isZero=function(){return!!this.d&&this.d[0]===0};F.lessThan=F.lt=function(r){return this.cmp(r)<0};F.lessThanOrEqualTo=F.lte=function(r){return this.cmp(r)<1};F.logarithm=F.log=function(r){var e,t,n,i,o,a,c,l,s=this,u=s.constructor,h=u.precision,f=u.rounding,d=5;if(r==null)r=new u(10),e=!0;else{if(r=new u(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new u(NaN);e=r.eq(10)}if(t=s.d,s.s<0||!t||!t[0]||s.eq(1))return new u(t&&!t[0]?-1/0:s.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)o=!0;else{for(i=t[0];i%10===0;)i/=10;o=i!==1}if(K=!1,c=h+d,a=$e(s,c),n=e?ii(u,c+10):$e(r,c),l=dt(a,n,c,1),$n(l.d,i=h,f))do if(c+=10,a=$e(s,c),n=e?ii(u,c+10):$e(r,c),l=dt(a,n,c,1),!o){+Bt(l.d).slice(i+1,i+15)+1==1e14&&(l=$(l,h+1,0));break}while($n(l.d,i+=10,f));return K=!0,$(l,h,f)};F.minus=F.sub=function(r){var e,t,n,i,o,a,c,l,s,u,h,f,d=this,g=d.constructor;if(r=new g(r),!d.d||!r.d)return!d.s||!r.s?r=new g(NaN):d.d?r.s=-r.s:r=new g(r.d||d.s!==r.s?d:NaN),r;if(d.s!=r.s)return r.s=-r.s,d.plus(r);if(s=d.d,f=r.d,c=g.precision,l=g.rounding,!s[0]||!f[0]){if(f[0])r.s=-r.s;else if(s[0])r=new g(d);else return new g(l===3?-0:0);return K?$(r,c,l):r}if(t=Wt(r.e/Z),u=Wt(d.e/Z),s=s.slice(),o=u-t,o){for(h=o<0,h?(e=s,o=-o,a=f.length):(e=f,t=u,a=s.length),n=Math.max(Math.ceil(c/Z),a)+2,o>n&&(o=n,e.length=1),e.reverse(),n=o;n--;)e.push(0);e.reverse()}else{for(n=s.length,a=f.length,h=n<a,h&&(a=n),n=0;n<a;n++)if(s[n]!=f[n]){h=s[n]<f[n];break}o=0}for(h&&(e=s,s=f,f=e,r.s=-r.s),a=s.length,n=f.length-a;n>0;--n)s[a++]=0;for(n=f.length;n>o;){if(s[--n]<f[n]){for(i=n;i&&s[--i]===0;)s[i]=ve-1;--s[i],s[n]+=ve}s[n]-=f[n]}for(;s[--a]===0;)s.pop();for(;s[0]===0;s.shift())--t;return s[0]?(r.d=s,r.e=si(s,t),K?$(r,c,l):r):new g(l===3?-0:0)};F.modulo=F.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?$(new n(t),n.precision,n.rounding):(K=!1,n.modulo==9?(e=dt(t,r.abs(),0,3,1),e.s*=r.s):e=dt(t,r,0,n.modulo,1),e=e.times(r),K=!0,t.minus(e))};F.naturalExponential=F.exp=function(){return Ji(this)};F.naturalLogarithm=F.ln=function(){return $e(this)};F.negated=F.neg=function(){var r=new this.constructor(this);return r.s=-r.s,$(r)};F.plus=F.add=function(r){var e,t,n,i,o,a,c,l,s,u,h=this,f=h.constructor;if(r=new f(r),!h.d||!r.d)return!h.s||!r.s?r=new f(NaN):h.d||(r=new f(r.d||h.s===r.s?h:NaN)),r;if(h.s!=r.s)return r.s=-r.s,h.minus(r);if(s=h.d,u=r.d,c=f.precision,l=f.rounding,!s[0]||!u[0])return u[0]||(r=new f(h)),K?$(r,c,l):r;if(o=Wt(h.e/Z),n=Wt(r.e/Z),s=s.slice(),i=o-n,i){for(i<0?(t=s,i=-i,a=u.length):(t=u,n=o,a=s.length),o=Math.ceil(c/Z),a=o>a?o+1:a+1,i>a&&(i=a,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(a=s.length,i=u.length,a-i<0&&(i=a,t=u,u=s,s=t),e=0;i;)e=(s[--i]=s[i]+u[i]+e)/ve|0,s[i]%=ve;for(e&&(s.unshift(e),++n),a=s.length;s[--a]==0;)s.pop();return r.d=s,r.e=si(s,n),K?$(r,c,l):r};F.precision=F.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Ze+r);return t.d?(e=Bu(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};F.round=function(){var r=this,e=r.constructor;return $(new e(r),r.e+1,e.rounding)};F.sine=F.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+Z,n.rounding=1,t=Ud(n,Vu(n,t)),n.precision=r,n.rounding=e,$(Ue>2?t.neg():t,r,e,!0)):new n(NaN)};F.squareRoot=F.sqrt=function(){var r,e,t,n,i,o,a=this,c=a.d,l=a.e,s=a.s,u=a.constructor;if(s!==1||!c||!c[0])return new u(!s||s<0&&(!c||c[0])?NaN:c?a:1/0);for(K=!1,s=Math.sqrt(+a),s==0||s==1/0?(e=Bt(c),(e.length+l)%2==0&&(e+="0"),s=Math.sqrt(e),l=Wt((l+1)/2)-(l<0||l%2),s==1/0?e="5e"+l:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+l),n=new u(e)):n=new u(s.toString()),t=(l=u.precision)+3;;)if(o=n,n=o.plus(dt(a,o,t+2,1)).times(.5),Bt(o.d).slice(0,t)===(e=Bt(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&($(o,l+1,0),o.times(o).eq(a))){n=o;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&($(n,l+1,1),r=!n.times(n).eq(a));break}return K=!0,$(n,l,u.rounding,r)};F.tangent=F.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=dt(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,$(Ue==2||Ue==4?t.neg():t,r,e,!0)):new n(NaN)};F.times=F.mul=function(r){var e,t,n,i,o,a,c,l,s,u=this,h=u.constructor,f=u.d,d=(r=new h(r)).d;if(r.s*=u.s,!f||!f[0]||!d||!d[0])return new h(!r.s||f&&!f[0]&&!d||d&&!d[0]&&!f?NaN:!f||!d?r.s/0:r.s*0);for(t=Wt(u.e/Z)+Wt(r.e/Z),l=f.length,s=d.length,l<s&&(o=f,f=d,d=o,a=l,l=s,s=a),o=[],a=l+s,n=a;n--;)o.push(0);for(n=s;--n>=0;){for(e=0,i=l+n;i>n;)c=o[i]+d[n]*f[i-n-1]+e,o[i--]=c%ve|0,e=c/ve|0;o[i]=(o[i]+e)%ve|0}for(;!o[--a];)o.pop();return e?++t:o.shift(),r.d=o,r.e=si(o,t),K?$(r,h.precision,h.rounding):r};F.toBinary=function(r,e){return to(this,2,r,e)};F.toDecimalPlaces=F.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Qt(r,0,Ke),e===void 0?e=n.rounding:Qt(e,0,8),$(t,r+t.e+1,e))};F.toExponential=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Pe(n,!0):(Qt(r,0,Ke),e===void 0?e=i.rounding:Qt(e,0,8),n=$(new i(n),r+1,e),t=Pe(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};F.toFixed=function(r,e){var t,n,i=this,o=i.constructor;return r===void 0?t=Pe(i):(Qt(r,0,Ke),e===void 0?e=o.rounding:Qt(e,0,8),n=$(new o(i),r+i.e+1,e),t=Pe(n,!1,r+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};F.toFraction=function(r){var e,t,n,i,o,a,c,l,s,u,h,f,d=this,g=d.d,p=d.constructor;if(!g)return new p(d);if(s=t=new p(1),n=l=new p(0),e=new p(n),o=e.e=Bu(g)-d.e-1,a=o%Z,e.d[0]=Pt(10,a<0?Z+a:a),r==null)r=o>0?e:s;else{if(c=new p(r),!c.isInt()||c.lt(s))throw Error(Ze+c);r=c.gt(e)?o>0?e:s:c}for(K=!1,c=new p(Bt(g)),u=p.precision,p.precision=o=g.length*Z*2;h=dt(c,e,0,1,1),i=t.plus(h.times(n)),i.cmp(r)!=1;)t=n,n=i,i=s,s=l.plus(h.times(i)),l=i,i=e,e=c.minus(h.times(i)),c=i;return i=dt(r.minus(t),n,0,1,1),l=l.plus(i.times(s)),t=t.plus(i.times(n)),l.s=s.s=d.s,f=dt(s,n,o,1).minus(d).abs().cmp(dt(l,t,o,1).minus(d).abs())<1?[s,n]:[l,t],p.precision=u,K=!0,f};F.toHexadecimal=F.toHex=function(r,e){return to(this,16,r,e)};F.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:Qt(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(K=!1,t=dt(t,r,0,e,1).times(r),K=!0,$(t)):(r.s=t.s,t=r),t};F.toNumber=function(){return+this};F.toOctal=function(r,e){return to(this,8,r,e)};F.toPower=F.pow=function(r){var e,t,n,i,o,a,c=this,l=c.constructor,s=+(r=new l(r));if(!c.d||!r.d||!c.d[0]||!r.d[0])return new l(Pt(+c,s));if(c=new l(c),c.eq(1))return c;if(n=l.precision,o=l.rounding,r.eq(1))return $(c,n,o);if(e=Wt(r.e/Z),e>=r.d.length-1&&(t=s<0?-s:s)<=Nd)return i=zu(l,c,t,n),r.s<0?new l(1).div(i):$(i,n,o);if(a=c.s,a<0){if(e<r.d.length-1)return new l(NaN);if(r.d[e]&1||(a=1),c.e==0&&c.d[0]==1&&c.d.length==1)return c.s=a,c}return t=Pt(+c,s),e=t==0||!isFinite(t)?Wt(s*(Math.log("0."+Bt(c.d))/Math.LN10+c.e+1)):new l(t+"").e,e>l.maxE+1||e<l.minE-1?new l(e>0?a/0:0):(K=!1,l.rounding=c.s=1,t=Math.min(12,(e+"").length),i=Ji(r.times($e(c,n+t)),n),i.d&&(i=$(i,n+5,1),$n(i.d,n,o)&&(e=n+10,i=$(Ji(r.times($e(c,e+t)),e),e+5,1),+Bt(i.d).slice(n+1,n+15)+1==1e14&&(i=$(i,n+1,0)))),i.s=a,K=!0,l.rounding=o,$(i,n,o))};F.toPrecision=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Pe(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Qt(r,1,Ke),e===void 0?e=i.rounding:Qt(e,0,8),n=$(new i(n),r,e),t=Pe(n,r<=n.e||n.e<=i.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};F.toSignificantDigits=F.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Qt(r,1,Ke),e===void 0?e=n.rounding:Qt(e,0,8)),$(new n(t),r,e)};F.toString=function(){var r=this,e=r.constructor,t=Pe(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};F.truncated=F.trunc=function(){return $(new this.constructor(this),this.e+1,1)};F.valueOf=F.toJSON=function(){var r=this,e=r.constructor,t=Pe(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function Bt(r){var e,t,n,i=r.length-1,o="",a=r[0];if(i>0){for(o+=a,e=1;e<i;e++)n=r[e]+"",t=Z-n.length,t&&(o+=Ye(t)),o+=n;a=r[e],n=a+"",t=Z-n.length,t&&(o+=Ye(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return o+a}function Qt(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Ze+r)}function $n(r,e,t,n){var i,o,a,c;for(o=r[0];o>=10;o/=10)--e;return--e<0?(e+=Z,i=0):(i=Math.ceil((e+1)/Z),e%=Z),o=Pt(10,Z-e),c=r[i]%o|0,n==null?e<3?(e==0?c=c/100|0:e==1&&(c=c/10|0),a=t<4&&c==99999||t>3&&c==49999||c==5e4||c==0):a=(t<4&&c+1==o||t>3&&c+1==o/2)&&(r[i+1]/o/100|0)==Pt(10,e-2)-1||(c==o/2||c==0)&&(r[i+1]/o/100|0)==0:e<4?(e==0?c=c/1e3|0:e==1?c=c/100|0:e==2&&(c=c/10|0),a=(n||t<4)&&c==9999||!n&&t>3&&c==4999):a=((n||t<4)&&c+1==o||!n&&t>3&&c+1==o/2)&&(r[i+1]/o/1e3|0)==Pt(10,e-3)-1,a}function ei(r,e,t){for(var n,i=[0],o,a=0,c=r.length;a<c;){for(o=i.length;o--;)i[o]*=e;for(i[0]+=$i.indexOf(r.charAt(a++)),n=0;n<i.length;n++)i[n]>t-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/t|0,i[n]%=t)}return i.reverse()}function Od(r,e){var t,n,i;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),i=(1/ai(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),r.precision+=t,e=Pn(r,1,e.times(i),new r(1));for(var o=t;o--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return r.precision-=t,e}var dt=function(){function r(n,i,o){var a,c=0,l=n.length;for(n=n.slice();l--;)a=n[l]*i+c,n[l]=a%o|0,c=a/o|0;return c&&n.unshift(c),n}function e(n,i,o,a){var c,l;if(o!=a)l=o>a?1:-1;else for(c=l=0;c<o;c++)if(n[c]!=i[c]){l=n[c]>i[c]?1:-1;break}return l}function t(n,i,o,a){for(var c=0;o--;)n[o]-=c,c=n[o]<i[o]?1:0,n[o]=c*a+n[o]-i[o];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,o,a,c,l){var s,u,h,f,d,g,p,m,v,b,y,S,x,_,M,w,C,P,D,R,W=n.constructor,G=n.s==i.s?1:-1,k=n.d,L=i.d;if(!k||!k[0]||!L||!L[0])return new W(!n.s||!i.s||(k?L&&k[0]==L[0]:!L)?NaN:k&&k[0]==0||!L?G*0:G/0);for(l?(d=1,u=n.e-i.e):(l=ve,d=Z,u=Wt(n.e/d)-Wt(i.e/d)),D=L.length,C=k.length,v=new W(G),b=v.d=[],h=0;L[h]==(k[h]||0);h++);if(L[h]>(k[h]||0)&&u--,o==null?(_=o=W.precision,a=W.rounding):c?_=o+(n.e-i.e)+1:_=o,_<0)b.push(1),g=!0;else{if(_=_/d+2|0,h=0,D==1){for(f=0,L=L[0],_++;(h<C||f)&&_--;h++)M=f*l+(k[h]||0),b[h]=M/L|0,f=M%L|0;g=f||h<C}else{for(f=l/(L[0]+1)|0,f>1&&(L=r(L,f,l),k=r(k,f,l),D=L.length,C=k.length),w=D,y=k.slice(0,D),S=y.length;S<D;)y[S++]=0;R=L.slice(),R.unshift(0),P=L[0],L[1]>=l/2&&++P;do f=0,s=e(L,y,D,S),s<0?(x=y[0],D!=S&&(x=x*l+(y[1]||0)),f=x/P|0,f>1?(f>=l&&(f=l-1),p=r(L,f,l),m=p.length,S=y.length,s=e(p,y,m,S),s==1&&(f--,t(p,D<m?R:L,m,l))):(f==0&&(s=f=1),p=L.slice()),m=p.length,m<S&&p.unshift(0),t(y,p,S,l),s==-1&&(S=y.length,s=e(L,y,D,S),s<1&&(f++,t(y,D<S?R:L,S,l))),S=y.length):s===0&&(f++,y=[0]),b[h++]=f,s&&y[0]?y[S++]=k[w]||0:(y=[k[w]],S=1);while((w++<C||y[0]!==void 0)&&_--);g=y[0]!==void 0}b[0]||b.shift()}if(d==1)v.e=u,Nu=g;else{for(h=1,f=b[0];f>=10;f/=10)h++;v.e=h+u*d-1,$(v,c?o+v.e+1:o,a,g)}return v}}();function $(r,e,t,n){var i,o,a,c,l,s,u,h,f,d=r.constructor;t:if(e!=null){if(h=r.d,!h)return r;for(i=1,c=h[0];c>=10;c/=10)i++;if(o=e-i,o<0)o+=Z,a=e,u=h[f=0],l=u/Pt(10,i-a-1)%10|0;else if(f=Math.ceil((o+1)/Z),c=h.length,f>=c)if(n){for(;c++<=f;)h.push(0);u=l=0,i=1,o%=Z,a=o-Z+1}else break t;else{for(u=c=h[f],i=1;c>=10;c/=10)i++;o%=Z,a=o-Z+i,l=a<0?0:u/Pt(10,i-a-1)%10|0}if(n=n||e<0||h[f+1]!==void 0||(a<0?u:u%Pt(10,i-a-1)),s=t<4?(l||n)&&(t==0||t==(r.s<0?3:2)):l>5||l==5&&(t==4||n||t==6&&(o>0?a>0?u/Pt(10,i-a):0:h[f-1])%10&1||t==(r.s<0?8:7)),e<1||!h[0])return h.length=0,s?(e-=r.e+1,h[0]=Pt(10,(Z-e%Z)%Z),r.e=-e||0):h[0]=r.e=0,r;if(o==0?(h.length=f,c=1,f--):(h.length=f+1,c=Pt(10,Z-o),h[f]=a>0?(u/Pt(10,i-a)%Pt(10,a)|0)*c:0),s)for(;;)if(f==0){for(o=1,a=h[0];a>=10;a/=10)o++;for(a=h[0]+=c,c=1;a>=10;a/=10)c++;o!=c&&(r.e++,h[0]==ve&&(h[0]=1));break}else{if(h[f]+=c,h[f]!=ve)break;h[f--]=0,c=1}for(o=h.length;h[--o]===0;)h.pop()}return K&&(r.e>d.maxE?(r.d=null,r.e=NaN):r.e<d.minE&&(r.e=0,r.d=[0])),r}function Pe(r,e,t){if(!r.isFinite())return ku(r);var n,i=r.e,o=Bt(r.d),a=o.length;return e?(t&&(n=t-a)>0?o=o.charAt(0)+"."+o.slice(1)+Ye(n):a>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(r.e<0?"e":"e+")+r.e):i<0?(o="0."+Ye(-i-1)+o,t&&(n=t-a)>0&&(o+=Ye(n))):i>=a?(o+=Ye(i+1-a),t&&(n=t-i-1)>0&&(o=o+"."+Ye(n))):((n=i+1)<a&&(o=o.slice(0,n)+"."+o.slice(n)),t&&(n=t-a)>0&&(i+1===a&&(o+="."),o+=Ye(n))),o}function si(r,e){var t=r[0];for(e*=Z;t>=10;t/=10)e++;return e}function ii(r,e,t){if(e>Ld)throw K=!0,t&&(r.precision=t),Error(Lu);return $(new r(ni),e,1,!0)}function ye(r,e,t){if(e>Ki)throw Error(Lu);return $(new r(ri),e,t,!0)}function Bu(r){var e=r.length-1,t=e*Z+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}function Ye(r){for(var e="";r--;)e+="0";return e}function zu(r,e,t,n){var i,o=new r(1),a=Math.ceil(n/Z+4);for(K=!1;;){if(t%2&&(o=o.times(e),Iu(o.d,a)&&(i=!0)),t=Wt(t/2),t===0){t=o.d.length-1,i&&o.d[t]===0&&++o.d[t];break}e=e.times(e),Iu(e.d,a)}return K=!0,o}function Du(r){return r.d[r.d.length-1]&1}function Gu(r,e,t){for(var n,i=new r(e[0]),o=0;++o<e.length;)if(n=new r(e[o]),n.s)i[t](n)&&(i=n);else{i=n;break}return i}function Ji(r,e){var t,n,i,o,a,c,l,s=0,u=0,h=0,f=r.constructor,d=f.rounding,g=f.precision;if(!r.d||!r.d[0]||r.e>17)return new f(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(K=!1,l=g):l=e,c=new f(.03125);r.e>-2;)r=r.times(c),h+=5;for(n=Math.log(Pt(2,h))/Math.LN10*2+5|0,l+=n,t=o=a=new f(1),f.precision=l;;){if(o=$(o.times(r),l,1),t=t.times(++u),c=a.plus(dt(o,t,l,1)),Bt(c.d).slice(0,l)===Bt(a.d).slice(0,l)){for(i=h;i--;)a=$(a.times(a),l,1);if(e==null)if(s<3&&$n(a.d,l-n,d,s))f.precision=l+=10,t=o=c=new f(1),u=0,s++;else return $(a,f.precision=g,d,K=!0);else return f.precision=g,a}a=c}}function $e(r,e){var t,n,i,o,a,c,l,s,u,h,f,d=1,g=10,p=r,m=p.d,v=p.constructor,b=v.rounding,y=v.precision;if(p.s<0||!m||!m[0]||!p.e&&m[0]==1&&m.length==1)return new v(m&&!m[0]?-1/0:p.s!=1?NaN:m?0:p);if(e==null?(K=!1,u=y):u=e,v.precision=u+=g,t=Bt(m),n=t.charAt(0),Math.abs(o=p.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)p=p.times(r),t=Bt(p.d),n=t.charAt(0),d++;o=p.e,n>1?(p=new v("0."+t),o++):p=new v(n+"."+t.slice(1))}else return s=ii(v,u+2,y).times(o+""),p=$e(new v(n+"."+t.slice(1)),u-g).plus(s),v.precision=y,e==null?$(p,y,b,K=!0):p;for(h=p,l=a=p=dt(p.minus(1),p.plus(1),u,1),f=$(p.times(p),u,1),i=3;;){if(a=$(a.times(f),u,1),s=l.plus(dt(a,new v(i),u,1)),Bt(s.d).slice(0,u)===Bt(l.d).slice(0,u))if(l=l.times(2),o!==0&&(l=l.plus(ii(v,u+2,y).times(o+""))),l=dt(l,new v(d),u,1),e==null)if($n(l.d,u-g,b,c))v.precision=u+=g,s=a=p=dt(h.minus(1),h.plus(1),u,1),f=$(p.times(p),u,1),i=c=1;else return $(l,v.precision=y,b,K=!0);else return v.precision=y,l;l=s,i+=2}}function ku(r){return String(r.s*r.s/0)}function Qi(r,e){var t,n,i;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%Z,t<0&&(n+=Z),n<i){for(n&&r.d.push(+e.slice(0,n)),i-=Z;n<i;)r.d.push(+e.slice(n,n+=Z));e=e.slice(n),n=Z-e.length}else n-=i;for(;n--;)e+="0";r.d.push(+e),K&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}function Fd(r,e){var t,n,i,o,a,c,l,s,u;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Uu.test(e))return Qi(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(Id.test(e))t=16,e=e.toLowerCase();else if(Dd.test(e))t=2;else if(Rd.test(e))t=8;else throw Error(Ze+e);for(o=e.search(/p/i),o>0?(l=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),o=e.indexOf("."),a=o>=0,n=r.constructor,a&&(e=e.replace(".",""),c=e.length,o=c-o,i=zu(n,new n(t),o,o*2)),s=ei(e,t,ve),u=s.length-1,o=u;s[o]===0;--o)s.pop();return o<0?new n(r.s*0):(r.e=si(s,u),r.d=s,K=!1,a&&(r=dt(r,i,c*4)),l&&(r=r.times(Math.abs(l)<54?Pt(2,l):Zn.pow(2,l))),K=!0,r)}function Ud(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:Pn(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/ai(5,t)),e=Pn(r,2,e,e);for(var i,o=new r(5),a=new r(16),c=new r(20);t--;)i=e.times(e),e=e.times(o.plus(i.times(a.times(i).minus(c))));return e}function Pn(r,e,t,n,i){var o,a,c,l,s=1,u=r.precision,h=Math.ceil(u/Z);for(K=!1,l=t.times(t),c=new r(n);;){if(a=dt(c.times(l),new r(e++*e++),u,1),c=i?n.plus(a):n.minus(a),n=dt(a.times(l),new r(e++*e++),u,1),a=c.plus(n),a.d[h]!==void 0){for(o=h;a.d[o]===c.d[o]&&o--;);if(o==-1)break}o=c,c=n,n=a,a=o,s++}return K=!0,a.d.length=h+1,a}function ai(r,e){for(var t=r;--e;)t*=r;return t}function Vu(r,e){var t,n=e.s<0,i=ye(r,r.precision,1),o=i.times(.5);if(e=e.abs(),e.lte(o))return Ue=n?4:1,e;if(t=e.divToInt(i),t.isZero())Ue=n?3:2;else{if(e=e.minus(t.times(i)),e.lte(o))return Ue=Du(t)?n?2:3:n?4:1,e;Ue=Du(t)?n?1:4:n?3:2}return e.minus(i).abs()}function to(r,e,t,n){var i,o,a,c,l,s,u,h,f,d=r.constructor,g=t!==void 0;if(g?(Qt(t,1,Ke),n===void 0?n=d.rounding:Qt(n,0,8)):(t=d.precision,n=d.rounding),!r.isFinite())u=ku(r);else{for(u=Pe(r),a=u.indexOf("."),g?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,a>=0&&(u=u.replace(".",""),f=new d(1),f.e=u.length-a,f.d=ei(Pe(f),10,i),f.e=f.d.length),h=ei(u,10,i),o=l=h.length;h[--l]==0;)h.pop();if(!h[0])u=g?"0p+0":"0";else{if(a<0?o--:(r=new d(r),r.d=h,r.e=o,r=dt(r,f,t,n,0,i),h=r.d,o=r.e,s=Nu),a=h[t],c=i/2,s=s||h[t+1]!==void 0,s=n<4?(a!==void 0||s)&&(n===0||n===(r.s<0?3:2)):a>c||a===c&&(n===4||s||n===6&&h[t-1]&1||n===(r.s<0?8:7)),h.length=t,s)for(;++h[--t]>i-1;)h[t]=0,t||(++o,h.unshift(1));for(l=h.length;!h[l-1];--l);for(a=0,u="";a<l;a++)u+=$i.charAt(h[a]);if(g){if(l>1)if(e==16||e==8){for(a=e==16?4:3,--l;l%a;l++)u+="0";for(h=ei(u,i,e),l=h.length;!h[l-1];--l);for(a=1,u="1.";a<l;a++)u+=$i.charAt(h[a])}else u=u.charAt(0)+"."+u.slice(1);u=u+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)u="0"+u;u="0."+u}else if(++o>l)for(o-=l;o--;)u+="0";else o<l&&(u=u.slice(0,o)+"."+u.slice(o))}u=(e==16?"0x":e==2?"0b":e==8?"0o":"")+u}return r.s<0?"-"+u:u}function Iu(r,e){if(r.length>e)return r.length=e,!0}function Bd(r){return new this(r).abs()}function zd(r){return new this(r).acos()}function Gd(r){return new this(r).acosh()}function kd(r,e){return new this(r).plus(e)}function Vd(r){return new this(r).asin()}function Hd(r){return new this(r).asinh()}function Wd(r){return new this(r).atan()}function qd(r){return new this(r).atanh()}function Xd(r,e){r=new this(r),e=new this(e);var t,n=this.precision,i=this.rounding,o=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=ye(this,o,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?ye(this,n,i):new this(0),t.s=r.s):!r.d||e.isZero()?(t=ye(this,o,1).times(.5),t.s=r.s):e.s<0?(this.precision=o,this.rounding=1,t=this.atan(dt(r,e,o,1)),e=ye(this,o,1),this.precision=n,this.rounding=i,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(dt(r,e,o,1)),t}function jd(r){return new this(r).cbrt()}function Yd(r){return $(r=new this(r),r.e+1,2)}function $d(r,e,t){return new this(r).clamp(e,t)}function Zd(r){if(!r||typeof r!="object")throw Error(oi+"Object expected");var e,t,n,i=r.defaults===!0,o=["precision",1,Ke,"rounding",0,8,"toExpNeg",-An,0,"toExpPos",0,An,"maxE",0,An,"minE",-An,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(t=o[e],i&&(this[t]=Zi[t]),(n=r[t])!==void 0)if(Wt(n)===n&&n>=o[e+1]&&n<=o[e+2])this[t]=n;else throw Error(Ze+t+": "+n);if(t="crypto",i&&(this[t]=Zi[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(Ou);else this[t]=!1;else throw Error(Ze+t+": "+n);return this}function Kd(r){return new this(r).cos()}function Jd(r){return new this(r).cosh()}function Hu(r){var e,t,n;function i(o){var a,c,l,s=this;if(!(s instanceof i))return new i(o);if(s.constructor=i,Ru(o)){s.s=o.s,K?!o.d||o.e>i.maxE?(s.e=NaN,s.d=null):o.e<i.minE?(s.e=0,s.d=[0]):(s.e=o.e,s.d=o.d.slice()):(s.e=o.e,s.d=o.d?o.d.slice():o.d);return}if(l=typeof o,l==="number"){if(o===0){s.s=1/o<0?-1:1,s.e=0,s.d=[0];return}if(o<0?(o=-o,s.s=-1):s.s=1,o===~~o&&o<1e7){for(a=0,c=o;c>=10;c/=10)a++;K?a>i.maxE?(s.e=NaN,s.d=null):a<i.minE?(s.e=0,s.d=[0]):(s.e=a,s.d=[o]):(s.e=a,s.d=[o]);return}else if(o*0!==0){o||(s.s=NaN),s.e=NaN,s.d=null;return}return Qi(s,o.toString())}else if(l!=="string")throw Error(Ze+o);return(c=o.charCodeAt(0))===45?(o=o.slice(1),s.s=-1):(c===43&&(o=o.slice(1)),s.s=1),Uu.test(o)?Qi(s,o):Fd(s,o)}if(i.prototype=F,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=Zd,i.clone=Hu,i.isDecimal=Ru,i.abs=Bd,i.acos=zd,i.acosh=Gd,i.add=kd,i.asin=Vd,i.asinh=Hd,i.atan=Wd,i.atanh=qd,i.atan2=Xd,i.cbrt=jd,i.ceil=Yd,i.clamp=$d,i.cos=Kd,i.cosh=Jd,i.div=Qd,i.exp=tg,i.floor=eg,i.hypot=ng,i.ln=rg,i.log=ig,i.log10=sg,i.log2=og,i.max=ag,i.min=ug,i.mod=lg,i.mul=cg,i.pow=hg,i.random=pg,i.round=fg,i.sign=dg,i.sin=gg,i.sinh=mg,i.sqrt=yg,i.sub=vg,i.sum=_g,i.tan=xg,i.tanh=Eg,i.trunc=bg,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return i.config(r),i}function Qd(r,e){return new this(r).div(e)}function tg(r){return new this(r).exp()}function eg(r){return $(r=new this(r),r.e+1,3)}function ng(){var r,e,t=new this(0);for(K=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return K=!0,new this(1/0);t=e}return K=!0,t.sqrt()}function Ru(r){return r instanceof Zn||r&&r.toStringTag===Fu||!1}function rg(r){return new this(r).ln()}function ig(r,e){return new this(r).log(e)}function og(r){return new this(r).log(2)}function sg(r){return new this(r).log(10)}function ag(){return Gu(this,arguments,"lt")}function ug(){return Gu(this,arguments,"gt")}function lg(r,e){return new this(r).mod(e)}function cg(r,e){return new this(r).mul(e)}function hg(r,e){return new this(r).pow(e)}function pg(r){var e,t,n,i,o=0,a=new this(1),c=[];if(r===void 0?r=this.precision:Qt(r,1,Ke),n=Math.ceil(r/Z),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));o<n;)i=e[o],i>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:c[o++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);o<n;)i=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((e[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,o):(c.push(i%1e7),o+=4);o=n/4}else throw Error(Ou);else for(;o<n;)c[o++]=Math.random()*1e7|0;for(n=c[--o],r%=Z,n&&r&&(i=Pt(10,Z-r),c[o]=(n/i|0)*i);c[o]===0;o--)c.pop();if(o<0)t=0,c=[0];else{for(t=-1;c[0]===0;t-=Z)c.shift();for(n=1,i=c[0];i>=10;i/=10)n++;n<Z&&(t-=Z-n)}return a.e=t,a.d=c,a}function fg(r){return $(r=new this(r),r.e+1,this.rounding)}function dg(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}function gg(r){return new this(r).sin()}function mg(r){return new this(r).sinh()}function yg(r){return new this(r).sqrt()}function vg(r,e){return new this(r).sub(e)}function _g(){var r=0,e=arguments,t=new this(e[r]);for(K=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return K=!0,$(t,this.precision,this.rounding)}function xg(r){return new this(r).tan()}function Eg(r){return new this(r).tanh()}function bg(r){return $(r=new this(r),r.e+1,1)}F[Symbol.for("nodejs.util.inspect.custom")]=F.toString;F[Symbol.toStringTag]="Decimal";var Zn=F.constructor=Hu(Zi);ni=new Zn(ni);ri=new Zn(ri);var Kn=Zn;var Sg="BigNumber",Mg=["?on","config"],eo=N(Sg,Mg,r=>{var{on:e,config:t}=r,n=Kn.clone({precision:t.precision,modulo:Kn.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(i){return new n(i.value)},e&&e("config",function(i,o){i.precision!==o.precision&&n.config({precision:i.precision})}),n},{isClass:!0});var Nt=pn(qu(),1);var wg="Complex",Tg=[],ro=N(wg,Tg,()=>(Object.defineProperty(Nt.default,"name",{value:"Complex"}),Nt.default.prototype.constructor=Nt.default,Nt.default.prototype.type="Complex",Nt.default.prototype.isComplex=!0,Nt.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Nt.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Nt.default.prototype.format=function(r){var e="",t=this.im,n=this.re,i=Yn(this.re,r),o=Yn(this.im,r),a=nt(r)?r:r?r.precision:null;if(a!==null){var c=Math.pow(10,-a);Math.abs(n/t)<c&&(n=0),Math.abs(t/n)<c&&(t=0)}return t===0?e=i:n===0?t===1?e="i":t===-1?e="-i":e=o+"i":t<0?t===-1?e=i+" - i":e=i+" - "+o.substring(1)+"i":t===1?e=i+" + i":e=i+" + "+o+"i",e},Nt.default.fromPolar=function(r){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return(0,Nt.default)(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var t=arguments[0],n=arguments[1];if(nt(t)){if($r(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),nt(n))return new Nt.default({r:t,phi:n});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Nt.default.prototype.valueOf=Nt.default.prototype.toString,Nt.default.fromJSON=function(r){return new Nt.default(r)},Nt.default.compare=function(r,e){return r.re>e.re?1:r.re<e.re?-1:r.im>e.im?1:r.im<e.im?-1:0},Nt.default),{isClass:!0});var Cg=2e3,X={s:1,n:0,d:1};function Be(r,e){if(isNaN(r=parseInt(r,10)))throw ui();return r*e}function bt(r,e){if(e===0)throw io();var t=Object.create(Lt.prototype);t.s=r<0?-1:1,r=r<0?-r:r;var n=Dn(r,e);return t.n=r/n,t.d=e/n,t}function Xu(r){for(var e={},t=r,n=2,i=4;i<=t;){for(;t%n===0;)t/=n,e[n]=(e[n]||0)+1;i+=1+2*n++}return t!==r?t>1&&(e[t]=(e[t]||0)+1):e[r]=(e[r]||0)+1,e}var oe=function(r,e){var t=0,n=1,i=1,o=0,a=0,c=0,l=1,s=1,u=0,h=1,f=1,d=1,g=1e7,p;if(r!=null)if(e!==void 0){if(t=r,n=e,i=t*n,t%1!==0||n%1!==0)throw Ig()}else switch(typeof r){case"object":{if("d"in r&&"n"in r)t=r.n,n=r.d,"s"in r&&(t*=r.s);else if(0 in r)t=r[0],1 in r&&(n=r[1]);else throw ui();i=t*n;break}case"number":{if(r<0&&(i=r,r=-r),r%1===0)t=r;else if(r>0){for(r>=1&&(s=Math.pow(10,Math.floor(1+Math.log(r)/Math.LN10)),r/=s);h<=g&&d<=g;)if(p=(u+f)/(h+d),r===p){h+d<=g?(t=u+f,n=h+d):d>h?(t=f,n=d):(t=u,n=h);break}else r>p?(u+=f,h+=d):(f+=u,d+=h),h>g?(t=f,n=d):(t=u,n=h);t*=s}else(isNaN(r)||isNaN(e))&&(n=t=NaN);break}case"string":{if(h=r.match(/\d+|./g),h===null)throw ui();if(h[u]==="-"?(i=-1,u++):h[u]==="+"&&u++,h.length===u+1?a=Be(h[u++],i):h[u+1]==="."||h[u]==="."?(h[u]!=="."&&(o=Be(h[u++],i)),u++,(u+1===h.length||h[u+1]==="("&&h[u+3]===")"||h[u+1]==="'"&&h[u+3]==="'")&&(a=Be(h[u],i),l=Math.pow(10,h[u].length),u++),(h[u]==="("&&h[u+2]===")"||h[u]==="'"&&h[u+2]==="'")&&(c=Be(h[u+1],i),s=Math.pow(10,h[u+1].length)-1,u+=3)):h[u+1]==="/"||h[u+1]===":"?(a=Be(h[u],i),l=Be(h[u+2],1),u+=3):h[u+3]==="/"&&h[u+1]===" "&&(o=Be(h[u],i),a=Be(h[u+2],i),l=Be(h[u+4],1),u+=5),h.length<=u){n=l*s,i=t=c+n*o+s*a;break}}default:throw ui()}if(n===0)throw io();X.s=i<0?-1:1,X.n=Math.abs(t),X.d=Math.abs(n)};function Ag(r,e,t){for(var n=1;e>0;r=r*r%t,e>>=1)e&1&&(n=n*r%t);return n}function Pg(r,e){for(;e%2===0;e/=2);for(;e%5===0;e/=5);if(e===1)return 0;for(var t=10%e,n=1;t!==1;n++)if(t=t*10%e,n>Cg)return 0;return n}function Dg(r,e,t){for(var n=1,i=Ag(10,t,e),o=0;o<300;o++){if(n===i)return o;n=n*10%e,i=i*10%e}return 0}function Dn(r,e){if(!r)return e;if(!e)return r;for(;;){if(r%=e,!r)return e;if(e%=r,!e)return r}}function Lt(r,e){if(oe(r,e),this instanceof Lt)r=Dn(X.d,X.n),this.s=X.s,this.n=X.n/r,this.d=X.d/r;else return bt(X.s*X.n,X.d)}var io=function(){return new Error("Division by Zero")},ui=function(){return new Error("Invalid argument")},Ig=function(){return new Error("Parameters must be integer")};Lt.prototype={s:1,n:0,d:1,abs:function(){return bt(this.n,this.d)},neg:function(){return bt(-this.s*this.n,this.d)},add:function(r,e){return oe(r,e),bt(this.s*this.n*X.d+X.s*this.d*X.n,this.d*X.d)},sub:function(r,e){return oe(r,e),bt(this.s*this.n*X.d-X.s*this.d*X.n,this.d*X.d)},mul:function(r,e){return oe(r,e),bt(this.s*X.s*this.n*X.n,this.d*X.d)},div:function(r,e){return oe(r,e),bt(this.s*X.s*this.n*X.d,this.d*X.n)},clone:function(){return bt(this.s*this.n,this.d)},mod:function(r,e){if(isNaN(this.n)||isNaN(this.d))return new Lt(NaN);if(r===void 0)return bt(this.s*this.n%this.d,1);if(oe(r,e),X.n===0&&this.d===0)throw io();return bt(this.s*(X.d*this.n)%(X.n*this.d),X.d*this.d)},gcd:function(r,e){return oe(r,e),bt(Dn(X.n,this.n)*Dn(X.d,this.d),X.d*this.d)},lcm:function(r,e){return oe(r,e),X.n===0&&this.n===0?bt(0,1):bt(X.n*this.n,Dn(X.n,this.n)*Dn(X.d,this.d))},ceil:function(r){return r=Math.pow(10,r||0),isNaN(this.n)||isNaN(this.d)?new Lt(NaN):bt(Math.ceil(r*this.s*this.n/this.d),r)},floor:function(r){return r=Math.pow(10,r||0),isNaN(this.n)||isNaN(this.d)?new Lt(NaN):bt(Math.floor(r*this.s*this.n/this.d),r)},round:function(r){return r=Math.pow(10,r||0),isNaN(this.n)||isNaN(this.d)?new Lt(NaN):bt(Math.round(r*this.s*this.n/this.d),r)},roundTo:function(r,e){return oe(r,e),bt(this.s*Math.round(this.n*X.d/(this.d*X.n))*X.n,X.d)},inverse:function(){return bt(this.s*this.d,this.n)},pow:function(r,e){if(oe(r,e),X.d===1)return X.s<0?bt(Math.pow(this.s*this.d,X.n),Math.pow(this.n,X.n)):bt(Math.pow(this.s*this.n,X.n),Math.pow(this.d,X.n));if(this.s<0)return null;var t=Xu(this.n),n=Xu(this.d),i=1,o=1;for(var a in t)if(a!=="1"){if(a==="0"){i=0;break}if(t[a]*=X.n,t[a]%X.d===0)t[a]/=X.d;else return null;i*=Math.pow(a,t[a])}for(var a in n)if(a!=="1"){if(n[a]*=X.n,n[a]%X.d===0)n[a]/=X.d;else return null;o*=Math.pow(a,n[a])}return X.s<0?bt(o,i):bt(i,o)},equals:function(r,e){return oe(r,e),this.s*this.n*X.d===X.s*X.n*this.d},compare:function(r,e){oe(r,e);var t=this.s*this.n*X.d-X.s*X.n*this.d;return(0<t)-(t<0)},simplify:function(r){if(isNaN(this.n)||isNaN(this.d))return this;r=r||.001;for(var e=this.abs(),t=e.toContinued(),n=1;n<t.length;n++){for(var i=bt(t[n-1],1),o=n-2;o>=0;o--)i=i.inverse().add(t[o]);if(Math.abs(i.sub(e).valueOf())<r)return i.mul(this.s)}return this},divisible:function(r,e){return oe(r,e),!(!(X.n*this.d)||this.n*X.d%(X.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(r){var e,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),i===1?t+=n:(r&&(e=Math.floor(n/i))>0&&(t+=e,t+=" ",n%=i),t+=n,t+="/",t+=i),t},toLatex:function(r){var e,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),i===1?t+=n:(r&&(e=Math.floor(n/i))>0&&(t+=e,n%=i),t+="\\frac{",t+=n,t+="}{",t+=i,t+="}"),t},toContinued:function(){var r,e=this.n,t=this.d,n=[];if(isNaN(e)||isNaN(t))return n;do n.push(Math.floor(e/t)),r=e%t,e=t,t=r;while(e!==1);return n},toString:function(r){var e=this.n,t=this.d;if(isNaN(e)||isNaN(t))return"NaN";r=r||15;var n=Pg(e,t),i=Dg(e,t,n),o=this.s<0?"-":"";if(o+=e/t|0,e%=t,e*=10,e&&(o+="."),n){for(var a=i;a--;)o+=e/t|0,e%=t,e*=10;o+="(";for(var a=n;a--;)o+=e/t|0,e%=t,e*=10;o+=")"}else for(var a=r;e&&a--;)o+=e/t|0,e%=t,e*=10;return o}};var Rg="Fraction",Ng=[],oo=N(Rg,Ng,()=>(Object.defineProperty(Lt,"name",{value:"Fraction"}),Lt.prototype.constructor=Lt,Lt.prototype.type="Fraction",Lt.prototype.isFraction=!0,Lt.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Lt.fromJSON=function(r){return new Lt(r)},Lt),{isClass:!0});var Lg="Matrix",Og=[],so=N(Lg,Og,()=>{function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator")}return r.prototype.type="Matrix",r.prototype.isMatrix=!0,r.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},r.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},r.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},r.prototype.subset=function(e,t,n){throw new Error("Cannot invoke subset on a Matrix interface")},r.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},r.prototype.set=function(e,t,n){throw new Error("Cannot invoke set on a Matrix interface")},r.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},r.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},r.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},r.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},r.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},r.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},r.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},r.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},r.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},r.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},r.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},r},{isClass:!0});function ao(r,e,t){var n=r.constructor,i=new n(2),o="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!tt(t))throw new Error("size must be an integer");if(r.greaterThan(i.pow(t-1).sub(1))||r.lessThan(i.pow(t-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!r.isInteger())throw new Error("Value must be an integer");r.lessThan(0)&&(r=r.add(i.pow(t))),o="i".concat(t)}switch(e){case 2:return"".concat(r.toBinary()).concat(o);case 8:return"".concat(r.toOctal()).concat(o);case 16:return"".concat(r.toHexadecimal()).concat(o);default:throw new Error("Base ".concat(e," not supported "))}}function $u(r,e){if(typeof e=="function")return e(r);if(!r.isFinite())return r.isNaN()?"NaN":r.gt(0)?"Infinity":"-Infinity";var{notation:t,precision:n,wordSize:i}=qi(e);switch(t){case"fixed":return Ug(r,n);case"exponential":return ju(r,n);case"engineering":return Fg(r,n);case"bin":return ao(r,2,i);case"oct":return ao(r,8,i);case"hex":return ao(r,16,i);case"auto":{var o=Yu(e?.lowerExp,-3),a=Yu(e?.upperExp,5);if(r.isZero())return"0";var c,l=r.toSignificantDigits(n),s=l.e;return s>=o&&s<a?c=l.toFixed():c=ju(r,n),c.replace(/((\.\d*?)(0+))($|e)/,function(){var u=arguments[2],h=arguments[4];return u!=="."?u+h:h})}default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Fg(r,e){var t=r.e,n=t%3===0?t:t<0?t-3-t%3:t-t%3,i=r.mul(Math.pow(10,-n)),o=i.toPrecision(e);if(o.includes("e")){var a=r.constructor;o=new a(o).toFixed()}return o+"e"+(t>=0?"+":"")+n.toString()}function ju(r,e){return e!==void 0?r.toExponential(e-1):r.toExponential()}function Ug(r,e){return r.toFixed(e)}function Yu(r,e){return nt(r)?r:it(r)?r.toNumber():e}function vt(r,e){var t=Bg(r,e);return e&&typeof e=="object"&&"truncate"in e&&t.length>e.truncate?t.substring(0,e.truncate-3)+"...":t}function Bg(r,e){if(typeof r=="number")return Yn(r,e);if(it(r))return $u(r,e);if(zg(r))return!e||e.fraction!=="decimal"?r.s*r.n+"/"+r.d:r.toString();if(Array.isArray(r))return Ju(r,e);if(jt(r))return Zu(r);if(typeof r=="function")return r.syntax?String(r.syntax):"function";if(r&&typeof r=="object"){if(typeof r.format=="function")return r.format(e);if(r&&r.toString(e)!=={}.toString())return r.toString(e);var t=Object.keys(r).map(n=>Zu(n)+": "+vt(r[n],e));return"{"+t.join(", ")+"}"}return String(r)}function Zu(r){for(var e=String(r),t="",n=0;n<e.length;){var i=e.charAt(n);t+=i in Ku?Ku[i]:i,n++}return'"'+t+'"'}var Ku={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function Ju(r,e){if(Array.isArray(r)){for(var t="[",n=r.length,i=0;i<n;i++)i!==0&&(t+=", "),t+=Ju(r[i],e);return t+="]",t}else return vt(r,e)}function zg(r){return r&&typeof r=="object"&&typeof r.s=="number"&&typeof r.n=="number"&&typeof r.d=="number"||!1}function Q(r,e,t){if(!(this instanceof Q))throw new SyntaxError("Constructor must be called with the new operator");this.actual=r,this.expected=e,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(r)?"["+r.join(", ")+"]":r)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}Q.prototype=new RangeError;Q.prototype.constructor=RangeError;Q.prototype.name="DimensionError";Q.prototype.isDimensionError=!0;function _e(r,e,t){if(!(this instanceof _e))throw new SyntaxError("Constructor must be called with the new operator");this.index=r,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=t),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}_e.prototype=new RangeError;_e.prototype.constructor=RangeError;_e.prototype.name="IndexError";_e.prototype.isIndexError=!0;function st(r){for(var e=[];Array.isArray(r);)e.push(r.length),r=r[0];return e}function Qu(r,e,t){var n,i=r.length;if(i!==e[t])throw new Q(i,e[t]);if(t<e.length-1){var o=t+1;for(n=0;n<i;n++){var a=r[n];if(!Array.isArray(a))throw new Q(e.length-1,e.length,"<");Qu(r[n],e,o)}}else for(n=0;n<i;n++)if(Array.isArray(r[n]))throw new Q(e.length+1,e.length,">")}function lo(r,e){var t=e.length===0;if(t){if(Array.isArray(r))throw new Q(r.length,0)}else Qu(r,e,0)}function Et(r,e){if(r!==void 0){if(!nt(r)||!tt(r))throw new TypeError("Index must be an integer (value: "+r+")");if(r<0||typeof e=="number"&&r>=e)throw new _e(r,e)}}function un(r,e,t){if(!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Error("Resizing to scalar is not supported");e.forEach(function(i){if(!nt(i)||!tt(i)||i<0)throw new TypeError("Invalid size, must contain positive integers (size: "+vt(e)+")")}),(nt(r)||it(r))&&(r=[r]);var n=t!==void 0?t:0;return uo(r,e,0,n),r}function uo(r,e,t,n){var i,o,a=r.length,c=e[t],l=Math.min(a,c);if(r.length=c,t<e.length-1){var s=t+1;for(i=0;i<l;i++)o=r[i],Array.isArray(o)||(o=[o],r[i]=o),uo(o,e,s,n);for(i=l;i<c;i++)o=[],r[i]=o,uo(o,e,s,n)}else{for(i=0;i<l;i++)for(;Array.isArray(r[i]);)r[i]=r[i][0];for(i=l;i<c;i++)r[i]=n}}function Jn(r,e){var t=kg(r),n=t.length;if(!Array.isArray(r)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Q(0,n,"!=");e=Qn(e,n);var i=tl(e);if(n!==i)throw new Q(i,n,"!=");try{return Gg(t,e)}catch(o){throw o instanceof Q?new Q(i,n,"!="):o}}function Qn(r,e){var t=tl(r),n=r.slice(),i=-1,o=r.indexOf(i),a=r.indexOf(i,o+1)>=0;if(a)throw new Error("More than one wildcard in sizes");var c=o>=0,l=e%t===0;if(c)if(l)n[o]=-e/t;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-t);return n}function tl(r){return r.reduce((e,t)=>e*t,1)}function Gg(r,e){for(var t=r,n,i=e.length-1;i>0;i--){var o=e[i];n=[];for(var a=t.length/o,c=0;c<a;c++)n.push(t.slice(c*o,(c+1)*o));t=n}return t}function li(r,e,t,n){var i=n||st(r);if(t)for(var o=0;o<t;o++)r=[r],i.unshift(1);for(r=el(r,e,0);i.length<e;)i.push(1);return r}function el(r,e,t){var n,i;if(Array.isArray(r)){var o=t+1;for(n=0,i=r.length;n<i;n++)r[n]=el(r[n],e,o)}else for(var a=t;a<e;a++)r=[r];return r}function kg(r){if(!Array.isArray(r))return r;var e=[];return r.forEach(function t(n){Array.isArray(n)?n.forEach(t):e.push(n)}),e}function In(r,e){for(var t,n=0,i=0;i<r.length;i++){var o=r[i],a=Array.isArray(o);if(i===0&&a&&(n=o.length),a&&o.length!==n)return;var c=a?In(o,e):e(o);if(t===void 0)t=c;else if(t!==c)return"mixed"}return t}function nl(r,e,t,n){if(n<t){if(r.length!==e.length)throw new Q(r.length,e.length);for(var i=[],o=0;o<r.length;o++)i[o]=nl(r[o],e[o],t,n+1);return i}else return r.concat(e)}function co(){var r=Array.prototype.slice.call(arguments,0,-1),e=Array.prototype.slice.call(arguments,-1);if(r.length===1)return r[0];if(r.length>1)return r.slice(1).reduce(function(t,n){return nl(t,n,e,0)},r[0]);throw new Error("Wrong number of arguments in function concat")}function ho(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];for(var n=e.map(f=>f.length),i=Math.max(...n),o=new Array(i).fill(null),a=0;a<e.length;a++)for(var c=e[a],l=n[a],s=0;s<l;s++){var u=i-l+s;c[s]>o[u]&&(o[u]=c[s])}for(var h=0;h<e.length;h++)rl(e[h],o);return o}function rl(r,e){for(var t=e.length,n=r.length,i=0;i<n;i++){var o=t-n+i;if(r[i]<e[o]&&r[i]>1||r[i]>e[o])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(r,") not possible to broadcast dimension ").concat(n," with size ").concat(r[i]," to size ").concat(e[o]))}}function tr(r,e){var t=st(r);if(ce(t,e))return r;rl(t,e);var n=ho(t,e),i=n.length,o=[...Array(i-t.length).fill(1),...t],a=Hg(r);t.length<i&&(a=Jn(a,o),t=st(a));for(var c=0;c<i;c++)t[c]<n[c]&&(a=Vg(a,n[c],c),t=st(a));return a}function Vg(r,e,t){return co(...Array(e).fill(r),t)}function il(r,e){if(!Array.isArray(r))throw new Error("Array expected");var t=st(r);if(e.length!==t.length)throw new Q(e.length,t.length);for(var n=0;n<e.length;n++)Et(e[n],t[n]);return e.reduce((i,o)=>i[o],r)}function Hg(r){return bn([],r)}var er=pn(Hi(),1);function ci(r,e,t,n,i){if(er.default.isTypedFunction(r)){var o=[e,t,n],a=er.default.resolve(r,o);if(a)return h(a.implementation,o);var c=[e,t],l=er.default.resolve(r,c);if(l)return h(l.implementation,c);var s=[e],u=er.default.resolve(r,s);return u?h(u.implementation,s):h(r,o)}else return r(e,t,n);function h(f,d){try{return f.apply(f,d)}catch(m){var g;if(m instanceof TypeError&&((g=m.data)===null||g===void 0?void 0:g.category)==="wrongType"){var p=[];throw p.push("value: ".concat(Ut(e))),d.length>=2&&p.push("index: ".concat(Ut(t))),d.length>=3&&p.push("array: ".concat(Ut(n))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(r.name,"(").concat(p.join(", "),") at index ").concat(JSON.stringify(t)))}else throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(r.name,": ").concat(m.message))}}}var Wg="DenseMatrix",qg=["Matrix"],po=N(Wg,qg,r=>{var{Matrix:e}=r;function t(u,h){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(h&&!jt(h))throw new Error("Invalid datatype: "+h);if(ot(u))u.type==="DenseMatrix"?(this._data=ft(u._data),this._size=ft(u._size),this._datatype=h||u._datatype):(this._data=u.toArray(),this._size=u.size(),this._datatype=h||u._datatype);else if(u&&yt(u.data)&&yt(u.size))this._data=u.data,this._size=u.size,lo(this._data,this._size),this._datatype=h||u.datatype;else if(yt(u))this._data=s(u),this._size=st(this._data),lo(this._data,this._size),this._datatype=h;else{if(u)throw new TypeError("Unsupported type of data ("+Ut(u)+")");this._data=[],this._size=[0],this._datatype=h}}t.prototype=new e,t.prototype.createDenseMatrix=function(u,h){return new t(u,h)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return In(this._data,Ut)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(u,h){return new t(u,h)},t.prototype.subset=function(u,h,f){switch(arguments.length){case 1:return n(this,u);case 2:case 3:return o(this,u,h,f);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(u){return il(this._data,u)},t.prototype.set=function(u,h,f){if(!yt(u))throw new TypeError("Array expected");if(u.length<this._size.length)throw new Q(u.length,this._size.length,"<");var d,g,p,m=u.map(function(b){return b+1});l(this,m,f);var v=this._data;for(d=0,g=u.length-1;d<g;d++)p=u[d],Et(p,v.length),v=v[p];return p=u[u.length-1],Et(p,v.length),v[p]=h,this};function n(u,h){if(!Mn(h))throw new TypeError("Invalid index");var f=h.isScalar();if(f)return u.get(h.min());var d=h.size();if(d.length!==u._size.length)throw new Q(d.length,u._size.length);for(var g=h.min(),p=h.max(),m=0,v=u._size.length;m<v;m++)Et(g[m],u._size[m]),Et(p[m],u._size[m]);return new t(i(u._data,h,d.length,0),u._datatype)}function i(u,h,f,d){var g=d===f-1,p=h.dimension(d);return g?p.map(function(m){return Et(m,u.length),u[m]}).valueOf():p.map(function(m){Et(m,u.length);var v=u[m];return i(v,h,f,d+1)}).valueOf()}function o(u,h,f,d){if(!h||h.isIndex!==!0)throw new TypeError("Invalid index");var g=h.size(),p=h.isScalar(),m;if(ot(f)?(m=f.size(),f=f.valueOf()):m=st(f),p){if(m.length!==0)throw new TypeError("Scalar expected");u.set(h.min(),f,d)}else{if(!ce(m,g))try{m.length===0?f=tr([f],g):f=tr(f,g),m=st(f)}catch{}if(g.length<u._size.length)throw new Q(g.length,u._size.length,"<");if(m.length<g.length){for(var v=0,b=0;g[v]===1&&m[v]===1;)v++;for(;g[v]===1;)b++,v++;f=li(f,g.length,b,m)}if(!ce(g,m))throw new Q(g,m,">");var y=h.max().map(function(_){return _+1});l(u,y,d);var S=g.length,x=0;a(u._data,h,f,S,x)}return u}function a(u,h,f,d,g){var p=g===d-1,m=h.dimension(g);p?m.forEach(function(v,b){Et(v),u[v]=f[b[0]]}):m.forEach(function(v,b){Et(v),a(u[v],h,f[b[0]],d,g+1)})}t.prototype.resize=function(u,h,f){if(!Fe(u))throw new TypeError("Array or Matrix expected");var d=u.valueOf().map(p=>Array.isArray(p)&&p.length===1?p[0]:p),g=f?this.clone():this;return c(g,d,h)};function c(u,h,f){if(h.length===0){for(var d=u._data;yt(d);)d=d[0];return d}return u._size=h.slice(0),u._data=un(u._data,u._size,f),u}t.prototype.reshape=function(u,h){var f=h?this.clone():this;f._data=Jn(f._data,u);var d=f._size.reduce((g,p)=>g*p);return f._size=Qn(u,d),f};function l(u,h,f){for(var d=u._size.slice(0),g=!1;d.length<h.length;)d.push(0),g=!0;for(var p=0,m=h.length;p<m;p++)h[p]>d[p]&&(d[p]=h[p],g=!0);g&&c(u,d,f)}t.prototype.clone=function(){var u=new t({data:ft(this._data),size:ft(this._size),datatype:this._datatype});return u},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(u){var h=this,f=function(m,v){return yt(m)?m.map(function(b,y){return f(b,v.concat(y))}):ci(u,m,v,h,"map")},d=f(this._data,[]),g=this._datatype!==void 0?In(d,Ut):void 0;return new t(d,g)},t.prototype.forEach=function(u){var h=this,f=function(g,p){yt(g)?g.forEach(function(m,v){f(m,p.concat(v))}):u(g,p,h)};f(this._data,[])},t.prototype[Symbol.iterator]=function*(){var u=function*(f,d){if(yt(f))for(var g=0;g<f.length;g++)yield*u(f[g],d.concat(g));else yield{value:f,index:d}};yield*u(this._data,[])},t.prototype.rows=function(){var u=[],h=this.size();if(h.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var f=this._data;for(var d of f)u.push(new t([d],this._datatype));return u},t.prototype.columns=function(){var u=this,h=[],f=this.size();if(f.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var d=this._data,g=function(v){var b=d.map(y=>[y[v]]);h.push(new t(b,u._datatype))},p=0;p<f[1];p++)g(p);return h},t.prototype.toArray=function(){return ft(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(u){return vt(this._data,u)},t.prototype.toString=function(){return vt(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(u){if(u){if(it(u)&&(u=u.toNumber()),!nt(u)||!tt(u))throw new TypeError("The parameter k must be an integer number")}else u=0;for(var h=u>0?u:0,f=u<0?-u:0,d=this._size[0],g=this._size[1],p=Math.min(d-f,g-h),m=[],v=0;v<p;v++)m[v]=this._data[v+f][v+h];return new t({data:m,size:[p],datatype:this._datatype})},t.diagonal=function(u,h,f,d){if(!yt(u))throw new TypeError("Array expected, size parameter");if(u.length!==2)throw new Error("Only two dimensions matrix are supported");if(u=u.map(function(M){if(it(M)&&(M=M.toNumber()),!nt(M)||!tt(M)||M<1)throw new Error("Size values must be positive integers");return M}),f){if(it(f)&&(f=f.toNumber()),!nt(f)||!tt(f))throw new TypeError("The parameter k must be an integer number")}else f=0;var g=f>0?f:0,p=f<0?-f:0,m=u[0],v=u[1],b=Math.min(m-p,v-g),y;if(yt(h)){if(h.length!==b)throw new Error("Invalid value array length");y=function(w){return h[w]}}else if(ot(h)){var S=h.size();if(S.length!==1||S[0]!==b)throw new Error("Invalid matrix length");y=function(w){return h.get([w])}}else y=function(){return h};d||(d=it(y(0))?y(0).mul(0):0);var x=[];if(u.length>0){x=un(x,u,d);for(var _=0;_<b;_++)x[_+p][_+g]=y(_)}return new t({data:x,size:[m,v]})},t.fromJSON=function(u){return new t(u)},t.prototype.swapRows=function(u,h){if(!nt(u)||!tt(u)||!nt(h)||!tt(h))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Et(u,this._size[0]),Et(h,this._size[0]),t._swapRows(u,h,this._data),this},t._swapRows=function(u,h,f){var d=f[u];f[u]=f[h],f[h]=d};function s(u){return ot(u)?s(u.valueOf()):yt(u)?u.map(s):u}return t},{isClass:!0});function ol(r){var e=r.length,t=r[0].length,n,i,o=[];for(i=0;i<t;i++){var a=[];for(n=0;n<e;n++)a.push(r[n][i]);o.push(a)}return o}function sl(r){for(var e=0;e<r.length;e++)if(Fe(r[e]))return!0;return!1}function fo(r,e){ot(r)&&(r=r.valueOf());for(var t=0,n=r.length;t<n;t++){var i=r[t];Array.isArray(i)?fo(i,e):e(i)}}function _t(r,e,t){return r&&typeof r.map=="function"?r.map(function(n){return _t(n,e,t)}):e(r)}function al(r,e,t){var n=Array.isArray(r)?st(r):r.size();if(e<0||e>=n.length)throw new _e(e,n.length);return ot(r)?r.create(hi(r.valueOf(),e,t),r.datatype()):hi(r,e,t)}function hi(r,e,t){var n,i,o,a;if(e<=0)if(Array.isArray(r[0])){for(a=ol(r),i=[],n=0;n<a.length;n++)i[n]=hi(a[n],e-1,t);return i}else{for(o=r[0],n=1;n<r.length;n++)o=t(o,r[n]);return o}else{for(i=[],n=0;n<r.length;n++)i[n]=hi(r[n],e-1,t);return i}}var ul="isInteger",Xg=["typed"],go=N(ul,Xg,r=>{var{typed:e}=r;return e(ul,{number:tt,BigNumber:function(n){return n.isInt()},bigint:function(n){return!0},Fraction:function(n){return n.d===1&&isFinite(n.n)},"Array | Matrix":e.referToSelf(t=>n=>_t(n,t))})});var te="number",ze="number, number";function mo(r){return Math.abs(r)}mo.signature=te;function yo(r,e){return r+e}yo.signature=ze;function vo(r,e){return r-e}vo.signature=ze;function _o(r,e){return r*e}_o.signature=ze;function jg(r,e){return r/e}jg.signature=ze;function xo(r){return-r}xo.signature=te;function Yg(r){return r}Yg.signature=te;function $g(r){return wu(r)}$g.signature=te;function Zg(r){return r*r*r}Zg.signature=te;function Eo(r){return Math.exp(r)}Eo.signature=te;function Kg(r){return Tu(r)}Kg.signature=te;function Jg(r,e){if(!tt(r)||!tt(e))throw new Error("Parameters in function gcd must be integer numbers");for(var t;e!==0;)t=r%e,r=e,e=t;return r<0?-r:r}Jg.signature=ze;function Qg(r,e){if(!tt(r)||!tt(e))throw new Error("Parameters in function lcm must be integer numbers");if(r===0||e===0)return 0;for(var t,n=r*e;e!==0;)t=e,e=r%t,r=t;return Math.abs(n/r)}Qg.signature=ze;function tm(r){return Su(r)}tm.signature=te;function bo(r){return bu(r)}bo.signature=te;function em(r){return Mu(r)}em.signature=te;function nm(r,e){return e===0?r:r-e*Math.floor(r/e)}nm.signature=ze;function rm(r){return Eu(r)}rm.signature=te;function im(r){return Math.sqrt(r)}im.signature=te;function om(r){return r*r}om.signature=te;function sm(r,e){var t,n,i,o=0,a=1,c=1,l=0;if(!tt(r)||!tt(e))throw new Error("Parameters in function xgcd must be integer numbers");for(;e;)n=Math.floor(r/e),i=r-n*e,t=o,o=a-n*o,a=t,t=c,c=l-n*c,l=t,r=e,e=i;var s;return r<0?s=[-r,-a,-l]:s=[r,r?a:0,l],s}sm.signature=ze;function So(r,e){return r*r<1&&e===1/0||r*r>1&&e===-1/0?0:Math.pow(r,e)}So.signature=ze;function Rn(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!tt(e)||e<0||e>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(Xi(r,e))}function am(r){return Math.abs(r)}am.signature=te;var ll=2*Math.PI;function Je(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-9,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(t<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return r.isNaN()||e.isNaN()?!1:!r.isFinite()||!e.isFinite()?r.eq(e):r.eq(e)?!0:r.minus(e).abs().lte(r.constructor.max(r.constructor.max(r.abs(),e.abs()).mul(t),n))}var cl="isZero",um=["typed","equalScalar"],Mo=N(cl,um,r=>{var{typed:e,equalScalar:t}=r;return e(cl,{"number | BigNumber | Complex | Fraction":n=>t(n,0),bigint:n=>n===0n,Unit:e.referToSelf(n=>i=>e.find(n,i.valueType())(i.value)),"Array | Matrix":e.referToSelf(n=>i=>_t(i,n))})});function hl(r,e,t,n){return pe(r.re,e.re,t,n)&&pe(r.im,e.im,t,n)}var pl=N("compareUnits",["typed"],r=>{var{typed:e}=r;return{"Unit, Unit":e.referToSelf(t=>(n,i)=>{if(!n.equalBase(i))throw new Error("Cannot compare units with different base");return e.find(t,[n.valueType(),i.valueType()])(n.value,i.value)})}});var pi="equalScalar",lm=["typed","config"],wo=N(pi,lm,r=>{var{typed:e,config:t}=r,n=pl({typed:e});return e(pi,{"boolean, boolean":function(o,a){return o===a},"number, number":function(o,a){return pe(o,a,t.relTol,t.absTol)},"BigNumber, BigNumber":function(o,a){return o.eq(a)||Je(o,a,t.relTol,t.absTol)},"bigint, bigint":function(o,a){return o===a},"Fraction, Fraction":function(o,a){return o.equals(a)},"Complex, Complex":function(o,a){return hl(o,a,t.relTol,t.absTol)}},n)}),Ww=N(pi,["typed","config"],r=>{var{typed:e,config:t}=r;return e(pi,{"number, number":function(i,o){return pe(i,o,t.relTol,t.absTol)}})});var cm="SparseMatrix",hm=["typed","equalScalar","Matrix"],To=N(cm,hm,r=>{var{typed:e,equalScalar:t,Matrix:n}=r;function i(p,m){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(m&&!jt(m))throw new Error("Invalid datatype: "+m);if(ot(p))o(this,p,m);else if(p&&yt(p.index)&&yt(p.ptr)&&yt(p.size))this._values=p.values,this._index=p.index,this._ptr=p.ptr,this._size=p.size,this._datatype=m||p.datatype;else if(yt(p))a(this,p,m);else{if(p)throw new TypeError("Unsupported type of data ("+Ut(p)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=m}}function o(p,m,v){m.type==="SparseMatrix"?(p._values=m._values?ft(m._values):void 0,p._index=ft(m._index),p._ptr=ft(m._ptr),p._size=ft(m._size),p._datatype=v||m._datatype):a(p,m.valueOf(),v||m._datatype)}function a(p,m,v){p._values=[],p._index=[],p._ptr=[],p._datatype=v;var b=m.length,y=0,S=t,x=0;if(jt(v)&&(S=e.find(t,[v,v])||t,x=e.convert(0,v)),b>0){var _=0;do{p._ptr.push(p._index.length);for(var M=0;M<b;M++){var w=m[M];if(yt(w)){if(_===0&&y<w.length&&(y=w.length),_<w.length){var C=w[_];S(C,x)||(p._values.push(C),p._index.push(M))}}else _===0&&y<1&&(y=1),S(w,x)||(p._values.push(w),p._index.push(M))}_++}while(_<y)}p._ptr.push(p._index.length),p._size=[b,y]}i.prototype=new n,i.prototype.createSparseMatrix=function(p,m){return new i(p,m)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return In(this._values,Ut)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(p,m){return new i(p,m)},i.prototype.density=function(){var p=this._size[0],m=this._size[1];return p!==0&&m!==0?this._index.length/(p*m):0},i.prototype.subset=function(p,m,v){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return c(this,p);case 2:case 3:return l(this,p,m,v);default:throw new SyntaxError("Wrong number of arguments")}};function c(p,m){if(!Mn(m))throw new TypeError("Invalid index");var v=m.isScalar();if(v)return p.get(m.min());var b=m.size();if(b.length!==p._size.length)throw new Q(b.length,p._size.length);var y,S,x,_,M=m.min(),w=m.max();for(y=0,S=p._size.length;y<S;y++)Et(M[y],p._size[y]),Et(w[y],p._size[y]);var C=p._values,P=p._index,D=p._ptr,R=m.dimension(0),W=m.dimension(1),G=[],k=[];R.forEach(function(j,J){k[j]=J[0],G[j]=!0});var L=C?[]:void 0,q=[],Y=[];return W.forEach(function(j){for(Y.push(q.length),x=D[j],_=D[j+1];x<_;x++)y=P[x],G[y]===!0&&(q.push(k[y]),L&&L.push(C[x]))}),Y.push(q.length),new i({values:L,index:q,ptr:Y,size:b,datatype:p._datatype})}function l(p,m,v,b){if(!m||m.isIndex!==!0)throw new TypeError("Invalid index");var y=m.size(),S=m.isScalar(),x;if(ot(v)?(x=v.size(),v=v.toArray()):x=st(v),S){if(x.length!==0)throw new TypeError("Scalar expected");p.set(m.min(),v,b)}else{if(y.length!==1&&y.length!==2)throw new Q(y.length,p._size.length,"<");if(x.length<y.length){for(var _=0,M=0;y[_]===1&&x[_]===1;)_++;for(;y[_]===1;)M++,_++;v=li(v,y.length,M,x)}if(!ce(y,x))throw new Q(y,x,">");if(y.length===1){var w=m.dimension(0);w.forEach(function(D,R){Et(D),p.set([D,0],v[R[0]],b)})}else{var C=m.dimension(0),P=m.dimension(1);C.forEach(function(D,R){Et(D),P.forEach(function(W,G){Et(W),p.set([D,W],v[R[0]][G[0]],b)})})}}return p}i.prototype.get=function(p){if(!yt(p))throw new TypeError("Array expected");if(p.length!==this._size.length)throw new Q(p.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var m=p[0],v=p[1];Et(m,this._size[0]),Et(v,this._size[1]);var b=s(m,this._ptr[v],this._ptr[v+1],this._index);return b<this._ptr[v+1]&&this._index[b]===m?this._values[b]:0},i.prototype.set=function(p,m,v){if(!yt(p))throw new TypeError("Array expected");if(p.length!==this._size.length)throw new Q(p.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var b=p[0],y=p[1],S=this._size[0],x=this._size[1],_=t,M=0;jt(this._datatype)&&(_=e.find(t,[this._datatype,this._datatype])||t,M=e.convert(0,this._datatype)),(b>S-1||y>x-1)&&(f(this,Math.max(b+1,S),Math.max(y+1,x),v),S=this._size[0],x=this._size[1]),Et(b,S),Et(y,x);var w=s(b,this._ptr[y],this._ptr[y+1],this._index);return w<this._ptr[y+1]&&this._index[w]===b?_(m,M)?u(w,y,this._values,this._index,this._ptr):this._values[w]=m:_(m,M)||h(w,b,y,m,this._values,this._index,this._ptr),this};function s(p,m,v,b){if(v-m===0)return v;for(var y=m;y<v;y++)if(b[y]===p)return y;return m}function u(p,m,v,b,y){v.splice(p,1),b.splice(p,1);for(var S=m+1;S<y.length;S++)y[S]--}function h(p,m,v,b,y,S,x){y.splice(p,0,b),S.splice(p,0,m);for(var _=v+1;_<x.length;_++)x[_]++}i.prototype.resize=function(p,m,v){if(!Fe(p))throw new TypeError("Array or Matrix expected");var b=p.valueOf().map(S=>Array.isArray(S)&&S.length===1?S[0]:S);if(b.length!==2)throw new Error("Only two dimensions matrix are supported");b.forEach(function(S){if(!nt(S)||!tt(S)||S<0)throw new TypeError("Invalid size, must contain positive integers (size: "+vt(b)+")")});var y=v?this.clone():this;return f(y,b[0],b[1],m)};function f(p,m,v,b){var y=b||0,S=t,x=0;jt(p._datatype)&&(S=e.find(t,[p._datatype,p._datatype])||t,x=e.convert(0,p._datatype),y=e.convert(y,p._datatype));var _=!S(y,x),M=p._size[0],w=p._size[1],C,P,D;if(v>w){for(P=w;P<v;P++)if(p._ptr[P]=p._values.length,_)for(C=0;C<M;C++)p._values.push(y),p._index.push(C);p._ptr[v]=p._values.length}else v<w&&(p._ptr.splice(v+1,w-v),p._values.splice(p._ptr[v],p._values.length),p._index.splice(p._ptr[v],p._index.length));if(w=v,m>M){if(_){var R=0;for(P=0;P<w;P++){p._ptr[P]=p._ptr[P]+R,D=p._ptr[P+1]+R;var W=0;for(C=M;C<m;C++,W++)p._values.splice(D+W,0,y),p._index.splice(D+W,0,C),R++}p._ptr[w]=p._values.length}}else if(m<M){var G=0;for(P=0;P<w;P++){p._ptr[P]=p._ptr[P]-G;var k=p._ptr[P],L=p._ptr[P+1]-G;for(D=k;D<L;D++)C=p._index[D],C>m-1&&(p._values.splice(D,1),p._index.splice(D,1),G++)}p._ptr[P]=p._values.length}return p._size[0]=m,p._size[1]=v,p}i.prototype.reshape=function(p,m){if(!yt(p))throw new TypeError("Array expected");if(p.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");p.forEach(function(j){if(!nt(j)||!tt(j)||j<=-2||j===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+vt(p)+")")});var v=this._size[0]*this._size[1];p=Qn(p,v);var b=p[0]*p[1];if(v!==b)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var y=m?this.clone():this;if(this._size[0]===p[0]&&this._size[1]===p[1])return y;for(var S=[],x=0;x<y._ptr.length;x++)for(var _=0;_<y._ptr[x+1]-y._ptr[x];_++)S.push(x);for(var M=y._values.slice(),w=y._index.slice(),C=0;C<y._index.length;C++){var P=w[C],D=S[C],R=P*y._size[1]+D;S[C]=R%p[1],w[C]=Math.floor(R/p[1])}y._values.length=0,y._index.length=0,y._ptr.length=p[1]+1,y._size=p.slice();for(var W=0;W<y._ptr.length;W++)y._ptr[W]=0;for(var G=0;G<M.length;G++){var k=w[G],L=S[G],q=M[G],Y=s(k,y._ptr[L],y._ptr[L+1],y._index);h(Y,k,L,q,y._values,y._index,y._ptr)}return y},i.prototype.clone=function(){var p=new i({values:this._values?ft(this._values):void 0,index:ft(this._index),ptr:ft(this._ptr),size:ft(this._size),datatype:this._datatype});return p},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(p,m){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var v=this,b=this._size[0],y=this._size[1],S=function(_,M,w){return ci(p,_,[M,w],v,"map")};return d(this,0,b-1,0,y-1,S,m)};function d(p,m,v,b,y,S,x){var _=[],M=[],w=[],C=t,P=0;jt(p._datatype)&&(C=e.find(t,[p._datatype,p._datatype])||t,P=e.convert(0,p._datatype));for(var D=function(pt,Tt,wt){var St=S(pt,Tt,wt);C(St,P)||(_.push(St),M.push(Tt))},R=b;R<=y;R++){w.push(_.length);var W=p._ptr[R],G=p._ptr[R+1];if(x)for(var k=W;k<G;k++){var L=p._index[k];L>=m&&L<=v&&D(p._values[k],L-m,R-b)}else{for(var q={},Y=W;Y<G;Y++){var j=p._index[Y];q[j]=p._values[Y]}for(var J=m;J<=v;J++){var lt=J in q?q[J]:0;D(lt,J-m,R-b)}}}return w.push(_.length),new i({values:_,index:M,ptr:w,size:[v-m+1,y-b+1]})}i.prototype.forEach=function(p,m){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var v=this,b=this._size[0],y=this._size[1],S=0;S<y;S++){var x=this._ptr[S],_=this._ptr[S+1];if(m)for(var M=x;M<_;M++){var w=this._index[M];p(this._values[M],[w,S],v)}else{for(var C={},P=x;P<_;P++){var D=this._index[P];C[D]=this._values[P]}for(var R=0;R<b;R++){var W=R in C?C[R]:0;p(W,[R,S],v)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var p=this._size[1],m=0;m<p;m++)for(var v=this._ptr[m],b=this._ptr[m+1],y=v;y<b;y++){var S=this._index[y];yield{value:this._values[y],index:[S,m]}}},i.prototype.toArray=function(){return g(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return g(this._values,this._index,this._ptr,this._size,!1)};function g(p,m,v,b,y){var S=b[0],x=b[1],_=[],M,w;for(M=0;M<S;M++)for(_[M]=[],w=0;w<x;w++)_[M][w]=0;for(w=0;w<x;w++)for(var C=v[w],P=v[w+1],D=C;D<P;D++)M=m[D],_[M][w]=p?y?ft(p[D]):p[D]:1;return _}return i.prototype.format=function(p){for(var m=this._size[0],v=this._size[1],b=this.density(),y="Sparse Matrix ["+vt(m,p)+" x "+vt(v,p)+"] density: "+vt(b,p)+`
7514
+ `);return Object.freeze(Bi)};bn(he,Bi,{MATRIX_OPTIONS:yu,NUMBER_OPTIONS:vu});var ji=pn(Hi(),1);function N(r,e,t,n){function i(o){var a=mu(o,e.map(wd));return Sd(r,e,o),t(a)}return i.isFactory=!0,i.fn=r,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function Sd(r,e,t){var n=e.filter(o=>!Md(o)).every(o=>t[o]!==void 0);if(!n){var i=e.filter(o=>t[o]===void 0);throw new Error('Cannot create function "'.concat(r,'", ')+"some dependencies are missing: ".concat(i.map(o=>'"'.concat(o,'"')).join(", "),"."))}}function Md(r){return r&&r[0]==="?"}function wd(r){return r&&r[0]==="?"?r.slice(1):r}function tt(r){return typeof r=="boolean"?!0:isFinite(r)?r===Math.round(r):!1}var Eu=Math.sign||function(r){return r>0?1:r<0?-1:0},bu=Math.log2||function(e){return Math.log(e)/Math.LN2},Su=Math.log10||function(e){return Math.log(e)/Math.LN10},Mu=Math.log1p||function(r){return Math.log(r+1)},wu=Math.cbrt||function(e){if(e===0)return e;var t=e<0,n;return t&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,t?-n:n},Tu=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Wi(r,e,t){var n={2:"0b",8:"0o",16:"0x"},i=n[e],o="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!tt(t))throw new Error("size must be an integer");if(r>2**(t-1)-1||r<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!tt(r))throw new Error("Value must be an integer");r<0&&(r=r+2**t),o="i".concat(t)}var a="";return r<0&&(r=-r,a="-"),"".concat(a).concat(i).concat(r.toString(e)).concat(o)}function $n(r,e){if(typeof e=="function")return e(r);if(r===1/0)return"Infinity";if(r===-1/0)return"-Infinity";if(isNaN(r))return"NaN";var{notation:t,precision:n,wordSize:i}=qi(e);switch(t){case"fixed":return Xi(r,n);case"exponential":return Cu(r,n);case"engineering":return Td(r,n);case"bin":return Wi(r,2,i);case"oct":return Wi(r,8,i);case"hex":return Wi(r,16,i);case"auto":return Cd(r,n,e).replace(/((\.\d*?)(0+))($|e)/,function(){var o=arguments[2],a=arguments[4];return o!=="."?o+a:a});default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function qi(r){var e="auto",t,n;if(r!==void 0)if(nt(r))t=r;else if(it(r))t=r.toNumber();else if(wn(r))r.precision!==void 0&&(t=_u(r.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),r.wordSize!==void 0&&(n=_u(r.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),r.notation&&(e=r.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:t,wordSize:n}}function Cn(r){var e=String(r).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+r);var t=e[1],n=e[2],i=parseFloat(e[4]||"0"),o=n.indexOf(".");i+=o!==-1?o-1:n.length-1;var a=n.replace(".","").replace(/^0*/,function(c){return i-=c.length,""}).replace(/0*$/,"").split("").map(function(c){return parseInt(c)});return a.length===0&&(a.push(0),i++),{sign:t,coefficients:a,exponent:i}}function Td(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=Cn(r),n=Kr(t,e),i=n.exponent,o=n.coefficients,a=i%3===0?i:i<0?i-3-i%3:i-i%3;if(nt(e))for(;e>o.length||i-a+1>o.length;)o.push(0);else for(var c=Math.abs(i-a)-(o.length-1),l=0;l<c;l++)o.push(0);for(var s=Math.abs(i-a),u=1;s>0;)u++,s--;var h=o.slice(u).join(""),f=nt(e)&&h.length||h.match(/[1-9]/)?"."+h:"",d=o.slice(0,u).join("")+f+"e"+(i>=0?"+":"")+a.toString();return n.sign+d}function Xi(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=Cn(r),n=typeof e=="number"?Kr(t,t.exponent+1+e):t,i=n.coefficients,o=n.exponent+1,a=o+(e||0);return i.length<a&&(i=i.concat(Tn(a-i.length))),o<0&&(i=Tn(-o+1).concat(i),o=1),o<i.length&&i.splice(o,0,o===0?"0.":"."),n.sign+i.join("")}function Cu(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=Cn(r),n=e?Kr(t,e):t,i=n.coefficients,o=n.exponent;i.length<e&&(i=i.concat(Tn(e-i.length)));var a=i.shift();return n.sign+a+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function Cd(r,e,t){if(isNaN(r)||!isFinite(r))return String(r);var n=xu(t?.lowerExp,-3),i=xu(t?.upperExp,5),o=Cn(r),a=e?Kr(o,e):o;if(a.exponent<n||a.exponent>=i)return Cu(r,e);var c=a.coefficients,l=a.exponent;c.length<e&&(c=c.concat(Tn(e-c.length))),c=c.concat(Tn(l-c.length+1+(c.length<e?e-c.length:0))),c=Tn(-l).concat(c);var s=l>0?l:0;return s<c.length-1&&c.splice(s+1,0,"."),a.sign+c.join("")}function Kr(r,e){for(var t={sign:r.sign,coefficients:r.coefficients,exponent:r.exponent},n=t.coefficients;e<=0;)n.unshift(0),t.exponent++,e++;if(n.length>e){var i=n.splice(e,n.length-e);if(i[0]>=5){var o=e-1;for(n[o]++;n[o]===10;)n.pop(),o===0&&(n.unshift(0),t.exponent++,o++),o--,n[o]++}}return t}function Tn(r){for(var e=[],t=0;t<r;t++)e.push(0);return e}function Au(r){return r.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var MM=Number.EPSILON||2220446049250313e-31;function pe(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-8,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(t<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return isNaN(r)||isNaN(e)?!1:!isFinite(r)||!isFinite(e)?r===e:r===e?!0:Math.abs(r-e)<=Math.max(t*Math.max(Math.abs(r),Math.abs(e)),n)}function _u(r,e){if(nt(r))return r;if(it(r))return r.toNumber();e()}function xu(r,e){return nt(r)?r:it(r)?r.toNumber():e}var Pu=function(){return Pu=ji.default.create,ji.default},Ad=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],Yi=N("typed",Ad,function(e){var{BigNumber:t,Complex:n,DenseMatrix:i,Fraction:o}=e,a=Pu();return a.clear(),a.addTypes([{name:"number",test:nt},{name:"Complex",test:zi},{name:"BigNumber",test:it},{name:"bigint",test:Ga},{name:"Fraction",test:Gi},{name:"Unit",test:$r},{name:"identifier",test:c=>jt&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\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uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB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0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(c)},{name:"string",test:jt},{name:"Chain",test:gu},{name:"Array",test:yt},{name:"Matrix",test:ot},{name:"DenseMatrix",test:ka},{name:"SparseMatrix",test:Va},{name:"Range",test:Ha},{name:"Index",test:Mn},{name:"boolean",test:Wa},{name:"ResultSet",test:qa},{name:"Help",test:Xa},{name:"function",test:ja},{name:"Date",test:Ya},{name:"RegExp",test:$a},{name:"null",test:Ka},{name:"undefined",test:Ja},{name:"AccessorNode",test:Qa},{name:"ArrayNode",test:tu},{name:"AssignmentNode",test:eu},{name:"BlockNode",test:nu},{name:"ConditionalNode",test:ru},{name:"ConstantNode",test:iu},{name:"FunctionNode",test:su},{name:"FunctionAssignmentNode",test:ou},{name:"IndexNode",test:au},{name:"Node",test:uu},{name:"ObjectNode",test:lu},{name:"OperatorNode",test:cu},{name:"ParenthesisNode",test:hu},{name:"RangeNode",test:pu},{name:"RelationalNode",test:fu},{name:"SymbolNode",test:du},{name:"Map",test:Za},{name:"Object",test:wn}]),a.addConversions([{from:"number",to:"BigNumber",convert:function(l){if(t||Jr(l),Au(l)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+l+"). Use function bignumber(x) to convert to BigNumber.");return new t(l)}},{from:"number",to:"Complex",convert:function(l){return n||Qr(l),new n(l,0)}},{from:"BigNumber",to:"Complex",convert:function(l){return n||Qr(l),new n(l.toNumber(),0)}},{from:"bigint",to:"number",convert:function(l){if(l>Number.MAX_SAFE_INTEGER)throw new TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: "+l+")");return Number(l)}},{from:"bigint",to:"BigNumber",convert:function(l){return t||Jr(l),new t(l.toString())}},{from:"bigint",to:"Fraction",convert:function(l){return o||ti(l),new o(l.toString())}},{from:"Fraction",to:"BigNumber",convert:function(l){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(l){return n||Qr(l),new n(l.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(l){o||ti(l);var s=new o(l);if(s.valueOf()!==l)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+l+"). Use function fraction(x) to convert to Fraction.");return s}},{from:"string",to:"number",convert:function(l){var s=Number(l);if(isNaN(s))throw new Error('Cannot convert "'+l+'" to a number');return s}},{from:"string",to:"BigNumber",convert:function(l){t||Jr(l);try{return new t(l)}catch{throw new Error('Cannot convert "'+l+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(l){try{return BigInt(l)}catch{throw new Error('Cannot convert "'+l+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(l){o||ti(l);try{return new o(l)}catch{throw new Error('Cannot convert "'+l+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(l){n||Qr(l);try{return new n(l)}catch{throw new Error('Cannot convert "'+l+'" to Complex')}}},{from:"boolean",to:"number",convert:function(l){return+l}},{from:"boolean",to:"BigNumber",convert:function(l){return t||Jr(l),new t(+l)}},{from:"boolean",to:"bigint",convert:function(l){return BigInt(+l)}},{from:"boolean",to:"Fraction",convert:function(l){return o||ti(l),new o(+l)}},{from:"boolean",to:"string",convert:function(l){return String(l)}},{from:"Array",to:"Matrix",convert:function(l){return i||Pd(),new i(l)}},{from:"Matrix",to:"Array",convert:function(l){return l.valueOf()}}]),a.onMismatch=(c,l,s)=>{var u=a.createError(c,l,s);if(["wrongType","mismatch"].includes(u.data.category)&&l.length===1&&Fe(l[0])&&s.some(f=>!f.params.includes(","))){var h=new TypeError("Function '".concat(c,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(c,")'."));throw h.data=u.data,h}throw u},a.onMismatch=(c,l,s)=>{var u=a.createError(c,l,s);if(["wrongType","mismatch"].includes(u.data.category)&&l.length===1&&Fe(l[0])&&s.some(f=>!f.params.includes(","))){var h=new TypeError("Function '".concat(c,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(c,")'."));throw h.data=u.data,h}throw u},a});function Jr(r){throw new Error("Cannot convert value ".concat(r," into a BigNumber: no class 'BigNumber' provided"))}function Qr(r){throw new Error("Cannot convert value ".concat(r," into a Complex number: no class 'Complex' provided"))}function Pd(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function ti(r){throw new Error("Cannot convert value ".concat(r," into a Fraction, no class 'Fraction' provided."))}var An=9e15,Ke=1e9,$i="0123456789abcdef",ni="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",ri="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Zi={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-An,maxE:An,crypto:!1},Nu,Ue,K=!0,oi="[DecimalError] ",Ze=oi+"Invalid argument: ",Lu=oi+"Precision limit exceeded",Ou=oi+"crypto unavailable",Fu="[object Decimal]",Wt=Math.floor,Pt=Math.pow,Dd=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Id=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Rd=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Uu=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ve=1e7,Z=7,Nd=9007199254740991,Ld=ni.length-1,Ki=ri.length-1,F={toStringTag:Fu};F.absoluteValue=F.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),$(r)};F.ceil=function(){return $(new this.constructor(this),this.e+1,2)};F.clampedTo=F.clamp=function(r,e){var t,n=this,i=n.constructor;if(r=new i(r),e=new i(e),!r.s||!e.s)return new i(NaN);if(r.gt(e))throw Error(Ze+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new i(n)};F.comparedTo=F.cmp=function(r){var e,t,n,i,o=this,a=o.d,c=(r=new o.constructor(r)).d,l=o.s,s=r.s;if(!a||!c)return!l||!s?NaN:l!==s?l:a===c?0:!a^l<0?1:-1;if(!a[0]||!c[0])return a[0]?l:c[0]?-s:0;if(l!==s)return l;if(o.e!==r.e)return o.e>r.e^l<0?1:-1;for(n=a.length,i=c.length,e=0,t=n<i?n:i;e<t;++e)if(a[e]!==c[e])return a[e]>c[e]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1};F.cosine=F.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+Z,n.rounding=1,t=Od(n,Vu(n,t)),n.precision=r,n.rounding=e,$(Ue==2||Ue==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};F.cubeRoot=F.cbrt=function(){var r,e,t,n,i,o,a,c,l,s,u=this,h=u.constructor;if(!u.isFinite()||u.isZero())return new h(u);for(K=!1,o=u.s*Pt(u.s*u,1/3),!o||Math.abs(o)==1/0?(t=Bt(u.d),r=u.e,(o=(r-t.length+1)%3)&&(t+=o==1||o==-2?"0":"00"),o=Pt(t,1/3),r=Wt((r+1)/3)-(r%3==(r<0?-1:2)),o==1/0?t="5e"+r:(t=o.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new h(t),n.s=u.s):n=new h(o.toString()),a=(r=h.precision)+3;;)if(c=n,l=c.times(c).times(c),s=l.plus(u),n=dt(s.plus(u).times(c),s.plus(l),a+2,1),Bt(c.d).slice(0,a)===(t=Bt(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!i&&t=="4999"){if(!i&&($(c,r+1,0),c.times(c).times(c).eq(u))){n=c;break}a+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&($(n,r+1,1),e=!n.times(n).times(n).eq(u));break}return K=!0,$(n,r,h.rounding,e)};F.decimalPlaces=F.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-Wt(this.e/Z))*Z,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};F.dividedBy=F.div=function(r){return dt(this,new this.constructor(r))};F.dividedToIntegerBy=F.divToInt=function(r){var e=this,t=e.constructor;return $(dt(e,new t(r),0,1,1),t.precision,t.rounding)};F.equals=F.eq=function(r){return this.cmp(r)===0};F.floor=function(){return $(new this.constructor(this),this.e+1,3)};F.greaterThan=F.gt=function(r){return this.cmp(r)>0};F.greaterThanOrEqualTo=F.gte=function(r){var e=this.cmp(r);return e==1||e===0};F.hyperbolicCosine=F.cosh=function(){var r,e,t,n,i,o=this,a=o.constructor,c=new a(1);if(!o.isFinite())return new a(o.s?1/0:NaN);if(o.isZero())return c;t=a.precision,n=a.rounding,a.precision=t+Math.max(o.e,o.sd())+4,a.rounding=1,i=o.d.length,i<32?(r=Math.ceil(i/3),e=(1/ai(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),o=Pn(a,1,o.times(e),new a(1),!0);for(var l,s=r,u=new a(8);s--;)l=o.times(o),o=c.minus(l.times(u.minus(l.times(u))));return $(o,a.precision=t,a.rounding=n,!0)};F.hyperbolicSine=F.sinh=function(){var r,e,t,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,t=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,n=i.d.length,n<3)i=Pn(o,2,i,i,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,i=i.times(1/ai(5,r)),i=Pn(o,2,i,i,!0);for(var a,c=new o(5),l=new o(16),s=new o(20);r--;)a=i.times(i),i=i.times(c.plus(a.times(l.times(a).plus(s))))}return o.precision=e,o.rounding=t,$(i,e,t,!0)};F.hyperbolicTangent=F.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,dt(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};F.inverseCosine=F.acos=function(){var r,e=this,t=e.constructor,n=e.abs().cmp(1),i=t.precision,o=t.rounding;return n!==-1?n===0?e.isNeg()?ye(t,i,o):new t(0):new t(NaN):e.isZero()?ye(t,i+4,o).times(.5):(t.precision=i+6,t.rounding=1,e=e.asin(),r=ye(t,i+4,o).times(.5),t.precision=i,t.rounding=o,r.minus(e))};F.inverseHyperbolicCosine=F.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,K=!1,t=t.times(t).minus(1).sqrt().plus(t),K=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};F.inverseHyperbolicSine=F.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,K=!1,t=t.times(t).plus(1).sqrt().plus(t),K=!0,n.precision=r,n.rounding=e,t.ln())};F.inverseHyperbolicTangent=F.atanh=function(){var r,e,t,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(r=o.precision,e=o.rounding,n=i.sd(),Math.max(n,r)<2*-i.e-1?$(new o(i),r,e,!0):(o.precision=t=n-i.e,i=dt(i.plus(1),new o(1).minus(i),t+r,1),o.precision=r+4,o.rounding=1,i=i.ln(),o.precision=r,o.rounding=e,i.times(.5))):new o(NaN)};F.inverseSine=F.asin=function(){var r,e,t,n,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),t=o.precision,n=o.rounding,e!==-1?e===0?(r=ye(o,t+4,n).times(.5),r.s=i.s,r):new o(NaN):(o.precision=t+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=t,o.rounding=n,i.times(2)))};F.inverseTangent=F.atan=function(){var r,e,t,n,i,o,a,c,l,s=this,u=s.constructor,h=u.precision,f=u.rounding;if(s.isFinite()){if(s.isZero())return new u(s);if(s.abs().eq(1)&&h+4<=Ki)return a=ye(u,h+4,f).times(.25),a.s=s.s,a}else{if(!s.s)return new u(NaN);if(h+4<=Ki)return a=ye(u,h+4,f).times(.5),a.s=s.s,a}for(u.precision=c=h+10,u.rounding=1,t=Math.min(28,c/Z+2|0),r=t;r;--r)s=s.div(s.times(s).plus(1).sqrt().plus(1));for(K=!1,e=Math.ceil(c/Z),n=1,l=s.times(s),a=new u(s),i=s;r!==-1;)if(i=i.times(l),o=a.minus(i.div(n+=2)),i=i.times(l),a=o.plus(i.div(n+=2)),a.d[e]!==void 0)for(r=e;a.d[r]===o.d[r]&&r--;);return t&&(a=a.times(2<<t-1)),K=!0,$(a,u.precision=h,u.rounding=f,!0)};F.isFinite=function(){return!!this.d};F.isInteger=F.isInt=function(){return!!this.d&&Wt(this.e/Z)>this.d.length-2};F.isNaN=function(){return!this.s};F.isNegative=F.isNeg=function(){return this.s<0};F.isPositive=F.isPos=function(){return this.s>0};F.isZero=function(){return!!this.d&&this.d[0]===0};F.lessThan=F.lt=function(r){return this.cmp(r)<0};F.lessThanOrEqualTo=F.lte=function(r){return this.cmp(r)<1};F.logarithm=F.log=function(r){var e,t,n,i,o,a,c,l,s=this,u=s.constructor,h=u.precision,f=u.rounding,d=5;if(r==null)r=new u(10),e=!0;else{if(r=new u(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new u(NaN);e=r.eq(10)}if(t=s.d,s.s<0||!t||!t[0]||s.eq(1))return new u(t&&!t[0]?-1/0:s.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)o=!0;else{for(i=t[0];i%10===0;)i/=10;o=i!==1}if(K=!1,c=h+d,a=$e(s,c),n=e?ii(u,c+10):$e(r,c),l=dt(a,n,c,1),Zn(l.d,i=h,f))do if(c+=10,a=$e(s,c),n=e?ii(u,c+10):$e(r,c),l=dt(a,n,c,1),!o){+Bt(l.d).slice(i+1,i+15)+1==1e14&&(l=$(l,h+1,0));break}while(Zn(l.d,i+=10,f));return K=!0,$(l,h,f)};F.minus=F.sub=function(r){var e,t,n,i,o,a,c,l,s,u,h,f,d=this,g=d.constructor;if(r=new g(r),!d.d||!r.d)return!d.s||!r.s?r=new g(NaN):d.d?r.s=-r.s:r=new g(r.d||d.s!==r.s?d:NaN),r;if(d.s!=r.s)return r.s=-r.s,d.plus(r);if(s=d.d,f=r.d,c=g.precision,l=g.rounding,!s[0]||!f[0]){if(f[0])r.s=-r.s;else if(s[0])r=new g(d);else return new g(l===3?-0:0);return K?$(r,c,l):r}if(t=Wt(r.e/Z),u=Wt(d.e/Z),s=s.slice(),o=u-t,o){for(h=o<0,h?(e=s,o=-o,a=f.length):(e=f,t=u,a=s.length),n=Math.max(Math.ceil(c/Z),a)+2,o>n&&(o=n,e.length=1),e.reverse(),n=o;n--;)e.push(0);e.reverse()}else{for(n=s.length,a=f.length,h=n<a,h&&(a=n),n=0;n<a;n++)if(s[n]!=f[n]){h=s[n]<f[n];break}o=0}for(h&&(e=s,s=f,f=e,r.s=-r.s),a=s.length,n=f.length-a;n>0;--n)s[a++]=0;for(n=f.length;n>o;){if(s[--n]<f[n]){for(i=n;i&&s[--i]===0;)s[i]=ve-1;--s[i],s[n]+=ve}s[n]-=f[n]}for(;s[--a]===0;)s.pop();for(;s[0]===0;s.shift())--t;return s[0]?(r.d=s,r.e=si(s,t),K?$(r,c,l):r):new g(l===3?-0:0)};F.modulo=F.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?$(new n(t),n.precision,n.rounding):(K=!1,n.modulo==9?(e=dt(t,r.abs(),0,3,1),e.s*=r.s):e=dt(t,r,0,n.modulo,1),e=e.times(r),K=!0,t.minus(e))};F.naturalExponential=F.exp=function(){return Ji(this)};F.naturalLogarithm=F.ln=function(){return $e(this)};F.negated=F.neg=function(){var r=new this.constructor(this);return r.s=-r.s,$(r)};F.plus=F.add=function(r){var e,t,n,i,o,a,c,l,s,u,h=this,f=h.constructor;if(r=new f(r),!h.d||!r.d)return!h.s||!r.s?r=new f(NaN):h.d||(r=new f(r.d||h.s===r.s?h:NaN)),r;if(h.s!=r.s)return r.s=-r.s,h.minus(r);if(s=h.d,u=r.d,c=f.precision,l=f.rounding,!s[0]||!u[0])return u[0]||(r=new f(h)),K?$(r,c,l):r;if(o=Wt(h.e/Z),n=Wt(r.e/Z),s=s.slice(),i=o-n,i){for(i<0?(t=s,i=-i,a=u.length):(t=u,n=o,a=s.length),o=Math.ceil(c/Z),a=o>a?o+1:a+1,i>a&&(i=a,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(a=s.length,i=u.length,a-i<0&&(i=a,t=u,u=s,s=t),e=0;i;)e=(s[--i]=s[i]+u[i]+e)/ve|0,s[i]%=ve;for(e&&(s.unshift(e),++n),a=s.length;s[--a]==0;)s.pop();return r.d=s,r.e=si(s,n),K?$(r,c,l):r};F.precision=F.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Ze+r);return t.d?(e=Bu(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};F.round=function(){var r=this,e=r.constructor;return $(new e(r),r.e+1,e.rounding)};F.sine=F.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+Z,n.rounding=1,t=Ud(n,Vu(n,t)),n.precision=r,n.rounding=e,$(Ue>2?t.neg():t,r,e,!0)):new n(NaN)};F.squareRoot=F.sqrt=function(){var r,e,t,n,i,o,a=this,c=a.d,l=a.e,s=a.s,u=a.constructor;if(s!==1||!c||!c[0])return new u(!s||s<0&&(!c||c[0])?NaN:c?a:1/0);for(K=!1,s=Math.sqrt(+a),s==0||s==1/0?(e=Bt(c),(e.length+l)%2==0&&(e+="0"),s=Math.sqrt(e),l=Wt((l+1)/2)-(l<0||l%2),s==1/0?e="5e"+l:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+l),n=new u(e)):n=new u(s.toString()),t=(l=u.precision)+3;;)if(o=n,n=o.plus(dt(a,o,t+2,1)).times(.5),Bt(o.d).slice(0,t)===(e=Bt(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&($(o,l+1,0),o.times(o).eq(a))){n=o;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&($(n,l+1,1),r=!n.times(n).eq(a));break}return K=!0,$(n,l,u.rounding,r)};F.tangent=F.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=dt(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,$(Ue==2||Ue==4?t.neg():t,r,e,!0)):new n(NaN)};F.times=F.mul=function(r){var e,t,n,i,o,a,c,l,s,u=this,h=u.constructor,f=u.d,d=(r=new h(r)).d;if(r.s*=u.s,!f||!f[0]||!d||!d[0])return new h(!r.s||f&&!f[0]&&!d||d&&!d[0]&&!f?NaN:!f||!d?r.s/0:r.s*0);for(t=Wt(u.e/Z)+Wt(r.e/Z),l=f.length,s=d.length,l<s&&(o=f,f=d,d=o,a=l,l=s,s=a),o=[],a=l+s,n=a;n--;)o.push(0);for(n=s;--n>=0;){for(e=0,i=l+n;i>n;)c=o[i]+d[n]*f[i-n-1]+e,o[i--]=c%ve|0,e=c/ve|0;o[i]=(o[i]+e)%ve|0}for(;!o[--a];)o.pop();return e?++t:o.shift(),r.d=o,r.e=si(o,t),K?$(r,h.precision,h.rounding):r};F.toBinary=function(r,e){return to(this,2,r,e)};F.toDecimalPlaces=F.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Qt(r,0,Ke),e===void 0?e=n.rounding:Qt(e,0,8),$(t,r+t.e+1,e))};F.toExponential=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Pe(n,!0):(Qt(r,0,Ke),e===void 0?e=i.rounding:Qt(e,0,8),n=$(new i(n),r+1,e),t=Pe(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};F.toFixed=function(r,e){var t,n,i=this,o=i.constructor;return r===void 0?t=Pe(i):(Qt(r,0,Ke),e===void 0?e=o.rounding:Qt(e,0,8),n=$(new o(i),r+i.e+1,e),t=Pe(n,!1,r+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};F.toFraction=function(r){var e,t,n,i,o,a,c,l,s,u,h,f,d=this,g=d.d,p=d.constructor;if(!g)return new p(d);if(s=t=new p(1),n=l=new p(0),e=new p(n),o=e.e=Bu(g)-d.e-1,a=o%Z,e.d[0]=Pt(10,a<0?Z+a:a),r==null)r=o>0?e:s;else{if(c=new p(r),!c.isInt()||c.lt(s))throw Error(Ze+c);r=c.gt(e)?o>0?e:s:c}for(K=!1,c=new p(Bt(g)),u=p.precision,p.precision=o=g.length*Z*2;h=dt(c,e,0,1,1),i=t.plus(h.times(n)),i.cmp(r)!=1;)t=n,n=i,i=s,s=l.plus(h.times(i)),l=i,i=e,e=c.minus(h.times(i)),c=i;return i=dt(r.minus(t),n,0,1,1),l=l.plus(i.times(s)),t=t.plus(i.times(n)),l.s=s.s=d.s,f=dt(s,n,o,1).minus(d).abs().cmp(dt(l,t,o,1).minus(d).abs())<1?[s,n]:[l,t],p.precision=u,K=!0,f};F.toHexadecimal=F.toHex=function(r,e){return to(this,16,r,e)};F.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:Qt(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(K=!1,t=dt(t,r,0,e,1).times(r),K=!0,$(t)):(r.s=t.s,t=r),t};F.toNumber=function(){return+this};F.toOctal=function(r,e){return to(this,8,r,e)};F.toPower=F.pow=function(r){var e,t,n,i,o,a,c=this,l=c.constructor,s=+(r=new l(r));if(!c.d||!r.d||!c.d[0]||!r.d[0])return new l(Pt(+c,s));if(c=new l(c),c.eq(1))return c;if(n=l.precision,o=l.rounding,r.eq(1))return $(c,n,o);if(e=Wt(r.e/Z),e>=r.d.length-1&&(t=s<0?-s:s)<=Nd)return i=zu(l,c,t,n),r.s<0?new l(1).div(i):$(i,n,o);if(a=c.s,a<0){if(e<r.d.length-1)return new l(NaN);if(r.d[e]&1||(a=1),c.e==0&&c.d[0]==1&&c.d.length==1)return c.s=a,c}return t=Pt(+c,s),e=t==0||!isFinite(t)?Wt(s*(Math.log("0."+Bt(c.d))/Math.LN10+c.e+1)):new l(t+"").e,e>l.maxE+1||e<l.minE-1?new l(e>0?a/0:0):(K=!1,l.rounding=c.s=1,t=Math.min(12,(e+"").length),i=Ji(r.times($e(c,n+t)),n),i.d&&(i=$(i,n+5,1),Zn(i.d,n,o)&&(e=n+10,i=$(Ji(r.times($e(c,e+t)),e),e+5,1),+Bt(i.d).slice(n+1,n+15)+1==1e14&&(i=$(i,n+1,0)))),i.s=a,K=!0,l.rounding=o,$(i,n,o))};F.toPrecision=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Pe(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Qt(r,1,Ke),e===void 0?e=i.rounding:Qt(e,0,8),n=$(new i(n),r,e),t=Pe(n,r<=n.e||n.e<=i.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};F.toSignificantDigits=F.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Qt(r,1,Ke),e===void 0?e=n.rounding:Qt(e,0,8)),$(new n(t),r,e)};F.toString=function(){var r=this,e=r.constructor,t=Pe(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};F.truncated=F.trunc=function(){return $(new this.constructor(this),this.e+1,1)};F.valueOf=F.toJSON=function(){var r=this,e=r.constructor,t=Pe(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function Bt(r){var e,t,n,i=r.length-1,o="",a=r[0];if(i>0){for(o+=a,e=1;e<i;e++)n=r[e]+"",t=Z-n.length,t&&(o+=Ye(t)),o+=n;a=r[e],n=a+"",t=Z-n.length,t&&(o+=Ye(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return o+a}function Qt(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Ze+r)}function Zn(r,e,t,n){var i,o,a,c;for(o=r[0];o>=10;o/=10)--e;return--e<0?(e+=Z,i=0):(i=Math.ceil((e+1)/Z),e%=Z),o=Pt(10,Z-e),c=r[i]%o|0,n==null?e<3?(e==0?c=c/100|0:e==1&&(c=c/10|0),a=t<4&&c==99999||t>3&&c==49999||c==5e4||c==0):a=(t<4&&c+1==o||t>3&&c+1==o/2)&&(r[i+1]/o/100|0)==Pt(10,e-2)-1||(c==o/2||c==0)&&(r[i+1]/o/100|0)==0:e<4?(e==0?c=c/1e3|0:e==1?c=c/100|0:e==2&&(c=c/10|0),a=(n||t<4)&&c==9999||!n&&t>3&&c==4999):a=((n||t<4)&&c+1==o||!n&&t>3&&c+1==o/2)&&(r[i+1]/o/1e3|0)==Pt(10,e-3)-1,a}function ei(r,e,t){for(var n,i=[0],o,a=0,c=r.length;a<c;){for(o=i.length;o--;)i[o]*=e;for(i[0]+=$i.indexOf(r.charAt(a++)),n=0;n<i.length;n++)i[n]>t-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/t|0,i[n]%=t)}return i.reverse()}function Od(r,e){var t,n,i;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),i=(1/ai(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),r.precision+=t,e=Pn(r,1,e.times(i),new r(1));for(var o=t;o--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return r.precision-=t,e}var dt=function(){function r(n,i,o){var a,c=0,l=n.length;for(n=n.slice();l--;)a=n[l]*i+c,n[l]=a%o|0,c=a/o|0;return c&&n.unshift(c),n}function e(n,i,o,a){var c,l;if(o!=a)l=o>a?1:-1;else for(c=l=0;c<o;c++)if(n[c]!=i[c]){l=n[c]>i[c]?1:-1;break}return l}function t(n,i,o,a){for(var c=0;o--;)n[o]-=c,c=n[o]<i[o]?1:0,n[o]=c*a+n[o]-i[o];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,o,a,c,l){var s,u,h,f,d,g,p,m,v,b,y,S,x,_,M,w,C,P,D,R,W=n.constructor,G=n.s==i.s?1:-1,k=n.d,L=i.d;if(!k||!k[0]||!L||!L[0])return new W(!n.s||!i.s||(k?L&&k[0]==L[0]:!L)?NaN:k&&k[0]==0||!L?G*0:G/0);for(l?(d=1,u=n.e-i.e):(l=ve,d=Z,u=Wt(n.e/d)-Wt(i.e/d)),D=L.length,C=k.length,v=new W(G),b=v.d=[],h=0;L[h]==(k[h]||0);h++);if(L[h]>(k[h]||0)&&u--,o==null?(_=o=W.precision,a=W.rounding):c?_=o+(n.e-i.e)+1:_=o,_<0)b.push(1),g=!0;else{if(_=_/d+2|0,h=0,D==1){for(f=0,L=L[0],_++;(h<C||f)&&_--;h++)M=f*l+(k[h]||0),b[h]=M/L|0,f=M%L|0;g=f||h<C}else{for(f=l/(L[0]+1)|0,f>1&&(L=r(L,f,l),k=r(k,f,l),D=L.length,C=k.length),w=D,y=k.slice(0,D),S=y.length;S<D;)y[S++]=0;R=L.slice(),R.unshift(0),P=L[0],L[1]>=l/2&&++P;do f=0,s=e(L,y,D,S),s<0?(x=y[0],D!=S&&(x=x*l+(y[1]||0)),f=x/P|0,f>1?(f>=l&&(f=l-1),p=r(L,f,l),m=p.length,S=y.length,s=e(p,y,m,S),s==1&&(f--,t(p,D<m?R:L,m,l))):(f==0&&(s=f=1),p=L.slice()),m=p.length,m<S&&p.unshift(0),t(y,p,S,l),s==-1&&(S=y.length,s=e(L,y,D,S),s<1&&(f++,t(y,D<S?R:L,S,l))),S=y.length):s===0&&(f++,y=[0]),b[h++]=f,s&&y[0]?y[S++]=k[w]||0:(y=[k[w]],S=1);while((w++<C||y[0]!==void 0)&&_--);g=y[0]!==void 0}b[0]||b.shift()}if(d==1)v.e=u,Nu=g;else{for(h=1,f=b[0];f>=10;f/=10)h++;v.e=h+u*d-1,$(v,c?o+v.e+1:o,a,g)}return v}}();function $(r,e,t,n){var i,o,a,c,l,s,u,h,f,d=r.constructor;t:if(e!=null){if(h=r.d,!h)return r;for(i=1,c=h[0];c>=10;c/=10)i++;if(o=e-i,o<0)o+=Z,a=e,u=h[f=0],l=u/Pt(10,i-a-1)%10|0;else if(f=Math.ceil((o+1)/Z),c=h.length,f>=c)if(n){for(;c++<=f;)h.push(0);u=l=0,i=1,o%=Z,a=o-Z+1}else break t;else{for(u=c=h[f],i=1;c>=10;c/=10)i++;o%=Z,a=o-Z+i,l=a<0?0:u/Pt(10,i-a-1)%10|0}if(n=n||e<0||h[f+1]!==void 0||(a<0?u:u%Pt(10,i-a-1)),s=t<4?(l||n)&&(t==0||t==(r.s<0?3:2)):l>5||l==5&&(t==4||n||t==6&&(o>0?a>0?u/Pt(10,i-a):0:h[f-1])%10&1||t==(r.s<0?8:7)),e<1||!h[0])return h.length=0,s?(e-=r.e+1,h[0]=Pt(10,(Z-e%Z)%Z),r.e=-e||0):h[0]=r.e=0,r;if(o==0?(h.length=f,c=1,f--):(h.length=f+1,c=Pt(10,Z-o),h[f]=a>0?(u/Pt(10,i-a)%Pt(10,a)|0)*c:0),s)for(;;)if(f==0){for(o=1,a=h[0];a>=10;a/=10)o++;for(a=h[0]+=c,c=1;a>=10;a/=10)c++;o!=c&&(r.e++,h[0]==ve&&(h[0]=1));break}else{if(h[f]+=c,h[f]!=ve)break;h[f--]=0,c=1}for(o=h.length;h[--o]===0;)h.pop()}return K&&(r.e>d.maxE?(r.d=null,r.e=NaN):r.e<d.minE&&(r.e=0,r.d=[0])),r}function Pe(r,e,t){if(!r.isFinite())return ku(r);var n,i=r.e,o=Bt(r.d),a=o.length;return e?(t&&(n=t-a)>0?o=o.charAt(0)+"."+o.slice(1)+Ye(n):a>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(r.e<0?"e":"e+")+r.e):i<0?(o="0."+Ye(-i-1)+o,t&&(n=t-a)>0&&(o+=Ye(n))):i>=a?(o+=Ye(i+1-a),t&&(n=t-i-1)>0&&(o=o+"."+Ye(n))):((n=i+1)<a&&(o=o.slice(0,n)+"."+o.slice(n)),t&&(n=t-a)>0&&(i+1===a&&(o+="."),o+=Ye(n))),o}function si(r,e){var t=r[0];for(e*=Z;t>=10;t/=10)e++;return e}function ii(r,e,t){if(e>Ld)throw K=!0,t&&(r.precision=t),Error(Lu);return $(new r(ni),e,1,!0)}function ye(r,e,t){if(e>Ki)throw Error(Lu);return $(new r(ri),e,t,!0)}function Bu(r){var e=r.length-1,t=e*Z+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}function Ye(r){for(var e="";r--;)e+="0";return e}function zu(r,e,t,n){var i,o=new r(1),a=Math.ceil(n/Z+4);for(K=!1;;){if(t%2&&(o=o.times(e),Iu(o.d,a)&&(i=!0)),t=Wt(t/2),t===0){t=o.d.length-1,i&&o.d[t]===0&&++o.d[t];break}e=e.times(e),Iu(e.d,a)}return K=!0,o}function Du(r){return r.d[r.d.length-1]&1}function Gu(r,e,t){for(var n,i=new r(e[0]),o=0;++o<e.length;)if(n=new r(e[o]),n.s)i[t](n)&&(i=n);else{i=n;break}return i}function Ji(r,e){var t,n,i,o,a,c,l,s=0,u=0,h=0,f=r.constructor,d=f.rounding,g=f.precision;if(!r.d||!r.d[0]||r.e>17)return new f(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(K=!1,l=g):l=e,c=new f(.03125);r.e>-2;)r=r.times(c),h+=5;for(n=Math.log(Pt(2,h))/Math.LN10*2+5|0,l+=n,t=o=a=new f(1),f.precision=l;;){if(o=$(o.times(r),l,1),t=t.times(++u),c=a.plus(dt(o,t,l,1)),Bt(c.d).slice(0,l)===Bt(a.d).slice(0,l)){for(i=h;i--;)a=$(a.times(a),l,1);if(e==null)if(s<3&&Zn(a.d,l-n,d,s))f.precision=l+=10,t=o=c=new f(1),u=0,s++;else return $(a,f.precision=g,d,K=!0);else return f.precision=g,a}a=c}}function $e(r,e){var t,n,i,o,a,c,l,s,u,h,f,d=1,g=10,p=r,m=p.d,v=p.constructor,b=v.rounding,y=v.precision;if(p.s<0||!m||!m[0]||!p.e&&m[0]==1&&m.length==1)return new v(m&&!m[0]?-1/0:p.s!=1?NaN:m?0:p);if(e==null?(K=!1,u=y):u=e,v.precision=u+=g,t=Bt(m),n=t.charAt(0),Math.abs(o=p.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)p=p.times(r),t=Bt(p.d),n=t.charAt(0),d++;o=p.e,n>1?(p=new v("0."+t),o++):p=new v(n+"."+t.slice(1))}else return s=ii(v,u+2,y).times(o+""),p=$e(new v(n+"."+t.slice(1)),u-g).plus(s),v.precision=y,e==null?$(p,y,b,K=!0):p;for(h=p,l=a=p=dt(p.minus(1),p.plus(1),u,1),f=$(p.times(p),u,1),i=3;;){if(a=$(a.times(f),u,1),s=l.plus(dt(a,new v(i),u,1)),Bt(s.d).slice(0,u)===Bt(l.d).slice(0,u))if(l=l.times(2),o!==0&&(l=l.plus(ii(v,u+2,y).times(o+""))),l=dt(l,new v(d),u,1),e==null)if(Zn(l.d,u-g,b,c))v.precision=u+=g,s=a=p=dt(h.minus(1),h.plus(1),u,1),f=$(p.times(p),u,1),i=c=1;else return $(l,v.precision=y,b,K=!0);else return v.precision=y,l;l=s,i+=2}}function ku(r){return String(r.s*r.s/0)}function Qi(r,e){var t,n,i;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%Z,t<0&&(n+=Z),n<i){for(n&&r.d.push(+e.slice(0,n)),i-=Z;n<i;)r.d.push(+e.slice(n,n+=Z));e=e.slice(n),n=Z-e.length}else n-=i;for(;n--;)e+="0";r.d.push(+e),K&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}function Fd(r,e){var t,n,i,o,a,c,l,s,u;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Uu.test(e))return Qi(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(Id.test(e))t=16,e=e.toLowerCase();else if(Dd.test(e))t=2;else if(Rd.test(e))t=8;else throw Error(Ze+e);for(o=e.search(/p/i),o>0?(l=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),o=e.indexOf("."),a=o>=0,n=r.constructor,a&&(e=e.replace(".",""),c=e.length,o=c-o,i=zu(n,new n(t),o,o*2)),s=ei(e,t,ve),u=s.length-1,o=u;s[o]===0;--o)s.pop();return o<0?new n(r.s*0):(r.e=si(s,u),r.d=s,K=!1,a&&(r=dt(r,i,c*4)),l&&(r=r.times(Math.abs(l)<54?Pt(2,l):Kn.pow(2,l))),K=!0,r)}function Ud(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:Pn(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/ai(5,t)),e=Pn(r,2,e,e);for(var i,o=new r(5),a=new r(16),c=new r(20);t--;)i=e.times(e),e=e.times(o.plus(i.times(a.times(i).minus(c))));return e}function Pn(r,e,t,n,i){var o,a,c,l,s=1,u=r.precision,h=Math.ceil(u/Z);for(K=!1,l=t.times(t),c=new r(n);;){if(a=dt(c.times(l),new r(e++*e++),u,1),c=i?n.plus(a):n.minus(a),n=dt(a.times(l),new r(e++*e++),u,1),a=c.plus(n),a.d[h]!==void 0){for(o=h;a.d[o]===c.d[o]&&o--;);if(o==-1)break}o=c,c=n,n=a,a=o,s++}return K=!0,a.d.length=h+1,a}function ai(r,e){for(var t=r;--e;)t*=r;return t}function Vu(r,e){var t,n=e.s<0,i=ye(r,r.precision,1),o=i.times(.5);if(e=e.abs(),e.lte(o))return Ue=n?4:1,e;if(t=e.divToInt(i),t.isZero())Ue=n?3:2;else{if(e=e.minus(t.times(i)),e.lte(o))return Ue=Du(t)?n?2:3:n?4:1,e;Ue=Du(t)?n?1:4:n?3:2}return e.minus(i).abs()}function to(r,e,t,n){var i,o,a,c,l,s,u,h,f,d=r.constructor,g=t!==void 0;if(g?(Qt(t,1,Ke),n===void 0?n=d.rounding:Qt(n,0,8)):(t=d.precision,n=d.rounding),!r.isFinite())u=ku(r);else{for(u=Pe(r),a=u.indexOf("."),g?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,a>=0&&(u=u.replace(".",""),f=new d(1),f.e=u.length-a,f.d=ei(Pe(f),10,i),f.e=f.d.length),h=ei(u,10,i),o=l=h.length;h[--l]==0;)h.pop();if(!h[0])u=g?"0p+0":"0";else{if(a<0?o--:(r=new d(r),r.d=h,r.e=o,r=dt(r,f,t,n,0,i),h=r.d,o=r.e,s=Nu),a=h[t],c=i/2,s=s||h[t+1]!==void 0,s=n<4?(a!==void 0||s)&&(n===0||n===(r.s<0?3:2)):a>c||a===c&&(n===4||s||n===6&&h[t-1]&1||n===(r.s<0?8:7)),h.length=t,s)for(;++h[--t]>i-1;)h[t]=0,t||(++o,h.unshift(1));for(l=h.length;!h[l-1];--l);for(a=0,u="";a<l;a++)u+=$i.charAt(h[a]);if(g){if(l>1)if(e==16||e==8){for(a=e==16?4:3,--l;l%a;l++)u+="0";for(h=ei(u,i,e),l=h.length;!h[l-1];--l);for(a=1,u="1.";a<l;a++)u+=$i.charAt(h[a])}else u=u.charAt(0)+"."+u.slice(1);u=u+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)u="0"+u;u="0."+u}else if(++o>l)for(o-=l;o--;)u+="0";else o<l&&(u=u.slice(0,o)+"."+u.slice(o))}u=(e==16?"0x":e==2?"0b":e==8?"0o":"")+u}return r.s<0?"-"+u:u}function Iu(r,e){if(r.length>e)return r.length=e,!0}function Bd(r){return new this(r).abs()}function zd(r){return new this(r).acos()}function Gd(r){return new this(r).acosh()}function kd(r,e){return new this(r).plus(e)}function Vd(r){return new this(r).asin()}function Hd(r){return new this(r).asinh()}function Wd(r){return new this(r).atan()}function qd(r){return new this(r).atanh()}function Xd(r,e){r=new this(r),e=new this(e);var t,n=this.precision,i=this.rounding,o=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=ye(this,o,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?ye(this,n,i):new this(0),t.s=r.s):!r.d||e.isZero()?(t=ye(this,o,1).times(.5),t.s=r.s):e.s<0?(this.precision=o,this.rounding=1,t=this.atan(dt(r,e,o,1)),e=ye(this,o,1),this.precision=n,this.rounding=i,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(dt(r,e,o,1)),t}function jd(r){return new this(r).cbrt()}function Yd(r){return $(r=new this(r),r.e+1,2)}function $d(r,e,t){return new this(r).clamp(e,t)}function Zd(r){if(!r||typeof r!="object")throw Error(oi+"Object expected");var e,t,n,i=r.defaults===!0,o=["precision",1,Ke,"rounding",0,8,"toExpNeg",-An,0,"toExpPos",0,An,"maxE",0,An,"minE",-An,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(t=o[e],i&&(this[t]=Zi[t]),(n=r[t])!==void 0)if(Wt(n)===n&&n>=o[e+1]&&n<=o[e+2])this[t]=n;else throw Error(Ze+t+": "+n);if(t="crypto",i&&(this[t]=Zi[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(Ou);else this[t]=!1;else throw Error(Ze+t+": "+n);return this}function Kd(r){return new this(r).cos()}function Jd(r){return new this(r).cosh()}function Hu(r){var e,t,n;function i(o){var a,c,l,s=this;if(!(s instanceof i))return new i(o);if(s.constructor=i,Ru(o)){s.s=o.s,K?!o.d||o.e>i.maxE?(s.e=NaN,s.d=null):o.e<i.minE?(s.e=0,s.d=[0]):(s.e=o.e,s.d=o.d.slice()):(s.e=o.e,s.d=o.d?o.d.slice():o.d);return}if(l=typeof o,l==="number"){if(o===0){s.s=1/o<0?-1:1,s.e=0,s.d=[0];return}if(o<0?(o=-o,s.s=-1):s.s=1,o===~~o&&o<1e7){for(a=0,c=o;c>=10;c/=10)a++;K?a>i.maxE?(s.e=NaN,s.d=null):a<i.minE?(s.e=0,s.d=[0]):(s.e=a,s.d=[o]):(s.e=a,s.d=[o]);return}else if(o*0!==0){o||(s.s=NaN),s.e=NaN,s.d=null;return}return Qi(s,o.toString())}else if(l!=="string")throw Error(Ze+o);return(c=o.charCodeAt(0))===45?(o=o.slice(1),s.s=-1):(c===43&&(o=o.slice(1)),s.s=1),Uu.test(o)?Qi(s,o):Fd(s,o)}if(i.prototype=F,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=Zd,i.clone=Hu,i.isDecimal=Ru,i.abs=Bd,i.acos=zd,i.acosh=Gd,i.add=kd,i.asin=Vd,i.asinh=Hd,i.atan=Wd,i.atanh=qd,i.atan2=Xd,i.cbrt=jd,i.ceil=Yd,i.clamp=$d,i.cos=Kd,i.cosh=Jd,i.div=Qd,i.exp=tg,i.floor=eg,i.hypot=ng,i.ln=rg,i.log=ig,i.log10=sg,i.log2=og,i.max=ag,i.min=ug,i.mod=lg,i.mul=cg,i.pow=hg,i.random=pg,i.round=fg,i.sign=dg,i.sin=gg,i.sinh=mg,i.sqrt=yg,i.sub=vg,i.sum=_g,i.tan=xg,i.tanh=Eg,i.trunc=bg,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return i.config(r),i}function Qd(r,e){return new this(r).div(e)}function tg(r){return new this(r).exp()}function eg(r){return $(r=new this(r),r.e+1,3)}function ng(){var r,e,t=new this(0);for(K=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return K=!0,new this(1/0);t=e}return K=!0,t.sqrt()}function Ru(r){return r instanceof Kn||r&&r.toStringTag===Fu||!1}function rg(r){return new this(r).ln()}function ig(r,e){return new this(r).log(e)}function og(r){return new this(r).log(2)}function sg(r){return new this(r).log(10)}function ag(){return Gu(this,arguments,"lt")}function ug(){return Gu(this,arguments,"gt")}function lg(r,e){return new this(r).mod(e)}function cg(r,e){return new this(r).mul(e)}function hg(r,e){return new this(r).pow(e)}function pg(r){var e,t,n,i,o=0,a=new this(1),c=[];if(r===void 0?r=this.precision:Qt(r,1,Ke),n=Math.ceil(r/Z),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));o<n;)i=e[o],i>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:c[o++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);o<n;)i=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((e[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,o):(c.push(i%1e7),o+=4);o=n/4}else throw Error(Ou);else for(;o<n;)c[o++]=Math.random()*1e7|0;for(n=c[--o],r%=Z,n&&r&&(i=Pt(10,Z-r),c[o]=(n/i|0)*i);c[o]===0;o--)c.pop();if(o<0)t=0,c=[0];else{for(t=-1;c[0]===0;t-=Z)c.shift();for(n=1,i=c[0];i>=10;i/=10)n++;n<Z&&(t-=Z-n)}return a.e=t,a.d=c,a}function fg(r){return $(r=new this(r),r.e+1,this.rounding)}function dg(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}function gg(r){return new this(r).sin()}function mg(r){return new this(r).sinh()}function yg(r){return new this(r).sqrt()}function vg(r,e){return new this(r).sub(e)}function _g(){var r=0,e=arguments,t=new this(e[r]);for(K=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return K=!0,$(t,this.precision,this.rounding)}function xg(r){return new this(r).tan()}function Eg(r){return new this(r).tanh()}function bg(r){return $(r=new this(r),r.e+1,1)}F[Symbol.for("nodejs.util.inspect.custom")]=F.toString;F[Symbol.toStringTag]="Decimal";var Kn=F.constructor=Hu(Zi);ni=new Kn(ni);ri=new Kn(ri);var Jn=Kn;var Sg="BigNumber",Mg=["?on","config"],eo=N(Sg,Mg,r=>{var{on:e,config:t}=r,n=Jn.clone({precision:t.precision,modulo:Jn.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(i){return new n(i.value)},e&&e("config",function(i,o){i.precision!==o.precision&&n.config({precision:i.precision})}),n},{isClass:!0});var Nt=pn(qu(),1);var wg="Complex",Tg=[],ro=N(wg,Tg,()=>(Object.defineProperty(Nt.default,"name",{value:"Complex"}),Nt.default.prototype.constructor=Nt.default,Nt.default.prototype.type="Complex",Nt.default.prototype.isComplex=!0,Nt.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Nt.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Nt.default.prototype.format=function(r){var e="",t=this.im,n=this.re,i=$n(this.re,r),o=$n(this.im,r),a=nt(r)?r:r?r.precision:null;if(a!==null){var c=Math.pow(10,-a);Math.abs(n/t)<c&&(n=0),Math.abs(t/n)<c&&(t=0)}return t===0?e=i:n===0?t===1?e="i":t===-1?e="-i":e=o+"i":t<0?t===-1?e=i+" - i":e=i+" - "+o.substring(1)+"i":t===1?e=i+" + i":e=i+" + "+o+"i",e},Nt.default.fromPolar=function(r){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return(0,Nt.default)(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var t=arguments[0],n=arguments[1];if(nt(t)){if($r(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),nt(n))return new Nt.default({r:t,phi:n});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Nt.default.prototype.valueOf=Nt.default.prototype.toString,Nt.default.fromJSON=function(r){return new Nt.default(r)},Nt.default.compare=function(r,e){return r.re>e.re?1:r.re<e.re?-1:r.im>e.im?1:r.im<e.im?-1:0},Nt.default),{isClass:!0});var Cg=2e3,X={s:1,n:0,d:1};function Be(r,e){if(isNaN(r=parseInt(r,10)))throw ui();return r*e}function bt(r,e){if(e===0)throw io();var t=Object.create(Lt.prototype);t.s=r<0?-1:1,r=r<0?-r:r;var n=Dn(r,e);return t.n=r/n,t.d=e/n,t}function Xu(r){for(var e={},t=r,n=2,i=4;i<=t;){for(;t%n===0;)t/=n,e[n]=(e[n]||0)+1;i+=1+2*n++}return t!==r?t>1&&(e[t]=(e[t]||0)+1):e[r]=(e[r]||0)+1,e}var oe=function(r,e){var t=0,n=1,i=1,o=0,a=0,c=0,l=1,s=1,u=0,h=1,f=1,d=1,g=1e7,p;if(r!=null)if(e!==void 0){if(t=r,n=e,i=t*n,t%1!==0||n%1!==0)throw Ig()}else switch(typeof r){case"object":{if("d"in r&&"n"in r)t=r.n,n=r.d,"s"in r&&(t*=r.s);else if(0 in r)t=r[0],1 in r&&(n=r[1]);else throw ui();i=t*n;break}case"number":{if(r<0&&(i=r,r=-r),r%1===0)t=r;else if(r>0){for(r>=1&&(s=Math.pow(10,Math.floor(1+Math.log(r)/Math.LN10)),r/=s);h<=g&&d<=g;)if(p=(u+f)/(h+d),r===p){h+d<=g?(t=u+f,n=h+d):d>h?(t=f,n=d):(t=u,n=h);break}else r>p?(u+=f,h+=d):(f+=u,d+=h),h>g?(t=f,n=d):(t=u,n=h);t*=s}else(isNaN(r)||isNaN(e))&&(n=t=NaN);break}case"string":{if(h=r.match(/\d+|./g),h===null)throw ui();if(h[u]==="-"?(i=-1,u++):h[u]==="+"&&u++,h.length===u+1?a=Be(h[u++],i):h[u+1]==="."||h[u]==="."?(h[u]!=="."&&(o=Be(h[u++],i)),u++,(u+1===h.length||h[u+1]==="("&&h[u+3]===")"||h[u+1]==="'"&&h[u+3]==="'")&&(a=Be(h[u],i),l=Math.pow(10,h[u].length),u++),(h[u]==="("&&h[u+2]===")"||h[u]==="'"&&h[u+2]==="'")&&(c=Be(h[u+1],i),s=Math.pow(10,h[u+1].length)-1,u+=3)):h[u+1]==="/"||h[u+1]===":"?(a=Be(h[u],i),l=Be(h[u+2],1),u+=3):h[u+3]==="/"&&h[u+1]===" "&&(o=Be(h[u],i),a=Be(h[u+2],i),l=Be(h[u+4],1),u+=5),h.length<=u){n=l*s,i=t=c+n*o+s*a;break}}default:throw ui()}if(n===0)throw io();X.s=i<0?-1:1,X.n=Math.abs(t),X.d=Math.abs(n)};function Ag(r,e,t){for(var n=1;e>0;r=r*r%t,e>>=1)e&1&&(n=n*r%t);return n}function Pg(r,e){for(;e%2===0;e/=2);for(;e%5===0;e/=5);if(e===1)return 0;for(var t=10%e,n=1;t!==1;n++)if(t=t*10%e,n>Cg)return 0;return n}function Dg(r,e,t){for(var n=1,i=Ag(10,t,e),o=0;o<300;o++){if(n===i)return o;n=n*10%e,i=i*10%e}return 0}function Dn(r,e){if(!r)return e;if(!e)return r;for(;;){if(r%=e,!r)return e;if(e%=r,!e)return r}}function Lt(r,e){if(oe(r,e),this instanceof Lt)r=Dn(X.d,X.n),this.s=X.s,this.n=X.n/r,this.d=X.d/r;else return bt(X.s*X.n,X.d)}var io=function(){return new Error("Division by Zero")},ui=function(){return new Error("Invalid argument")},Ig=function(){return new Error("Parameters must be integer")};Lt.prototype={s:1,n:0,d:1,abs:function(){return bt(this.n,this.d)},neg:function(){return bt(-this.s*this.n,this.d)},add:function(r,e){return oe(r,e),bt(this.s*this.n*X.d+X.s*this.d*X.n,this.d*X.d)},sub:function(r,e){return oe(r,e),bt(this.s*this.n*X.d-X.s*this.d*X.n,this.d*X.d)},mul:function(r,e){return oe(r,e),bt(this.s*X.s*this.n*X.n,this.d*X.d)},div:function(r,e){return oe(r,e),bt(this.s*X.s*this.n*X.d,this.d*X.n)},clone:function(){return bt(this.s*this.n,this.d)},mod:function(r,e){if(isNaN(this.n)||isNaN(this.d))return new Lt(NaN);if(r===void 0)return bt(this.s*this.n%this.d,1);if(oe(r,e),X.n===0&&this.d===0)throw io();return bt(this.s*(X.d*this.n)%(X.n*this.d),X.d*this.d)},gcd:function(r,e){return oe(r,e),bt(Dn(X.n,this.n)*Dn(X.d,this.d),X.d*this.d)},lcm:function(r,e){return oe(r,e),X.n===0&&this.n===0?bt(0,1):bt(X.n*this.n,Dn(X.n,this.n)*Dn(X.d,this.d))},ceil:function(r){return r=Math.pow(10,r||0),isNaN(this.n)||isNaN(this.d)?new Lt(NaN):bt(Math.ceil(r*this.s*this.n/this.d),r)},floor:function(r){return r=Math.pow(10,r||0),isNaN(this.n)||isNaN(this.d)?new Lt(NaN):bt(Math.floor(r*this.s*this.n/this.d),r)},round:function(r){return r=Math.pow(10,r||0),isNaN(this.n)||isNaN(this.d)?new Lt(NaN):bt(Math.round(r*this.s*this.n/this.d),r)},roundTo:function(r,e){return oe(r,e),bt(this.s*Math.round(this.n*X.d/(this.d*X.n))*X.n,X.d)},inverse:function(){return bt(this.s*this.d,this.n)},pow:function(r,e){if(oe(r,e),X.d===1)return X.s<0?bt(Math.pow(this.s*this.d,X.n),Math.pow(this.n,X.n)):bt(Math.pow(this.s*this.n,X.n),Math.pow(this.d,X.n));if(this.s<0)return null;var t=Xu(this.n),n=Xu(this.d),i=1,o=1;for(var a in t)if(a!=="1"){if(a==="0"){i=0;break}if(t[a]*=X.n,t[a]%X.d===0)t[a]/=X.d;else return null;i*=Math.pow(a,t[a])}for(var a in n)if(a!=="1"){if(n[a]*=X.n,n[a]%X.d===0)n[a]/=X.d;else return null;o*=Math.pow(a,n[a])}return X.s<0?bt(o,i):bt(i,o)},equals:function(r,e){return oe(r,e),this.s*this.n*X.d===X.s*X.n*this.d},compare:function(r,e){oe(r,e);var t=this.s*this.n*X.d-X.s*X.n*this.d;return(0<t)-(t<0)},simplify:function(r){if(isNaN(this.n)||isNaN(this.d))return this;r=r||.001;for(var e=this.abs(),t=e.toContinued(),n=1;n<t.length;n++){for(var i=bt(t[n-1],1),o=n-2;o>=0;o--)i=i.inverse().add(t[o]);if(Math.abs(i.sub(e).valueOf())<r)return i.mul(this.s)}return this},divisible:function(r,e){return oe(r,e),!(!(X.n*this.d)||this.n*X.d%(X.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(r){var e,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),i===1?t+=n:(r&&(e=Math.floor(n/i))>0&&(t+=e,t+=" ",n%=i),t+=n,t+="/",t+=i),t},toLatex:function(r){var e,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),i===1?t+=n:(r&&(e=Math.floor(n/i))>0&&(t+=e,n%=i),t+="\\frac{",t+=n,t+="}{",t+=i,t+="}"),t},toContinued:function(){var r,e=this.n,t=this.d,n=[];if(isNaN(e)||isNaN(t))return n;do n.push(Math.floor(e/t)),r=e%t,e=t,t=r;while(e!==1);return n},toString:function(r){var e=this.n,t=this.d;if(isNaN(e)||isNaN(t))return"NaN";r=r||15;var n=Pg(e,t),i=Dg(e,t,n),o=this.s<0?"-":"";if(o+=e/t|0,e%=t,e*=10,e&&(o+="."),n){for(var a=i;a--;)o+=e/t|0,e%=t,e*=10;o+="(";for(var a=n;a--;)o+=e/t|0,e%=t,e*=10;o+=")"}else for(var a=r;e&&a--;)o+=e/t|0,e%=t,e*=10;return o}};var Rg="Fraction",Ng=[],oo=N(Rg,Ng,()=>(Object.defineProperty(Lt,"name",{value:"Fraction"}),Lt.prototype.constructor=Lt,Lt.prototype.type="Fraction",Lt.prototype.isFraction=!0,Lt.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Lt.fromJSON=function(r){return new Lt(r)},Lt),{isClass:!0});var Lg="Matrix",Og=[],so=N(Lg,Og,()=>{function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator")}return r.prototype.type="Matrix",r.prototype.isMatrix=!0,r.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},r.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},r.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},r.prototype.subset=function(e,t,n){throw new Error("Cannot invoke subset on a Matrix interface")},r.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},r.prototype.set=function(e,t,n){throw new Error("Cannot invoke set on a Matrix interface")},r.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},r.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},r.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},r.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},r.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},r.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},r.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},r.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},r.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},r.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},r.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},r},{isClass:!0});function ao(r,e,t){var n=r.constructor,i=new n(2),o="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!tt(t))throw new Error("size must be an integer");if(r.greaterThan(i.pow(t-1).sub(1))||r.lessThan(i.pow(t-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!r.isInteger())throw new Error("Value must be an integer");r.lessThan(0)&&(r=r.add(i.pow(t))),o="i".concat(t)}switch(e){case 2:return"".concat(r.toBinary()).concat(o);case 8:return"".concat(r.toOctal()).concat(o);case 16:return"".concat(r.toHexadecimal()).concat(o);default:throw new Error("Base ".concat(e," not supported "))}}function $u(r,e){if(typeof e=="function")return e(r);if(!r.isFinite())return r.isNaN()?"NaN":r.gt(0)?"Infinity":"-Infinity";var{notation:t,precision:n,wordSize:i}=qi(e);switch(t){case"fixed":return Ug(r,n);case"exponential":return ju(r,n);case"engineering":return Fg(r,n);case"bin":return ao(r,2,i);case"oct":return ao(r,8,i);case"hex":return ao(r,16,i);case"auto":{var o=Yu(e?.lowerExp,-3),a=Yu(e?.upperExp,5);if(r.isZero())return"0";var c,l=r.toSignificantDigits(n),s=l.e;return s>=o&&s<a?c=l.toFixed():c=ju(r,n),c.replace(/((\.\d*?)(0+))($|e)/,function(){var u=arguments[2],h=arguments[4];return u!=="."?u+h:h})}default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Fg(r,e){var t=r.e,n=t%3===0?t:t<0?t-3-t%3:t-t%3,i=r.mul(Math.pow(10,-n)),o=i.toPrecision(e);if(o.includes("e")){var a=r.constructor;o=new a(o).toFixed()}return o+"e"+(t>=0?"+":"")+n.toString()}function ju(r,e){return e!==void 0?r.toExponential(e-1):r.toExponential()}function Ug(r,e){return r.toFixed(e)}function Yu(r,e){return nt(r)?r:it(r)?r.toNumber():e}function vt(r,e){var t=Bg(r,e);return e&&typeof e=="object"&&"truncate"in e&&t.length>e.truncate?t.substring(0,e.truncate-3)+"...":t}function Bg(r,e){if(typeof r=="number")return $n(r,e);if(it(r))return $u(r,e);if(zg(r))return!e||e.fraction!=="decimal"?r.s*r.n+"/"+r.d:r.toString();if(Array.isArray(r))return Ju(r,e);if(jt(r))return Zu(r);if(typeof r=="function")return r.syntax?String(r.syntax):"function";if(r&&typeof r=="object"){if(typeof r.format=="function")return r.format(e);if(r&&r.toString(e)!=={}.toString())return r.toString(e);var t=Object.keys(r).map(n=>Zu(n)+": "+vt(r[n],e));return"{"+t.join(", ")+"}"}return String(r)}function Zu(r){for(var e=String(r),t="",n=0;n<e.length;){var i=e.charAt(n);t+=i in Ku?Ku[i]:i,n++}return'"'+t+'"'}var Ku={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function Ju(r,e){if(Array.isArray(r)){for(var t="[",n=r.length,i=0;i<n;i++)i!==0&&(t+=", "),t+=Ju(r[i],e);return t+="]",t}else return vt(r,e)}function zg(r){return r&&typeof r=="object"&&typeof r.s=="number"&&typeof r.n=="number"&&typeof r.d=="number"||!1}function Q(r,e,t){if(!(this instanceof Q))throw new SyntaxError("Constructor must be called with the new operator");this.actual=r,this.expected=e,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(r)?"["+r.join(", ")+"]":r)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}Q.prototype=new RangeError;Q.prototype.constructor=RangeError;Q.prototype.name="DimensionError";Q.prototype.isDimensionError=!0;function _e(r,e,t){if(!(this instanceof _e))throw new SyntaxError("Constructor must be called with the new operator");this.index=r,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=t),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}_e.prototype=new RangeError;_e.prototype.constructor=RangeError;_e.prototype.name="IndexError";_e.prototype.isIndexError=!0;function st(r){for(var e=[];Array.isArray(r);)e.push(r.length),r=r[0];return e}function Qu(r,e,t){var n,i=r.length;if(i!==e[t])throw new Q(i,e[t]);if(t<e.length-1){var o=t+1;for(n=0;n<i;n++){var a=r[n];if(!Array.isArray(a))throw new Q(e.length-1,e.length,"<");Qu(r[n],e,o)}}else for(n=0;n<i;n++)if(Array.isArray(r[n]))throw new Q(e.length+1,e.length,">")}function lo(r,e){var t=e.length===0;if(t){if(Array.isArray(r))throw new Q(r.length,0)}else Qu(r,e,0)}function Et(r,e){if(r!==void 0){if(!nt(r)||!tt(r))throw new TypeError("Index must be an integer (value: "+r+")");if(r<0||typeof e=="number"&&r>=e)throw new _e(r,e)}}function un(r,e,t){if(!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Error("Resizing to scalar is not supported");e.forEach(function(i){if(!nt(i)||!tt(i)||i<0)throw new TypeError("Invalid size, must contain positive integers (size: "+vt(e)+")")}),(nt(r)||it(r))&&(r=[r]);var n=t!==void 0?t:0;return uo(r,e,0,n),r}function uo(r,e,t,n){var i,o,a=r.length,c=e[t],l=Math.min(a,c);if(r.length=c,t<e.length-1){var s=t+1;for(i=0;i<l;i++)o=r[i],Array.isArray(o)||(o=[o],r[i]=o),uo(o,e,s,n);for(i=l;i<c;i++)o=[],r[i]=o,uo(o,e,s,n)}else{for(i=0;i<l;i++)for(;Array.isArray(r[i]);)r[i]=r[i][0];for(i=l;i<c;i++)r[i]=n}}function Qn(r,e){var t=kg(r),n=t.length;if(!Array.isArray(r)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Q(0,n,"!=");e=tr(e,n);var i=tl(e);if(n!==i)throw new Q(i,n,"!=");try{return Gg(t,e)}catch(o){throw o instanceof Q?new Q(i,n,"!="):o}}function tr(r,e){var t=tl(r),n=r.slice(),i=-1,o=r.indexOf(i),a=r.indexOf(i,o+1)>=0;if(a)throw new Error("More than one wildcard in sizes");var c=o>=0,l=e%t===0;if(c)if(l)n[o]=-e/t;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-t);return n}function tl(r){return r.reduce((e,t)=>e*t,1)}function Gg(r,e){for(var t=r,n,i=e.length-1;i>0;i--){var o=e[i];n=[];for(var a=t.length/o,c=0;c<a;c++)n.push(t.slice(c*o,(c+1)*o));t=n}return t}function li(r,e,t,n){var i=n||st(r);if(t)for(var o=0;o<t;o++)r=[r],i.unshift(1);for(r=el(r,e,0);i.length<e;)i.push(1);return r}function el(r,e,t){var n,i;if(Array.isArray(r)){var o=t+1;for(n=0,i=r.length;n<i;n++)r[n]=el(r[n],e,o)}else for(var a=t;a<e;a++)r=[r];return r}function kg(r){if(!Array.isArray(r))return r;var e=[];return r.forEach(function t(n){Array.isArray(n)?n.forEach(t):e.push(n)}),e}function In(r,e){for(var t,n=0,i=0;i<r.length;i++){var o=r[i],a=Array.isArray(o);if(i===0&&a&&(n=o.length),a&&o.length!==n)return;var c=a?In(o,e):e(o);if(t===void 0)t=c;else if(t!==c)return"mixed"}return t}function nl(r,e,t,n){if(n<t){if(r.length!==e.length)throw new Q(r.length,e.length);for(var i=[],o=0;o<r.length;o++)i[o]=nl(r[o],e[o],t,n+1);return i}else return r.concat(e)}function co(){var r=Array.prototype.slice.call(arguments,0,-1),e=Array.prototype.slice.call(arguments,-1);if(r.length===1)return r[0];if(r.length>1)return r.slice(1).reduce(function(t,n){return nl(t,n,e,0)},r[0]);throw new Error("Wrong number of arguments in function concat")}function ho(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];for(var n=e.map(f=>f.length),i=Math.max(...n),o=new Array(i).fill(null),a=0;a<e.length;a++)for(var c=e[a],l=n[a],s=0;s<l;s++){var u=i-l+s;c[s]>o[u]&&(o[u]=c[s])}for(var h=0;h<e.length;h++)rl(e[h],o);return o}function rl(r,e){for(var t=e.length,n=r.length,i=0;i<n;i++){var o=t-n+i;if(r[i]<e[o]&&r[i]>1||r[i]>e[o])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(r,") not possible to broadcast dimension ").concat(n," with size ").concat(r[i]," to size ").concat(e[o]))}}function er(r,e){var t=st(r);if(ce(t,e))return r;rl(t,e);var n=ho(t,e),i=n.length,o=[...Array(i-t.length).fill(1),...t],a=Hg(r);t.length<i&&(a=Qn(a,o),t=st(a));for(var c=0;c<i;c++)t[c]<n[c]&&(a=Vg(a,n[c],c),t=st(a));return a}function Vg(r,e,t){return co(...Array(e).fill(r),t)}function il(r,e){if(!Array.isArray(r))throw new Error("Array expected");var t=st(r);if(e.length!==t.length)throw new Q(e.length,t.length);for(var n=0;n<e.length;n++)Et(e[n],t[n]);return e.reduce((i,o)=>i[o],r)}function Hg(r){return bn([],r)}var nr=pn(Hi(),1);function ci(r,e,t,n,i){if(nr.default.isTypedFunction(r)){var o=[e,t,n],a=nr.default.resolve(r,o);if(a)return h(a.implementation,o);var c=[e,t],l=nr.default.resolve(r,c);if(l)return h(l.implementation,c);var s=[e],u=nr.default.resolve(r,s);return u?h(u.implementation,s):h(r,o)}else return r(e,t,n);function h(f,d){try{return f.apply(f,d)}catch(m){var g;if(m instanceof TypeError&&((g=m.data)===null||g===void 0?void 0:g.category)==="wrongType"){var p=[];throw p.push("value: ".concat(Ut(e))),d.length>=2&&p.push("index: ".concat(Ut(t))),d.length>=3&&p.push("array: ".concat(Ut(n))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(r.name,"(").concat(p.join(", "),") at index ").concat(JSON.stringify(t)))}else throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(r.name,": ").concat(m.message))}}}var Wg="DenseMatrix",qg=["Matrix"],po=N(Wg,qg,r=>{var{Matrix:e}=r;function t(u,h){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(h&&!jt(h))throw new Error("Invalid datatype: "+h);if(ot(u))u.type==="DenseMatrix"?(this._data=ft(u._data),this._size=ft(u._size),this._datatype=h||u._datatype):(this._data=u.toArray(),this._size=u.size(),this._datatype=h||u._datatype);else if(u&&yt(u.data)&&yt(u.size))this._data=u.data,this._size=u.size,lo(this._data,this._size),this._datatype=h||u.datatype;else if(yt(u))this._data=s(u),this._size=st(this._data),lo(this._data,this._size),this._datatype=h;else{if(u)throw new TypeError("Unsupported type of data ("+Ut(u)+")");this._data=[],this._size=[0],this._datatype=h}}t.prototype=new e,t.prototype.createDenseMatrix=function(u,h){return new t(u,h)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return In(this._data,Ut)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(u,h){return new t(u,h)},t.prototype.subset=function(u,h,f){switch(arguments.length){case 1:return n(this,u);case 2:case 3:return o(this,u,h,f);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(u){return il(this._data,u)},t.prototype.set=function(u,h,f){if(!yt(u))throw new TypeError("Array expected");if(u.length<this._size.length)throw new Q(u.length,this._size.length,"<");var d,g,p,m=u.map(function(b){return b+1});l(this,m,f);var v=this._data;for(d=0,g=u.length-1;d<g;d++)p=u[d],Et(p,v.length),v=v[p];return p=u[u.length-1],Et(p,v.length),v[p]=h,this};function n(u,h){if(!Mn(h))throw new TypeError("Invalid index");var f=h.isScalar();if(f)return u.get(h.min());var d=h.size();if(d.length!==u._size.length)throw new Q(d.length,u._size.length);for(var g=h.min(),p=h.max(),m=0,v=u._size.length;m<v;m++)Et(g[m],u._size[m]),Et(p[m],u._size[m]);return new t(i(u._data,h,d.length,0),u._datatype)}function i(u,h,f,d){var g=d===f-1,p=h.dimension(d);return g?p.map(function(m){return Et(m,u.length),u[m]}).valueOf():p.map(function(m){Et(m,u.length);var v=u[m];return i(v,h,f,d+1)}).valueOf()}function o(u,h,f,d){if(!h||h.isIndex!==!0)throw new TypeError("Invalid index");var g=h.size(),p=h.isScalar(),m;if(ot(f)?(m=f.size(),f=f.valueOf()):m=st(f),p){if(m.length!==0)throw new TypeError("Scalar expected");u.set(h.min(),f,d)}else{if(!ce(m,g))try{m.length===0?f=er([f],g):f=er(f,g),m=st(f)}catch{}if(g.length<u._size.length)throw new Q(g.length,u._size.length,"<");if(m.length<g.length){for(var v=0,b=0;g[v]===1&&m[v]===1;)v++;for(;g[v]===1;)b++,v++;f=li(f,g.length,b,m)}if(!ce(g,m))throw new Q(g,m,">");var y=h.max().map(function(_){return _+1});l(u,y,d);var S=g.length,x=0;a(u._data,h,f,S,x)}return u}function a(u,h,f,d,g){var p=g===d-1,m=h.dimension(g);p?m.forEach(function(v,b){Et(v),u[v]=f[b[0]]}):m.forEach(function(v,b){Et(v),a(u[v],h,f[b[0]],d,g+1)})}t.prototype.resize=function(u,h,f){if(!Fe(u))throw new TypeError("Array or Matrix expected");var d=u.valueOf().map(p=>Array.isArray(p)&&p.length===1?p[0]:p),g=f?this.clone():this;return c(g,d,h)};function c(u,h,f){if(h.length===0){for(var d=u._data;yt(d);)d=d[0];return d}return u._size=h.slice(0),u._data=un(u._data,u._size,f),u}t.prototype.reshape=function(u,h){var f=h?this.clone():this;f._data=Qn(f._data,u);var d=f._size.reduce((g,p)=>g*p);return f._size=tr(u,d),f};function l(u,h,f){for(var d=u._size.slice(0),g=!1;d.length<h.length;)d.push(0),g=!0;for(var p=0,m=h.length;p<m;p++)h[p]>d[p]&&(d[p]=h[p],g=!0);g&&c(u,d,f)}t.prototype.clone=function(){var u=new t({data:ft(this._data),size:ft(this._size),datatype:this._datatype});return u},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(u){var h=this,f=function(m,v){return yt(m)?m.map(function(b,y){return f(b,v.concat(y))}):ci(u,m,v,h,"map")},d=f(this._data,[]),g=this._datatype!==void 0?In(d,Ut):void 0;return new t(d,g)},t.prototype.forEach=function(u){var h=this,f=function(g,p){yt(g)?g.forEach(function(m,v){f(m,p.concat(v))}):u(g,p,h)};f(this._data,[])},t.prototype[Symbol.iterator]=function*(){var u=function*(f,d){if(yt(f))for(var g=0;g<f.length;g++)yield*u(f[g],d.concat(g));else yield{value:f,index:d}};yield*u(this._data,[])},t.prototype.rows=function(){var u=[],h=this.size();if(h.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var f=this._data;for(var d of f)u.push(new t([d],this._datatype));return u},t.prototype.columns=function(){var u=this,h=[],f=this.size();if(f.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var d=this._data,g=function(v){var b=d.map(y=>[y[v]]);h.push(new t(b,u._datatype))},p=0;p<f[1];p++)g(p);return h},t.prototype.toArray=function(){return ft(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(u){return vt(this._data,u)},t.prototype.toString=function(){return vt(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(u){if(u){if(it(u)&&(u=u.toNumber()),!nt(u)||!tt(u))throw new TypeError("The parameter k must be an integer number")}else u=0;for(var h=u>0?u:0,f=u<0?-u:0,d=this._size[0],g=this._size[1],p=Math.min(d-f,g-h),m=[],v=0;v<p;v++)m[v]=this._data[v+f][v+h];return new t({data:m,size:[p],datatype:this._datatype})},t.diagonal=function(u,h,f,d){if(!yt(u))throw new TypeError("Array expected, size parameter");if(u.length!==2)throw new Error("Only two dimensions matrix are supported");if(u=u.map(function(M){if(it(M)&&(M=M.toNumber()),!nt(M)||!tt(M)||M<1)throw new Error("Size values must be positive integers");return M}),f){if(it(f)&&(f=f.toNumber()),!nt(f)||!tt(f))throw new TypeError("The parameter k must be an integer number")}else f=0;var g=f>0?f:0,p=f<0?-f:0,m=u[0],v=u[1],b=Math.min(m-p,v-g),y;if(yt(h)){if(h.length!==b)throw new Error("Invalid value array length");y=function(w){return h[w]}}else if(ot(h)){var S=h.size();if(S.length!==1||S[0]!==b)throw new Error("Invalid matrix length");y=function(w){return h.get([w])}}else y=function(){return h};d||(d=it(y(0))?y(0).mul(0):0);var x=[];if(u.length>0){x=un(x,u,d);for(var _=0;_<b;_++)x[_+p][_+g]=y(_)}return new t({data:x,size:[m,v]})},t.fromJSON=function(u){return new t(u)},t.prototype.swapRows=function(u,h){if(!nt(u)||!tt(u)||!nt(h)||!tt(h))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Et(u,this._size[0]),Et(h,this._size[0]),t._swapRows(u,h,this._data),this},t._swapRows=function(u,h,f){var d=f[u];f[u]=f[h],f[h]=d};function s(u){return ot(u)?s(u.valueOf()):yt(u)?u.map(s):u}return t},{isClass:!0});function ol(r){var e=r.length,t=r[0].length,n,i,o=[];for(i=0;i<t;i++){var a=[];for(n=0;n<e;n++)a.push(r[n][i]);o.push(a)}return o}function sl(r){for(var e=0;e<r.length;e++)if(Fe(r[e]))return!0;return!1}function fo(r,e){ot(r)&&(r=r.valueOf());for(var t=0,n=r.length;t<n;t++){var i=r[t];Array.isArray(i)?fo(i,e):e(i)}}function _t(r,e,t){return r&&typeof r.map=="function"?r.map(function(n){return _t(n,e,t)}):e(r)}function al(r,e,t){var n=Array.isArray(r)?st(r):r.size();if(e<0||e>=n.length)throw new _e(e,n.length);return ot(r)?r.create(hi(r.valueOf(),e,t),r.datatype()):hi(r,e,t)}function hi(r,e,t){var n,i,o,a;if(e<=0)if(Array.isArray(r[0])){for(a=ol(r),i=[],n=0;n<a.length;n++)i[n]=hi(a[n],e-1,t);return i}else{for(o=r[0],n=1;n<r.length;n++)o=t(o,r[n]);return o}else{for(i=[],n=0;n<r.length;n++)i[n]=hi(r[n],e-1,t);return i}}var ul="isInteger",Xg=["typed"],go=N(ul,Xg,r=>{var{typed:e}=r;return e(ul,{number:tt,BigNumber:function(n){return n.isInt()},bigint:function(n){return!0},Fraction:function(n){return n.d===1&&isFinite(n.n)},"Array | Matrix":e.referToSelf(t=>n=>_t(n,t))})});var te="number",ze="number, number";function mo(r){return Math.abs(r)}mo.signature=te;function yo(r,e){return r+e}yo.signature=ze;function vo(r,e){return r-e}vo.signature=ze;function _o(r,e){return r*e}_o.signature=ze;function jg(r,e){return r/e}jg.signature=ze;function xo(r){return-r}xo.signature=te;function Yg(r){return r}Yg.signature=te;function $g(r){return wu(r)}$g.signature=te;function Zg(r){return r*r*r}Zg.signature=te;function Eo(r){return Math.exp(r)}Eo.signature=te;function Kg(r){return Tu(r)}Kg.signature=te;function Jg(r,e){if(!tt(r)||!tt(e))throw new Error("Parameters in function gcd must be integer numbers");for(var t;e!==0;)t=r%e,r=e,e=t;return r<0?-r:r}Jg.signature=ze;function Qg(r,e){if(!tt(r)||!tt(e))throw new Error("Parameters in function lcm must be integer numbers");if(r===0||e===0)return 0;for(var t,n=r*e;e!==0;)t=e,e=r%t,r=t;return Math.abs(n/r)}Qg.signature=ze;function tm(r){return Su(r)}tm.signature=te;function bo(r){return bu(r)}bo.signature=te;function em(r){return Mu(r)}em.signature=te;function nm(r,e){return e===0?r:r-e*Math.floor(r/e)}nm.signature=ze;function rm(r){return Eu(r)}rm.signature=te;function im(r){return Math.sqrt(r)}im.signature=te;function om(r){return r*r}om.signature=te;function sm(r,e){var t,n,i,o=0,a=1,c=1,l=0;if(!tt(r)||!tt(e))throw new Error("Parameters in function xgcd must be integer numbers");for(;e;)n=Math.floor(r/e),i=r-n*e,t=o,o=a-n*o,a=t,t=c,c=l-n*c,l=t,r=e,e=i;var s;return r<0?s=[-r,-a,-l]:s=[r,r?a:0,l],s}sm.signature=ze;function So(r,e){return r*r<1&&e===1/0||r*r>1&&e===-1/0?0:Math.pow(r,e)}So.signature=ze;function Rn(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!tt(e)||e<0||e>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(Xi(r,e))}function am(r){return Math.abs(r)}am.signature=te;var ll=2*Math.PI;function Je(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-9,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(t<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return r.isNaN()||e.isNaN()?!1:!r.isFinite()||!e.isFinite()?r.eq(e):r.eq(e)?!0:r.minus(e).abs().lte(r.constructor.max(r.constructor.max(r.abs(),e.abs()).mul(t),n))}var cl="isZero",um=["typed","equalScalar"],Mo=N(cl,um,r=>{var{typed:e,equalScalar:t}=r;return e(cl,{"number | BigNumber | Complex | Fraction":n=>t(n,0),bigint:n=>n===0n,Unit:e.referToSelf(n=>i=>e.find(n,i.valueType())(i.value)),"Array | Matrix":e.referToSelf(n=>i=>_t(i,n))})});function hl(r,e,t,n){return pe(r.re,e.re,t,n)&&pe(r.im,e.im,t,n)}var pl=N("compareUnits",["typed"],r=>{var{typed:e}=r;return{"Unit, Unit":e.referToSelf(t=>(n,i)=>{if(!n.equalBase(i))throw new Error("Cannot compare units with different base");return e.find(t,[n.valueType(),i.valueType()])(n.value,i.value)})}});var pi="equalScalar",lm=["typed","config"],wo=N(pi,lm,r=>{var{typed:e,config:t}=r,n=pl({typed:e});return e(pi,{"boolean, boolean":function(o,a){return o===a},"number, number":function(o,a){return pe(o,a,t.relTol,t.absTol)},"BigNumber, BigNumber":function(o,a){return o.eq(a)||Je(o,a,t.relTol,t.absTol)},"bigint, bigint":function(o,a){return o===a},"Fraction, Fraction":function(o,a){return o.equals(a)},"Complex, Complex":function(o,a){return hl(o,a,t.relTol,t.absTol)}},n)}),Ww=N(pi,["typed","config"],r=>{var{typed:e,config:t}=r;return e(pi,{"number, number":function(i,o){return pe(i,o,t.relTol,t.absTol)}})});var cm="SparseMatrix",hm=["typed","equalScalar","Matrix"],To=N(cm,hm,r=>{var{typed:e,equalScalar:t,Matrix:n}=r;function i(p,m){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(m&&!jt(m))throw new Error("Invalid datatype: "+m);if(ot(p))o(this,p,m);else if(p&&yt(p.index)&&yt(p.ptr)&&yt(p.size))this._values=p.values,this._index=p.index,this._ptr=p.ptr,this._size=p.size,this._datatype=m||p.datatype;else if(yt(p))a(this,p,m);else{if(p)throw new TypeError("Unsupported type of data ("+Ut(p)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=m}}function o(p,m,v){m.type==="SparseMatrix"?(p._values=m._values?ft(m._values):void 0,p._index=ft(m._index),p._ptr=ft(m._ptr),p._size=ft(m._size),p._datatype=v||m._datatype):a(p,m.valueOf(),v||m._datatype)}function a(p,m,v){p._values=[],p._index=[],p._ptr=[],p._datatype=v;var b=m.length,y=0,S=t,x=0;if(jt(v)&&(S=e.find(t,[v,v])||t,x=e.convert(0,v)),b>0){var _=0;do{p._ptr.push(p._index.length);for(var M=0;M<b;M++){var w=m[M];if(yt(w)){if(_===0&&y<w.length&&(y=w.length),_<w.length){var C=w[_];S(C,x)||(p._values.push(C),p._index.push(M))}}else _===0&&y<1&&(y=1),S(w,x)||(p._values.push(w),p._index.push(M))}_++}while(_<y)}p._ptr.push(p._index.length),p._size=[b,y]}i.prototype=new n,i.prototype.createSparseMatrix=function(p,m){return new i(p,m)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return In(this._values,Ut)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(p,m){return new i(p,m)},i.prototype.density=function(){var p=this._size[0],m=this._size[1];return p!==0&&m!==0?this._index.length/(p*m):0},i.prototype.subset=function(p,m,v){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return c(this,p);case 2:case 3:return l(this,p,m,v);default:throw new SyntaxError("Wrong number of arguments")}};function c(p,m){if(!Mn(m))throw new TypeError("Invalid index");var v=m.isScalar();if(v)return p.get(m.min());var b=m.size();if(b.length!==p._size.length)throw new Q(b.length,p._size.length);var y,S,x,_,M=m.min(),w=m.max();for(y=0,S=p._size.length;y<S;y++)Et(M[y],p._size[y]),Et(w[y],p._size[y]);var C=p._values,P=p._index,D=p._ptr,R=m.dimension(0),W=m.dimension(1),G=[],k=[];R.forEach(function(j,J){k[j]=J[0],G[j]=!0});var L=C?[]:void 0,q=[],Y=[];return W.forEach(function(j){for(Y.push(q.length),x=D[j],_=D[j+1];x<_;x++)y=P[x],G[y]===!0&&(q.push(k[y]),L&&L.push(C[x]))}),Y.push(q.length),new i({values:L,index:q,ptr:Y,size:b,datatype:p._datatype})}function l(p,m,v,b){if(!m||m.isIndex!==!0)throw new TypeError("Invalid index");var y=m.size(),S=m.isScalar(),x;if(ot(v)?(x=v.size(),v=v.toArray()):x=st(v),S){if(x.length!==0)throw new TypeError("Scalar expected");p.set(m.min(),v,b)}else{if(y.length!==1&&y.length!==2)throw new Q(y.length,p._size.length,"<");if(x.length<y.length){for(var _=0,M=0;y[_]===1&&x[_]===1;)_++;for(;y[_]===1;)M++,_++;v=li(v,y.length,M,x)}if(!ce(y,x))throw new Q(y,x,">");if(y.length===1){var w=m.dimension(0);w.forEach(function(D,R){Et(D),p.set([D,0],v[R[0]],b)})}else{var C=m.dimension(0),P=m.dimension(1);C.forEach(function(D,R){Et(D),P.forEach(function(W,G){Et(W),p.set([D,W],v[R[0]][G[0]],b)})})}}return p}i.prototype.get=function(p){if(!yt(p))throw new TypeError("Array expected");if(p.length!==this._size.length)throw new Q(p.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var m=p[0],v=p[1];Et(m,this._size[0]),Et(v,this._size[1]);var b=s(m,this._ptr[v],this._ptr[v+1],this._index);return b<this._ptr[v+1]&&this._index[b]===m?this._values[b]:0},i.prototype.set=function(p,m,v){if(!yt(p))throw new TypeError("Array expected");if(p.length!==this._size.length)throw new Q(p.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var b=p[0],y=p[1],S=this._size[0],x=this._size[1],_=t,M=0;jt(this._datatype)&&(_=e.find(t,[this._datatype,this._datatype])||t,M=e.convert(0,this._datatype)),(b>S-1||y>x-1)&&(f(this,Math.max(b+1,S),Math.max(y+1,x),v),S=this._size[0],x=this._size[1]),Et(b,S),Et(y,x);var w=s(b,this._ptr[y],this._ptr[y+1],this._index);return w<this._ptr[y+1]&&this._index[w]===b?_(m,M)?u(w,y,this._values,this._index,this._ptr):this._values[w]=m:_(m,M)||h(w,b,y,m,this._values,this._index,this._ptr),this};function s(p,m,v,b){if(v-m===0)return v;for(var y=m;y<v;y++)if(b[y]===p)return y;return m}function u(p,m,v,b,y){v.splice(p,1),b.splice(p,1);for(var S=m+1;S<y.length;S++)y[S]--}function h(p,m,v,b,y,S,x){y.splice(p,0,b),S.splice(p,0,m);for(var _=v+1;_<x.length;_++)x[_]++}i.prototype.resize=function(p,m,v){if(!Fe(p))throw new TypeError("Array or Matrix expected");var b=p.valueOf().map(S=>Array.isArray(S)&&S.length===1?S[0]:S);if(b.length!==2)throw new Error("Only two dimensions matrix are supported");b.forEach(function(S){if(!nt(S)||!tt(S)||S<0)throw new TypeError("Invalid size, must contain positive integers (size: "+vt(b)+")")});var y=v?this.clone():this;return f(y,b[0],b[1],m)};function f(p,m,v,b){var y=b||0,S=t,x=0;jt(p._datatype)&&(S=e.find(t,[p._datatype,p._datatype])||t,x=e.convert(0,p._datatype),y=e.convert(y,p._datatype));var _=!S(y,x),M=p._size[0],w=p._size[1],C,P,D;if(v>w){for(P=w;P<v;P++)if(p._ptr[P]=p._values.length,_)for(C=0;C<M;C++)p._values.push(y),p._index.push(C);p._ptr[v]=p._values.length}else v<w&&(p._ptr.splice(v+1,w-v),p._values.splice(p._ptr[v],p._values.length),p._index.splice(p._ptr[v],p._index.length));if(w=v,m>M){if(_){var R=0;for(P=0;P<w;P++){p._ptr[P]=p._ptr[P]+R,D=p._ptr[P+1]+R;var W=0;for(C=M;C<m;C++,W++)p._values.splice(D+W,0,y),p._index.splice(D+W,0,C),R++}p._ptr[w]=p._values.length}}else if(m<M){var G=0;for(P=0;P<w;P++){p._ptr[P]=p._ptr[P]-G;var k=p._ptr[P],L=p._ptr[P+1]-G;for(D=k;D<L;D++)C=p._index[D],C>m-1&&(p._values.splice(D,1),p._index.splice(D,1),G++)}p._ptr[P]=p._values.length}return p._size[0]=m,p._size[1]=v,p}i.prototype.reshape=function(p,m){if(!yt(p))throw new TypeError("Array expected");if(p.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");p.forEach(function(j){if(!nt(j)||!tt(j)||j<=-2||j===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+vt(p)+")")});var v=this._size[0]*this._size[1];p=tr(p,v);var b=p[0]*p[1];if(v!==b)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var y=m?this.clone():this;if(this._size[0]===p[0]&&this._size[1]===p[1])return y;for(var S=[],x=0;x<y._ptr.length;x++)for(var _=0;_<y._ptr[x+1]-y._ptr[x];_++)S.push(x);for(var M=y._values.slice(),w=y._index.slice(),C=0;C<y._index.length;C++){var P=w[C],D=S[C],R=P*y._size[1]+D;S[C]=R%p[1],w[C]=Math.floor(R/p[1])}y._values.length=0,y._index.length=0,y._ptr.length=p[1]+1,y._size=p.slice();for(var W=0;W<y._ptr.length;W++)y._ptr[W]=0;for(var G=0;G<M.length;G++){var k=w[G],L=S[G],q=M[G],Y=s(k,y._ptr[L],y._ptr[L+1],y._index);h(Y,k,L,q,y._values,y._index,y._ptr)}return y},i.prototype.clone=function(){var p=new i({values:this._values?ft(this._values):void 0,index:ft(this._index),ptr:ft(this._ptr),size:ft(this._size),datatype:this._datatype});return p},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(p,m){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var v=this,b=this._size[0],y=this._size[1],S=function(_,M,w){return ci(p,_,[M,w],v,"map")};return d(this,0,b-1,0,y-1,S,m)};function d(p,m,v,b,y,S,x){var _=[],M=[],w=[],C=t,P=0;jt(p._datatype)&&(C=e.find(t,[p._datatype,p._datatype])||t,P=e.convert(0,p._datatype));for(var D=function(pt,Tt,wt){var St=S(pt,Tt,wt);C(St,P)||(_.push(St),M.push(Tt))},R=b;R<=y;R++){w.push(_.length);var W=p._ptr[R],G=p._ptr[R+1];if(x)for(var k=W;k<G;k++){var L=p._index[k];L>=m&&L<=v&&D(p._values[k],L-m,R-b)}else{for(var q={},Y=W;Y<G;Y++){var j=p._index[Y];q[j]=p._values[Y]}for(var J=m;J<=v;J++){var lt=J in q?q[J]:0;D(lt,J-m,R-b)}}}return w.push(_.length),new i({values:_,index:M,ptr:w,size:[v-m+1,y-b+1]})}i.prototype.forEach=function(p,m){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var v=this,b=this._size[0],y=this._size[1],S=0;S<y;S++){var x=this._ptr[S],_=this._ptr[S+1];if(m)for(var M=x;M<_;M++){var w=this._index[M];p(this._values[M],[w,S],v)}else{for(var C={},P=x;P<_;P++){var D=this._index[P];C[D]=this._values[P]}for(var R=0;R<b;R++){var W=R in C?C[R]:0;p(W,[R,S],v)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var p=this._size[1],m=0;m<p;m++)for(var v=this._ptr[m],b=this._ptr[m+1],y=v;y<b;y++){var S=this._index[y];yield{value:this._values[y],index:[S,m]}}},i.prototype.toArray=function(){return g(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return g(this._values,this._index,this._ptr,this._size,!1)};function g(p,m,v,b,y){var S=b[0],x=b[1],_=[],M,w;for(M=0;M<S;M++)for(_[M]=[],w=0;w<x;w++)_[M][w]=0;for(w=0;w<x;w++)for(var C=v[w],P=v[w+1],D=C;D<P;D++)M=m[D],_[M][w]=p?y?ft(p[D]):p[D]:1;return _}return i.prototype.format=function(p){for(var m=this._size[0],v=this._size[1],b=this.density(),y="Sparse Matrix ["+vt(m,p)+" x "+vt(v,p)+"] density: "+vt(b,p)+`
7515
7515
  `,S=0;S<v;S++)for(var x=this._ptr[S],_=this._ptr[S+1],M=x;M<_;M++){var w=this._index[M];y+=`
7516
- (`+vt(w,p)+", "+vt(S,p)+") ==> "+(this._values?vt(this._values[M],p):"X")}return y},i.prototype.toString=function(){return vt(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(p){if(p){if(it(p)&&(p=p.toNumber()),!nt(p)||!tt(p))throw new TypeError("The parameter k must be an integer number")}else p=0;var m=p>0?p:0,v=p<0?-p:0,b=this._size[0],y=this._size[1],S=Math.min(b-v,y-m),x=[],_=[],M=[];M[0]=0;for(var w=m;w<y&&x.length<S;w++)for(var C=this._ptr[w],P=this._ptr[w+1],D=C;D<P;D++){var R=this._index[D];if(R===w-m+v){x.push(this._values[D]),_[x.length-1]=R-v;break}}return M.push(x.length),new i({values:x,index:_,ptr:M,size:[S,1]})},i.fromJSON=function(p){return new i(p)},i.diagonal=function(p,m,v,b,y){if(!yt(p))throw new TypeError("Array expected, size parameter");if(p.length!==2)throw new Error("Only two dimensions matrix are supported");if(p=p.map(function(j){if(it(j)&&(j=j.toNumber()),!nt(j)||!tt(j)||j<1)throw new Error("Size values must be positive integers");return j}),v){if(it(v)&&(v=v.toNumber()),!nt(v)||!tt(v))throw new TypeError("The parameter k must be an integer number")}else v=0;var S=t,x=0;jt(y)&&(S=e.find(t,[y,y])||t,x=e.convert(0,y));var _=v>0?v:0,M=v<0?-v:0,w=p[0],C=p[1],P=Math.min(w-M,C-_),D;if(yt(m)){if(m.length!==P)throw new Error("Invalid value array length");D=function(J){return m[J]}}else if(ot(m)){var R=m.size();if(R.length!==1||R[0]!==P)throw new Error("Invalid matrix length");D=function(J){return m.get([J])}}else D=function(){return m};for(var W=[],G=[],k=[],L=0;L<C;L++){k.push(W.length);var q=L-_;if(q>=0&&q<P){var Y=D(q);S(Y,x)||(G.push(q+M),W.push(Y))}}return k.push(W.length),new i({values:W,index:G,ptr:k,size:[w,C]})},i.prototype.swapRows=function(p,m){if(!nt(p)||!tt(p)||!nt(m)||!tt(m))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Et(p,this._size[0]),Et(m,this._size[0]),i._swapRows(p,m,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(p,m,v,b,y){for(var S=b[p],x=b[p+1],_=S;_<x;_++)y(v[_],m[_])},i._swapRows=function(p,m,v,b,y,S){for(var x=0;x<v;x++){var _=S[x],M=S[x+1],w=s(p,_,M,y),C=s(m,_,M,y);if(w<M&&C<M&&y[w]===p&&y[C]===m){if(b){var P=b[w];b[w]=b[C],b[C]=P}continue}if(w<M&&y[w]===p&&(C>=M||y[C]!==m)){var D=b?b[w]:void 0;y.splice(C,0,m),b&&b.splice(C,0,D),y.splice(C<=w?w+1:w,1),b&&b.splice(C<=w?w+1:w,1);continue}if(C<M&&y[C]===m&&(w>=M||y[w]!==p)){var R=b?b[C]:void 0;y.splice(w,0,p),b&&b.splice(w,0,R),y.splice(w<=C?C+1:C,1),b&&b.splice(w<=C?C+1:C,1)}}},i},{isClass:!0});var pm="number",fm=["typed"];function dm(r){var e=r.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var t={"0b":2,"0o":8,"0x":16}[e[1]],n=e[2],i=e[3];return{input:r,radix:t,integerPart:n,fractionalPart:i}}else return null}function gm(r){for(var e=parseInt(r.integerPart,r.radix),t=0,n=0;n<r.fractionalPart.length;n++){var i=parseInt(r.fractionalPart[n],r.radix);t+=i/Math.pow(r.radix,n+1)}var o=e+t;if(isNaN(o))throw new SyntaxError('String "'+r.input+'" is not a valid number');return o}var Co=N(pm,fm,r=>{var{typed:e}=r,t=e("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var o=dm(i);if(o)return gm(o);var a=0,c=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);c&&(a=Number(c[2]),i=c[1]);var l=Number(i);if(isNaN(l))throw new SyntaxError('String "'+i+'" is not a valid number');if(c){if(l>2**a-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));l>=2**(a-1)&&(l=l-2**a)}return l},BigNumber:function(i){return i.toNumber()},bigint:function(i){return Number(i)},Fraction:function(i){return i.valueOf()},Unit:e.referToSelf(n=>i=>{var o=i.clone();return o.value=n(i.value),o}),null:function(i){return 0},"Unit, string | Unit":function(i,o){return i.toNumber(o)},"Array | Matrix":e.referToSelf(n=>i=>_t(i,n))});return t.fromJSON=function(n){return parseFloat(n.value)},t});var mm="bignumber",ym=["typed","BigNumber"],Ao=N(mm,ym,r=>{var{typed:e,BigNumber:t}=r;return e("bignumber",{"":function(){return new t(0)},number:function(i){return new t(i+"")},string:function(i){var o=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(o){var a=o[2],c=t(o[1]),l=new t(2).pow(Number(a));if(c.gt(l.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var s=new t(2).pow(Number(a)-1);return c.gte(s)?c.sub(l):c}return new t(i)},BigNumber:function(i){return i},bigint:function(i){return new t(i.toString())},Unit:e.referToSelf(n=>i=>{var o=i.clone();return o.value=n(i.value),o}),Fraction:function(i){return new t(i.n).div(i.d).times(i.s)},null:function(i){return new t(0)},"Array | Matrix":e.referToSelf(n=>i=>_t(i,n))})});var vm="fraction",_m=["typed","Fraction"],Po=N(vm,_m,r=>{var{typed:e,Fraction:t}=r;return e("fraction",{number:function(i){if(!isFinite(i)||isNaN(i))throw new Error(i+" cannot be represented as a fraction");return new t(i)},string:function(i){return new t(i)},"number, number":function(i,o){return new t(i,o)},null:function(i){return new t(0)},BigNumber:function(i){return new t(i.toString())},bigint:function(i){return new t(i.toString())},Fraction:function(i){return i},Unit:e.referToSelf(n=>i=>{var o=i.clone();return o.value=n(i.value),o}),Object:function(i){return new t(i)},"Array | Matrix":e.referToSelf(n=>i=>_t(i,n))})});var fl="matrix",xm=["typed","Matrix","DenseMatrix","SparseMatrix"],Do=N(fl,xm,r=>{var{typed:e,Matrix:t,DenseMatrix:n,SparseMatrix:i}=r;return e(fl,{"":function(){return o([])},string:function(c){return o([],c)},"string, string":function(c,l){return o([],c,l)},Array:function(c){return o(c)},Matrix:function(c){return o(c,c.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(a,c,l){if(c==="dense"||c==="default"||c===void 0)return new n(a,l);if(c==="sparse")return new i(a,l);throw new TypeError("Unknown matrix type "+JSON.stringify(c)+".")}});var dl="unaryMinus",Em=["typed"],Io=N(dl,Em,r=>{var{typed:e}=r;return e(dl,{number:xo,"Complex | BigNumber | Fraction":t=>t.neg(),bigint:t=>-t,Unit:e.referToSelf(t=>n=>{var i=n.clone();return i.value=e.find(t,i.valueType())(n.value),i}),"Array | Matrix":e.referToSelf(t=>n=>_t(n,t,!0))})});var gl="abs",bm=["typed"],Ro=N(gl,bm,r=>{var{typed:e}=r;return e(gl,{number:mo,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),bigint:t=>t<0n?-t:t,"Array | Matrix":e.referToSelf(t=>n=>_t(n,t,!0))})});var ml="addScalar",Sm=["typed"],No=N(ml,Sm,r=>{var{typed:e}=r;return e(ml,{"number, number":yo,"Complex, Complex":function(n,i){return n.add(i)},"BigNumber, BigNumber":function(n,i){return n.plus(i)},"bigint, bigint":function(n,i){return n+i},"Fraction, Fraction":function(n,i){return n.add(i)},"Unit, Unit":e.referToSelf(t=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var o=n.clone();return o.value=e.find(t,[o.valueType(),i.valueType()])(o.value,i.value),o.fixPrefix=!1,o})})});var yl="subtractScalar",Mm=["typed"],Lo=N(yl,Mm,r=>{var{typed:e}=r;return e(yl,{"number, number":vo,"Complex, Complex":function(n,i){return n.sub(i)},"BigNumber, BigNumber":function(n,i){return n.minus(i)},"bigint, bigint":function(n,i){return n-i},"Fraction, Fraction":function(n,i){return n.sub(i)},"Unit, Unit":e.referToSelf(t=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var o=n.clone();return o.value=e.find(t,[o.valueType(),i.valueType()])(o.value,i.value),o.fixPrefix=!1,o})})});var wm="matAlgo11xS0s",Tm=["typed","equalScalar"],De=N(wm,Tm,r=>{var{typed:e,equalScalar:t}=r;return function(i,o,a,c){var l=i._values,s=i._index,u=i._ptr,h=i._size,f=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=h[0],g=h[1],p,m=t,v=0,b=a;typeof f=="string"&&(p=f,m=e.find(t,[p,p]),v=e.convert(0,p),o=e.convert(o,p),b=e.find(a,[p,p]));for(var y=[],S=[],x=[],_=0;_<g;_++){x[_]=S.length;for(var M=u[_],w=u[_+1],C=M;C<w;C++){var P=s[C],D=c?b(o,l[C]):b(l[C],o);m(D,v)||(S.push(P),y.push(D))}}return x[g]=S.length,i.createSparseMatrix({values:y,index:S,ptr:x,size:[d,g],datatype:p})}});var Cm="matAlgo12xSfs",Am=["typed","DenseMatrix"],Nn=N(Cm,Am,r=>{var{typed:e,DenseMatrix:t}=r;return function(i,o,a,c){var l=i._values,s=i._index,u=i._ptr,h=i._size,f=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=h[0],g=h[1],p,m=a;typeof f=="string"&&(p=f,o=e.convert(o,p),m=e.find(a,[p,p]));for(var v=[],b=[],y=[],S=0;S<g;S++){for(var x=S+1,_=u[S],M=u[S+1],w=_;w<M;w++){var C=s[w];b[C]=l[w],y[C]=x}for(var P=0;P<d;P++)S===0&&(v[P]=[]),y[P]===x?v[P][S]=c?m(o,b[P]):m(b[P],o):v[P][S]=c?m(o,0):m(0,o)}return new t({data:v,size:[d,g],datatype:p})}});var Pm="matAlgo14xDs",Dm=["typed"],Ie=N(Pm,Dm,r=>{var{typed:e}=r;return function(i,o,a,c){var l=i._data,s=i._size,u=i._datatype,h,f=a;typeof u=="string"&&(h=u,o=e.convert(o,h),f=e.find(a,[h,h]));var d=s.length>0?t(f,0,s,s[0],l,o,c):[];return i.createDenseMatrix({data:d,size:ft(s),datatype:h})};function t(n,i,o,a,c,l,s){var u=[];if(i===o.length-1)for(var h=0;h<a;h++)u[h]=s?n(l,c[h]):n(c[h],l);else for(var f=0;f<a;f++)u[f]=t(n,i+1,o,o[i+1],c[f],l,s);return u}});var Oo="ceil",Im=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Rm=N(Oo,["typed","config","round"],r=>{var{typed:e,config:t,round:n}=r;return e(Oo,{number:function(o){return pe(o,n(o),t.relTol,t.absTol)?n(o):Math.ceil(o)},"number, number":function(o,a){if(pe(o,n(o,a),t.relTol,t.absTol))return n(o,a);var[c,l]="".concat(o,"e").split("e"),s=Math.ceil(Number("".concat(c,"e").concat(Number(l)+a)));return[c,l]="".concat(s,"e").split("e"),Number("".concat(c,"e").concat(Number(l)-a))}})}),Fo=N(Oo,Im,r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:o,zeros:a,DenseMatrix:c}=r,l=De({typed:e,equalScalar:o}),s=Nn({typed:e,DenseMatrix:c}),u=Ie({typed:e}),h=Rm({typed:e,config:t,round:n});return e("ceil",{number:h.signatures.number,"number,number":h.signatures["number,number"],Complex:function(d){return d.ceil()},"Complex, number":function(d,g){return d.ceil(g)},"Complex, BigNumber":function(d,g){return d.ceil(g.toNumber())},BigNumber:function(d){return Je(d,n(d),t.relTol,t.absTol)?n(d):d.ceil()},"BigNumber, BigNumber":function(d,g){return Je(d,n(d,g),t.relTol,t.absTol)?n(d,g):d.toDecimalPlaces(g.toNumber(),Kn.ROUND_CEIL)},Fraction:function(d){return d.ceil()},"Fraction, number":function(d,g){return d.ceil(g)},"Fraction, BigNumber":function(d,g){return d.ceil(g.toNumber())},"Array | Matrix":e.referToSelf(f=>d=>_t(d,f,!0)),"Array, number | BigNumber":e.referToSelf(f=>(d,g)=>_t(d,p=>f(p,g),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(f=>(d,g)=>l(d,g,f,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(f=>(d,g)=>u(d,g,f,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(f=>(d,g)=>u(i(g),d,f,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(f=>(d,g)=>o(d,0)?a(g.size(),g.storage()):g.storage()==="dense"?u(g,d,f,!0):s(g,d,f,!0))})});var vl="exp",Nm=["typed"],Uo=N(vl,Nm,r=>{var{typed:e}=r;return e(vl,{number:Eo,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var Lm="matAlgo02xDS0",Om=["typed","equalScalar"],_l=N(Lm,Om,r=>{var{typed:e,equalScalar:t}=r;return function(i,o,a,c){var l=i._data,s=i._size,u=i._datatype||i.getDataType(),h=o._values,f=o._index,d=o._ptr,g=o._size,p=o._datatype||o._data===void 0?o._datatype:o.getDataType();if(s.length!==g.length)throw new Q(s.length,g.length);if(s[0]!==g[0]||s[1]!==g[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+g+")");if(!h)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=s[0],v=s[1],b,y=t,S=0,x=a;typeof u=="string"&&u===p&&u!=="mixed"&&(b=u,y=e.find(t,[b,b]),S=e.convert(0,b),x=e.find(a,[b,b]));for(var _=[],M=[],w=[],C=0;C<v;C++){w[C]=M.length;for(var P=d[C],D=d[C+1],R=P;R<D;R++){var W=f[R],G=c?x(h[R],l[W][C]):x(l[W][C],h[R]);y(G,S)||(M.push(W),_.push(G))}}return w[v]=M.length,o.createSparseMatrix({values:_,index:M,ptr:w,size:[m,v],datatype:u===i._datatype&&p===o._datatype?b:void 0})}});var Fm="matAlgo03xDSf",Um=["typed"],xl=N(Fm,Um,r=>{var{typed:e}=r;return function(n,i,o,a){var c=n._data,l=n._size,s=n._datatype||n.getDataType(),u=i._values,h=i._index,f=i._ptr,d=i._size,g=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(l.length!==d.length)throw new Q(l.length,d.length);if(l[0]!==d[0]||l[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var p=l[0],m=l[1],v,b=0,y=o;typeof s=="string"&&s===g&&s!=="mixed"&&(v=s,b=e.convert(0,v),y=e.find(o,[v,v]));for(var S=[],x=0;x<p;x++)S[x]=[];for(var _=[],M=[],w=0;w<m;w++){for(var C=w+1,P=f[w],D=f[w+1],R=P;R<D;R++){var W=h[R];_[W]=a?y(u[R],c[W][w]):y(c[W][w],u[R]),M[W]=C}for(var G=0;G<p;G++)M[G]===C?S[G][w]=_[G]:S[G][w]=a?y(b,c[G][w]):y(c[G][w],b)}return n.createDenseMatrix({data:S,size:[p,m],datatype:s===n._datatype&&g===i._datatype?v:void 0})}});var Bm="matAlgo13xDD",zm=["typed"],El=N(Bm,zm,r=>{var{typed:e}=r;return function(i,o,a){var c=i._data,l=i._size,s=i._datatype,u=o._data,h=o._size,f=o._datatype,d=[];if(l.length!==h.length)throw new Q(l.length,h.length);for(var g=0;g<l.length;g++){if(l[g]!==h[g])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+h+")");d[g]=l[g]}var p,m=a;typeof s=="string"&&s===f&&(p=s,m=e.find(a,[p,p]));var v=d.length>0?t(m,0,d,d[0],c,u):[];return i.createDenseMatrix({data:v,size:d,datatype:p})};function t(n,i,o,a,c,l){var s=[];if(i===o.length-1)for(var u=0;u<a;u++)s[u]=n(c[u],l[u]);else for(var h=0;h<a;h++)s[h]=t(n,i+1,o,o[i+1],c[h],l[h]);return s}});function Dt(r,e){if(ce(r.size(),e.size()))return[r,e];var t=ho(r.size(),e.size());return[r,e].map(n=>Gm(n,t))}function Gm(r,e){return ce(r.size(),e)?r:r.create(tr(r.valueOf(),e),r.datatype())}var km="matrixAlgorithmSuite",Vm=["typed","matrix"],fi=N(km,Vm,r=>{var{typed:e,matrix:t}=r,n=El({typed:e}),i=Ie({typed:e});return function(a){var c=a.elop,l=a.SD||a.DS,s;c?(s={"DenseMatrix, DenseMatrix":(d,g)=>n(...Dt(d,g),c),"Array, Array":(d,g)=>n(...Dt(t(d),t(g)),c).valueOf(),"Array, DenseMatrix":(d,g)=>n(...Dt(t(d),g),c),"DenseMatrix, Array":(d,g)=>n(...Dt(d,t(g)),c)},a.SS&&(s["SparseMatrix, SparseMatrix"]=(d,g)=>a.SS(...Dt(d,g),c,!1)),a.DS&&(s["DenseMatrix, SparseMatrix"]=(d,g)=>a.DS(...Dt(d,g),c,!1),s["Array, SparseMatrix"]=(d,g)=>a.DS(...Dt(t(d),g),c,!1)),l&&(s["SparseMatrix, DenseMatrix"]=(d,g)=>l(...Dt(g,d),c,!0),s["SparseMatrix, Array"]=(d,g)=>l(...Dt(t(g),d),c,!0))):(s={"DenseMatrix, DenseMatrix":e.referToSelf(d=>(g,p)=>n(...Dt(g,p),d)),"Array, Array":e.referToSelf(d=>(g,p)=>n(...Dt(t(g),t(p)),d).valueOf()),"Array, DenseMatrix":e.referToSelf(d=>(g,p)=>n(...Dt(t(g),p),d)),"DenseMatrix, Array":e.referToSelf(d=>(g,p)=>n(...Dt(g,t(p)),d))},a.SS&&(s["SparseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,p)=>a.SS(...Dt(g,p),d,!1))),a.DS&&(s["DenseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,p)=>a.DS(...Dt(g,p),d,!1)),s["Array, SparseMatrix"]=e.referToSelf(d=>(g,p)=>a.DS(...Dt(t(g),p),d,!1))),l&&(s["SparseMatrix, DenseMatrix"]=e.referToSelf(d=>(g,p)=>l(...Dt(p,g),d,!0)),s["SparseMatrix, Array"]=e.referToSelf(d=>(g,p)=>l(...Dt(t(p),g),d,!0))));var u=a.scalar||"any",h=a.Ds||a.Ss;h&&(c?(s["DenseMatrix,"+u]=(d,g)=>i(d,g,c,!1),s[u+", DenseMatrix"]=(d,g)=>i(g,d,c,!0),s["Array,"+u]=(d,g)=>i(t(d),g,c,!1).valueOf(),s[u+", Array"]=(d,g)=>i(t(g),d,c,!0).valueOf()):(s["DenseMatrix,"+u]=e.referToSelf(d=>(g,p)=>i(g,p,d,!1)),s[u+", DenseMatrix"]=e.referToSelf(d=>(g,p)=>i(p,g,d,!0)),s["Array,"+u]=e.referToSelf(d=>(g,p)=>i(t(g),p,d,!1).valueOf()),s[u+", Array"]=e.referToSelf(d=>(g,p)=>i(t(p),g,d,!0).valueOf())));var f=a.sS!==void 0?a.sS:a.Ss;return c?(a.Ss&&(s["SparseMatrix,"+u]=(d,g)=>a.Ss(d,g,c,!1)),f&&(s[u+", SparseMatrix"]=(d,g)=>f(g,d,c,!0))):(a.Ss&&(s["SparseMatrix,"+u]=e.referToSelf(d=>(g,p)=>a.Ss(g,p,d,!1))),f&&(s[u+", SparseMatrix"]=e.referToSelf(d=>(g,p)=>f(p,g,d,!0)))),c&&c.signatures&&Zr(s,c.signatures),s}});var Hm="matAlgo01xDSid",Wm=["typed"],bl=N(Hm,Wm,r=>{var{typed:e}=r;return function(n,i,o,a){var c=n._data,l=n._size,s=n._datatype||n.getDataType(),u=i._values,h=i._index,f=i._ptr,d=i._size,g=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(l.length!==d.length)throw new Q(l.length,d.length);if(l[0]!==d[0]||l[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var p=l[0],m=l[1],v=typeof s=="string"&&s!=="mixed"&&s===g?s:void 0,b=v?e.find(o,[v,v]):o,y,S,x=[];for(y=0;y<p;y++)x[y]=[];var _=[],M=[];for(S=0;S<m;S++){for(var w=S+1,C=f[S],P=f[S+1],D=C;D<P;D++)y=h[D],_[y]=a?b(u[D],c[y][S]):b(c[y][S],u[D]),M[y]=w;for(y=0;y<p;y++)M[y]===w?x[y][S]=_[y]:x[y][S]=c[y][S]}return n.createDenseMatrix({data:x,size:[p,m],datatype:s===n._datatype&&g===i._datatype?v:void 0})}});var qm="matAlgo04xSidSid",Xm=["typed","equalScalar"],Sl=N(qm,Xm,r=>{var{typed:e,equalScalar:t}=r;return function(i,o,a){var c=i._values,l=i._index,s=i._ptr,u=i._size,h=i._datatype||i._data===void 0?i._datatype:i.getDataType(),f=o._values,d=o._index,g=o._ptr,p=o._size,m=o._datatype||o._data===void 0?o._datatype:o.getDataType();if(u.length!==p.length)throw new Q(u.length,p.length);if(u[0]!==p[0]||u[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+p+")");var v=u[0],b=u[1],y,S=t,x=0,_=a;typeof h=="string"&&h===m&&h!=="mixed"&&(y=h,S=e.find(t,[y,y]),x=e.convert(0,y),_=e.find(a,[y,y]));var M=c&&f?[]:void 0,w=[],C=[],P=c&&f?[]:void 0,D=c&&f?[]:void 0,R=[],W=[],G,k,L,q,Y;for(k=0;k<b;k++){C[k]=w.length;var j=k+1;for(q=s[k],Y=s[k+1],L=q;L<Y;L++)G=l[L],w.push(G),R[G]=j,P&&(P[G]=c[L]);for(q=g[k],Y=g[k+1],L=q;L<Y;L++)if(G=d[L],R[G]===j){if(P){var J=_(P[G],f[L]);S(J,x)?R[G]=null:P[G]=J}}else w.push(G),W[G]=j,D&&(D[G]=f[L]);if(P&&D)for(L=C[k];L<w.length;)G=w[L],R[G]===j?(M[L]=P[G],L++):W[G]===j?(M[L]=D[G],L++):w.splice(L,1)}return C[b]=w.length,i.createSparseMatrix({values:M,index:w,ptr:C,size:[v,b],datatype:h===i._datatype&&m===o._datatype?y:void 0})}});var jm="matAlgo10xSids",Ym=["typed","DenseMatrix"],Ml=N(jm,Ym,r=>{var{typed:e,DenseMatrix:t}=r;return function(i,o,a,c){var l=i._values,s=i._index,u=i._ptr,h=i._size,f=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=h[0],g=h[1],p,m=a;typeof f=="string"&&(p=f,o=e.convert(o,p),m=e.find(a,[p,p]));for(var v=[],b=[],y=[],S=0;S<g;S++){for(var x=S+1,_=u[S],M=u[S+1],w=_;w<M;w++){var C=s[w];b[C]=l[w],y[C]=x}for(var P=0;P<d;P++)S===0&&(v[P]=[]),y[P]===x?v[P][S]=c?m(o,b[P]):m(b[P],o):v[P][S]=o}return new t({data:v,size:[d,g],datatype:p})}});var wl="log2",$m=["typed","config","Complex"],Bo=N(wl,$m,r=>{var{typed:e,config:t,Complex:n}=r;return e(wl,{number:function(a){return a>=0||t.predictable?bo(a):i(new n(a,0))},Complex:i,BigNumber:function(a){return!a.isNegative()||t.predictable?a.log(2):i(new n(a.toNumber(),0))},"Array | Matrix":e.referToSelf(o=>a=>_t(a,o))});function i(o){var a=Math.sqrt(o.re*o.re+o.im*o.im);return new n(Math.log2?Math.log2(a):Math.log(a)/Math.LN2,Math.atan2(o.im,o.re)/Math.LN2)}});var Zm="multiplyScalar",Km=["typed"],zo=N(Zm,Km,r=>{var{typed:e}=r;return e("multiplyScalar",{"number, number":_o,"Complex, Complex":function(n,i){return n.mul(i)},"BigNumber, BigNumber":function(n,i){return n.times(i)},"bigint, bigint":function(n,i){return n*i},"Fraction, Fraction":function(n,i){return n.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(t,n)=>n.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,n)=>t.multiply(n)})});var Tl="multiply",Jm=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],Go=N(Tl,Jm,r=>{var{typed:e,matrix:t,addScalar:n,multiplyScalar:i,equalScalar:o,dot:a}=r,c=De({typed:e,equalScalar:o}),l=Ie({typed:e});function s(x,_){switch(x.length){case 1:switch(_.length){case 1:if(x[0]!==_[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(x[0]!==_[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+x[0]+") must match Matrix rows ("+_[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+_.length+" dimensions)")}break;case 2:switch(_.length){case 1:if(x[1]!==_[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+x[1]+") must match Vector length ("+_[0]+")");break;case 2:if(x[1]!==_[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+x[1]+") must match Matrix B rows ("+_[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+_.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+x.length+" dimensions)")}}function u(x,_,M){if(M===0)throw new Error("Cannot multiply two empty vectors");return a(x,_)}function h(x,_){if(_.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return f(x,_)}function f(x,_){var M=x._data,w=x._size,C=x._datatype||x.getDataType(),P=_._data,D=_._size,R=_._datatype||_.getDataType(),W=w[0],G=D[1],k,L=n,q=i;C&&R&&C===R&&typeof C=="string"&&C!=="mixed"&&(k=C,L=e.find(n,[k,k]),q=e.find(i,[k,k]));for(var Y=[],j=0;j<G;j++){for(var J=q(M[0],P[0][j]),lt=1;lt<W;lt++)J=L(J,q(M[lt],P[lt][j]));Y[j]=J}return x.createDenseMatrix({data:Y,size:[G],datatype:C===x._datatype&&R===_._datatype?k:void 0})}var d=e("_multiplyMatrixVector",{"DenseMatrix, any":p,"SparseMatrix, any":b}),g=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":m,"DenseMatrix, SparseMatrix":v,"SparseMatrix, DenseMatrix":y,"SparseMatrix, SparseMatrix":S});function p(x,_){var M=x._data,w=x._size,C=x._datatype||x.getDataType(),P=_._data,D=_._datatype||_.getDataType(),R=w[0],W=w[1],G,k=n,L=i;C&&D&&C===D&&typeof C=="string"&&C!=="mixed"&&(G=C,k=e.find(n,[G,G]),L=e.find(i,[G,G]));for(var q=[],Y=0;Y<R;Y++){for(var j=M[Y],J=L(j[0],P[0]),lt=1;lt<W;lt++)J=k(J,L(j[lt],P[lt]));q[Y]=J}return x.createDenseMatrix({data:q,size:[R],datatype:C===x._datatype&&D===_._datatype?G:void 0})}function m(x,_){var M=x._data,w=x._size,C=x._datatype||x.getDataType(),P=_._data,D=_._size,R=_._datatype||_.getDataType(),W=w[0],G=w[1],k=D[1],L,q=n,Y=i;C&&R&&C===R&&typeof C=="string"&&C!=="mixed"&&C!=="mixed"&&(L=C,q=e.find(n,[L,L]),Y=e.find(i,[L,L]));for(var j=[],J=0;J<W;J++){var lt=M[J];j[J]=[];for(var at=0;at<k;at++){for(var pt=Y(lt[0],P[0][at]),Tt=1;Tt<G;Tt++)pt=q(pt,Y(lt[Tt],P[Tt][at]));j[J][at]=pt}}return x.createDenseMatrix({data:j,size:[W,k],datatype:C===x._datatype&&R===_._datatype?L:void 0})}function v(x,_){var M=x._data,w=x._size,C=x._datatype||x.getDataType(),P=_._values,D=_._index,R=_._ptr,W=_._size,G=_._datatype||_._data===void 0?_._datatype:_.getDataType();if(!P)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var k=w[0],L=W[1],q,Y=n,j=i,J=o,lt=0;C&&G&&C===G&&typeof C=="string"&&C!=="mixed"&&(q=C,Y=e.find(n,[q,q]),j=e.find(i,[q,q]),J=e.find(o,[q,q]),lt=e.convert(0,q));for(var at=[],pt=[],Tt=[],wt=_.createSparseMatrix({values:at,index:pt,ptr:Tt,size:[k,L],datatype:C===x._datatype&&G===_._datatype?q:void 0}),St=0;St<L;St++){Tt[St]=pt.length;var xt=R[St],$t=R[St+1];if($t>xt)for(var Mt=0,gt=0;gt<k;gt++){for(var se=gt+1,Ot=void 0,ct=xt;ct<$t;ct++){var It=D[ct];Mt!==se?(Ot=j(M[gt][It],P[ct]),Mt=se):Ot=Y(Ot,j(M[gt][It],P[ct]))}Mt===se&&!J(Ot,lt)&&(pt.push(gt),at.push(Ot))}}return Tt[L]=pt.length,wt}function b(x,_){var M=x._values,w=x._index,C=x._ptr,P=x._datatype||x._data===void 0?x._datatype:x.getDataType();if(!M)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var D=_._data,R=_._datatype||_.getDataType(),W=x._size[0],G=_._size[0],k=[],L=[],q=[],Y,j=n,J=i,lt=o,at=0;P&&R&&P===R&&typeof P=="string"&&P!=="mixed"&&(Y=P,j=e.find(n,[Y,Y]),J=e.find(i,[Y,Y]),lt=e.find(o,[Y,Y]),at=e.convert(0,Y));var pt=[],Tt=[];q[0]=0;for(var wt=0;wt<G;wt++){var St=D[wt];if(!lt(St,at))for(var xt=C[wt],$t=C[wt+1],Mt=xt;Mt<$t;Mt++){var gt=w[Mt];Tt[gt]?pt[gt]=j(pt[gt],J(St,M[Mt])):(Tt[gt]=!0,L.push(gt),pt[gt]=J(St,M[Mt]))}}for(var se=L.length,Ot=0;Ot<se;Ot++){var ct=L[Ot];k[Ot]=pt[ct]}return q[1]=L.length,x.createSparseMatrix({values:k,index:L,ptr:q,size:[W,1],datatype:P===x._datatype&&R===_._datatype?Y:void 0})}function y(x,_){var M=x._values,w=x._index,C=x._ptr,P=x._datatype||x._data===void 0?x._datatype:x.getDataType();if(!M)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var D=_._data,R=_._datatype||_.getDataType(),W=x._size[0],G=_._size[0],k=_._size[1],L,q=n,Y=i,j=o,J=0;P&&R&&P===R&&typeof P=="string"&&P!=="mixed"&&(L=P,q=e.find(n,[L,L]),Y=e.find(i,[L,L]),j=e.find(o,[L,L]),J=e.convert(0,L));for(var lt=[],at=[],pt=[],Tt=x.createSparseMatrix({values:lt,index:at,ptr:pt,size:[W,k],datatype:P===x._datatype&&R===_._datatype?L:void 0}),wt=[],St=[],xt=0;xt<k;xt++){pt[xt]=at.length;for(var $t=xt+1,Mt=0;Mt<G;Mt++){var gt=D[Mt][xt];if(!j(gt,J))for(var se=C[Mt],Ot=C[Mt+1],ct=se;ct<Ot;ct++){var It=w[ct];St[It]!==$t?(St[It]=$t,at.push(It),wt[It]=Y(gt,M[ct])):wt[It]=q(wt[It],Y(gt,M[ct]))}}for(var zt=pt[xt],Ee=at.length,Ge=zt;Ge<Ee;Ge++){var Un=at[Ge];lt[Ge]=wt[Un]}}return pt[k]=at.length,Tt}function S(x,_){var M=x._values,w=x._index,C=x._ptr,P=x._datatype||x._data===void 0?x._datatype:x.getDataType(),D=_._values,R=_._index,W=_._ptr,G=_._datatype||_._data===void 0?_._datatype:_.getDataType(),k=x._size[0],L=_._size[1],q=M&&D,Y,j=n,J=i;P&&G&&P===G&&typeof P=="string"&&P!=="mixed"&&(Y=P,j=e.find(n,[Y,Y]),J=e.find(i,[Y,Y]));for(var lt=q?[]:void 0,at=[],pt=[],Tt=x.createSparseMatrix({values:lt,index:at,ptr:pt,size:[k,L],datatype:P===x._datatype&&G===_._datatype?Y:void 0}),wt=q?[]:void 0,St=[],xt,$t,Mt,gt,se,Ot,ct,It,zt=0;zt<L;zt++){pt[zt]=at.length;var Ee=zt+1;for(se=W[zt],Ot=W[zt+1],gt=se;gt<Ot;gt++)if(It=R[gt],q)for($t=C[It],Mt=C[It+1],xt=$t;xt<Mt;xt++)ct=w[xt],St[ct]!==Ee?(St[ct]=Ee,at.push(ct),wt[ct]=J(D[gt],M[xt])):wt[ct]=j(wt[ct],J(D[gt],M[xt]));else for($t=C[It],Mt=C[It+1],xt=$t;xt<Mt;xt++)ct=w[xt],St[ct]!==Ee&&(St[ct]=Ee,at.push(ct));if(q)for(var Ge=pt[zt],Un=at.length,cn=Ge;cn<Un;cn++){var or=at[cn];lt[cn]=wt[or]}}return pt[L]=at.length,Tt}return e(Tl,i,{"Array, Array":e.referTo("Matrix, Matrix",x=>(_,M)=>{s(st(_),st(M));var w=x(t(_),t(M));return ot(w)?w.valueOf():w}),"Matrix, Matrix":function(_,M){var w=_.size(),C=M.size();return s(w,C),w.length===1?C.length===1?u(_,M,w[0]):h(_,M):C.length===1?d(_,M):g(_,M)},"Matrix, Array":e.referTo("Matrix,Matrix",x=>(_,M)=>x(_,t(M))),"Array, Matrix":e.referToSelf(x=>(_,M)=>x(t(_,M.storage()),M)),"SparseMatrix, any":function(_,M){return c(_,M,i,!1)},"DenseMatrix, any":function(_,M){return l(_,M,i,!1)},"any, SparseMatrix":function(_,M){return c(M,_,i,!0)},"any, DenseMatrix":function(_,M){return l(M,_,i,!0)},"Array, any":function(_,M){return l(t(_),M,i,!1).valueOf()},"any, Array":function(_,M){return l(t(M),_,i,!0).valueOf()},"any, any":i,"any, any, ...any":e.referToSelf(x=>(_,M,w)=>{for(var C=x(_,M),P=0;P<w.length;P++)C=x(C,w[P]);return C})})});var Qm="matAlgo07xSSf",ty=["typed","DenseMatrix"],Cl=N(Qm,ty,r=>{var{typed:e,DenseMatrix:t}=r;return function(o,a,c){var l=o._size,s=o._datatype||o._data===void 0?o._datatype:o.getDataType(),u=a._size,h=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(l.length!==u.length)throw new Q(l.length,u.length);if(l[0]!==u[0]||l[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+u+")");var f=l[0],d=l[1],g,p=0,m=c;typeof s=="string"&&s===h&&s!=="mixed"&&(g=s,p=e.convert(0,g),m=e.find(c,[g,g]));var v,b,y=[];for(v=0;v<f;v++)y[v]=[];var S=[],x=[],_=[],M=[];for(b=0;b<d;b++){var w=b+1;for(n(o,b,_,S,w),n(a,b,M,x,w),v=0;v<f;v++){var C=_[v]===w?S[v]:p,P=M[v]===w?x[v]:p;y[v][b]=m(C,P)}}return new t({data:y,size:[f,d],datatype:s===o._datatype&&h===a._datatype?g:void 0})};function n(i,o,a,c,l){for(var s=i._values,u=i._index,h=i._ptr,f=h[o],d=h[o+1];f<d;f++){var g=u[f];a[g]=l,c[g]=s[f]}}});var Al="conj",ey=["typed"],ko=N(Al,ey,r=>{var{typed:e}=r;return e(Al,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":e.referToSelf(t=>n=>_t(n,t))})});var Pl="concat",ny=["typed","matrix","isInteger"],Vo=N(Pl,ny,r=>{var{typed:e,matrix:t,isInteger:n}=r;return e(Pl,{"...Array | Matrix | number | BigNumber":function(o){var a,c=o.length,l=-1,s,u=!1,h=[];for(a=0;a<c;a++){var f=o[a];if(ot(f)&&(u=!0),nt(f)||it(f)){if(a!==c-1)throw new Error("Dimension must be specified as last argument");if(s=l,l=f.valueOf(),!n(l))throw new TypeError("Integer number expected for dimension");if(l<0||a>0&&l>s)throw new _e(l,s+1)}else{var d=ft(f).valueOf(),g=st(d);if(h[a]=d,s=l,l=g.length-1,a>0&&l!==s)throw new Q(s+1,l+1)}}if(h.length===0)throw new SyntaxError("At least one matrix expected");for(var p=h.shift();h.length;)p=co(p,h.shift(),l);return u?t(p):p},"...string":function(o){return o.join("")}})});var Dl="identity",ry=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],Ho=N(Dl,ry,r=>{var{typed:e,config:t,matrix:n,BigNumber:i,DenseMatrix:o,SparseMatrix:a}=r;return e(Dl,{"":function(){return t.matrix==="Matrix"?n([]):[]},string:function(u){return n(u)},"number | BigNumber":function(u){return l(u,u,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(u,h){return l(u,u,h)},"number | BigNumber, number | BigNumber":function(u,h){return l(u,h,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(u,h,f){return l(u,h,f)},Array:function(u){return c(u)},"Array, string":function(u,h){return c(u,h)},Matrix:function(u){return c(u.valueOf(),u.storage())},"Matrix, string":function(u,h){return c(u.valueOf(),h)}});function c(s,u){switch(s.length){case 0:return u?n(u):[];case 1:return l(s[0],s[0],u);case 2:return l(s[0],s[1],u);default:throw new Error("Vector containing two values expected")}}function l(s,u,h){var f=it(s)||it(u)?i:null;if(it(s)&&(s=s.toNumber()),it(u)&&(u=u.toNumber()),!tt(s)||s<1)throw new Error("Parameters in function identity must be positive integers");if(!tt(u)||u<1)throw new Error("Parameters in function identity must be positive integers");var d=f?new i(1):1,g=f?new f(0):0,p=[s,u];if(h){if(h==="sparse")return a.diagonal(p,d,0,g);if(h==="dense")return o.diagonal(p,d,0,g);throw new TypeError('Unknown matrix type "'.concat(h,'"'))}for(var m=un([],p,g),v=s<u?s:u,b=0;b<v;b++)m[b][b]=d;return m}});function Il(){throw new Error('No "bignumber" implementation available')}function Rl(){throw new Error('No "fraction" implementation available')}function Nl(){throw new Error('No "matrix" implementation available')}var Ll="reshape",iy=["typed","isInteger","matrix"],Wo=N(Ll,iy,r=>{var{typed:e,isInteger:t}=r;return e(Ll,{"Matrix, Array":function(i,o){return i.reshape(o,!0)},"Array, Array":function(i,o){return o.forEach(function(a){if(!t(a))throw new TypeError("Invalid size for dimension: "+a)}),Jn(i,o)}})});var Ol="size",oy=["typed","config","?matrix"],qo=N(Ol,oy,r=>{var{typed:e,config:t,matrix:n}=r;return e(Ol,{Matrix:function(o){return o.create(o.size(),"number")},Array:st,string:function(o){return t.matrix==="Array"?[o.length]:n([o.length],"dense","number")},"number | Complex | BigNumber | Unit | boolean | null":function(o){return t.matrix==="Array"?[]:n?n([],"dense","number"):Nl()}})});var Fl="zeros",sy=["typed","config","matrix","BigNumber"],Xo=N(Fl,sy,r=>{var{typed:e,config:t,matrix:n,BigNumber:i}=r;return e(Fl,{"":function(){return t.matrix==="Array"?o([]):o([],"default")},"...number | BigNumber | string":function(s){var u=s[s.length-1];if(typeof u=="string"){var h=s.pop();return o(s,h)}else return t.matrix==="Array"?o(s):o(s,"default")},Array:o,Matrix:function(s){var u=s.storage();return o(s.valueOf(),u)},"Array | Matrix, string":function(s,u){return o(s.valueOf(),u)}});function o(l,s){var u=a(l),h=u?new i(0):0;if(c(l),s){var f=n(s);return l.length>0?f.resize(l,h):f}else{var d=[];return l.length>0?un(d,l,h):d}}function a(l){var s=!1;return l.forEach(function(u,h,f){it(u)&&(s=!0,f[h]=u.toNumber())}),s}function c(l){l.forEach(function(s){if(typeof s!="number"||!tt(s)||s<0)throw new Error("Parameters in function zeros must be positive integers")})}});var Ul="fft",ay=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],jo=N(Ul,ay,r=>{var{typed:e,matrix:t,addScalar:n,multiplyScalar:i,divideScalar:o,exp:a,tau:c,i:l,dotDivide:s,conj:u,pow:h,ceil:f,log2:d}=r;return e(Ul,{Array:g,Matrix:function(y){return y.create(g(y.valueOf()),y.datatype())}});function g(b){var y=st(b);return y.length===1?v(b,y[0]):p(b.map(S=>g(S,y.slice(1))),0)}function p(b,y){var S=st(b);if(y!==0)return new Array(S[0]).fill(0).map((_,M)=>p(b[M],y-1));if(S.length===1)return v(b);function x(_){var M=st(_);return new Array(M[1]).fill(0).map((w,C)=>new Array(M[0]).fill(0).map((P,D)=>_[D][C]))}return x(p(x(b),1))}function m(b){for(var y=b.length,S=a(o(i(-1,i(l,c)),y)),x=[],_=1-y;_<y;_++)x.push(h(S,o(h(_,2),2)));for(var M=h(2,f(d(y+y-1))),w=[...new Array(y).fill(0).map((L,q)=>i(b[q],x[y-1+q])),...new Array(M-y).fill(0)],C=[...new Array(y+y-1).fill(0).map((L,q)=>o(1,x[q])),...new Array(M-(y+y-1)).fill(0)],P=v(w),D=v(C),R=new Array(M).fill(0).map((L,q)=>i(P[q],D[q])),W=s(u(g(u(R))),M),G=[],k=y-1;k<y+y-1;k++)G.push(i(W[k],x[k]));return G}function v(b){var y=b.length;if(y===1)return[b[0]];if(y%2===0){for(var S=[...v(b.filter((w,C)=>C%2===0),y/2),...v(b.filter((w,C)=>C%2===1),y/2)],x=0;x<y/2;x++){var _=S[x],M=i(S[x+y/2],a(i(i(c,l),o(-x,y))));S[x]=n(_,M),S[x+y/2]=n(_,i(-1,M))}return S}else return m(b)}});function Yo(r,e,t){var n;return String(r).includes("Unexpected type")?(n=arguments.length>2?" (type: "+Ut(t)+", value: "+JSON.stringify(t)+")":" (type: "+r.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+n)):String(r).includes("complex numbers")?(n=arguments.length>2?" (type: "+Ut(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+n)):r}var uy="numeric",ly=["number","?bignumber","?fraction"],$o=N(uy,ly,r=>{var{number:e,bignumber:t,fraction:n}=r,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},o={number:a=>e(a),BigNumber:t?a=>t(a):Il,bigint:a=>BigInt(a),Fraction:n?a=>n(a):Rl};return function(c){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",s=arguments.length>2?arguments[2]:void 0;if(s!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var u=Ut(c);if(!(u in i))throw new TypeError("Cannot convert "+c+' of type "'+u+'"; valid input types are '+Object.keys(i).join(", "));if(!(l in o))throw new TypeError("Cannot convert "+c+' to type "'+l+'"; valid output types are '+Object.keys(o).join(", "));return l===u?c:o[l](c)}});var Bl="divideScalar",cy=["typed","numeric"],Zo=N(Bl,cy,r=>{var{typed:e,numeric:t}=r;return e(Bl,{"number, number":function(i,o){return i/o},"Complex, Complex":function(i,o){return i.div(o)},"BigNumber, BigNumber":function(i,o){return i.div(o)},"bigint, bigint":function(i,o){return i/o},"Fraction, Fraction":function(i,o){return i.div(o)},"Unit, number | Complex | Fraction | BigNumber | Unit":(n,i)=>n.divide(i),"number | Fraction | Complex | BigNumber, Unit":(n,i)=>i.divideInto(n)})});var zl="pow",hy=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Ko=N(zl,hy,r=>{var{typed:e,config:t,identity:n,multiply:i,matrix:o,inv:a,number:c,fraction:l,Complex:s}=r;return e(zl,{"number, number":u,"Complex, Complex":function(g,p){return g.pow(p)},"BigNumber, BigNumber":function(g,p){return p.isInteger()||g>=0||t.predictable?g.pow(p):new s(g.toNumber(),0).pow(p.toNumber(),0)},"bigint, bigint":(d,g)=>d**g,"Fraction, Fraction":function(g,p){var m=g.pow(p);if(m!=null)return m;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return u(g.valueOf(),p.valueOf())},"Array, number":h,"Array, BigNumber":function(g,p){return h(g,p.toNumber())},"Matrix, number":f,"Matrix, BigNumber":function(g,p){return f(g,p.toNumber())},"Unit, number | BigNumber":function(g,p){return g.pow(p)}});function u(d,g){if(t.predictable&&!tt(g)&&d<0)try{var p=l(g),m=c(p);if((g===m||Math.abs((g-m)/g)<1e-14)&&p.d%2===1)return(p.n%2===0?1:-1)*Math.pow(-d,g)}catch{}return t.predictable&&(d<-1&&g===1/0||d>-1&&d<0&&g===-1/0)?NaN:tt(g)||d>=0||t.predictable?So(d,g):d*d<1&&g===1/0||d*d>1&&g===-1/0?0:new s(d,0).pow(g,0)}function h(d,g){if(!tt(g))throw new TypeError("For A^b, b must be an integer (value is "+g+")");var p=st(d);if(p.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+p.length+" dimensions)");if(p[0]!==p[1])throw new Error("For A^b, A must be square (size is "+p[0]+"x"+p[1]+")");if(g<0)try{return h(a(d),-g)}catch(b){throw b.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+g+")"):b}for(var m=n(p[0]).valueOf(),v=d;g>=1;)(g&1)===1&&(m=i(v,m)),g>>=1,v=i(v,v);return m}function f(d,g){return o(h(d.valueOf(),g))}});var Ln="Number of decimals in function round must be an integer",Gl="round",py=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],Jo=N(Gl,py,r=>{var{typed:e,config:t,matrix:n,equalScalar:i,zeros:o,BigNumber:a,DenseMatrix:c}=r,l=De({typed:e,equalScalar:i}),s=Nn({typed:e,DenseMatrix:c}),u=Ie({typed:e});function h(f){return Math.abs(Cn(f).exponent)}return e(Gl,{number:function(d){var g=Rn(d,h(t.relTol)),p=pe(d,g,t.relTol,t.absTol)?g:d;return Rn(p)},"number, number":function(d,g){var p=h(t.relTol);if(g>=p)return Rn(d,g);var m=Rn(d,p),v=pe(d,m,t.relTol,t.absTol)?m:d;return Rn(v,g)},"number, BigNumber":function(d,g){if(!g.isInteger())throw new TypeError(Ln);return new a(d).toDecimalPlaces(g.toNumber())},Complex:function(d){return d.round()},"Complex, number":function(d,g){if(g%1)throw new TypeError(Ln);return d.round(g)},"Complex, BigNumber":function(d,g){if(!g.isInteger())throw new TypeError(Ln);var p=g.toNumber();return d.round(p)},BigNumber:function(d){var g=new a(d).toDecimalPlaces(h(t.relTol)),p=Je(d,g,t.relTol,t.absTol)?g:d;return p.toDecimalPlaces(0)},"BigNumber, BigNumber":function(d,g){if(!g.isInteger())throw new TypeError(Ln);var p=h(t.relTol);if(g>=p)return d.toDecimalPlaces(g.toNumber());var m=d.toDecimalPlaces(p),v=Je(d,m,t.relTol,t.absTol)?m:d;return v.toDecimalPlaces(g.toNumber())},Fraction:function(d){return d.round()},"Fraction, number":function(d,g){if(g%1)throw new TypeError(Ln);return d.round(g)},"Fraction, BigNumber":function(d,g){if(!g.isInteger())throw new TypeError(Ln);return d.round(g.toNumber())},"Unit, number, Unit":e.referToSelf(f=>function(d,g,p){var m=d.toNumeric(p);return p.multiply(f(m,g))}),"Unit, BigNumber, Unit":e.referToSelf(f=>(d,g,p)=>f(d,g.toNumber(),p)),"Unit, Unit":e.referToSelf(f=>(d,g)=>f(d,0,g)),"Array | Matrix, number, Unit":e.referToSelf(f=>(d,g,p)=>_t(d,m=>f(m,g,p),!0)),"Array | Matrix, BigNumber, Unit":e.referToSelf(f=>(d,g,p)=>f(d,g.toNumber(),p)),"Array | Matrix, Unit":e.referToSelf(f=>(d,g)=>f(d,0,g)),"Array | Matrix":e.referToSelf(f=>d=>_t(d,f,!0)),"SparseMatrix, number | BigNumber":e.referToSelf(f=>(d,g)=>l(d,g,f,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(f=>(d,g)=>u(d,g,f,!1)),"Array, number | BigNumber":e.referToSelf(f=>(d,g)=>u(n(d),g,f,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":e.referToSelf(f=>(d,g)=>i(d,0)?o(g.size(),g.storage()):s(g,d,f,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":e.referToSelf(f=>(d,g)=>i(d,0)?o(g.size(),g.storage()):u(g,d,f,!0)),"number | Complex | BigNumber | Fraction, Array":e.referToSelf(f=>(d,g)=>u(n(g),d,f,!0).valueOf())})});var kl="dotDivide",fy=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],Qo=N(kl,fy,r=>{var{typed:e,matrix:t,equalScalar:n,divideScalar:i,DenseMatrix:o,concat:a}=r,c=_l({typed:e,equalScalar:n}),l=xl({typed:e}),s=Cl({typed:e,DenseMatrix:o}),u=De({typed:e,equalScalar:n}),h=Nn({typed:e,DenseMatrix:o}),f=fi({typed:e,matrix:t,concat:a});return e(kl,f({elop:i,SS:s,DS:l,SD:c,Ss:u,sS:h}))});function Vl(r){var e=0,t=1,n=Object.create(null),i=Object.create(null),o=0,a=function(l){var s=i[l];if(s&&(delete n[s],delete i[l],--e,t===s)){if(!e){o=0,t=1;return}for(;!Object.prototype.hasOwnProperty.call(n,++t););}};return r=Math.abs(r),{hit:function(l){var s=i[l],u=++o;if(n[u]=l,i[l]=u,!s)return++e,e<=r?void 0:(l=n[t],a(l),l);if(delete n[s],t===s)for(;!Object.prototype.hasOwnProperty.call(n,++t););},delete:a,clear:function(){e=o=0,t=1,n=Object.create(null),i=Object.create(null)}}}function nr(r){var{hasher:e,limit:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t=t??Number.POSITIVE_INFINITY,e=e??JSON.stringify,function n(){typeof n.cache!="object"&&(n.cache={values:new Map,lru:Vl(t||Number.POSITIVE_INFINITY)});for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var a=e(i);if(n.cache.values.has(a))return n.cache.lru.hit(a),n.cache.values.get(a);var c=r.apply(r,i);return n.cache.values.set(a,c),n.cache.values.delete(n.cache.lru.hit(a)),c}}var dy=nr(function(r){return new r(1).exp()},{hasher:di}),gy=nr(function(r){return new r(1).plus(new r(5).sqrt()).div(2)},{hasher:di}),Hl=nr(function(r){return r.acos(-1)},{hasher:di}),Wl=nr(function(r){return Hl(r).times(2)},{hasher:di});function di(r){return r[0].precision}var ql="add",my=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],ts=N(ql,my,r=>{var{typed:e,matrix:t,addScalar:n,equalScalar:i,DenseMatrix:o,SparseMatrix:a,concat:c}=r,l=bl({typed:e}),s=Sl({typed:e,equalScalar:i}),u=Ml({typed:e,DenseMatrix:o}),h=fi({typed:e,matrix:t,concat:c});return e(ql,{"any, any":n,"any, any, ...any":e.referToSelf(f=>(d,g,p)=>{for(var m=f(d,g),v=0;v<p.length;v++)m=f(m,p[v]);return m})},h({elop:n,DS:l,SS:s,Ss:u}))});var Xl="dot",yy=["typed","addScalar","multiplyScalar","conj","size"],es=N(Xl,yy,r=>{var{typed:e,addScalar:t,multiplyScalar:n,conj:i,size:o}=r;return e(Xl,{"Array | DenseMatrix, Array | DenseMatrix":c,"SparseMatrix, SparseMatrix":l});function a(u,h){var f=s(u),d=s(h),g,p;if(f.length===1)g=f[0];else if(f.length===2&&f[1]===1)g=f[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+f.join(", ")+")");if(d.length===1)p=d[0];else if(d.length===2&&d[1]===1)p=d[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+d.join(", ")+")");if(g!==p)throw new RangeError("Vectors must have equal length ("+g+" != "+p+")");if(g===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return g}function c(u,h){var f=a(u,h),d=ot(u)?u._data:u,g=ot(u)?u._datatype||u.getDataType():void 0,p=ot(h)?h._data:h,m=ot(h)?h._datatype||h.getDataType():void 0,v=s(u).length===2,b=s(h).length===2,y=t,S=n;if(g&&m&&g===m&&typeof g=="string"&&g!=="mixed"){var x=g;y=e.find(t,[x,x]),S=e.find(n,[x,x])}if(!v&&!b){for(var _=S(i(d[0]),p[0]),M=1;M<f;M++)_=y(_,S(i(d[M]),p[M]));return _}if(!v&&b){for(var w=S(i(d[0]),p[0][0]),C=1;C<f;C++)w=y(w,S(i(d[C]),p[C][0]));return w}if(v&&!b){for(var P=S(i(d[0][0]),p[0]),D=1;D<f;D++)P=y(P,S(i(d[D][0]),p[D]));return P}if(v&&b){for(var R=S(i(d[0][0]),p[0][0]),W=1;W<f;W++)R=y(R,S(i(d[W][0]),p[W][0]));return R}}function l(u,h){a(u,h);for(var f=u._index,d=u._values,g=h._index,p=h._values,m=0,v=t,b=n,y=0,S=0;y<f.length&&S<g.length;){var x=f[y],_=g[S];if(x<_){y++;continue}if(x>_){S++;continue}x===_&&(m=v(m,b(d[y],p[S])),y++,S++)}return m}function s(u){return ot(u)?u.size():o(u)}});var jl="det",vy=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],ns=N(jl,vy,r=>{var{typed:e,matrix:t,subtractScalar:n,multiply:i,divideScalar:o,isZero:a,unaryMinus:c}=r;return e(jl,{any:function(u){return ft(u)},"Array | Matrix":function(u){var h;switch(ot(u)?h=u.size():Array.isArray(u)?(u=t(u),h=u.size()):h=[],h.length){case 0:return ft(u);case 1:if(h[0]===1)return ft(u.valueOf()[0]);if(h[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+vt(h)+")");case 2:{var f=h[0],d=h[1];if(f===d)return l(u.clone().valueOf(),f,d);if(d===0)return 1;throw new RangeError("Matrix must be square (size: "+vt(h)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+vt(h)+")")}}});function l(s,u,h){if(u===1)return ft(s[0][0]);if(u===2)return n(i(s[0][0],s[1][1]),i(s[1][0],s[0][1]));for(var f=!1,d=new Array(u).fill(0).map((M,w)=>w),g=0;g<u;g++){var p=d[g];if(a(s[p][g])){var m=void 0;for(m=g+1;m<u;m++)if(!a(s[d[m]][g])){p=d[m],d[m]=d[g],d[g]=p,f=!f;break}if(m===u)return s[p][g]}for(var v=s[p][g],b=g===0?1:s[d[g-1]][g-1],y=g+1;y<u;y++)for(var S=d[y],x=g+1;x<u;x++)s[S][x]=o(n(i(s[S][x],v),i(s[S][g],s[p][x])),b)}var _=s[d[u-1]][u-1];return f?c(_):_}});var Yl="inv",_y=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],rs=N(Yl,_y,r=>{var{typed:e,matrix:t,divideScalar:n,addScalar:i,multiply:o,unaryMinus:a,det:c,identity:l,abs:s}=r;return e(Yl,{"Array | Matrix":function(f){var d=ot(f)?f.size():st(f);switch(d.length){case 1:if(d[0]===1)return ot(f)?t([n(1,f.valueOf()[0])]):[n(1,f[0])];throw new RangeError("Matrix must be square (size: "+vt(d)+")");case 2:{var g=d[0],p=d[1];if(g===p)return ot(f)?t(u(f.valueOf(),g,p),f.storage()):u(f,g,p);throw new RangeError("Matrix must be square (size: "+vt(d)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+vt(d)+")")}},any:function(f){return n(1,f)}});function u(h,f,d){var g,p,m,v,b;if(f===1){if(v=h[0][0],v===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,v)]]}else if(f===2){var y=c(h);if(y===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(h[1][1],y),n(a(h[0][1]),y)],[n(a(h[1][0]),y),n(h[0][0],y)]]}else{var S=h.concat();for(g=0;g<f;g++)S[g]=S[g].concat();for(var x=l(f).valueOf(),_=0;_<d;_++){var M=s(S[_][_]),w=_;for(g=_+1;g<f;)s(S[g][_])>M&&(M=s(S[g][_]),w=g),g++;if(M===0)throw Error("Cannot calculate inverse, determinant is zero");g=w,g!==_&&(b=S[_],S[_]=S[g],S[g]=b,b=x[_],x[_]=x[g],x[g]=b);var C=S[_],P=x[_];for(g=0;g<f;g++){var D=S[g],R=x[g];if(g!==_){if(D[_]!==0){for(m=n(a(D[_]),C[_]),p=_;p<d;p++)D[p]=i(D[p],o(m,C[p]));for(p=0;p<d;p++)R[p]=i(R[p],o(m,P[p]))}}else{for(m=C[_],p=_;p<d;p++)D[p]=n(D[p],m);for(p=0;p<d;p++)R[p]=n(R[p],m)}}}return x}}});var xy="divide",Ey=["typed","matrix","multiply","equalScalar","divideScalar","inv"],is=N(xy,Ey,r=>{var{typed:e,matrix:t,multiply:n,equalScalar:i,divideScalar:o,inv:a}=r,c=De({typed:e,equalScalar:i}),l=Ie({typed:e});return e("divide",Zr({"Array | Matrix, Array | Matrix":function(u,h){return n(u,a(h))},"DenseMatrix, any":function(u,h){return l(u,h,o,!1)},"SparseMatrix, any":function(u,h){return c(u,h,o,!1)},"Array, any":function(u,h){return l(t(u),h,o,!1).valueOf()},"any, Array | Matrix":function(u,h){return n(u,a(h))}},o.signatures))});var $l="mean",by=["typed","add","divide"],os=N($l,by,r=>{var{typed:e,add:t,divide:n}=r;return e($l,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":i,"...":function(c){if(sl(c))throw new TypeError("Scalar values expected in function mean");return o(c)}});function i(a,c){try{var l=al(a,c,t),s=Array.isArray(a)?st(a):a.size();return n(l,s[c])}catch(u){throw Yo(u,"mean")}}function o(a){var c,l=0;if(fo(a,function(s){try{c=c===void 0?s:t(c,s),l++}catch(u){throw Yo(u,"mean",s)}}),l===0)throw new Error("Cannot calculate the mean of an empty array");return n(c,l)}});var ss=Zl("tau",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?Wl(t):ll});var as=Zl("i",["Complex"],r=>{var{Complex:e}=r;return e.I});function Zl(r,e,t){return N(r,e,t,{recreateOnConfigChange:!0})}var On=eo({config:he}),gi=ro({});var Kl=oo({}),By=as({Complex:gi});var us=so({});var zy=ss({BigNumber:On,config:he});var ln=po({Matrix:us});var rt=Yi({BigNumber:On,Complex:gi,DenseMatrix:ln,Fraction:Kl});var Gy=Ro({typed:rt});var rr=No({typed:rt});var Jl=ko({typed:rt});var Qe=wo({config:he,typed:rt});var ky=Uo({typed:rt});var Ql=go({typed:rt});var Vy=Mo({equalScalar:Qe,typed:rt});var Hy=Bo({Complex:gi,config:he,typed:rt});var ls=zo({typed:rt});var tc=Co({typed:rt});var cs=To({Matrix:us,equalScalar:Qe,typed:rt});var Wy=Lo({typed:rt});var qy=Ao({BigNumber:On,typed:rt});var ec=Io({typed:rt});var nc=Po({Fraction:Kl,typed:rt});var Yt=Do({DenseMatrix:ln,Matrix:us,SparseMatrix:cs,typed:rt});var Xy=$o({bignumber:qy,fraction:nc,number:tc});var rc=Wo({isInteger:Ql,matrix:Yt,typed:rt}),jy=qo({matrix:Yt,config:he,typed:rt});var ic=Xo({BigNumber:On,config:he,matrix:Yt,typed:rt});var oc=Vo({isInteger:Ql,matrix:Yt,typed:rt});var ir=Zo({numeric:Xy,typed:rt}),Yy=Qo({DenseMatrix:ln,concat:oc,divideScalar:ir,equalScalar:Qe,matrix:Yt,typed:rt});var sc=Ho({BigNumber:On,DenseMatrix:ln,SparseMatrix:cs,config:he,matrix:Yt,typed:rt});var $y=Jo({BigNumber:On,DenseMatrix:ln,config:he,equalScalar:Qe,matrix:Yt,typed:rt,zeros:ic});var Zy=ts({DenseMatrix:ln,SparseMatrix:cs,addScalar:rr,concat:oc,equalScalar:Qe,matrix:Yt,typed:rt});var Ky=es({addScalar:rr,conj:Jl,multiplyScalar:ls,size:jy,typed:rt});var Fn=Go({addScalar:rr,dot:Ky,equalScalar:Qe,matrix:Yt,multiplyScalar:ls,typed:rt});var Jy=Fo({DenseMatrix:ln,config:he,equalScalar:Qe,matrix:Yt,round:$y,typed:rt,zeros:ic});var Qy=ns({divideScalar:ir,isZero:Vy,matrix:Yt,multiply:Fn,subtractScalar:Wy,typed:rt,unaryMinus:ec});var ac=rs({abs:Gy,addScalar:rr,det:Qy,divideScalar:ir,identity:sc,matrix:Yt,multiply:Fn,typed:rt,unaryMinus:ec});var tv=Ko({Complex:gi,config:he,fraction:nc,identity:sc,inv:ac,matrix:Yt,multiply:Fn,number:tc,typed:rt});var uc=jo({addScalar:rr,ceil:Jy,conj:Jl,divideScalar:ir,dotDivide:Yy,exp:ky,i:By,log2:Hy,matrix:Yt,multiplyScalar:ls,pow:tv,tau:zy,typed:rt});var ev=is({divideScalar:ir,equalScalar:Qe,inv:ac,matrix:Yt,multiply:Fn,typed:rt});var lc=os({add:Zy,divide:ev,typed:rt});var mi=class{NumParticle;reSampNumParticle;initial_xy_uncertainty;initial_yaw_uncertainty;step_noise_sigma;yaw_noise_sigma;compass_update_interval;sigmaCompass;delta_yaw;sigmaBeacon;unaccess_weight;particle_PosInitFlag;particle_yawInitFlag;xEst;particleX;particleWeight;last_compass_time;constructor(e){this.NumParticle=e.NumParticle,this.reSampNumParticle=e.reSampNumParticle,this.initial_xy_uncertainty=e.initial_xy_uncertainty,this.initial_yaw_uncertainty=e.initial_yaw_uncertainty,this.step_noise_sigma=e.step_noise_sigma,this.yaw_noise_sigma=e.yaw_noise_sigma,this.compass_update_interval=e.compass_update_interval,this.sigmaCompass=e.sigmaCompass,this.delta_yaw=e.delta_yaw,this.sigmaBeacon=e.sigmaBeacon,this.unaccess_weight=e.unaccess_weight,this.particle_PosInitFlag=!1,this.particle_yawInitFlag=!1,this.xEst=[[0],[0],[0]],this.particleX=Array.from({length:3},()=>Array(this.NumParticle).fill(0)),this.particleWeight=Array.from({length:1},()=>Array(this.NumParticle).fill(1/this.NumParticle)),this.last_compass_time=0}motionModelRotYaw(e){if(!(Math.abs(e)<.001))for(let t=0;t<this.NumParticle;t++){let n=Math.random()*this.yaw_noise_sigma;this.particleX[2][t]=this.particleX[2][t]+e+n,this.particleX[2][t]=jr(this.particleX[2][t])}}motionModelStepLength(e,t){if(e===0)return;for(let i=0;i<this.NumParticle;i++){let o=Math.random()*this.step_noise_sigma;this.particleX[0][i]+=(.65+o)*Math.sin(-this.particleX[2][i]/180*Math.PI),this.particleX[1][i]+=(.65+o)*Math.cos(this.particleX[2][i]/180*Math.PI),t(this.particleX[0][i],this.particleX[1][i])||(this.particleWeight[0][i]*=this.unaccess_weight)}let n=this.particleWeight[0].reduce((i,o)=>i+o,0);this.particleWeight[0]=this.particleWeight[0].map(i=>i/n)}motionModelCompassYaw(e,t){if(t-this.last_compass_time>this.compass_update_interval){let n=360-e;n+=this.delta_yaw,n=jr(n);for(let o=0;o<this.NumParticle;o++){let a=Math.abs(this.particleX[2][o]-n);a>180&&(a=360-a),this.particleWeight[0][o]*=Xr(a,this.sigmaCompass)}let i=this.particleWeight[0].reduce((o,a)=>o+a,0);this.particleWeight[0]=this.particleWeight[0].map(o=>o/i),this.setLastCompassTime(t)}}resampling(){if(1/this.particleWeight[0].reduce((t,n)=>t+n*n,0)<this.reSampNumParticle){let t=this.particleWeight[0].reduce((c,l,s)=>c.concat(c[s]+l),[0]),i=this.particleWeight[0].map(()=>1/this.NumParticle).map((c,l)=>c+Math.random()/this.NumParticle),o=[],a=0;for(let c=0;c<this.NumParticle;c++){for(;i[c]>t[a];)a++;o.push(a)}this.particleX=this.particleX.map((c,l)=>o.map(s=>c[s])),this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle)}}update(e,t){for(let i=0;i<this.NumParticle;i++){let o=En(this.particleX[0][i],this.particleX[1][i],e.x,e.y);this.particleWeight[0][i]=Math.max(1e-7,this.particleWeight[0][i]*Xr(o,t))}let n=this.particleWeight[0].reduce((i,o)=>i+o,0);this.particleWeight[0]=this.particleWeight[0].map(i=>i/n)}updateCar(e,t){let n=e.x-this.xEst[0][0],i=e.y-this.xEst[1][0];for(let a=0;a<this.NumParticle;a++){let c=En(this.particleX[0][a],this.particleX[1][a],e.x,e.y);this.particleWeight[0][a]=Math.max(1e-7,this.particleWeight[0][a]*Xr(c,t)),this.particleX[0][a]+=n,this.particleX[1][a]+=i}let o=this.particleWeight[0].reduce((a,c)=>a+c,0);this.particleWeight[0]=this.particleWeight[0].map(a=>a/o)}getPosInitFlag(){return this.particle_PosInitFlag}getYawInitFlag(){return this.particle_yawInitFlag}setPosInitFlag(e){this.particle_PosInitFlag=e}setYawInitFlag(e){this.particle_yawInitFlag=e}getResultX(){let e=rc(this.particleWeight,[this.NumParticle,1]),t=Fn(this.particleX,e);return this.xEst=t,this.xEst[0][0]}getResultY(){return this.xEst[1][0]}getResultYaw(){let e=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0]));return this.particleX[2][e]}getEstConfidence(){let e=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0])),t=this.particleWeight[0].indexOf(Math.min(...this.particleWeight[0])),n=[this.particleX[0][e],this.particleX[1][e]],i=[this.particleX[0][t],this.particleX[1][t]],o=En(n[0],n[1],i[0],i[1]),a=o*.67;return console.log(o,a),a}getParticleNum(){return this.NumParticle}getParticleX(){return this.particleX}setLastCompassTime(e){this.last_compass_time=e}getLastCompassTime(){return this.last_compass_time}initParticlesByPos(e,t,n){if(!this.particle_PosInitFlag){this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle);let i=0;for(;i<this.NumParticle;){let a=(2*Math.random()-1)*this.initial_xy_uncertainty,c=(2*Math.random()-1)*this.initial_xy_uncertainty;n(e+a,t+c)||(this.particleWeight[0][i]*=this.unaccess_weight),this.particleX[0][i]=e+a,this.particleX[1][i]=t+c,i++}let o=this.particleWeight[0].reduce((a,c)=>a+c,0);this.particleWeight[0]=this.particleWeight[0].map(a=>a/o),this.particle_PosInitFlag=!0,this.xEst[0][0]=e,this.xEst[1][0]=t,this.xEst[2][0]=0}}initParticlesByCompass(e){console.log(`Init compass: ${e}`);let t=360-e;t+=this.delta_yaw,t=jr(t),console.log(`Init Yaw: ${t}`);for(let n=0;n<this.NumParticle;n++){let i=(2*Math.random()-1)*this.initial_yaw_uncertainty;this.particleX[2][n]=t+i}this.particle_yawInitFlag=!0,this.xEst[2][0]=t}};var yi=class{fre=100;accH_fifo=[];accH_time_fifo=[];accH_fifo_len=Math.floor(1*this.fre)+1;step_count=0;state_count=0;last_valley_time=0;last_peak_time=0;last_step_time=0;min_step_time=.3;max_step_time=1;min_peak=10.5;max_valley=9.5;peak_num=0;valley_num=0;fft_min_amp=.3;fft_min_fre=0;fft_max_fre=4;last_fft_amp=0;abnor_start_time=0;abnor_fft_detected=!1;abnor_time_threshold=4;abnor_peak_time=0;abnor_peak_accH=0;const_step_length=.65;last_rot=[];delta_rot=[];last_yaw=0;delta_yaw=null;delta_rot_sum_fifo=[];delta_rot_sum_time_fifo=[];delta_yaw_accum=0;delta_yaw_accum_timestamp=0;delta_yaw_time_threshold=.5;last_px=0;last_py=0;delta_px=0;delta_py=0;init(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10+.5,this.max_valley=10-.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.65,this.last_rot=[0,0,0],this.delta_rot=[0,0,0],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}reset(){this.init()}setInitPose(e=[0,0]){this.last_px=e[0],this.last_py=e[1],console.info(`pdr init pos: ${this.last_px}, ${this.last_py}`)}setInitYaw(e=0){this.last_yaw=e}getPos(e,t,n){let i=0;return n.length===3&&(this.delta_yaw=this.getDeltaYawFromRot(e,n)),t.length===3&&(i=this.getStepLength(e,t)),i!==0&&(this.last_px+=this.delta_px,this.last_py+=this.delta_py),[this.last_px,this.last_py]}getDeltaPose(){return[this.delta_px,this.delta_py]}getStepLength(e,t){if(t.length<3)return console.warn("acc data less than 3"),0;let n=!1,i=Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2));if(this.accH_fifo.push(i),this.accH_time_fifo.push(e),this.imuFreUpdate(),this.accH_fifo.length<this.accH_fifo_len+1)n=!1;else{for(;this.accH_fifo.length>=this.accH_fifo_len+1;)this.accH_fifo.shift(),this.accH_time_fifo.shift();let o=this.PVStepDetec(),a=this.FFTStepDetec(),c=this.recheckState(),l=this.accH_time_fifo[Math.floor(this.accH_time_fifo.length*3/4)];Math.abs(this.abnor_start_time)<.001&&this.abnor_fft_detected?this.abnor_start_time=l:this.abnor_fft_detected||(this.abnor_start_time=0),o&&a&&c?(this.step_count+=1,this.last_step_time=l,n=!0):Math.abs(this.abnor_start_time)>.001&&this.abnor_peak_time-this.abnor_start_time>this.abnor_time_threshold&&this.step_count>1&&this.abnor_peak_time-this.last_step_time>1?(this.step_count+=1,this.last_step_time=l,n=!0):(l-this.last_step_time>2&&(this.state_count=0),n=!1)}if(n){let o=this.last_yaw/180*Math.PI;return this.delta_px=this.const_step_length*Math.cos(o),this.delta_py=this.const_step_length*Math.sin(o),this.const_step_length}else return 0}imuFreUpdate(){if(this.accH_time_fifo.length>2&&(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]<0||this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]>10||this.accH_time_fifo[this.accH_time_fifo.length-1]===this.accH_time_fifo[0])&&(console.warn(`pdr reset last one time ${this.accH_time_fifo[this.accH_time_fifo.length-1]} last two time ${this.accH_time_fifo[this.accH_time_fifo.length-2]}`),this.reset()),this.accH_fifo.length>9||this.fre<15){let e=(this.accH_fifo.length-1)/(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[0]);Math.abs(this.fre-e)>8&&(this.fre=Math.round((e-3)/10)*10,(this.fre<=10||this.fre>=100)&&(console.warn(`Frequency Error ${this.fre}`),this.fre=100),console.debug(`Frequency change to ${this.fre}`),this.accH_fifo_len=Math.floor(1*this.fre)+1)}}recheckState(){return!0}PVStepDetec(){let e=!1,t=this.accH_fifo.slice(Math.floor(this.accH_fifo_len/2)),n=this.accH_time_fifo.slice(Math.floor(this.accH_fifo_len/2)),i=t[Math.floor(t.length/2)],o=n[Math.floor(n.length/2)],a=Math.max(...t),c=Math.min(...t),l=!1,s=!1;return Math.abs(i-c)<.01&&i<this.max_valley&&this.valley_num<=this.peak_num&&(this.last_valley_time===0?s=!0:s=o-this.last_valley_time>this.min_step_time,s&&(this.last_valley_time=o,this.valley_num+=1)),Math.abs(i-a)<.01&&i>this.min_peak&&this.peak_num<=this.valley_num&&(this.last_peak_time===0?l=!0:l=o-this.last_peak_time>this.min_step_time,l&&(this.last_peak_time=o,this.peak_num+=1)),i===a&&i>this.min_peak&&(this.abnor_peak_time=o,this.abnor_peak_accH=i),this.peak_num===this.valley_num&&(l||s)&&(e=!0),e}FFTStepDetec(){return!0}getDeltaYawFromRot(e,t){if(t.length<3)return console.warn("rot data less than 3"),0;let n=[0,0,0];this.last_rot.length===3&&(n=t.map((c,l)=>c-this.last_rot[l]));for(let c=0;c<t.length;c++)n[c]<-180?n[c]+=360:n[c]>180&&(n[c]-=360);let i=.2;this.delta_rot.length===3?this.delta_rot=this.delta_rot.map((c,l)=>i*c+(1-i)*n[l]):this.delta_rot=n,this.last_rot=t,this.delta_yaw=this.delta_rot[0],this.last_yaw+=this.delta_yaw,this.last_yaw=this.limitYaw(this.last_yaw);let o=this.delta_rot.reduce((c,l)=>c+Math.abs(l),0);this.delta_rot_sum_fifo.push(o),this.delta_rot_sum_time_fifo.push(e),Math.abs(this.delta_rot_sum_time_fifo[this.delta_rot_sum_time_fifo.length-1]-this.delta_rot_sum_time_fifo[0])>1&&(this.delta_rot_sum_fifo.shift(),this.delta_rot_sum_time_fifo.shift()),this.delta_yaw_accum+=this.delta_yaw;let a=0;return Math.abs(this.delta_yaw_accum_timestamp-e)>this.delta_yaw_time_threshold?(a=this.delta_yaw_accum,this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=e,a):null}limitYaw(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}};var vi=class{particleFilter;pdr;sigmaBeacon=5;gps_horizontalAccuracy=10;using_gps=!0;last_beacon_time=null;last_pos_time;position_count=0;gps_max_horizontalAccuracy=20;MaxEstimateErr=5;outTrustRegionNum=0;TrustNum=4;cacheSensorData=[];constructor(){this.particleFilter=new mi({NumParticle:200,reSampNumParticle:.65,initial_xy_uncertainty:12,initial_yaw_uncertainty:100,step_noise_sigma:.5,yaw_noise_sigma:2,compass_update_interval:3e3,sigmaCompass:80,delta_yaw:2,sigmaBeacon:5,unaccess_weight:.7}),this.pdr=new yi}pfFusionPDRiBeacon(e){let{type:t,timestamp:n,res:i}=e,o=!1;if(this.particleFilter.getPosInitFlag()&&this.particleFilter.getYawInitFlag()){if(t==="acceleration"){let a=i,c=this.pdr.getStepLength(n/1e3,a);c!==0&&(this.particleFilter.motionModelStepLength(c,()=>!0),this.particleFilter.resampling(),this.position_count+=1,o=!0)}if(this.using_gps&&t==="gps"&&(this.last_beacon_time===null||n-this.last_beacon_time>5e3)){let a=this.getGpsPosition(i);o=a!==null,a&&(this.particleFilter.update(a,this.gps_horizontalAccuracy),this.resetParticleFilterDist(a),this.particleFilter.resampling(),this.position_count+=1)}if(t==="deviceMotion"){let a=this.pdr.getDeltaYawFromRot(n/1e3,i);a!==null&&this.particleFilter.motionModelRotYaw(a)}t==="compass"&&this.particleFilter.motionModelCompassYaw(i,n),this.last_pos_time&&n-this.last_pos_time>500&&(this.position_count+=1,o=!0)}else if(!this.particleFilter.getPosInitFlag()&&this.using_gps&&t==="gps"){let a=this.getGpsPosition(i);o=a!==null,a?(this.particleFilter.initParticlesByPos(a.x,a.y,()=>!0),this.last_pos_time=n,console.log(`init Pos by gps success time ${n}`),this.cacheSensorData.length=0):console.log(`init Pos by gps fail time ${n}`)}else if(!this.particleFilter.getYawInitFlag()&&t==="compass"){let a=i;this.particleFilter.initParticlesByCompass(a),this.particleFilter.setLastCompassTime(n),console.log(`init yaw by compass success time ${n}`)}else this.cacheSensorData.push(e);return o&&(this.last_pos_time=n),[o,this.particleFilter.getResultX(),this.particleFilter.getResultY()]}setBeaconPosition(e,t){return this.last_beacon_time=t,this.particleFilter.getPosInitFlag()?this.particleFilter.update(e,this.sigmaBeacon):this.particleFilter.initParticlesByPos(e.x,e.y,()=>!0),this.resetParticleFilterDist(e),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.filter(i=>i.timestamp>t).map(i=>this.pfFusionPDRiBeacon(i)),this.cacheSensorData.length=0,[this.particleFilter.getResultX(),this.particleFilter.getResultY()]}getGpsPosition(e){return e[2]>this.gps_max_horizontalAccuracy?null:Ua(e[0],e[1])}resetParticleFilterDist(e){let t=this.particleFilter.getResultX(),n=this.particleFilter.getResultY();En(t,n,e.x,e.y)>this.MaxEstimateErr?(this.outTrustRegionNum+=1,this.outTrustRegionNum>=this.TrustNum&&(console.info(`\u8D85\u51FA\u53EF\u4FE1\u533A\u57DF\uFF0C\u91CD\u7F6E\u7C92\u5B50\u8FC7\u6EE4\u5668\u5230: ${e.x}, ${e.y}`),this.particleFilter.setPosInitFlag(!1),this.particleFilter.setYawInitFlag(!1),this.outTrustRegionNum=0)):this.outTrustRegionNum=0}};var cc=class extends rv{sensor;pdr;constructor(e={}){super(),this.sensor=new qr(e.sensor),this.pdr=new vi}checkSensor(){return this.sensor.checkSensor()}start(){this.sensor.start(),this.sensor.addEventListener("add-data-item",({item:e})=>{this.getPositionBySensorItem(e)})}getPositionBySensorItem(e){let[t,n,i]=this.pdr.pfFusionPDRiBeacon(e);return t&&this.dispatchEvent({type:"position",x:n,y:i,_type:e.type==="gps"?"gps":"pdr"}),[t,n,i]}setBeaconPosition(e,t){let[n,i]=this.pdr.setBeaconPosition(e,t);this.dispatchEvent({type:"position",x:n,y:i,_type:"beacon"})}dispose(){this.sensor.stop()}};async function hc({brand:r,project:e},t){let{apiDomain:n,apiPath:{floorRange:i},apiInfo:o}=t,a=`${n}${i}?brand=${r}&project=${e}&phase=${e}&building=${e}`;return await fetch(a,o).then(l=>l.json()).then(l=>l.data).then(l=>{let s=(l||[])[0];return s&&(s.info=JSON.parse(s.info)),s})}async function pc({brand:r,project:e,floor:t,ts:n,resource_type_list:i},o){let{apiDomain:a,apiPath:{floorGraphic:c},apiInfo:l}=o,s=`${a}${c}?brand=${r}&project=${e}&phase=${e}&building=${e}&floor=${t}&ts=${n}&resource_type_list=${i}`;return await fetch(s,l).then(h=>h.json()).then(h=>h.data).then(h=>((h||[]).map(f=>f.info=JSON.parse(f.info)),h||[]))}async function E2({project:r,floor:e},t){let{apiDomain:n,apiInfo:i}=t,o=`${n}/api/inception-map/external_street/get?projectCode=${r}&floorCode=${e}`;return await fetch(o,i).then(c=>c.json()).then(c=>c.data).then(c=>JSON.parse(c[0].streetInfo||"{}")).then(c=>c.fileId?iv(c.fileId,t):null)}async function iv(r,e){let{apiDomain:t,apiInfo:n}=e;return fetch(`${t}/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 xe;function fc(r="aibee_map"){return new Promise((e,t)=>{if(xe)return e({db:xe,type:"success"});let n=indexedDB.open(r);n.onupgradeneeded=function(i){xe=i.target.result,console.log("onupgradeneeded"),e({db:xe,type:"onupgradeneeded"})},n.onsuccess=i=>{xe=i.target.result,e({db:xe,type:"success"})},n.onerror=i=>{t(i)}})}function dc(r,e,t=xe){return new Promise((n,i)=>{t||i("\u6CA1\u6709db");let a=t.transaction([r],"readonly").objectStore(r).get(e);a.onsuccess=()=>{a.result?n(a.result.value):n(null)},a.onerror=c=>{console.log("[getVersionByKey]",c),n(null)}})}function gc(r,e,t,n=xe){return new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((a,c)=>{let s=n.transaction([r],"readwrite").objectStore(r).add({key:e,value:t});s.onsuccess=function(u){a(u)},s.onerror=function(u){c(u)}})))}function _i(r,e=xe){e&&(e.objectStoreNames.contains(r)||e.createObjectStore(r,{keyPath:"key"}))}function mc(){xe?.close(),xe=null}var yc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAGQCAYAAAAUdV17AAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAABLKADAAQAAAABAAABkAAAAAAun0XIAAAtt0lEQVR4Ae2dB9glRZm2ZxyyMiTJA0oaQFlgCJKzxEVZlCgiCJhYWBXDyqLrirL/qqy4oLD4iyQRFARFUGFILiBhJC1Z0iBRsuQwMHs/w3eY84WTu7uqup66rvc753Soet+7up+vqrq7evw4p6gIzJw5c04cWhlbbcjey+cK2NzYXE2m7Z7B7semN9ldfL92/Pjxr/LpZAK1IjC+VtEkGgwitSKu74J9GFsTmwMbJL3AzpdhF2AXIl538ulkAiZgAv0RQKQmY4dhN2Blp+kU8G/Y4v15671MwASyJIBoTMHOxUKklyn0RGz1LOE7aBMwge4IIBJrYOdgsaSLcWT97rz3ViZgAlkQQBSWxc7C3sBiS6/j0A+xiVlUhoM0ARNoTQAh2AN7Gos9PYSDGvB3MgETyI0AJ/9E7JTYVWoM/37NsoVyqy/Hmw4B39ZQcF1xwm9AlqdhyxWcdVXZ6RaIHbgV4t6qCnQ5JtAtAQtWt6S62A6x2pHNzsTm6WLzmDd5HOd2QrSuitlJ+5YfgbflF3I5ESNWuvHzbCx1sRKgRbFLi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AABCPSBwAMeIXNXRR/IUyQEIACBUQSGHJDvG7WRnxCAAAQgUD6B+xyQp5VfLiVCAAIQgMAoAtM8hzxBG/8iWXjUTn5CAAIQgEA5BLwA08S36GZkr7Hw+XLKpBQIQAACEGhB4BjF4sc9ZTFGX76hj2+2yMQmCEAAAhAojoDXtDhBMfj7LmLEHRaavthd274qead3kiAAAQhAoDACN8nycQrG04dLGBGQhzcqML9D3zeSZFl+c1iNTwhAAAIQ6ExgePnNGxWI7+qclb0QgAAEINA3Av8fPece3M0Z0YQAAAAASUVORK5CYII=";var O2={loadRoadNetwork:!1},xi="version",hs="map_data",Ei="road_network_data",xc={half:yc,power:vc,mechanical:_c},Ec=class{constructor(e){this.bmap=e;this.initDb()}floors=[];async initDb(){try{let{db:e,type:t}=await fc();t==="onupgradeneeded"&&(_i(xi),_i(hs),_i(Ei))}catch(e){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",e)}}async load(e){if(this.clear(),Array.isArray(e))this.floors=e;else{let t=await fetch(e).then(n=>n.json());t.code==="0"&&(this.floors=t.data.list)}}setCacheData(e,t,n){return gc(e,`${t}`,n)}getCacheData(e,t){return dc(e,`${t}`)}getFloorCacheKey(e){return`${e.floor_id}`}async getFloorData(e){let t=this.floors.find(i=>i.floor===e);if(!t)return null;let n=this.getFloorCacheKey(t);try{if(await this.getCacheData(xi,n)===t.version_id){let o=await this.getCacheData(hs,n);if(o)return this.getDataByJson(o)}return this.getFloorDataByFloorInfo(t)}catch{return this.getFloorDataByFloorInfo(t)}}async getFloorDataByFloorInfo(e){let t=this.getFloorCacheKey(e);console.time("zstd_json");let n=await fetch(e.map_url).then(i=>i.json());return n.floor=e.floor,console.timeEnd("zstd_json"),this.setCacheData(hs,t,n),this.setCacheData(xi,t,e.version_id),this.getDataByJson(n)}async getRoadNetworkData(){return(await Promise.all(this.floors.map(async t=>{let n=this.getFloorCacheKey(t);try{if(await this.getCacheData(xi,n)===t.version_id){let a=await this.getCacheData(Ei,n);if(a)return a}let o=await fetch(t.route_url).then(a=>a.json());return this.setCacheData(Ei,n,o),o}catch{let i=await fetch(t.route_url).then(o=>o.json());return this.setCacheData(Ei,n,i),i}}))).filter(t=>t.points)}async getFacilitiesData(){if(this.floors[0]?.entry_infra_url)return fetch(this.floors[0].entry_infra_url).then(e=>e.json())}async getOtherDataByFreeTime(){}async getMulFloorsData(e){return Promise.all(e.map(t=>this.getFloorData(t))).then(t=>t.filter(n=>n))}async getDataByUrl(e){let t=await fetch(e).then(n=>n.json());return this.getDataByJson(t)}getDataByJson(e){let t=new Ce(this.bmap.context);t.userData.graphics=[],t.userData.graphicMap=new Map;let n=[0,0];return e.layers.forEach(i=>{switch(i.l_type){case"range":let o=i.elements[0];n=[o.center_x,o.center_y];break;case"graph":ee(i.elements,n);let a=[];i.elements.forEach(p=>{p.group==="ground"?t.createGround(p):a.push(p)});let c=a.reduce((p,m)=>{let{fillColor:v,fillOpacity:b,strokeColor:y,strokeOpacity:S,height:x}=m,_=`${v.toLowerCase()}-${b}-${y.toLowerCase()}-${S}-${x}`;return S===0&&(_=`${v.toLowerCase()}-${b}-${x}`),p[_]?p[_].push(m):p[_]=[m],p},{});Object.values(c).forEach(p=>{let m=new Ar(this.bmap.context,p);t.mergeGraphicLayer.add(m)});break;case"ground":ee(i.elements,n);let l=i.elements.map(p=>new Ft(this.bmap.context,p));t.addGrounds(l);break;case"wall":ee(i.elements,n);let s=i.elements.reduce((p,m)=>{let{fillColor:v,fillOpacity:b,strokeColor:y,strokeOpacity:S,height:x}=m,_=`${v.toLowerCase()}-${b}-${y.toLowerCase()}-${S}-${x}`;return S===0&&(_=`${v.toLowerCase()}-${b}-${x}`),p[_]?p[_].push(m):p[_]=[m],p},{});Object.values(s).forEach(p=>{let m=new wr(this.bmap.context,p);t.wallLayer.add(m)});break;case"lane":ee(i.elements,n);let u=i.elements.reduce((p,m)=>{let{fillColor:v,fillOpacity:b,strokeColor:y,strokeOpacity:S}=m,x=`${v.toLowerCase()}-${b}-${y.toLowerCase()}-${S}`;return S===0&&(x=`${v.toLowerCase()}-${b}`),p[x]?p[x].push(m):p[x]=[m],p},{});Object.values(u).forEach(p=>{let m=new Cr(this.bmap.context,p);t.laneLayer.add(m)});break;case"texture2d":case"texture3d":if(ee(i.elements,n),i.elements.length){let p=new Wn(this.bmap.context,i.elements);t.textureLayer.add(p)}break;case"glb":ee(i.elements,n),i.elements.forEach(p=>{let m=Te([p.center_x,p.center_y],n),v=new Tr(this.bmap.context,{...p,url:p.secondUrl,rotate:p.secondRotate,width:p.secondWidth,center_x:m[0],center_y:m[1]});t.glbModelLayer.add(v)});break;case"store":ee(i.elements,n),i.elements.map(p=>{let m=Te([p.center_x,p.center_y],n),v=t.addGraphic(p);t.userData.graphics.push(v),t.userData.graphicMap.set(p.id,v);try{let b=new ne(this.bmap.context,{id:p.id,icon:p.poi_info.icon,text:p.poi_info.showName||p.store_name||p.poi_info.text,position:{x:m[0],y:m[1],z:p.airHeight+p.height},icon_size:[18,18]});t.poiLayer2.pushPoi(b),b&&(b.userData.type="store",b.userData.data=p)}catch(b){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",b,p)}});break;case"facility":ee(i.elements,n),i.elements.map(p=>{let m=Te([p.center_x,p.center_y],n),v=t.addGraphic(p);if(t.userData.graphics.push(v),t.userData.graphicMap.set(p.id,v),p.poi_info){let b=new ne(this.bmap.context,{id:p.id,icon:p.poi_info.icon,text:p.poi_info.showName||p.store_name||p.poi_info.text,position:{x:m[0],y:m[1],z:p.airHeight+p.height},icon_size:[18,18]});t.poiLayer2.pushPoi(b),b.userData.type="facility",b.userData.data=p}else console.log("\u6DFB\u52A0facility\u5931\u8D25\u6CA1\u6709poi_info",p)});break;case"parkingSpace":ee(i.elements,n);let h=[],f=new Map;i.elements.forEach(p=>{let m=t.addGraphic(p);h.push(m),f.set(p.id,m);let v=Te([p.center_x,p.center_y],n);if(p.texts[0]){let b=new ne(this.bmap.context,{id:p.id,text:p.texts[0],position:{x:v[0],y:v[1],z:p.airHeight+p.height}});b&&(b.userData.type="parkingSpace",b.userData.data=p),t.poiLayer2.pushPoi(b)}});let d=i.elements.filter(p=>xc[p.parkingType]).map(p=>{let m=Te([p.center_x,p.center_y],n),v=Ss(p.geometry.coords,m);return{uuid:p.id,iconUrl:xc[p.parkingType],name:p.texts[0],deltaHeight:p.deltaHeight,airHeight:p.airHeight,height:p.height,geometry:{...p.geometry,coords:v},opacity:p.fillOpacity,visible:!0}});if(d.length){let p=new Wn(this.bmap.context,d);t.textureLayer.add(p)}t.userData.parkingSpaces=h,t.userData.parkingSpacesGraphicMap=f;break;case"text":ee(i.elements,n);let g=new Dr(this.bmap.context,i.elements.map(p=>{let m=Te([p.center_x,p.center_y],n);return{...p,center_x:m[0],center_y:m[1]}}));t.textTextureLayer.add(g);break}}),t.userData.center=n,t.userData.height=e.floorHeight*10,t.name=e.floor,t.userData.data=e,t.updateBox(),t}clear(){}dispose(){this.clear(),mc()}};var bc=class{constructor(e){this.bmap=e}cacheData=new Map;floorDataLengthMap=new Map;buildingGroundMap=new Map;externalStreetMap=new Map;async load(e){let t=yn(e);if(this.cacheData.has(t))return this.cacheData.get(t);let[,n]=await Promise.all([this.loadBuildGround(e),pc(e,this.bmap.config)]),i=yn({floor:e.floor,ts:e.ts});ee(n.map(a=>a.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),n.forEach(a=>a.info.transformToBuildingGround=!1),this.cacheData.set(t,n);let o=this.floorDataLengthMap.get(i)||0;return this.floorDataLengthMap.set(i,o+n.length),this.loadExternalStreet(e),n}async loadExternalStreet(e){}switchFloorByData(e,t){if(!e.length)return;let n=t.userData.legacyToGraphicMap||new Map,i=t.userData.graphicMap||new Map,{ground:o,markGraphic:a,graphic:c}=this.bmap.config;for(let l=0;l<e.length;l++){let s=e[l];s.info.group==="ground"?(s.info.fillColor=o.color,s.info.fillOpacity=o.opacity,s.info.height=o.height,s.info.stroke=o.stroke,s.info.strokeColor=o.strokeColor,s.info.strokeOpacity=o.strokeOpacity):s.info.userData.mark?(s.info.height=a.height,s.info.fillColor=a.color,s.info.fillOpacity=a.opacity,s.info.stroke=a.stroke,s.info.strokeColor=a.strokeColor,s.info.strokeOpacity=a.strokeOpacity):(s.info.fillOpacity=c.fillOpacity,this.bmap.config.initTransToMark&&(s.info.height=a.height,s.info.fillColor=a.color,s.info.stroke=a.stroke,s.info.strokeColor=a.strokeColor,s.info.strokeOpacity=a.strokeOpacity))}for(let l of e){if(l.info.group==="ground")t.createGround(l.info);else{let s=t.addGraphic(l.info);s.userData.data=l,n.set(l.legacy_id,s)}i.set(l.element_uuid,l)}t.userData.legacyToGraphicMap=n,t.userData.graphicMap=i,t.updateBox(),t===this.bmap.context.currentFloor?(this.bmap.triggerHooks("switch_floor_before",{curFloor:t,graphics:t.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:t,graphics:t.graphicLayer.children})):this.bmap.switchFloorByFloor(t)}filterData(e,t){let n=t.userData.graphicMap||new Map;return e.filter(i=>!n.has(i.element_uuid))}async switchFloorByStoreData(e,t){let n=await this.load({...e,resource_type_list:"6"}),i=this.filterData(n,t);this.switchFloorByData(i,t)}async switchFloorByOtherData(e,t){let n=await this.load({...e,resource_type_list:"1,2,3,4"}),i=this.filterData(n,t);this.switchFloorByData(i,t)}async loadBuildGround({brand:e,project:t}){let n=await this.loadBuildingGround({brand:e,project:t});return this.bmap.currentBuildGround=n,this.bmap.changeBuildingCenter(n,{brand:e,project:t}),this.bmap.currentBuildGround}async loadBuildingGround({brand:e,project:t}){let n=yn({brand:e,project:t});if(this.buildingGroundMap.has(n))return this.buildingGroundMap.get(n);let i=hc({brand:e,project:t},this.bmap.config).then(o=>(this.buildingGroundMap.set(n,o),o));return this.buildingGroundMap.set(n,i),i}async switchFloor(e){let t=new Ce(this.bmap.context);t.name=e.floor;try{await Promise.all([this.switchFloorByStoreData(e,t),this.switchFloorByOtherData(e,t)])}catch(n){console.log(n)}return t}dispose(){this.cacheData.clear(),this.floorDataLengthMap.clear(),this.buildingGroundMap.clear()}};export{Ec as AibeeLoader,ba as BMap,La as BMapSelect,le as BaseSvg,kr as Context,bc as CrLoader,Na as CrNavPath,Sa as Equipment,As as Events,Ce as Floor,Tr as GlbModel,Ft as Graphic,_r as GraphicLayer,Wn as GroundTexture,yr as HeatmapElement,Vn as HooksName,Nr as HoverHelper,Cr as Lane,Ht as Layer,kf as MapTypePolar,Ar as MergeGraphic,vr as Model,Ia as MulFloors,Ra as NavPath,Da as Navigation,mr as Overlay,Bs as PathDirection,cc as PdrPosition,rn as Poi,ne as Poi2,_n as PoiLayer,xr as PoiLayer2,ta as RoadNetwork,ea as RoadNetwork2,ca as SelectBox,Rr as Selection,qr as Sensor,gr as Shadow,Sr as SvgLine,Mr as SvgPolygon,Dr as TextTexture,Gt as Timer,vn as TweenUtil,Cs as UA,wr as Wall,wv as addAlphaToHexColor,bs as calc_angle,wi as calc_direction,na as convertToSnakeCase,Gn as createCircle,hr as createLine,Ve as createRect,ws as createSvg,cr as createSvgElement,u_ as createThreeBox,a_ as createThreeLine,Le as darkenColor,O2 as defaultAibeeLoaderOption,Uf as defaultConfig,Di as defaultGraphicOptions,Gp as defaultOptions,yf as defaultTextTextureOptions,Jt as dispose,Us as distancePointToSegment,yn as generatorKeyByObj,yh as getAngle,lr as getCenter,Ea as getConfig,kv as getDirectPath,zs as getDistanceByPathPos,kt as getLength,yv as getLongestSideDir,Ss as getMinEdgeSquare,Se as getPathLength,fn as getPointEdgeIndex,pr as getPosByPathDistance,Es as hasChinese,Si as hexToRgb,xs as initDirectionalLight,_s as initLight,be as initShape,Cv as isAndroid,ke as isContain,mn as isControl,kn as isIphone,gn as isMac,Ms as isPointInPolygon,hc as loadBuildingGround,E2 as loadExternalStreet,pc as loadGraphics,Gv as moveOnRoute,dn as proxyOptions,_h as removeWeightPath,en as setCirclePosition,ge as setLineStartEnd,Xt as setRectPosition,Fs as simplifyPath,Ts as sleepOnePromise,bv as sleepOneRf,Os as smoothPath,Mv as strToNumber,tn as timeoutPromise,r_ as toWebWorker,ee as transformGraphicData,Te as translatePosToCenter,we as triggerWorker,et as vector3ToDevice,Lv as xhrGet};
7516
+ (`+vt(w,p)+", "+vt(S,p)+") ==> "+(this._values?vt(this._values[M],p):"X")}return y},i.prototype.toString=function(){return vt(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(p){if(p){if(it(p)&&(p=p.toNumber()),!nt(p)||!tt(p))throw new TypeError("The parameter k must be an integer number")}else p=0;var m=p>0?p:0,v=p<0?-p:0,b=this._size[0],y=this._size[1],S=Math.min(b-v,y-m),x=[],_=[],M=[];M[0]=0;for(var w=m;w<y&&x.length<S;w++)for(var C=this._ptr[w],P=this._ptr[w+1],D=C;D<P;D++){var R=this._index[D];if(R===w-m+v){x.push(this._values[D]),_[x.length-1]=R-v;break}}return M.push(x.length),new i({values:x,index:_,ptr:M,size:[S,1]})},i.fromJSON=function(p){return new i(p)},i.diagonal=function(p,m,v,b,y){if(!yt(p))throw new TypeError("Array expected, size parameter");if(p.length!==2)throw new Error("Only two dimensions matrix are supported");if(p=p.map(function(j){if(it(j)&&(j=j.toNumber()),!nt(j)||!tt(j)||j<1)throw new Error("Size values must be positive integers");return j}),v){if(it(v)&&(v=v.toNumber()),!nt(v)||!tt(v))throw new TypeError("The parameter k must be an integer number")}else v=0;var S=t,x=0;jt(y)&&(S=e.find(t,[y,y])||t,x=e.convert(0,y));var _=v>0?v:0,M=v<0?-v:0,w=p[0],C=p[1],P=Math.min(w-M,C-_),D;if(yt(m)){if(m.length!==P)throw new Error("Invalid value array length");D=function(J){return m[J]}}else if(ot(m)){var R=m.size();if(R.length!==1||R[0]!==P)throw new Error("Invalid matrix length");D=function(J){return m.get([J])}}else D=function(){return m};for(var W=[],G=[],k=[],L=0;L<C;L++){k.push(W.length);var q=L-_;if(q>=0&&q<P){var Y=D(q);S(Y,x)||(G.push(q+M),W.push(Y))}}return k.push(W.length),new i({values:W,index:G,ptr:k,size:[w,C]})},i.prototype.swapRows=function(p,m){if(!nt(p)||!tt(p)||!nt(m)||!tt(m))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Et(p,this._size[0]),Et(m,this._size[0]),i._swapRows(p,m,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(p,m,v,b,y){for(var S=b[p],x=b[p+1],_=S;_<x;_++)y(v[_],m[_])},i._swapRows=function(p,m,v,b,y,S){for(var x=0;x<v;x++){var _=S[x],M=S[x+1],w=s(p,_,M,y),C=s(m,_,M,y);if(w<M&&C<M&&y[w]===p&&y[C]===m){if(b){var P=b[w];b[w]=b[C],b[C]=P}continue}if(w<M&&y[w]===p&&(C>=M||y[C]!==m)){var D=b?b[w]:void 0;y.splice(C,0,m),b&&b.splice(C,0,D),y.splice(C<=w?w+1:w,1),b&&b.splice(C<=w?w+1:w,1);continue}if(C<M&&y[C]===m&&(w>=M||y[w]!==p)){var R=b?b[C]:void 0;y.splice(w,0,p),b&&b.splice(w,0,R),y.splice(w<=C?C+1:C,1),b&&b.splice(w<=C?C+1:C,1)}}},i},{isClass:!0});var pm="number",fm=["typed"];function dm(r){var e=r.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var t={"0b":2,"0o":8,"0x":16}[e[1]],n=e[2],i=e[3];return{input:r,radix:t,integerPart:n,fractionalPart:i}}else return null}function gm(r){for(var e=parseInt(r.integerPart,r.radix),t=0,n=0;n<r.fractionalPart.length;n++){var i=parseInt(r.fractionalPart[n],r.radix);t+=i/Math.pow(r.radix,n+1)}var o=e+t;if(isNaN(o))throw new SyntaxError('String "'+r.input+'" is not a valid number');return o}var Co=N(pm,fm,r=>{var{typed:e}=r,t=e("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var o=dm(i);if(o)return gm(o);var a=0,c=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);c&&(a=Number(c[2]),i=c[1]);var l=Number(i);if(isNaN(l))throw new SyntaxError('String "'+i+'" is not a valid number');if(c){if(l>2**a-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));l>=2**(a-1)&&(l=l-2**a)}return l},BigNumber:function(i){return i.toNumber()},bigint:function(i){return Number(i)},Fraction:function(i){return i.valueOf()},Unit:e.referToSelf(n=>i=>{var o=i.clone();return o.value=n(i.value),o}),null:function(i){return 0},"Unit, string | Unit":function(i,o){return i.toNumber(o)},"Array | Matrix":e.referToSelf(n=>i=>_t(i,n))});return t.fromJSON=function(n){return parseFloat(n.value)},t});var mm="bignumber",ym=["typed","BigNumber"],Ao=N(mm,ym,r=>{var{typed:e,BigNumber:t}=r;return e("bignumber",{"":function(){return new t(0)},number:function(i){return new t(i+"")},string:function(i){var o=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(o){var a=o[2],c=t(o[1]),l=new t(2).pow(Number(a));if(c.gt(l.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var s=new t(2).pow(Number(a)-1);return c.gte(s)?c.sub(l):c}return new t(i)},BigNumber:function(i){return i},bigint:function(i){return new t(i.toString())},Unit:e.referToSelf(n=>i=>{var o=i.clone();return o.value=n(i.value),o}),Fraction:function(i){return new t(i.n).div(i.d).times(i.s)},null:function(i){return new t(0)},"Array | Matrix":e.referToSelf(n=>i=>_t(i,n))})});var vm="fraction",_m=["typed","Fraction"],Po=N(vm,_m,r=>{var{typed:e,Fraction:t}=r;return e("fraction",{number:function(i){if(!isFinite(i)||isNaN(i))throw new Error(i+" cannot be represented as a fraction");return new t(i)},string:function(i){return new t(i)},"number, number":function(i,o){return new t(i,o)},null:function(i){return new t(0)},BigNumber:function(i){return new t(i.toString())},bigint:function(i){return new t(i.toString())},Fraction:function(i){return i},Unit:e.referToSelf(n=>i=>{var o=i.clone();return o.value=n(i.value),o}),Object:function(i){return new t(i)},"Array | Matrix":e.referToSelf(n=>i=>_t(i,n))})});var fl="matrix",xm=["typed","Matrix","DenseMatrix","SparseMatrix"],Do=N(fl,xm,r=>{var{typed:e,Matrix:t,DenseMatrix:n,SparseMatrix:i}=r;return e(fl,{"":function(){return o([])},string:function(c){return o([],c)},"string, string":function(c,l){return o([],c,l)},Array:function(c){return o(c)},Matrix:function(c){return o(c,c.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(a,c,l){if(c==="dense"||c==="default"||c===void 0)return new n(a,l);if(c==="sparse")return new i(a,l);throw new TypeError("Unknown matrix type "+JSON.stringify(c)+".")}});var dl="unaryMinus",Em=["typed"],Io=N(dl,Em,r=>{var{typed:e}=r;return e(dl,{number:xo,"Complex | BigNumber | Fraction":t=>t.neg(),bigint:t=>-t,Unit:e.referToSelf(t=>n=>{var i=n.clone();return i.value=e.find(t,i.valueType())(n.value),i}),"Array | Matrix":e.referToSelf(t=>n=>_t(n,t,!0))})});var gl="abs",bm=["typed"],Ro=N(gl,bm,r=>{var{typed:e}=r;return e(gl,{number:mo,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),bigint:t=>t<0n?-t:t,"Array | Matrix":e.referToSelf(t=>n=>_t(n,t,!0))})});var ml="addScalar",Sm=["typed"],No=N(ml,Sm,r=>{var{typed:e}=r;return e(ml,{"number, number":yo,"Complex, Complex":function(n,i){return n.add(i)},"BigNumber, BigNumber":function(n,i){return n.plus(i)},"bigint, bigint":function(n,i){return n+i},"Fraction, Fraction":function(n,i){return n.add(i)},"Unit, Unit":e.referToSelf(t=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var o=n.clone();return o.value=e.find(t,[o.valueType(),i.valueType()])(o.value,i.value),o.fixPrefix=!1,o})})});var yl="subtractScalar",Mm=["typed"],Lo=N(yl,Mm,r=>{var{typed:e}=r;return e(yl,{"number, number":vo,"Complex, Complex":function(n,i){return n.sub(i)},"BigNumber, BigNumber":function(n,i){return n.minus(i)},"bigint, bigint":function(n,i){return n-i},"Fraction, Fraction":function(n,i){return n.sub(i)},"Unit, Unit":e.referToSelf(t=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var o=n.clone();return o.value=e.find(t,[o.valueType(),i.valueType()])(o.value,i.value),o.fixPrefix=!1,o})})});var wm="matAlgo11xS0s",Tm=["typed","equalScalar"],De=N(wm,Tm,r=>{var{typed:e,equalScalar:t}=r;return function(i,o,a,c){var l=i._values,s=i._index,u=i._ptr,h=i._size,f=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=h[0],g=h[1],p,m=t,v=0,b=a;typeof f=="string"&&(p=f,m=e.find(t,[p,p]),v=e.convert(0,p),o=e.convert(o,p),b=e.find(a,[p,p]));for(var y=[],S=[],x=[],_=0;_<g;_++){x[_]=S.length;for(var M=u[_],w=u[_+1],C=M;C<w;C++){var P=s[C],D=c?b(o,l[C]):b(l[C],o);m(D,v)||(S.push(P),y.push(D))}}return x[g]=S.length,i.createSparseMatrix({values:y,index:S,ptr:x,size:[d,g],datatype:p})}});var Cm="matAlgo12xSfs",Am=["typed","DenseMatrix"],Nn=N(Cm,Am,r=>{var{typed:e,DenseMatrix:t}=r;return function(i,o,a,c){var l=i._values,s=i._index,u=i._ptr,h=i._size,f=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=h[0],g=h[1],p,m=a;typeof f=="string"&&(p=f,o=e.convert(o,p),m=e.find(a,[p,p]));for(var v=[],b=[],y=[],S=0;S<g;S++){for(var x=S+1,_=u[S],M=u[S+1],w=_;w<M;w++){var C=s[w];b[C]=l[w],y[C]=x}for(var P=0;P<d;P++)S===0&&(v[P]=[]),y[P]===x?v[P][S]=c?m(o,b[P]):m(b[P],o):v[P][S]=c?m(o,0):m(0,o)}return new t({data:v,size:[d,g],datatype:p})}});var Pm="matAlgo14xDs",Dm=["typed"],Ie=N(Pm,Dm,r=>{var{typed:e}=r;return function(i,o,a,c){var l=i._data,s=i._size,u=i._datatype,h,f=a;typeof u=="string"&&(h=u,o=e.convert(o,h),f=e.find(a,[h,h]));var d=s.length>0?t(f,0,s,s[0],l,o,c):[];return i.createDenseMatrix({data:d,size:ft(s),datatype:h})};function t(n,i,o,a,c,l,s){var u=[];if(i===o.length-1)for(var h=0;h<a;h++)u[h]=s?n(l,c[h]):n(c[h],l);else for(var f=0;f<a;f++)u[f]=t(n,i+1,o,o[i+1],c[f],l,s);return u}});var Oo="ceil",Im=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Rm=N(Oo,["typed","config","round"],r=>{var{typed:e,config:t,round:n}=r;return e(Oo,{number:function(o){return pe(o,n(o),t.relTol,t.absTol)?n(o):Math.ceil(o)},"number, number":function(o,a){if(pe(o,n(o,a),t.relTol,t.absTol))return n(o,a);var[c,l]="".concat(o,"e").split("e"),s=Math.ceil(Number("".concat(c,"e").concat(Number(l)+a)));return[c,l]="".concat(s,"e").split("e"),Number("".concat(c,"e").concat(Number(l)-a))}})}),Fo=N(Oo,Im,r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:o,zeros:a,DenseMatrix:c}=r,l=De({typed:e,equalScalar:o}),s=Nn({typed:e,DenseMatrix:c}),u=Ie({typed:e}),h=Rm({typed:e,config:t,round:n});return e("ceil",{number:h.signatures.number,"number,number":h.signatures["number,number"],Complex:function(d){return d.ceil()},"Complex, number":function(d,g){return d.ceil(g)},"Complex, BigNumber":function(d,g){return d.ceil(g.toNumber())},BigNumber:function(d){return Je(d,n(d),t.relTol,t.absTol)?n(d):d.ceil()},"BigNumber, BigNumber":function(d,g){return Je(d,n(d,g),t.relTol,t.absTol)?n(d,g):d.toDecimalPlaces(g.toNumber(),Jn.ROUND_CEIL)},Fraction:function(d){return d.ceil()},"Fraction, number":function(d,g){return d.ceil(g)},"Fraction, BigNumber":function(d,g){return d.ceil(g.toNumber())},"Array | Matrix":e.referToSelf(f=>d=>_t(d,f,!0)),"Array, number | BigNumber":e.referToSelf(f=>(d,g)=>_t(d,p=>f(p,g),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(f=>(d,g)=>l(d,g,f,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(f=>(d,g)=>u(d,g,f,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(f=>(d,g)=>u(i(g),d,f,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(f=>(d,g)=>o(d,0)?a(g.size(),g.storage()):g.storage()==="dense"?u(g,d,f,!0):s(g,d,f,!0))})});var vl="exp",Nm=["typed"],Uo=N(vl,Nm,r=>{var{typed:e}=r;return e(vl,{number:Eo,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var Lm="matAlgo02xDS0",Om=["typed","equalScalar"],_l=N(Lm,Om,r=>{var{typed:e,equalScalar:t}=r;return function(i,o,a,c){var l=i._data,s=i._size,u=i._datatype||i.getDataType(),h=o._values,f=o._index,d=o._ptr,g=o._size,p=o._datatype||o._data===void 0?o._datatype:o.getDataType();if(s.length!==g.length)throw new Q(s.length,g.length);if(s[0]!==g[0]||s[1]!==g[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+g+")");if(!h)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=s[0],v=s[1],b,y=t,S=0,x=a;typeof u=="string"&&u===p&&u!=="mixed"&&(b=u,y=e.find(t,[b,b]),S=e.convert(0,b),x=e.find(a,[b,b]));for(var _=[],M=[],w=[],C=0;C<v;C++){w[C]=M.length;for(var P=d[C],D=d[C+1],R=P;R<D;R++){var W=f[R],G=c?x(h[R],l[W][C]):x(l[W][C],h[R]);y(G,S)||(M.push(W),_.push(G))}}return w[v]=M.length,o.createSparseMatrix({values:_,index:M,ptr:w,size:[m,v],datatype:u===i._datatype&&p===o._datatype?b:void 0})}});var Fm="matAlgo03xDSf",Um=["typed"],xl=N(Fm,Um,r=>{var{typed:e}=r;return function(n,i,o,a){var c=n._data,l=n._size,s=n._datatype||n.getDataType(),u=i._values,h=i._index,f=i._ptr,d=i._size,g=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(l.length!==d.length)throw new Q(l.length,d.length);if(l[0]!==d[0]||l[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var p=l[0],m=l[1],v,b=0,y=o;typeof s=="string"&&s===g&&s!=="mixed"&&(v=s,b=e.convert(0,v),y=e.find(o,[v,v]));for(var S=[],x=0;x<p;x++)S[x]=[];for(var _=[],M=[],w=0;w<m;w++){for(var C=w+1,P=f[w],D=f[w+1],R=P;R<D;R++){var W=h[R];_[W]=a?y(u[R],c[W][w]):y(c[W][w],u[R]),M[W]=C}for(var G=0;G<p;G++)M[G]===C?S[G][w]=_[G]:S[G][w]=a?y(b,c[G][w]):y(c[G][w],b)}return n.createDenseMatrix({data:S,size:[p,m],datatype:s===n._datatype&&g===i._datatype?v:void 0})}});var Bm="matAlgo13xDD",zm=["typed"],El=N(Bm,zm,r=>{var{typed:e}=r;return function(i,o,a){var c=i._data,l=i._size,s=i._datatype,u=o._data,h=o._size,f=o._datatype,d=[];if(l.length!==h.length)throw new Q(l.length,h.length);for(var g=0;g<l.length;g++){if(l[g]!==h[g])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+h+")");d[g]=l[g]}var p,m=a;typeof s=="string"&&s===f&&(p=s,m=e.find(a,[p,p]));var v=d.length>0?t(m,0,d,d[0],c,u):[];return i.createDenseMatrix({data:v,size:d,datatype:p})};function t(n,i,o,a,c,l){var s=[];if(i===o.length-1)for(var u=0;u<a;u++)s[u]=n(c[u],l[u]);else for(var h=0;h<a;h++)s[h]=t(n,i+1,o,o[i+1],c[h],l[h]);return s}});function Dt(r,e){if(ce(r.size(),e.size()))return[r,e];var t=ho(r.size(),e.size());return[r,e].map(n=>Gm(n,t))}function Gm(r,e){return ce(r.size(),e)?r:r.create(er(r.valueOf(),e),r.datatype())}var km="matrixAlgorithmSuite",Vm=["typed","matrix"],fi=N(km,Vm,r=>{var{typed:e,matrix:t}=r,n=El({typed:e}),i=Ie({typed:e});return function(a){var c=a.elop,l=a.SD||a.DS,s;c?(s={"DenseMatrix, DenseMatrix":(d,g)=>n(...Dt(d,g),c),"Array, Array":(d,g)=>n(...Dt(t(d),t(g)),c).valueOf(),"Array, DenseMatrix":(d,g)=>n(...Dt(t(d),g),c),"DenseMatrix, Array":(d,g)=>n(...Dt(d,t(g)),c)},a.SS&&(s["SparseMatrix, SparseMatrix"]=(d,g)=>a.SS(...Dt(d,g),c,!1)),a.DS&&(s["DenseMatrix, SparseMatrix"]=(d,g)=>a.DS(...Dt(d,g),c,!1),s["Array, SparseMatrix"]=(d,g)=>a.DS(...Dt(t(d),g),c,!1)),l&&(s["SparseMatrix, DenseMatrix"]=(d,g)=>l(...Dt(g,d),c,!0),s["SparseMatrix, Array"]=(d,g)=>l(...Dt(t(g),d),c,!0))):(s={"DenseMatrix, DenseMatrix":e.referToSelf(d=>(g,p)=>n(...Dt(g,p),d)),"Array, Array":e.referToSelf(d=>(g,p)=>n(...Dt(t(g),t(p)),d).valueOf()),"Array, DenseMatrix":e.referToSelf(d=>(g,p)=>n(...Dt(t(g),p),d)),"DenseMatrix, Array":e.referToSelf(d=>(g,p)=>n(...Dt(g,t(p)),d))},a.SS&&(s["SparseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,p)=>a.SS(...Dt(g,p),d,!1))),a.DS&&(s["DenseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,p)=>a.DS(...Dt(g,p),d,!1)),s["Array, SparseMatrix"]=e.referToSelf(d=>(g,p)=>a.DS(...Dt(t(g),p),d,!1))),l&&(s["SparseMatrix, DenseMatrix"]=e.referToSelf(d=>(g,p)=>l(...Dt(p,g),d,!0)),s["SparseMatrix, Array"]=e.referToSelf(d=>(g,p)=>l(...Dt(t(p),g),d,!0))));var u=a.scalar||"any",h=a.Ds||a.Ss;h&&(c?(s["DenseMatrix,"+u]=(d,g)=>i(d,g,c,!1),s[u+", DenseMatrix"]=(d,g)=>i(g,d,c,!0),s["Array,"+u]=(d,g)=>i(t(d),g,c,!1).valueOf(),s[u+", Array"]=(d,g)=>i(t(g),d,c,!0).valueOf()):(s["DenseMatrix,"+u]=e.referToSelf(d=>(g,p)=>i(g,p,d,!1)),s[u+", DenseMatrix"]=e.referToSelf(d=>(g,p)=>i(p,g,d,!0)),s["Array,"+u]=e.referToSelf(d=>(g,p)=>i(t(g),p,d,!1).valueOf()),s[u+", Array"]=e.referToSelf(d=>(g,p)=>i(t(p),g,d,!0).valueOf())));var f=a.sS!==void 0?a.sS:a.Ss;return c?(a.Ss&&(s["SparseMatrix,"+u]=(d,g)=>a.Ss(d,g,c,!1)),f&&(s[u+", SparseMatrix"]=(d,g)=>f(g,d,c,!0))):(a.Ss&&(s["SparseMatrix,"+u]=e.referToSelf(d=>(g,p)=>a.Ss(g,p,d,!1))),f&&(s[u+", SparseMatrix"]=e.referToSelf(d=>(g,p)=>f(p,g,d,!0)))),c&&c.signatures&&Zr(s,c.signatures),s}});var Hm="matAlgo01xDSid",Wm=["typed"],bl=N(Hm,Wm,r=>{var{typed:e}=r;return function(n,i,o,a){var c=n._data,l=n._size,s=n._datatype||n.getDataType(),u=i._values,h=i._index,f=i._ptr,d=i._size,g=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(l.length!==d.length)throw new Q(l.length,d.length);if(l[0]!==d[0]||l[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var p=l[0],m=l[1],v=typeof s=="string"&&s!=="mixed"&&s===g?s:void 0,b=v?e.find(o,[v,v]):o,y,S,x=[];for(y=0;y<p;y++)x[y]=[];var _=[],M=[];for(S=0;S<m;S++){for(var w=S+1,C=f[S],P=f[S+1],D=C;D<P;D++)y=h[D],_[y]=a?b(u[D],c[y][S]):b(c[y][S],u[D]),M[y]=w;for(y=0;y<p;y++)M[y]===w?x[y][S]=_[y]:x[y][S]=c[y][S]}return n.createDenseMatrix({data:x,size:[p,m],datatype:s===n._datatype&&g===i._datatype?v:void 0})}});var qm="matAlgo04xSidSid",Xm=["typed","equalScalar"],Sl=N(qm,Xm,r=>{var{typed:e,equalScalar:t}=r;return function(i,o,a){var c=i._values,l=i._index,s=i._ptr,u=i._size,h=i._datatype||i._data===void 0?i._datatype:i.getDataType(),f=o._values,d=o._index,g=o._ptr,p=o._size,m=o._datatype||o._data===void 0?o._datatype:o.getDataType();if(u.length!==p.length)throw new Q(u.length,p.length);if(u[0]!==p[0]||u[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+p+")");var v=u[0],b=u[1],y,S=t,x=0,_=a;typeof h=="string"&&h===m&&h!=="mixed"&&(y=h,S=e.find(t,[y,y]),x=e.convert(0,y),_=e.find(a,[y,y]));var M=c&&f?[]:void 0,w=[],C=[],P=c&&f?[]:void 0,D=c&&f?[]:void 0,R=[],W=[],G,k,L,q,Y;for(k=0;k<b;k++){C[k]=w.length;var j=k+1;for(q=s[k],Y=s[k+1],L=q;L<Y;L++)G=l[L],w.push(G),R[G]=j,P&&(P[G]=c[L]);for(q=g[k],Y=g[k+1],L=q;L<Y;L++)if(G=d[L],R[G]===j){if(P){var J=_(P[G],f[L]);S(J,x)?R[G]=null:P[G]=J}}else w.push(G),W[G]=j,D&&(D[G]=f[L]);if(P&&D)for(L=C[k];L<w.length;)G=w[L],R[G]===j?(M[L]=P[G],L++):W[G]===j?(M[L]=D[G],L++):w.splice(L,1)}return C[b]=w.length,i.createSparseMatrix({values:M,index:w,ptr:C,size:[v,b],datatype:h===i._datatype&&m===o._datatype?y:void 0})}});var jm="matAlgo10xSids",Ym=["typed","DenseMatrix"],Ml=N(jm,Ym,r=>{var{typed:e,DenseMatrix:t}=r;return function(i,o,a,c){var l=i._values,s=i._index,u=i._ptr,h=i._size,f=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=h[0],g=h[1],p,m=a;typeof f=="string"&&(p=f,o=e.convert(o,p),m=e.find(a,[p,p]));for(var v=[],b=[],y=[],S=0;S<g;S++){for(var x=S+1,_=u[S],M=u[S+1],w=_;w<M;w++){var C=s[w];b[C]=l[w],y[C]=x}for(var P=0;P<d;P++)S===0&&(v[P]=[]),y[P]===x?v[P][S]=c?m(o,b[P]):m(b[P],o):v[P][S]=o}return new t({data:v,size:[d,g],datatype:p})}});var wl="log2",$m=["typed","config","Complex"],Bo=N(wl,$m,r=>{var{typed:e,config:t,Complex:n}=r;return e(wl,{number:function(a){return a>=0||t.predictable?bo(a):i(new n(a,0))},Complex:i,BigNumber:function(a){return!a.isNegative()||t.predictable?a.log(2):i(new n(a.toNumber(),0))},"Array | Matrix":e.referToSelf(o=>a=>_t(a,o))});function i(o){var a=Math.sqrt(o.re*o.re+o.im*o.im);return new n(Math.log2?Math.log2(a):Math.log(a)/Math.LN2,Math.atan2(o.im,o.re)/Math.LN2)}});var Zm="multiplyScalar",Km=["typed"],zo=N(Zm,Km,r=>{var{typed:e}=r;return e("multiplyScalar",{"number, number":_o,"Complex, Complex":function(n,i){return n.mul(i)},"BigNumber, BigNumber":function(n,i){return n.times(i)},"bigint, bigint":function(n,i){return n*i},"Fraction, Fraction":function(n,i){return n.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(t,n)=>n.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,n)=>t.multiply(n)})});var Tl="multiply",Jm=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],Go=N(Tl,Jm,r=>{var{typed:e,matrix:t,addScalar:n,multiplyScalar:i,equalScalar:o,dot:a}=r,c=De({typed:e,equalScalar:o}),l=Ie({typed:e});function s(x,_){switch(x.length){case 1:switch(_.length){case 1:if(x[0]!==_[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(x[0]!==_[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+x[0]+") must match Matrix rows ("+_[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+_.length+" dimensions)")}break;case 2:switch(_.length){case 1:if(x[1]!==_[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+x[1]+") must match Vector length ("+_[0]+")");break;case 2:if(x[1]!==_[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+x[1]+") must match Matrix B rows ("+_[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+_.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+x.length+" dimensions)")}}function u(x,_,M){if(M===0)throw new Error("Cannot multiply two empty vectors");return a(x,_)}function h(x,_){if(_.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return f(x,_)}function f(x,_){var M=x._data,w=x._size,C=x._datatype||x.getDataType(),P=_._data,D=_._size,R=_._datatype||_.getDataType(),W=w[0],G=D[1],k,L=n,q=i;C&&R&&C===R&&typeof C=="string"&&C!=="mixed"&&(k=C,L=e.find(n,[k,k]),q=e.find(i,[k,k]));for(var Y=[],j=0;j<G;j++){for(var J=q(M[0],P[0][j]),lt=1;lt<W;lt++)J=L(J,q(M[lt],P[lt][j]));Y[j]=J}return x.createDenseMatrix({data:Y,size:[G],datatype:C===x._datatype&&R===_._datatype?k:void 0})}var d=e("_multiplyMatrixVector",{"DenseMatrix, any":p,"SparseMatrix, any":b}),g=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":m,"DenseMatrix, SparseMatrix":v,"SparseMatrix, DenseMatrix":y,"SparseMatrix, SparseMatrix":S});function p(x,_){var M=x._data,w=x._size,C=x._datatype||x.getDataType(),P=_._data,D=_._datatype||_.getDataType(),R=w[0],W=w[1],G,k=n,L=i;C&&D&&C===D&&typeof C=="string"&&C!=="mixed"&&(G=C,k=e.find(n,[G,G]),L=e.find(i,[G,G]));for(var q=[],Y=0;Y<R;Y++){for(var j=M[Y],J=L(j[0],P[0]),lt=1;lt<W;lt++)J=k(J,L(j[lt],P[lt]));q[Y]=J}return x.createDenseMatrix({data:q,size:[R],datatype:C===x._datatype&&D===_._datatype?G:void 0})}function m(x,_){var M=x._data,w=x._size,C=x._datatype||x.getDataType(),P=_._data,D=_._size,R=_._datatype||_.getDataType(),W=w[0],G=w[1],k=D[1],L,q=n,Y=i;C&&R&&C===R&&typeof C=="string"&&C!=="mixed"&&C!=="mixed"&&(L=C,q=e.find(n,[L,L]),Y=e.find(i,[L,L]));for(var j=[],J=0;J<W;J++){var lt=M[J];j[J]=[];for(var at=0;at<k;at++){for(var pt=Y(lt[0],P[0][at]),Tt=1;Tt<G;Tt++)pt=q(pt,Y(lt[Tt],P[Tt][at]));j[J][at]=pt}}return x.createDenseMatrix({data:j,size:[W,k],datatype:C===x._datatype&&R===_._datatype?L:void 0})}function v(x,_){var M=x._data,w=x._size,C=x._datatype||x.getDataType(),P=_._values,D=_._index,R=_._ptr,W=_._size,G=_._datatype||_._data===void 0?_._datatype:_.getDataType();if(!P)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var k=w[0],L=W[1],q,Y=n,j=i,J=o,lt=0;C&&G&&C===G&&typeof C=="string"&&C!=="mixed"&&(q=C,Y=e.find(n,[q,q]),j=e.find(i,[q,q]),J=e.find(o,[q,q]),lt=e.convert(0,q));for(var at=[],pt=[],Tt=[],wt=_.createSparseMatrix({values:at,index:pt,ptr:Tt,size:[k,L],datatype:C===x._datatype&&G===_._datatype?q:void 0}),St=0;St<L;St++){Tt[St]=pt.length;var xt=R[St],$t=R[St+1];if($t>xt)for(var Mt=0,gt=0;gt<k;gt++){for(var se=gt+1,Ot=void 0,ct=xt;ct<$t;ct++){var It=D[ct];Mt!==se?(Ot=j(M[gt][It],P[ct]),Mt=se):Ot=Y(Ot,j(M[gt][It],P[ct]))}Mt===se&&!J(Ot,lt)&&(pt.push(gt),at.push(Ot))}}return Tt[L]=pt.length,wt}function b(x,_){var M=x._values,w=x._index,C=x._ptr,P=x._datatype||x._data===void 0?x._datatype:x.getDataType();if(!M)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var D=_._data,R=_._datatype||_.getDataType(),W=x._size[0],G=_._size[0],k=[],L=[],q=[],Y,j=n,J=i,lt=o,at=0;P&&R&&P===R&&typeof P=="string"&&P!=="mixed"&&(Y=P,j=e.find(n,[Y,Y]),J=e.find(i,[Y,Y]),lt=e.find(o,[Y,Y]),at=e.convert(0,Y));var pt=[],Tt=[];q[0]=0;for(var wt=0;wt<G;wt++){var St=D[wt];if(!lt(St,at))for(var xt=C[wt],$t=C[wt+1],Mt=xt;Mt<$t;Mt++){var gt=w[Mt];Tt[gt]?pt[gt]=j(pt[gt],J(St,M[Mt])):(Tt[gt]=!0,L.push(gt),pt[gt]=J(St,M[Mt]))}}for(var se=L.length,Ot=0;Ot<se;Ot++){var ct=L[Ot];k[Ot]=pt[ct]}return q[1]=L.length,x.createSparseMatrix({values:k,index:L,ptr:q,size:[W,1],datatype:P===x._datatype&&R===_._datatype?Y:void 0})}function y(x,_){var M=x._values,w=x._index,C=x._ptr,P=x._datatype||x._data===void 0?x._datatype:x.getDataType();if(!M)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var D=_._data,R=_._datatype||_.getDataType(),W=x._size[0],G=_._size[0],k=_._size[1],L,q=n,Y=i,j=o,J=0;P&&R&&P===R&&typeof P=="string"&&P!=="mixed"&&(L=P,q=e.find(n,[L,L]),Y=e.find(i,[L,L]),j=e.find(o,[L,L]),J=e.convert(0,L));for(var lt=[],at=[],pt=[],Tt=x.createSparseMatrix({values:lt,index:at,ptr:pt,size:[W,k],datatype:P===x._datatype&&R===_._datatype?L:void 0}),wt=[],St=[],xt=0;xt<k;xt++){pt[xt]=at.length;for(var $t=xt+1,Mt=0;Mt<G;Mt++){var gt=D[Mt][xt];if(!j(gt,J))for(var se=C[Mt],Ot=C[Mt+1],ct=se;ct<Ot;ct++){var It=w[ct];St[It]!==$t?(St[It]=$t,at.push(It),wt[It]=Y(gt,M[ct])):wt[It]=q(wt[It],Y(gt,M[ct]))}}for(var zt=pt[xt],Ee=at.length,Ge=zt;Ge<Ee;Ge++){var Un=at[Ge];lt[Ge]=wt[Un]}}return pt[k]=at.length,Tt}function S(x,_){var M=x._values,w=x._index,C=x._ptr,P=x._datatype||x._data===void 0?x._datatype:x.getDataType(),D=_._values,R=_._index,W=_._ptr,G=_._datatype||_._data===void 0?_._datatype:_.getDataType(),k=x._size[0],L=_._size[1],q=M&&D,Y,j=n,J=i;P&&G&&P===G&&typeof P=="string"&&P!=="mixed"&&(Y=P,j=e.find(n,[Y,Y]),J=e.find(i,[Y,Y]));for(var lt=q?[]:void 0,at=[],pt=[],Tt=x.createSparseMatrix({values:lt,index:at,ptr:pt,size:[k,L],datatype:P===x._datatype&&G===_._datatype?Y:void 0}),wt=q?[]:void 0,St=[],xt,$t,Mt,gt,se,Ot,ct,It,zt=0;zt<L;zt++){pt[zt]=at.length;var Ee=zt+1;for(se=W[zt],Ot=W[zt+1],gt=se;gt<Ot;gt++)if(It=R[gt],q)for($t=C[It],Mt=C[It+1],xt=$t;xt<Mt;xt++)ct=w[xt],St[ct]!==Ee?(St[ct]=Ee,at.push(ct),wt[ct]=J(D[gt],M[xt])):wt[ct]=j(wt[ct],J(D[gt],M[xt]));else for($t=C[It],Mt=C[It+1],xt=$t;xt<Mt;xt++)ct=w[xt],St[ct]!==Ee&&(St[ct]=Ee,at.push(ct));if(q)for(var Ge=pt[zt],Un=at.length,cn=Ge;cn<Un;cn++){var sr=at[cn];lt[cn]=wt[sr]}}return pt[L]=at.length,Tt}return e(Tl,i,{"Array, Array":e.referTo("Matrix, Matrix",x=>(_,M)=>{s(st(_),st(M));var w=x(t(_),t(M));return ot(w)?w.valueOf():w}),"Matrix, Matrix":function(_,M){var w=_.size(),C=M.size();return s(w,C),w.length===1?C.length===1?u(_,M,w[0]):h(_,M):C.length===1?d(_,M):g(_,M)},"Matrix, Array":e.referTo("Matrix,Matrix",x=>(_,M)=>x(_,t(M))),"Array, Matrix":e.referToSelf(x=>(_,M)=>x(t(_,M.storage()),M)),"SparseMatrix, any":function(_,M){return c(_,M,i,!1)},"DenseMatrix, any":function(_,M){return l(_,M,i,!1)},"any, SparseMatrix":function(_,M){return c(M,_,i,!0)},"any, DenseMatrix":function(_,M){return l(M,_,i,!0)},"Array, any":function(_,M){return l(t(_),M,i,!1).valueOf()},"any, Array":function(_,M){return l(t(M),_,i,!0).valueOf()},"any, any":i,"any, any, ...any":e.referToSelf(x=>(_,M,w)=>{for(var C=x(_,M),P=0;P<w.length;P++)C=x(C,w[P]);return C})})});var Qm="matAlgo07xSSf",ty=["typed","DenseMatrix"],Cl=N(Qm,ty,r=>{var{typed:e,DenseMatrix:t}=r;return function(o,a,c){var l=o._size,s=o._datatype||o._data===void 0?o._datatype:o.getDataType(),u=a._size,h=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(l.length!==u.length)throw new Q(l.length,u.length);if(l[0]!==u[0]||l[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+u+")");var f=l[0],d=l[1],g,p=0,m=c;typeof s=="string"&&s===h&&s!=="mixed"&&(g=s,p=e.convert(0,g),m=e.find(c,[g,g]));var v,b,y=[];for(v=0;v<f;v++)y[v]=[];var S=[],x=[],_=[],M=[];for(b=0;b<d;b++){var w=b+1;for(n(o,b,_,S,w),n(a,b,M,x,w),v=0;v<f;v++){var C=_[v]===w?S[v]:p,P=M[v]===w?x[v]:p;y[v][b]=m(C,P)}}return new t({data:y,size:[f,d],datatype:s===o._datatype&&h===a._datatype?g:void 0})};function n(i,o,a,c,l){for(var s=i._values,u=i._index,h=i._ptr,f=h[o],d=h[o+1];f<d;f++){var g=u[f];a[g]=l,c[g]=s[f]}}});var Al="conj",ey=["typed"],ko=N(Al,ey,r=>{var{typed:e}=r;return e(Al,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":e.referToSelf(t=>n=>_t(n,t))})});var Pl="concat",ny=["typed","matrix","isInteger"],Vo=N(Pl,ny,r=>{var{typed:e,matrix:t,isInteger:n}=r;return e(Pl,{"...Array | Matrix | number | BigNumber":function(o){var a,c=o.length,l=-1,s,u=!1,h=[];for(a=0;a<c;a++){var f=o[a];if(ot(f)&&(u=!0),nt(f)||it(f)){if(a!==c-1)throw new Error("Dimension must be specified as last argument");if(s=l,l=f.valueOf(),!n(l))throw new TypeError("Integer number expected for dimension");if(l<0||a>0&&l>s)throw new _e(l,s+1)}else{var d=ft(f).valueOf(),g=st(d);if(h[a]=d,s=l,l=g.length-1,a>0&&l!==s)throw new Q(s+1,l+1)}}if(h.length===0)throw new SyntaxError("At least one matrix expected");for(var p=h.shift();h.length;)p=co(p,h.shift(),l);return u?t(p):p},"...string":function(o){return o.join("")}})});var Dl="identity",ry=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],Ho=N(Dl,ry,r=>{var{typed:e,config:t,matrix:n,BigNumber:i,DenseMatrix:o,SparseMatrix:a}=r;return e(Dl,{"":function(){return t.matrix==="Matrix"?n([]):[]},string:function(u){return n(u)},"number | BigNumber":function(u){return l(u,u,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(u,h){return l(u,u,h)},"number | BigNumber, number | BigNumber":function(u,h){return l(u,h,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(u,h,f){return l(u,h,f)},Array:function(u){return c(u)},"Array, string":function(u,h){return c(u,h)},Matrix:function(u){return c(u.valueOf(),u.storage())},"Matrix, string":function(u,h){return c(u.valueOf(),h)}});function c(s,u){switch(s.length){case 0:return u?n(u):[];case 1:return l(s[0],s[0],u);case 2:return l(s[0],s[1],u);default:throw new Error("Vector containing two values expected")}}function l(s,u,h){var f=it(s)||it(u)?i:null;if(it(s)&&(s=s.toNumber()),it(u)&&(u=u.toNumber()),!tt(s)||s<1)throw new Error("Parameters in function identity must be positive integers");if(!tt(u)||u<1)throw new Error("Parameters in function identity must be positive integers");var d=f?new i(1):1,g=f?new f(0):0,p=[s,u];if(h){if(h==="sparse")return a.diagonal(p,d,0,g);if(h==="dense")return o.diagonal(p,d,0,g);throw new TypeError('Unknown matrix type "'.concat(h,'"'))}for(var m=un([],p,g),v=s<u?s:u,b=0;b<v;b++)m[b][b]=d;return m}});function Il(){throw new Error('No "bignumber" implementation available')}function Rl(){throw new Error('No "fraction" implementation available')}function Nl(){throw new Error('No "matrix" implementation available')}var Ll="reshape",iy=["typed","isInteger","matrix"],Wo=N(Ll,iy,r=>{var{typed:e,isInteger:t}=r;return e(Ll,{"Matrix, Array":function(i,o){return i.reshape(o,!0)},"Array, Array":function(i,o){return o.forEach(function(a){if(!t(a))throw new TypeError("Invalid size for dimension: "+a)}),Qn(i,o)}})});var Ol="size",oy=["typed","config","?matrix"],qo=N(Ol,oy,r=>{var{typed:e,config:t,matrix:n}=r;return e(Ol,{Matrix:function(o){return o.create(o.size(),"number")},Array:st,string:function(o){return t.matrix==="Array"?[o.length]:n([o.length],"dense","number")},"number | Complex | BigNumber | Unit | boolean | null":function(o){return t.matrix==="Array"?[]:n?n([],"dense","number"):Nl()}})});var Fl="zeros",sy=["typed","config","matrix","BigNumber"],Xo=N(Fl,sy,r=>{var{typed:e,config:t,matrix:n,BigNumber:i}=r;return e(Fl,{"":function(){return t.matrix==="Array"?o([]):o([],"default")},"...number | BigNumber | string":function(s){var u=s[s.length-1];if(typeof u=="string"){var h=s.pop();return o(s,h)}else return t.matrix==="Array"?o(s):o(s,"default")},Array:o,Matrix:function(s){var u=s.storage();return o(s.valueOf(),u)},"Array | Matrix, string":function(s,u){return o(s.valueOf(),u)}});function o(l,s){var u=a(l),h=u?new i(0):0;if(c(l),s){var f=n(s);return l.length>0?f.resize(l,h):f}else{var d=[];return l.length>0?un(d,l,h):d}}function a(l){var s=!1;return l.forEach(function(u,h,f){it(u)&&(s=!0,f[h]=u.toNumber())}),s}function c(l){l.forEach(function(s){if(typeof s!="number"||!tt(s)||s<0)throw new Error("Parameters in function zeros must be positive integers")})}});var Ul="fft",ay=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],jo=N(Ul,ay,r=>{var{typed:e,matrix:t,addScalar:n,multiplyScalar:i,divideScalar:o,exp:a,tau:c,i:l,dotDivide:s,conj:u,pow:h,ceil:f,log2:d}=r;return e(Ul,{Array:g,Matrix:function(y){return y.create(g(y.valueOf()),y.datatype())}});function g(b){var y=st(b);return y.length===1?v(b,y[0]):p(b.map(S=>g(S,y.slice(1))),0)}function p(b,y){var S=st(b);if(y!==0)return new Array(S[0]).fill(0).map((_,M)=>p(b[M],y-1));if(S.length===1)return v(b);function x(_){var M=st(_);return new Array(M[1]).fill(0).map((w,C)=>new Array(M[0]).fill(0).map((P,D)=>_[D][C]))}return x(p(x(b),1))}function m(b){for(var y=b.length,S=a(o(i(-1,i(l,c)),y)),x=[],_=1-y;_<y;_++)x.push(h(S,o(h(_,2),2)));for(var M=h(2,f(d(y+y-1))),w=[...new Array(y).fill(0).map((L,q)=>i(b[q],x[y-1+q])),...new Array(M-y).fill(0)],C=[...new Array(y+y-1).fill(0).map((L,q)=>o(1,x[q])),...new Array(M-(y+y-1)).fill(0)],P=v(w),D=v(C),R=new Array(M).fill(0).map((L,q)=>i(P[q],D[q])),W=s(u(g(u(R))),M),G=[],k=y-1;k<y+y-1;k++)G.push(i(W[k],x[k]));return G}function v(b){var y=b.length;if(y===1)return[b[0]];if(y%2===0){for(var S=[...v(b.filter((w,C)=>C%2===0),y/2),...v(b.filter((w,C)=>C%2===1),y/2)],x=0;x<y/2;x++){var _=S[x],M=i(S[x+y/2],a(i(i(c,l),o(-x,y))));S[x]=n(_,M),S[x+y/2]=n(_,i(-1,M))}return S}else return m(b)}});function Yo(r,e,t){var n;return String(r).includes("Unexpected type")?(n=arguments.length>2?" (type: "+Ut(t)+", value: "+JSON.stringify(t)+")":" (type: "+r.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+n)):String(r).includes("complex numbers")?(n=arguments.length>2?" (type: "+Ut(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+n)):r}var uy="numeric",ly=["number","?bignumber","?fraction"],$o=N(uy,ly,r=>{var{number:e,bignumber:t,fraction:n}=r,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},o={number:a=>e(a),BigNumber:t?a=>t(a):Il,bigint:a=>BigInt(a),Fraction:n?a=>n(a):Rl};return function(c){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",s=arguments.length>2?arguments[2]:void 0;if(s!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var u=Ut(c);if(!(u in i))throw new TypeError("Cannot convert "+c+' of type "'+u+'"; valid input types are '+Object.keys(i).join(", "));if(!(l in o))throw new TypeError("Cannot convert "+c+' to type "'+l+'"; valid output types are '+Object.keys(o).join(", "));return l===u?c:o[l](c)}});var Bl="divideScalar",cy=["typed","numeric"],Zo=N(Bl,cy,r=>{var{typed:e,numeric:t}=r;return e(Bl,{"number, number":function(i,o){return i/o},"Complex, Complex":function(i,o){return i.div(o)},"BigNumber, BigNumber":function(i,o){return i.div(o)},"bigint, bigint":function(i,o){return i/o},"Fraction, Fraction":function(i,o){return i.div(o)},"Unit, number | Complex | Fraction | BigNumber | Unit":(n,i)=>n.divide(i),"number | Fraction | Complex | BigNumber, Unit":(n,i)=>i.divideInto(n)})});var zl="pow",hy=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Ko=N(zl,hy,r=>{var{typed:e,config:t,identity:n,multiply:i,matrix:o,inv:a,number:c,fraction:l,Complex:s}=r;return e(zl,{"number, number":u,"Complex, Complex":function(g,p){return g.pow(p)},"BigNumber, BigNumber":function(g,p){return p.isInteger()||g>=0||t.predictable?g.pow(p):new s(g.toNumber(),0).pow(p.toNumber(),0)},"bigint, bigint":(d,g)=>d**g,"Fraction, Fraction":function(g,p){var m=g.pow(p);if(m!=null)return m;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return u(g.valueOf(),p.valueOf())},"Array, number":h,"Array, BigNumber":function(g,p){return h(g,p.toNumber())},"Matrix, number":f,"Matrix, BigNumber":function(g,p){return f(g,p.toNumber())},"Unit, number | BigNumber":function(g,p){return g.pow(p)}});function u(d,g){if(t.predictable&&!tt(g)&&d<0)try{var p=l(g),m=c(p);if((g===m||Math.abs((g-m)/g)<1e-14)&&p.d%2===1)return(p.n%2===0?1:-1)*Math.pow(-d,g)}catch{}return t.predictable&&(d<-1&&g===1/0||d>-1&&d<0&&g===-1/0)?NaN:tt(g)||d>=0||t.predictable?So(d,g):d*d<1&&g===1/0||d*d>1&&g===-1/0?0:new s(d,0).pow(g,0)}function h(d,g){if(!tt(g))throw new TypeError("For A^b, b must be an integer (value is "+g+")");var p=st(d);if(p.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+p.length+" dimensions)");if(p[0]!==p[1])throw new Error("For A^b, A must be square (size is "+p[0]+"x"+p[1]+")");if(g<0)try{return h(a(d),-g)}catch(b){throw b.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+g+")"):b}for(var m=n(p[0]).valueOf(),v=d;g>=1;)(g&1)===1&&(m=i(v,m)),g>>=1,v=i(v,v);return m}function f(d,g){return o(h(d.valueOf(),g))}});var Ln="Number of decimals in function round must be an integer",Gl="round",py=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],Jo=N(Gl,py,r=>{var{typed:e,config:t,matrix:n,equalScalar:i,zeros:o,BigNumber:a,DenseMatrix:c}=r,l=De({typed:e,equalScalar:i}),s=Nn({typed:e,DenseMatrix:c}),u=Ie({typed:e});function h(f){return Math.abs(Cn(f).exponent)}return e(Gl,{number:function(d){var g=Rn(d,h(t.relTol)),p=pe(d,g,t.relTol,t.absTol)?g:d;return Rn(p)},"number, number":function(d,g){var p=h(t.relTol);if(g>=p)return Rn(d,g);var m=Rn(d,p),v=pe(d,m,t.relTol,t.absTol)?m:d;return Rn(v,g)},"number, BigNumber":function(d,g){if(!g.isInteger())throw new TypeError(Ln);return new a(d).toDecimalPlaces(g.toNumber())},Complex:function(d){return d.round()},"Complex, number":function(d,g){if(g%1)throw new TypeError(Ln);return d.round(g)},"Complex, BigNumber":function(d,g){if(!g.isInteger())throw new TypeError(Ln);var p=g.toNumber();return d.round(p)},BigNumber:function(d){var g=new a(d).toDecimalPlaces(h(t.relTol)),p=Je(d,g,t.relTol,t.absTol)?g:d;return p.toDecimalPlaces(0)},"BigNumber, BigNumber":function(d,g){if(!g.isInteger())throw new TypeError(Ln);var p=h(t.relTol);if(g>=p)return d.toDecimalPlaces(g.toNumber());var m=d.toDecimalPlaces(p),v=Je(d,m,t.relTol,t.absTol)?m:d;return v.toDecimalPlaces(g.toNumber())},Fraction:function(d){return d.round()},"Fraction, number":function(d,g){if(g%1)throw new TypeError(Ln);return d.round(g)},"Fraction, BigNumber":function(d,g){if(!g.isInteger())throw new TypeError(Ln);return d.round(g.toNumber())},"Unit, number, Unit":e.referToSelf(f=>function(d,g,p){var m=d.toNumeric(p);return p.multiply(f(m,g))}),"Unit, BigNumber, Unit":e.referToSelf(f=>(d,g,p)=>f(d,g.toNumber(),p)),"Unit, Unit":e.referToSelf(f=>(d,g)=>f(d,0,g)),"Array | Matrix, number, Unit":e.referToSelf(f=>(d,g,p)=>_t(d,m=>f(m,g,p),!0)),"Array | Matrix, BigNumber, Unit":e.referToSelf(f=>(d,g,p)=>f(d,g.toNumber(),p)),"Array | Matrix, Unit":e.referToSelf(f=>(d,g)=>f(d,0,g)),"Array | Matrix":e.referToSelf(f=>d=>_t(d,f,!0)),"SparseMatrix, number | BigNumber":e.referToSelf(f=>(d,g)=>l(d,g,f,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(f=>(d,g)=>u(d,g,f,!1)),"Array, number | BigNumber":e.referToSelf(f=>(d,g)=>u(n(d),g,f,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":e.referToSelf(f=>(d,g)=>i(d,0)?o(g.size(),g.storage()):s(g,d,f,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":e.referToSelf(f=>(d,g)=>i(d,0)?o(g.size(),g.storage()):u(g,d,f,!0)),"number | Complex | BigNumber | Fraction, Array":e.referToSelf(f=>(d,g)=>u(n(g),d,f,!0).valueOf())})});var kl="dotDivide",fy=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],Qo=N(kl,fy,r=>{var{typed:e,matrix:t,equalScalar:n,divideScalar:i,DenseMatrix:o,concat:a}=r,c=_l({typed:e,equalScalar:n}),l=xl({typed:e}),s=Cl({typed:e,DenseMatrix:o}),u=De({typed:e,equalScalar:n}),h=Nn({typed:e,DenseMatrix:o}),f=fi({typed:e,matrix:t,concat:a});return e(kl,f({elop:i,SS:s,DS:l,SD:c,Ss:u,sS:h}))});function Vl(r){var e=0,t=1,n=Object.create(null),i=Object.create(null),o=0,a=function(l){var s=i[l];if(s&&(delete n[s],delete i[l],--e,t===s)){if(!e){o=0,t=1;return}for(;!Object.prototype.hasOwnProperty.call(n,++t););}};return r=Math.abs(r),{hit:function(l){var s=i[l],u=++o;if(n[u]=l,i[l]=u,!s)return++e,e<=r?void 0:(l=n[t],a(l),l);if(delete n[s],t===s)for(;!Object.prototype.hasOwnProperty.call(n,++t););},delete:a,clear:function(){e=o=0,t=1,n=Object.create(null),i=Object.create(null)}}}function rr(r){var{hasher:e,limit:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t=t??Number.POSITIVE_INFINITY,e=e??JSON.stringify,function n(){typeof n.cache!="object"&&(n.cache={values:new Map,lru:Vl(t||Number.POSITIVE_INFINITY)});for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var a=e(i);if(n.cache.values.has(a))return n.cache.lru.hit(a),n.cache.values.get(a);var c=r.apply(r,i);return n.cache.values.set(a,c),n.cache.values.delete(n.cache.lru.hit(a)),c}}var dy=rr(function(r){return new r(1).exp()},{hasher:di}),gy=rr(function(r){return new r(1).plus(new r(5).sqrt()).div(2)},{hasher:di}),Hl=rr(function(r){return r.acos(-1)},{hasher:di}),Wl=rr(function(r){return Hl(r).times(2)},{hasher:di});function di(r){return r[0].precision}var ql="add",my=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],ts=N(ql,my,r=>{var{typed:e,matrix:t,addScalar:n,equalScalar:i,DenseMatrix:o,SparseMatrix:a,concat:c}=r,l=bl({typed:e}),s=Sl({typed:e,equalScalar:i}),u=Ml({typed:e,DenseMatrix:o}),h=fi({typed:e,matrix:t,concat:c});return e(ql,{"any, any":n,"any, any, ...any":e.referToSelf(f=>(d,g,p)=>{for(var m=f(d,g),v=0;v<p.length;v++)m=f(m,p[v]);return m})},h({elop:n,DS:l,SS:s,Ss:u}))});var Xl="dot",yy=["typed","addScalar","multiplyScalar","conj","size"],es=N(Xl,yy,r=>{var{typed:e,addScalar:t,multiplyScalar:n,conj:i,size:o}=r;return e(Xl,{"Array | DenseMatrix, Array | DenseMatrix":c,"SparseMatrix, SparseMatrix":l});function a(u,h){var f=s(u),d=s(h),g,p;if(f.length===1)g=f[0];else if(f.length===2&&f[1]===1)g=f[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+f.join(", ")+")");if(d.length===1)p=d[0];else if(d.length===2&&d[1]===1)p=d[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+d.join(", ")+")");if(g!==p)throw new RangeError("Vectors must have equal length ("+g+" != "+p+")");if(g===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return g}function c(u,h){var f=a(u,h),d=ot(u)?u._data:u,g=ot(u)?u._datatype||u.getDataType():void 0,p=ot(h)?h._data:h,m=ot(h)?h._datatype||h.getDataType():void 0,v=s(u).length===2,b=s(h).length===2,y=t,S=n;if(g&&m&&g===m&&typeof g=="string"&&g!=="mixed"){var x=g;y=e.find(t,[x,x]),S=e.find(n,[x,x])}if(!v&&!b){for(var _=S(i(d[0]),p[0]),M=1;M<f;M++)_=y(_,S(i(d[M]),p[M]));return _}if(!v&&b){for(var w=S(i(d[0]),p[0][0]),C=1;C<f;C++)w=y(w,S(i(d[C]),p[C][0]));return w}if(v&&!b){for(var P=S(i(d[0][0]),p[0]),D=1;D<f;D++)P=y(P,S(i(d[D][0]),p[D]));return P}if(v&&b){for(var R=S(i(d[0][0]),p[0][0]),W=1;W<f;W++)R=y(R,S(i(d[W][0]),p[W][0]));return R}}function l(u,h){a(u,h);for(var f=u._index,d=u._values,g=h._index,p=h._values,m=0,v=t,b=n,y=0,S=0;y<f.length&&S<g.length;){var x=f[y],_=g[S];if(x<_){y++;continue}if(x>_){S++;continue}x===_&&(m=v(m,b(d[y],p[S])),y++,S++)}return m}function s(u){return ot(u)?u.size():o(u)}});var jl="det",vy=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],ns=N(jl,vy,r=>{var{typed:e,matrix:t,subtractScalar:n,multiply:i,divideScalar:o,isZero:a,unaryMinus:c}=r;return e(jl,{any:function(u){return ft(u)},"Array | Matrix":function(u){var h;switch(ot(u)?h=u.size():Array.isArray(u)?(u=t(u),h=u.size()):h=[],h.length){case 0:return ft(u);case 1:if(h[0]===1)return ft(u.valueOf()[0]);if(h[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+vt(h)+")");case 2:{var f=h[0],d=h[1];if(f===d)return l(u.clone().valueOf(),f,d);if(d===0)return 1;throw new RangeError("Matrix must be square (size: "+vt(h)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+vt(h)+")")}}});function l(s,u,h){if(u===1)return ft(s[0][0]);if(u===2)return n(i(s[0][0],s[1][1]),i(s[1][0],s[0][1]));for(var f=!1,d=new Array(u).fill(0).map((M,w)=>w),g=0;g<u;g++){var p=d[g];if(a(s[p][g])){var m=void 0;for(m=g+1;m<u;m++)if(!a(s[d[m]][g])){p=d[m],d[m]=d[g],d[g]=p,f=!f;break}if(m===u)return s[p][g]}for(var v=s[p][g],b=g===0?1:s[d[g-1]][g-1],y=g+1;y<u;y++)for(var S=d[y],x=g+1;x<u;x++)s[S][x]=o(n(i(s[S][x],v),i(s[S][g],s[p][x])),b)}var _=s[d[u-1]][u-1];return f?c(_):_}});var Yl="inv",_y=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],rs=N(Yl,_y,r=>{var{typed:e,matrix:t,divideScalar:n,addScalar:i,multiply:o,unaryMinus:a,det:c,identity:l,abs:s}=r;return e(Yl,{"Array | Matrix":function(f){var d=ot(f)?f.size():st(f);switch(d.length){case 1:if(d[0]===1)return ot(f)?t([n(1,f.valueOf()[0])]):[n(1,f[0])];throw new RangeError("Matrix must be square (size: "+vt(d)+")");case 2:{var g=d[0],p=d[1];if(g===p)return ot(f)?t(u(f.valueOf(),g,p),f.storage()):u(f,g,p);throw new RangeError("Matrix must be square (size: "+vt(d)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+vt(d)+")")}},any:function(f){return n(1,f)}});function u(h,f,d){var g,p,m,v,b;if(f===1){if(v=h[0][0],v===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,v)]]}else if(f===2){var y=c(h);if(y===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(h[1][1],y),n(a(h[0][1]),y)],[n(a(h[1][0]),y),n(h[0][0],y)]]}else{var S=h.concat();for(g=0;g<f;g++)S[g]=S[g].concat();for(var x=l(f).valueOf(),_=0;_<d;_++){var M=s(S[_][_]),w=_;for(g=_+1;g<f;)s(S[g][_])>M&&(M=s(S[g][_]),w=g),g++;if(M===0)throw Error("Cannot calculate inverse, determinant is zero");g=w,g!==_&&(b=S[_],S[_]=S[g],S[g]=b,b=x[_],x[_]=x[g],x[g]=b);var C=S[_],P=x[_];for(g=0;g<f;g++){var D=S[g],R=x[g];if(g!==_){if(D[_]!==0){for(m=n(a(D[_]),C[_]),p=_;p<d;p++)D[p]=i(D[p],o(m,C[p]));for(p=0;p<d;p++)R[p]=i(R[p],o(m,P[p]))}}else{for(m=C[_],p=_;p<d;p++)D[p]=n(D[p],m);for(p=0;p<d;p++)R[p]=n(R[p],m)}}}return x}}});var xy="divide",Ey=["typed","matrix","multiply","equalScalar","divideScalar","inv"],is=N(xy,Ey,r=>{var{typed:e,matrix:t,multiply:n,equalScalar:i,divideScalar:o,inv:a}=r,c=De({typed:e,equalScalar:i}),l=Ie({typed:e});return e("divide",Zr({"Array | Matrix, Array | Matrix":function(u,h){return n(u,a(h))},"DenseMatrix, any":function(u,h){return l(u,h,o,!1)},"SparseMatrix, any":function(u,h){return c(u,h,o,!1)},"Array, any":function(u,h){return l(t(u),h,o,!1).valueOf()},"any, Array | Matrix":function(u,h){return n(u,a(h))}},o.signatures))});var $l="mean",by=["typed","add","divide"],os=N($l,by,r=>{var{typed:e,add:t,divide:n}=r;return e($l,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":i,"...":function(c){if(sl(c))throw new TypeError("Scalar values expected in function mean");return o(c)}});function i(a,c){try{var l=al(a,c,t),s=Array.isArray(a)?st(a):a.size();return n(l,s[c])}catch(u){throw Yo(u,"mean")}}function o(a){var c,l=0;if(fo(a,function(s){try{c=c===void 0?s:t(c,s),l++}catch(u){throw Yo(u,"mean",s)}}),l===0)throw new Error("Cannot calculate the mean of an empty array");return n(c,l)}});var ss=Zl("tau",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?Wl(t):ll});var as=Zl("i",["Complex"],r=>{var{Complex:e}=r;return e.I});function Zl(r,e,t){return N(r,e,t,{recreateOnConfigChange:!0})}var On=eo({config:he}),gi=ro({});var Kl=oo({}),By=as({Complex:gi});var us=so({});var zy=ss({BigNumber:On,config:he});var ln=po({Matrix:us});var rt=Yi({BigNumber:On,Complex:gi,DenseMatrix:ln,Fraction:Kl});var Gy=Ro({typed:rt});var ir=No({typed:rt});var Jl=ko({typed:rt});var Qe=wo({config:he,typed:rt});var ky=Uo({typed:rt});var Ql=go({typed:rt});var Vy=Mo({equalScalar:Qe,typed:rt});var Hy=Bo({Complex:gi,config:he,typed:rt});var ls=zo({typed:rt});var tc=Co({typed:rt});var cs=To({Matrix:us,equalScalar:Qe,typed:rt});var Wy=Lo({typed:rt});var qy=Ao({BigNumber:On,typed:rt});var ec=Io({typed:rt});var nc=Po({Fraction:Kl,typed:rt});var Yt=Do({DenseMatrix:ln,Matrix:us,SparseMatrix:cs,typed:rt});var Xy=$o({bignumber:qy,fraction:nc,number:tc});var rc=Wo({isInteger:Ql,matrix:Yt,typed:rt}),jy=qo({matrix:Yt,config:he,typed:rt});var ic=Xo({BigNumber:On,config:he,matrix:Yt,typed:rt});var oc=Vo({isInteger:Ql,matrix:Yt,typed:rt});var or=Zo({numeric:Xy,typed:rt}),Yy=Qo({DenseMatrix:ln,concat:oc,divideScalar:or,equalScalar:Qe,matrix:Yt,typed:rt});var sc=Ho({BigNumber:On,DenseMatrix:ln,SparseMatrix:cs,config:he,matrix:Yt,typed:rt});var $y=Jo({BigNumber:On,DenseMatrix:ln,config:he,equalScalar:Qe,matrix:Yt,typed:rt,zeros:ic});var Zy=ts({DenseMatrix:ln,SparseMatrix:cs,addScalar:ir,concat:oc,equalScalar:Qe,matrix:Yt,typed:rt});var Ky=es({addScalar:ir,conj:Jl,multiplyScalar:ls,size:jy,typed:rt});var Fn=Go({addScalar:ir,dot:Ky,equalScalar:Qe,matrix:Yt,multiplyScalar:ls,typed:rt});var Jy=Fo({DenseMatrix:ln,config:he,equalScalar:Qe,matrix:Yt,round:$y,typed:rt,zeros:ic});var Qy=ns({divideScalar:or,isZero:Vy,matrix:Yt,multiply:Fn,subtractScalar:Wy,typed:rt,unaryMinus:ec});var ac=rs({abs:Gy,addScalar:ir,det:Qy,divideScalar:or,identity:sc,matrix:Yt,multiply:Fn,typed:rt,unaryMinus:ec});var tv=Ko({Complex:gi,config:he,fraction:nc,identity:sc,inv:ac,matrix:Yt,multiply:Fn,number:tc,typed:rt});var uc=jo({addScalar:ir,ceil:Jy,conj:Jl,divideScalar:or,dotDivide:Yy,exp:ky,i:By,log2:Hy,matrix:Yt,multiplyScalar:ls,pow:tv,tau:zy,typed:rt});var ev=is({divideScalar:or,equalScalar:Qe,inv:ac,matrix:Yt,multiply:Fn,typed:rt});var lc=os({add:Zy,divide:ev,typed:rt});var mi=class{NumParticle;reSampNumParticle;initial_xy_uncertainty;initial_yaw_uncertainty;step_noise_sigma;yaw_noise_sigma;compass_update_interval;sigmaCompass;delta_yaw;sigmaBeacon;unaccess_weight;particle_PosInitFlag;particle_yawInitFlag;xEst;particleX;particleWeight;last_compass_time;last_yaw_compass=0;compass_consecutive_offset_count=0;constructor(e){this.NumParticle=e.NumParticle,this.reSampNumParticle=e.reSampNumParticle,this.initial_xy_uncertainty=e.initial_xy_uncertainty,this.initial_yaw_uncertainty=e.initial_yaw_uncertainty,this.step_noise_sigma=e.step_noise_sigma,this.yaw_noise_sigma=e.yaw_noise_sigma,this.compass_update_interval=e.compass_update_interval,this.sigmaCompass=e.sigmaCompass,this.delta_yaw=e.delta_yaw,this.sigmaBeacon=e.sigmaBeacon,this.unaccess_weight=e.unaccess_weight,this.particle_PosInitFlag=!1,this.particle_yawInitFlag=!1,this.xEst=[[0],[0],[0]],this.particleX=Array.from({length:3},()=>Array(this.NumParticle).fill(0)),this.particleWeight=Array.from({length:1},()=>Array(this.NumParticle).fill(1/this.NumParticle)),this.last_compass_time=0}motionModelRotYaw(e){if(!(Math.abs(e)<.001)){this.last_yaw_compass=jn(this.last_yaw_compass+e);for(let t=0;t<this.NumParticle;t++){let n=Math.random()*this.yaw_noise_sigma;this.particleX[2][t]=this.particleX[2][t]+e+n,this.particleX[2][t]=jn(this.particleX[2][t])}}}motionModelStepLength(e,t){if(e===0)return;for(let i=0;i<this.NumParticle;i++){let o=Math.random()*this.step_noise_sigma;this.particleX[0][i]+=(.65+o)*Math.sin(-this.particleX[2][i]/180*Math.PI),this.particleX[1][i]+=(.65+o)*Math.cos(this.particleX[2][i]/180*Math.PI),t(this.particleX[0][i],this.particleX[1][i])||(this.particleWeight[0][i]*=this.unaccess_weight)}let n=this.particleWeight[0].reduce((i,o)=>i+o,0);this.particleWeight[0]=this.particleWeight[0].map(i=>i/n)}motionModelCompassYaw(e,t){if(t-this.last_compass_time>this.compass_update_interval){let n=360-e;n+=this.delta_yaw,n=jn(n),Math.abs(n-this.last_yaw_compass)>60?this.compass_consecutive_offset_count++:this.compass_consecutive_offset_count=0,this.compass_consecutive_offset_count>=5&&this.initParticlesByCompass(e);for(let o=0;o<this.NumParticle;o++){let a=Math.abs(this.particleX[2][o]-n);a>180&&(a=360-a),this.particleWeight[0][o]*=jr(a,this.sigmaCompass)}let i=this.particleWeight[0].reduce((o,a)=>o+a,0);this.particleWeight[0]=this.particleWeight[0].map(o=>o/i),this.setLastCompassTime(t)}}resampling(){if(1/this.particleWeight[0].reduce((t,n)=>t+n*n,0)<this.reSampNumParticle){let t=this.particleWeight[0].reduce((c,l,s)=>c.concat(c[s]+l),[0]),i=this.particleWeight[0].map(()=>1/this.NumParticle).map((c,l)=>c+Math.random()/this.NumParticle),o=[],a=0;for(let c=0;c<this.NumParticle;c++){for(;i[c]>t[a];)a++;o.push(a)}this.particleX=this.particleX.map((c,l)=>o.map(s=>c[s])),this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle)}}update(e,t){for(let i=0;i<this.NumParticle;i++){let o=En(this.particleX[0][i],this.particleX[1][i],e.x,e.y);this.particleWeight[0][i]=Math.max(1e-7,this.particleWeight[0][i]*jr(o,t))}let n=this.particleWeight[0].reduce((i,o)=>i+o,0);this.particleWeight[0]=this.particleWeight[0].map(i=>i/n)}updateCar(e,t){let n=e.x-this.xEst[0][0],i=e.y-this.xEst[1][0];for(let a=0;a<this.NumParticle;a++){let c=En(this.particleX[0][a],this.particleX[1][a],e.x,e.y);this.particleWeight[0][a]=Math.max(1e-7,this.particleWeight[0][a]*jr(c,t)),this.particleX[0][a]+=n,this.particleX[1][a]+=i}let o=this.particleWeight[0].reduce((a,c)=>a+c,0);this.particleWeight[0]=this.particleWeight[0].map(a=>a/o)}getPosInitFlag(){return this.particle_PosInitFlag}getYawInitFlag(){return this.particle_yawInitFlag}setPosInitFlag(e){this.particle_PosInitFlag=e}setYawInitFlag(e){this.particle_yawInitFlag=e}getResultX(){let e=rc(this.particleWeight,[this.NumParticle,1]),t=Fn(this.particleX,e);return this.xEst=t,this.xEst[0][0]}getResultY(){return this.xEst[1][0]}getResultYaw(){let e=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0]));return this.particleX[2][e]}getEstConfidence(){let e=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0])),t=this.particleWeight[0].indexOf(Math.min(...this.particleWeight[0])),n=[this.particleX[0][e],this.particleX[1][e]],i=[this.particleX[0][t],this.particleX[1][t]],o=En(n[0],n[1],i[0],i[1]),a=o*.67;return console.log(o,a),a}getParticleNum(){return this.NumParticle}getParticleX(){return this.particleX}setLastCompassTime(e){this.last_compass_time=e}getLastCompassTime(){return this.last_compass_time}initParticlesByPos(e,t,n){if(!this.particle_PosInitFlag){this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle);let i=0;for(;i<this.NumParticle;){let a=(2*Math.random()-1)*this.initial_xy_uncertainty,c=(2*Math.random()-1)*this.initial_xy_uncertainty;n(e+a,t+c)||(this.particleWeight[0][i]*=this.unaccess_weight),this.particleX[0][i]=e+a,this.particleX[1][i]=t+c,i++}let o=this.particleWeight[0].reduce((a,c)=>a+c,0);this.particleWeight[0]=this.particleWeight[0].map(a=>a/o),this.particle_PosInitFlag=!0,this.xEst[0][0]=e,this.xEst[1][0]=t,this.xEst[2][0]=0}}initParticlesByCompass(e){console.log(`Init compass: ${e}`);let t=360-e;t+=this.delta_yaw,t=jn(t),console.log(`Init Yaw: ${t}`);for(let n=0;n<this.NumParticle;n++){let i=(2*Math.random()-1)*this.initial_yaw_uncertainty;this.particleX[2][n]=t+i}this.particle_yawInitFlag=!0,this.xEst[2][0]=t,this.last_yaw_compass=t,this.compass_consecutive_offset_count=0}};var yi=class{fre=100;accH_fifo=[];accH_time_fifo=[];accH_fifo_len=Math.floor(1*this.fre)+1;step_count=0;state_count=0;last_valley_time=0;last_peak_time=0;last_step_time=0;min_step_time=.3;max_step_time=1;min_peak=10.5;max_valley=9.5;peak_num=0;valley_num=0;fft_min_amp=.3;fft_min_fre=0;fft_max_fre=4;last_fft_amp=0;abnor_start_time=0;abnor_fft_detected=!1;abnor_time_threshold=4;abnor_peak_time=0;abnor_peak_accH=0;const_step_length=.65;last_rot=[];delta_rot=[];last_yaw=0;delta_yaw=null;delta_rot_sum_fifo=[];delta_rot_sum_time_fifo=[];delta_yaw_accum=0;delta_yaw_accum_timestamp=0;delta_yaw_time_threshold=.5;last_px=0;last_py=0;delta_px=0;delta_py=0;init(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10+.5,this.max_valley=10-.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.65,this.last_rot=[0,0,0],this.delta_rot=[0,0,0],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}reset(){this.init()}setInitPose(e=[0,0]){this.last_px=e[0],this.last_py=e[1],console.info(`pdr init pos: ${this.last_px}, ${this.last_py}`)}setInitYaw(e=0){this.last_yaw=e}getPos(e,t,n){let i=0;return n.length===3&&(this.delta_yaw=this.getDeltaYawFromRot(e,n)),t.length===3&&(i=this.getStepLength(e,t)),i!==0&&(this.last_px+=this.delta_px,this.last_py+=this.delta_py),[this.last_px,this.last_py]}getDeltaPose(){return[this.delta_px,this.delta_py]}getStepLength(e,t){if(t.length<3)return console.warn("acc data less than 3"),0;let n=!1,i=Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2));if(this.accH_fifo.push(i),this.accH_time_fifo.push(e),this.imuFreUpdate(),this.accH_fifo.length<this.accH_fifo_len+1)n=!1;else{for(;this.accH_fifo.length>=this.accH_fifo_len+1;)this.accH_fifo.shift(),this.accH_time_fifo.shift();let o=this.PVStepDetec(),a=this.FFTStepDetec(),c=this.recheckState(),l=this.accH_time_fifo[Math.floor(this.accH_time_fifo.length*3/4)];Math.abs(this.abnor_start_time)<.001&&this.abnor_fft_detected?this.abnor_start_time=l:this.abnor_fft_detected||(this.abnor_start_time=0),o&&a&&c?(this.step_count+=1,this.last_step_time=l,n=!0):Math.abs(this.abnor_start_time)>.001&&this.abnor_peak_time-this.abnor_start_time>this.abnor_time_threshold&&this.step_count>1&&this.abnor_peak_time-this.last_step_time>1?(this.step_count+=1,this.last_step_time=l,n=!0):(l-this.last_step_time>2&&(this.state_count=0),n=!1)}if(n){let o=this.last_yaw/180*Math.PI;return this.delta_px=this.const_step_length*Math.cos(o),this.delta_py=this.const_step_length*Math.sin(o),this.const_step_length}else return 0}imuFreUpdate(){if(this.accH_time_fifo.length>2&&(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]<0||this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]>10||this.accH_time_fifo[this.accH_time_fifo.length-1]===this.accH_time_fifo[0])&&(console.warn(`pdr reset last one time ${this.accH_time_fifo[this.accH_time_fifo.length-1]} last two time ${this.accH_time_fifo[this.accH_time_fifo.length-2]}`),this.reset()),this.accH_fifo.length>9||this.fre<15){let e=(this.accH_fifo.length-1)/(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[0]);Math.abs(this.fre-e)>8&&(this.fre=Math.round((e-3)/10)*10,(this.fre<=10||this.fre>=100)&&(console.warn(`Frequency Error ${this.fre}`),this.fre=100),console.debug(`Frequency change to ${this.fre}`),this.accH_fifo_len=Math.floor(1*this.fre)+1)}}recheckState(){return!0}PVStepDetec(){let e=!1,t=this.accH_fifo.slice(Math.floor(this.accH_fifo_len/2)),n=this.accH_time_fifo.slice(Math.floor(this.accH_fifo_len/2)),i=t[Math.floor(t.length/2)],o=n[Math.floor(n.length/2)],a=Math.max(...t),c=Math.min(...t),l=!1,s=!1;return Math.abs(i-c)<.01&&i<this.max_valley&&this.valley_num<=this.peak_num&&(this.last_valley_time===0?s=!0:s=o-this.last_valley_time>this.min_step_time,s&&(this.last_valley_time=o,this.valley_num+=1)),Math.abs(i-a)<.01&&i>this.min_peak&&this.peak_num<=this.valley_num&&(this.last_peak_time===0?l=!0:l=o-this.last_peak_time>this.min_step_time,l&&(this.last_peak_time=o,this.peak_num+=1)),i===a&&i>this.min_peak&&(this.abnor_peak_time=o,this.abnor_peak_accH=i),this.peak_num===this.valley_num&&(l||s)&&(e=!0),e}FFTStepDetec(){return!0}getDeltaYawFromRot(e,t){if(t.length<3)return console.warn("rot data less than 3"),0;let n=[0,0,0];this.last_rot.length===3&&(n=t.map((c,l)=>c-this.last_rot[l]));for(let c=0;c<t.length;c++)n[c]<-180?n[c]+=360:n[c]>180&&(n[c]-=360);let i=.2;this.delta_rot.length===3?this.delta_rot=this.delta_rot.map((c,l)=>i*c+(1-i)*n[l]):this.delta_rot=n,this.last_rot=t,this.delta_yaw=this.delta_rot[0],this.last_yaw+=this.delta_yaw,this.last_yaw=this.limitYaw(this.last_yaw);let o=this.delta_rot.reduce((c,l)=>c+Math.abs(l),0);this.delta_rot_sum_fifo.push(o),this.delta_rot_sum_time_fifo.push(e),Math.abs(this.delta_rot_sum_time_fifo[this.delta_rot_sum_time_fifo.length-1]-this.delta_rot_sum_time_fifo[0])>1&&(this.delta_rot_sum_fifo.shift(),this.delta_rot_sum_time_fifo.shift()),this.delta_yaw_accum+=this.delta_yaw;let a=0;return Math.abs(this.delta_yaw_accum_timestamp-e)>this.delta_yaw_time_threshold?(a=this.delta_yaw_accum,this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=e,a):null}limitYaw(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}};var vi=class{particleFilter;pdr;sigmaBeacon=5;gps_horizontalAccuracy=10;using_gps=!0;last_beacon_time=null;last_pos_time;position_count=0;gps_max_horizontalAccuracy=20;MaxEstimateErr=5;outTrustRegionNum=0;TrustNum=4;cacheSensorData=[];constructor(){this.particleFilter=new mi({NumParticle:200,reSampNumParticle:.65,initial_xy_uncertainty:12,initial_yaw_uncertainty:100,step_noise_sigma:.5,yaw_noise_sigma:2,compass_update_interval:3e3,sigmaCompass:80,delta_yaw:2,sigmaBeacon:5,unaccess_weight:.7}),this.pdr=new yi}pfFusionPDRiBeacon(e){let{type:t,timestamp:n,res:i}=e,o=!1;if(this.particleFilter.getPosInitFlag()&&this.particleFilter.getYawInitFlag()){if(t==="acceleration"){let a=i,c=this.pdr.getStepLength(n/1e3,a);c!==0&&(this.particleFilter.motionModelStepLength(c,()=>!0),this.particleFilter.resampling(),this.position_count+=1,o=!0)}if(this.using_gps&&t==="gps"&&(this.last_beacon_time===null||n-this.last_beacon_time>5e3)){let a=this.getGpsPosition(i);o=a!==null,a&&(this.particleFilter.update(a,this.gps_horizontalAccuracy),this.resetParticleFilterDist(a),this.particleFilter.resampling(),this.position_count+=1)}if(t==="deviceMotion"){let a=this.pdr.getDeltaYawFromRot(n/1e3,i);a!==null&&this.particleFilter.motionModelRotYaw(a)}t==="compass"&&this.particleFilter.motionModelCompassYaw(i,n),this.last_pos_time&&n-this.last_pos_time>500&&(this.position_count+=1,o=!0)}else if(!this.particleFilter.getPosInitFlag()&&this.using_gps&&t==="gps"){let a=this.getGpsPosition(i);o=a!==null,a?(this.particleFilter.initParticlesByPos(a.x,a.y,()=>!0),this.last_pos_time=n,console.log(`init Pos by gps success time ${n}`),this.cacheSensorData.length=0):console.log(`init Pos by gps fail time ${n}`)}else if(!this.particleFilter.getYawInitFlag()&&t==="compass"){let a=i;this.particleFilter.initParticlesByCompass(a),this.particleFilter.setLastCompassTime(n),console.log(`init yaw by compass success time ${n}`)}else this.cacheSensorData.push(e);return o&&(this.last_pos_time=n),[o,this.particleFilter.getResultX(),this.particleFilter.getResultY()]}setBeaconPosition(e,t){return this.last_beacon_time=t,this.particleFilter.getPosInitFlag()?this.particleFilter.update(e,this.sigmaBeacon):this.particleFilter.initParticlesByPos(e.x,e.y,()=>!0),this.resetParticleFilterDist(e),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.filter(i=>i.timestamp>t).map(i=>this.pfFusionPDRiBeacon(i)),this.cacheSensorData.length=0,[this.particleFilter.getResultX(),this.particleFilter.getResultY()]}getGpsPosition(e){return e[2]>this.gps_max_horizontalAccuracy?null:Ua(e[0],e[1])}resetParticleFilterDist(e){let t=this.particleFilter.getResultX(),n=this.particleFilter.getResultY();En(t,n,e.x,e.y)>this.MaxEstimateErr?(this.outTrustRegionNum+=1,this.outTrustRegionNum>=this.TrustNum&&(console.info(`\u8D85\u51FA\u53EF\u4FE1\u533A\u57DF\uFF0C\u91CD\u7F6E\u7C92\u5B50\u8FC7\u6EE4\u5668\u5230: ${e.x}, ${e.y}`),this.particleFilter.setPosInitFlag(!1),this.particleFilter.setYawInitFlag(!1),this.outTrustRegionNum=0)):this.outTrustRegionNum=0}};var cc=class extends rv{sensor;pdr;constructor(e={}){super(),this.sensor=new Xr(e.sensor),this.pdr=new vi}checkSensor(){return this.sensor.checkSensor()}start(){this.sensor.start(),this.sensor.addEventListener("add-data-item",({item:e})=>{this.getPositionBySensorItem(e)})}getPositionBySensorItem(e){let[t,n,i]=this.pdr.pfFusionPDRiBeacon(e);return t&&this.dispatchEvent({type:"position",x:n,y:i,_type:e.type==="gps"?"gps":"pdr"}),[t,n,i]}setBeaconPosition(e,t){let[n,i]=this.pdr.setBeaconPosition(e,t);this.dispatchEvent({type:"position",x:n,y:i,_type:"beacon"})}dispose(){this.sensor.stop()}};async function hc({brand:r,project:e},t){let{apiDomain:n,apiPath:{floorRange:i},apiInfo:o}=t,a=`${n}${i}?brand=${r}&project=${e}&phase=${e}&building=${e}`;return await fetch(a,o).then(l=>l.json()).then(l=>l.data).then(l=>{let s=(l||[])[0];return s&&(s.info=JSON.parse(s.info)),s})}async function pc({brand:r,project:e,floor:t,ts:n,resource_type_list:i},o){let{apiDomain:a,apiPath:{floorGraphic:c},apiInfo:l}=o,s=`${a}${c}?brand=${r}&project=${e}&phase=${e}&building=${e}&floor=${t}&ts=${n}&resource_type_list=${i}`;return await fetch(s,l).then(h=>h.json()).then(h=>h.data).then(h=>((h||[]).map(f=>f.info=JSON.parse(f.info)),h||[]))}async function E2({project:r,floor:e},t){let{apiDomain:n,apiInfo:i}=t,o=`${n}/api/inception-map/external_street/get?projectCode=${r}&floorCode=${e}`;return await fetch(o,i).then(c=>c.json()).then(c=>c.data).then(c=>JSON.parse(c[0].streetInfo||"{}")).then(c=>c.fileId?iv(c.fileId,t):null)}async function iv(r,e){let{apiDomain:t,apiInfo:n}=e;return fetch(`${t}/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 xe;function fc(r="aibee_map"){return new Promise((e,t)=>{if(xe)return e({db:xe,type:"success"});let n=indexedDB.open(r);n.onupgradeneeded=function(i){xe=i.target.result,console.log("onupgradeneeded"),e({db:xe,type:"onupgradeneeded"})},n.onsuccess=i=>{xe=i.target.result,e({db:xe,type:"success"})},n.onerror=i=>{t(i)}})}function dc(r,e,t=xe){return new Promise((n,i)=>{t||i("\u6CA1\u6709db");let a=t.transaction([r],"readonly").objectStore(r).get(e);a.onsuccess=()=>{a.result?n(a.result.value):n(null)},a.onerror=c=>{console.log("[getVersionByKey]",c),n(null)}})}function gc(r,e,t,n=xe){return new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((a,c)=>{let s=n.transaction([r],"readwrite").objectStore(r).add({key:e,value:t});s.onsuccess=function(u){a(u)},s.onerror=function(u){c(u)}})))}function _i(r,e=xe){e&&(e.objectStoreNames.contains(r)||e.createObjectStore(r,{keyPath:"key"}))}function mc(){xe?.close(),xe=null}var yc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAGQCAYAAAAUdV17AAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAABLKADAAQAAAABAAABkAAAAAAun0XIAAAtt0lEQVR4Ae2dB9glRZm2ZxyyMiTJA0oaQFlgCJKzxEVZlCgiCJhYWBXDyqLrirL/qqy4oLD4iyQRFARFUGFILiBhJC1Z0iBRsuQwMHs/w3eY84WTu7uqup66rvc753Soet+7up+vqrq7evw4p6gIzJw5c04cWhlbbcjey+cK2NzYXE2m7Z7B7semN9ldfL92/Pjxr/LpZAK1IjC+VtEkGgwitSKu74J9GFsTmwMbJL3AzpdhF2AXIl538ulkAiZgAv0RQKQmY4dhN2Blp+kU8G/Y4v15671MwASyJIBoTMHOxUKklyn0RGz1LOE7aBMwge4IIBJrYOdgsaSLcWT97rz3ViZgAlkQQBSWxc7C3sBiS6/j0A+xiVlUhoM0ARNoTQAh2AN7Gos9PYSDGvB3MgETyI0AJ/9E7JTYVWoM/37NsoVyqy/Hmw4B39ZQcF1xwm9AlqdhyxWcdVXZ6RaIHbgV4t6qCnQ5JtAtAQtWt6S62A6x2pHNzsTm6WLzmDd5HOd2QrSuitlJ+5YfgbflF3I5ESNWuvHzbCx1sRKgRbFLiGk3/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SBwAMeIXNXRR/IUyQEIACBUQSGHJDvG7WRnxCAAAQgUD6B+xyQp5VfLiVCAAIQgMAoAtM8hzxBG/8iWXjUTn5CAAIQgEA5BLwA08S36GZkr7Hw+XLKpBQIQAACEGhB4BjF4sc9ZTFGX76hj2+2yMQmCEAAAhAojoDXtDhBMfj7LmLEHRaavthd274qead3kiAAAQhAoDACN8nycQrG04dLGBGQhzcqML9D3zeSZFl+c1iNTwhAAAIQ6ExgePnNGxWI7+qclb0QgAAEINA3Av8fPece3M0Z0YQAAAAASUVORK5CYII=";var O2={loadRoadNetwork:!1},xi="version",hs="map_data",Ei="road_network_data",xc={half:yc,power:vc,mechanical:_c},Ec=class{constructor(e){this.bmap=e;this.initDb()}floors=[];async initDb(){try{let{db:e,type:t}=await fc();t==="onupgradeneeded"&&(_i(xi),_i(hs),_i(Ei))}catch(e){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",e)}}async load(e){if(this.clear(),Array.isArray(e))this.floors=e;else{let t=await fetch(e).then(n=>n.json());t.code==="0"&&(this.floors=t.data.list)}}setCacheData(e,t,n){return gc(e,`${t}`,n)}getCacheData(e,t){return dc(e,`${t}`)}getFloorCacheKey(e){return`${e.floor_id}`}async getFloorData(e){let t=this.floors.find(i=>i.floor===e);if(!t)return null;let n=this.getFloorCacheKey(t);try{if(await this.getCacheData(xi,n)===t.version_id){let o=await this.getCacheData(hs,n);if(o)return this.getDataByJson(o)}return this.getFloorDataByFloorInfo(t)}catch{return this.getFloorDataByFloorInfo(t)}}async getFloorDataByFloorInfo(e){let t=this.getFloorCacheKey(e);console.time("zstd_json");let n=await fetch(e.map_url).then(i=>i.json());return n.floor=e.floor,console.timeEnd("zstd_json"),this.setCacheData(hs,t,n),this.setCacheData(xi,t,e.version_id),this.getDataByJson(n)}async getRoadNetworkData(){return(await Promise.all(this.floors.map(async t=>{let n=this.getFloorCacheKey(t);try{if(await this.getCacheData(xi,n)===t.version_id){let a=await this.getCacheData(Ei,n);if(a)return a}let o=await fetch(t.route_url).then(a=>a.json());return this.setCacheData(Ei,n,o),o}catch{let i=await fetch(t.route_url).then(o=>o.json());return this.setCacheData(Ei,n,i),i}}))).filter(t=>t.points)}async getFacilitiesData(){if(this.floors[0]?.entry_infra_url)return fetch(this.floors[0].entry_infra_url).then(e=>e.json())}async getOtherDataByFreeTime(){}async getMulFloorsData(e){return Promise.all(e.map(t=>this.getFloorData(t))).then(t=>t.filter(n=>n))}async getDataByUrl(e){let t=await fetch(e).then(n=>n.json());return this.getDataByJson(t)}getDataByJson(e){let t=new Ce(this.bmap.context);t.userData.graphics=[],t.userData.graphicMap=new Map;let n=[0,0];return e.layers.forEach(i=>{switch(i.l_type){case"range":let o=i.elements[0];n=[o.center_x,o.center_y];break;case"graph":ee(i.elements,n);let a=[];i.elements.forEach(p=>{p.group==="ground"?t.createGround(p):a.push(p)});let c=a.reduce((p,m)=>{let{fillColor:v,fillOpacity:b,strokeColor:y,strokeOpacity:S,height:x}=m,_=`${v.toLowerCase()}-${b}-${y.toLowerCase()}-${S}-${x}`;return S===0&&(_=`${v.toLowerCase()}-${b}-${x}`),p[_]?p[_].push(m):p[_]=[m],p},{});Object.values(c).forEach(p=>{let m=new Pr(this.bmap.context,p);t.mergeGraphicLayer.add(m)});break;case"ground":ee(i.elements,n);let l=i.elements.map(p=>new Ft(this.bmap.context,p));t.addGrounds(l);break;case"wall":ee(i.elements,n);let s=i.elements.reduce((p,m)=>{let{fillColor:v,fillOpacity:b,strokeColor:y,strokeOpacity:S,height:x}=m,_=`${v.toLowerCase()}-${b}-${y.toLowerCase()}-${S}-${x}`;return S===0&&(_=`${v.toLowerCase()}-${b}-${x}`),p[_]?p[_].push(m):p[_]=[m],p},{});Object.values(s).forEach(p=>{let m=new Tr(this.bmap.context,p);t.wallLayer.add(m)});break;case"lane":ee(i.elements,n);let u=i.elements.reduce((p,m)=>{let{fillColor:v,fillOpacity:b,strokeColor:y,strokeOpacity:S}=m,x=`${v.toLowerCase()}-${b}-${y.toLowerCase()}-${S}`;return S===0&&(x=`${v.toLowerCase()}-${b}`),p[x]?p[x].push(m):p[x]=[m],p},{});Object.values(u).forEach(p=>{let m=new Ar(this.bmap.context,p);t.laneLayer.add(m)});break;case"texture2d":case"texture3d":if(ee(i.elements,n),i.elements.length){let p=new Wn(this.bmap.context,i.elements);t.textureLayer.add(p)}break;case"glb":ee(i.elements,n),i.elements.forEach(p=>{let m=Te([p.center_x,p.center_y],n),v=new Cr(this.bmap.context,{...p,url:p.secondUrl,rotate:p.secondRotate,width:p.secondWidth,center_x:m[0],center_y:m[1]});t.glbModelLayer.add(v)});break;case"store":ee(i.elements,n),i.elements.map(p=>{let m=Te([p.center_x,p.center_y],n),v=t.addGraphic(p);t.userData.graphics.push(v),t.userData.graphicMap.set(p.id,v);try{let b=new ne(this.bmap.context,{id:p.id,icon:p.poi_info.icon,text:p.poi_info.showName||p.store_name||p.poi_info.text,position:{x:m[0],y:m[1],z:p.airHeight+p.height},icon_size:[18,18]});t.poiLayer2.pushPoi(b),b&&(b.userData.type="store",b.userData.data=p)}catch(b){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",b,p)}});break;case"facility":ee(i.elements,n),i.elements.map(p=>{let m=Te([p.center_x,p.center_y],n),v=t.addGraphic(p);if(t.userData.graphics.push(v),t.userData.graphicMap.set(p.id,v),p.poi_info){let b=new ne(this.bmap.context,{id:p.id,icon:p.poi_info.icon,text:p.poi_info.showName||p.store_name||p.poi_info.text,position:{x:m[0],y:m[1],z:p.airHeight+p.height},icon_size:[18,18]});t.poiLayer2.pushPoi(b),b.userData.type="facility",b.userData.data=p}else console.log("\u6DFB\u52A0facility\u5931\u8D25\u6CA1\u6709poi_info",p)});break;case"parkingSpace":ee(i.elements,n);let h=[],f=new Map;i.elements.forEach(p=>{let m=t.addGraphic(p);h.push(m),f.set(p.id,m);let v=Te([p.center_x,p.center_y],n);if(p.texts[0]){let b=new ne(this.bmap.context,{id:p.id,text:p.texts[0],position:{x:v[0],y:v[1],z:p.airHeight+p.height}});b&&(b.userData.type="parkingSpace",b.userData.data=p),t.poiLayer2.pushPoi(b)}});let d=i.elements.filter(p=>xc[p.parkingType]).map(p=>{let m=Te([p.center_x,p.center_y],n),v=Ss(p.geometry.coords,m);return{uuid:p.id,iconUrl:xc[p.parkingType],name:p.texts[0],deltaHeight:p.deltaHeight,airHeight:p.airHeight,height:p.height,geometry:{...p.geometry,coords:v},opacity:p.fillOpacity,visible:!0}});if(d.length){let p=new Wn(this.bmap.context,d);t.textureLayer.add(p)}t.userData.parkingSpaces=h,t.userData.parkingSpacesGraphicMap=f;break;case"text":ee(i.elements,n);let g=new Ir(this.bmap.context,i.elements.map(p=>{let m=Te([p.center_x,p.center_y],n);return{...p,center_x:m[0],center_y:m[1]}}));t.textTextureLayer.add(g);break}}),t.userData.center=n,t.userData.height=e.floorHeight*10,t.name=e.floor,t.userData.data=e,t.updateBox(),t}clear(){}dispose(){this.clear(),mc()}};var bc=class{constructor(e){this.bmap=e}cacheData=new Map;floorDataLengthMap=new Map;buildingGroundMap=new Map;externalStreetMap=new Map;async load(e){let t=yn(e);if(this.cacheData.has(t))return this.cacheData.get(t);let[,n]=await Promise.all([this.loadBuildGround(e),pc(e,this.bmap.config)]),i=yn({floor:e.floor,ts:e.ts});ee(n.map(a=>a.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),n.forEach(a=>a.info.transformToBuildingGround=!1),this.cacheData.set(t,n);let o=this.floorDataLengthMap.get(i)||0;return this.floorDataLengthMap.set(i,o+n.length),this.loadExternalStreet(e),n}async loadExternalStreet(e){}switchFloorByData(e,t){if(!e.length)return;let n=t.userData.legacyToGraphicMap||new Map,i=t.userData.graphicMap||new Map,{ground:o,markGraphic:a,graphic:c}=this.bmap.config;for(let l=0;l<e.length;l++){let s=e[l];s.info.group==="ground"?(s.info.fillColor=o.color,s.info.fillOpacity=o.opacity,s.info.height=o.height,s.info.stroke=o.stroke,s.info.strokeColor=o.strokeColor,s.info.strokeOpacity=o.strokeOpacity):s.info.userData.mark?(s.info.height=a.height,s.info.fillColor=a.color,s.info.fillOpacity=a.opacity,s.info.stroke=a.stroke,s.info.strokeColor=a.strokeColor,s.info.strokeOpacity=a.strokeOpacity):(s.info.fillOpacity=c.fillOpacity,this.bmap.config.initTransToMark&&(s.info.height=a.height,s.info.fillColor=a.color,s.info.stroke=a.stroke,s.info.strokeColor=a.strokeColor,s.info.strokeOpacity=a.strokeOpacity))}for(let l of e){if(l.info.group==="ground")t.createGround(l.info);else{let s=t.addGraphic(l.info);s.userData.data=l,n.set(l.legacy_id,s)}i.set(l.element_uuid,l)}t.userData.legacyToGraphicMap=n,t.userData.graphicMap=i,t.updateBox(),t===this.bmap.context.currentFloor?(this.bmap.triggerHooks("switch_floor_before",{curFloor:t,graphics:t.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:t,graphics:t.graphicLayer.children})):this.bmap.switchFloorByFloor(t)}filterData(e,t){let n=t.userData.graphicMap||new Map;return e.filter(i=>!n.has(i.element_uuid))}async switchFloorByStoreData(e,t){let n=await this.load({...e,resource_type_list:"6"}),i=this.filterData(n,t);this.switchFloorByData(i,t)}async switchFloorByOtherData(e,t){let n=await this.load({...e,resource_type_list:"1,2,3,4"}),i=this.filterData(n,t);this.switchFloorByData(i,t)}async loadBuildGround({brand:e,project:t}){let n=await this.loadBuildingGround({brand:e,project:t});return this.bmap.currentBuildGround=n,this.bmap.changeBuildingCenter(n,{brand:e,project:t}),this.bmap.currentBuildGround}async loadBuildingGround({brand:e,project:t}){let n=yn({brand:e,project:t});if(this.buildingGroundMap.has(n))return this.buildingGroundMap.get(n);let i=hc({brand:e,project:t},this.bmap.config).then(o=>(this.buildingGroundMap.set(n,o),o));return this.buildingGroundMap.set(n,i),i}async switchFloor(e){let t=new Ce(this.bmap.context);t.name=e.floor;try{await Promise.all([this.switchFloorByStoreData(e,t),this.switchFloorByOtherData(e,t)])}catch(n){console.log(n)}return t}dispose(){this.cacheData.clear(),this.floorDataLengthMap.clear(),this.buildingGroundMap.clear()}};export{Ec as AibeeLoader,ba as BMap,La as BMapSelect,le as BaseSvg,Vr as Context,bc as CrLoader,Na as CrNavPath,Sa as Equipment,As as Events,Ce as Floor,Cr as GlbModel,Ft as Graphic,xr as GraphicLayer,Wn as GroundTexture,vr as HeatmapElement,Vn as HooksName,Lr as HoverHelper,Ar as Lane,Ht as Layer,kf as MapTypePolar,Pr as MergeGraphic,_r as Model,Ia as MulFloors,Ra as NavPath,Da as Navigation,yr as Overlay,Bs as PathDirection,cc as PdrPosition,rn as Poi,ne as Poi2,_n as PoiLayer,Er as PoiLayer2,ta as RoadNetwork,ea as RoadNetwork2,ca as SelectBox,Nr as Selection,Xr as Sensor,mr as Shadow,Mr as SvgLine,wr as SvgPolygon,Ir as TextTexture,Gt as Timer,vn as TweenUtil,Cs as UA,Tr as Wall,wv as addAlphaToHexColor,bs as calc_angle,wi as calc_direction,na as convertToSnakeCase,Gn as createCircle,pr as createLine,Ve as createRect,ws as createSvg,hr as createSvgElement,u_ as createThreeBox,a_ as createThreeLine,Le as darkenColor,O2 as defaultAibeeLoaderOption,Uf as defaultConfig,Di as defaultGraphicOptions,Gp as defaultOptions,yf as defaultTextTextureOptions,Jt as dispose,Us as distancePointToSegment,yn as generatorKeyByObj,yh as getAngle,cr as getCenter,Ea as getConfig,kv as getDirectPath,zs as getDistanceByPathPos,kt as getLength,yv as getLongestSideDir,Ss as getMinEdgeSquare,Se as getPathLength,fn as getPointEdgeIndex,fr as getPosByPathDistance,Es as hasChinese,Si as hexToRgb,xs as initDirectionalLight,_s as initLight,be as initShape,Cv as isAndroid,ke as isContain,mn as isControl,kn as isIphone,gn as isMac,Ms as isPointInPolygon,hc as loadBuildingGround,E2 as loadExternalStreet,pc as loadGraphics,Gv as moveOnRoute,dn as proxyOptions,_h as removeWeightPath,en as setCirclePosition,ge as setLineStartEnd,Xt as setRectPosition,Fs as simplifyPath,Ts as sleepOnePromise,bv as sleepOneRf,Os as smoothPath,Mv as strToNumber,tn as timeoutPromise,r_ as toWebWorker,ee as transformGraphicData,Te as translatePosToCenter,we as triggerWorker,et as vector3ToDevice,Lv as xhrGet};
7517
7517
  /*! Bundled license information:
7518
7518
 
7519
7519
  complex.js/complex.js: