@aibee/crc-bmap 0.0.134 → 0.0.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bmap.cjs.min.js +27 -18
- package/lib/bmap.cjs.min.js.map +3 -3
- package/lib/bmap.esm.js +67 -27
- package/lib/bmap.esm.js.map +3 -3
- package/lib/bmap.esm.min.js +27 -18
- package/lib/bmap.esm.min.js.map +3 -3
- package/lib/bmap.min.js +27 -18
- package/lib/bmap.min.js.map +3 -3
- package/lib/src/elements/glb-model.d.ts +1 -0
- package/lib/src/elements/wall.d.ts +3 -0
- package/package.json +1 -1
package/lib/bmap.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var Ei=Object.create;var Ge=Object.defineProperty;var bi=Object.getOwnPropertyDescriptor;var Mi=Object.getOwnPropertyNames;var Si=Object.getPrototypeOf,wi=Object.prototype.hasOwnProperty;var y=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var dt=(o,n)=>()=>(n||o((n={exports:{}}).exports,n),n.exports);var Ti=(o,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Mi(n))!wi.call(o,i)&&i!==t&&Ge(o,i,{get:()=>n[i],enumerable:!(e=bi(n,i))||e.enumerable});return o};var Se=(o,n,t)=>(t=o!=null?Ei(Si(o)):{},Ti(n||!o||!o.__esModule?Ge(t,"default",{value:o,enumerable:!0}):t,o));var an=dt((Lr,sn)=>{sn.exports=function(n,t){return n[0]=t[0],n[1]=t[1],n}});var hn=dt((Ar,un)=>{var ln=an();un.exports=function(o,n){Array.isArray(n)||(n=[]),o.length>0&&n.push(ln([0,0],o[0]));for(var t=0;t<o.length-1;t++){var e=o[t],i=o[t+1],r=e[0],s=e[1],a=i[0],u=i[1],l=[.75*r+.25*a,.75*s+.25*u],h=[.25*r+.75*a,.25*s+.75*u];n.push(l),n.push(h)}return o.length>1&&n.push(ln([0,0],o[o.length-1])),n}});var yn=dt((Dr,mn)=>{var Pe=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((n,t)=>n.priority-t.priority)}set(n,t){let e=Number(t);if(isNaN(e))throw new TypeError('"priority" must be a number');return this.keys.has(n)?this.queue.map(i=>(i.key===n&&Object.assign(i,{priority:e}),i)):(this.keys.add(n),this.queue.push({key:n,priority:e})),this.sort(),this.queue.length}next(){let n=this.queue.shift();return this.keys.delete(n.key),n}isEmpty(){return this.queue.length===0}has(n){return this.keys.has(n)}get(n){return this.queue.find(t=>t.key===n)}};mn.exports=Pe});var xn=dt((Or,vn)=>{function _n(o,n){let t=new Map;for(let[e,i]of o)e!==n&&i instanceof Map?t.set(e,_n(i,n)):e!==n&&t.set(e,i);return t}vn.exports=_n});var Mn=dt((Fr,bn)=>{function Ui(o){let n=Number(o);return!(isNaN(n)||n<=0)}function En(o){let n=new Map;return Object.keys(o).forEach(e=>{let i=o[e];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return n.set(e,En(i));if(!Ui(i))throw new Error(`Could not add node at key "${e}", make sure it's a valid node`,i);return n.set(e,Number(i))}),n}bn.exports=En});var Tn=dt((Ur,wn)=>{function Sn(o){if(!(o instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof o}`);o.forEach((n,t)=>{if(typeof n=="object"&&n instanceof Map){Sn(n);return}if(typeof n!="number"||n<=0)throw new Error(`Values must be numbers greater than 0. Found value ${n} at ${t}`)})}wn.exports=Sn});var Ae=dt((Br,Ln)=>{var Bi=yn(),Gi=xn(),Cn=Mn(),Pn=Tn(),Le=class{constructor(n){n instanceof Map?(Pn(n),this.graph=n):n?this.graph=Cn(n):this.graph=new Map}addNode(n,t){let e;return t instanceof Map?(Pn(t),e=t):e=Cn(t),this.graph.set(n,e),this}addVertex(n,t){return this.addNode(n,t)}removeNode(n){return this.graph=Gi(this.graph,n),this}path(n,t,e={}){if(!this.graph.size)return e.cost?{path:null,cost:0}:null;let i=new Set,r=new Bi,s=new Map,a=[],u=0,l=[];if(e.avoid&&(l=[].concat(e.avoid)),l.includes(n))throw new Error(`Starting node (${n}) cannot be avoided`);if(l.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(r.set(n,0);!r.isEmpty();){let h=r.next();if(h.key===t){u=h.priority;let f=h.key;for(;s.has(f);)a.push(f),f=s.get(f);break}i.add(h.key),(this.graph.get(h.key)||new Map).forEach((f,m)=>{if(i.has(m)||l.includes(m))return null;if(!r.has(m))return s.set(m,h.key),r.set(m,h.priority+f);let c=r.get(m).priority,d=h.priority+f;return d<c?(s.set(m,h.key),r.set(m,d)):null})}return a.length?(e.trim?a.shift():a=a.concat([n]),e.reverse||(a=a.reverse()),e.cost?{path:a,cost:u}:a):e.cost?{path:null,cost:0}:null}shortestPath(...n){return this.path(...n)}};Ln.exports=Le});var ve=y("three");var W=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(n){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),n()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(n){this.tasks.requestAnimation.delete(n),window.cancelAnimationFrame(n)}setTimeout(n,t){let e=window.setTimeout(()=>{this.tasks.timeout.delete(e),n()},t);return this.tasks.timeout.add(e),e}clearTimeout(n){this.tasks.timeout.delete(n),window.clearTimeout(n)}setInterval(n,t){let e=window.setInterval(()=>{this.tasks.interval.delete(e),n()},t);return this.tasks.interval.add(e),e}clearInterval(n){this.tasks.interval.delete(n),window.clearInterval(n)}dispose(){this.tasks.requestAnimation.forEach(n=>{window.cancelAnimationFrame(n)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(n=>{window.clearTimeout(n)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(n=>{window.clearInterval(n)}),this.tasks.interval.clear()}};var T=y("three"),ze=y("three/examples/jsm/controls/MapControls");function ke(){let o=new T.Scene;return o.background=new T.Color(16777215),o}function Ve(){let o=new T.WebGLRenderer({antialias:!0});return o.autoClear=!0,o.setClearAlpha(1),o.setClearColor(16777215),o.setPixelRatio(window.devicePixelRatio),o.shadowMap.enabled=!0,o.shadowMap.autoUpdate=!0,o.shadowMap.type=T.PCFSoftShadowMap,o}function He(o,n){let t=new T.OrthographicCamera(-o/2,o/2,n/2,-n/2,-1e3,5e3);return t.up.set(0,0,1),t.position.set(0,0,100),t.lookAt(0,0,0),t}function We(){let o=new T.Group,n=new T.AmbientLight(16777215,2.6);return o.add(n),o}function Xe(o,n){let t=new ze.MapControls(o,n);return t.enableDamping=!1,t.zoomSpeed=2,t}function nt(o,n=[]){let t=new T.Shape(o.map(e=>new T.Vector2(...e)));return n.length&&n.forEach(e=>{var i=new T.Path(e.map(r=>new T.Vector2(...r)));t.holes.push(i)}),t}function qe(o=16777215,n=1){let t=new T.DirectionalLight(o,n);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 Z(o,n){if(n&&o.children&&o.children.length&&o.children.forEach(t=>{Z(t,n)}),o.isMesh){let t=o;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(e=>{e.dispose()}):t.material.dispose())}o.isLight&&o.dispose?.()}function je(o){return/[\u4E00-\u9FA5]+/g.test(o)}var X=y("three"),bt=new Map,Rt=new Map,Ci=new X.TextureLoader;function Pi(){let o=document.createElement("canvas");o.width=1024,o.height=64;let n=o.getContext("2d",{willReadFrequently:!0});return n.font="54px sans-serif",n.textBaseline="hanging",n.lineWidth=12,n.fillStyle="rgba(0,0,0,1)",n.strokeStyle="white",{canvas:o,ctx:n}}var we,gt;function Li(){if(!we){let{canvas:o,ctx:n}=Pi();we=o,gt=n}}function Ye(o){if(Rt.has(o))return Rt.get(o);Li(),gt.clearRect(0,0,1024,64);let n=je(o)?4:8;gt.strokeText(o,2,n),gt.fillText(o,2,n);let t=Math.ceil(gt.measureText(o).width);t=t%2===0?t:t+1,t+=2;let e=gt.getImageData(0,0,t,64),i=new X.DataTexture(Uint8Array.from(e.data),t,64,X.RGBAFormat);return i.flipY=!0,i.minFilter=X.LinearFilter,i.magFilter=X.LinearFilter,Rt.set(o,i),i}function $e(){Rt.forEach((o,n)=>{o.dispose()}),bt.forEach(o=>{o instanceof Promise?o.then(n=>n.dispose()):o.dispose()}),Rt.clear(),bt.clear()}function Ze(){gt=null,we=null}async function Ke(o){if(bt.has(o))return bt.get(o);let n=Ci.loadAsync(o);return n.then(t=>{t.format=X.RGBAFormat,t.magFilter=X.LinearFilter,t.minFilter=X.LinearFilter,t.colorSpace="srgb",bt.set(o,t)}),bt.set(o,n),n}var L=y("three"),Mt=y("@turf/turf");function E(o,n,t,e){let i=o.clone().project(n),r=t/2,s=e/2,a=Math.round(i.x*r+r),u=Math.round(-i.y*s+s);return{x:a,y:u}}function Bt(o){let n=(0,Mt.featureCollection)(o.map(e=>(0,Mt.point)(e)));return(0,Mt.center)(n).geometry.coordinates}function Gt(o,n,t){return o.x>=n.x&&o.x<=t.x&&o.y>=n.y&&o.y<=t.y}function lr(o){let n=0,t=new L.Vector3;for(let e=1;e<o.length;e++){let i=new L.Vector3(o[e-1][0],o[e-1][1],0),r=new L.Vector3(o[e][0],o[e][1],0),s=r.distanceTo(i);s>n&&(n=s,t=r.clone().sub(i).normalize())}return t}function R(o,n){return Math.sqrt((n[0]-o[0])**2+(n[1]-o[1])**2)}function ht(o){let n=0;for(let t=0;t<o.length-1;t++)n+=R(o[t],o[t+1]);return n}function zt(o,n,t){let e=new L.Vector2(n[0]-o[0],n[1]-o[1]),i=new L.Vector2(n[0]-t[0],n[1]-t[1]),s=e.angleTo(i)*180/Math.PI,a=new L.Vector2(n[0]-o[0],n[1]-o[1]);return new L.Vector2(t[0]-o[0],t[1]-o[1]).cross(a)>0?s:-s}function Je(o,n){let t=Math.min(R(o[0][0],o[0][1]),R(o[0][2],o[0][1]))-1;n||(n=Bt(o[0]));let e=Ai(n,t),i=new L.Vector2(o[0][0][0],o[0][0][1]),r=new L.Vector2(o[0][1][0],o[0][1][1]),s=new L.Vector2(o[0][2][0],o[0][2][1]),u=(i.distanceTo(r)>r.distanceTo(s)?r.clone().sub(i):s.clone().sub(r)).angleTo(new L.Vector2(0,1)),l=new L.Matrix3;return l.multiply(new L.Matrix3().translate(n[0],n[1])).multiply(new L.Matrix3().rotate(u)).multiply(new L.Matrix3().translate(-n[0],-n[1])),[e.map(h=>{let p=new L.Vector2(h[0],h[1]).applyMatrix3(l);return[p.x,p.y]})]}function Ai(o,n){let t=n/2;return[[o[0]-t,o[1]+t],[o[0]+t,o[1]+t],[o[0]+t,o[1]-t],[o[0]-t,o[1]-t],[o[0]-t,o[1]+t]]}function Qe(o,n,t){let[e,i]=o,[r,s]=n,[a,u]=t,l=(r-e)*(u-i)-(s-i)*(a-e);if(console.log("crossProduct",o,n,t,l),Math.abs(l)!==0)return!1;let h=Math.min(e,r)<=a&&a<=Math.max(e,r),p=Math.min(i,s)<=u&&u<=Math.max(i,s);return h&&p}function St(o,n){return new Proxy(o,{get:(t,e,i)=>Reflect.get(t,e,i),set:(t,e,i,r)=>{let s=Reflect.get(t,e,r),a=Reflect.set(t,e,i,r);return s!==i&&n.dispatchEvent({type:`change-${e}`,value:i}),a}})}function mt(o,n){return Promise.race([o,new Promise((t,e)=>{setTimeout(()=>e(new Error("Promise timeout")),n)})])}function kt(o){return document.createElementNS("http://www.w3.org/2000/svg",o)}function tn(o,n){let t=kt("svg");return t.setAttribute("width",o),t.setAttribute("height",n),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function It(o="2",n){let t=kt("circle");return t.setAttribute("r",o),t.setAttribute("fill",n),t}function Vt(o){let n=kt("line");return n.setAttribute("stroke",o),n}function wt(o,n){let t=kt("rect");return t.setAttribute("stroke",o),t.setAttribute("fill",n),t}function yt(o,n,t){o.setAttribute("cx",`${n}`),o.setAttribute("cy",`${t}`)}function K(o,n,t){n&&(o.setAttribute("x1",`${n.x}`),o.setAttribute("y1",`${n.y}`)),t&&(o.setAttribute("x2",`${t.x}`),o.setAttribute("y2",`${t.y}`))}function J(o,n,t,e,i){o.setAttribute("x",`${n}`),o.setAttribute("y",`${t}`),o.setAttribute("width",`${e}`),o.setAttribute("height",`${i}`)}function en(){return Promise.resolve()}function fr(){return new Promise(o=>{requestAnimationFrame(o)})}function gr(o){return parseInt(o.replace("#","0x"),16)}function mr(o,n){let t=parseInt(o.substring(1,3),16),e=parseInt(o.substring(3,5),16),i=parseInt(o.substring(5,7),16),r=Math.round(t*n),s=Math.round(e*n),a=Math.round(i*n);return`#${(1<<24|r<<16|s<<8|a).toString(16).slice(1)}`}function ct(o,n=.85){let t,e,i;if(o.startsWith("#"))t=parseInt(o.substring(1,3),16),e=parseInt(o.substring(3,5),16),i=parseInt(o.substring(5,7),16);else{let s=o.slice(4,-1).split(",");t=parseInt(s[0].trim()),e=parseInt(s[1].trim()),i=parseInt(s[2].trim())}return t=Math.min(Math.floor(t*n),255),e=Math.min(Math.floor(e*n),255),i=Math.min(Math.floor(i*n),255),"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)}var nn=y("three/examples/jsm/loaders/GLTFLoader");function Ri(){return new nn.GLTFLoader}var Ht=null,Wt=new Map;function Xt(o){if(Wt.has(o)){let t=Wt.get(o).then(e=>(e.scene=e.scene.clone(),e))}Ht||(Ht=Ri());let n=new Promise((t,e)=>{Ht.load(o,i=>{t(i)},void 0,e)});return Wt.set(o,n),n.then(t=>(t.scene=t.scene.clone(),t))}function rn(){Ht=null,Wt.clear()}var qt=navigator.userAgent.toUpperCase().indexOf("MAC")>=0;function Te(o){return qt?o==="Meta":o==="Control"}var Ce="__once__",on=class{events=new Map;on(n,t){if(typeof t!="function")return;let e=this.events.get(n);return e?e.add(t):this.events.set(n,new Set([t]))}once(n,t){if(typeof t!="function")return;let e=`${Ce}${n}`,i=this.events.get(e);return i?i.add(t):this.events.set(e,new Set([t]))}off(n,t){let e=this.events.get(n),i=this.events.get(`${Ce}${n}`);!e&&!i||(t===void 0&&(e?.clear(),i?.clear()),e?.has(t)&&e.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(n,...t){let e=this.events.get(n),i=this.events.get(`${Ce}${n}`);!e&&!i||(e?.forEach(r=>{typeof r=="function"&&r(...t)}),i?.forEach(r=>{typeof r=="function"&&r(...t)}),i?.clear())}};var Nt=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(Nt||{});function Q(o){return Object.keys(o).sort().map(n=>`${n}=${o[n]}`).join("&")}function Tr(o,n){return new Promise((t,e)=>{let i=new XMLHttpRequest;i.open("GET",o,!0),Object.keys(n.headers||{}).forEach(r=>{i.setRequestHeader(r,n.headers[r])}),n.responseType&&(i.responseType=n.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(n.responseType==="arraybuffer")t(i.response);else try{let r=JSON.parse(i.responseText);t(r)}catch(r){e(r)}else e(i.statusText)},i.onerror=()=>{e(i.statusText)},i.send()})}var Tt=class o{keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}genUniqueKey(){let n=o.createKey();for(;this.keySet.has(n);)n=o.createKey();return n}removeKey(n){this.keySet.delete(n)}dispose(){this.keySet.clear()}};var Ct=y("three"),cn=Se(hn(),1);function Ii(o,n){let t=o.clone().normalize(),e=n.clone().normalize();return Math.acos(t.dot(e))}function Ni(o){let n=0;return o.reduce(([t,e],[i,r])=>(n+=Math.sqrt((i-t)**2+(r-e)**2),[i,r])),n/o.length}function pn(o,n=.25){if(Ni(o)<n)return o;let t=(0,cn.default)(o);return pn(t,n)}function fn(o,n=!1,t=!0,e=5,i=150,r=3){let s=[],a=!n;if(s.push(o[0]),o.length<2)return s;for(let l=0;l<o.length-2;l+=1){let h=o[l],p=o[l+1],f=o[l+2],m=new Ct.Vector2(h[0]-p[0],h[1]-p[1]),c=new Ct.Vector2(f[0]-p[0],f[1]-p[1]),d=Ii(m,c)/Math.PI*180,g=m.length()+c.length();(!a||d<i&&g>.01||g>e)&&(s.push(o[l+1]),a=!0)}if(s.push(o[o.length-1]),!t)return s;let u=[];u.push(s[0]);for(let l=0;l<s.length-2;l+=1){let h=new Ct.Vector2(s[l][0],s[l][1]),p=new Ct.Vector2(s[l+1][0],s[l+1][1]),f=new Ct.Vector2(s[l+2][0],s[l+2][1]),m=h.distanceTo(p)/2,c=f.distanceTo(p)/2,d=p.clone(),g=p.clone();d.add(h.clone().sub(p).normalize().multiplyScalar(m>r?r/2:m)),g.add(f.clone().sub(p).normalize().multiplyScalar(c>r?r/2:c));let v=[[d.x,d.y],[p.x,p.y],[g.x,g.y]];u.push(...pn(v,r/25))}return u.push(s[s.length-1]),Di(u)}function Di(o){if(o.length<=1)return o;let n=[],t;return o.forEach(([e,i])=>{t?e===t[0]&&i===t[1]||(t=[e,i],n.push([e,i])):(t=[e,i],n.push([e,i]))}),n}function dn(o,n,t){let e=Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2);if(e===0)return{distance:Math.sqrt((o[0]-n[0])**2+(o[1]-n[1])**2),closestPoint:n.slice(0)};let i=Math.max(0,Math.min(1,((o[0]-n[0])*(t[0]-n[0])+(o[1]-n[1])*(t[1]-n[1]))/e**2)),r=[n[0]+i*(t[0]-n[0]),n[1]+i*(t[1]-n[1])];return{distance:Math.sqrt((o[0]-r[0])**2+(o[1]-r[1])**2),closestPoint:r}}function gn(o,n,t){let[e,i]=o,[r,s]=n,a=Math.sqrt(Math.pow(r-e,2)+Math.pow(s-i,2));if(a===0||a<t)return[...n];let u=t/a,l=e+(r-e)*u,h=i+(s-i)*u;return[l,h]}var Oi=(l=>(l.START="start",l.END="end",l.FRONT="front",l.RIGHT="right",l.LEFT="left",l.RIGHT_FRONT="right_front",l.LEFT_FRONT="left_front",l.RIGHT_BACK="right_back",l.LEFT_BACK="left_back",l))(Oi||{});function Fi(o,n,t){let e=zt(o,n,t);return 180-Math.abs(e)<15?"front":e>135?"right_front":e<-135?"left_front":e<=135&&e>=60?"right":e>=-135&&e<=-60?"left":e<60&&e>0?"right_back":e>-60&&e<0?"left_back":"front"}function Ir(o){let n=[{direction:"start",distance:R(o[0],o[1]),points:[o[0],o[1]]}];for(let t=2;t<o.length;t++){let e=Fi(o[t-2],o[t-1],o[t]);if(e==="front"){let i=n[n.length-1],r=R(o[t-1],o[t]);i.distance+=r,t!==2&&i.points.push(o[t-1])}else n.push({direction:e,distance:R(o[t-1],o[t]),points:[o[t-1],o[t]]})}return n.push({direction:"end",distance:0,points:[o[o.length-1]]}),n}var it=Se(Ae(),1);var q="___",An=class{constructor(n=3){this.lift_priority=n}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new it.default;escalatorRoute=new it.default;straightLadderRoute=new it.default;initRoute(n){this.clear(),this.roadInfo=n,n.length&&(n.forEach(t=>{t.points.forEach(e=>{let i=`${t.floor}${q}${e.id}`;if(this.pointMap.set(i,e),this.nodeMap.set(`${e.floor}${q}${e.nodeId}`,i),e.type==="straightLadder"){let r=this.straightLadderMap.get(e.name)||[];r.push({...e}),this.straightLadderMap.set(e.name,r)}if(e.type==="staircase"){let r=this.staircaseMap.get(e.name)||[];r.push({...e}),this.staircaseMap.set(e.name,r)}if(e.type==="escalator"){let r=this.escalatorMap.get(e.name)||{};e.escalatorDirection==="exit"?r.end={floor:e.floor,id:e.id}:r.start={floor:e.floor,id:e.id},this.escalatorMap.set(e.name,r)}if(e.type==="facility"){let r=this.facilityMap.get(e.targetId)||[];r.push({...e}),this.facilityMap.set(e.targetId,r)}}),t.lines.filter(e=>e.direction!=="no").forEach(e=>{let i=`${t.floor}${q}${e.from}`,r=`${t.floor}${q}${e.to}`,s=this.pointMap.get(i)?.cds,a=this.pointMap.get(r)?.cds;if(s?.length&&a?.length){let u=R(s,a);this.addLineItem(i,r,u),e.direction==="double"&&this.addLineItem(r,i,u)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(n,t,e,i=this.lineMap){let r=i.get(n)||new Map;r.set(t,e),i.set(n,r)}addFacilityToLineMap(n,t,e,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([r,s])=>{if(!(s.length<2))for(let a=0;a<s.length;a++){let u=`${s[a].floor}${q}${s[a].id}`;for(let l=0;l<s.length;l++)if(a!==l){let h=`${s[l].floor}${q}${s[l].id}`,p=this.pointMap.get(u)?.cds,f=this.pointMap.get(h)?.cds;if(p?.length&&f?.length)if(s[a].type==="straightLadder"){let m=t;this.addLineItem(u,h,m,i)}else{let m=e;this.addLineItem(u,h,m,i)}}}}),this.escalatorMap.forEach((r,s)=>{if(r.start&&r.end){let a=`${r.start.floor}${q}${r.start.id}`,u=`${r.end.floor}${q}${r.end.id}`,l=this.pointMap.get(a)?.cds,h=this.pointMap.get(u)?.cds;if(l?.length&&h?.length){let p=n;this.addLineItem(a,u,p,i)}}})}initBaseRoute(){let n=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,n),this.baseRoute=new it.default(n)}initEscalatorRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,n),this.escalatorRoute=new it.default(n)}initStraightLadderRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,n),this.straightLadderRoute=new it.default(n)}checkStart(n){return!(!n.floor||!n.nodeId&&(!n.coord||n.coord.length<2))}checkEnd(n){return n.facility?!0:this.checkStart(n)}transformStart(n){if(n.nodeId){let t=this.nodeMap.get(`${n.floor}${q}${n.nodeId}`);if(t){let[e,i]=t.split(q);return{floor:e,id:i}}}if(n.coord?.length){let t=this.roadInfo.find(i=>i.floor===n.floor);if(!t)return null;let e=t.points.reduce((i,r)=>{let s=R(n.coord,r.cds);return s<i.min&&(i.min=s,i.point=r),i},{min:1/0,point:t.points[0]});return{floor:e.point.floor,id:e.point.id}}return null}transformEnd(n){if(n.floor){let t=this.transformStart(n);if(t)return t}return n.facility&&this.facilityMap.get(n.facility)?.length?{floor:n.floor,facility:n.facility}:null}getPath(n,t,e=""){if(!this.checkStart(n))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(n);if(!i)return"no-start";let r=this.transformEnd(t);if(!r)return"no-end";let s=this.getBasePath.bind(this);switch(e){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(console.log(i,r),r.id)return s(i,r);if(r.facility){let a=this.facilityMap.get(r.facility).filter(l=>r.floor?l.floor===r.floor:!0);if(!a.length)return null;let u=a.map(l=>s(i,{floor:l.floor,id:l.id})).filter(l=>!!l);return u.reduce((l,h)=>{let p=h.reduce((f,m)=>f+ht(m.points),0);return p<l.distance&&(l.distance=p,l.path=h),l},{distance:1/0,path:u[0]}).path}}getRoutePath(n,t,e){let i=`${n.floor}${q}${n.id}`,r=`${t.floor}${q}${t.id}`,s=e.path(i,r);if(console.log(i,r,s),!s)return null;let a=[];return s.map(u=>{let l=this.pointMap.get(u);if(l){let{floor:h}=l;if(a[a.length-1]?.floor===h){let p=a[a.length-1];p.points.push(l.cds),p.endType=l.type,p.destId=l.nodeId}else a.push({floor:h,points:[l.cds],endType:l.type,destId:l.nodeId})}}),a}getBasePath(n,t){return this.getRoutePath(n,t,this.baseRoute)}getEscalatorPath(n,t){return this.getRoutePath(n,t,this.escalatorRoute)}getStraightLadderPath(n,t){return this.getRoutePath(n,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 it.default,this.escalatorRoute=new it.default,this.straightLadderRoute=new it.default}};var j=Se(Ae(),1);var z="___",Rn=class{constructor(n=3){this.lift_priority=n}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new j.default;escalatorRoute=new j.default;straightLadderRoute=new j.default;forwardLineMap=new Map;forwardRoute=new j.default;initRoute(n){this.clear(),this.roadInfo=n,n.length&&(n.forEach(t=>{t.points.forEach(e=>{let i=`${t.floor}${z}${e.id}`;if(this.pointMap.set(i,e),this.nodeMap.set(`${e.floor}${z}${e.nodeId}`,i),e.type==="straightLadder"){let r=this.straightLadderMap.get(e.name)||[];r.push({...e}),this.straightLadderMap.set(e.name,r)}if(e.type==="staircase"){let r=this.staircaseMap.get(e.name)||[];r.push({...e}),this.staircaseMap.set(e.name,r)}if(e.type==="escalator"){let r=this.escalatorMap.get(e.name)||{};e.escalatorDirection==="exit"?r.end={floor:e.floor,id:e.id}:r.start={floor:e.floor,id:e.id},this.escalatorMap.set(e.name,r)}if(e.type==="facility"){let r=this.facilityMap.get(e.targetId)||[];r.push({...e}),this.facilityMap.set(e.targetId,r)}e.type==="parkingSpace"&&this.parkingMap.set(`${e.floor}${z}${e.name}`,e)}),t.lines.filter(e=>e.direction!=="no").forEach(e=>{let i=`${t.floor}${z}${e.from}`,r=`${t.floor}${z}${e.to}`,s=this.pointMap.get(i)?.cds,a=this.pointMap.get(r)?.cds;if(s?.length&&a?.length){let u=R(s,a);switch(this.addLineItem(i,r,u),this.addLineItem(r,i,u),e.direction){case"double":this.addLineItem(i,r,u,this.forwardLineMap),this.addLineItem(r,i,u,this.forwardLineMap);break;case"single":this.addLineItem(i,r,u,this.forwardLineMap);break;case"back":this.addLineItem(r,i,u,this.forwardLineMap);break}}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}addLineItem(n,t,e,i=this.lineMap){let r=i.get(n)||new Map;r.set(t,e),i.set(n,r)}addFacilityToLineMap(n,t,e,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([r,s])=>{if(!(s.length<2))for(let a=0;a<s.length;a++){let u=`${s[a].floor}${z}${s[a].id}`;for(let l=0;l<s.length;l++)if(a!==l){let h=`${s[l].floor}${z}${s[l].id}`,p=this.pointMap.get(u)?.cds,f=this.pointMap.get(h)?.cds;if(p?.length&&f?.length)if(s[a].type==="straightLadder"){let m=t;this.addLineItem(u,h,m,i)}else{let m=e;this.addLineItem(u,h,m,i)}}}}),this.escalatorMap.forEach((r,s)=>{if(r.start&&r.end){let a=`${r.start.floor}${z}${r.start.id}`,u=`${r.end.floor}${z}${r.end.id}`,l=this.pointMap.get(a)?.cds,h=this.pointMap.get(u)?.cds;if(l?.length&&h?.length){let p=n;this.addLineItem(a,u,p,i)}}})}initBaseRoute(){let n=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,n),this.baseRoute=new j.default(n)}initEscalatorRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,n),this.escalatorRoute=new j.default(n)}initStraightLadderRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,n),this.straightLadderRoute=new j.default(n)}initForwardRoute(){this.forwardRoute=new j.default(this.forwardLineMap)}checkStart(n){return!(!n.floor||!n.nodeId&&(!n.coord||n.coord.length<2))}checkEnd(n){return n.facility||n.parkingSpace&&n.floor?!0:this.checkStart(n)}transformStart(n){if(n.nodeId){let t=this.nodeMap.get(`${n.floor}${z}${n.nodeId}`);if(t){let[e,i]=t.split(z);return{floor:e,id:i}}}if(n.coord?.length){let t=this.roadInfo.find(i=>i.floor===n.floor);if(!t)return null;let e=t.points.reduce((i,r)=>{let s=R(n.coord,r.cds);return s<i.min&&(i.min=s,i.point=r),i},{min:1/0,point:t.points[0]});return{floor:e.point.floor,id:e.point.id}}return null}transformEnd(n){if(n.floor){if(n.parkingSpace){let e=this.parkingMap.get(`${n.floor}${z}${n.parkingSpace}`);if(e)return{floor:e.floor,id:e.id}}let t=this.transformStart(n);if(t)return t}return n.facility&&this.facilityMap.get(n.facility)?.length?{floor:n.floor,facility:n.facility}:null}getPath(n,t,e=""){if(!this.checkStart(n))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(n);if(!i)return"no-start";let r=this.transformEnd(t);if(!r)return"no-end";let s=this.getBasePath.bind(this);switch(e){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;case"forward":s=this.getForwardPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(r.id)return s(i,r);if(r.facility){let a=this.facilityMap.get(r.facility).filter(l=>r.floor?l.floor===r.floor:!0);if(!a.length)return null;let u=a.map(l=>s(i,{floor:l.floor,id:l.id})).filter(l=>!!l);return u.reduce((l,h)=>{let p=h.reduce((f,m)=>f+ht(m.points),0);return p<l.distance&&(l.distance=p,l.path=h),l},{distance:1/0,path:u[0]}).path}}getRoutePath(n,t,e){let i=`${n.floor}${z}${n.id}`,r=`${t.floor}${z}${t.id}`,s=e.path(i,r);if(!s)return null;let a=[];return s.map(u=>{let l=this.pointMap.get(u);if(l){let{floor:h}=l;if(a[a.length-1]?.floor===h){let p=a[a.length-1];p.points.push(l.cds),p.endType=l.type,p.destId=l.nodeId,p.distance=ht(p.points)}else a.push({floor:h,points:[l.cds],endType:l.type,destId:l.nodeId,distance:0})}}),a}getBasePath(n,t){return this.getRoutePath(n,t,this.baseRoute)}getEscalatorPath(n,t){return this.getRoutePath(n,t,this.escalatorRoute)}getStraightLadderPath(n,t){return this.getRoutePath(n,t,this.straightLadderRoute)}getForwardPath(n,t){return this.getRoutePath(n,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 j.default,this.escalatorRoute=new j.default,this.straightLadderRoute=new j.default}};function In(o){return o.replace(/[A-Z]/g,n=>"_"+n.toLowerCase()).replace(/^_/,"")}var Nn=new Tt;function Pt(o,n,t){return new Promise((e,i)=>{let r=Nn.genUniqueKey(),s=({data:a})=>{a.type===`${n}_result`&&a.key===r&&(Nn.removeKey(r),self.removeEventListener("message",s),a.error?i(a.error):e(a.data))};o.addEventListener("message",s),o.postMessage({type:n,key:r,data:t})})}function qr(o){let n={};for(let e in o)e.startsWith("on")&&(n[In(e.slice(2))]=o[e]);let t=async({data:e})=>{if(n[e.type])try{let i=await n[e.type](e.data);self.postMessage({type:`${e.type}_result`,key:e.key,data:i})}catch(i){self.postMessage({type:`${e.type}_result`,key:e.key,error:i})}else self.postMessage({type:`${e.type}_result`,key:e.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var M=y("three"),Et=y("@tweenjs/tween.js");var qn=y("three");var b=y("three");var Re={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},U=class extends b.Object3D{constructor(t,e){super();this.context=t;if(this.options=St({...Re,...e},this),this.options.geometry.type==="point"){let[i,r]=this.options.geometry.coords;return this.position.set(i,r,this.options.height+this.options.airHeight),this}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 b.Vector3,e=new b.Box3;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new b.Vector3(0,0,0);let t=new b.Box3,e=new b.Vector3;return t.setFromObject(this),t.getSize(e),e}getPosition(){let t=this.getCenter();return t.setZ(t.z+this.options.height/2),t}init(){this.initDoor(),this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){}initGeometry(){let t=nt(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new b.ExtrudeGeometry(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=this.context.materialFactory.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.height<=.1)return this.material=t,t;let e=this.context.materialFactory.createMeshBasicMaterial({color:ct(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let i=new b.Box3().setFromObject(this),r=t.clone().add(e.clone().multiplyScalar(1e3)),s=new b.Ray(r,e.clone().multiplyScalar(-1)),a=new b.Vector3;s.intersectBox(i,a);let u=t.clone().add(e.clone().multiplyScalar(-1e3)),l=new b.Ray(u,e.clone()),h=new b.Vector3;return l.intersectBox(i,h),{max:h,min:a}}initGradualMaterial(){let{max:t,min:e}=new b.Box3().setFromObject(this),i=t.clone().sub(e),r=Math.max(i.x,i.y,i.z)/2,s=this.getPosition(),a=new b.Vector3(-1,.2,0).normalize(),{max:u,min:l}=this.getMaxAndMin(s,a),h=this.context.materialFactory.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:r,opacity:this.options.fillOpacity,direction:new b.Vector3(-1,.2,0),max:u,min:l});if(this.options.height<=.1)return this.material=h,h;let p=this.getCenter(),f=new b.Vector3(-1,.2,1).normalize(),{max:m,min:c}=this.getMaxAndMin(p,f),d=this.context.materialFactory.createShaderMaterial({gradualColor:[ct(this.options.gradualColor[0],this.options.colorFactor),ct(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:r,opacity:this.options.fillOpacity,direction:new b.Vector3(-1,.2,1),max:m,min:c});return this.material=[h,d],[h,d]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){let t=this.context.materialFactory.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new b.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:i}=this.options.geometry;for(let r=0;r<i.length;r++){let s=i[r];for(let a=0;a<s.length;a++){let u=s[a],l=a+1===s.length?s[0]:s[a+1];t.push(new b.Vector3(u[0],u[1],e)),t.push(new b.Vector3(l[0],l[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new b.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new b.LineSegments(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 e=t.intersectObject(this.mesh);if(e[0]){let{point:i,distance:r}=e[0];return{position:i,distance:r}}return!1}dispose(){this.geometry?.dispose(),this.line?.geometry.dispose(),this.clear()}};var Y=y("three");var jt=class extends Y.Object3D{directionalLight;plane;basicOpacity=.07;constructor(){super(),this.directionalLight=this.initLight(),this.initPlane()}initLight(){let n=qe(16777215,.5);return n.position.set(0,0,100),this.add(n),n}changeLightCamera(n){let t=n.x,e=n.y;this.directionalLight.shadow.camera.left=-t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.top=e,this.directionalLight.shadow.camera.bottom=-e,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(t,e)}changeLightColor(n){this.directionalLight.color=new Y.Color(n)}setPosition(n){this.position.copy(n),this.directionalLight.position.set(-n.x/2,-n.y/2,100)}initPlane(n=1e3,t=1e3){let e=new Y.PlaneGeometry(n,t),i=new Y.ShadowMaterial({transparent:!0,opacity:0,side:Y.DoubleSide}),r=new Y.Mesh(e,i);return r.receiveShadow=!0,r.position.z=-10,this.add(r),this.plane=r,r}setTarget(n){this.directionalLight.target=n}transformOpacity(n){return n*this.basicOpacity}setOpacity(n){this.plane.material.opacity=this.transformOpacity(n)}dispose(){Z(this,!0)}};var $t=y("three");var S=y("three");var Dn=y("lodash");var zi={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},Yt=class extends S.EventDispatcher{constructor(t,e={}){super();this.context=t;this.options={...zi,...e},this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}div;element;position=new S.Vector3;clientPos={x:0,y:0};visible=!0;options;placement="top";observer=null;initObserver(){let t=new MutationObserver((0,Dn.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){if(this.element instanceof U&&this.element.options.geometry.type==="polygon"){let{max:r,min:s}=new S.Box3().setFromObject(this.element),a=(r.x+s.x)/2,u=(r.y+s.y)/2;return{left:new S.Vector3(s.x,u,r.z),leftTop:new S.Vector3(s.x,r.y,r.z),top:new S.Vector3(a,r.y,r.z),rightTop:new S.Vector3(r.x,r.y,r.z),right:new S.Vector3(r.x,u,r.z),rightBottom:new S.Vector3(r.x,s.y,r.z),bottom:new S.Vector3(a,s.y,r.z),leftBottom:new S.Vector3(s.x,s.y,r.z),center:new S.Vector3(a,u,r.z)}}let{x:t,y:e,z:i}=this.element?.getPosition?.()||this.position;return{left:new S.Vector3(t,e,i),leftTop:new S.Vector3(t,e,i),top:new S.Vector3(t,e,i),rightTop:new S.Vector3(t,e,i),right:new S.Vector3(t,e,i),rightBottom:new S.Vector3(t,e,i),bottom:new S.Vector3(t,e,i),leftBottom:new S.Vector3(t,e,i),center:new S.Vector3(t,e,i)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,i=this.getPlacementPosition();return Object.keys(i).reduce((r,s)=>{let{x:a,y:u}=E(i[s],this.context.camera,t,e);return r[s]={x:a,y:u},r},{})}checkOverflow(t,e){let{width:i,height:r}=this.context.clientSize;return e.x>0&&t.x<i&&e.y<r&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,i=this.getPlacementScreenPosition(),r=t/2,s=e/2,a=[{type:"center",getBox(u,l){return{max:{x:r+u,y:l-e},min:{x:u-r,y:l}}}},{type:"left",getBox(u,l){return{max:{x:u,y:l-s},min:{x:u-t,y:l+s}}}},{type:"leftTop",getBox(u,l){return{max:{x:u,y:l-e},min:{x:u-t,y:l}}}},{type:"top",getBox(u,l){return{max:{x:u+r,y:l-e},min:{x:u-r,y:l}}}},{type:"rightTop",getBox(u,l){return{max:{x:u+t,y:l-e},min:{x:u,y:l}}}},{type:"right",getBox(u,l){return{max:{x:u+t,y:l-s},min:{x:u,y:l+s}}}},{type:"rightBottom",getBox(u,l){return{max:{x:u+t,y:l},min:{x:u,y:l+e}}}},{type:"bottom",getBox(u,l){return{max:{x:u+r,y:l},min:{x:u-r,y:l+e}}}},{type:"leftBottom",getBox(u,l){return{max:{x:u,y:l},min:{x:u-t,y:l+s}}}}];for(let u=0;u<a.length;u++){let l=a[u],h=i[l.type],{max:p,min:f}=l.getBox(h.x,h.y);if(this.checkOverflow(p,f))return{type:l.type,position:h}}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,e="block"){t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=`${t}`}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new S.Box3().setFromObject(this.element).getCenter(new S.Vector3):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:i,height:r}=this.context.clientSize;return t>=0&&t<=i&&e>=0&&e<=r}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:i,height:r,x:s,y:a}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=`${s}px`,this.div.style.top=`${a+r}px`),this.options.autoUpdate?this.div.style.transform=`translate3d(${t}px, ${-r+e}px, 0)`:this.dispatchEvent({type:"update-position",x:t,y:e,width:i,height:r})}updatePosition(t=!1){let e=this.getPosition(),{width:i,height:r}=this.context.clientSize,{x:s,y:a}=E(e,this.context.camera,i,r);this.clientPos.x===s&&this.clientPos.y===a&&!t||this._updatePosition(s,a)}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 ki={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},_t=class extends $t.EventDispatcher{constructor(t,e){super();this.context=t;this.options=St({...ki,...e},this),this.position.set(e.position?.x||0,e.position?.y||0,e.position?.z||0),this.overlay=new Yt(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",({x:i,y:r,height:s})=>{this.overlay.div.style.transform=`translate3d(calc(${i}px - 50%), calc(${-s+r}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 r=this.textDiv;if(r){let s=this.initText();this.div.replaceChild(s,r)}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 $t.Vector3;userData={};showTextStatus=!0;disposed=!1;get withinDisplayRange(){return this.overlay.withinDisplayRange}async resetSize(){if(await en(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+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(e=>{let i=document.createElement("div");if(i.style.whiteSpace="nowrap",e.styles)for(let[r,s]of Object.entries(e.styles))i.style[r]=s;i.textContent=e.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:e,height:i}=this.size,r=e*t,s=i*t,{x:a,y:u}=this.overlay.clientPos;return{left:a-r/2,right:a+r/2,top:this.options.icon?u-s:u-s/2,bottom:this.options.icon?u:u+s/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let i=this.getOriginBox();return t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}};var G=y("three");var O=y("three"),On=y("@mars3d/heatmap.js"),pt=y("@turf/turf"),Zt=class extends O.Object3D{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:e,height:i,leftTop:r,center:s}=this.getBox(t);this.heatmap=(0,On.create)({width:e,height:i,container:this.div,...this.context.config.heatMap}),this.heatmap.setData(this.transformData(t,r)),this.initPlane(e,i),this.position.set(s[0],s[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let i=new O.PlaneGeometry(t,e),r=new O.Texture(this.div.firstChild);r.needsUpdate=!0;let s=new O.MeshBasicMaterial({transparent:!0,side:O.DoubleSide,map:r});s.needsUpdate=!0,this.plane=new O.Mesh(i,s),this.add(this.plane)}getTransMatrix({x:t,y:e}){return new O.Matrix3().makeScale(1,-1).multiply(new O.Matrix3().makeTranslation(0-t,0-e))}transformData(t,e){let i=this.getTransMatrix(e);return{data:t.data.map(s=>{let a=new O.Vector2(s.x,s.y).applyMatrix3(i);return{x:a.x,y:a.y,value:s.value}}),max:t.max,min:t.min}}getBox(t){let e=(0,pt.featureCollection)(t.data.map(l=>(0,pt.point)([l.x,l.y]))),i=(0,pt.bbox)(e),r=i[2]-i[0],s=i[3]-i[1],a={x:i[0],y:i[3]},u=(0,pt.center)(e);return{width:r,height:s,leftTop:a,center:u.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}};var Jt=y("three");var Kt=class extends Jt.Object3D{constructor(t,e){super();this.context=t;this.options=e;this.position.copy(e.position||new Jt.Vector3(0,0,0)),this.loadModel()}model=null;async loadModel(){let t=await Xt(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t}dispose(){Z(this),this.model=null}};var te=y("three");var Fn=y("three");var B=class extends Fn.Object3D{constructor(t){super();this.context=t}dispose(){Z(this),this.children.forEach(t=>t.dispose?.()),this.clear()}};var Qt=class extends B{graphicMap=new Map;constructor(n){super(n)}getCenter(){return new te.Box3().setFromObject(this).getCenter(new te.Vector3)}createGraphic(n){let t=new U(this.context,n);return this.add(t),this.graphicMap.set(n.id,t),t}removeGraphic(n){this.remove(n),this.graphicMap.delete(n.options.id),n.dispose()}removeGraphicById(n){this.graphicMap.has(n)&&this.removeGraphic(this.graphicMap.get(n))}getGraphicByNodeId(n){return this.graphicMap.get(n)||null}getGraphicByRaycaster(n){let t={distance:1e4,graphic:null,position:null},e=this.children.reduce((i,r)=>{if(r instanceof U){let s=r.raycast(n);if(s){let{distance:a}=s;if(a<i.distance)return{distance:s.distance,position:s.position,graphic:r}}return i}else return i},t);return e===t?{graphics:[],position:null}:{graphics:[e.graphic],position:e.position}}};var Un=y("lodash");var Lt=class extends B{pois=[];debounceCollisionDetection;timer=new W;constructor(n){super(n),this.registryEvent(),this.debounceCollisionDetection=(0,Un.debounce)(this.collisionDetection,10)}clear(n=!1){return this.pois.forEach(t=>{t.options.built_in&&!n||t.dispose()}),this.pois=n?[]:this.pois.filter(t=>t.options.built_in),this}createPoi(n){let t=new _t(this.context,n);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(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),this.pushPoi(n))}removePoi(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),n.dispose())}removePoiById(n){let t=this.pois.find(e=>e.options.id===n);t&&this.removePoi(t)}getPoiById(n){return this.pois.find(e=>e.options.id===n)||null}pushPoi(n){if(!n.options.collision_enable){this.pois.unshift(n);return}if(n.options.level===0){this.pois.push(n);return}for(let t=0;t<this.pois.length;t++){let e=this.pois[t];if(e.options.collision_enable&&e.options.level<=n.options.level){this.pois.splice(t,0,n);return}}this.pois.push(n)}getPoiByDeviceXy(n,t){return this.pois.filter(i=>i instanceof _t&&i.isContain(n,t))}onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let n=[];this.pois.filter(e=>e.visible&&e.withinDisplayRange).forEach((e,i)=>{let{left:r,right:s,top:a,bottom:u}=e.getBox();if(i===0||!e.options.collision_enable){n.push({left:r,right:s,top:a,bottom:u}),e.parentSetVisible(!0);return}let l=n.some(h=>h.left<s&&h.right>r&&h.top<u&&h.bottom>a);e.parentSetVisible(!l),l||n.push({left:r,right:s,top:a,bottom:u})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(n=>n.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var Bn=y("lodash");var ne=y("three"),ee=class extends B{pois=[];debounceCollisionDetection;timer=new W;constructor(n){super(n),this.registryEvent(),this.debounceCollisionDetection=(0,Bn.debounce)(this.collisionDetection,10)}clear(){return this.pois.forEach(n=>{n.dispose()}),this.pois=[],this}createPoi(n){let t=new k(this.context,n);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(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),this.pushPoi(n))}removePoi(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.remove(n),this.pois.splice(t,1),n.dispose())}removePoiById(n){let t=this.pois.find(e=>e.options.id===n);t&&this.removePoi(t)}getPoiById(n){return this.pois.find(e=>e.options.id===n)||null}pushPoi(n){if(this.add(n),!n.options.collision_enable){this.pois.unshift(n);return}if(n.options.level===0){this.pois.push(n);return}for(let t=0;t<this.pois.length;t++){let e=this.pois[t];if(e.options.collision_enable&&e.options.level<=n.options.level){this.pois.splice(t,0,n);return}}this.pois.push(n)}getPoiByDeviceXy(n,t){let e=new ne.Vector2(n,t);return this.pois.filter(r=>r instanceof k&&r.canSelect&&r.box.containsPoint(e))}changeParkingSpaceVisibleByZoom=()=>{let n=this.parent?.parent;if(n&&n instanceof rt){let{clientSize:{width:t,height:e}}=this.context,{max:i,min:r}=n.box,a=Math.min(t/(i.x-r.x),e/(i.y-r.y))*(i.x-r.x)/200;console.log(a,this.context.camera.zoom),this.pois.filter(u=>u.userData.type==="parkingSpace").map(u=>{let l=this.context.camera.zoom>=a;u.visible=l,l||u.parentSetVisible(l)})}};onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let n=[],{camera:t}=this.context;t.updateMatrixWorld();let e=s=>s<=1&&s>=-1,i=t.projectionMatrix.clone();i.multiply(t.matrixWorldInverse),this.pois.filter(s=>{if(s.visible){let a=new ne.Vector3().setFromMatrixPosition(s.matrixWorld);return a.applyMatrix4(i),s.screenPosition=a,e(a.x)&&e(a.y)&&e(a.z)}return!1}).forEach((s,a)=>{let u=s.getBox(s.screenPosition);if(a===0||!s.options.collision_enable){n.push(u),s.parentSetVisible(!0);return}let l=n.some(h=>h.intersectsBox(u));s.parentSetVisible(!l),l||n.push(u)})}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(n=>n.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var rt=class extends G.Object3D{constructor(t){super();this.context=t;this.groundLayer=new B(this.context),this.graphicLayer=new Qt(this.context),this.poiLayer=new Lt(this.context),this.poiLayer2=new ee(this.context),this.wallLayer=new B(this.context),this.textureLayer=new B(this.context),this.glbModelLayer=new B(this.context),this.laneLayer=new B(this.context),this.mergeGraphicLayer=new B(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.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}graphicLayer;poiLayer;poiLayer2;wallLayer;textureLayer;glbModelLayer;laneLayer;mergeGraphicLayer;grounds=new Set;groundLayer;shadow=new jt;heatmap;groundUpper=new G.Object3D;models=new G.Object3D;modelMap=new Map;groundMaxHeight=0;name="";key="";box=new G.Box3;getPosition(){return new G.Box3().setFromObject(this).getCenter(new G.Vector3)}createGround(t){let e=new U(this.context,t);this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(e.mesh.castShadow=!0,this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new G.Box3().setFromObject(this).getCenter(new G.Vector3)}addModel(t){let e=new Kt(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new G.Box3().setFromObject(this.groundUpper),e=t.getCenter(new G.Vector3),i=t.getSize(new G.Vector3);this.shadow.setPosition(e),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 Zt(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new G.Box3().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(e.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(){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.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()}};var ie=y("three");var ot=class extends ie.EventDispatcher{constructor(t){super();this.context=t;this.svg=tn(`${t.container.clientWidth}`,`${t.container.clientHeight}`),t.container.appendChild(this.svg),this._registryEvent()}points=[];svg;enable=!0;_onResize=({width:t,height:e})=>{this.svg&&(this.svg.setAttribute("width",`${t}`),this.svg.setAttribute("height",`${e}`))};_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:e,renderer:i}=this.context,{offsetX:r,offsetY:s}=t,{clientWidth:a,clientHeight:u}=i.domElement,l=r/a*2-1,h=1-s/u*2;return new ie.Vector3(l,h,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:i}=this.context;return E(t,e,i.clientWidth,i.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}};var re=class extends ot{constructor(t){super(t);this.context=t;let{config:{svg:{circle:e,line:i}}}=t;this.circles=[It(e.radius,e.fill),It(e.radius,e.fill)],this.line=Vt(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]);yt(this.circles[0],t.x,t.y),K(this.line,t)}if(this.points[1]){let t=this.getSvgCoordinate(this.points[1]);yt(this.circles[1],t.x,t.y),K(this.line,void 0,t)}};onPointermove=t=>{this.points.length===1&&(this.line.style.display="block",K(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 e=this.getIntersectByPointerEvent(t);if(e){let{offsetX:i,offsetY:r}=t,s=this.circles[this.points.length];yt(s,i,r),this.points.length||K(this.line,{x:i,y:r},{x:i,y:r}),this.addPoint(e)}};addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:i,y:r}]=this.points;return Math.sqrt((i-t)**2+(r-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}};var oe=class extends ot{circles=[];lines=[];isClose=!1;constructor(n){super(n),this.registryEvent()}setEnable(n){super.setEnable(n),n?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(n){this.circles.push(n),this.svg.appendChild(n)}addLine(n){this.lines.push(n),this.svg.appendChild(n)}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((n,t)=>{let e=this.getSvgCoordinate(n);this.circles[t]&&yt(this.circles[t],e.x,e.y),t!==0&&K(this.lines[t-1],void 0,e),this.lines[t]&&K(this.lines[t],e)})};onPointermove=n=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",K(this.lastLine,void 0,{x:n.offsetX,y:n.offsetY}))};onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")};onPointerdown=n=>{if(this.isClose)return;let t=this.getIntersectByPointerEvent(n);if(t){let{offsetX:e,offsetY:i}=n;this.checkAdsorb(e,i)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(t);let{circle:{fill:r,radius:s},line:{stroke:a}}=this.context.config.svg;if(!this.isClose){let u=It(s,r);yt(u,e,i),this.addCircle(u)}if(this.lines.length&&K(this.lastLine,void 0,{x:e,y:i}),!this.isClose){let u=Vt(a);K(u,{x:e,y:i},{x:e,y:i}),this.addLine(u)}}};checkAdsorb(n,t){if(this.points.length<3)return!1;let e=this.circles[0],i=+e.getAttribute("cx"),r=+e.getAttribute("cy");return Math.sqrt((n-i)**2+(t-r)**2)<=5}addPoint(n){if(this.points.push(n),this.isClose){let t=this.calculatedArea();this.dispatchEvent({type:"area",area:t})}}calculatedArea(){let n=this.points.map(i=>[i.x,i.y]),t=0,e=n.length;for(let i=0;i<e;i++){let r=(i+1)%e;t+=n[i][0]*n[r][1]-n[r][0]*n[i][1]}return Math.abs(t/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}};var zn=y("three");var Gn=class extends ot{constructor(t){super(t);this.context=t;let{config:{svg:{line:e}}}=t;this.rect=wt(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let i=0;i<4;i++)this.cornerRect[i]=wt(e.stroke,"#ffffff"),this.centerRect[i]=wt(e.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 zn.Box3().setFromObject(this.graphic),{camera:e,container:{clientWidth:i,clientHeight:r}}=this.context,{min:s,max:a}=t,u=E(s,e,i,r),l=E(a,e,i,r);J(this.rect,u.x,l.y,Math.abs(l.x-u.x),Math.abs(l.y-u.y));let{x:h,y:p}=u,{x:f,y:m}=l,c=5,d=[{x:h-c,y:m-c},{x:f-c,y:m-c},{x:h-c,y:p-c},{x:f-c,y:p-c}];for(let x=0;x<d.length;x++)J(this.cornerRect[x],d[x].x,d[x].y,c*2,c*2);let g=4,v=(h+f)/2,P=(p+m)/2,C=[{x:v-g,y:m-g},{x:h-g,y:P-g},{x:f-g,y:P-g},{x:v-g,y:p-g}];for(let x=0;x<C.length;x++)J(this.centerRect[x],C[x].x,C[x].y,g*2,g*2)}else{J(this.rect,0,0,0,0);for(let t=0;t<this.cornerRect.length;t++)J(this.cornerRect[t],0,0,0,0),J(this.centerRect[t],0,0,0,0)}};selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}};var I=y("three");var Ie=y("three/examples/jsm/utils/BufferGeometryUtils"),se=class extends I.Object3D{constructor(t,e){super();this.context=t;this.options=e;e.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;initGeometry(){let t=this.options.map(e=>{let i=nt(e.geometry.coords[0],e.geometry.coords.slice(1));return new I.ExtrudeGeometry(i,{steps:1,bevelEnabled:!1,depth:e.height,curveSegments:4})});this.geometry=(0,Ie.mergeGeometries)(t),t.forEach(e=>e.dispose())}initMaterial(){let t=`
|
|
1
|
+
"use strict";(()=>{var Ei=Object.create;var Ge=Object.defineProperty;var bi=Object.getOwnPropertyDescriptor;var Mi=Object.getOwnPropertyNames;var Si=Object.getPrototypeOf,wi=Object.prototype.hasOwnProperty;var y=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var gt=(o,n)=>()=>(n||o((n={exports:{}}).exports,n),n.exports);var Ti=(o,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Mi(n))!wi.call(o,i)&&i!==t&&Ge(o,i,{get:()=>n[i],enumerable:!(e=bi(n,i))||e.enumerable});return o};var Se=(o,n,t)=>(t=o!=null?Ei(Si(o)):{},Ti(n||!o||!o.__esModule?Ge(t,"default",{value:o,enumerable:!0}):t,o));var an=gt((Lr,sn)=>{sn.exports=function(n,t){return n[0]=t[0],n[1]=t[1],n}});var hn=gt((Ar,un)=>{var ln=an();un.exports=function(o,n){Array.isArray(n)||(n=[]),o.length>0&&n.push(ln([0,0],o[0]));for(var t=0;t<o.length-1;t++){var e=o[t],i=o[t+1],r=e[0],s=e[1],l=i[0],u=i[1],a=[.75*r+.25*l,.75*s+.25*u],h=[.25*r+.75*l,.25*s+.75*u];n.push(a),n.push(h)}return o.length>1&&n.push(ln([0,0],o[o.length-1])),n}});var yn=gt((Dr,mn)=>{var Pe=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((n,t)=>n.priority-t.priority)}set(n,t){let e=Number(t);if(isNaN(e))throw new TypeError('"priority" must be a number');return this.keys.has(n)?this.queue.map(i=>(i.key===n&&Object.assign(i,{priority:e}),i)):(this.keys.add(n),this.queue.push({key:n,priority:e})),this.sort(),this.queue.length}next(){let n=this.queue.shift();return this.keys.delete(n.key),n}isEmpty(){return this.queue.length===0}has(n){return this.keys.has(n)}get(n){return this.queue.find(t=>t.key===n)}};mn.exports=Pe});var xn=gt((Or,vn)=>{function _n(o,n){let t=new Map;for(let[e,i]of o)e!==n&&i instanceof Map?t.set(e,_n(i,n)):e!==n&&t.set(e,i);return t}vn.exports=_n});var Mn=gt((Fr,bn)=>{function Ui(o){let n=Number(o);return!(isNaN(n)||n<=0)}function En(o){let n=new Map;return Object.keys(o).forEach(e=>{let i=o[e];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return n.set(e,En(i));if(!Ui(i))throw new Error(`Could not add node at key "${e}", make sure it's a valid node`,i);return n.set(e,Number(i))}),n}bn.exports=En});var Tn=gt((Ur,wn)=>{function Sn(o){if(!(o instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof o}`);o.forEach((n,t)=>{if(typeof n=="object"&&n instanceof Map){Sn(n);return}if(typeof n!="number"||n<=0)throw new Error(`Values must be numbers greater than 0. Found value ${n} at ${t}`)})}wn.exports=Sn});var Ae=gt((Br,Ln)=>{var Bi=yn(),Gi=xn(),Cn=Mn(),Pn=Tn(),Le=class{constructor(n){n instanceof Map?(Pn(n),this.graph=n):n?this.graph=Cn(n):this.graph=new Map}addNode(n,t){let e;return t instanceof Map?(Pn(t),e=t):e=Cn(t),this.graph.set(n,e),this}addVertex(n,t){return this.addNode(n,t)}removeNode(n){return this.graph=Gi(this.graph,n),this}path(n,t,e={}){if(!this.graph.size)return e.cost?{path:null,cost:0}:null;let i=new Set,r=new Bi,s=new Map,l=[],u=0,a=[];if(e.avoid&&(a=[].concat(e.avoid)),a.includes(n))throw new Error(`Starting node (${n}) cannot be avoided`);if(a.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(r.set(n,0);!r.isEmpty();){let h=r.next();if(h.key===t){u=h.priority;let f=h.key;for(;s.has(f);)l.push(f),f=s.get(f);break}i.add(h.key),(this.graph.get(h.key)||new Map).forEach((f,m)=>{if(i.has(m)||a.includes(m))return null;if(!r.has(m))return s.set(m,h.key),r.set(m,h.priority+f);let c=r.get(m).priority,d=h.priority+f;return d<c?(s.set(m,h.key),r.set(m,d)):null})}return l.length?(e.trim?l.shift():l=l.concat([n]),e.reverse||(l=l.reverse()),e.cost?{path:l,cost:u}:l):e.cost?{path:null,cost:0}:null}shortestPath(...n){return this.path(...n)}};Ln.exports=Le});var ve=y("three");var W=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(n){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),n()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(n){this.tasks.requestAnimation.delete(n),window.cancelAnimationFrame(n)}setTimeout(n,t){let e=window.setTimeout(()=>{this.tasks.timeout.delete(e),n()},t);return this.tasks.timeout.add(e),e}clearTimeout(n){this.tasks.timeout.delete(n),window.clearTimeout(n)}setInterval(n,t){let e=window.setInterval(()=>{this.tasks.interval.delete(e),n()},t);return this.tasks.interval.add(e),e}clearInterval(n){this.tasks.interval.delete(n),window.clearInterval(n)}dispose(){this.tasks.requestAnimation.forEach(n=>{window.cancelAnimationFrame(n)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(n=>{window.clearTimeout(n)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(n=>{window.clearInterval(n)}),this.tasks.interval.clear()}};var T=y("three"),ze=y("three/examples/jsm/controls/MapControls");function ke(){let o=new T.Scene;return o.background=new T.Color(16777215),o}function Ve(){let o=new T.WebGLRenderer({antialias:!0});return o.autoClear=!0,o.setClearAlpha(1),o.setClearColor(16777215),o.setPixelRatio(window.devicePixelRatio),o.shadowMap.enabled=!0,o.shadowMap.autoUpdate=!0,o.shadowMap.type=T.PCFSoftShadowMap,o}function He(o,n){let t=new T.OrthographicCamera(-o/2,o/2,n/2,-n/2,-1e3,5e3);return t.up.set(0,0,1),t.position.set(0,0,100),t.lookAt(0,0,0),t}function We(){let o=new T.Group,n=new T.AmbientLight(16777215,2.6);return o.add(n),o}function Xe(o,n){let t=new ze.MapControls(o,n);return t.enableDamping=!1,t.zoomSpeed=2,t}function nt(o,n=[]){let t=new T.Shape(o.map(e=>new T.Vector2(...e)));return n.length&&n.forEach(e=>{var i=new T.Path(e.map(r=>new T.Vector2(...r)));t.holes.push(i)}),t}function qe(o=16777215,n=1){let t=new T.DirectionalLight(o,n);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 Z(o,n){if(n&&o.children&&o.children.length&&o.children.forEach(t=>{Z(t,n)}),o.isMesh){let t=o;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(e=>{e.dispose()}):t.material.dispose())}o.isLight&&o.dispose?.()}function je(o){return/[\u4E00-\u9FA5]+/g.test(o)}var X=y("three"),Mt=new Map,Rt=new Map,Ci=new X.TextureLoader;function Pi(){let o=document.createElement("canvas");o.width=1024,o.height=64;let n=o.getContext("2d",{willReadFrequently:!0});return n.font="54px sans-serif",n.textBaseline="hanging",n.lineWidth=12,n.fillStyle="rgba(0,0,0,1)",n.strokeStyle="white",{canvas:o,ctx:n}}var we,mt;function Li(){if(!we){let{canvas:o,ctx:n}=Pi();we=o,mt=n}}function Ye(o){if(Rt.has(o))return Rt.get(o);Li(),mt.clearRect(0,0,1024,64);let n=je(o)?4:8;mt.strokeText(o,2,n),mt.fillText(o,2,n);let t=Math.ceil(mt.measureText(o).width);t=t%2===0?t:t+1,t+=2;let e=mt.getImageData(0,0,t,64),i=new X.DataTexture(Uint8Array.from(e.data),t,64,X.RGBAFormat);return i.flipY=!0,i.minFilter=X.LinearFilter,i.magFilter=X.LinearFilter,Rt.set(o,i),i}function $e(){Rt.forEach((o,n)=>{o.dispose()}),Mt.forEach(o=>{o instanceof Promise?o.then(n=>n.dispose()):o.dispose()}),Rt.clear(),Mt.clear()}function Ze(){mt=null,we=null}async function Ke(o){if(Mt.has(o))return Mt.get(o);let n=Ci.loadAsync(o);return n.then(t=>{t.format=X.RGBAFormat,t.magFilter=X.LinearFilter,t.minFilter=X.LinearFilter,t.colorSpace="srgb",Mt.set(o,t)}),Mt.set(o,n),n}var A=y("three"),St=y("@turf/turf");function E(o,n,t,e){let i=o.clone().project(n),r=t/2,s=e/2,l=Math.round(i.x*r+r),u=Math.round(-i.y*s+s);return{x:l,y:u}}function Bt(o){let n=(0,St.featureCollection)(o.map(e=>(0,St.point)(e)));return(0,St.center)(n).geometry.coordinates}function Gt(o,n,t){return o.x>=n.x&&o.x<=t.x&&o.y>=n.y&&o.y<=t.y}function lr(o){let n=0,t=new A.Vector3;for(let e=1;e<o.length;e++){let i=new A.Vector3(o[e-1][0],o[e-1][1],0),r=new A.Vector3(o[e][0],o[e][1],0),s=r.distanceTo(i);s>n&&(n=s,t=r.clone().sub(i).normalize())}return t}function I(o,n){return Math.sqrt((n[0]-o[0])**2+(n[1]-o[1])**2)}function ct(o){let n=0;for(let t=0;t<o.length-1;t++)n+=I(o[t],o[t+1]);return n}function zt(o,n,t){let e=new A.Vector2(n[0]-o[0],n[1]-o[1]),i=new A.Vector2(n[0]-t[0],n[1]-t[1]),s=e.angleTo(i)*180/Math.PI,l=new A.Vector2(n[0]-o[0],n[1]-o[1]);return new A.Vector2(t[0]-o[0],t[1]-o[1]).cross(l)>0?s:-s}function Je(o,n){let t=Math.min(I(o[0][0],o[0][1]),I(o[0][2],o[0][1]))-1;n||(n=Bt(o[0]));let e=Ai(n,t),i=new A.Vector2(o[0][0][0],o[0][0][1]),r=new A.Vector2(o[0][1][0],o[0][1][1]),s=new A.Vector2(o[0][2][0],o[0][2][1]),u=(i.distanceTo(r)>r.distanceTo(s)?r.clone().sub(i):s.clone().sub(r)).angleTo(new A.Vector2(0,1)),a=new A.Matrix3;return a.multiply(new A.Matrix3().translate(n[0],n[1])).multiply(new A.Matrix3().rotate(u)).multiply(new A.Matrix3().translate(-n[0],-n[1])),[e.map(h=>{let p=new A.Vector2(h[0],h[1]).applyMatrix3(a);return[p.x,p.y]})]}function Ai(o,n){let t=n/2;return[[o[0]-t,o[1]+t],[o[0]+t,o[1]+t],[o[0]+t,o[1]-t],[o[0]-t,o[1]-t],[o[0]-t,o[1]+t]]}function Qe(o,n,t){let[e,i]=o,[r,s]=n,[l,u]=t,a=(r-e)*(u-i)-(s-i)*(l-e);if(console.log("crossProduct",o,n,t,a),Math.abs(a)!==0)return!1;let h=Math.min(e,r)<=l&&l<=Math.max(e,r),p=Math.min(i,s)<=u&&u<=Math.max(i,s);return h&&p}function wt(o,n){return new Proxy(o,{get:(t,e,i)=>Reflect.get(t,e,i),set:(t,e,i,r)=>{let s=Reflect.get(t,e,r),l=Reflect.set(t,e,i,r);return s!==i&&n.dispatchEvent({type:`change-${e}`,value:i}),l}})}function yt(o,n){return Promise.race([o,new Promise((t,e)=>{setTimeout(()=>e(new Error("Promise timeout")),n)})])}function kt(o){return document.createElementNS("http://www.w3.org/2000/svg",o)}function tn(o,n){let t=kt("svg");return t.setAttribute("width",o),t.setAttribute("height",n),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function It(o="2",n){let t=kt("circle");return t.setAttribute("r",o),t.setAttribute("fill",n),t}function Vt(o){let n=kt("line");return n.setAttribute("stroke",o),n}function Tt(o,n){let t=kt("rect");return t.setAttribute("stroke",o),t.setAttribute("fill",n),t}function _t(o,n,t){o.setAttribute("cx",`${n}`),o.setAttribute("cy",`${t}`)}function K(o,n,t){n&&(o.setAttribute("x1",`${n.x}`),o.setAttribute("y1",`${n.y}`)),t&&(o.setAttribute("x2",`${t.x}`),o.setAttribute("y2",`${t.y}`))}function J(o,n,t,e,i){o.setAttribute("x",`${n}`),o.setAttribute("y",`${t}`),o.setAttribute("width",`${e}`),o.setAttribute("height",`${i}`)}function en(){return Promise.resolve()}function fr(){return new Promise(o=>{requestAnimationFrame(o)})}function gr(o){return parseInt(o.replace("#","0x"),16)}function mr(o,n){let t=parseInt(o.substring(1,3),16),e=parseInt(o.substring(3,5),16),i=parseInt(o.substring(5,7),16),r=Math.round(t*n),s=Math.round(e*n),l=Math.round(i*n);return`#${(1<<24|r<<16|s<<8|l).toString(16).slice(1)}`}function ut(o,n=.85){let t,e,i;if(o.startsWith("#"))t=parseInt(o.substring(1,3),16),e=parseInt(o.substring(3,5),16),i=parseInt(o.substring(5,7),16);else{let s=o.slice(4,-1).split(",");t=parseInt(s[0].trim()),e=parseInt(s[1].trim()),i=parseInt(s[2].trim())}return t=Math.min(Math.floor(t*n),255),e=Math.min(Math.floor(e*n),255),i=Math.min(Math.floor(i*n),255),"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)}var nn=y("three/examples/jsm/loaders/GLTFLoader");function Ri(){return new nn.GLTFLoader}var Ht=null,Wt=new Map;function Xt(o){if(Wt.has(o)){let t=Wt.get(o).then(e=>(e.scene=e.scene.clone(),e))}Ht||(Ht=Ri());let n=new Promise((t,e)=>{Ht.load(o,i=>{t(i)},void 0,e)});return Wt.set(o,n),n.then(t=>(t.scene=t.scene.clone(),t))}function rn(){Ht=null,Wt.clear()}var qt=navigator.userAgent.toUpperCase().indexOf("MAC")>=0;function Te(o){return qt?o==="Meta":o==="Control"}var Ce="__once__",on=class{events=new Map;on(n,t){if(typeof t!="function")return;let e=this.events.get(n);return e?e.add(t):this.events.set(n,new Set([t]))}once(n,t){if(typeof t!="function")return;let e=`${Ce}${n}`,i=this.events.get(e);return i?i.add(t):this.events.set(e,new Set([t]))}off(n,t){let e=this.events.get(n),i=this.events.get(`${Ce}${n}`);!e&&!i||(t===void 0&&(e?.clear(),i?.clear()),e?.has(t)&&e.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(n,...t){let e=this.events.get(n),i=this.events.get(`${Ce}${n}`);!e&&!i||(e?.forEach(r=>{typeof r=="function"&&r(...t)}),i?.forEach(r=>{typeof r=="function"&&r(...t)}),i?.clear())}};var Nt=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(Nt||{});function Q(o){return Object.keys(o).sort().map(n=>`${n}=${o[n]}`).join("&")}function Tr(o,n){return new Promise((t,e)=>{let i=new XMLHttpRequest;i.open("GET",o,!0),Object.keys(n.headers||{}).forEach(r=>{i.setRequestHeader(r,n.headers[r])}),n.responseType&&(i.responseType=n.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(n.responseType==="arraybuffer")t(i.response);else try{let r=JSON.parse(i.responseText);t(r)}catch(r){e(r)}else e(i.statusText)},i.onerror=()=>{e(i.statusText)},i.send()})}var Ct=class o{keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}genUniqueKey(){let n=o.createKey();for(;this.keySet.has(n);)n=o.createKey();return n}removeKey(n){this.keySet.delete(n)}dispose(){this.keySet.clear()}};var Pt=y("three"),cn=Se(hn(),1);function Ii(o,n){let t=o.clone().normalize(),e=n.clone().normalize();return Math.acos(t.dot(e))}function Ni(o){let n=0;return o.reduce(([t,e],[i,r])=>(n+=Math.sqrt((i-t)**2+(r-e)**2),[i,r])),n/o.length}function pn(o,n=.25){if(Ni(o)<n)return o;let t=(0,cn.default)(o);return pn(t,n)}function fn(o,n=!1,t=!0,e=5,i=150,r=3){let s=[],l=!n;if(s.push(o[0]),o.length<2)return s;for(let a=0;a<o.length-2;a+=1){let h=o[a],p=o[a+1],f=o[a+2],m=new Pt.Vector2(h[0]-p[0],h[1]-p[1]),c=new Pt.Vector2(f[0]-p[0],f[1]-p[1]),d=Ii(m,c)/Math.PI*180,g=m.length()+c.length();(!l||d<i&&g>.01||g>e)&&(s.push(o[a+1]),l=!0)}if(s.push(o[o.length-1]),!t)return s;let u=[];u.push(s[0]);for(let a=0;a<s.length-2;a+=1){let h=new Pt.Vector2(s[a][0],s[a][1]),p=new Pt.Vector2(s[a+1][0],s[a+1][1]),f=new Pt.Vector2(s[a+2][0],s[a+2][1]),m=h.distanceTo(p)/2,c=f.distanceTo(p)/2,d=p.clone(),g=p.clone();d.add(h.clone().sub(p).normalize().multiplyScalar(m>r?r/2:m)),g.add(f.clone().sub(p).normalize().multiplyScalar(c>r?r/2:c));let v=[[d.x,d.y],[p.x,p.y],[g.x,g.y]];u.push(...pn(v,r/25))}return u.push(s[s.length-1]),Di(u)}function Di(o){if(o.length<=1)return o;let n=[],t;return o.forEach(([e,i])=>{t?e===t[0]&&i===t[1]||(t=[e,i],n.push([e,i])):(t=[e,i],n.push([e,i]))}),n}function dn(o,n,t){let e=Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2);if(e===0)return{distance:Math.sqrt((o[0]-n[0])**2+(o[1]-n[1])**2),closestPoint:n.slice(0)};let i=Math.max(0,Math.min(1,((o[0]-n[0])*(t[0]-n[0])+(o[1]-n[1])*(t[1]-n[1]))/e**2)),r=[n[0]+i*(t[0]-n[0]),n[1]+i*(t[1]-n[1])];return{distance:Math.sqrt((o[0]-r[0])**2+(o[1]-r[1])**2),closestPoint:r}}function gn(o,n,t){let[e,i]=o,[r,s]=n,l=Math.sqrt(Math.pow(r-e,2)+Math.pow(s-i,2));if(l===0||l<t)return[...n];let u=t/l,a=e+(r-e)*u,h=i+(s-i)*u;return[a,h]}var Oi=(a=>(a.START="start",a.END="end",a.FRONT="front",a.RIGHT="right",a.LEFT="left",a.RIGHT_FRONT="right_front",a.LEFT_FRONT="left_front",a.RIGHT_BACK="right_back",a.LEFT_BACK="left_back",a))(Oi||{});function Fi(o,n,t){let e=zt(o,n,t);return 180-Math.abs(e)<15?"front":e>135?"right_front":e<-135?"left_front":e<=135&&e>=60?"right":e>=-135&&e<=-60?"left":e<60&&e>0?"right_back":e>-60&&e<0?"left_back":"front"}function Ir(o){let n=[{direction:"start",distance:I(o[0],o[1]),points:[o[0],o[1]]}];for(let t=2;t<o.length;t++){let e=Fi(o[t-2],o[t-1],o[t]);if(e==="front"){let i=n[n.length-1],r=I(o[t-1],o[t]);i.distance+=r,t!==2&&i.points.push(o[t-1])}else n.push({direction:e,distance:I(o[t-1],o[t]),points:[o[t-1],o[t]]})}return n.push({direction:"end",distance:0,points:[o[o.length-1]]}),n}var it=Se(Ae(),1);var q="___",An=class{constructor(n=3){this.lift_priority=n}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new it.default;escalatorRoute=new it.default;straightLadderRoute=new it.default;initRoute(n){this.clear(),this.roadInfo=n,n.length&&(n.forEach(t=>{t.points.forEach(e=>{let i=`${t.floor}${q}${e.id}`;if(this.pointMap.set(i,e),this.nodeMap.set(`${e.floor}${q}${e.nodeId}`,i),e.type==="straightLadder"){let r=this.straightLadderMap.get(e.name)||[];r.push({...e}),this.straightLadderMap.set(e.name,r)}if(e.type==="staircase"){let r=this.staircaseMap.get(e.name)||[];r.push({...e}),this.staircaseMap.set(e.name,r)}if(e.type==="escalator"){let r=this.escalatorMap.get(e.name)||{};e.escalatorDirection==="exit"?r.end={floor:e.floor,id:e.id}:r.start={floor:e.floor,id:e.id},this.escalatorMap.set(e.name,r)}if(e.type==="facility"){let r=this.facilityMap.get(e.targetId)||[];r.push({...e}),this.facilityMap.set(e.targetId,r)}}),t.lines.filter(e=>e.direction!=="no").forEach(e=>{let i=`${t.floor}${q}${e.from}`,r=`${t.floor}${q}${e.to}`,s=this.pointMap.get(i)?.cds,l=this.pointMap.get(r)?.cds;if(s?.length&&l?.length){let u=I(s,l);this.addLineItem(i,r,u),e.direction==="double"&&this.addLineItem(r,i,u)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(n,t,e,i=this.lineMap){let r=i.get(n)||new Map;r.set(t,e),i.set(n,r)}addFacilityToLineMap(n,t,e,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([r,s])=>{if(!(s.length<2))for(let l=0;l<s.length;l++){let u=`${s[l].floor}${q}${s[l].id}`;for(let a=0;a<s.length;a++)if(l!==a){let h=`${s[a].floor}${q}${s[a].id}`,p=this.pointMap.get(u)?.cds,f=this.pointMap.get(h)?.cds;if(p?.length&&f?.length)if(s[l].type==="straightLadder"){let m=t;this.addLineItem(u,h,m,i)}else{let m=e;this.addLineItem(u,h,m,i)}}}}),this.escalatorMap.forEach((r,s)=>{if(r.start&&r.end){let l=`${r.start.floor}${q}${r.start.id}`,u=`${r.end.floor}${q}${r.end.id}`,a=this.pointMap.get(l)?.cds,h=this.pointMap.get(u)?.cds;if(a?.length&&h?.length){let p=n;this.addLineItem(l,u,p,i)}}})}initBaseRoute(){let n=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,n),this.baseRoute=new it.default(n)}initEscalatorRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,n),this.escalatorRoute=new it.default(n)}initStraightLadderRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,n),this.straightLadderRoute=new it.default(n)}checkStart(n){return!(!n.floor||!n.nodeId&&(!n.coord||n.coord.length<2))}checkEnd(n){return n.facility?!0:this.checkStart(n)}transformStart(n){if(n.nodeId){let t=this.nodeMap.get(`${n.floor}${q}${n.nodeId}`);if(t){let[e,i]=t.split(q);return{floor:e,id:i}}}if(n.coord?.length){let t=this.roadInfo.find(i=>i.floor===n.floor);if(!t)return null;let e=t.points.reduce((i,r)=>{let s=I(n.coord,r.cds);return s<i.min&&(i.min=s,i.point=r),i},{min:1/0,point:t.points[0]});return{floor:e.point.floor,id:e.point.id}}return null}transformEnd(n){if(n.floor){let t=this.transformStart(n);if(t)return t}return n.facility&&this.facilityMap.get(n.facility)?.length?{floor:n.floor,facility:n.facility}:null}getPath(n,t,e=""){if(!this.checkStart(n))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(n);if(!i)return"no-start";let r=this.transformEnd(t);if(!r)return"no-end";let s=this.getBasePath.bind(this);switch(e){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(console.log(i,r),r.id)return s(i,r);if(r.facility){let l=this.facilityMap.get(r.facility).filter(a=>r.floor?a.floor===r.floor:!0);if(!l.length)return null;let u=l.map(a=>s(i,{floor:a.floor,id:a.id})).filter(a=>!!a);return u.reduce((a,h)=>{let p=h.reduce((f,m)=>f+ct(m.points),0);return p<a.distance&&(a.distance=p,a.path=h),a},{distance:1/0,path:u[0]}).path}}getRoutePath(n,t,e){let i=`${n.floor}${q}${n.id}`,r=`${t.floor}${q}${t.id}`,s=e.path(i,r);if(console.log(i,r,s),!s)return null;let l=[];return s.map(u=>{let a=this.pointMap.get(u);if(a){let{floor:h}=a;if(l[l.length-1]?.floor===h){let p=l[l.length-1];p.points.push(a.cds),p.endType=a.type,p.destId=a.nodeId}else l.push({floor:h,points:[a.cds],endType:a.type,destId:a.nodeId})}}),l}getBasePath(n,t){return this.getRoutePath(n,t,this.baseRoute)}getEscalatorPath(n,t){return this.getRoutePath(n,t,this.escalatorRoute)}getStraightLadderPath(n,t){return this.getRoutePath(n,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 it.default,this.escalatorRoute=new it.default,this.straightLadderRoute=new it.default}};var j=Se(Ae(),1);var G="___",Rn=class{constructor(n=3){this.lift_priority=n}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new j.default;escalatorRoute=new j.default;straightLadderRoute=new j.default;forwardLineMap=new Map;forwardRoute=new j.default;initRoute(n){this.clear(),this.roadInfo=n,n.length&&(n.forEach(t=>{t.points.forEach(e=>{let i=`${t.floor}${G}${e.id}`;if(this.pointMap.set(i,e),this.nodeMap.set(`${e.floor}${G}${e.nodeId}`,i),e.type==="straightLadder"){let r=this.straightLadderMap.get(e.name)||[];r.push({...e}),this.straightLadderMap.set(e.name,r)}if(e.type==="staircase"){let r=this.staircaseMap.get(e.name)||[];r.push({...e}),this.staircaseMap.set(e.name,r)}if(e.type==="escalator"){let r=this.escalatorMap.get(e.name)||{};e.escalatorDirection==="exit"?r.end={floor:e.floor,id:e.id}:r.start={floor:e.floor,id:e.id},this.escalatorMap.set(e.name,r)}if(e.type==="facility"){let r=this.facilityMap.get(e.targetId)||[];r.push({...e}),this.facilityMap.set(e.targetId,r)}e.type==="parkingSpace"&&this.parkingMap.set(`${e.floor}${G}${e.name}`,e)}),t.lines.filter(e=>e.direction!=="no").forEach(e=>{let i=`${t.floor}${G}${e.from}`,r=`${t.floor}${G}${e.to}`,s=this.pointMap.get(i)?.cds,l=this.pointMap.get(r)?.cds;if(s?.length&&l?.length){let u=I(s,l);switch(this.addLineItem(i,r,u),this.addLineItem(r,i,u),e.direction){case"double":this.addLineItem(i,r,u,this.forwardLineMap),this.addLineItem(r,i,u,this.forwardLineMap);break;case"single":this.addLineItem(i,r,u,this.forwardLineMap);break;case"back":this.addLineItem(r,i,u,this.forwardLineMap);break}}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}addLineItem(n,t,e,i=this.lineMap){let r=i.get(n)||new Map;r.set(t,e),i.set(n,r)}addFacilityToLineMap(n,t,e,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([r,s])=>{if(!(s.length<2))for(let l=0;l<s.length;l++){let u=`${s[l].floor}${G}${s[l].id}`;for(let a=0;a<s.length;a++)if(l!==a){let h=`${s[a].floor}${G}${s[a].id}`,p=this.pointMap.get(u)?.cds,f=this.pointMap.get(h)?.cds;if(p?.length&&f?.length)if(s[l].type==="straightLadder"){let m=t;this.addLineItem(u,h,m,i)}else{let m=e;this.addLineItem(u,h,m,i)}}}}),this.escalatorMap.forEach((r,s)=>{if(r.start&&r.end){let l=`${r.start.floor}${G}${r.start.id}`,u=`${r.end.floor}${G}${r.end.id}`,a=this.pointMap.get(l)?.cds,h=this.pointMap.get(u)?.cds;if(a?.length&&h?.length){let p=n;this.addLineItem(l,u,p,i)}}})}initBaseRoute(){let n=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,n),this.baseRoute=new j.default(n)}initEscalatorRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,n),this.escalatorRoute=new j.default(n)}initStraightLadderRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,n),this.straightLadderRoute=new j.default(n)}initForwardRoute(){this.forwardRoute=new j.default(this.forwardLineMap)}checkStart(n){return!(!n.floor||!n.nodeId&&(!n.coord||n.coord.length<2))}checkEnd(n){return n.facility||n.parkingSpace&&n.floor?!0:this.checkStart(n)}transformStart(n){if(n.nodeId){let t=this.nodeMap.get(`${n.floor}${G}${n.nodeId}`);if(t){let[e,i]=t.split(G);return{floor:e,id:i}}}if(n.coord?.length){let t=this.roadInfo.find(i=>i.floor===n.floor);if(!t)return null;let e=t.points.reduce((i,r)=>{let s=I(n.coord,r.cds);return s<i.min&&(i.min=s,i.point=r),i},{min:1/0,point:t.points[0]});return{floor:e.point.floor,id:e.point.id}}return null}transformEnd(n){if(n.floor){if(n.parkingSpace){let e=this.parkingMap.get(`${n.floor}${G}${n.parkingSpace}`);if(e)return{floor:e.floor,id:e.id}}let t=this.transformStart(n);if(t)return t}return n.facility&&this.facilityMap.get(n.facility)?.length?{floor:n.floor,facility:n.facility}:null}getPath(n,t,e=""){if(!this.checkStart(n))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(n);if(!i)return"no-start";let r=this.transformEnd(t);if(!r)return"no-end";let s=this.getBasePath.bind(this);switch(e){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;case"forward":s=this.getForwardPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(r.id)return s(i,r);if(r.facility){let l=this.facilityMap.get(r.facility).filter(a=>r.floor?a.floor===r.floor:!0);if(!l.length)return null;let u=l.map(a=>s(i,{floor:a.floor,id:a.id})).filter(a=>!!a);return u.reduce((a,h)=>{let p=h.reduce((f,m)=>f+ct(m.points),0);return p<a.distance&&(a.distance=p,a.path=h),a},{distance:1/0,path:u[0]}).path}}getRoutePath(n,t,e){let i=`${n.floor}${G}${n.id}`,r=`${t.floor}${G}${t.id}`,s=e.path(i,r);if(!s)return null;let l=[];return s.map(u=>{let a=this.pointMap.get(u);if(a){let{floor:h}=a;if(l[l.length-1]?.floor===h){let p=l[l.length-1];p.points.push(a.cds),p.endType=a.type,p.destId=a.nodeId,p.distance=ct(p.points)}else l.push({floor:h,points:[a.cds],endType:a.type,destId:a.nodeId,distance:0})}}),l}getBasePath(n,t){return this.getRoutePath(n,t,this.baseRoute)}getEscalatorPath(n,t){return this.getRoutePath(n,t,this.escalatorRoute)}getStraightLadderPath(n,t){return this.getRoutePath(n,t,this.straightLadderRoute)}getForwardPath(n,t){return this.getRoutePath(n,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 j.default,this.escalatorRoute=new j.default,this.straightLadderRoute=new j.default}};function In(o){return o.replace(/[A-Z]/g,n=>"_"+n.toLowerCase()).replace(/^_/,"")}var Nn=new Ct;function Lt(o,n,t){return new Promise((e,i)=>{let r=Nn.genUniqueKey(),s=({data:l})=>{l.type===`${n}_result`&&l.key===r&&(Nn.removeKey(r),self.removeEventListener("message",s),l.error?i(l.error):e(l.data))};o.addEventListener("message",s),o.postMessage({type:n,key:r,data:t})})}function qr(o){let n={};for(let e in o)e.startsWith("on")&&(n[In(e.slice(2))]=o[e]);let t=async({data:e})=>{if(n[e.type])try{let i=await n[e.type](e.data);self.postMessage({type:`${e.type}_result`,key:e.key,data:i})}catch(i){self.postMessage({type:`${e.type}_result`,key:e.key,error:i})}else self.postMessage({type:`${e.type}_result`,key:e.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var M=y("three"),bt=y("@tweenjs/tween.js");var qn=y("three");var b=y("three");var Re={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},U=class extends b.Object3D{constructor(t,e){super();this.context=t;if(this.options=wt({...Re,...e},this),this.options.geometry.type==="point"){let[i,r]=this.options.geometry.coords;return this.position.set(i,r,this.options.height+this.options.airHeight),this}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 b.Vector3,e=new b.Box3;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new b.Vector3(0,0,0);let t=new b.Box3,e=new b.Vector3;return t.setFromObject(this),t.getSize(e),e}getPosition(){let t=this.getCenter();return t.setZ(t.z+this.options.height/2),t}init(){this.initDoor(),this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){}initGeometry(){let t=nt(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new b.ExtrudeGeometry(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=this.context.materialFactory.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.height<=.1)return this.material=t,t;let e=this.context.materialFactory.createMeshBasicMaterial({color:ut(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let i=new b.Box3().setFromObject(this),r=t.clone().add(e.clone().multiplyScalar(1e3)),s=new b.Ray(r,e.clone().multiplyScalar(-1)),l=new b.Vector3;s.intersectBox(i,l);let u=t.clone().add(e.clone().multiplyScalar(-1e3)),a=new b.Ray(u,e.clone()),h=new b.Vector3;return a.intersectBox(i,h),{max:h,min:l}}initGradualMaterial(){let{max:t,min:e}=new b.Box3().setFromObject(this),i=t.clone().sub(e),r=Math.max(i.x,i.y,i.z)/2,s=this.getPosition(),l=new b.Vector3(-1,.2,0).normalize(),{max:u,min:a}=this.getMaxAndMin(s,l),h=this.context.materialFactory.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:r,opacity:this.options.fillOpacity,direction:new b.Vector3(-1,.2,0),max:u,min:a});if(this.options.height<=.1)return this.material=h,h;let p=this.getCenter(),f=new b.Vector3(-1,.2,1).normalize(),{max:m,min:c}=this.getMaxAndMin(p,f),d=this.context.materialFactory.createShaderMaterial({gradualColor:[ut(this.options.gradualColor[0],this.options.colorFactor),ut(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:r,opacity:this.options.fillOpacity,direction:new b.Vector3(-1,.2,1),max:m,min:c});return this.material=[h,d],[h,d]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){let t=this.context.materialFactory.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new b.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:i}=this.options.geometry;for(let r=0;r<i.length;r++){let s=i[r];for(let l=0;l<s.length;l++){let u=s[l],a=l+1===s.length?s[0]:s[l+1];t.push(new b.Vector3(u[0],u[1],e)),t.push(new b.Vector3(a[0],a[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new b.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new b.LineSegments(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 e=t.intersectObject(this.mesh);if(e[0]){let{point:i,distance:r}=e[0];return{position:i,distance:r}}return!1}dispose(){this.geometry?.dispose(),this.line?.geometry.dispose(),this.clear()}};var Y=y("three");var jt=class extends Y.Object3D{directionalLight;plane;basicOpacity=.07;constructor(){super(),this.directionalLight=this.initLight(),this.initPlane()}initLight(){let n=qe(16777215,.5);return n.position.set(0,0,100),this.add(n),n}changeLightCamera(n){let t=n.x,e=n.y;this.directionalLight.shadow.camera.left=-t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.top=e,this.directionalLight.shadow.camera.bottom=-e,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(t,e)}changeLightColor(n){this.directionalLight.color=new Y.Color(n)}setPosition(n){this.position.copy(n),this.directionalLight.position.set(-n.x/2,-n.y/2,100)}initPlane(n=1e3,t=1e3){let e=new Y.PlaneGeometry(n,t),i=new Y.ShadowMaterial({transparent:!0,opacity:0,side:Y.DoubleSide}),r=new Y.Mesh(e,i);return r.receiveShadow=!0,r.position.z=-10,this.add(r),this.plane=r,r}setTarget(n){this.directionalLight.target=n}transformOpacity(n){return n*this.basicOpacity}setOpacity(n){this.plane.material.opacity=this.transformOpacity(n)}dispose(){Z(this,!0)}};var $t=y("three");var S=y("three");var Dn=y("lodash");var zi={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},Yt=class extends S.EventDispatcher{constructor(t,e={}){super();this.context=t;this.options={...zi,...e},this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}div;element;position=new S.Vector3;clientPos={x:0,y:0};visible=!0;options;placement="top";observer=null;initObserver(){let t=new MutationObserver((0,Dn.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){if(this.element instanceof U&&this.element.options.geometry.type==="polygon"){let{max:r,min:s}=new S.Box3().setFromObject(this.element),l=(r.x+s.x)/2,u=(r.y+s.y)/2;return{left:new S.Vector3(s.x,u,r.z),leftTop:new S.Vector3(s.x,r.y,r.z),top:new S.Vector3(l,r.y,r.z),rightTop:new S.Vector3(r.x,r.y,r.z),right:new S.Vector3(r.x,u,r.z),rightBottom:new S.Vector3(r.x,s.y,r.z),bottom:new S.Vector3(l,s.y,r.z),leftBottom:new S.Vector3(s.x,s.y,r.z),center:new S.Vector3(l,u,r.z)}}let{x:t,y:e,z:i}=this.element?.getPosition?.()||this.position;return{left:new S.Vector3(t,e,i),leftTop:new S.Vector3(t,e,i),top:new S.Vector3(t,e,i),rightTop:new S.Vector3(t,e,i),right:new S.Vector3(t,e,i),rightBottom:new S.Vector3(t,e,i),bottom:new S.Vector3(t,e,i),leftBottom:new S.Vector3(t,e,i),center:new S.Vector3(t,e,i)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,i=this.getPlacementPosition();return Object.keys(i).reduce((r,s)=>{let{x:l,y:u}=E(i[s],this.context.camera,t,e);return r[s]={x:l,y:u},r},{})}checkOverflow(t,e){let{width:i,height:r}=this.context.clientSize;return e.x>0&&t.x<i&&e.y<r&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,i=this.getPlacementScreenPosition(),r=t/2,s=e/2,l=[{type:"center",getBox(u,a){return{max:{x:r+u,y:a-e},min:{x:u-r,y:a}}}},{type:"left",getBox(u,a){return{max:{x:u,y:a-s},min:{x:u-t,y:a+s}}}},{type:"leftTop",getBox(u,a){return{max:{x:u,y:a-e},min:{x:u-t,y:a}}}},{type:"top",getBox(u,a){return{max:{x:u+r,y:a-e},min:{x:u-r,y:a}}}},{type:"rightTop",getBox(u,a){return{max:{x:u+t,y:a-e},min:{x:u,y:a}}}},{type:"right",getBox(u,a){return{max:{x:u+t,y:a-s},min:{x:u,y:a+s}}}},{type:"rightBottom",getBox(u,a){return{max:{x:u+t,y:a},min:{x:u,y:a+e}}}},{type:"bottom",getBox(u,a){return{max:{x:u+r,y:a},min:{x:u-r,y:a+e}}}},{type:"leftBottom",getBox(u,a){return{max:{x:u,y:a},min:{x:u-t,y:a+s}}}}];for(let u=0;u<l.length;u++){let a=l[u],h=i[a.type],{max:p,min:f}=a.getBox(h.x,h.y);if(this.checkOverflow(p,f))return{type:a.type,position:h}}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,e="block"){t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=`${t}`}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new S.Box3().setFromObject(this.element).getCenter(new S.Vector3):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:i,height:r}=this.context.clientSize;return t>=0&&t<=i&&e>=0&&e<=r}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:i,height:r,x:s,y:l}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=`${s}px`,this.div.style.top=`${l+r}px`),this.options.autoUpdate?this.div.style.transform=`translate3d(${t}px, ${-r+e}px, 0)`:this.dispatchEvent({type:"update-position",x:t,y:e,width:i,height:r})}updatePosition(t=!1){let e=this.getPosition(),{width:i,height:r}=this.context.clientSize,{x:s,y:l}=E(e,this.context.camera,i,r);this.clientPos.x===s&&this.clientPos.y===l&&!t||this._updatePosition(s,l)}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 ki={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},vt=class extends $t.EventDispatcher{constructor(t,e){super();this.context=t;this.options=wt({...ki,...e},this),this.position.set(e.position?.x||0,e.position?.y||0,e.position?.z||0),this.overlay=new Yt(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",({x:i,y:r,height:s})=>{this.overlay.div.style.transform=`translate3d(calc(${i}px - 50%), calc(${-s+r}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 r=this.textDiv;if(r){let s=this.initText();this.div.replaceChild(s,r)}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 $t.Vector3;userData={};showTextStatus=!0;disposed=!1;get withinDisplayRange(){return this.overlay.withinDisplayRange}async resetSize(){if(await en(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+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(e=>{let i=document.createElement("div");if(i.style.whiteSpace="nowrap",e.styles)for(let[r,s]of Object.entries(e.styles))i.style[r]=s;i.textContent=e.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:e,height:i}=this.size,r=e*t,s=i*t,{x:l,y:u}=this.overlay.clientPos;return{left:l-r/2,right:l+r/2,top:this.options.icon?u-s:u-s/2,bottom:this.options.icon?u:u+s/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let i=this.getOriginBox();return t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}};var z=y("three");var O=y("three"),On=y("@mars3d/heatmap.js"),pt=y("@turf/turf"),Zt=class extends O.Object3D{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:e,height:i,leftTop:r,center:s}=this.getBox(t);this.heatmap=(0,On.create)({width:e,height:i,container:this.div,...this.context.config.heatMap}),this.heatmap.setData(this.transformData(t,r)),this.initPlane(e,i),this.position.set(s[0],s[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let i=new O.PlaneGeometry(t,e),r=new O.Texture(this.div.firstChild);r.needsUpdate=!0;let s=new O.MeshBasicMaterial({transparent:!0,side:O.DoubleSide,map:r});s.needsUpdate=!0,this.plane=new O.Mesh(i,s),this.add(this.plane)}getTransMatrix({x:t,y:e}){return new O.Matrix3().makeScale(1,-1).multiply(new O.Matrix3().makeTranslation(0-t,0-e))}transformData(t,e){let i=this.getTransMatrix(e);return{data:t.data.map(s=>{let l=new O.Vector2(s.x,s.y).applyMatrix3(i);return{x:l.x,y:l.y,value:s.value}}),max:t.max,min:t.min}}getBox(t){let e=(0,pt.featureCollection)(t.data.map(a=>(0,pt.point)([a.x,a.y]))),i=(0,pt.bbox)(e),r=i[2]-i[0],s=i[3]-i[1],l={x:i[0],y:i[3]},u=(0,pt.center)(e);return{width:r,height:s,leftTop:l,center:u.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}};var Jt=y("three");var Kt=class extends Jt.Object3D{constructor(t,e){super();this.context=t;this.options=e;this.position.copy(e.position||new Jt.Vector3(0,0,0)),this.loadModel()}model=null;async loadModel(){let t=await Xt(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t}dispose(){Z(this),this.model=null}};var te=y("three");var Fn=y("three");var B=class extends Fn.Object3D{constructor(t){super();this.context=t}dispose(){Z(this),this.children.forEach(t=>t.dispose?.()),this.clear()}};var Qt=class extends B{graphicMap=new Map;constructor(n){super(n)}getCenter(){return new te.Box3().setFromObject(this).getCenter(new te.Vector3)}createGraphic(n){let t=new U(this.context,n);return this.add(t),this.graphicMap.set(n.id,t),t}removeGraphic(n){this.remove(n),this.graphicMap.delete(n.options.id),n.dispose()}removeGraphicById(n){this.graphicMap.has(n)&&this.removeGraphic(this.graphicMap.get(n))}getGraphicByNodeId(n){return this.graphicMap.get(n)||null}getGraphicByRaycaster(n){let t={distance:1e4,graphic:null,position:null},e=this.children.reduce((i,r)=>{if(r instanceof U){let s=r.raycast(n);if(s){let{distance:l}=s;if(l<i.distance)return{distance:s.distance,position:s.position,graphic:r}}return i}else return i},t);return e===t?{graphics:[],position:null}:{graphics:[e.graphic],position:e.position}}};var Un=y("lodash");var At=class extends B{pois=[];debounceCollisionDetection;timer=new W;constructor(n){super(n),this.registryEvent(),this.debounceCollisionDetection=(0,Un.debounce)(this.collisionDetection,10)}clear(n=!1){return this.pois.forEach(t=>{t.options.built_in&&!n||t.dispose()}),this.pois=n?[]:this.pois.filter(t=>t.options.built_in),this}createPoi(n){let t=new vt(this.context,n);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(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),this.pushPoi(n))}removePoi(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),n.dispose())}removePoiById(n){let t=this.pois.find(e=>e.options.id===n);t&&this.removePoi(t)}getPoiById(n){return this.pois.find(e=>e.options.id===n)||null}pushPoi(n){if(!n.options.collision_enable){this.pois.unshift(n);return}if(n.options.level===0){this.pois.push(n);return}for(let t=0;t<this.pois.length;t++){let e=this.pois[t];if(e.options.collision_enable&&e.options.level<=n.options.level){this.pois.splice(t,0,n);return}}this.pois.push(n)}getPoiByDeviceXy(n,t){return this.pois.filter(i=>i instanceof vt&&i.isContain(n,t))}onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let n=[];this.pois.filter(e=>e.visible&&e.withinDisplayRange).forEach((e,i)=>{let{left:r,right:s,top:l,bottom:u}=e.getBox();if(i===0||!e.options.collision_enable){n.push({left:r,right:s,top:l,bottom:u}),e.parentSetVisible(!0);return}let a=n.some(h=>h.left<s&&h.right>r&&h.top<u&&h.bottom>l);e.parentSetVisible(!a),a||n.push({left:r,right:s,top:l,bottom:u})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(n=>n.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var Bn=y("lodash");var ne=y("three"),ee=class extends B{pois=[];debounceCollisionDetection;timer=new W;constructor(n){super(n),this.registryEvent(),this.debounceCollisionDetection=(0,Bn.debounce)(this.collisionDetection,10)}clear(){return this.pois.forEach(n=>{n.dispose()}),this.pois=[],this}createPoi(n){let t=new k(this.context,n);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(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),this.pushPoi(n))}removePoi(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.remove(n),this.pois.splice(t,1),n.dispose())}removePoiById(n){let t=this.pois.find(e=>e.options.id===n);t&&this.removePoi(t)}getPoiById(n){return this.pois.find(e=>e.options.id===n)||null}pushPoi(n){if(this.add(n),!n.options.collision_enable){this.pois.unshift(n);return}if(n.options.level===0){this.pois.push(n);return}for(let t=0;t<this.pois.length;t++){let e=this.pois[t];if(e.options.collision_enable&&e.options.level<=n.options.level){this.pois.splice(t,0,n);return}}this.pois.push(n)}getPoiByDeviceXy(n,t){let e=new ne.Vector2(n,t);return this.pois.filter(r=>r instanceof k&&r.canSelect&&r.box.containsPoint(e))}changeParkingSpaceVisibleByZoom=()=>{let n=this.parent?.parent;if(n&&n instanceof rt){let{clientSize:{width:t,height:e}}=this.context,{max:i,min:r}=n.box,l=Math.min(t/(i.x-r.x),e/(i.y-r.y))*(i.x-r.x)/200;this.pois.filter(u=>u.userData.type==="parkingSpace").map(u=>{let a=this.context.camera.zoom>=l;u.visible=a,a||u.parentSetVisible(a)})}};onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let n=[],{camera:t}=this.context;t.updateMatrixWorld();let e=s=>s<=1&&s>=-1,i=t.projectionMatrix.clone();i.multiply(t.matrixWorldInverse),this.pois.filter(s=>{if(s.visible){let l=new ne.Vector3().setFromMatrixPosition(s.matrixWorld);return l.applyMatrix4(i),s.screenPosition=l,e(l.x)&&e(l.y)&&e(l.z)}return!1}).forEach((s,l)=>{let u=s.getBox(s.screenPosition);if(l===0||!s.options.collision_enable){n.push(u),s.parentSetVisible(!0);return}let a=n.some(h=>h.intersectsBox(u));s.parentSetVisible(!a),a||n.push(u)})}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(n=>n.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var rt=class extends z.Object3D{constructor(t){super();this.context=t;this.groundLayer=new B(this.context),this.graphicLayer=new Qt(this.context),this.poiLayer=new At(this.context),this.poiLayer2=new ee(this.context),this.wallLayer=new B(this.context),this.textureLayer=new B(this.context),this.glbModelLayer=new B(this.context),this.laneLayer=new B(this.context),this.mergeGraphicLayer=new B(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.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}graphicLayer;poiLayer;poiLayer2;wallLayer;textureLayer;glbModelLayer;laneLayer;mergeGraphicLayer;grounds=new Set;groundLayer;shadow=new jt;heatmap;groundUpper=new z.Object3D;models=new z.Object3D;modelMap=new Map;groundMaxHeight=0;name="";key="";box=new z.Box3;getPosition(){return this.box.getCenter(new z.Vector3)}createGround(t){let e=new U(this.context,t);this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(e.mesh.castShadow=!0,this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new z.Box3().setFromObject(this).getCenter(new z.Vector3)}addModel(t){let e=new Kt(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new z.Box3().setFromObject(this.groundUpper),e=t.getCenter(new z.Vector3),i=t.getSize(new z.Vector3);this.shadow.setPosition(e),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 Zt(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new z.Box3().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(e.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),this.wallLayer.children.forEach(t=>{t.changeWorldPoint(this.box.max,this.box.min)})}dispose(){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.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()}};var ie=y("three");var ot=class extends ie.EventDispatcher{constructor(t){super();this.context=t;this.svg=tn(`${t.container.clientWidth}`,`${t.container.clientHeight}`),t.container.appendChild(this.svg),this._registryEvent()}points=[];svg;enable=!0;_onResize=({width:t,height:e})=>{this.svg&&(this.svg.setAttribute("width",`${t}`),this.svg.setAttribute("height",`${e}`))};_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:e,renderer:i}=this.context,{offsetX:r,offsetY:s}=t,{clientWidth:l,clientHeight:u}=i.domElement,a=r/l*2-1,h=1-s/u*2;return new ie.Vector3(a,h,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:i}=this.context;return E(t,e,i.clientWidth,i.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}};var re=class extends ot{constructor(t){super(t);this.context=t;let{config:{svg:{circle:e,line:i}}}=t;this.circles=[It(e.radius,e.fill),It(e.radius,e.fill)],this.line=Vt(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]);_t(this.circles[0],t.x,t.y),K(this.line,t)}if(this.points[1]){let t=this.getSvgCoordinate(this.points[1]);_t(this.circles[1],t.x,t.y),K(this.line,void 0,t)}};onPointermove=t=>{this.points.length===1&&(this.line.style.display="block",K(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 e=this.getIntersectByPointerEvent(t);if(e){let{offsetX:i,offsetY:r}=t,s=this.circles[this.points.length];_t(s,i,r),this.points.length||K(this.line,{x:i,y:r},{x:i,y:r}),this.addPoint(e)}};addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:i,y:r}]=this.points;return Math.sqrt((i-t)**2+(r-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}};var oe=class extends ot{circles=[];lines=[];isClose=!1;constructor(n){super(n),this.registryEvent()}setEnable(n){super.setEnable(n),n?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(n){this.circles.push(n),this.svg.appendChild(n)}addLine(n){this.lines.push(n),this.svg.appendChild(n)}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((n,t)=>{let e=this.getSvgCoordinate(n);this.circles[t]&&_t(this.circles[t],e.x,e.y),t!==0&&K(this.lines[t-1],void 0,e),this.lines[t]&&K(this.lines[t],e)})};onPointermove=n=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",K(this.lastLine,void 0,{x:n.offsetX,y:n.offsetY}))};onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")};onPointerdown=n=>{if(this.isClose)return;let t=this.getIntersectByPointerEvent(n);if(t){let{offsetX:e,offsetY:i}=n;this.checkAdsorb(e,i)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(t);let{circle:{fill:r,radius:s},line:{stroke:l}}=this.context.config.svg;if(!this.isClose){let u=It(s,r);_t(u,e,i),this.addCircle(u)}if(this.lines.length&&K(this.lastLine,void 0,{x:e,y:i}),!this.isClose){let u=Vt(l);K(u,{x:e,y:i},{x:e,y:i}),this.addLine(u)}}};checkAdsorb(n,t){if(this.points.length<3)return!1;let e=this.circles[0],i=+e.getAttribute("cx"),r=+e.getAttribute("cy");return Math.sqrt((n-i)**2+(t-r)**2)<=5}addPoint(n){if(this.points.push(n),this.isClose){let t=this.calculatedArea();this.dispatchEvent({type:"area",area:t})}}calculatedArea(){let n=this.points.map(i=>[i.x,i.y]),t=0,e=n.length;for(let i=0;i<e;i++){let r=(i+1)%e;t+=n[i][0]*n[r][1]-n[r][0]*n[i][1]}return Math.abs(t/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}};var zn=y("three");var Gn=class extends ot{constructor(t){super(t);this.context=t;let{config:{svg:{line:e}}}=t;this.rect=Tt(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let i=0;i<4;i++)this.cornerRect[i]=Tt(e.stroke,"#ffffff"),this.centerRect[i]=Tt(e.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 zn.Box3().setFromObject(this.graphic),{camera:e,container:{clientWidth:i,clientHeight:r}}=this.context,{min:s,max:l}=t,u=E(s,e,i,r),a=E(l,e,i,r);J(this.rect,u.x,a.y,Math.abs(a.x-u.x),Math.abs(a.y-u.y));let{x:h,y:p}=u,{x:f,y:m}=a,c=5,d=[{x:h-c,y:m-c},{x:f-c,y:m-c},{x:h-c,y:p-c},{x:f-c,y:p-c}];for(let x=0;x<d.length;x++)J(this.cornerRect[x],d[x].x,d[x].y,c*2,c*2);let g=4,v=(h+f)/2,L=(p+m)/2,C=[{x:v-g,y:m-g},{x:h-g,y:L-g},{x:f-g,y:L-g},{x:v-g,y:p-g}];for(let x=0;x<C.length;x++)J(this.centerRect[x],C[x].x,C[x].y,g*2,g*2)}else{J(this.rect,0,0,0,0);for(let t=0;t<this.cornerRect.length;t++)J(this.cornerRect[t],0,0,0,0),J(this.centerRect[t],0,0,0,0)}};selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}};var P=y("three");var Ie=y("three/examples/jsm/utils/BufferGeometryUtils"),se=class extends P.Object3D{constructor(t,e){super();this.context=t;this.options=e;e.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;maxWorldPoint=new P.Vector3(100,100,5);minWorldPoint=new P.Vector3(-100,-100,0);initGeometry(){let t=this.options.map(e=>{let i=nt(e.geometry.coords[0],e.geometry.coords.slice(1));return new P.ExtrudeGeometry(i,{steps:1,bevelEnabled:!1,depth:e.height,curveSegments:4})});this.geometry=(0,Ie.mergeGeometries)(t),t.forEach(e=>e.dispose())}initMaterial(){let t=`
|
|
2
2
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
3
3
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
4
4
|
uniform vec3 uColor;
|
|
@@ -6,25 +6,34 @@
|
|
|
6
6
|
uniform float uOpacity;
|
|
7
7
|
|
|
8
8
|
void main() {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
vPosition = position; // \u5411\u7247\u6BB5\u7740\u8272\u5668\u4F20\u9012\u4F4D\u7F6E
|
|
10
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
11
11
|
}
|
|
12
12
|
`,e=`
|
|
13
13
|
varying vec3 vPosition; // \u63A5\u6536\u9876\u70B9\u4F4D\u7F6E
|
|
14
14
|
uniform float maxZ;
|
|
15
15
|
uniform vec3 uColor;
|
|
16
|
-
uniform vec3
|
|
16
|
+
uniform vec3 uGradualColor1;
|
|
17
|
+
uniform vec3 uGradualColor2;
|
|
17
18
|
uniform float uOpacity;
|
|
19
|
+
uniform vec3 uMax;
|
|
20
|
+
uniform vec3 uMin;
|
|
18
21
|
|
|
19
22
|
void main() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
// \u5224\u65AD\u5F53\u524D\u9876\u70B9\u662F\u5426\u4E3A\u9876\u9762
|
|
24
|
+
if (vPosition.z >= maxZ) {
|
|
25
|
+
gl_FragColor = vec4(uColor, uOpacity); //\uFF08\u9876\u9762\u989C\u8272\uFF09
|
|
26
|
+
} else {
|
|
27
|
+
// \u8BA1\u7B97\u6E10\u53D8\u7684\u989C\u8272
|
|
28
|
+
vec3 lineVec = uMax - uMin; // \u7EBF\u6BB5AB\u7684\u65B9\u5411\u5411\u91CF
|
|
29
|
+
vec3 AP = vPosition - uMin; // \u5411\u91CFAP
|
|
30
|
+
float t = dot(AP, lineVec) / dot(lineVec, lineVec); // \u53C2\u6570t
|
|
31
|
+
// t = clamp(t, 0.0, 1.0); // \u9650\u5236t\u5728[0, 1]\u8303\u56F4\u5185\uFF0C\u786E\u4FDD\u6700\u77ED\u8DDD\u79BB\u5728\u7EBF\u6BB5AB\u4E0A
|
|
32
|
+
vec3 vColor = mix(uGradualColor1, uGradualColor2, 1.0 - t);
|
|
33
|
+
gl_FragColor = vec4(vColor, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
34
|
+
}
|
|
26
35
|
}
|
|
27
|
-
`,i=-1/0,r=this.geometry.getAttribute("position");if(r)for(let
|
|
36
|
+
`,i=-1/0,r=this.geometry.getAttribute("position");if(r)for(let l=0;l<r.count;l++){let u=r.getZ(l);u>i&&(i=u)}let s=new P.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new P.Color(this.options[0].fillColor)},uGradualColor1:{value:new P.Color(ut(this.options[0].fillColor,.95))},uGradualColor2:{value:new P.Color(ut(this.options[0].fillColor,.7))},uOpacity:{value:this.options[0].fillOpacity},uMax:{value:this.maxWorldPoint},uMin:{value:this.minWorldPoint}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=s}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],i=this.context.materialFactory.createLineMaterial({color:t,opacity:e});return this.lineMaterial=i,i}getBorderPoints(t){let{height:e,deltaHeight:i,geometry:r}=t,s=[],l=e+(i||0),{coords:u}=r;for(let a=0;a<u.length;a++){let h=u[a];for(let p=0;p<h.length;p++){let f=h[p],m=p+1===h.length?h[0]:h[p+1];s.push(new P.Vector3(f[0],f[1],l)),s.push(new P.Vector3(m[0],m[1],l))}}return s}initLineGeometry(){let t=this.options.map(e=>{let i=this.getBorderPoints(e);return new P.BufferGeometry().setFromPoints(i)});this.lineGeometry=(0,Ie.mergeGeometries)(t)}createBorder(){let t=new P.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new P.Mesh(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}changeWorldPoint(t,e){this.maxWorldPoint=t,this.minWorldPoint=e,this.material&&(this.material.uniforms.uMax.value=t,this.material.uniforms.uMin.value=e)}dispose(){this.geometry?.dispose(),this.material?.dispose(),this.lineGeometry?.dispose(),this.clear()}};var $=y("three"),kn=y("three/examples/jsm/utils/BufferGeometryUtils"),Vi={uuid:"",iconUrl:"",name:"",airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},Dt=class extends $.Object3D{constructor(t,e){super();this.context=t;this.options=e.map(i=>({...Vi,...i})),this.init()}options;mesh;async init(){let t=this.options.map(s=>{let{geometry:l}=s,u=nt(l.coords[0],l.coords.slice(1)),a=new $.ShapeGeometry(u,4),h=s.height+s.deltaHeight+s.airHeight,p=a.getAttribute("position");for(let m=0;m<p.count;m++)p.setZ(m,h);let f=[0,1,1,1,1,0,0,0];return a.setAttribute("uv",new $.Float32BufferAttribute(f,2)),a}),e=(0,kn.mergeGeometries)(t,!0);t.forEach(s=>s.dispose());let i=await Promise.all(this.options.map(async s=>{let{iconUrl:l}=s,u=await this.context.textureFactory.getTexture(l);return new $.MeshBasicMaterial({map:u,alphaTest:.5,side:$.DoubleSide})})),r=new $.Mesh(e,i);this.mesh=r,this.position.z+=.004,this.add(r)}dispose(){this.mesh?.geometry.dispose(),(this.mesh?.material).forEach(t=>t.dispose()),this.clear()}};var ft=y("three");var Hi={url:"",geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},id:"",width:0,rotate:1,airHeight:1,deltaHeight:0,center_x:0,center_y:0},ae=class extends ft.Object3D{constructor(t,e){super();this.context=t;this.options=Object.assign({},Hi,e),this.loadModel()}model=null;options;async loadModel(){let t=await Xt(this.options.url);t.scene.rotation.set(Math.PI/2,0,0);let i=new ft.Box3().setFromObject(t.scene).getSize(new ft.Vector3),r=Math.max(i.x,i.y),s=this.options.width/r;this.scale.set(s,s,s),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 ft.Mesh&&(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(){Z(this),this.model=null}};var V=y("three");var Ne=y("three/examples/jsm/utils/BufferGeometryUtils"),Vn=y("three/examples/jsm/lines/Line2"),Hn=y("three/examples/jsm/lines/LineGeometry"),le=class extends V.Object3D{constructor(t,e){super();this.context=t;this.options=e;e.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;doubleLines=[];initGeometry(){let t=this.options.map(e=>{let i=nt(e.geometry.coords[0].slice(0,-1),e.geometry.coords.slice(1)),r=new V.ShapeGeometry(i,4),s=r.getAttribute("position");for(let l=0;l<s.count;l++)s.setZ(l,e.airHeight+(e.deltaHeight||0));return r});this.geometry=(0,Ne.mergeGeometries)(t),t.forEach(e=>e.dispose())}initMaterial(){let{fillColor:t,fillOpacity:e}=this.options[0],i=this.context.materialFactory.createMeshBasicMaterial({color:t,opacity:e});return this.material=i,i}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],i=this.context.materialFactory.createLineMaterial({color:t,opacity:e});return this.lineMaterial=i,i}getBorderPoints(t){let{deltaHeight:e,geometry:i}=t,r=[],s=e||0,{coords:l}=i;for(let u=0;u<l.length;u++){let a=l[u];for(let h=0;h<a.length;h++){let p=a[h],f=h+1===a.length?a[0]:a[h+1];r.push(new V.Vector3(p[0],p[1],s)),r.push(new V.Vector3(f[0],f[1],s))}}return r}initDoubleLine(){let t=this.options.filter(i=>i.double&&i.geometry.otherCoords?.[1]?.length);if(!t.length)return;let e=t.reduce((i,r)=>{let s=`${r.secondColor}-${r.dashed}`;return i[s]&&i[s].push(r),i[s]||(i[s]=[r]),i},{});this.doubleLines=Object.values(e).map(i=>{let r=this.context.materialFactory.createLine2MaterialMap({color:i[0].secondColor,width:.2,dashed:i[0].dashed});return i.map(s=>{let l=new Hn.LineGeometry,u=s.geometry.otherCoords[1].map(h=>[...h,s.airHeight+(s.deltaHeight||0)]).flat(2);l.setPositions(u);let a=new Vn.Line2(l,r);return a.computeLineDistances(),a.position.z+=.001,this.add(a),a})}).flat(2)}initLineGeometry(){let t=this.options.map(e=>{let i=this.getBorderPoints(e);return new V.BufferGeometry().setFromPoints(i)});this.lineGeometry=(0,Ne.mergeGeometries)(t)}createBorder(){let t=new V.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new V.Mesh(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()}};var N=y("three");var Wn=y("three/examples/jsm/utils/BufferGeometryUtils"),ue=class extends N.Object3D{constructor(t,e){super();this.context=t;this.options=e.map(i=>({...Re,...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 r=nt(i.geometry.coords[0],i.geometry.coords.slice(1));return new N.ExtrudeGeometry(r,{steps:1,bevelEnabled:!1,depth:i.height,curveSegments:4})}),e=(0,Wn.mergeGeometries)(t);return t.forEach(i=>i.dispose()),e}initMaterial(){let t=`
|
|
28
37
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
29
38
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
30
39
|
uniform vec3 uColor;
|
|
@@ -50,7 +59,7 @@
|
|
|
50
59
|
gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
51
60
|
}
|
|
52
61
|
}
|
|
53
|
-
`,i=-1/0,r=this.geometry.getAttribute("position");if(r)for(let a=0;a<r.count;a++){let u=r.getZ(a);u>i&&(i=u)}let s=new N.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new N.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new N.Color(ct(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e});this.material=s}initLineMaterial(){let t=this.context.materialFactory.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 N.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(i=>{let{coords:r}=i.geometry;for(let s=0;s<r.length;s++){let a=r[s];for(let u=0;u<a.length;u++){let l=a[u],h=u+1===a.length?a[0]:a[u+1];t.push(new N.Vector3(l[0],l[1],e)),t.push(new N.Vector3(h[0],h[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new N.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new N.LineSegments(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()}};var F=y("three"),Wi={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},k=class extends F.Object3D{constructor(t,e){super();this.context=t;this.options=St({...Wi,...e},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 F.Box2;boxHelper;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(){let{offset:t,iconHeight:e,durIconAndText:i,textHeight:r}=this,s=t*(e+i+r)/this.context.camera.zoom;return s+=.1,s}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.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})})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}async initIcon(){if(this.options.icon){let t=await Ke(this.options.icon),e=new F.Sprite(new F.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:!1}));e.visible=!1,e.renderOrder=1e5,t.needsUpdate=!0,this.add(e),this.spriteIcon=e}}initText(){if(this.options.text){let t=Ye(this.options.text);this.textAspect=t.image.width/t.image.height;let e=new F.Sprite(new F.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:!1}));e.visible=!1,e.renderOrder=100001,t.needsUpdate=!0,this.spriteText=e,this.add(e)}}initSize(){let t=0,e=0,{icon:i,text:r}=this.options;i?r?(t=0,e=t*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(t=.5,e=0):r?(e=.5,t=0):(t=0,e=0),this.spriteIcon?.center.set(.5,t),this.spriteText?.center.set(.5,e)}async init(){await this.initIcon(),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}_initScale=({zoom:t})=>{if(this.spriteText){let e=this.textHeight/t;this.spriteText.scale.set(this.textAspect*e,e,.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:e,height:i}}=this.context,r=e*(t.x+1)/2,s=i*(-t.y+1)/2;s+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let a=this.iconWidth/2,u=new F.Box2(new F.Vector2(r-a,s-this.iconHeight),new F.Vector2(r+a,s)),l=this.textWidth/2,h=new F.Box2(new F.Vector2(r-l,s-this.textHeight-this.durIconAndText-this.iconHeight),new F.Vector2(r+l,s-this.iconHeight-this.durIconAndText));return this.box=h.union(u),this.box}renderBoxHelper(){if(!this.boxHelper){let t=document.createElement("div");t.style.position="fixed",this.boxHelper=t,t.style.border="1px solid red",t.style.pointerEvents="none",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}};var Xn=y("three"),he=class extends ot{startPoint;endPoint;rect;frustum=new Xn.Frustum;constructor(n){super(n);let{config:{selectBox:{fill:t,stroke:e}}}=n;this.rect=wt(e,t),this.svg.appendChild(this.rect),this.registryEvent()}setEnable(n){super.setEnable(n),J(this.rect,0,0,0,0),n?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}onPointerDown=n=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(n);t&&(this.startPoint=t),this.endPoint=void 0};onPointerMove=n=>{if(!this.enable||!this.startPoint)return;let t=this.getIntersectByPointerEvent(n);t&&(this.endPoint=t)};onPointerUp=n=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(n);t&&(this.endPoint=t),this.doSelect(),this.startPoint=void 0};onUpdate=()=>{if(this.startPoint){let n=this.getSvgCoordinate(this.startPoint),t={...n};this.endPoint&&(t=this.getSvgCoordinate(this.endPoint));let e={x:Math.min(n.x,t.x),y:Math.min(n.y,t.y)},i=Math.abs(t.x-n.x),r=Math.abs(t.y-n.y);J(this.rect,e.x,e.y,i,r)}else J(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:e,clientHeight:i}}}=this,r=E(this.startPoint,t,e,i),s=E(this.endPoint,t,e,i),a={x:Math.min(r.x,s.x),y:Math.min(r.y,s.y)},u={x:Math.max(r.x,s.x),y:Math.max(r.y,s.y)},l=this.searchMapInFrustum(a,u);this.dispatchEvent({type:"selected",list:l})}}searchMapInFrustum(n,t){let{context:e}=this;return e.currentFloor?.graphicLayer.children.filter(i=>i instanceof U&&this.searchChildInFrustum(i,n,t))||[]}searchChildInFrustum(n,t,e){let{context:{camera:i,container:{clientWidth:r,clientHeight:s}}}=this;if(!n)return!1;if(!n.mesh){let f=n.getPosition();if(f){let m=E(f,i,r,s);return Gt(m,t,e)}return!1}n.mesh.geometry.boundingBox||n.mesh.geometry.computeBoundingBox();let a=n.mesh.geometry.boundingBox;if(!a)return!1;let{min:u,max:l}=a,h=E(u,i,r,s),p=E(l,i,r,s);return!(!Gt(h,t,e)||!Gt(p,t,e))}dispose(){this.unRegistryEvent()}};var ce=class extends qn.EventDispatcher{constructor(t){super();this.context=t;this.boxSelection=new he(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.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:e,offsetY:i}=t,{x:r,y:s}=this.downPoint;if(Math.sqrt((r-e)**2+(s-i)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(e,i),u=new Set(a.map(h=>h.options.id));this.context.getPoisByDeviceXy(e,i).forEach(h=>{if(!u.has(h.options.id)){let p=this.context.currentFloor?.graphicLayer.graphicMap.get(h.options.id)||null;p&&p.options.geometry.type==="point"&&(a.push(p),u.add(h.options.id))}}),(qt?t.metaKey:t.ctrlKey)||this._list.clear(),a.forEach(h=>this._list.add(h)),this.selectEnd(),this.downPoint=null};onPointerOut=t=>{this.disableBoxSelection()};onKeyDown=t=>{Te(t.key)&&this.enableBoxSelection()};onKeyUp=t=>{Te(t.key)&&this.disableBoxSelection()};onBoxSelected=({list:t})=>{this._list.clear(),t.forEach(e=>{this._list.add(e)}),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()}};var fe=y("three");var pe=class extends fe.EventDispatcher{constructor(t){super();this.context=t;this.registryEvent()}curGraphics=new Set;timer=new W;graphicTimerMap=new Map;onPointerMove=({graphics:t,pois:e,e:i})=>{let r=e.map(l=>this.context.currentFloor?.graphicLayer.graphicMap.get(l.options.id)).filter(l=>l&&l.options.geometry.type==="point");if(!t.length&&!r.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:s}=this.context.config.hover,a=new Set;if(r.length){let l,h=1e4;r.forEach(p=>{let f=e.find(m=>m.options.id===p.options.id);if(f instanceof _t){let{x:m,y:c}=f.clientPos,d=Math.sqrt((m-i.offsetX)**2+(c-i.offsetY)**2);d<h&&(h=d,l=p)}else if(f instanceof k){let{x:m,y:c}=f.box.getCenter(new fe.Vector2),d=Math.sqrt((m-i.offsetX)**2+(c-i.offsetY)**2);d<h&&(h=d,l=p)}}),a.add(l)}a.size||t.forEach(l=>a.add(l)),a.forEach(l=>{if(this.graphicTimerMap.get(l)||this.curGraphics.has(l))return;let h=this.timer.setTimeout(()=>{this.curGraphics.add(l),this.graphicTimerMap.delete(l),this.timer.clearTimeout(h),this.handleHoverGraphicsChange()},s);this.graphicTimerMap.set(l,h)}),this.graphicTimerMap.forEach((l,h)=>{a.has(h)||(this.timer.clearTimeout(l),this.graphicTimerMap.delete(h))});let u=this.curGraphics.size;this.curGraphics.forEach(l=>{a.has(l)||this.curGraphics.delete(l)}),u!==this.curGraphics.size&&this.handleHoverGraphicsChange()};onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()};onBodyPointerMove=t=>{if(this.curGraphics.size){let e=this.context.container.getBoundingClientRect();(t.clientX<e.left||t.clientX>e.right||t.clientY<e.top||t.clientY>e.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()}};var Yn=y("three/examples/jsm/lines/LineMaterial"),A=y("three");function jn(o){return`${o.x}-${o.y}-${o.z}`}var de=class{constructor(n){this.context=n}lineMaterialMap=new Map;meshStandardMaterialMap=new Map;meshBasicMaterialMap=new Map;shaderMaterialMap=new Map;groundTextureMaterialMap=new Map;line2MaterialMap=new Map;generateLineMaterialKey({color:n,opacity:t}){return`${n}-${t}`}createLineMaterial({color:n,opacity:t}){let e=this.generateLineMaterialKey({color:n,opacity:t});if(this.lineMaterialMap.has(e))return this.lineMaterialMap.get(e);let i=new A.LineBasicMaterial({color:new A.Color(n).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(e,i),i}createMeshStandardMaterial({color:n,opacity:t}){let e=`${n}-${t}`;if(this.meshStandardMaterialMap.has(e))return this.meshStandardMaterialMap.get(e);let i=new A.MeshStandardMaterial({color:new A.Color(n).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(e,i),i}createMeshBasicMaterial({color:n,opacity:t}){let e=`${n}-${t}`;if(this.meshBasicMaterialMap.has(e))return this.meshBasicMaterialMap.get(e);let i=new A.MeshBasicMaterial({color:n,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(e,i),i}createShaderMaterial({gradualColor:n,center:t,maxValue:e,opacity:i,direction:r,max:s,min:a}){let u=`${n.toString()}-${jn(t)}-${e}-${i}-${jn(r)}`;if(this.shaderMaterialMap.has(u))return this.shaderMaterialMap.get(u);let l=`
|
|
62
|
+
`,i=-1/0,r=this.geometry.getAttribute("position");if(r)for(let l=0;l<r.count;l++){let u=r.getZ(l);u>i&&(i=u)}let s=new N.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new N.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new N.Color(ut(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=s}initLineMaterial(){let t=this.context.materialFactory.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 N.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(i=>{let{coords:r}=i.geometry;for(let s=0;s<r.length;s++){let l=r[s];for(let u=0;u<l.length;u++){let a=l[u],h=u+1===l.length?l[0]:l[u+1];t.push(new N.Vector3(a[0],a[1],e)),t.push(new N.Vector3(h[0],h[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new N.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new N.LineSegments(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()}};var F=y("three"),Wi={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},k=class extends F.Object3D{constructor(t,e){super();this.context=t;this.options=wt({...Wi,...e},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 F.Box2;boxHelper;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(){let{offset:t,iconHeight:e,durIconAndText:i,textHeight:r}=this,s=t*(e+i+r)/this.context.camera.zoom;return s+=.1,s}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.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})})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}async initIcon(){if(this.options.icon){let t=await Ke(this.options.icon),e=new F.Sprite(new F.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:!1}));e.visible=!1,e.renderOrder=1e5,t.needsUpdate=!0,this.add(e),this.spriteIcon=e}}initText(){if(this.options.text){let t=Ye(this.options.text);this.textAspect=t.image.width/t.image.height;let e=new F.Sprite(new F.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:!1}));e.visible=!1,e.renderOrder=100001,t.needsUpdate=!0,this.spriteText=e,this.add(e)}}initSize(){let t=0,e=0,{icon:i,text:r}=this.options;i?r?(t=0,e=t*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(t=.5,e=0):r?(e=.5,t=0):(t=0,e=0),this.spriteIcon?.center.set(.5,t),this.spriteText?.center.set(.5,e)}async init(){await this.initIcon(),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}_initScale=({zoom:t})=>{if(this.spriteText){let e=this.textHeight/t;this.spriteText.scale.set(this.textAspect*e,e,.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:e,height:i}}=this.context,r=e*(t.x+1)/2,s=i*(-t.y+1)/2;s+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let l=this.iconWidth/2,u=new F.Box2(new F.Vector2(r-l,s-this.iconHeight),new F.Vector2(r+l,s)),a=this.textWidth/2,h=new F.Box2(new F.Vector2(r-a,s-this.textHeight-this.durIconAndText-this.iconHeight),new F.Vector2(r+a,s-this.iconHeight-this.durIconAndText));return this.box=h.union(u),this.box}renderBoxHelper(){if(!this.boxHelper){let t=document.createElement("div");t.style.position="fixed",this.boxHelper=t,t.style.border="1px solid red",t.style.pointerEvents="none",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}};var Xn=y("three"),he=class extends ot{startPoint;endPoint;rect;frustum=new Xn.Frustum;constructor(n){super(n);let{config:{selectBox:{fill:t,stroke:e}}}=n;this.rect=Tt(e,t),this.svg.appendChild(this.rect),this.registryEvent()}setEnable(n){super.setEnable(n),J(this.rect,0,0,0,0),n?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}onPointerDown=n=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(n);t&&(this.startPoint=t),this.endPoint=void 0};onPointerMove=n=>{if(!this.enable||!this.startPoint)return;let t=this.getIntersectByPointerEvent(n);t&&(this.endPoint=t)};onPointerUp=n=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(n);t&&(this.endPoint=t),this.doSelect(),this.startPoint=void 0};onUpdate=()=>{if(this.startPoint){let n=this.getSvgCoordinate(this.startPoint),t={...n};this.endPoint&&(t=this.getSvgCoordinate(this.endPoint));let e={x:Math.min(n.x,t.x),y:Math.min(n.y,t.y)},i=Math.abs(t.x-n.x),r=Math.abs(t.y-n.y);J(this.rect,e.x,e.y,i,r)}else J(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:e,clientHeight:i}}}=this,r=E(this.startPoint,t,e,i),s=E(this.endPoint,t,e,i),l={x:Math.min(r.x,s.x),y:Math.min(r.y,s.y)},u={x:Math.max(r.x,s.x),y:Math.max(r.y,s.y)},a=this.searchMapInFrustum(l,u);this.dispatchEvent({type:"selected",list:a})}}searchMapInFrustum(n,t){let{context:e}=this;return e.currentFloor?.graphicLayer.children.filter(i=>i instanceof U&&this.searchChildInFrustum(i,n,t))||[]}searchChildInFrustum(n,t,e){let{context:{camera:i,container:{clientWidth:r,clientHeight:s}}}=this;if(!n)return!1;if(!n.mesh){let f=n.getPosition();if(f){let m=E(f,i,r,s);return Gt(m,t,e)}return!1}n.mesh.geometry.boundingBox||n.mesh.geometry.computeBoundingBox();let l=n.mesh.geometry.boundingBox;if(!l)return!1;let{min:u,max:a}=l,h=E(u,i,r,s),p=E(a,i,r,s);return!(!Gt(h,t,e)||!Gt(p,t,e))}dispose(){this.unRegistryEvent()}};var ce=class extends qn.EventDispatcher{constructor(t){super();this.context=t;this.boxSelection=new he(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.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:e,offsetY:i}=t,{x:r,y:s}=this.downPoint;if(Math.sqrt((r-e)**2+(s-i)**2)>3)return;let{graphics:l}=this.context.getGraphicsByDeviceXy(e,i),u=new Set(l.map(h=>h.options.id));this.context.getPoisByDeviceXy(e,i).forEach(h=>{if(!u.has(h.options.id)){let p=this.context.currentFloor?.graphicLayer.graphicMap.get(h.options.id)||null;p&&p.options.geometry.type==="point"&&(l.push(p),u.add(h.options.id))}}),(qt?t.metaKey:t.ctrlKey)||this._list.clear(),l.forEach(h=>this._list.add(h)),this.selectEnd(),this.downPoint=null};onPointerOut=t=>{this.disableBoxSelection()};onKeyDown=t=>{Te(t.key)&&this.enableBoxSelection()};onKeyUp=t=>{Te(t.key)&&this.disableBoxSelection()};onBoxSelected=({list:t})=>{this._list.clear(),t.forEach(e=>{this._list.add(e)}),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()}};var fe=y("three");var pe=class extends fe.EventDispatcher{constructor(t){super();this.context=t;this.registryEvent()}curGraphics=new Set;timer=new W;graphicTimerMap=new Map;onPointerMove=({graphics:t,pois:e,e:i})=>{let r=e.map(a=>this.context.currentFloor?.graphicLayer.graphicMap.get(a.options.id)).filter(a=>a&&a.options.geometry.type==="point");if(!t.length&&!r.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:s}=this.context.config.hover,l=new Set;if(r.length){let a,h=1e4;r.forEach(p=>{let f=e.find(m=>m.options.id===p.options.id);if(f instanceof vt){let{x:m,y:c}=f.clientPos,d=Math.sqrt((m-i.offsetX)**2+(c-i.offsetY)**2);d<h&&(h=d,a=p)}else if(f instanceof k){let{x:m,y:c}=f.box.getCenter(new fe.Vector2),d=Math.sqrt((m-i.offsetX)**2+(c-i.offsetY)**2);d<h&&(h=d,a=p)}}),l.add(a)}l.size||t.forEach(a=>l.add(a)),l.forEach(a=>{if(this.graphicTimerMap.get(a)||this.curGraphics.has(a))return;let h=this.timer.setTimeout(()=>{this.curGraphics.add(a),this.graphicTimerMap.delete(a),this.timer.clearTimeout(h),this.handleHoverGraphicsChange()},s);this.graphicTimerMap.set(a,h)}),this.graphicTimerMap.forEach((a,h)=>{l.has(h)||(this.timer.clearTimeout(a),this.graphicTimerMap.delete(h))});let u=this.curGraphics.size;this.curGraphics.forEach(a=>{l.has(a)||this.curGraphics.delete(a)}),u!==this.curGraphics.size&&this.handleHoverGraphicsChange()};onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()};onBodyPointerMove=t=>{if(this.curGraphics.size){let e=this.context.container.getBoundingClientRect();(t.clientX<e.left||t.clientX>e.right||t.clientY<e.top||t.clientY>e.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()}};var Yn=y("three/examples/jsm/lines/LineMaterial"),R=y("three");function jn(o){return`${o.x}-${o.y}-${o.z}`}var de=class{constructor(n){this.context=n}lineMaterialMap=new Map;meshStandardMaterialMap=new Map;meshBasicMaterialMap=new Map;shaderMaterialMap=new Map;groundTextureMaterialMap=new Map;line2MaterialMap=new Map;generateLineMaterialKey({color:n,opacity:t}){return`${n}-${t}`}createLineMaterial({color:n,opacity:t}){let e=this.generateLineMaterialKey({color:n,opacity:t});if(this.lineMaterialMap.has(e))return this.lineMaterialMap.get(e);let i=new R.LineBasicMaterial({color:new R.Color(n).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(e,i),i}createMeshStandardMaterial({color:n,opacity:t}){let e=`${n}-${t}`;if(this.meshStandardMaterialMap.has(e))return this.meshStandardMaterialMap.get(e);let i=new R.MeshStandardMaterial({color:new R.Color(n).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(e,i),i}createMeshBasicMaterial({color:n,opacity:t}){let e=`${n}-${t}`;if(this.meshBasicMaterialMap.has(e))return this.meshBasicMaterialMap.get(e);let i=new R.MeshBasicMaterial({color:n,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(e,i),i}createShaderMaterial({gradualColor:n,center:t,maxValue:e,opacity:i,direction:r,max:s,min:l}){let u=`${n.toString()}-${jn(t)}-${e}-${i}-${jn(r)}`;if(this.shaderMaterialMap.has(u))return this.shaderMaterialMap.get(u);let a=`
|
|
54
63
|
uniform vec3 uColor;
|
|
55
64
|
uniform vec3 uGradualColor;
|
|
56
65
|
uniform vec3 center;
|
|
@@ -71,9 +80,9 @@
|
|
|
71
80
|
float distance = length(vecAP);
|
|
72
81
|
float maxLen = length(lineVec);
|
|
73
82
|
|
|
74
|
-
vec3 direction = normalize(uDirection);
|
|
75
|
-
float gradient = dot(normalize(normal), normalize(uDirection));
|
|
76
|
-
vec3 currentPosition = position - center;
|
|
83
|
+
// vec3 direction = normalize(uDirection);
|
|
84
|
+
// float gradient = dot(normalize(normal), normalize(uDirection));
|
|
85
|
+
// vec3 currentPosition = position - center;
|
|
77
86
|
// float colorFactor = (dot(direction, currentPosition) / maxValue) * 0.5 + 0.5;
|
|
78
87
|
float colorFactor = distance / maxLen;
|
|
79
88
|
|
|
@@ -87,7 +96,7 @@
|
|
|
87
96
|
void main() {
|
|
88
97
|
gl_FragColor = vec4(vColor.x, vColor.y, vColor.z, opacity);
|
|
89
98
|
}
|
|
90
|
-
`,p=new A.ShaderMaterial({uniforms:{uColor:{value:new A.Color(n[0]).convertLinearToSRGB()},uGradualColor:{value:new A.Color(n[1]).convertLinearToSRGB()},center:{value:t},maxValue:{value:e},opacity:{value:i},uDirection:{value:r},uMax:{value:s},uMin:{value:a}},vertexShader:l,fragmentShader:h,side:A.DoubleSide});return this.shaderMaterialMap.set(u,p),p}async createGroundTextureMaterial({url:n,opacity:t}){let e=`${n}-${t}`;if(this.groundTextureMaterialMap.has(e))return this.groundTextureMaterialMap.get(e);let i=await this.context.textureFactory.getTexture(n),r=new A.MeshBasicMaterial({map:i,alphaTest:.2,side:A.DoubleSide});return i.needsUpdate=!0,this.groundTextureMaterialMap.set(e,r),r}createLine2MaterialMap({color:n,width:t,dashed:e}){let i=`${n}-${t}-${e}`;if(this.line2MaterialMap.has(i))return this.line2MaterialMap.get(i);let r=new Yn.LineMaterial({color:parseInt(n.slice(1),16),dashed:e,linewidth:t,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:new A.Vector2(this.context.clientSize.width,this.context.clientSize.height)});return this.line2MaterialMap.set(i,r),r}dispose(){this.lineMaterialMap.forEach((n,t)=>{n.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((n,t)=>{n.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((n,t)=>{n.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((n,t)=>{n.dispose()}),this.shaderMaterialMap.clear(),this.groundTextureMaterialMap.forEach((n,t)=>{n.dispose(),n.map?.dispose()}),this.groundTextureMaterialMap.clear(),this.line2MaterialMap.forEach((n,t)=>{n.dispose()}),this.line2MaterialMap.clear()}};var vt=y("three");var ge=class{constructor(n){this.context=n;this.registryEvent(),this.changePrevCamera()}prevCamera={position:new vt.Vector3,zoom:1,target:new vt.Vector3};enable=!0;box=new vt.Box3;updateBox(){this.box.setFromObject(this.context.scene)}setEnable(n){this.enable=n,n?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(g=>g instanceof rt).length)return null;let t=this.box,{camera:e,clientSize:{width:i,height:r}}=this.context,{min:s,max:a}=t,u=E(s,e,i,r),l=E(a,e,i,r),h=E(new vt.Vector3(s.x,a.y,a.z),e,i,r),p=E(new vt.Vector3(a.x,s.y,s.z),e,i,r),f=Math.min(u.x,l.x,h.x,p.x),m=Math.max(u.x,l.x,h.x,p.x),c=Math.min(u.y,l.y,h.y,p.y),d=Math.max(u.y,l.y,h.y,p.y);return{left:f,right:m,top:c,bottom:d}}checkDistanceToScreenEdge({left:n,right:t,top:e,bottom:i}){let{width:r,height:s}=this.context.clientSize,[a,u,l,h]=this.context.config.cameraBound.padding,p=t>=h,f=r-n>=u,m=s-e>=l,c=i>=a;return p&&f&&m&&c}onCameraChange=()=>{let n=this.getCurFloorScreenPosition();if(n){let{left:t,right:e,top:i,bottom:r}=n;this.checkDistanceToScreenEdge({left:t,right:e,top:i,bottom:r})?this.changePrevCamera():this.backToPrevCamera()}};dispose(){this.unRegistryEvent()}};var xt=y("three"),me=class{constructor(n){this.context=n}textureMap=new Map;loader=new xt.TextureLoader;async getTexture(n){if(this.textureMap.has(n))return this.textureMap.get(n);let t=this.loader.loadAsync(n).then(e=>(this.textureMap.set(n,e),e.format=xt.RGBAFormat,e.magFilter=xt.LinearFilter,e.minFilter=xt.LinearFilter,e.colorSpace="srgb",e));return this.textureMap.set(n,t),t}dispose(){this.textureMap.forEach(n=>{n instanceof Promise?n.then(t=>t.dispose()):n.dispose()}),this.textureMap.clear()}};var ye=class extends M.EventDispatcher{constructor(t,e){super();this.container=t;this.config=e;this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new ce(this),this.hoverHelper=new pe(this),this.materialFactory=new de(this),this.textureFactory=new me(this),this.resizeClientSize(),this.registryEvent()}scene=ke();renderer=Ve();camera;control;lights=We();timer=new W;tweenGroup=new Et.Group;currentFloor;selection;hoverHelper;basicRatio;materialFactory;textureFactory;cameraBound;clientSize={width:0,height:0,x:0,y:0};renderRf=0;prevCameraZoom=1;resizeClientSize(){let{x:t,y:e,width:i,height:r}=this.container.getBoundingClientRect();this.clientSize={width:i||this.container.clientWidth,height:r||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=He(t,e),this.prevCameraZoom=this.camera.zoom,this.renderer.setSize(t,e),this.control=Xe(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",()=>{let i=this.control.getPolarAngle();this.currentFloor?.setShadowOpacity(i/this.config.control.maxPolar),this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"}),this.prevCameraZoom!==this.camera.zoom&&(this.dispatchEvent({type:"control-zoom-change",zoom:this.camera.zoom}),this.prevCameraZoom=this.camera.zoom)}),this.cameraBound=new ge(this)}getRatio(t=new M.Vector3(0,0,0),e=new M.Vector3(100,0,0)){let{clientWidth:i,clientHeight:r}=this.container,s=E(t,this.camera,i,r),a=E(e,this.camera,i,r);return Math.ceil(Math.sqrt((a.x-s.x)**2+(a.y-s.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof M.AmbientLight&&(e.color=new M.Color(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let e=t.getCenter();e&&(this.lights.position.x=e.x,this.lights.position.y=e.y),this.cameraBound.updateBox()}onWindowResize=()=>{let{container:t,camera:e,renderer:i}=this,{clientWidth:r,clientHeight:s}=t;r=Math.max(1,r),s=Math.max(1,s),e.left=-r/2,e.right=r/2,e.top=s/2,e.bottom=-s/2,e.updateProjectionMatrix(),i.setSize(r,s),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:r,height:s})};onClick=t=>{let{graphics:e,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY);e.length&&this.dispatchEvent({type:"graphic-click",graphics:e,position:i});let r=this.getPoisByDeviceXy(t.offsetX,t.offsetY);r.length&&this.dispatchEvent({type:"poi-click",pois:r})};getGraphicsByDeviceXy(t,e){let i=new M.Vector2;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let r=new M.Raycaster;return r.setFromCamera(i,this.camera),r.ray.origin.sub(r.ray.direction.clone().multiplyScalar(100)),this.currentFloor?.graphicLayer.getGraphicByRaycaster(r)||{graphics:[],position:null}}getPoisByDeviceXy(t,e){let i=this.currentFloor?.poiLayer.getPoiByDeviceXy(t,e),r=this.currentFloor?.poiLayer2.getPoiByDeviceXy(t,e);return(i||[]).concat(r||[])}onPointerover=t=>{let{graphics:e,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),r=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-over",e:t,graphics:e,pois:r,position:i})};onPointermove=t=>{let{graphics:e,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),r=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-move",e:t,graphics:e,pois:r,position:i})};onPointerleave=t=>{this.dispatchEvent({type:"pointer-level"})};onSelectionSelect=({graphics:t,isMultipleSelect:e})=>{this.dispatchEvent({type:"select-graphic",graphics:t,isMultipleSelect:e})};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,e=500){return e===0?(this.control.maxPolarAngle=t,this.control.minPolarAngle=t,this.control.update(),this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,Promise.resolve()):mt(new Promise(i=>{let r={polar:this.control.getPolarAngle()},s={polar:t},a=new Et.Tween(r,this.tweenGroup).to(s,e).onUpdate(()=>{this.control.maxPolarAngle=r.polar,this.control.minPolarAngle=r.polar,this.control.update()}).onComplete(()=>{this.control.enabled=!0,this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}setAzimuthalAngle(t,e=500){let{maxAzimuthAngle:i,minAzimuthAngle:r}=this.control,s=i===r;if(!(!s&&t>i&&t<r)){if(e===0){this.control.maxAzimuthAngle=t,this.control.minAzimuthAngle=t,this.control.update(),s||(this.control.maxAzimuthAngle=i,this.control.minAzimuthAngle=r);return}return mt(new Promise(a=>{let u={azimuthal:this.control.getAzimuthalAngle()},l={azimuthal:t},h=new Et.Tween(u,this.tweenGroup).to(l,e).onUpdate(()=>{this.control.maxAzimuthAngle=u.azimuthal,this.control.minAzimuthAngle=u.azimuthal,this.control.update()}).onComplete(()=>{this.control.enabled=!0,s||(this.control.maxAzimuthAngle=i,this.control.minAzimuthAngle=r),this.tweenGroup.remove(h),a(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}}getCameraLookAt(){return new M.Vector3().subVectors(this.control.target,this.camera.position)}setZoom(t,e,i=500){let r=this.getCameraLookAt(),s={zoom:this.camera.zoom,target:this.control.target.clone()};if(!i){this.camera.position.copy(e.clone().sub(r)),this.control.target.copy(e),this.camera.zoom=t,this.control.update();return}return mt(new Promise(a=>{let u=new Et.Tween(s,this.tweenGroup).to({zoom:t,target:e},i).onUpdate(()=>{this.camera.position.copy(s.target.clone().sub(r)),this.control.target.copy(s.target),this.camera.zoom=s.zoom,this.control.update()}).onComplete(()=>{this.tweenGroup.remove(u),this.control.enabled=!0,a(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),i+500)}getFitCameraToObjectZoom(t,e=[20,20,20,20],i=500,r=!0){let[s,a,u,l]=e,{clientSize:{width:h,height:p}}=this,f=this.control.getPolarAngle();r&&this.setPolarAngle(0,0);let m=new M.Box3().setFromObject(t);this.setPolarAngle(f,0);let{max:c,min:d}=m,g=new M.Vector3(d.x,c.y,c.z),v=new M.Vector3(c.x,c.y,c.z),P=new M.Vector3(c.x,d.y,d.z),C=new M.Vector3(d.x,d.y,d.z),x=E(g,this.camera,h,p),w=E(v,this.camera,h,p),ft=E(C,this.camera,h,p),lt=E(P,this.camera,h,p),Be=new M.Box2().setFromPoints([new M.Vector2(x.x,x.y),new M.Vector2(w.x,w.y),new M.Vector2(ft.x,ft.y),new M.Vector2(lt.x,lt.y)]).getSize(new M.Vector2),yi=(h-a-l)/Be.x,_i=(p-s-u)/Be.y,vi=Math.min(yi,_i),xi=new M.Vector3((c.x+d.x)/2,(c.y+d.y)/2,(c.z+d.z)/2);return{zoom:vi*this.camera.zoom,center:xi}}fitCameraToObject(t,e=[20,20,20,20],i=500,r=!0){let{zoom:s,center:a}=this.getFitCameraToObjectZoom(t,e,i,r);return this.setZoom(s,a,i)}getFitCameraToGroundZoom(t=[20,20,20,20],e=500,i=!0){if(this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,e,i).zoom}fitCameraToGround(t=[20,20,20,20],e=500,i=!0){return this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundUpper,t,e,i):Promise.resolve(!1)}async setCameraPosition(t,e){let i=this.camera.position.clone(),r=this.getCameraLookAt();if(!e){this.control.enabled=!1,this.camera.position.copy(t.clone().sub(r)),this.control.target.copy(t.clone()),this.control.update(),this.control.enabled=!0;return}return mt(new Promise(s=>{let a=new Et.Tween(i,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(i.clone().sub(r)),this.control.target.copy(i.clone()),this.control.update()}).onComplete(()=>{this.tweenGroup.remove(a),this.camera.position.copy(i.clone().sub(r)),this.control.target.copy(t.clone()),this.control.update(),this.control.enabled=!0,s(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}render(){this.dispatchEvent({type:"update"}),this.tweenGroup.update(),this.renderer.render(this.scene,this.camera),this.renderRf=this.timer.requestAnimationFrame(()=>{this.render()})}pauseRender(){this.timer.cancelAnimationFrame(this.renderRf)}continueRender(){this.render()}dispose(){this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.timer.dispose(),this.renderer.dispose(),this.lights.children.forEach(t=>t.dispose()),this.materialFactory.dispose(),this.textureFactory.dispose(),Z(this.scene)}};var $n=y("lodash"),Xi={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"},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 Zn(o){return(0,$n.merge)({},Xi,o)}var Qn=y("lodash");async function Kn({brand:o,project:n},t){let{apiDomain:e,apiPath:{floorRange:i},apiInfo:r}=t,s=`${e}${i}?brand=${o}&project=${n}&phase=${n}&building=${n}`;return await fetch(s,r).then(u=>u.json()).then(u=>u.data).then(u=>{let l=(u||[])[0];return l&&(l.info=JSON.parse(l.info)),l})}async function _e({brand:o,project:n,floor:t,ts:e,resource_type_list:i},r){let{apiDomain:s,apiPath:{floorGraphic:a},apiInfo:u}=r,l=`${s}${a}?brand=${o}&project=${n}&phase=${n}&building=${n}&floor=${t}&ts=${e}&resource_type_list=${i}`;return await fetch(l,u).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(f=>f.info=JSON.parse(f.info)),p||[]))}var qi=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(qi||{}),Jn=class extends ve.EventDispatcher{constructor(t,e={}){super();this.container=t;this.config=Zn(e),this.context=new ye(t,this.config),this.registryEvent(),this.context.render()}config;context;polarKeys=[];azimuthalKeys=[];svgLine;svgPolygon;basicZoom=1;prevCameraZoom=1;type="2d";floorDataMap=new Map;buildingGroundMap=new Map;buildingGroundPromiseMap=new Map;currentBuildGround=null;observe=null;buildingCenter=[0,0];timer=new W;plugins=[];async loadGraphics({brand:t,project:e,floor:i,ts:r,resource_type_list:s}){return await _e({brand:t,project:e,floor:i,ts:r,resource_type_list:s},this.config)}changeBuildingCenter(t,{brand:e,project:i}){let r=t?Bt(t.info.geometry.cds[0]):[0,0];this.buildingCenter=r,this.dispatchEvent({type:"center-change",center:r,project:i,brand:e})}async loadBuildingGround({brand:t,project:e}){let i=Q({brand:t,project:e});if(this.buildingGroundMap.has(i)){let s=this.buildingGroundMap.get(i);return this.changeBuildingCenter(s||null,{brand:t,project:e}),s||null}if(this.buildingGroundPromiseMap.has(i))return this.buildingGroundPromiseMap.get(i);let r=new Promise(async s=>{let a=await Kn({brand:t,project:e},this.config);this.buildingGroundMap.set(i,a),this.changeBuildingCenter(a||null,{brand:t,project:e}),this.buildingGroundPromiseMap.delete(i),s(a)});return this.buildingGroundPromiseMap.set(i,r),r}async load({brand:t,project:e,floor:i,ts:r,resource_type_list:s}){let a=Q({brand:t,project:e,floor:i,ts:r,resource_type_list:s});if(this.floorDataMap.has(a))return this.floorDataMap.get(a);let[u,l]=await Promise.all([this.loadGraphics({brand:t,project:e,floor:i,ts:r,resource_type_list:s}),this.loadBuildingGround({brand:t,project:e})]);return this.transformGraphicData(u),u.forEach(h=>{h.info.transformToBuildingGround=!!l}),this.config.useFloorCache||this.floorDataMap.clear(),this.floorDataMap.set(a,u),u}transformGraphicData(t,e=this.buildingCenter,i=0){t.forEach(u=>{if(u.info.geometry.coords=JSON.parse(JSON.stringify(u.info.geometry.cds)),u.info.geometry.type==="polygon")u.info.geometry.coords.map(l=>{Array.isArray(l)&&l.forEach(h=>{h[0]-=e[0],h[1]-=e[1]})});else{let[l,h]=u.info.geometry.cds;u.info.geometry.coords=[l-e[0],h-e[1]]}});let{ground:r,markGraphic:s,graphic:a}=this.config;for(let u=0;u<t.length;u++){let l=t[u];l.info.deltaHeight=1e-5*(i+u+1),l.info.group==="ground"?(l.info.fillColor=r.color,l.info.fillOpacity=r.opacity,l.info.height=r.height,l.info.stroke=r.stroke,l.info.strokeColor=r.strokeColor,l.info.strokeOpacity=r.strokeOpacity):l.info.userData.mark?(l.info.height=s.height,l.info.fillColor=s.color,l.info.fillOpacity=s.opacity,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity):(l.info.fillOpacity=a.fillOpacity,this.config.initTransToMark&&(l.info.height=s.height,l.info.fillColor=s.color,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity))}}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}createFloor(t){let e=new rt(this.context);if(!t.length)return{curFloor:e,graphics:[]};let i=new Map,r=[];for(let s of t)if(s.info.group==="ground")e.createGround(s.info);else{let a=e.addGraphic(s.info);a.userData.data=s,i.set(s.legacy_id,a),r.push(a)}return e.userData.legacyToGraphicMap=i,{curFloor:e,graphics:r}}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor({brand:t,project:e,floor:i,ts:r,resource_type_list:s}){let a=Q({brand:t,project:e,floor:i,ts:r,resource_type_list:s}),u=this.floorDataMap.get(a);if(this.context.control.removeEventListener("change",this.onControlChange),u){let l=Q({brand:t,project:e});this.currentBuildGround=this.buildingGroundMap.get(l)||null;let h=this.createFloor(u);h?(h.curFloor.name=i,this.triggerHooks("switch_floor_before",h),h.curFloor.updateBox(),this.context.switchFloor(h.curFloor),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",h)):console.warn("[switchFloor error] ["+i+"] \u697C\u5C42\u6CA1\u6709\u6570\u636E")}else console.warn("[switchFloor error] \u6CA1\u6709\u8FD9\u4E2A\u697C\u5C42\uFF0C\u8BF7\u5148\u8C03\u7528load\u65B9\u6CD5\u52A0\u8F7D\u697C\u5C42")}switchFloorByData(t,e,i=e){let{curFloor:r,graphics:s}=this.createFloor(t);r.name=e,r.key=i;let a=new Map;t.forEach(u=>{a.set(u.element_uuid,u)}),r.userData.graphicMap=a,this.switchFloorByFloor(r,s)}switchFloorByFloor(t,e=t.graphicLayer.children){this.triggerHooks("switch_floor_before",{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",{curFloor:t,graphics:e})}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*25,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,e){if(t.options.geometry.type==="polygon"){let i=this.context.currentFloor?.addModel({...e,position:t.getPosition().setZ(.1),id:t.options.id});if(i){let{facilityAngle:r=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;i.rotateZ((180-r)/180*Math.PI),i.scale.set(s,a,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 U)||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let i=t.getCenter();return this.context.currentFloor.addPoi({...e,position:{...i,z:i.z+t.options.height/2}})}return null}removeHeatMap(){this.context.currentFloor?.removeHeatMap()}translateElementToCenter(t,e=500){let i=t.getPosition();return this.context.setCameraPosition(i,e)}async translateElementToCenterX(t,e=500){return mt(new Promise(i=>{let r=this.context.control.target.clone(),s=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:a,height:u},camera:l}=this.context,p=E(s,l,a,u).x-a/2,f=new ve.Vector3;f.setFromMatrixColumn(this.context.camera.matrix,0),f.normalize(),f.multiplyScalar(p/this.context.camera.zoom),r.add(f),this.context.setCameraPosition(r,e).then(i)})}),e+500)}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:i,clientHeight:r}=this.container;return E(e,this.context.camera,i,r)}changeMapType(t,e=500){return this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}async resetView(t=300){let e=t/3;await this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),await this.context.setPolarAngle(this.config.control.defaultPolar,e),await this.context.fitCameraToGround(this.config.defaultPadding,e,!1)}reduceMap(t=.5,e=500){let i=this.context.camera.zoom;return this.context.setZoom(i-t,this.context.control.target,e)}enlargeMap(t=.5,e=500){let i=this.context.camera.zoom;return this.context.setZoom(i+t,this.context.control.target,e)}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 e=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=e,this.context.control.minPolarAngle=e}if(this.azimuthalKeys.includes(t.code)){let e=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=e,this.context.control.minAzimuthAngle=e}};registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver((0,Qn.debounce)(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 e=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(e+t,500)}async measureDistance(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new re(this.context);let i=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){i(),e("cancel")},this.svgLine.addEventListener("distance",({distance:r})=>{t(r)})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new oe(this.context);let i=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){i(),e("cancel")},this.svgPolygon.addEventListener("area",({area:r})=>{t(r)})})}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 e=Bt(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(r=>{r[0]-=e[0],r[1]-=e[1]})});else{let[i,r]=t.geometry.cds;t.geometry.coords=[i-e[0],r-e[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(),e=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=e,this.context.control.minZoom=i,this.context.control.maxZoom=i*25,this.basicZoom=e,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.floorDataMap.clear(),this.buildingGroundMap.clear(),$e(),Ze(),rn(),this.unRegistryEvent()}};var ti=y("three"),st=class extends ti.EventDispatcher{bmap;constructor(n){super(),this.bmap=n}dispose(){}};var ei=class extends st{equipmentList=[];equipmentMap=new Map;constructor(n){super(n),this.fetchEquipment(),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}async fetchEquipment(){let{apiDomain:n,apiPath:{equipmentList:t},apiInfo:e}=this.bmap.config,i=`${n}${t}`;await fetch(i,e).then(r=>r.json()).then(r=>r.data).then(r=>{this.equipmentList=r,this.equipmentMap=new Map(r.map(s=>[s.equipment_id,s]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)}onSwitchFloor=({data:{graphics:n}})=>{this.equipmentList.length&&this.changeGraphicToEquipment(n)};getGraphicEquipment(n){return n.userData.data.info.userData.equipment}changeGraphicToEquipment(n){n.filter(t=>{let e=this.getGraphicEquipment(t);return e&&this.equipmentMap.has(e)}).forEach(t=>{let e=this.equipmentMap.get(this.getGraphicEquipment(t)),i=this.bmap.createGraphicPoi(t,{icon:e?.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=e,i.userData.type="equipment")})}dispose(){this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),Array.from(this.bmap.context.currentFloor?.poiLayer.pois||[]).forEach(n=>{n.userData.type==="equipment"&&this.bmap.context.currentFloor?.poiLayer.removePoi(n)})}};function De(o){let n=new Blob([o],{type:"text/javascript"}),t=URL.createObjectURL(n),e=new Worker(t);return URL.revokeObjectURL(t),e}function Oe(){return De(`var B1=Object.create;var Fh=Object.defineProperty;var z1=Object.getOwnPropertyDescriptor;var k1=Object.getOwnPropertyNames,gm=Object.getOwnPropertySymbols,G1=Object.getPrototypeOf,ym=Object.prototype.hasOwnProperty,V1=Object.prototype.propertyIsEnumerable;var Dh=(r,t,e)=>t in r?Fh(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ls=(r,t)=>{for(var e in t||(t={}))ym.call(t,e)&&Dh(r,e,t[e]);if(gm)for(var e of gm(t))V1.call(t,e)&&Dh(r,e,t[e]);return r};var Zt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var H1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of k1(t))!ym.call(r,a)&&a!==e&&Fh(r,a,{get:()=>t[a],enumerable:!(o=z1(t,a))||o.enumerable});return r};var Ln=(r,t,e)=>(e=r!=null?B1(G1(r)):{},H1(t||!r||!r.__esModule?Fh(e,"default",{value:r,enumerable:!0}):e,r));var dn=(r,t,e)=>Dh(r,typeof t!="symbol"?t+"":t,e);var _m=Zt((dR,vm)=>{var Uh=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)}};vm.exports=Uh});var Mm=Zt((mR,Em)=>{function xm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,xm(a,t)):o!==t&&e.set(o,a);return e}Em.exports=xm});var bm=Zt((gR,Sm)=>{function W1(r){let t=Number(r);return!(isNaN(t)||t<=0)}function wm(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,wm(a));if(!W1(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}Sm.exports=wm});var Cm=Zt((yR,Am)=>{function Tm(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){Tm(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}Am.exports=Tm});var zh=Zt((vR,Rm)=>{var q1=_m(),X1=Mm(),Pm=bm(),Im=Cm(),Bh=class{constructor(t){t instanceof Map?(Im(t),this.graph=t):t?this.graph=Pm(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(Im(e),o=e):o=Pm(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=X1(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,l=new q1,h=new Map,f=[],p=0,d=[];if(o.avoid&&(d=[].concat(o.avoid)),d.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(d.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(l.set(t,0);!l.isEmpty();){let g=l.next();if(g.key===e){p=g.priority;let y=g.key;for(;h.has(y);)f.push(y),y=h.get(y);break}a.add(g.key),(this.graph.get(g.key)||new Map).forEach((y,M)=>{if(a.has(M)||d.includes(M))return null;if(!l.has(M))return h.set(M,g.key),l.set(M,g.priority+y);let S=l.get(M).priority,T=g.priority+y;return T<S?(h.set(M,g.key),l.set(M,T)):null})}return f.length?(o.trim?f.shift():f=f.concat([t]),o.reverse||(f=f.reverse()),o.cost?{path:f,cost:p}:f):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};Rm.exports=Bh});var Mc=Zt((AR,E0)=>{"use strict";var x0=Object.getOwnPropertySymbols,Yb=Object.prototype.hasOwnProperty,$b=Object.prototype.propertyIsEnumerable;function Zb(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Jb(){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(l){return t[l]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(l){a[l]=l}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(l){return!1}}E0.exports=Jb()?Object.assign:function(r,t){for(var e,o=Zb(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var h in e)Yb.call(e,h)&&(o[h]=e[h]);if(x0){a=x0(e);for(var f=0;f<a.length;f++)$b.call(e,a[f])&&(o[a[f]]=e[a[f]])}}return o}});var fp=Zt((cp,hp)=>{(function(r,t){typeof cp=="object"&&typeof hp!="undefined"?hp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(cp,function(){"use strict";function r(x,v,C,w,O){(function F(G,z,L,D,q){for(;D>L;){if(D-L>600){var nt=D-L+1,k=z-L+1,xt=Math.log(nt),X=.5*Math.exp(2*xt/3),it=.5*Math.sqrt(xt*X*(nt-X)/nt)*(k-nt/2<0?-1:1),vt=Math.max(L,Math.floor(z-k*X/nt+it)),pt=Math.min(D,Math.floor(z+(nt-k)*X/nt+it));F(G,z,vt,pt,q)}var et=G[z],ot=L,V=D;for(t(G,L,z),q(G[D],et)>0&&t(G,L,D);ot<V;){for(t(G,ot,V),ot++,V--;q(G[ot],et)<0;)ot++;for(;q(G[V],et)>0;)V--}q(G[L],et)===0?t(G,L,V):t(G,++V,D),V<=z&&(L=V+1),z<=V&&(D=V-1)}})(x,v,C||0,w||x.length-1,O||e)}function t(x,v,C){var w=x[v];x[v]=x[C],x[C]=w}function e(x,v){return x<v?-1:x>v?1:0}var o=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(x,v,C){if(!C)return v.indexOf(x);for(var w=0;w<v.length;w++)if(C(x,v[w]))return w;return-1}function l(x,v){h(x,0,x.children.length,v,x)}function h(x,v,C,w,O){O||(O=S(null)),O.minX=1/0,O.minY=1/0,O.maxX=-1/0,O.maxY=-1/0;for(var F=v;F<C;F++){var G=x.children[F];f(O,x.leaf?w(G):G)}return O}function f(x,v){return x.minX=Math.min(x.minX,v.minX),x.minY=Math.min(x.minY,v.minY),x.maxX=Math.max(x.maxX,v.maxX),x.maxY=Math.max(x.maxY,v.maxY),x}function p(x,v){return x.minX-v.minX}function d(x,v){return x.minY-v.minY}function g(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function _(x){return x.maxX-x.minX+(x.maxY-x.minY)}function y(x,v){return x.minX<=v.minX&&x.minY<=v.minY&&v.maxX<=x.maxX&&v.maxY<=x.maxY}function M(x,v){return v.minX<=x.maxX&&v.minY<=x.maxY&&v.maxX>=x.minX&&v.maxY>=x.minY}function S(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(x,v,C,w,O){for(var F=[v,C];F.length;)if(!((C=F.pop())-(v=F.pop())<=w)){var G=v+Math.ceil((C-v)/w/2)*w;r(x,G,v,C,O),F.push(v,G,G,C)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(x){var v=this.data,C=[];if(!M(x,v))return C;for(var w=this.toBBox,O=[];v;){for(var F=0;F<v.children.length;F++){var G=v.children[F],z=v.leaf?w(G):G;M(x,z)&&(v.leaf?C.push(G):y(x,z)?this._all(G,C):O.push(G))}v=O.pop()}return C},o.prototype.collides=function(x){var v=this.data;if(!M(x,v))return!1;for(var C=[];v;){for(var w=0;w<v.children.length;w++){var O=v.children[w],F=v.leaf?this.toBBox(O):O;if(M(x,F)){if(v.leaf||y(x,F))return!0;C.push(O)}}v=C.pop()}return!1},o.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var v=0;v<x.length;v++)this.insert(x[v]);return this}var C=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===C.height)this._splitRoot(this.data,C);else{if(this.data.height<C.height){var w=this.data;this.data=C,C=w}this._insert(C,this.data.height-C.height-1,!0)}else this.data=C;return this},o.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},o.prototype.clear=function(){return this.data=S([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var C,w,O,F=this.data,G=this.toBBox(x),z=[],L=[];F||z.length;){if(F||(F=z.pop(),w=z[z.length-1],C=L.pop(),O=!0),F.leaf){var D=a(x,F.children,v);if(D!==-1)return F.children.splice(D,1),z.push(F),this._condense(z),this}O||F.leaf||!y(F,G)?w?(C++,F=w.children[C],O=!1):F=null:(z.push(F),L.push(C),C=0,w=F,F=F.children[0])}return this},o.prototype.toBBox=function(x){return x},o.prototype.compareMinX=function(x,v){return x.minX-v.minX},o.prototype.compareMinY=function(x,v){return x.minY-v.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(x){return this.data=x,this},o.prototype._all=function(x,v){for(var C=[];x;)x.leaf?v.push.apply(v,x.children):C.push.apply(C,x.children),x=C.pop();return v},o.prototype._build=function(x,v,C,w){var O,F=C-v+1,G=this._maxEntries;if(F<=G)return l(O=S(x.slice(v,C+1)),this.toBBox),O;w||(w=Math.ceil(Math.log(F)/Math.log(G)),G=Math.ceil(F/Math.pow(G,w-1))),(O=S([])).leaf=!1,O.height=w;var z=Math.ceil(F/G),L=z*Math.ceil(Math.sqrt(G));T(x,v,C,L,this.compareMinX);for(var D=v;D<=C;D+=L){var q=Math.min(D+L-1,C);T(x,D,q,z,this.compareMinY);for(var nt=D;nt<=q;nt+=z){var k=Math.min(nt+z-1,q);O.children.push(this._build(x,nt,k,w-1))}}return l(O,this.toBBox),O},o.prototype._chooseSubtree=function(x,v,C,w){for(;w.push(v),!v.leaf&&w.length-1!==C;){for(var O=1/0,F=1/0,G=void 0,z=0;z<v.children.length;z++){var L=v.children[z],D=g(L),q=(nt=x,k=L,(Math.max(k.maxX,nt.maxX)-Math.min(k.minX,nt.minX))*(Math.max(k.maxY,nt.maxY)-Math.min(k.minY,nt.minY))-D);q<F?(F=q,O=D<O?D:O,G=L):q===F&&D<O&&(O=D,G=L)}v=G||v.children[0]}var nt,k;return v},o.prototype._insert=function(x,v,C){var w=C?x:this.toBBox(x),O=[],F=this._chooseSubtree(w,this.data,v,O);for(F.children.push(x),f(F,w);v>=0&&O[v].children.length>this._maxEntries;)this._split(O,v),v--;this._adjustParentBBoxes(w,O,v)},o.prototype._split=function(x,v){var C=x[v],w=C.children.length,O=this._minEntries;this._chooseSplitAxis(C,O,w);var F=this._chooseSplitIndex(C,O,w),G=S(C.children.splice(F,C.children.length-F));G.height=C.height,G.leaf=C.leaf,l(C,this.toBBox),l(G,this.toBBox),v?x[v-1].children.push(G):this._splitRoot(C,G)},o.prototype._splitRoot=function(x,v){this.data=S([x,v]),this.data.height=x.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(x,v,C){for(var w,O,F,G,z,L,D,q=1/0,nt=1/0,k=v;k<=C-v;k++){var xt=h(x,0,k,this.toBBox),X=h(x,k,C,this.toBBox),it=(O=xt,F=X,G=void 0,z=void 0,L=void 0,D=void 0,G=Math.max(O.minX,F.minX),z=Math.max(O.minY,F.minY),L=Math.min(O.maxX,F.maxX),D=Math.min(O.maxY,F.maxY),Math.max(0,L-G)*Math.max(0,D-z)),vt=g(xt)+g(X);it<q?(q=it,w=k,nt=vt<nt?vt:nt):it===q&&vt<nt&&(nt=vt,w=k)}return w||C-v},o.prototype._chooseSplitAxis=function(x,v,C){var w=x.leaf?this.compareMinX:p,O=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,C,w)<this._allDistMargin(x,v,C,O)&&x.children.sort(w)},o.prototype._allDistMargin=function(x,v,C,w){x.children.sort(w);for(var O=this.toBBox,F=h(x,0,v,O),G=h(x,C-v,C,O),z=_(F)+_(G),L=v;L<C-v;L++){var D=x.children[L];f(F,x.leaf?O(D):D),z+=_(F)}for(var q=C-v-1;q>=v;q--){var nt=x.children[q];f(G,x.leaf?O(nt):nt),z+=_(G)}return z},o.prototype._adjustParentBBoxes=function(x,v,C){for(var w=C;w>=0;w--)f(v[w],x)},o.prototype._condense=function(x){for(var v=x.length-1,C=void 0;v>=0;v--)x[v].children.length===0?v>0?(C=x[v-1].children).splice(C.indexOf(x[v]),1):this.clear():l(x[v],this.toBBox)},o})});var M0=Zt((pp,dp)=>{(function(r,t){typeof pp=="object"&&typeof dp!="undefined"?dp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(pp,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 l=(this.length>>1)-1;l>=0;l--)this._down(l)};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,l=a.data,h=a.compare,f=l[o];o>0;){var p=o-1>>1,d=l[p];if(h(f,d)>=0)break;l[o]=d,o=p}l[o]=f},r.prototype._down=function(o){for(var a=this,l=a.data,h=a.compare,f=this.length>>1,p=l[o];o<f;){var d=(o<<1)+1,g=l[d],_=d+1;if(_<this.length&&h(l[_],g)<0&&(d=_,g=l[_]),h(g,p)>=0)break;l[o]=g,o=d}l[o]=p};function t(e,o){return e<o?-1:e>o?1:0}return r})});var S0=Zt((NR,w0)=>{w0.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=(a-o)/2,d=0,g=p-1;d<p;g=d++){var _=e[o+d*2+0],y=e[o+d*2+1],M=e[o+g*2+0],S=e[o+g*2+1],T=y>h!=S>h&&l<(M-_)*(h-y)/(S-y)+_;T&&(f=!f)}return f}});var T0=Zt((OR,b0)=>{b0.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=a-o,d=0,g=p-1;d<p;g=d++){var _=e[d+o][0],y=e[d+o][1],M=e[g+o][0],S=e[g+o][1],T=y>h!=S>h&&l<(M-_)*(h-y)/(S-y)+_;T&&(f=!f)}return f}});var P0=Zt((DR,bc)=>{var A0=S0(),C0=T0();bc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?C0(t,e,o,a):A0(t,e,o,a)};bc.exports.nested=C0;bc.exports.flat=A0});var R0=Zt((Tc,I0)=>{(function(r,t){typeof Tc=="object"&&typeof I0!="undefined"?t(Tc):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(Tc,function(r){"use strict";let e=33306690738754706e-32;function o(M,S,T,x,v){let C,w,O,F,G=S[0],z=x[0],L=0,D=0;z>G==z>-G?(C=G,G=S[++L]):(C=z,z=x[++D]);let q=0;if(L<M&&D<T)for(z>G==z>-G?(O=C-((w=G+C)-G),G=S[++L]):(O=C-((w=z+C)-z),z=x[++D]),C=w,O!==0&&(v[q++]=O);L<M&&D<T;)z>G==z>-G?(O=C-((w=C+G)-(F=w-C))+(G-F),G=S[++L]):(O=C-((w=C+z)-(F=w-C))+(z-F),z=x[++D]),C=w,O!==0&&(v[q++]=O);for(;L<M;)O=C-((w=C+G)-(F=w-C))+(G-F),G=S[++L],C=w,O!==0&&(v[q++]=O);for(;D<T;)O=C-((w=C+z)-(F=w-C))+(z-F),z=x[++D],C=w,O!==0&&(v[q++]=O);return C===0&&q!==0||(v[q++]=C),q}function a(M){return new Float64Array(M)}let l=33306690738754716e-32,h=22204460492503146e-32,f=11093356479670487e-47,p=a(4),d=a(8),g=a(12),_=a(16),y=a(4);r.orient2d=function(M,S,T,x,v,C){let w=(S-C)*(T-v),O=(M-v)*(x-C),F=w-O;if(w===0||O===0||w>0!=O>0)return F;let G=Math.abs(w+O);return Math.abs(F)>=l*G?F:-function(z,L,D,q,nt,k,xt){let X,it,vt,pt,et,ot,V,K,at,Tt,dt,Ct,Yt,Wt,Nt,ne,Pt,Xt,tt=z-nt,nn=D-nt,Gt=L-k,te=q-k;et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=tt*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=Gt*nn)-V*at-K*at-V*Tt))),p[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),p[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,p[2]=Ct-(Xt-et)+(dt-et),p[3]=Xt;let qt=function(W,Z){let I=Z[0];for(let P=1;P<W;P++)I+=Z[P];return I}(4,p),J=h*xt;if(qt>=J||-qt>=J||(X=z-(tt+(et=z-tt))+(et-nt),vt=D-(nn+(et=D-nn))+(et-nt),it=L-(Gt+(et=L-Gt))+(et-k),pt=q-(te+(et=q-te))+(et-k),X===0&&it===0&&vt===0&&pt===0)||(J=f*xt+e*Math.abs(qt),(qt+=tt*pt+te*X-(Gt*vt+nn*it))>=J||-qt>=J))return qt;et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=X*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=it*nn)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let N=o(4,p,4,y,d);et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=tt*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=Gt*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let b=o(N,d,4,y,g);et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=X*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=it*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let R=o(b,g,4,y,_);return _[R-1]}(M,S,T,x,v,C,G)},r.orient2dfast=function(M,S,T,x,v,C){return(S-C)*(T-v)-(M-v)*(x-C)},Object.defineProperty(r,"__esModule",{value:!0})})});var U0=Zt((FR,vp)=>{"use strict";var L0=fp(),Cc=M0(),Qb=P0(),jb=R0().orient2d;Cc.default&&(Cc=Cc.default);vp.exports=F0;vp.exports.default=F0;function F0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=iT(r),a=new L0(16);a.toBBox=function(C){return{minX:C[0],minY:C[1],maxX:C[0],maxY:C[1]}},a.compareMinX=function(C,w){return C[0]-w[0]},a.compareMinY=function(C,w){return C[1]-w[1]},a.load(r);for(var l=[],h=0,f;h<o.length;h++){var p=o[h];a.remove(p),f=D0(p,f),l.push(f)}var d=new L0(16);for(h=0;h<l.length;h++)d.insert(mp(l[h]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,S=y.next.p,T=gp(M,S);if(!(T<_)){var x=T/g;p=tT(a,y.prev.p,M,S,y.next.next.p,x,d),p&&Math.min(gp(p,M),gp(p,S))<=x&&(l.push(y),l.push(D0(p,y)),a.remove(p),d.remove(y),d.insert(mp(y)),d.insert(mp(y.next)))}}y=f;var v=[];do v.push(y.p),y=y.next;while(y!==f);return v.push(y.p),v}function tT(r,t,e,o,a,l,h){for(var f=new Cc([],eT),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?yp(g,e,o):nT(e,o,g);_>l||f.push({node:g,dist:_})}for(;f.length&&!f.peek().node.children;){var y=f.pop(),M=y.node,S=yp(M,t,e),T=yp(M,o,a);if(y.dist<S&&y.dist<T&&O0(e,M,h)&&O0(o,M,h))return M}p=f.pop(),p&&(p=p.node)}return null}function eT(r,t){return r.dist-t.dist}function nT(r,t,e){if(N0(r,e)||N0(t,e))return 0;var o=Ac(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=Ac(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=Ac(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var h=Ac(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return h===0?0:Math.min(o,a,l,h)}function N0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function O0(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),l=Math.max(r[0],t[0]),h=Math.max(r[1],t[1]),f=e.search({minX:o,minY:a,maxX:l,maxY:h}),p=0;p<f.length;p++)if(rT(f[p].p,f[p].next.p,r,t))return!1;return!0}function Qa(r,t,e){return jb(r[0],r[1],t[0],t[1],e[0],e[1])}function rT(r,t,e,o){return r!==o&&t!==e&&Qa(r,t,e)>0!=Qa(r,t,o)>0&&Qa(e,o,r)>0!=Qa(e,o,t)>0}function mp(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 iT(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],l=0;l<r.length;l++){var h=r[l];h[0]<t[0]&&(t=h),h[0]>o[0]&&(o=h),h[1]<e[1]&&(e=h),h[1]>a[1]&&(a=h)}var f=[t,e,o,a],p=f.slice();for(l=0;l<r.length;l++)Qb(r[l],f)||p.push(r[l]);return sT(p)}function D0(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 gp(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function yp(r,t,e){var o=t[0],a=t[1],l=e[0]-o,h=e[1]-a;if(l!==0||h!==0){var f=((r[0]-o)*l+(r[1]-a)*h)/(l*l+h*h);f>1?(o=e[0],a=e[1]):f>0&&(o+=l*f,a+=h*f)}return l=r[0]-o,h=r[1]-a,l*l+h*h}function Ac(r,t,e,o,a,l,h,f){var p=e-r,d=o-t,g=h-a,_=f-l,y=r-a,M=t-l,S=p*p+d*d,T=p*g+d*_,x=g*g+_*_,v=p*y+d*M,C=g*y+_*M,w=S*x-T*T,O,F,G,z,L=w,D=w;w===0?(F=0,L=1,z=C,D=x):(F=T*C-x*v,z=S*C-T*v,F<0?(F=0,z=C,D=x):F>L&&(F=L,z=C+T,D=x)),z<0?(z=0,-v<0?F=0:-v>S?F=L:(F=-v,L=S)):z>D&&(z=D,-v+T<0?F=0:-v+T>S?F=L:(F=-v+T,L=S)),O=F===0?0:F/L,G=z===0?0:z/D;var q=(1-O)*r+O*e,nt=(1-O)*t+O*o,k=(1-G)*a+G*h,xt=(1-G)*l+G*f,X=k-q,it=xt-nt;return X*X+it*it}function oT(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function sT(r){r.sort(oT);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Qa(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&&Qa(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 H0=Zt((xp,Ep)=>{(function(r,t){typeof xp=="object"&&typeof Ep!="undefined"?Ep.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(xp,function(){"use strict";function r(a,l,h,f,p){t(a,l,h||0,f||a.length-1,p||o)}function t(a,l,h,f,p){for(;f>h;){if(f-h>600){var d=f-h+1,g=l-h+1,_=Math.log(d),y=.5*Math.exp(2*_/3),M=.5*Math.sqrt(_*y*(d-y)/d)*(g-d/2<0?-1:1),S=Math.max(h,Math.floor(l-g*y/d+M)),T=Math.min(f,Math.floor(l+(d-g)*y/d+M));t(a,l,S,T,p)}var x=a[l],v=h,C=f;for(e(a,h,l),p(a[f],x)>0&&e(a,h,f);v<C;){for(e(a,v,C),v++,C--;p(a[v],x)<0;)v++;for(;p(a[C],x)>0;)C--}p(a[h],x)===0?e(a,h,C):(C++,e(a,C,f)),C<=l&&(h=C+1),l<=C&&(f=C-1)}}function e(a,l,h){var f=a[l];a[l]=a[h],a[h]=f}function o(a,l){return a<l?-1:a>l?1:0}return r})});var bp=Zt((u2,Sp)=>{"use strict";Sp.exports=$u;Sp.exports.default=$u;var _T=H0();function $u(r,t){if(!(this instanceof $u))return new $u(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()}$u.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Ic(r,t))return e;for(var a=[],l,h,f,p;t;){for(l=0,h=t.children.length;l<h;l++)f=t.children[l],p=t.leaf?o(f):f,Ic(r,p)&&(t.leaf?e.push(f):wp(r,p)?this._all(f,e):a.push(f));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!Ic(r,t))return!1;for(var o=[],a,l,h,f;t;){for(a=0,l=t.children.length;a<l;a++)if(h=t.children[a],f=t.leaf?e(h):h,Ic(r,f)){if(t.leaf||wp(r,f))return!0;o.push(h)}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=eu([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],l=[],h,f,p,d;e||a.length;){if(e||(e=a.pop(),f=a[a.length-1],h=l.pop(),d=!0),e.leaf&&(p=xT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&wp(e,o)?(a.push(e),l.push(h),h=0,f=e,e=e.children[0]):f?(h++,e=f.children[h],d=!1):e=null}return this},toBBox:function(r){return r},compareMinX:W0,compareMinY:q0,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,l=this._maxEntries,h;if(a<=l)return h=eu(r.slice(t,e+1)),tu(h,this.toBBox),h;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),h=eu([]),h.leaf=!1,h.height=o;var f=Math.ceil(a/l),p=f*Math.ceil(Math.sqrt(l)),d,g,_,y;for(X0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),X0(r,d,_,f,this.compareMinY),g=d;g<=_;g+=f)y=Math.min(g+f-1,_),h.children.push(this._build(r,g,y,o-1));return tu(h,this.toBBox),h},_chooseSubtree:function(r,t,e,o){for(var a,l,h,f,p,d,g,_;o.push(t),!(t.leaf||o.length-1===e);){for(g=_=1/0,a=0,l=t.children.length;a<l;a++)h=t.children[a],p=Mp(h),d=ET(r,h)-p,d<_?(_=d,g=p<g?p:g,f=h):d===_&&p<g&&(g=p,f=h);t=f||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),l=[],h=this._chooseSubtree(a,this.data,t,l);for(h.children.push(r),Yu(h,a);t>=0&&l[t].children.length>this._maxEntries;)this._split(l,t),t--;this._adjustParentBBoxes(a,l,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var l=this._chooseSplitIndex(e,a,o),h=eu(e.children.splice(l,e.children.length-l));h.height=e.height,h.leaf=e.leaf,tu(e,this.toBBox),tu(h,this.toBBox),t?r[t-1].children.push(h):this._splitRoot(e,h)},_splitRoot:function(r,t){this.data=eu([r,t]),this.data.height=r.height+1,this.data.leaf=!1,tu(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,l,h,f,p,d,g;for(p=d=1/0,o=t;o<=e-t;o++)a=Xu(r,0,o,this.toBBox),l=Xu(r,o,e,this.toBBox),h=MT(a,l),f=Mp(a)+Mp(l),h<p?(p=h,g=o,d=f<d?f:d):h===p&&f<d&&(d=f,g=o);return g},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:W0,a=r.leaf?this.compareMinY:q0,l=this._allDistMargin(r,t,e,o),h=this._allDistMargin(r,t,e,a);l<h&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,l=Xu(r,0,t,a),h=Xu(r,e-t,e,a),f=Pc(l)+Pc(h),p,d;for(p=t;p<e-t;p++)d=r.children[p],Yu(l,r.leaf?a(d):d),f+=Pc(l);for(p=e-t-1;p>=t;p--)d=r.children[p],Yu(h,r.leaf?a(d):d),f+=Pc(h);return f},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)Yu(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():tu(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 xT(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 tu(r,t){Xu(r,0,r.children.length,t,r)}function Xu(r,t,e,o,a){a||(a=eu(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var l=t,h;l<e;l++)h=r.children[l],Yu(a,r.leaf?o(h):h);return a}function Yu(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 W0(r,t){return r.minX-t.minX}function q0(r,t){return r.minY-t.minY}function Mp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Pc(r){return r.maxX-r.minX+(r.maxY-r.minY)}function ET(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 MT(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),l=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,l-o)}function wp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Ic(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function eu(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function X0(r,t,e,o,a){for(var l=[t,e],h;l.length;)e=l.pop(),t=l.pop(),!(e-t<=o)&&(h=t+Math.ceil((e-t)/o/2)*o,_T(r,h,t,e,a),l.push(t,h,h,e))}});var Q0=Zt((EO,Rp)=>{"use strict";Rp.exports=Oc;Rp.exports.default=Oc;function Oc(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=Z0(r,0,a,e,!0),h=[];if(!l||l.next===l.prev)return h;var f,p,d,g,_,y,M;if(o&&(l=LT(r,t,l,e)),r.length>80*e){f=d=r[0],p=g=r[1];for(var S=e;S<a;S+=e)_=r[S],y=r[S+1],_<f&&(f=_),y<p&&(p=y),_>d&&(d=_),y>g&&(g=y);M=Math.max(d-f,g-p),M=M!==0?32767/M:0}return Ku(l,h,e,f,p,M,0),h}function Z0(r,t,e,o,a){var l,h;if(a===Ip(r,t,e,o)>0)for(l=t;l<e;l+=o)h=$0(l,r[l],r[l+1],h);else for(l=e-o;l>=t;l-=o)h=$0(l,r[l],r[l+1],h);return h&&Dc(h,h.next)&&(ju(h),h=h.next),h}function ea(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Dc(e,e.next)||Bn(e.prev,e,e.next)===0)){if(ju(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function Ku(r,t,e,o,a,l,h){if(r){!h&&l&&UT(r,o,a,l);for(var f=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?PT(r,o,a,l):CT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),ju(r),r=d.next,f=d.next;continue}if(r=d,r===f){h?h===1?(r=IT(ea(r),t,e),Ku(r,t,e,o,a,l,2)):h===2&&RT(r,t,e,o,a,l):Ku(ea(r),t,e,o,a,l,1);break}}}}function CT(r){var t=r.prev,e=r,o=r.next;if(Bn(t,e,o)>=0)return!1;for(var a=t.x,l=e.x,h=o.x,f=t.y,p=e.y,d=o.y,g=a<l?a<h?a:h:l<h?l:h,_=f<p?f<d?f:d:p<d?p:d,y=a>l?a>h?a:h:l>h?l:h,M=f>p?f>d?f:d:p>d?p:d,S=o.next;S!==t;){if(S.x>=g&&S.x<=y&&S.y>=_&&S.y<=M&&iu(a,f,l,p,h,d,S.x,S.y)&&Bn(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function PT(r,t,e,o){var a=r.prev,l=r,h=r.next;if(Bn(a,l,h)>=0)return!1;for(var f=a.x,p=l.x,d=h.x,g=a.y,_=l.y,y=h.y,M=f<p?f<d?f:d:p<d?p:d,S=g<_?g<y?g:y:_<y?_:y,T=f>p?f>d?f:d:p>d?p:d,x=g>_?g>y?g:y:_>y?_:y,v=Cp(M,S,t,e,o),C=Cp(T,x,t,e,o),w=r.prevZ,O=r.nextZ;w&&w.z>=v&&O&&O.z<=C;){if(w.x>=M&&w.x<=T&&w.y>=S&&w.y<=x&&w!==a&&w!==h&&iu(f,g,p,_,d,y,w.x,w.y)&&Bn(w.prev,w,w.next)>=0||(w=w.prevZ,O.x>=M&&O.x<=T&&O.y>=S&&O.y<=x&&O!==a&&O!==h&&iu(f,g,p,_,d,y,O.x,O.y)&&Bn(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;w&&w.z>=v;){if(w.x>=M&&w.x<=T&&w.y>=S&&w.y<=x&&w!==a&&w!==h&&iu(f,g,p,_,d,y,w.x,w.y)&&Bn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;O&&O.z<=C;){if(O.x>=M&&O.x<=T&&O.y>=S&&O.y<=x&&O!==a&&O!==h&&iu(f,g,p,_,d,y,O.x,O.y)&&Bn(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function IT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Dc(a,l)&&J0(a,o,o.next,l)&&Qu(a,l)&&Qu(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),ju(o),ju(o.next),o=r=l),o=o.next}while(o!==r);return ea(o)}function RT(r,t,e,o,a,l){var h=r;do{for(var f=h.next.next;f!==h.prev;){if(h.i!==f.i&&kT(h,f)){var p=K0(h,f);h=ea(h,h.next),p=ea(p,p.next),Ku(h,t,e,o,a,l,0),Ku(p,t,e,o,a,l,0);return}f=f.next}h=h.next}while(h!==r)}function LT(r,t,e,o){var a=[],l,h,f,p,d;for(l=0,h=t.length;l<h;l++)f=t[l]*o,p=l<h-1?t[l+1]*o:r.length,d=Z0(r,f,p,o,!1),d===d.next&&(d.steiner=!0),a.push(zT(d));for(a.sort(NT),l=0;l<a.length;l++)e=OT(a[l],e);return e}function NT(r,t){return r.x-t.x}function OT(r,t){var e=DT(r,t);if(!e)return t;var o=K0(e,r);return ea(o,o.next),ea(e,e.next)}function DT(r,t){var e=t,o=r.x,a=r.y,l=-1/0,h;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var f=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=o&&f>l&&(l=f,h=e.x<e.next.x?e:e.next,f===o))return h}e=e.next}while(e!==t);if(!h)return null;var p=h,d=h.x,g=h.y,_=1/0,y;e=h;do o>=e.x&&e.x>=d&&o!==e.x&&iu(a<g?o:l,a,d,g,a<g?l:o,a,e.x,e.y)&&(y=Math.abs(a-e.y)/(o-e.x),Qu(e,r)&&(y<_||y===_&&(e.x>h.x||e.x===h.x&&FT(h,e)))&&(h=e,_=y)),e=e.next;while(e!==p);return h}function FT(r,t){return Bn(r.prev,r,t.prev)<0&&Bn(t.next,r,r.next)<0}function UT(r,t,e,o){var a=r;do a.z===0&&(a.z=Cp(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,BT(a)}function BT(r){var t,e,o,a,l,h,f,p,d=1;do{for(e=r,r=null,l=null,h=0;e;){for(h++,o=e,f=0,t=0;t<d&&(f++,o=o.nextZ,!!o);t++);for(p=d;f>0||p>0&&o;)f!==0&&(p===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,f--):(a=o,o=o.nextZ,p--),l?l.nextZ=a:r=a,a.prevZ=l,l=a;e=o}l.nextZ=null,d*=2}while(h>1);return r}function Cp(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 zT(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 iu(r,t,e,o,a,l,h,f){return(a-h)*(t-f)>=(r-h)*(l-f)&&(r-h)*(o-f)>=(e-h)*(t-f)&&(e-h)*(l-f)>=(a-h)*(o-f)}function kT(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!GT(r,t)&&(Qu(r,t)&&Qu(t,r)&&VT(r,t)&&(Bn(r.prev,r,t.prev)||Bn(r,t.prev,t))||Dc(r,t)&&Bn(r.prev,r,r.next)>0&&Bn(t.prev,t,t.next)>0)}function Bn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Dc(r,t){return r.x===t.x&&r.y===t.y}function J0(r,t,e,o){var a=Nc(Bn(r,t,e)),l=Nc(Bn(r,t,o)),h=Nc(Bn(e,o,r)),f=Nc(Bn(e,o,t));return!!(a!==l&&h!==f||a===0&&Lc(r,e,t)||l===0&&Lc(r,o,t)||h===0&&Lc(e,r,o)||f===0&&Lc(e,t,o))}function Lc(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 Nc(r){return r>0?1:r<0?-1:0}function GT(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&&J0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Qu(r,t){return Bn(r.prev,r,r.next)<0?Bn(r,t,r.next)>=0&&Bn(r,r.prev,t)>=0:Bn(r,t,r.prev)<0||Bn(r,r.next,t)<0}function VT(r,t){var e=r,o=!1,a=(r.x+t.x)/2,l=(r.y+t.y)/2;do e.y>l!=e.next.y>l&&e.next.y!==e.y&&a<(e.next.x-e.x)*(l-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function K0(r,t){var e=new Pp(r.i,r.x,r.y),o=new Pp(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,l.next=o,o.prev=l,o}function $0(r,t,e,o){var a=new Pp(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 ju(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 Pp(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}Oc.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,h=Math.abs(Ip(r,0,l,e));if(a)for(var f=0,p=t.length;f<p;f++){var d=t[f]*e,g=f<p-1?t[f+1]*e:r.length;h-=Math.abs(Ip(r,d,g,e))}var _=0;for(f=0;f<o.length;f+=3){var y=o[f]*e,M=o[f+1]*e,S=o[f+2]*e;_+=Math.abs((r[y]-r[S])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[S+1]-r[y+1]))}return h===0&&_===0?0:Math.abs((_-h)/h)};function Ip(r,t,e,o){for(var a=0,l=t,h=e-o;l<e;l+=o)a+=(r[h]-r[l])*(r[l+1]+r[h+1]),h=l;return a}Oc.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 l=0;l<r[a].length;l++)for(var h=0;h<t;h++)e.vertices.push(r[a][l][h]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var Fp=Zt(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.earthRadius=63710088e-1;ue.factors={centimeters:ue.earthRadius*100,centimetres:ue.earthRadius*100,degrees:ue.earthRadius/111325,feet:ue.earthRadius*3.28084,inches:ue.earthRadius*39.37,kilometers:ue.earthRadius/1e3,kilometres:ue.earthRadius/1e3,meters:ue.earthRadius,metres:ue.earthRadius,miles:ue.earthRadius/1609.344,millimeters:ue.earthRadius*1e3,millimetres:ue.earthRadius*1e3,nauticalmiles:ue.earthRadius/1852,radians:1,yards:ue.earthRadius*1.0936};ue.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/ue.earthRadius,yards:1.0936133};ue.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 Ss(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}ue.feature=Ss;function WT(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Lp(t).geometry;case"LineString":return Op(t).geometry;case"Polygon":return Np(t).geometry;case"MultiPoint":return ty(t).geometry;case"MultiLineString":return j0(t).geometry;case"MultiPolygon":return ey(t).geometry;default:throw new Error(r+" is invalid")}}ue.geometry=WT;function Lp(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(!Fc(r[0])||!Fc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Ss(o,t,e)}ue.point=Lp;function qT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Lp(o,t)}),e)}ue.points=qT;function Np(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<l[l.length-1].length;h++)if(l[l.length-1][h]!==l[0][h])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:r};return Ss(f,t,e)}ue.polygon=Np;function XT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Np(o,t)}),e)}ue.polygons=XT;function Op(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 Ss(o,t,e)}ue.lineString=Op;function YT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Op(o,t)}),e)}ue.lineStrings=YT;function Uc(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}ue.featureCollection=Uc;function j0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Ss(o,t,e)}ue.multiLineString=j0;function ty(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Ss(o,t,e)}ue.multiPoint=ty;function ey(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Ss(o,t,e)}ue.multiPolygon=ey;function $T(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Ss(o,t,e)}ue.geometryCollection=$T;function ZT(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}ue.round=ZT;function ny(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}ue.radiansToLength=ny;function Dp(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}ue.lengthToRadians=Dp;function JT(r,t){return ry(Dp(r,t))}ue.lengthToDegrees=JT;function KT(r){var t=r%360;return t<0&&(t+=360),t}ue.bearingToAzimuth=KT;function ry(r){var t=r%(2*Math.PI);return t*180/Math.PI}ue.radiansToDegrees=ry;function QT(r){var t=r%360;return t*Math.PI/180}ue.degreesToRadians=QT;function jT(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 ny(Dp(r,t),e)}ue.convertLength=jT;function tA(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=ue.areaFactors[t];if(!o)throw new Error("invalid original units");var a=ue.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}ue.convertArea=tA;function Fc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ue.isNumber=Fc;function eA(r){return!!r&&r.constructor===Object}ue.isObject=eA;function nA(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(!Fc(t))throw new Error("bbox must only contain numbers")})}ue.validateBBox=nA;function rA(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")}ue.validateId=rA});var Bp=Zt(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});var Vr=Fp();function tl(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,_=0,y,M=r.type,S=M==="FeatureCollection",T=M==="Feature",x=S?r.features.length:1,v=0;v<x;v++){d=S?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,f=y?d.geometries.length:1;for(var C=0;C<f;C++){var w=0,O=0;if(h=y?d.geometries[C]:d,h!==null){p=h.coordinates;var F=h.type;switch(g=e&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(t(p,_,v,w,O)===!1)return!1;_++,w++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,w,O)===!1)return!1;_++,F==="MultiPoint"&&w++}F==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,w,O)===!1)return!1;_++}F==="MultiLineString"&&w++,F==="Polygon"&&O++}F==="Polygon"&&w++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(O=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,w,O)===!1)return!1;_++}O++}w++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(tl(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function iA(r,t,e,o){var a=e;return tl(r,function(l,h,f,p,d){h===0&&e===void 0?a=l:a=t(a,l,h,f,p,d)},o),a}function iy(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 oA(r,t,e){var o=e;return iy(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function oy(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 sA(r,t,e){var o=e;return oy(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function aA(r){var t=[];return tl(r,function(e){t.push(e)}),t}function Up(r,t){var e,o,a,l,h,f,p,d,g,_,y=0,M=r.type==="FeatureCollection",S=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(f=M?r.features[e].geometry:S?r.geometry:r,d=M?r.features[e].properties:S?r.properties:{},g=M?r.features[e].bbox:S?r.bbox:void 0,_=M?r.features[e].id:S?r.id:void 0,p=f?f.type==="GeometryCollection":!1,h=p?f.geometries.length:1,a=0;a<h;a++){if(l=p?f.geometries[a]:f,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function uA(r,t,e){var o=e;return Up(r,function(a,l,h,f,p){l===0&&e===void 0?o=a:o=t(o,a,l,h,f,p)}),o}function Bc(r,t){Up(r,function(e,o,a,l,h){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(Vr.feature(e,a,{bbox:l,id:h}),o,0)===!1?!1:void 0}var p;switch(f){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(Vr.feature(_,a),o,d)===!1)return!1}})}function lA(r,t,e){var o=e;return Bc(r,function(a,l,h){l===0&&h===0&&e===void 0?o=a:o=t(o,a,l,h)}),o}function sy(r,t){Bc(r,function(e,o,a){var l=0;if(e.geometry){var h=e.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var f,p=0,d=0,g=0;if(tl(e,function(_,y,M,S,T){if(f===void 0||o>p||S>d||T>g){f=_,p=o,d=S,g=T,l=0;return}var x=Vr.lineString([f,_],e.properties);if(t(x,o,a,T,l)===!1)return!1;l++,f=_})===!1)return!1}}})}function cA(r,t,e){var o=e,a=!1;return sy(r,function(l,h,f,p,d){a===!1&&e===void 0?o=l:o=t(o,l,h,f,p,d),a=!0}),o}function ay(r,t){if(!r)throw new Error("geojson is required");Bc(r,function(e,o,a){if(e.geometry!==null){var l=e.geometry.type,h=e.geometry.coordinates;switch(l){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var f=0;f<h.length;f++)if(t(Vr.lineString(h[f],e.properties),o,a,f)===!1)return!1;break}}})}function hA(r,t,e){var o=e;return ay(r,function(a,l,h,f){l===0&&e===void 0?o=a:o=t(o,a,l,h,f)}),o}function fA(r,t){if(t=t||{},!Vr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.segmentIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=p.length+l-1),Vr.lineString([p[l],p[l+1]],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l-1),Vr.lineString([p[a][l],p[a][l+1]],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l-1),Vr.lineString([p[o][l],p[o][l+1]],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l-1),Vr.lineString([p[o][a][l],p[o][a][l+1]],h,t)}throw new Error("geojson is invalid")}function pA(r,t){if(t=t||{},!Vr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.coordIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":return Vr.point(p,h,t);case"MultiPoint":return o<0&&(o=p.length+o),Vr.point(p[o],h,t);case"LineString":return l<0&&(l=p.length+l),Vr.point(p[l],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Vr.point(p[a][l],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Vr.point(p[o][l],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l),Vr.point(p[o][a][l],h,t)}throw new Error("geojson is invalid")}or.coordAll=aA;or.coordEach=tl;or.coordReduce=iA;or.featureEach=oy;or.featureReduce=sA;or.findPoint=pA;or.findSegment=fA;or.flattenEach=Bc;or.flattenReduce=lA;or.geomEach=Up;or.geomReduce=uA;or.lineEach=ay;or.lineReduce=hA;or.propEach=iy;or.propReduce=oA;or.segmentEach=sy;or.segmentReduce=cA});var uy=Zt(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var dA=Bp();function zp(r){var t=[1/0,1/0,-1/0,-1/0];return dA.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}zp.default=zp;kp.default=zp});var zc=Zt((UO,Gp)=>{var _o=fp(),cy=Fp(),hy=Bp(),ou=uy().default,mA=hy.featureEach,DO=hy.coordEach,FO=cy.polygon,ly=cy.featureCollection;function fy(r){var t=new _o(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:ou(e),_o.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:ou(a),o.push(a)}):mA(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ou(a),o.push(a)}),_o.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:ou(e),_o.prototype.remove.call(this,e,o)},t.clear=function(){return _o.prototype.clear.call(this)},t.search=function(e){var o=_o.prototype.search.call(this,this.toBBox(e));return ly(o)},t.collides=function(e){return _o.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=_o.prototype.all.call(this);return ly(e)},t.toJSON=function(){return _o.prototype.toJSON.call(this)},t.fromJSON=function(e){return _o.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=ou(e);else if(e.type==="FeatureCollection")o=ou(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Gp.exports=fy;Gp.exports.default=fy});var Yp=Zt((X3,My)=>{"use strict";var Ey=Object.prototype.toString;My.exports=function(t){var e=Ey.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Ey.call(t.callee)==="[object Function]"),o}});var Ry=Zt((Y3,Iy)=>{"use strict";var Py;Object.keys||(rl=Object.prototype.hasOwnProperty,$p=Object.prototype.toString,wy=Yp(),Zp=Object.prototype.propertyIsEnumerable,Sy=!Zp.call({toString:null},"toString"),by=Zp.call(function(){},"prototype"),il=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Wc=function(r){var t=r.constructor;return t&&t.prototype===r},Ty={$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},Ay=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!Ty["$"+r]&&rl.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Wc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),Cy=function(r){if(typeof window=="undefined"||!Ay)return Wc(r);try{return Wc(r)}catch(t){return!1}},Py=function(t){var e=t!==null&&typeof t=="object",o=$p.call(t)==="[object Function]",a=wy(t),l=e&&$p.call(t)==="[object String]",h=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var f=by&&o;if(l&&t.length>0&&!rl.call(t,0))for(var p=0;p<t.length;++p)h.push(String(p));if(a&&t.length>0)for(var d=0;d<t.length;++d)h.push(String(d));else for(var g in t)!(f&&g==="prototype")&&rl.call(t,g)&&h.push(String(g));if(Sy)for(var _=Cy(t),y=0;y<il.length;++y)!(_&&il[y]==="constructor")&&rl.call(t,il[y])&&h.push(il[y]);return h});var rl,$p,wy,Zp,Sy,by,il,Wc,Ty,Ay,Cy;Iy.exports=Py});var Jp=Zt(($3,Oy)=>{"use strict";var bA=Array.prototype.slice,TA=Yp(),Ly=Object.keys,qc=Ly?function(t){return Ly(t)}:Ry(),Ny=Object.keys;qc.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 TA(o)?Ny(bA.call(o)):Ny(o)})}else Object.keys=qc;return Object.keys||qc};Oy.exports=qc});var Kp=Zt((Z3,Dy)=>{"use strict";Dy.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 l=Object.getOwnPropertySymbols(t);if(l.length!==1||l[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(t,e);if(h.value!==a||h.enumerable!==!0)return!1}return!0}});var Xc=Zt((J3,Fy)=>{"use strict";var AA=Kp();Fy.exports=function(){return AA()&&!!Symbol.toStringTag}});var zy=Zt((K3,By)=>{"use strict";var Uy=typeof Symbol!="undefined"&&Symbol,CA=Kp();By.exports=function(){return typeof Uy!="function"||typeof Symbol!="function"||typeof Uy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:CA()}});var Vy=Zt((Q3,Gy)=>{"use strict";var ky={foo:{}},PA=Object;Gy.exports=function(){return{__proto__:ky}.foo===ky.foo&&!({__proto__:null}instanceof PA)}});var qy=Zt((j3,Wy)=>{"use strict";var IA="Function.prototype.bind called on incompatible ",RA=Object.prototype.toString,LA=Math.max,NA="[object Function]",Hy=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var l=0;l<e.length;l+=1)o[l+t.length]=e[l];return o},OA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},DA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};Wy.exports=function(t){var e=this;if(typeof e!="function"||RA.apply(e)!==NA)throw new TypeError(IA+e);for(var o=OA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,Hy(o,arguments));return Object(g)===g?g:this}return e.apply(t,Hy(o,arguments))},h=LA(0,e.length-o.length),f=[],p=0;p<h;p++)f[p]="$"+p;if(a=Function("binder","return function ("+DA(f,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,a.prototype=new d,d.prototype=null}return a}});var Yc=Zt((tF,Xy)=>{"use strict";var FA=qy();Xy.exports=Function.prototype.bind||FA});var $y=Zt((eF,Yy)=>{"use strict";var UA=Function.prototype.call,BA=Object.prototype.hasOwnProperty,zA=Yc();Yy.exports=zA.call(UA,BA)});var ia=Zt((nF,jy)=>{"use strict";var tn,lu=SyntaxError,Qy=Function,uu=TypeError,Qp=function(r){try{return Qy('"use strict"; return ('+r+").constructor;")()}catch(t){}},na=Object.getOwnPropertyDescriptor;if(na)try{na({},"")}catch(r){na=null}var jp=function(){throw new uu},kA=na?function(){try{return arguments.callee,jp}catch(r){try{return na(arguments,"callee").get}catch(t){return jp}}}():jp,su=zy()(),GA=Vy()(),_r=Object.getPrototypeOf||(GA?function(r){return r.__proto__}:null),au={},VA=typeof Uint8Array=="undefined"||!_r?tn:_r(Uint8Array),ra={"%AggregateError%":typeof AggregateError=="undefined"?tn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?tn:ArrayBuffer,"%ArrayIteratorPrototype%":su&&_r?_r([][Symbol.iterator]()):tn,"%AsyncFromSyncIteratorPrototype%":tn,"%AsyncFunction%":au,"%AsyncGenerator%":au,"%AsyncGeneratorFunction%":au,"%AsyncIteratorPrototype%":au,"%Atomics%":typeof Atomics=="undefined"?tn:Atomics,"%BigInt%":typeof BigInt=="undefined"?tn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?tn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?tn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?tn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?tn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?tn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?tn:FinalizationRegistry,"%Function%":Qy,"%GeneratorFunction%":au,"%Int8Array%":typeof Int8Array=="undefined"?tn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?tn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?tn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":su&&_r?_r(_r([][Symbol.iterator]())):tn,"%JSON%":typeof JSON=="object"?JSON:tn,"%Map%":typeof Map=="undefined"?tn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!su||!_r?tn:_r(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?tn:Promise,"%Proxy%":typeof Proxy=="undefined"?tn:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?tn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?tn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!su||!_r?tn:_r(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?tn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":su&&_r?_r(""[Symbol.iterator]()):tn,"%Symbol%":su?Symbol:tn,"%SyntaxError%":lu,"%ThrowTypeError%":kA,"%TypedArray%":VA,"%TypeError%":uu,"%Uint8Array%":typeof Uint8Array=="undefined"?tn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?tn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?tn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?tn:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?tn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?tn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?tn:WeakSet};if(_r)try{null.error}catch(r){Zy=_r(_r(r)),ra["%Error.prototype%"]=Zy}var Zy,HA=function r(t){var e;if(t==="%AsyncFunction%")e=Qp("async function () {}");else if(t==="%GeneratorFunction%")e=Qp("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Qp("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&_r&&(e=_r(a.prototype))}return ra[t]=e,e},Jy={"%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"]},ol=Yc(),$c=$y(),WA=ol.call(Function.call,Array.prototype.concat),qA=ol.call(Function.apply,Array.prototype.splice),Ky=ol.call(Function.call,String.prototype.replace),Zc=ol.call(Function.call,String.prototype.slice),XA=ol.call(Function.call,RegExp.prototype.exec),YA=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,$A=/\\\\(\\\\)?/g,ZA=function(t){var e=Zc(t,0,1),o=Zc(t,-1);if(e==="%"&&o!=="%")throw new lu("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new lu("invalid intrinsic syntax, expected opening \`%\`");var a=[];return Ky(t,YA,function(l,h,f,p){a[a.length]=f?Ky(p,$A,"$1"):h||l}),a},JA=function(t,e){var o=t,a;if($c(Jy,o)&&(a=Jy[o],o="%"+a[0]+"%"),$c(ra,o)){var l=ra[o];if(l===au&&(l=HA(o)),typeof l=="undefined"&&!e)throw new uu("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new lu("intrinsic "+t+" does not exist!")};jy.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new uu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new uu('"allowMissing" argument must be a boolean');if(XA(/^%?[^%]*%?$/,t)===null)throw new lu("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=ZA(t),a=o.length>0?o[0]:"",l=JA("%"+a+"%",e),h=l.name,f=l.value,p=!1,d=l.alias;d&&(a=d[0],qA(o,WA([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Zc(y,0,1),S=Zc(y,-1);if((M==='"'||M==="'"||M==="\`"||S==='"'||S==="'"||S==="\`")&&M!==S)throw new lu("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,h="%"+a+"%",$c(ra,h))f=ra[h];else if(f!=null){if(!(y in f)){if(!e)throw new uu("base intrinsic for "+t+" exists, but the property is not available.");return}if(na&&g+1>=o.length){var T=na(f,y);_=!!T,_&&"get"in T&&!("originalValue"in T.get)?f=T.get:f=f[y]}else _=$c(f,y),f=f[y];_&&!p&&(ra[h]=f)}}return f}});var sl=Zt((rF,tv)=>{"use strict";var KA=ia(),td=KA("%Object.defineProperty%",!0),ed=function(){if(td)try{return td({},"a",{value:1}),!0}catch(t){return!1}return!1};ed.hasArrayLengthDefineBug=function(){if(!ed())return null;try{return td([],"length",{value:1}).length!==1}catch(t){return!0}};tv.exports=ed});var nd=Zt((iF,ev)=>{"use strict";var QA=ia(),Jc=QA("%Object.getOwnPropertyDescriptor%",!0);if(Jc)try{Jc([],"length")}catch(r){Jc=null}ev.exports=Jc});var Kc=Zt((oF,rv)=>{"use strict";var jA=sl()(),rd=ia(),al=jA&&rd("%Object.defineProperty%",!0);if(al)try{al({},"a",{value:1})}catch(r){al=!1}var tC=rd("%SyntaxError%"),cu=rd("%TypeError%"),nv=nd();rv.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new cu("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new cu("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new cu("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new cu("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new cu("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new cu("\`loose\`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,p=!!nv&&nv(t,e);if(al)al(t,e,{configurable:h===null&&p?p.configurable:!h,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(f||!a&&!l&&!h)t[e]=o;else throw new tC("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var lv=Zt((sF,uv)=>{"use strict";var av=ia(),iv=Kc(),eC=sl()(),ov=nd(),sv=av("%TypeError%"),nC=av("%Math.floor%");uv.exports=function(t,e){if(typeof t!="function")throw new sv("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||nC(e)!==e)throw new sv("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&ov){var h=ov(t,"length");h&&!h.configurable&&(a=!1),h&&!h.writable&&(l=!1)}return(a||l||!o)&&(eC?iv(t,"length",e,!0,!0):iv(t,"length",e)),t}});var jc=Zt((aF,Qc)=>{"use strict";var id=Yc(),hu=ia(),rC=lv(),iC=hu("%TypeError%"),hv=hu("%Function.prototype.apply%"),fv=hu("%Function.prototype.call%"),pv=hu("%Reflect.apply%",!0)||id.call(fv,hv),ul=hu("%Object.defineProperty%",!0),oC=hu("%Math.max%");if(ul)try{ul({},"a",{value:1})}catch(r){ul=null}Qc.exports=function(t){if(typeof t!="function")throw new iC("a function is required");var e=pv(id,fv,arguments);return rC(e,1+oC(0,t.length-(arguments.length-1)),!0)};var cv=function(){return pv(id,hv,arguments)};ul?ul(Qc.exports,"apply",{value:cv}):Qc.exports.apply=cv});var od=Zt((uF,gv)=>{"use strict";var dv=ia(),mv=jc(),sC=mv(dv("String.prototype.indexOf"));gv.exports=function(t,e){var o=dv(t,!!e);return typeof o=="function"&&sC(t,".prototype.")>-1?mv(o):o}});var _v=Zt((lF,vv)=>{"use strict";var aC=Xc()(),uC=od(),sd=uC("Object.prototype.toString"),th=function(t){return aC&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:sd(t)==="[object Arguments]"},yv=function(t){return th(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&sd(t)!=="[object Array]"&&sd(t.callee)==="[object Function]"},lC=function(){return th(arguments)}();th.isLegacyArguments=yv;vv.exports=lC?th:yv});var fu=Zt((cF,wv)=>{"use strict";var cC=Jp(),hC=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",fC=Object.prototype.toString,pC=Array.prototype.concat,xv=Kc(),dC=function(r){return typeof r=="function"&&fC.call(r)==="[object Function]"},Ev=sl()(),mC=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!dC(o)||!o())return}Ev?xv(r,t,e,!0):xv(r,t,e)},Mv=function(r,t){var e=arguments.length>2?arguments[2]:{},o=cC(t);hC&&(o=pC.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)mC(r,o[a],t[o[a]],e[o[a]])};Mv.supportsDescriptors=!!Ev;wv.exports=Mv});var ad=Zt((hF,bv)=>{"use strict";var Sv=function(r){return r!==r};bv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Sv(t)&&Sv(e))}});var ud=Zt((fF,Tv)=>{"use strict";var gC=ad();Tv.exports=function(){return typeof Object.is=="function"?Object.is:gC}});var Cv=Zt((pF,Av)=>{"use strict";var yC=ud(),vC=fu();Av.exports=function(){var t=yC();return vC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Lv=Zt((dF,Rv)=>{"use strict";var _C=fu(),xC=jc(),EC=ad(),Pv=ud(),MC=Cv(),Iv=xC(Pv(),Object);_C(Iv,{getPolyfill:Pv,implementation:EC,shim:MC});Rv.exports=Iv});var Uv=Zt((mF,Fv)=>{"use strict";var ld=od(),Nv=Xc()(),Ov,Dv,cd,hd;Nv&&(Ov=ld("Object.prototype.hasOwnProperty"),Dv=ld("RegExp.prototype.exec"),cd={},eh=function(){throw cd},hd={toString:eh,valueOf:eh},typeof Symbol.toPrimitive=="symbol"&&(hd[Symbol.toPrimitive]=eh));var eh,wC=ld("Object.prototype.toString"),SC=Object.getOwnPropertyDescriptor,bC="[object RegExp]";Fv.exports=Nv?function(t){if(!t||typeof t!="object")return!1;var e=SC(t,"lastIndex"),o=e&&Ov(e,"value");if(!o)return!1;try{Dv(t,hd)}catch(a){return a===cd}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:wC(t)===bC}});var zv=Zt((gF,Bv)=>{"use strict";var cl=function(){return typeof function(){}.name=="string"},ll=Object.getOwnPropertyDescriptor;if(ll)try{ll([],"length")}catch(r){ll=null}cl.functionsHaveConfigurableNames=function(){if(!cl()||!ll)return!1;var t=ll(function(){},"name");return!!t&&!!t.configurable};var TC=Function.prototype.bind;cl.boundFunctionsHaveNames=function(){return cl()&&typeof TC=="function"&&function(){}.bind().name!==""};Bv.exports=cl});var Vv=Zt((yF,Gv)=>{"use strict";var kv=Kc(),AC=sl()(),CC=zv().functionsHaveConfigurableNames(),PC=TypeError;Gv.exports=function(t,e){if(typeof t!="function")throw new PC("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||CC)&&(AC?kv(t,"name",e,!0,!0):kv(t,"name",e)),t}});var fd=Zt((vF,Hv)=>{"use strict";var IC=Vv(),RC=Object,LC=TypeError;Hv.exports=IC(function(){if(this!=null&&this!==RC(this))throw new LC("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 pd=Zt((_F,Wv)=>{"use strict";var NC=fd(),OC=fu().supportsDescriptors,DC=Object.getOwnPropertyDescriptor;Wv.exports=function(){if(OC&&/a/mig.flags==="gim"){var t=DC(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 NC}});var Yv=Zt((xF,Xv)=>{"use strict";var FC=fu().supportsDescriptors,UC=pd(),BC=Object.getOwnPropertyDescriptor,zC=Object.defineProperty,kC=TypeError,qv=Object.getPrototypeOf,GC=/a/;Xv.exports=function(){if(!FC||!qv)throw new kC("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=UC(),e=qv(GC),o=BC(e,"flags");return(!o||o.get!==t)&&zC(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Kv=Zt((EF,Jv)=>{"use strict";var VC=fu(),HC=jc(),WC=fd(),$v=pd(),qC=Yv(),Zv=HC($v());VC(Zv,{getPolyfill:$v,implementation:WC,shim:qC});Jv.exports=Zv});var jv=Zt((MF,Qv)=>{"use strict";var XC=Date.prototype.getDay,YC=function(t){try{return XC.call(t),!0}catch(e){return!1}},$C=Object.prototype.toString,ZC="[object Date]",JC=Xc()();Qv.exports=function(t){return typeof t!="object"||t===null?!1:JC?YC(t):$C.call(t)===ZC}});var dd=Zt((wF,c_)=>{var t_=Jp(),e_=_v(),n_=Lv(),r_=Uv(),i_=Kv(),o_=jv(),s_=Date.prototype.getTime;function l_(r,t,e){var o=e||{};return(o.strict?n_(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?n_(r,t):r==t:KC(r,t,o)}function a_(r){return r==null}function u_(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 KC(r,t,e){var o,a;if(typeof r!=typeof t||a_(r)||a_(t)||r.prototype!==t.prototype||e_(r)!==e_(t))return!1;var l=r_(r),h=r_(t);if(l!==h)return!1;if(l||h)return r.source===t.source&&i_(r)===i_(t);if(o_(r)&&o_(t))return s_.call(r)===s_.call(t);var f=u_(r),p=u_(t);if(f!==p)return!1;if(f||p){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 d=t_(r),g=t_(t)}catch(_){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),o=d.length-1;o>=0;o--)if(d[o]!=g[o])return!1;for(o=d.length-1;o>=0;o--)if(a=d[o],!l_(r[a],t[a],e))return!1;return!0}c_.exports=l_});var Td=Zt((PB,y_)=>{var GP=dd(),xo=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:VP};xo.prototype.compare=function(r,t){if(r.type!==t.type||!g_(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=m_(r),a=m_(t);return o.every(function(l){return this.some(function(h){return e.compare(l,h)})},a)}}return!1};function m_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function g_(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}xo.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};xo.prototype.compareLine=function(r,t,e,o){if(!g_(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),l=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],l[0])&&(l=this.fixStartIndex(l,a),!l))){var h=this.compareCoord(a[e],l[e]);return this.direction||h?this.comparePath(a,l):this.compareCoord(a[e],l[l.length-(1+e)])?this.comparePath(a.slice().reverse(),l):!1}};xo.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};xo.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};xo.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(l){return this.some(function(h){return a.compareLine(l,h,1,!0)})},o)}else return!1};xo.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)};xo.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};xo.prototype.removePseudo=function(r){return r};function VP(r,t){return GP(r,t,{strict:!0})}y_.exports=xo});var v_=Zt((GB,ih)=>{function Ts(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)}Ts.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 l=this._regionQuery(a);if(l.length<this.minPts)this.noise.push(a);else{var h=this.clusters.length;this.clusters.push([]),this._addToCluster(a,h),this._expandCluster(h,l)}}return this.clusters};Ts.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)};Ts.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)}};Ts.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};Ts.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};Ts.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};Ts.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 ih!="undefined"&&ih.exports&&(ih.exports=Ts)});var __=Zt((VB,oh)=>{function As(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}As.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)};As.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 l=0;l<this.k;l++){for(var h=new Array(g),f=0,p=0;p<g;p++)h[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(l===this.assignments[d]){for(var p=0;p<g;p++)h[p]+=this.dataset[d][p];f++}}if(f>0){for(var p=0;p<g;p++)h[p]/=f;this.centroids[l]=h}else this.centroids[l]=this.randomCentroid(),a=!0}}return this.getClusters()};As.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};As.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};As.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};As.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,l=t.length,h,f=0;f<l;f++)h=e(r,t[f]),h<o&&(o=h,a=f);return a};As.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 oh!="undefined"&&oh.exports&&(oh.exports=As)});var Ad=Zt((HB,sh)=>{function Eo(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}Eo.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)};Eo.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}}};Eo.prototype.forEach=function(r){this._queue.forEach(r)};Eo.prototype.getElements=function(){return this._queue};Eo.prototype.getElementPriority=function(r){return this._priorities[r]};Eo.prototype.getPriorities=function(){return this._priorities};Eo.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};Eo.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)};Eo.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 sh!="undefined"&&sh.exports&&(sh.exports=Eo)});var E_=Zt((WB,du)=>{typeof du!="undefined"&&du.exports&&(x_=Ad());var x_;function jo(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)}jo.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,l=this.dataset.length;a<l;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var h=this.clusters.length-1;this._orderedList.push(a);var f=new x_(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,f),this._expandCluster(h,f))}return this.clusters};jo.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};jo.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)};jo.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 l=o.distance(o.dataset[r],o.dataset[a]),h=Math.max(o._coreDistance,l);o._reachability[a]===void 0?(o._reachability[a]=h,e.insert(a,h)):h<o._reachability[a]&&(o._reachability[a]=h,e.remove(a),e.insert(a,h))}})};jo.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var l=e[o];if(this._processed[l]===void 0){var h=this._regionQuery(l);this._processed[l]=1,this.clusters[r].push(l),this._orderedList.push(l),this._distanceToCore(l)!==void 0&&(this._updateQueue(l,h,t),this._expandCluster(r,t))}}};jo.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}};jo.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};jo.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 du!="undefined"&&du.exports&&(du.exports=jo)});var M_=Zt((qB,ah)=>{typeof ah!="undefined"&&ah.exports&&(ah.exports={DBSCAN:v_(),KMEANS:__(),OPTICS:E_(),PriorityQueue:Ad()})});var Cd=Zt((KB,S_)=>{"use strict";S_.exports={eudist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++){var f=(t[h]||0)-(e[h]||0);l+=f*f}return o?Math.sqrt(l):l},mandist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++)l+=Math.abs((t[h]||0)-(e[h]||0));return o?Math.sqrt(l):l},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var A_=Zt((QB,T_)=>{"use strict";var b_=Cd(),$P=b_.eudist,ZP=b_.dist;T_.exports={kmrand:function(t,e){for(var o={},a=[],l=e<<2,h=t.length,f=t[0].length>0;a.length<e&&l-- >0;){var p=t[Math.floor(Math.random()*h)],d=f?p.join("_"):""+p;o[d]||(o[d]=!0,a.push(p))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?$P:ZP,a=[],l=t.length,h=t[0].length>0,f={},p=t[Math.floor(Math.random()*l)],d=h?p.join("_"):""+p;for(a.push(p),f[d]=!0;a.length<e;){for(var g=[],_=a.length,y=0,M=[],S=0;S<l;S++){for(var T=1/0,x=0;x<_;x++){var v=o(t[S],a[x]);v<=T&&(T=v)}g[S]=T}for(var C=0;C<l;C++)y+=g[C];for(var w=0;w<l;w++)M[w]={i:w,v:t[w],pr:g[w]/y,cs:0};M.sort(function(z,L){return z.pr-L.pr}),M[0].cs=M[0].pr;for(var O=1;O<l;O++)M[O].cs=M[O-1].cs+M[O].pr;for(var F=Math.random(),G=0;G<l-1&&M[G++].cs<F;);a.push(M[G-1].v)}return a}}});var L_=Zt((ez,R_)=>{"use strict";var Pd=Cd(),I_=A_(),JP=Pd.eudist,jB=Pd.mandist,tz=Pd.dist,KP=I_.kmrand,QP=I_.kmpp,C_=1e4;function P_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function jP(r,t,e,o){var a=[],l=[],h=[],f=[],p=!1,d=o||C_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=KP(r,t):e=="kmpp"?a=QP(r,t):a=e;else for(var S={};a.length<t;){var T=Math.floor(Math.random()*g);S[T]||(S[T]=!0,a.push(r[T]))}do{P_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,C=0,w=0;w<t;w++){var f=y?JP(r[x],a[w]):Math.abs(r[x]-a[w]);f<=v&&(v=f,C=w)}h[x]=C,M[C]++}for(var O=[],l=[],F=0,G=0;G<t;G++)O[G]=y?P_(_,0,O[G]):0,l[G]=a[G];if(y){for(var z=0;z<t;z++)a[z]=[];for(var L=0;L<g;L++)for(var D=h[L],q=O[D],nt=r[L],k=0;k<_;k++)q[k]+=nt[k];p=!0;for(var xt=0;xt<t;xt++){for(var X=a[xt],it=O[xt],vt=l[xt],pt=M[xt],et=0;et<_;et++)X[et]=it[et]/pt||0;if(p){for(var ot=0;ot<_;ot++)if(vt[ot]!=X[ot]){p=!1;break}}}}else{for(var V=0;V<g;V++){var K=h[V];O[K]+=r[V]}for(var at=0;at<t;at++)a[at]=O[at]/M[at]||0;p=!0;for(var Tt=0;Tt<t;Tt++)if(l[Tt]!=a[Tt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:C_-d,k:t,idxs:h,centroids:a}}R_.exports=jP});var _u=Zt((Dd,Fd)=>{(function(r,t){typeof Dd=="object"&&typeof Fd!="undefined"?Fd.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Dd,function(){"use strict";function r(J,N){if(!(J instanceof N))throw new TypeError("Cannot call a class as a function")}function t(J,N){for(var b=0;b<N.length;b++){var R=N[b];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(J,R.key,R)}}function e(J,N,b){return N&&t(J.prototype,N),b&&t(J,b),J}var o=function(){function J(N,b){this.next=null,this.key=N,this.data=b,this.left=null,this.right=null}return J}();function a(J,N){return J>N?1:J<N?-1:0}function l(J,N,b){for(var R=new o(null,null),W=R,Z=R;;){var I=b(J,N.key);if(I<0){if(N.left===null)break;if(b(J,N.left.key)<0){var P=N.left;if(N.left=P.right,P.right=N,N=P,N.left===null)break}Z.left=N,Z=N,N=N.left}else if(I>0){if(N.right===null)break;if(b(J,N.right.key)>0){var P=N.right;if(N.right=P.left,P.left=N,N=P,N.right===null)break}W.right=N,W=N,N=N.right}else break}return W.right=N.left,Z.left=N.right,N.left=R.right,N.right=R.left,N}function h(J,N,b,R){var W=new o(J,N);if(b===null)return W.left=W.right=null,W;b=l(J,b,R);var Z=R(J,b.key);return Z<0?(W.left=b.left,W.right=b,b.left=null):Z>=0&&(W.right=b.right,W.left=b,b.right=null),W}function f(J,N,b){var R=null,W=null;if(N){N=l(J,N,b);var Z=b(N.key,J);Z===0?(R=N.left,W=N.right):Z<0?(W=N.right,N.right=null,R=N):(R=N.left,N.left=null,W=N)}return{left:R,right:W}}function p(J,N,b){return N===null?J:(J===null||(N=l(J.key,N,b),N.left=J),N)}function d(J,N,b,R,W){if(J){R(""+N+(b?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+W(J)+\`
|
|
99
|
+
`,p=new R.ShaderMaterial({uniforms:{uColor:{value:new R.Color(n[0]).convertLinearToSRGB()},uGradualColor:{value:new R.Color(n[1]).convertLinearToSRGB()},center:{value:t},maxValue:{value:e},opacity:{value:i},uDirection:{value:r},uMax:{value:s},uMin:{value:l}},vertexShader:a,fragmentShader:h,side:R.DoubleSide});return this.shaderMaterialMap.set(u,p),p}async createGroundTextureMaterial({url:n,opacity:t}){let e=`${n}-${t}`;if(this.groundTextureMaterialMap.has(e))return this.groundTextureMaterialMap.get(e);let i=await this.context.textureFactory.getTexture(n),r=new R.MeshBasicMaterial({map:i,alphaTest:.2,side:R.DoubleSide});return i.needsUpdate=!0,this.groundTextureMaterialMap.set(e,r),r}createLine2MaterialMap({color:n,width:t,dashed:e}){let i=`${n}-${t}-${e}`;if(this.line2MaterialMap.has(i))return this.line2MaterialMap.get(i);let r=new Yn.LineMaterial({color:parseInt(n.slice(1),16),dashed:e,linewidth:t,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:new R.Vector2(this.context.clientSize.width,this.context.clientSize.height)});return this.line2MaterialMap.set(i,r),r}dispose(){this.lineMaterialMap.forEach((n,t)=>{n.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((n,t)=>{n.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((n,t)=>{n.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((n,t)=>{n.dispose()}),this.shaderMaterialMap.clear(),this.groundTextureMaterialMap.forEach((n,t)=>{n.dispose(),n.map?.dispose()}),this.groundTextureMaterialMap.clear(),this.line2MaterialMap.forEach((n,t)=>{n.dispose()}),this.line2MaterialMap.clear()}};var xt=y("three");var ge=class{constructor(n){this.context=n;this.registryEvent(),this.changePrevCamera()}prevCamera={position:new xt.Vector3,zoom:1,target:new xt.Vector3};enable=!0;box=new xt.Box3;updateBox(){this.box.setFromObject(this.context.scene)}setEnable(n){this.enable=n,n?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(g=>g instanceof rt).length)return null;let t=this.box,{camera:e,clientSize:{width:i,height:r}}=this.context,{min:s,max:l}=t,u=E(s,e,i,r),a=E(l,e,i,r),h=E(new xt.Vector3(s.x,l.y,l.z),e,i,r),p=E(new xt.Vector3(l.x,s.y,s.z),e,i,r),f=Math.min(u.x,a.x,h.x,p.x),m=Math.max(u.x,a.x,h.x,p.x),c=Math.min(u.y,a.y,h.y,p.y),d=Math.max(u.y,a.y,h.y,p.y);return{left:f,right:m,top:c,bottom:d}}checkDistanceToScreenEdge({left:n,right:t,top:e,bottom:i}){let{width:r,height:s}=this.context.clientSize,[l,u,a,h]=this.context.config.cameraBound.padding,p=t>=h,f=r-n>=u,m=s-e>=a,c=i>=l;return p&&f&&m&&c}onCameraChange=()=>{let n=this.getCurFloorScreenPosition();if(n){let{left:t,right:e,top:i,bottom:r}=n;this.checkDistanceToScreenEdge({left:t,right:e,top:i,bottom:r})?this.changePrevCamera():this.backToPrevCamera()}};dispose(){this.unRegistryEvent()}};var Et=y("three"),me=class{constructor(n){this.context=n}textureMap=new Map;loader=new Et.TextureLoader;async getTexture(n){if(this.textureMap.has(n))return this.textureMap.get(n);let t=this.loader.loadAsync(n).then(e=>(this.textureMap.set(n,e),e.format=Et.RGBAFormat,e.magFilter=Et.LinearFilter,e.minFilter=Et.LinearFilter,e.colorSpace="srgb",e));return this.textureMap.set(n,t),t}dispose(){this.textureMap.forEach(n=>{n instanceof Promise?n.then(t=>t.dispose()):n.dispose()}),this.textureMap.clear()}};var ye=class extends M.EventDispatcher{constructor(t,e){super();this.container=t;this.config=e;this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new ce(this),this.hoverHelper=new pe(this),this.materialFactory=new de(this),this.textureFactory=new me(this),this.resizeClientSize(),this.registryEvent()}scene=ke();renderer=Ve();camera;control;lights=We();timer=new W;tweenGroup=new bt.Group;currentFloor;selection;hoverHelper;basicRatio;materialFactory;textureFactory;cameraBound;clientSize={width:0,height:0,x:0,y:0};renderRf=0;prevCameraZoom=1;resizeClientSize(){let{x:t,y:e,width:i,height:r}=this.container.getBoundingClientRect();this.clientSize={width:i||this.container.clientWidth,height:r||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=He(t,e),this.prevCameraZoom=this.camera.zoom,this.renderer.setSize(t,e),this.control=Xe(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",()=>{let i=this.control.getPolarAngle();this.currentFloor?.setShadowOpacity(i/this.config.control.maxPolar),this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"}),this.prevCameraZoom!==this.camera.zoom&&(this.dispatchEvent({type:"control-zoom-change",zoom:this.camera.zoom}),this.prevCameraZoom=this.camera.zoom)}),this.cameraBound=new ge(this)}getRatio(t=new M.Vector3(0,0,0),e=new M.Vector3(100,0,0)){let{clientWidth:i,clientHeight:r}=this.container,s=E(t,this.camera,i,r),l=E(e,this.camera,i,r);return Math.ceil(Math.sqrt((l.x-s.x)**2+(l.y-s.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof M.AmbientLight&&(e.color=new M.Color(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let e=t.getCenter();e&&(this.lights.position.x=e.x,this.lights.position.y=e.y),this.cameraBound.updateBox()}onWindowResize=()=>{let{container:t,camera:e,renderer:i}=this,{clientWidth:r,clientHeight:s}=t;r=Math.max(1,r),s=Math.max(1,s),e.left=-r/2,e.right=r/2,e.top=s/2,e.bottom=-s/2,e.updateProjectionMatrix(),i.setSize(r,s),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:r,height:s})};onClick=t=>{let{graphics:e,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY);e.length&&this.dispatchEvent({type:"graphic-click",graphics:e,position:i});let r=this.getPoisByDeviceXy(t.offsetX,t.offsetY);r.length&&this.dispatchEvent({type:"poi-click",pois:r})};getGraphicsByDeviceXy(t,e){let i=new M.Vector2;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let r=new M.Raycaster;return r.setFromCamera(i,this.camera),r.ray.origin.sub(r.ray.direction.clone().multiplyScalar(100)),this.currentFloor?.graphicLayer.getGraphicByRaycaster(r)||{graphics:[],position:null}}getPoisByDeviceXy(t,e){let i=this.currentFloor?.poiLayer.getPoiByDeviceXy(t,e),r=this.currentFloor?.poiLayer2.getPoiByDeviceXy(t,e);return(i||[]).concat(r||[])}onPointerover=t=>{let{graphics:e,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),r=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-over",e:t,graphics:e,pois:r,position:i})};onPointermove=t=>{let{graphics:e,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),r=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-move",e:t,graphics:e,pois:r,position:i})};onPointerleave=t=>{this.dispatchEvent({type:"pointer-level"})};onSelectionSelect=({graphics:t,isMultipleSelect:e})=>{this.dispatchEvent({type:"select-graphic",graphics:t,isMultipleSelect:e})};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,e=500){return e===0?(this.control.maxPolarAngle=t,this.control.minPolarAngle=t,this.control.update(),this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,Promise.resolve()):yt(new Promise(i=>{let r={polar:this.control.getPolarAngle()},s={polar:t},l=new bt.Tween(r,this.tweenGroup).to(s,e).onUpdate(()=>{this.control.maxPolarAngle=r.polar,this.control.minPolarAngle=r.polar,this.control.update()}).onComplete(()=>{this.control.enabled=!0,this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,this.tweenGroup.remove(l),i(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}setAzimuthalAngle(t,e=500){let{maxAzimuthAngle:i,minAzimuthAngle:r}=this.control,s=i===r;if(!(!s&&t>i&&t<r)){if(e===0){this.control.maxAzimuthAngle=t,this.control.minAzimuthAngle=t,this.control.update(),s||(this.control.maxAzimuthAngle=i,this.control.minAzimuthAngle=r);return}return yt(new Promise(l=>{let u={azimuthal:this.control.getAzimuthalAngle()},a={azimuthal:t},h=new bt.Tween(u,this.tweenGroup).to(a,e).onUpdate(()=>{this.control.maxAzimuthAngle=u.azimuthal,this.control.minAzimuthAngle=u.azimuthal,this.control.update()}).onComplete(()=>{this.control.enabled=!0,s||(this.control.maxAzimuthAngle=i,this.control.minAzimuthAngle=r),this.tweenGroup.remove(h),l(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}}getCameraLookAt(){return new M.Vector3().subVectors(this.control.target,this.camera.position)}setZoom(t,e,i=500){let r=this.getCameraLookAt(),s={zoom:this.camera.zoom,target:this.control.target.clone()};if(!i){this.camera.position.copy(e.clone().sub(r)),this.control.target.copy(e),this.camera.zoom=t,this.control.update();return}return yt(new Promise(l=>{let u=new bt.Tween(s,this.tweenGroup).to({zoom:t,target:e},i).onUpdate(()=>{this.camera.position.copy(s.target.clone().sub(r)),this.control.target.copy(s.target),this.camera.zoom=s.zoom,this.control.update()}).onComplete(()=>{this.tweenGroup.remove(u),this.control.enabled=!0,l(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),i+500)}getFitCameraToObjectZoom(t,e=[20,20,20,20],i=500,r=!0){let[s,l,u,a]=e,{clientSize:{width:h,height:p}}=this,f=this.control.getPolarAngle();r&&this.setPolarAngle(0,0);let m=new M.Box3().setFromObject(t);this.setPolarAngle(f,0);let{max:c,min:d}=m,g=new M.Vector3(d.x,c.y,c.z),v=new M.Vector3(c.x,c.y,c.z),L=new M.Vector3(c.x,d.y,d.z),C=new M.Vector3(d.x,d.y,d.z),x=E(g,this.camera,h,p),w=E(v,this.camera,h,p),dt=E(C,this.camera,h,p),lt=E(L,this.camera,h,p),Be=new M.Box2().setFromPoints([new M.Vector2(x.x,x.y),new M.Vector2(w.x,w.y),new M.Vector2(dt.x,dt.y),new M.Vector2(lt.x,lt.y)]).getSize(new M.Vector2),yi=(h-l-a)/Be.x,_i=(p-s-u)/Be.y,vi=Math.min(yi,_i),xi=new M.Vector3((c.x+d.x)/2,(c.y+d.y)/2,(c.z+d.z)/2);return{zoom:vi*this.camera.zoom,center:xi}}fitCameraToObject(t,e=[20,20,20,20],i=500,r=!0){let{zoom:s,center:l}=this.getFitCameraToObjectZoom(t,e,i,r);return this.setZoom(s,l,i)}getFitCameraToGroundZoom(t=[20,20,20,20],e=500,i=!0){if(this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,e,i).zoom}fitCameraToGround(t=[20,20,20,20],e=500,i=!0){return this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundUpper,t,e,i):Promise.resolve(!1)}async setCameraPosition(t,e){let i=this.camera.position.clone(),r=this.getCameraLookAt();if(!e){this.control.enabled=!1,this.camera.position.copy(t.clone().sub(r)),this.control.target.copy(t.clone()),this.control.update(),this.control.enabled=!0;return}return yt(new Promise(s=>{let l=new bt.Tween(i,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(i.clone().sub(r)),this.control.target.copy(i.clone()),this.control.update()}).onComplete(()=>{this.tweenGroup.remove(l),this.camera.position.copy(i.clone().sub(r)),this.control.target.copy(t.clone()),this.control.update(),this.control.enabled=!0,s(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}render(){this.dispatchEvent({type:"update"}),this.tweenGroup.update(),this.renderer.render(this.scene,this.camera),this.renderRf=this.timer.requestAnimationFrame(()=>{this.render()})}pauseRender(){this.timer.cancelAnimationFrame(this.renderRf)}continueRender(){this.render()}dispose(){this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.timer.dispose(),this.renderer.dispose(),this.lights.children.forEach(t=>t.dispose()),this.materialFactory.dispose(),this.textureFactory.dispose(),Z(this.scene)}};var $n=y("lodash"),Xi={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"},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 Zn(o){return(0,$n.merge)({},Xi,o)}var Qn=y("lodash");async function Kn({brand:o,project:n},t){let{apiDomain:e,apiPath:{floorRange:i},apiInfo:r}=t,s=`${e}${i}?brand=${o}&project=${n}&phase=${n}&building=${n}`;return await fetch(s,r).then(u=>u.json()).then(u=>u.data).then(u=>{let a=(u||[])[0];return a&&(a.info=JSON.parse(a.info)),a})}async function _e({brand:o,project:n,floor:t,ts:e,resource_type_list:i},r){let{apiDomain:s,apiPath:{floorGraphic:l},apiInfo:u}=r,a=`${s}${l}?brand=${o}&project=${n}&phase=${n}&building=${n}&floor=${t}&ts=${e}&resource_type_list=${i}`;return await fetch(a,u).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(f=>f.info=JSON.parse(f.info)),p||[]))}var qi=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(qi||{}),Jn=class extends ve.EventDispatcher{constructor(t,e={}){super();this.container=t;this.config=Zn(e),this.context=new ye(t,this.config),this.registryEvent(),this.context.render()}config;context;polarKeys=[];azimuthalKeys=[];svgLine;svgPolygon;basicZoom=1;prevCameraZoom=1;type="2d";floorDataMap=new Map;buildingGroundMap=new Map;buildingGroundPromiseMap=new Map;currentBuildGround=null;observe=null;buildingCenter=[0,0];timer=new W;plugins=[];async loadGraphics({brand:t,project:e,floor:i,ts:r,resource_type_list:s}){return await _e({brand:t,project:e,floor:i,ts:r,resource_type_list:s},this.config)}changeBuildingCenter(t,{brand:e,project:i}){let r=t?Bt(t.info.geometry.cds[0]):[0,0];this.buildingCenter=r,this.dispatchEvent({type:"center-change",center:r,project:i,brand:e})}async loadBuildingGround({brand:t,project:e}){let i=Q({brand:t,project:e});if(this.buildingGroundMap.has(i)){let s=this.buildingGroundMap.get(i);return this.changeBuildingCenter(s||null,{brand:t,project:e}),s||null}if(this.buildingGroundPromiseMap.has(i))return this.buildingGroundPromiseMap.get(i);let r=new Promise(async s=>{let l=await Kn({brand:t,project:e},this.config);this.buildingGroundMap.set(i,l),this.changeBuildingCenter(l||null,{brand:t,project:e}),this.buildingGroundPromiseMap.delete(i),s(l)});return this.buildingGroundPromiseMap.set(i,r),r}async load({brand:t,project:e,floor:i,ts:r,resource_type_list:s}){let l=Q({brand:t,project:e,floor:i,ts:r,resource_type_list:s});if(this.floorDataMap.has(l))return this.floorDataMap.get(l);let[u,a]=await Promise.all([this.loadGraphics({brand:t,project:e,floor:i,ts:r,resource_type_list:s}),this.loadBuildingGround({brand:t,project:e})]);return this.transformGraphicData(u),u.forEach(h=>{h.info.transformToBuildingGround=!!a}),this.config.useFloorCache||this.floorDataMap.clear(),this.floorDataMap.set(l,u),u}transformGraphicData(t,e=this.buildingCenter,i=0){t.forEach(u=>{if(u.info.geometry.coords=JSON.parse(JSON.stringify(u.info.geometry.cds)),u.info.geometry.type==="polygon")u.info.geometry.coords.map(a=>{Array.isArray(a)&&a.forEach(h=>{h[0]-=e[0],h[1]-=e[1]})});else{let[a,h]=u.info.geometry.cds;u.info.geometry.coords=[a-e[0],h-e[1]]}});let{ground:r,markGraphic:s,graphic:l}=this.config;for(let u=0;u<t.length;u++){let a=t[u];a.info.deltaHeight=1e-5*(i+u+1),a.info.group==="ground"?(a.info.fillColor=r.color,a.info.fillOpacity=r.opacity,a.info.height=r.height,a.info.stroke=r.stroke,a.info.strokeColor=r.strokeColor,a.info.strokeOpacity=r.strokeOpacity):a.info.userData.mark?(a.info.height=s.height,a.info.fillColor=s.color,a.info.fillOpacity=s.opacity,a.info.stroke=s.stroke,a.info.strokeColor=s.strokeColor,a.info.strokeOpacity=s.strokeOpacity):(a.info.fillOpacity=l.fillOpacity,this.config.initTransToMark&&(a.info.height=s.height,a.info.fillColor=s.color,a.info.stroke=s.stroke,a.info.strokeColor=s.strokeColor,a.info.strokeOpacity=s.strokeOpacity))}}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}createFloor(t){let e=new rt(this.context);if(!t.length)return{curFloor:e,graphics:[]};let i=new Map,r=[];for(let s of t)if(s.info.group==="ground")e.createGround(s.info);else{let l=e.addGraphic(s.info);l.userData.data=s,i.set(s.legacy_id,l),r.push(l)}return e.userData.legacyToGraphicMap=i,{curFloor:e,graphics:r}}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor({brand:t,project:e,floor:i,ts:r,resource_type_list:s}){let l=Q({brand:t,project:e,floor:i,ts:r,resource_type_list:s}),u=this.floorDataMap.get(l);if(this.context.control.removeEventListener("change",this.onControlChange),u){let a=Q({brand:t,project:e});this.currentBuildGround=this.buildingGroundMap.get(a)||null;let h=this.createFloor(u);h?(h.curFloor.name=i,this.triggerHooks("switch_floor_before",h),h.curFloor.updateBox(),this.context.switchFloor(h.curFloor),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",h)):console.warn("[switchFloor error] ["+i+"] \u697C\u5C42\u6CA1\u6709\u6570\u636E")}else console.warn("[switchFloor error] \u6CA1\u6709\u8FD9\u4E2A\u697C\u5C42\uFF0C\u8BF7\u5148\u8C03\u7528load\u65B9\u6CD5\u52A0\u8F7D\u697C\u5C42")}switchFloorByData(t,e,i=e){let{curFloor:r,graphics:s}=this.createFloor(t);r.name=e,r.key=i;let l=new Map;t.forEach(u=>{l.set(u.element_uuid,u)}),r.userData.graphicMap=l,this.switchFloorByFloor(r,s)}switchFloorByFloor(t,e=t.graphicLayer.children){this.triggerHooks("switch_floor_before",{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",{curFloor:t,graphics:e})}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*25,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,e){if(t.options.geometry.type==="polygon"){let i=this.context.currentFloor?.addModel({...e,position:t.getPosition().setZ(.1),id:t.options.id});if(i){let{facilityAngle:r=0,facilityXScale:s=1,facilityYScale:l=1}=t.options.userData;i.rotateZ((180-r)/180*Math.PI),i.scale.set(s,l,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 U)||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let i=t.getCenter();return this.context.currentFloor.addPoi({...e,position:{...i,z:i.z+t.options.height/2}})}return null}removeHeatMap(){this.context.currentFloor?.removeHeatMap()}translateElementToCenter(t,e=500){let i=t.getPosition();return this.context.setCameraPosition(i,e)}async translateElementToCenterX(t,e=500){return yt(new Promise(i=>{let r=this.context.control.target.clone(),s=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:l,height:u},camera:a}=this.context,p=E(s,a,l,u).x-l/2,f=new ve.Vector3;f.setFromMatrixColumn(this.context.camera.matrix,0),f.normalize(),f.multiplyScalar(p/this.context.camera.zoom),r.add(f),this.context.setCameraPosition(r,e).then(i)})}),e+500)}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:i,clientHeight:r}=this.container;return E(e,this.context.camera,i,r)}changeMapType(t,e=500){return this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}async resetView(t=300){let e=t/3;await this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),await this.context.setPolarAngle(this.config.control.defaultPolar,e),await this.context.fitCameraToGround(this.config.defaultPadding,e,!1)}reduceMap(t=.5,e=500){let i=this.context.camera.zoom;return this.context.setZoom(i-t,this.context.control.target,e)}enlargeMap(t=.5,e=500){let i=this.context.camera.zoom;return this.context.setZoom(i+t,this.context.control.target,e)}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 e=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=e,this.context.control.minPolarAngle=e}if(this.azimuthalKeys.includes(t.code)){let e=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=e,this.context.control.minAzimuthAngle=e}};registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver((0,Qn.debounce)(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 e=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(e+t,500)}async measureDistance(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new re(this.context);let i=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){i(),e("cancel")},this.svgLine.addEventListener("distance",({distance:r})=>{t(r)})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new oe(this.context);let i=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){i(),e("cancel")},this.svgPolygon.addEventListener("area",({area:r})=>{t(r)})})}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 e=Bt(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(r=>{r[0]-=e[0],r[1]-=e[1]})});else{let[i,r]=t.geometry.cds;t.geometry.coords=[i-e[0],r-e[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(),e=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=e,this.context.control.minZoom=i,this.context.control.maxZoom=i*25,this.basicZoom=e,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.floorDataMap.clear(),this.buildingGroundMap.clear(),$e(),Ze(),rn(),this.unRegistryEvent()}};var ti=y("three"),st=class extends ti.EventDispatcher{bmap;constructor(n){super(),this.bmap=n}dispose(){}};var ei=class extends st{equipmentList=[];equipmentMap=new Map;constructor(n){super(n),this.fetchEquipment(),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}async fetchEquipment(){let{apiDomain:n,apiPath:{equipmentList:t},apiInfo:e}=this.bmap.config,i=`${n}${t}`;await fetch(i,e).then(r=>r.json()).then(r=>r.data).then(r=>{this.equipmentList=r,this.equipmentMap=new Map(r.map(s=>[s.equipment_id,s]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)}onSwitchFloor=({data:{graphics:n}})=>{this.equipmentList.length&&this.changeGraphicToEquipment(n)};getGraphicEquipment(n){return n.userData.data.info.userData.equipment}changeGraphicToEquipment(n){n.filter(t=>{let e=this.getGraphicEquipment(t);return e&&this.equipmentMap.has(e)}).forEach(t=>{let e=this.equipmentMap.get(this.getGraphicEquipment(t)),i=this.bmap.createGraphicPoi(t,{icon:e?.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=e,i.userData.type="equipment")})}dispose(){this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),Array.from(this.bmap.context.currentFloor?.poiLayer.pois||[]).forEach(n=>{n.userData.type==="equipment"&&this.bmap.context.currentFloor?.poiLayer.removePoi(n)})}};function De(o){let n=new Blob([o],{type:"text/javascript"}),t=URL.createObjectURL(n),e=new Worker(t);return URL.revokeObjectURL(t),e}function Oe(){return De(`var B1=Object.create;var Fh=Object.defineProperty;var z1=Object.getOwnPropertyDescriptor;var k1=Object.getOwnPropertyNames,gm=Object.getOwnPropertySymbols,G1=Object.getPrototypeOf,ym=Object.prototype.hasOwnProperty,V1=Object.prototype.propertyIsEnumerable;var Dh=(r,t,e)=>t in r?Fh(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ls=(r,t)=>{for(var e in t||(t={}))ym.call(t,e)&&Dh(r,e,t[e]);if(gm)for(var e of gm(t))V1.call(t,e)&&Dh(r,e,t[e]);return r};var Zt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var H1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of k1(t))!ym.call(r,a)&&a!==e&&Fh(r,a,{get:()=>t[a],enumerable:!(o=z1(t,a))||o.enumerable});return r};var Ln=(r,t,e)=>(e=r!=null?B1(G1(r)):{},H1(t||!r||!r.__esModule?Fh(e,"default",{value:r,enumerable:!0}):e,r));var dn=(r,t,e)=>Dh(r,typeof t!="symbol"?t+"":t,e);var _m=Zt((dR,vm)=>{var Uh=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)}};vm.exports=Uh});var Mm=Zt((mR,Em)=>{function xm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,xm(a,t)):o!==t&&e.set(o,a);return e}Em.exports=xm});var bm=Zt((gR,Sm)=>{function W1(r){let t=Number(r);return!(isNaN(t)||t<=0)}function wm(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,wm(a));if(!W1(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}Sm.exports=wm});var Cm=Zt((yR,Am)=>{function Tm(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){Tm(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}Am.exports=Tm});var zh=Zt((vR,Rm)=>{var q1=_m(),X1=Mm(),Pm=bm(),Im=Cm(),Bh=class{constructor(t){t instanceof Map?(Im(t),this.graph=t):t?this.graph=Pm(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(Im(e),o=e):o=Pm(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=X1(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,l=new q1,h=new Map,f=[],p=0,d=[];if(o.avoid&&(d=[].concat(o.avoid)),d.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(d.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(l.set(t,0);!l.isEmpty();){let g=l.next();if(g.key===e){p=g.priority;let y=g.key;for(;h.has(y);)f.push(y),y=h.get(y);break}a.add(g.key),(this.graph.get(g.key)||new Map).forEach((y,M)=>{if(a.has(M)||d.includes(M))return null;if(!l.has(M))return h.set(M,g.key),l.set(M,g.priority+y);let S=l.get(M).priority,T=g.priority+y;return T<S?(h.set(M,g.key),l.set(M,T)):null})}return f.length?(o.trim?f.shift():f=f.concat([t]),o.reverse||(f=f.reverse()),o.cost?{path:f,cost:p}:f):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};Rm.exports=Bh});var Mc=Zt((AR,E0)=>{"use strict";var x0=Object.getOwnPropertySymbols,Yb=Object.prototype.hasOwnProperty,$b=Object.prototype.propertyIsEnumerable;function Zb(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Jb(){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(l){return t[l]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(l){a[l]=l}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(l){return!1}}E0.exports=Jb()?Object.assign:function(r,t){for(var e,o=Zb(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var h in e)Yb.call(e,h)&&(o[h]=e[h]);if(x0){a=x0(e);for(var f=0;f<a.length;f++)$b.call(e,a[f])&&(o[a[f]]=e[a[f]])}}return o}});var fp=Zt((cp,hp)=>{(function(r,t){typeof cp=="object"&&typeof hp!="undefined"?hp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(cp,function(){"use strict";function r(x,v,C,w,O){(function F(G,z,L,D,q){for(;D>L;){if(D-L>600){var nt=D-L+1,k=z-L+1,xt=Math.log(nt),X=.5*Math.exp(2*xt/3),it=.5*Math.sqrt(xt*X*(nt-X)/nt)*(k-nt/2<0?-1:1),vt=Math.max(L,Math.floor(z-k*X/nt+it)),pt=Math.min(D,Math.floor(z+(nt-k)*X/nt+it));F(G,z,vt,pt,q)}var et=G[z],ot=L,V=D;for(t(G,L,z),q(G[D],et)>0&&t(G,L,D);ot<V;){for(t(G,ot,V),ot++,V--;q(G[ot],et)<0;)ot++;for(;q(G[V],et)>0;)V--}q(G[L],et)===0?t(G,L,V):t(G,++V,D),V<=z&&(L=V+1),z<=V&&(D=V-1)}})(x,v,C||0,w||x.length-1,O||e)}function t(x,v,C){var w=x[v];x[v]=x[C],x[C]=w}function e(x,v){return x<v?-1:x>v?1:0}var o=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(x,v,C){if(!C)return v.indexOf(x);for(var w=0;w<v.length;w++)if(C(x,v[w]))return w;return-1}function l(x,v){h(x,0,x.children.length,v,x)}function h(x,v,C,w,O){O||(O=S(null)),O.minX=1/0,O.minY=1/0,O.maxX=-1/0,O.maxY=-1/0;for(var F=v;F<C;F++){var G=x.children[F];f(O,x.leaf?w(G):G)}return O}function f(x,v){return x.minX=Math.min(x.minX,v.minX),x.minY=Math.min(x.minY,v.minY),x.maxX=Math.max(x.maxX,v.maxX),x.maxY=Math.max(x.maxY,v.maxY),x}function p(x,v){return x.minX-v.minX}function d(x,v){return x.minY-v.minY}function g(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function _(x){return x.maxX-x.minX+(x.maxY-x.minY)}function y(x,v){return x.minX<=v.minX&&x.minY<=v.minY&&v.maxX<=x.maxX&&v.maxY<=x.maxY}function M(x,v){return v.minX<=x.maxX&&v.minY<=x.maxY&&v.maxX>=x.minX&&v.maxY>=x.minY}function S(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(x,v,C,w,O){for(var F=[v,C];F.length;)if(!((C=F.pop())-(v=F.pop())<=w)){var G=v+Math.ceil((C-v)/w/2)*w;r(x,G,v,C,O),F.push(v,G,G,C)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(x){var v=this.data,C=[];if(!M(x,v))return C;for(var w=this.toBBox,O=[];v;){for(var F=0;F<v.children.length;F++){var G=v.children[F],z=v.leaf?w(G):G;M(x,z)&&(v.leaf?C.push(G):y(x,z)?this._all(G,C):O.push(G))}v=O.pop()}return C},o.prototype.collides=function(x){var v=this.data;if(!M(x,v))return!1;for(var C=[];v;){for(var w=0;w<v.children.length;w++){var O=v.children[w],F=v.leaf?this.toBBox(O):O;if(M(x,F)){if(v.leaf||y(x,F))return!0;C.push(O)}}v=C.pop()}return!1},o.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var v=0;v<x.length;v++)this.insert(x[v]);return this}var C=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===C.height)this._splitRoot(this.data,C);else{if(this.data.height<C.height){var w=this.data;this.data=C,C=w}this._insert(C,this.data.height-C.height-1,!0)}else this.data=C;return this},o.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},o.prototype.clear=function(){return this.data=S([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var C,w,O,F=this.data,G=this.toBBox(x),z=[],L=[];F||z.length;){if(F||(F=z.pop(),w=z[z.length-1],C=L.pop(),O=!0),F.leaf){var D=a(x,F.children,v);if(D!==-1)return F.children.splice(D,1),z.push(F),this._condense(z),this}O||F.leaf||!y(F,G)?w?(C++,F=w.children[C],O=!1):F=null:(z.push(F),L.push(C),C=0,w=F,F=F.children[0])}return this},o.prototype.toBBox=function(x){return x},o.prototype.compareMinX=function(x,v){return x.minX-v.minX},o.prototype.compareMinY=function(x,v){return x.minY-v.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(x){return this.data=x,this},o.prototype._all=function(x,v){for(var C=[];x;)x.leaf?v.push.apply(v,x.children):C.push.apply(C,x.children),x=C.pop();return v},o.prototype._build=function(x,v,C,w){var O,F=C-v+1,G=this._maxEntries;if(F<=G)return l(O=S(x.slice(v,C+1)),this.toBBox),O;w||(w=Math.ceil(Math.log(F)/Math.log(G)),G=Math.ceil(F/Math.pow(G,w-1))),(O=S([])).leaf=!1,O.height=w;var z=Math.ceil(F/G),L=z*Math.ceil(Math.sqrt(G));T(x,v,C,L,this.compareMinX);for(var D=v;D<=C;D+=L){var q=Math.min(D+L-1,C);T(x,D,q,z,this.compareMinY);for(var nt=D;nt<=q;nt+=z){var k=Math.min(nt+z-1,q);O.children.push(this._build(x,nt,k,w-1))}}return l(O,this.toBBox),O},o.prototype._chooseSubtree=function(x,v,C,w){for(;w.push(v),!v.leaf&&w.length-1!==C;){for(var O=1/0,F=1/0,G=void 0,z=0;z<v.children.length;z++){var L=v.children[z],D=g(L),q=(nt=x,k=L,(Math.max(k.maxX,nt.maxX)-Math.min(k.minX,nt.minX))*(Math.max(k.maxY,nt.maxY)-Math.min(k.minY,nt.minY))-D);q<F?(F=q,O=D<O?D:O,G=L):q===F&&D<O&&(O=D,G=L)}v=G||v.children[0]}var nt,k;return v},o.prototype._insert=function(x,v,C){var w=C?x:this.toBBox(x),O=[],F=this._chooseSubtree(w,this.data,v,O);for(F.children.push(x),f(F,w);v>=0&&O[v].children.length>this._maxEntries;)this._split(O,v),v--;this._adjustParentBBoxes(w,O,v)},o.prototype._split=function(x,v){var C=x[v],w=C.children.length,O=this._minEntries;this._chooseSplitAxis(C,O,w);var F=this._chooseSplitIndex(C,O,w),G=S(C.children.splice(F,C.children.length-F));G.height=C.height,G.leaf=C.leaf,l(C,this.toBBox),l(G,this.toBBox),v?x[v-1].children.push(G):this._splitRoot(C,G)},o.prototype._splitRoot=function(x,v){this.data=S([x,v]),this.data.height=x.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(x,v,C){for(var w,O,F,G,z,L,D,q=1/0,nt=1/0,k=v;k<=C-v;k++){var xt=h(x,0,k,this.toBBox),X=h(x,k,C,this.toBBox),it=(O=xt,F=X,G=void 0,z=void 0,L=void 0,D=void 0,G=Math.max(O.minX,F.minX),z=Math.max(O.minY,F.minY),L=Math.min(O.maxX,F.maxX),D=Math.min(O.maxY,F.maxY),Math.max(0,L-G)*Math.max(0,D-z)),vt=g(xt)+g(X);it<q?(q=it,w=k,nt=vt<nt?vt:nt):it===q&&vt<nt&&(nt=vt,w=k)}return w||C-v},o.prototype._chooseSplitAxis=function(x,v,C){var w=x.leaf?this.compareMinX:p,O=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,C,w)<this._allDistMargin(x,v,C,O)&&x.children.sort(w)},o.prototype._allDistMargin=function(x,v,C,w){x.children.sort(w);for(var O=this.toBBox,F=h(x,0,v,O),G=h(x,C-v,C,O),z=_(F)+_(G),L=v;L<C-v;L++){var D=x.children[L];f(F,x.leaf?O(D):D),z+=_(F)}for(var q=C-v-1;q>=v;q--){var nt=x.children[q];f(G,x.leaf?O(nt):nt),z+=_(G)}return z},o.prototype._adjustParentBBoxes=function(x,v,C){for(var w=C;w>=0;w--)f(v[w],x)},o.prototype._condense=function(x){for(var v=x.length-1,C=void 0;v>=0;v--)x[v].children.length===0?v>0?(C=x[v-1].children).splice(C.indexOf(x[v]),1):this.clear():l(x[v],this.toBBox)},o})});var M0=Zt((pp,dp)=>{(function(r,t){typeof pp=="object"&&typeof dp!="undefined"?dp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(pp,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 l=(this.length>>1)-1;l>=0;l--)this._down(l)};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,l=a.data,h=a.compare,f=l[o];o>0;){var p=o-1>>1,d=l[p];if(h(f,d)>=0)break;l[o]=d,o=p}l[o]=f},r.prototype._down=function(o){for(var a=this,l=a.data,h=a.compare,f=this.length>>1,p=l[o];o<f;){var d=(o<<1)+1,g=l[d],_=d+1;if(_<this.length&&h(l[_],g)<0&&(d=_,g=l[_]),h(g,p)>=0)break;l[o]=g,o=d}l[o]=p};function t(e,o){return e<o?-1:e>o?1:0}return r})});var S0=Zt((NR,w0)=>{w0.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=(a-o)/2,d=0,g=p-1;d<p;g=d++){var _=e[o+d*2+0],y=e[o+d*2+1],M=e[o+g*2+0],S=e[o+g*2+1],T=y>h!=S>h&&l<(M-_)*(h-y)/(S-y)+_;T&&(f=!f)}return f}});var T0=Zt((OR,b0)=>{b0.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=a-o,d=0,g=p-1;d<p;g=d++){var _=e[d+o][0],y=e[d+o][1],M=e[g+o][0],S=e[g+o][1],T=y>h!=S>h&&l<(M-_)*(h-y)/(S-y)+_;T&&(f=!f)}return f}});var P0=Zt((DR,bc)=>{var A0=S0(),C0=T0();bc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?C0(t,e,o,a):A0(t,e,o,a)};bc.exports.nested=C0;bc.exports.flat=A0});var R0=Zt((Tc,I0)=>{(function(r,t){typeof Tc=="object"&&typeof I0!="undefined"?t(Tc):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(Tc,function(r){"use strict";let e=33306690738754706e-32;function o(M,S,T,x,v){let C,w,O,F,G=S[0],z=x[0],L=0,D=0;z>G==z>-G?(C=G,G=S[++L]):(C=z,z=x[++D]);let q=0;if(L<M&&D<T)for(z>G==z>-G?(O=C-((w=G+C)-G),G=S[++L]):(O=C-((w=z+C)-z),z=x[++D]),C=w,O!==0&&(v[q++]=O);L<M&&D<T;)z>G==z>-G?(O=C-((w=C+G)-(F=w-C))+(G-F),G=S[++L]):(O=C-((w=C+z)-(F=w-C))+(z-F),z=x[++D]),C=w,O!==0&&(v[q++]=O);for(;L<M;)O=C-((w=C+G)-(F=w-C))+(G-F),G=S[++L],C=w,O!==0&&(v[q++]=O);for(;D<T;)O=C-((w=C+z)-(F=w-C))+(z-F),z=x[++D],C=w,O!==0&&(v[q++]=O);return C===0&&q!==0||(v[q++]=C),q}function a(M){return new Float64Array(M)}let l=33306690738754716e-32,h=22204460492503146e-32,f=11093356479670487e-47,p=a(4),d=a(8),g=a(12),_=a(16),y=a(4);r.orient2d=function(M,S,T,x,v,C){let w=(S-C)*(T-v),O=(M-v)*(x-C),F=w-O;if(w===0||O===0||w>0!=O>0)return F;let G=Math.abs(w+O);return Math.abs(F)>=l*G?F:-function(z,L,D,q,nt,k,xt){let X,it,vt,pt,et,ot,V,K,at,Tt,dt,Ct,Yt,Wt,Nt,ne,Pt,Xt,tt=z-nt,nn=D-nt,Gt=L-k,te=q-k;et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=tt*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=Gt*nn)-V*at-K*at-V*Tt))),p[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),p[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,p[2]=Ct-(Xt-et)+(dt-et),p[3]=Xt;let qt=function(W,Z){let I=Z[0];for(let P=1;P<W;P++)I+=Z[P];return I}(4,p),J=h*xt;if(qt>=J||-qt>=J||(X=z-(tt+(et=z-tt))+(et-nt),vt=D-(nn+(et=D-nn))+(et-nt),it=L-(Gt+(et=L-Gt))+(et-k),pt=q-(te+(et=q-te))+(et-k),X===0&&it===0&&vt===0&&pt===0)||(J=f*xt+e*Math.abs(qt),(qt+=tt*pt+te*X-(Gt*vt+nn*it))>=J||-qt>=J))return qt;et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=X*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=it*nn)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let N=o(4,p,4,y,d);et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=tt*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=Gt*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let b=o(N,d,4,y,g);et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=X*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=it*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let R=o(b,g,4,y,_);return _[R-1]}(M,S,T,x,v,C,G)},r.orient2dfast=function(M,S,T,x,v,C){return(S-C)*(T-v)-(M-v)*(x-C)},Object.defineProperty(r,"__esModule",{value:!0})})});var U0=Zt((FR,vp)=>{"use strict";var L0=fp(),Cc=M0(),Qb=P0(),jb=R0().orient2d;Cc.default&&(Cc=Cc.default);vp.exports=F0;vp.exports.default=F0;function F0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=iT(r),a=new L0(16);a.toBBox=function(C){return{minX:C[0],minY:C[1],maxX:C[0],maxY:C[1]}},a.compareMinX=function(C,w){return C[0]-w[0]},a.compareMinY=function(C,w){return C[1]-w[1]},a.load(r);for(var l=[],h=0,f;h<o.length;h++){var p=o[h];a.remove(p),f=D0(p,f),l.push(f)}var d=new L0(16);for(h=0;h<l.length;h++)d.insert(mp(l[h]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,S=y.next.p,T=gp(M,S);if(!(T<_)){var x=T/g;p=tT(a,y.prev.p,M,S,y.next.next.p,x,d),p&&Math.min(gp(p,M),gp(p,S))<=x&&(l.push(y),l.push(D0(p,y)),a.remove(p),d.remove(y),d.insert(mp(y)),d.insert(mp(y.next)))}}y=f;var v=[];do v.push(y.p),y=y.next;while(y!==f);return v.push(y.p),v}function tT(r,t,e,o,a,l,h){for(var f=new Cc([],eT),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?yp(g,e,o):nT(e,o,g);_>l||f.push({node:g,dist:_})}for(;f.length&&!f.peek().node.children;){var y=f.pop(),M=y.node,S=yp(M,t,e),T=yp(M,o,a);if(y.dist<S&&y.dist<T&&O0(e,M,h)&&O0(o,M,h))return M}p=f.pop(),p&&(p=p.node)}return null}function eT(r,t){return r.dist-t.dist}function nT(r,t,e){if(N0(r,e)||N0(t,e))return 0;var o=Ac(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=Ac(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=Ac(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var h=Ac(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return h===0?0:Math.min(o,a,l,h)}function N0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function O0(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),l=Math.max(r[0],t[0]),h=Math.max(r[1],t[1]),f=e.search({minX:o,minY:a,maxX:l,maxY:h}),p=0;p<f.length;p++)if(rT(f[p].p,f[p].next.p,r,t))return!1;return!0}function Qa(r,t,e){return jb(r[0],r[1],t[0],t[1],e[0],e[1])}function rT(r,t,e,o){return r!==o&&t!==e&&Qa(r,t,e)>0!=Qa(r,t,o)>0&&Qa(e,o,r)>0!=Qa(e,o,t)>0}function mp(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 iT(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],l=0;l<r.length;l++){var h=r[l];h[0]<t[0]&&(t=h),h[0]>o[0]&&(o=h),h[1]<e[1]&&(e=h),h[1]>a[1]&&(a=h)}var f=[t,e,o,a],p=f.slice();for(l=0;l<r.length;l++)Qb(r[l],f)||p.push(r[l]);return sT(p)}function D0(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 gp(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function yp(r,t,e){var o=t[0],a=t[1],l=e[0]-o,h=e[1]-a;if(l!==0||h!==0){var f=((r[0]-o)*l+(r[1]-a)*h)/(l*l+h*h);f>1?(o=e[0],a=e[1]):f>0&&(o+=l*f,a+=h*f)}return l=r[0]-o,h=r[1]-a,l*l+h*h}function Ac(r,t,e,o,a,l,h,f){var p=e-r,d=o-t,g=h-a,_=f-l,y=r-a,M=t-l,S=p*p+d*d,T=p*g+d*_,x=g*g+_*_,v=p*y+d*M,C=g*y+_*M,w=S*x-T*T,O,F,G,z,L=w,D=w;w===0?(F=0,L=1,z=C,D=x):(F=T*C-x*v,z=S*C-T*v,F<0?(F=0,z=C,D=x):F>L&&(F=L,z=C+T,D=x)),z<0?(z=0,-v<0?F=0:-v>S?F=L:(F=-v,L=S)):z>D&&(z=D,-v+T<0?F=0:-v+T>S?F=L:(F=-v+T,L=S)),O=F===0?0:F/L,G=z===0?0:z/D;var q=(1-O)*r+O*e,nt=(1-O)*t+O*o,k=(1-G)*a+G*h,xt=(1-G)*l+G*f,X=k-q,it=xt-nt;return X*X+it*it}function oT(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function sT(r){r.sort(oT);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Qa(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&&Qa(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 H0=Zt((xp,Ep)=>{(function(r,t){typeof xp=="object"&&typeof Ep!="undefined"?Ep.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(xp,function(){"use strict";function r(a,l,h,f,p){t(a,l,h||0,f||a.length-1,p||o)}function t(a,l,h,f,p){for(;f>h;){if(f-h>600){var d=f-h+1,g=l-h+1,_=Math.log(d),y=.5*Math.exp(2*_/3),M=.5*Math.sqrt(_*y*(d-y)/d)*(g-d/2<0?-1:1),S=Math.max(h,Math.floor(l-g*y/d+M)),T=Math.min(f,Math.floor(l+(d-g)*y/d+M));t(a,l,S,T,p)}var x=a[l],v=h,C=f;for(e(a,h,l),p(a[f],x)>0&&e(a,h,f);v<C;){for(e(a,v,C),v++,C--;p(a[v],x)<0;)v++;for(;p(a[C],x)>0;)C--}p(a[h],x)===0?e(a,h,C):(C++,e(a,C,f)),C<=l&&(h=C+1),l<=C&&(f=C-1)}}function e(a,l,h){var f=a[l];a[l]=a[h],a[h]=f}function o(a,l){return a<l?-1:a>l?1:0}return r})});var bp=Zt((u2,Sp)=>{"use strict";Sp.exports=$u;Sp.exports.default=$u;var _T=H0();function $u(r,t){if(!(this instanceof $u))return new $u(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()}$u.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Ic(r,t))return e;for(var a=[],l,h,f,p;t;){for(l=0,h=t.children.length;l<h;l++)f=t.children[l],p=t.leaf?o(f):f,Ic(r,p)&&(t.leaf?e.push(f):wp(r,p)?this._all(f,e):a.push(f));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!Ic(r,t))return!1;for(var o=[],a,l,h,f;t;){for(a=0,l=t.children.length;a<l;a++)if(h=t.children[a],f=t.leaf?e(h):h,Ic(r,f)){if(t.leaf||wp(r,f))return!0;o.push(h)}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=eu([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],l=[],h,f,p,d;e||a.length;){if(e||(e=a.pop(),f=a[a.length-1],h=l.pop(),d=!0),e.leaf&&(p=xT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&wp(e,o)?(a.push(e),l.push(h),h=0,f=e,e=e.children[0]):f?(h++,e=f.children[h],d=!1):e=null}return this},toBBox:function(r){return r},compareMinX:W0,compareMinY:q0,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,l=this._maxEntries,h;if(a<=l)return h=eu(r.slice(t,e+1)),tu(h,this.toBBox),h;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),h=eu([]),h.leaf=!1,h.height=o;var f=Math.ceil(a/l),p=f*Math.ceil(Math.sqrt(l)),d,g,_,y;for(X0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),X0(r,d,_,f,this.compareMinY),g=d;g<=_;g+=f)y=Math.min(g+f-1,_),h.children.push(this._build(r,g,y,o-1));return tu(h,this.toBBox),h},_chooseSubtree:function(r,t,e,o){for(var a,l,h,f,p,d,g,_;o.push(t),!(t.leaf||o.length-1===e);){for(g=_=1/0,a=0,l=t.children.length;a<l;a++)h=t.children[a],p=Mp(h),d=ET(r,h)-p,d<_?(_=d,g=p<g?p:g,f=h):d===_&&p<g&&(g=p,f=h);t=f||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),l=[],h=this._chooseSubtree(a,this.data,t,l);for(h.children.push(r),Yu(h,a);t>=0&&l[t].children.length>this._maxEntries;)this._split(l,t),t--;this._adjustParentBBoxes(a,l,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var l=this._chooseSplitIndex(e,a,o),h=eu(e.children.splice(l,e.children.length-l));h.height=e.height,h.leaf=e.leaf,tu(e,this.toBBox),tu(h,this.toBBox),t?r[t-1].children.push(h):this._splitRoot(e,h)},_splitRoot:function(r,t){this.data=eu([r,t]),this.data.height=r.height+1,this.data.leaf=!1,tu(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,l,h,f,p,d,g;for(p=d=1/0,o=t;o<=e-t;o++)a=Xu(r,0,o,this.toBBox),l=Xu(r,o,e,this.toBBox),h=MT(a,l),f=Mp(a)+Mp(l),h<p?(p=h,g=o,d=f<d?f:d):h===p&&f<d&&(d=f,g=o);return g},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:W0,a=r.leaf?this.compareMinY:q0,l=this._allDistMargin(r,t,e,o),h=this._allDistMargin(r,t,e,a);l<h&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,l=Xu(r,0,t,a),h=Xu(r,e-t,e,a),f=Pc(l)+Pc(h),p,d;for(p=t;p<e-t;p++)d=r.children[p],Yu(l,r.leaf?a(d):d),f+=Pc(l);for(p=e-t-1;p>=t;p--)d=r.children[p],Yu(h,r.leaf?a(d):d),f+=Pc(h);return f},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)Yu(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():tu(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 xT(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 tu(r,t){Xu(r,0,r.children.length,t,r)}function Xu(r,t,e,o,a){a||(a=eu(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var l=t,h;l<e;l++)h=r.children[l],Yu(a,r.leaf?o(h):h);return a}function Yu(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 W0(r,t){return r.minX-t.minX}function q0(r,t){return r.minY-t.minY}function Mp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Pc(r){return r.maxX-r.minX+(r.maxY-r.minY)}function ET(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 MT(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),l=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,l-o)}function wp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Ic(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function eu(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function X0(r,t,e,o,a){for(var l=[t,e],h;l.length;)e=l.pop(),t=l.pop(),!(e-t<=o)&&(h=t+Math.ceil((e-t)/o/2)*o,_T(r,h,t,e,a),l.push(t,h,h,e))}});var Q0=Zt((EO,Rp)=>{"use strict";Rp.exports=Oc;Rp.exports.default=Oc;function Oc(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=Z0(r,0,a,e,!0),h=[];if(!l||l.next===l.prev)return h;var f,p,d,g,_,y,M;if(o&&(l=LT(r,t,l,e)),r.length>80*e){f=d=r[0],p=g=r[1];for(var S=e;S<a;S+=e)_=r[S],y=r[S+1],_<f&&(f=_),y<p&&(p=y),_>d&&(d=_),y>g&&(g=y);M=Math.max(d-f,g-p),M=M!==0?32767/M:0}return Ku(l,h,e,f,p,M,0),h}function Z0(r,t,e,o,a){var l,h;if(a===Ip(r,t,e,o)>0)for(l=t;l<e;l+=o)h=$0(l,r[l],r[l+1],h);else for(l=e-o;l>=t;l-=o)h=$0(l,r[l],r[l+1],h);return h&&Dc(h,h.next)&&(ju(h),h=h.next),h}function ea(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Dc(e,e.next)||Bn(e.prev,e,e.next)===0)){if(ju(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function Ku(r,t,e,o,a,l,h){if(r){!h&&l&&UT(r,o,a,l);for(var f=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?PT(r,o,a,l):CT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),ju(r),r=d.next,f=d.next;continue}if(r=d,r===f){h?h===1?(r=IT(ea(r),t,e),Ku(r,t,e,o,a,l,2)):h===2&&RT(r,t,e,o,a,l):Ku(ea(r),t,e,o,a,l,1);break}}}}function CT(r){var t=r.prev,e=r,o=r.next;if(Bn(t,e,o)>=0)return!1;for(var a=t.x,l=e.x,h=o.x,f=t.y,p=e.y,d=o.y,g=a<l?a<h?a:h:l<h?l:h,_=f<p?f<d?f:d:p<d?p:d,y=a>l?a>h?a:h:l>h?l:h,M=f>p?f>d?f:d:p>d?p:d,S=o.next;S!==t;){if(S.x>=g&&S.x<=y&&S.y>=_&&S.y<=M&&iu(a,f,l,p,h,d,S.x,S.y)&&Bn(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function PT(r,t,e,o){var a=r.prev,l=r,h=r.next;if(Bn(a,l,h)>=0)return!1;for(var f=a.x,p=l.x,d=h.x,g=a.y,_=l.y,y=h.y,M=f<p?f<d?f:d:p<d?p:d,S=g<_?g<y?g:y:_<y?_:y,T=f>p?f>d?f:d:p>d?p:d,x=g>_?g>y?g:y:_>y?_:y,v=Cp(M,S,t,e,o),C=Cp(T,x,t,e,o),w=r.prevZ,O=r.nextZ;w&&w.z>=v&&O&&O.z<=C;){if(w.x>=M&&w.x<=T&&w.y>=S&&w.y<=x&&w!==a&&w!==h&&iu(f,g,p,_,d,y,w.x,w.y)&&Bn(w.prev,w,w.next)>=0||(w=w.prevZ,O.x>=M&&O.x<=T&&O.y>=S&&O.y<=x&&O!==a&&O!==h&&iu(f,g,p,_,d,y,O.x,O.y)&&Bn(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;w&&w.z>=v;){if(w.x>=M&&w.x<=T&&w.y>=S&&w.y<=x&&w!==a&&w!==h&&iu(f,g,p,_,d,y,w.x,w.y)&&Bn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;O&&O.z<=C;){if(O.x>=M&&O.x<=T&&O.y>=S&&O.y<=x&&O!==a&&O!==h&&iu(f,g,p,_,d,y,O.x,O.y)&&Bn(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function IT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Dc(a,l)&&J0(a,o,o.next,l)&&Qu(a,l)&&Qu(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),ju(o),ju(o.next),o=r=l),o=o.next}while(o!==r);return ea(o)}function RT(r,t,e,o,a,l){var h=r;do{for(var f=h.next.next;f!==h.prev;){if(h.i!==f.i&&kT(h,f)){var p=K0(h,f);h=ea(h,h.next),p=ea(p,p.next),Ku(h,t,e,o,a,l,0),Ku(p,t,e,o,a,l,0);return}f=f.next}h=h.next}while(h!==r)}function LT(r,t,e,o){var a=[],l,h,f,p,d;for(l=0,h=t.length;l<h;l++)f=t[l]*o,p=l<h-1?t[l+1]*o:r.length,d=Z0(r,f,p,o,!1),d===d.next&&(d.steiner=!0),a.push(zT(d));for(a.sort(NT),l=0;l<a.length;l++)e=OT(a[l],e);return e}function NT(r,t){return r.x-t.x}function OT(r,t){var e=DT(r,t);if(!e)return t;var o=K0(e,r);return ea(o,o.next),ea(e,e.next)}function DT(r,t){var e=t,o=r.x,a=r.y,l=-1/0,h;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var f=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=o&&f>l&&(l=f,h=e.x<e.next.x?e:e.next,f===o))return h}e=e.next}while(e!==t);if(!h)return null;var p=h,d=h.x,g=h.y,_=1/0,y;e=h;do o>=e.x&&e.x>=d&&o!==e.x&&iu(a<g?o:l,a,d,g,a<g?l:o,a,e.x,e.y)&&(y=Math.abs(a-e.y)/(o-e.x),Qu(e,r)&&(y<_||y===_&&(e.x>h.x||e.x===h.x&&FT(h,e)))&&(h=e,_=y)),e=e.next;while(e!==p);return h}function FT(r,t){return Bn(r.prev,r,t.prev)<0&&Bn(t.next,r,r.next)<0}function UT(r,t,e,o){var a=r;do a.z===0&&(a.z=Cp(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,BT(a)}function BT(r){var t,e,o,a,l,h,f,p,d=1;do{for(e=r,r=null,l=null,h=0;e;){for(h++,o=e,f=0,t=0;t<d&&(f++,o=o.nextZ,!!o);t++);for(p=d;f>0||p>0&&o;)f!==0&&(p===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,f--):(a=o,o=o.nextZ,p--),l?l.nextZ=a:r=a,a.prevZ=l,l=a;e=o}l.nextZ=null,d*=2}while(h>1);return r}function Cp(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 zT(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 iu(r,t,e,o,a,l,h,f){return(a-h)*(t-f)>=(r-h)*(l-f)&&(r-h)*(o-f)>=(e-h)*(t-f)&&(e-h)*(l-f)>=(a-h)*(o-f)}function kT(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!GT(r,t)&&(Qu(r,t)&&Qu(t,r)&&VT(r,t)&&(Bn(r.prev,r,t.prev)||Bn(r,t.prev,t))||Dc(r,t)&&Bn(r.prev,r,r.next)>0&&Bn(t.prev,t,t.next)>0)}function Bn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Dc(r,t){return r.x===t.x&&r.y===t.y}function J0(r,t,e,o){var a=Nc(Bn(r,t,e)),l=Nc(Bn(r,t,o)),h=Nc(Bn(e,o,r)),f=Nc(Bn(e,o,t));return!!(a!==l&&h!==f||a===0&&Lc(r,e,t)||l===0&&Lc(r,o,t)||h===0&&Lc(e,r,o)||f===0&&Lc(e,t,o))}function Lc(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 Nc(r){return r>0?1:r<0?-1:0}function GT(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&&J0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Qu(r,t){return Bn(r.prev,r,r.next)<0?Bn(r,t,r.next)>=0&&Bn(r,r.prev,t)>=0:Bn(r,t,r.prev)<0||Bn(r,r.next,t)<0}function VT(r,t){var e=r,o=!1,a=(r.x+t.x)/2,l=(r.y+t.y)/2;do e.y>l!=e.next.y>l&&e.next.y!==e.y&&a<(e.next.x-e.x)*(l-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function K0(r,t){var e=new Pp(r.i,r.x,r.y),o=new Pp(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,l.next=o,o.prev=l,o}function $0(r,t,e,o){var a=new Pp(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 ju(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 Pp(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}Oc.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,h=Math.abs(Ip(r,0,l,e));if(a)for(var f=0,p=t.length;f<p;f++){var d=t[f]*e,g=f<p-1?t[f+1]*e:r.length;h-=Math.abs(Ip(r,d,g,e))}var _=0;for(f=0;f<o.length;f+=3){var y=o[f]*e,M=o[f+1]*e,S=o[f+2]*e;_+=Math.abs((r[y]-r[S])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[S+1]-r[y+1]))}return h===0&&_===0?0:Math.abs((_-h)/h)};function Ip(r,t,e,o){for(var a=0,l=t,h=e-o;l<e;l+=o)a+=(r[h]-r[l])*(r[l+1]+r[h+1]),h=l;return a}Oc.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 l=0;l<r[a].length;l++)for(var h=0;h<t;h++)e.vertices.push(r[a][l][h]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var Fp=Zt(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.earthRadius=63710088e-1;ue.factors={centimeters:ue.earthRadius*100,centimetres:ue.earthRadius*100,degrees:ue.earthRadius/111325,feet:ue.earthRadius*3.28084,inches:ue.earthRadius*39.37,kilometers:ue.earthRadius/1e3,kilometres:ue.earthRadius/1e3,meters:ue.earthRadius,metres:ue.earthRadius,miles:ue.earthRadius/1609.344,millimeters:ue.earthRadius*1e3,millimetres:ue.earthRadius*1e3,nauticalmiles:ue.earthRadius/1852,radians:1,yards:ue.earthRadius*1.0936};ue.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/ue.earthRadius,yards:1.0936133};ue.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 Ss(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}ue.feature=Ss;function WT(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Lp(t).geometry;case"LineString":return Op(t).geometry;case"Polygon":return Np(t).geometry;case"MultiPoint":return ty(t).geometry;case"MultiLineString":return j0(t).geometry;case"MultiPolygon":return ey(t).geometry;default:throw new Error(r+" is invalid")}}ue.geometry=WT;function Lp(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(!Fc(r[0])||!Fc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Ss(o,t,e)}ue.point=Lp;function qT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Lp(o,t)}),e)}ue.points=qT;function Np(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<l[l.length-1].length;h++)if(l[l.length-1][h]!==l[0][h])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:r};return Ss(f,t,e)}ue.polygon=Np;function XT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Np(o,t)}),e)}ue.polygons=XT;function Op(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 Ss(o,t,e)}ue.lineString=Op;function YT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Op(o,t)}),e)}ue.lineStrings=YT;function Uc(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}ue.featureCollection=Uc;function j0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Ss(o,t,e)}ue.multiLineString=j0;function ty(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Ss(o,t,e)}ue.multiPoint=ty;function ey(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Ss(o,t,e)}ue.multiPolygon=ey;function $T(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Ss(o,t,e)}ue.geometryCollection=$T;function ZT(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}ue.round=ZT;function ny(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}ue.radiansToLength=ny;function Dp(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}ue.lengthToRadians=Dp;function JT(r,t){return ry(Dp(r,t))}ue.lengthToDegrees=JT;function KT(r){var t=r%360;return t<0&&(t+=360),t}ue.bearingToAzimuth=KT;function ry(r){var t=r%(2*Math.PI);return t*180/Math.PI}ue.radiansToDegrees=ry;function QT(r){var t=r%360;return t*Math.PI/180}ue.degreesToRadians=QT;function jT(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 ny(Dp(r,t),e)}ue.convertLength=jT;function tA(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=ue.areaFactors[t];if(!o)throw new Error("invalid original units");var a=ue.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}ue.convertArea=tA;function Fc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ue.isNumber=Fc;function eA(r){return!!r&&r.constructor===Object}ue.isObject=eA;function nA(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(!Fc(t))throw new Error("bbox must only contain numbers")})}ue.validateBBox=nA;function rA(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")}ue.validateId=rA});var Bp=Zt(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});var Vr=Fp();function tl(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,_=0,y,M=r.type,S=M==="FeatureCollection",T=M==="Feature",x=S?r.features.length:1,v=0;v<x;v++){d=S?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,f=y?d.geometries.length:1;for(var C=0;C<f;C++){var w=0,O=0;if(h=y?d.geometries[C]:d,h!==null){p=h.coordinates;var F=h.type;switch(g=e&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(t(p,_,v,w,O)===!1)return!1;_++,w++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,w,O)===!1)return!1;_++,F==="MultiPoint"&&w++}F==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,w,O)===!1)return!1;_++}F==="MultiLineString"&&w++,F==="Polygon"&&O++}F==="Polygon"&&w++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(O=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,w,O)===!1)return!1;_++}O++}w++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(tl(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function iA(r,t,e,o){var a=e;return tl(r,function(l,h,f,p,d){h===0&&e===void 0?a=l:a=t(a,l,h,f,p,d)},o),a}function iy(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 oA(r,t,e){var o=e;return iy(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function oy(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 sA(r,t,e){var o=e;return oy(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function aA(r){var t=[];return tl(r,function(e){t.push(e)}),t}function Up(r,t){var e,o,a,l,h,f,p,d,g,_,y=0,M=r.type==="FeatureCollection",S=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(f=M?r.features[e].geometry:S?r.geometry:r,d=M?r.features[e].properties:S?r.properties:{},g=M?r.features[e].bbox:S?r.bbox:void 0,_=M?r.features[e].id:S?r.id:void 0,p=f?f.type==="GeometryCollection":!1,h=p?f.geometries.length:1,a=0;a<h;a++){if(l=p?f.geometries[a]:f,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function uA(r,t,e){var o=e;return Up(r,function(a,l,h,f,p){l===0&&e===void 0?o=a:o=t(o,a,l,h,f,p)}),o}function Bc(r,t){Up(r,function(e,o,a,l,h){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(Vr.feature(e,a,{bbox:l,id:h}),o,0)===!1?!1:void 0}var p;switch(f){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(Vr.feature(_,a),o,d)===!1)return!1}})}function lA(r,t,e){var o=e;return Bc(r,function(a,l,h){l===0&&h===0&&e===void 0?o=a:o=t(o,a,l,h)}),o}function sy(r,t){Bc(r,function(e,o,a){var l=0;if(e.geometry){var h=e.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var f,p=0,d=0,g=0;if(tl(e,function(_,y,M,S,T){if(f===void 0||o>p||S>d||T>g){f=_,p=o,d=S,g=T,l=0;return}var x=Vr.lineString([f,_],e.properties);if(t(x,o,a,T,l)===!1)return!1;l++,f=_})===!1)return!1}}})}function cA(r,t,e){var o=e,a=!1;return sy(r,function(l,h,f,p,d){a===!1&&e===void 0?o=l:o=t(o,l,h,f,p,d),a=!0}),o}function ay(r,t){if(!r)throw new Error("geojson is required");Bc(r,function(e,o,a){if(e.geometry!==null){var l=e.geometry.type,h=e.geometry.coordinates;switch(l){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var f=0;f<h.length;f++)if(t(Vr.lineString(h[f],e.properties),o,a,f)===!1)return!1;break}}})}function hA(r,t,e){var o=e;return ay(r,function(a,l,h,f){l===0&&e===void 0?o=a:o=t(o,a,l,h,f)}),o}function fA(r,t){if(t=t||{},!Vr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.segmentIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=p.length+l-1),Vr.lineString([p[l],p[l+1]],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l-1),Vr.lineString([p[a][l],p[a][l+1]],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l-1),Vr.lineString([p[o][l],p[o][l+1]],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l-1),Vr.lineString([p[o][a][l],p[o][a][l+1]],h,t)}throw new Error("geojson is invalid")}function pA(r,t){if(t=t||{},!Vr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.coordIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":return Vr.point(p,h,t);case"MultiPoint":return o<0&&(o=p.length+o),Vr.point(p[o],h,t);case"LineString":return l<0&&(l=p.length+l),Vr.point(p[l],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Vr.point(p[a][l],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Vr.point(p[o][l],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l),Vr.point(p[o][a][l],h,t)}throw new Error("geojson is invalid")}or.coordAll=aA;or.coordEach=tl;or.coordReduce=iA;or.featureEach=oy;or.featureReduce=sA;or.findPoint=pA;or.findSegment=fA;or.flattenEach=Bc;or.flattenReduce=lA;or.geomEach=Up;or.geomReduce=uA;or.lineEach=ay;or.lineReduce=hA;or.propEach=iy;or.propReduce=oA;or.segmentEach=sy;or.segmentReduce=cA});var uy=Zt(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var dA=Bp();function zp(r){var t=[1/0,1/0,-1/0,-1/0];return dA.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}zp.default=zp;kp.default=zp});var zc=Zt((UO,Gp)=>{var _o=fp(),cy=Fp(),hy=Bp(),ou=uy().default,mA=hy.featureEach,DO=hy.coordEach,FO=cy.polygon,ly=cy.featureCollection;function fy(r){var t=new _o(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:ou(e),_o.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:ou(a),o.push(a)}):mA(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ou(a),o.push(a)}),_o.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:ou(e),_o.prototype.remove.call(this,e,o)},t.clear=function(){return _o.prototype.clear.call(this)},t.search=function(e){var o=_o.prototype.search.call(this,this.toBBox(e));return ly(o)},t.collides=function(e){return _o.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=_o.prototype.all.call(this);return ly(e)},t.toJSON=function(){return _o.prototype.toJSON.call(this)},t.fromJSON=function(e){return _o.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=ou(e);else if(e.type==="FeatureCollection")o=ou(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Gp.exports=fy;Gp.exports.default=fy});var Yp=Zt((X3,My)=>{"use strict";var Ey=Object.prototype.toString;My.exports=function(t){var e=Ey.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Ey.call(t.callee)==="[object Function]"),o}});var Ry=Zt((Y3,Iy)=>{"use strict";var Py;Object.keys||(rl=Object.prototype.hasOwnProperty,$p=Object.prototype.toString,wy=Yp(),Zp=Object.prototype.propertyIsEnumerable,Sy=!Zp.call({toString:null},"toString"),by=Zp.call(function(){},"prototype"),il=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Wc=function(r){var t=r.constructor;return t&&t.prototype===r},Ty={$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},Ay=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!Ty["$"+r]&&rl.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Wc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),Cy=function(r){if(typeof window=="undefined"||!Ay)return Wc(r);try{return Wc(r)}catch(t){return!1}},Py=function(t){var e=t!==null&&typeof t=="object",o=$p.call(t)==="[object Function]",a=wy(t),l=e&&$p.call(t)==="[object String]",h=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var f=by&&o;if(l&&t.length>0&&!rl.call(t,0))for(var p=0;p<t.length;++p)h.push(String(p));if(a&&t.length>0)for(var d=0;d<t.length;++d)h.push(String(d));else for(var g in t)!(f&&g==="prototype")&&rl.call(t,g)&&h.push(String(g));if(Sy)for(var _=Cy(t),y=0;y<il.length;++y)!(_&&il[y]==="constructor")&&rl.call(t,il[y])&&h.push(il[y]);return h});var rl,$p,wy,Zp,Sy,by,il,Wc,Ty,Ay,Cy;Iy.exports=Py});var Jp=Zt(($3,Oy)=>{"use strict";var bA=Array.prototype.slice,TA=Yp(),Ly=Object.keys,qc=Ly?function(t){return Ly(t)}:Ry(),Ny=Object.keys;qc.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 TA(o)?Ny(bA.call(o)):Ny(o)})}else Object.keys=qc;return Object.keys||qc};Oy.exports=qc});var Kp=Zt((Z3,Dy)=>{"use strict";Dy.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 l=Object.getOwnPropertySymbols(t);if(l.length!==1||l[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(t,e);if(h.value!==a||h.enumerable!==!0)return!1}return!0}});var Xc=Zt((J3,Fy)=>{"use strict";var AA=Kp();Fy.exports=function(){return AA()&&!!Symbol.toStringTag}});var zy=Zt((K3,By)=>{"use strict";var Uy=typeof Symbol!="undefined"&&Symbol,CA=Kp();By.exports=function(){return typeof Uy!="function"||typeof Symbol!="function"||typeof Uy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:CA()}});var Vy=Zt((Q3,Gy)=>{"use strict";var ky={foo:{}},PA=Object;Gy.exports=function(){return{__proto__:ky}.foo===ky.foo&&!({__proto__:null}instanceof PA)}});var qy=Zt((j3,Wy)=>{"use strict";var IA="Function.prototype.bind called on incompatible ",RA=Object.prototype.toString,LA=Math.max,NA="[object Function]",Hy=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var l=0;l<e.length;l+=1)o[l+t.length]=e[l];return o},OA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},DA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};Wy.exports=function(t){var e=this;if(typeof e!="function"||RA.apply(e)!==NA)throw new TypeError(IA+e);for(var o=OA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,Hy(o,arguments));return Object(g)===g?g:this}return e.apply(t,Hy(o,arguments))},h=LA(0,e.length-o.length),f=[],p=0;p<h;p++)f[p]="$"+p;if(a=Function("binder","return function ("+DA(f,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,a.prototype=new d,d.prototype=null}return a}});var Yc=Zt((tF,Xy)=>{"use strict";var FA=qy();Xy.exports=Function.prototype.bind||FA});var $y=Zt((eF,Yy)=>{"use strict";var UA=Function.prototype.call,BA=Object.prototype.hasOwnProperty,zA=Yc();Yy.exports=zA.call(UA,BA)});var ia=Zt((nF,jy)=>{"use strict";var tn,lu=SyntaxError,Qy=Function,uu=TypeError,Qp=function(r){try{return Qy('"use strict"; return ('+r+").constructor;")()}catch(t){}},na=Object.getOwnPropertyDescriptor;if(na)try{na({},"")}catch(r){na=null}var jp=function(){throw new uu},kA=na?function(){try{return arguments.callee,jp}catch(r){try{return na(arguments,"callee").get}catch(t){return jp}}}():jp,su=zy()(),GA=Vy()(),_r=Object.getPrototypeOf||(GA?function(r){return r.__proto__}:null),au={},VA=typeof Uint8Array=="undefined"||!_r?tn:_r(Uint8Array),ra={"%AggregateError%":typeof AggregateError=="undefined"?tn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?tn:ArrayBuffer,"%ArrayIteratorPrototype%":su&&_r?_r([][Symbol.iterator]()):tn,"%AsyncFromSyncIteratorPrototype%":tn,"%AsyncFunction%":au,"%AsyncGenerator%":au,"%AsyncGeneratorFunction%":au,"%AsyncIteratorPrototype%":au,"%Atomics%":typeof Atomics=="undefined"?tn:Atomics,"%BigInt%":typeof BigInt=="undefined"?tn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?tn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?tn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?tn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?tn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?tn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?tn:FinalizationRegistry,"%Function%":Qy,"%GeneratorFunction%":au,"%Int8Array%":typeof Int8Array=="undefined"?tn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?tn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?tn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":su&&_r?_r(_r([][Symbol.iterator]())):tn,"%JSON%":typeof JSON=="object"?JSON:tn,"%Map%":typeof Map=="undefined"?tn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!su||!_r?tn:_r(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?tn:Promise,"%Proxy%":typeof Proxy=="undefined"?tn:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?tn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?tn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!su||!_r?tn:_r(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?tn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":su&&_r?_r(""[Symbol.iterator]()):tn,"%Symbol%":su?Symbol:tn,"%SyntaxError%":lu,"%ThrowTypeError%":kA,"%TypedArray%":VA,"%TypeError%":uu,"%Uint8Array%":typeof Uint8Array=="undefined"?tn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?tn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?tn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?tn:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?tn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?tn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?tn:WeakSet};if(_r)try{null.error}catch(r){Zy=_r(_r(r)),ra["%Error.prototype%"]=Zy}var Zy,HA=function r(t){var e;if(t==="%AsyncFunction%")e=Qp("async function () {}");else if(t==="%GeneratorFunction%")e=Qp("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Qp("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&_r&&(e=_r(a.prototype))}return ra[t]=e,e},Jy={"%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"]},ol=Yc(),$c=$y(),WA=ol.call(Function.call,Array.prototype.concat),qA=ol.call(Function.apply,Array.prototype.splice),Ky=ol.call(Function.call,String.prototype.replace),Zc=ol.call(Function.call,String.prototype.slice),XA=ol.call(Function.call,RegExp.prototype.exec),YA=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,$A=/\\\\(\\\\)?/g,ZA=function(t){var e=Zc(t,0,1),o=Zc(t,-1);if(e==="%"&&o!=="%")throw new lu("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new lu("invalid intrinsic syntax, expected opening \`%\`");var a=[];return Ky(t,YA,function(l,h,f,p){a[a.length]=f?Ky(p,$A,"$1"):h||l}),a},JA=function(t,e){var o=t,a;if($c(Jy,o)&&(a=Jy[o],o="%"+a[0]+"%"),$c(ra,o)){var l=ra[o];if(l===au&&(l=HA(o)),typeof l=="undefined"&&!e)throw new uu("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new lu("intrinsic "+t+" does not exist!")};jy.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new uu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new uu('"allowMissing" argument must be a boolean');if(XA(/^%?[^%]*%?$/,t)===null)throw new lu("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=ZA(t),a=o.length>0?o[0]:"",l=JA("%"+a+"%",e),h=l.name,f=l.value,p=!1,d=l.alias;d&&(a=d[0],qA(o,WA([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Zc(y,0,1),S=Zc(y,-1);if((M==='"'||M==="'"||M==="\`"||S==='"'||S==="'"||S==="\`")&&M!==S)throw new lu("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,h="%"+a+"%",$c(ra,h))f=ra[h];else if(f!=null){if(!(y in f)){if(!e)throw new uu("base intrinsic for "+t+" exists, but the property is not available.");return}if(na&&g+1>=o.length){var T=na(f,y);_=!!T,_&&"get"in T&&!("originalValue"in T.get)?f=T.get:f=f[y]}else _=$c(f,y),f=f[y];_&&!p&&(ra[h]=f)}}return f}});var sl=Zt((rF,tv)=>{"use strict";var KA=ia(),td=KA("%Object.defineProperty%",!0),ed=function(){if(td)try{return td({},"a",{value:1}),!0}catch(t){return!1}return!1};ed.hasArrayLengthDefineBug=function(){if(!ed())return null;try{return td([],"length",{value:1}).length!==1}catch(t){return!0}};tv.exports=ed});var nd=Zt((iF,ev)=>{"use strict";var QA=ia(),Jc=QA("%Object.getOwnPropertyDescriptor%",!0);if(Jc)try{Jc([],"length")}catch(r){Jc=null}ev.exports=Jc});var Kc=Zt((oF,rv)=>{"use strict";var jA=sl()(),rd=ia(),al=jA&&rd("%Object.defineProperty%",!0);if(al)try{al({},"a",{value:1})}catch(r){al=!1}var tC=rd("%SyntaxError%"),cu=rd("%TypeError%"),nv=nd();rv.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new cu("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new cu("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new cu("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new cu("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new cu("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new cu("\`loose\`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,p=!!nv&&nv(t,e);if(al)al(t,e,{configurable:h===null&&p?p.configurable:!h,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(f||!a&&!l&&!h)t[e]=o;else throw new tC("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var lv=Zt((sF,uv)=>{"use strict";var av=ia(),iv=Kc(),eC=sl()(),ov=nd(),sv=av("%TypeError%"),nC=av("%Math.floor%");uv.exports=function(t,e){if(typeof t!="function")throw new sv("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||nC(e)!==e)throw new sv("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&ov){var h=ov(t,"length");h&&!h.configurable&&(a=!1),h&&!h.writable&&(l=!1)}return(a||l||!o)&&(eC?iv(t,"length",e,!0,!0):iv(t,"length",e)),t}});var jc=Zt((aF,Qc)=>{"use strict";var id=Yc(),hu=ia(),rC=lv(),iC=hu("%TypeError%"),hv=hu("%Function.prototype.apply%"),fv=hu("%Function.prototype.call%"),pv=hu("%Reflect.apply%",!0)||id.call(fv,hv),ul=hu("%Object.defineProperty%",!0),oC=hu("%Math.max%");if(ul)try{ul({},"a",{value:1})}catch(r){ul=null}Qc.exports=function(t){if(typeof t!="function")throw new iC("a function is required");var e=pv(id,fv,arguments);return rC(e,1+oC(0,t.length-(arguments.length-1)),!0)};var cv=function(){return pv(id,hv,arguments)};ul?ul(Qc.exports,"apply",{value:cv}):Qc.exports.apply=cv});var od=Zt((uF,gv)=>{"use strict";var dv=ia(),mv=jc(),sC=mv(dv("String.prototype.indexOf"));gv.exports=function(t,e){var o=dv(t,!!e);return typeof o=="function"&&sC(t,".prototype.")>-1?mv(o):o}});var _v=Zt((lF,vv)=>{"use strict";var aC=Xc()(),uC=od(),sd=uC("Object.prototype.toString"),th=function(t){return aC&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:sd(t)==="[object Arguments]"},yv=function(t){return th(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&sd(t)!=="[object Array]"&&sd(t.callee)==="[object Function]"},lC=function(){return th(arguments)}();th.isLegacyArguments=yv;vv.exports=lC?th:yv});var fu=Zt((cF,wv)=>{"use strict";var cC=Jp(),hC=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",fC=Object.prototype.toString,pC=Array.prototype.concat,xv=Kc(),dC=function(r){return typeof r=="function"&&fC.call(r)==="[object Function]"},Ev=sl()(),mC=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!dC(o)||!o())return}Ev?xv(r,t,e,!0):xv(r,t,e)},Mv=function(r,t){var e=arguments.length>2?arguments[2]:{},o=cC(t);hC&&(o=pC.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)mC(r,o[a],t[o[a]],e[o[a]])};Mv.supportsDescriptors=!!Ev;wv.exports=Mv});var ad=Zt((hF,bv)=>{"use strict";var Sv=function(r){return r!==r};bv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Sv(t)&&Sv(e))}});var ud=Zt((fF,Tv)=>{"use strict";var gC=ad();Tv.exports=function(){return typeof Object.is=="function"?Object.is:gC}});var Cv=Zt((pF,Av)=>{"use strict";var yC=ud(),vC=fu();Av.exports=function(){var t=yC();return vC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Lv=Zt((dF,Rv)=>{"use strict";var _C=fu(),xC=jc(),EC=ad(),Pv=ud(),MC=Cv(),Iv=xC(Pv(),Object);_C(Iv,{getPolyfill:Pv,implementation:EC,shim:MC});Rv.exports=Iv});var Uv=Zt((mF,Fv)=>{"use strict";var ld=od(),Nv=Xc()(),Ov,Dv,cd,hd;Nv&&(Ov=ld("Object.prototype.hasOwnProperty"),Dv=ld("RegExp.prototype.exec"),cd={},eh=function(){throw cd},hd={toString:eh,valueOf:eh},typeof Symbol.toPrimitive=="symbol"&&(hd[Symbol.toPrimitive]=eh));var eh,wC=ld("Object.prototype.toString"),SC=Object.getOwnPropertyDescriptor,bC="[object RegExp]";Fv.exports=Nv?function(t){if(!t||typeof t!="object")return!1;var e=SC(t,"lastIndex"),o=e&&Ov(e,"value");if(!o)return!1;try{Dv(t,hd)}catch(a){return a===cd}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:wC(t)===bC}});var zv=Zt((gF,Bv)=>{"use strict";var cl=function(){return typeof function(){}.name=="string"},ll=Object.getOwnPropertyDescriptor;if(ll)try{ll([],"length")}catch(r){ll=null}cl.functionsHaveConfigurableNames=function(){if(!cl()||!ll)return!1;var t=ll(function(){},"name");return!!t&&!!t.configurable};var TC=Function.prototype.bind;cl.boundFunctionsHaveNames=function(){return cl()&&typeof TC=="function"&&function(){}.bind().name!==""};Bv.exports=cl});var Vv=Zt((yF,Gv)=>{"use strict";var kv=Kc(),AC=sl()(),CC=zv().functionsHaveConfigurableNames(),PC=TypeError;Gv.exports=function(t,e){if(typeof t!="function")throw new PC("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||CC)&&(AC?kv(t,"name",e,!0,!0):kv(t,"name",e)),t}});var fd=Zt((vF,Hv)=>{"use strict";var IC=Vv(),RC=Object,LC=TypeError;Hv.exports=IC(function(){if(this!=null&&this!==RC(this))throw new LC("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 pd=Zt((_F,Wv)=>{"use strict";var NC=fd(),OC=fu().supportsDescriptors,DC=Object.getOwnPropertyDescriptor;Wv.exports=function(){if(OC&&/a/mig.flags==="gim"){var t=DC(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 NC}});var Yv=Zt((xF,Xv)=>{"use strict";var FC=fu().supportsDescriptors,UC=pd(),BC=Object.getOwnPropertyDescriptor,zC=Object.defineProperty,kC=TypeError,qv=Object.getPrototypeOf,GC=/a/;Xv.exports=function(){if(!FC||!qv)throw new kC("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=UC(),e=qv(GC),o=BC(e,"flags");return(!o||o.get!==t)&&zC(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Kv=Zt((EF,Jv)=>{"use strict";var VC=fu(),HC=jc(),WC=fd(),$v=pd(),qC=Yv(),Zv=HC($v());VC(Zv,{getPolyfill:$v,implementation:WC,shim:qC});Jv.exports=Zv});var jv=Zt((MF,Qv)=>{"use strict";var XC=Date.prototype.getDay,YC=function(t){try{return XC.call(t),!0}catch(e){return!1}},$C=Object.prototype.toString,ZC="[object Date]",JC=Xc()();Qv.exports=function(t){return typeof t!="object"||t===null?!1:JC?YC(t):$C.call(t)===ZC}});var dd=Zt((wF,c_)=>{var t_=Jp(),e_=_v(),n_=Lv(),r_=Uv(),i_=Kv(),o_=jv(),s_=Date.prototype.getTime;function l_(r,t,e){var o=e||{};return(o.strict?n_(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?n_(r,t):r==t:KC(r,t,o)}function a_(r){return r==null}function u_(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 KC(r,t,e){var o,a;if(typeof r!=typeof t||a_(r)||a_(t)||r.prototype!==t.prototype||e_(r)!==e_(t))return!1;var l=r_(r),h=r_(t);if(l!==h)return!1;if(l||h)return r.source===t.source&&i_(r)===i_(t);if(o_(r)&&o_(t))return s_.call(r)===s_.call(t);var f=u_(r),p=u_(t);if(f!==p)return!1;if(f||p){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 d=t_(r),g=t_(t)}catch(_){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),o=d.length-1;o>=0;o--)if(d[o]!=g[o])return!1;for(o=d.length-1;o>=0;o--)if(a=d[o],!l_(r[a],t[a],e))return!1;return!0}c_.exports=l_});var Td=Zt((PB,y_)=>{var GP=dd(),xo=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:VP};xo.prototype.compare=function(r,t){if(r.type!==t.type||!g_(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=m_(r),a=m_(t);return o.every(function(l){return this.some(function(h){return e.compare(l,h)})},a)}}return!1};function m_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function g_(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}xo.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};xo.prototype.compareLine=function(r,t,e,o){if(!g_(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),l=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],l[0])&&(l=this.fixStartIndex(l,a),!l))){var h=this.compareCoord(a[e],l[e]);return this.direction||h?this.comparePath(a,l):this.compareCoord(a[e],l[l.length-(1+e)])?this.comparePath(a.slice().reverse(),l):!1}};xo.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};xo.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};xo.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(l){return this.some(function(h){return a.compareLine(l,h,1,!0)})},o)}else return!1};xo.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)};xo.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};xo.prototype.removePseudo=function(r){return r};function VP(r,t){return GP(r,t,{strict:!0})}y_.exports=xo});var v_=Zt((GB,ih)=>{function Ts(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)}Ts.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 l=this._regionQuery(a);if(l.length<this.minPts)this.noise.push(a);else{var h=this.clusters.length;this.clusters.push([]),this._addToCluster(a,h),this._expandCluster(h,l)}}return this.clusters};Ts.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)};Ts.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)}};Ts.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};Ts.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};Ts.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};Ts.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 ih!="undefined"&&ih.exports&&(ih.exports=Ts)});var __=Zt((VB,oh)=>{function As(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}As.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)};As.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 l=0;l<this.k;l++){for(var h=new Array(g),f=0,p=0;p<g;p++)h[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(l===this.assignments[d]){for(var p=0;p<g;p++)h[p]+=this.dataset[d][p];f++}}if(f>0){for(var p=0;p<g;p++)h[p]/=f;this.centroids[l]=h}else this.centroids[l]=this.randomCentroid(),a=!0}}return this.getClusters()};As.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};As.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};As.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};As.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,l=t.length,h,f=0;f<l;f++)h=e(r,t[f]),h<o&&(o=h,a=f);return a};As.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 oh!="undefined"&&oh.exports&&(oh.exports=As)});var Ad=Zt((HB,sh)=>{function Eo(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}Eo.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)};Eo.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}}};Eo.prototype.forEach=function(r){this._queue.forEach(r)};Eo.prototype.getElements=function(){return this._queue};Eo.prototype.getElementPriority=function(r){return this._priorities[r]};Eo.prototype.getPriorities=function(){return this._priorities};Eo.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};Eo.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)};Eo.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 sh!="undefined"&&sh.exports&&(sh.exports=Eo)});var E_=Zt((WB,du)=>{typeof du!="undefined"&&du.exports&&(x_=Ad());var x_;function jo(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)}jo.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,l=this.dataset.length;a<l;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var h=this.clusters.length-1;this._orderedList.push(a);var f=new x_(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,f),this._expandCluster(h,f))}return this.clusters};jo.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};jo.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)};jo.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 l=o.distance(o.dataset[r],o.dataset[a]),h=Math.max(o._coreDistance,l);o._reachability[a]===void 0?(o._reachability[a]=h,e.insert(a,h)):h<o._reachability[a]&&(o._reachability[a]=h,e.remove(a),e.insert(a,h))}})};jo.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var l=e[o];if(this._processed[l]===void 0){var h=this._regionQuery(l);this._processed[l]=1,this.clusters[r].push(l),this._orderedList.push(l),this._distanceToCore(l)!==void 0&&(this._updateQueue(l,h,t),this._expandCluster(r,t))}}};jo.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}};jo.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};jo.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 du!="undefined"&&du.exports&&(du.exports=jo)});var M_=Zt((qB,ah)=>{typeof ah!="undefined"&&ah.exports&&(ah.exports={DBSCAN:v_(),KMEANS:__(),OPTICS:E_(),PriorityQueue:Ad()})});var Cd=Zt((KB,S_)=>{"use strict";S_.exports={eudist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++){var f=(t[h]||0)-(e[h]||0);l+=f*f}return o?Math.sqrt(l):l},mandist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++)l+=Math.abs((t[h]||0)-(e[h]||0));return o?Math.sqrt(l):l},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var A_=Zt((QB,T_)=>{"use strict";var b_=Cd(),$P=b_.eudist,ZP=b_.dist;T_.exports={kmrand:function(t,e){for(var o={},a=[],l=e<<2,h=t.length,f=t[0].length>0;a.length<e&&l-- >0;){var p=t[Math.floor(Math.random()*h)],d=f?p.join("_"):""+p;o[d]||(o[d]=!0,a.push(p))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?$P:ZP,a=[],l=t.length,h=t[0].length>0,f={},p=t[Math.floor(Math.random()*l)],d=h?p.join("_"):""+p;for(a.push(p),f[d]=!0;a.length<e;){for(var g=[],_=a.length,y=0,M=[],S=0;S<l;S++){for(var T=1/0,x=0;x<_;x++){var v=o(t[S],a[x]);v<=T&&(T=v)}g[S]=T}for(var C=0;C<l;C++)y+=g[C];for(var w=0;w<l;w++)M[w]={i:w,v:t[w],pr:g[w]/y,cs:0};M.sort(function(z,L){return z.pr-L.pr}),M[0].cs=M[0].pr;for(var O=1;O<l;O++)M[O].cs=M[O-1].cs+M[O].pr;for(var F=Math.random(),G=0;G<l-1&&M[G++].cs<F;);a.push(M[G-1].v)}return a}}});var L_=Zt((ez,R_)=>{"use strict";var Pd=Cd(),I_=A_(),JP=Pd.eudist,jB=Pd.mandist,tz=Pd.dist,KP=I_.kmrand,QP=I_.kmpp,C_=1e4;function P_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function jP(r,t,e,o){var a=[],l=[],h=[],f=[],p=!1,d=o||C_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=KP(r,t):e=="kmpp"?a=QP(r,t):a=e;else for(var S={};a.length<t;){var T=Math.floor(Math.random()*g);S[T]||(S[T]=!0,a.push(r[T]))}do{P_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,C=0,w=0;w<t;w++){var f=y?JP(r[x],a[w]):Math.abs(r[x]-a[w]);f<=v&&(v=f,C=w)}h[x]=C,M[C]++}for(var O=[],l=[],F=0,G=0;G<t;G++)O[G]=y?P_(_,0,O[G]):0,l[G]=a[G];if(y){for(var z=0;z<t;z++)a[z]=[];for(var L=0;L<g;L++)for(var D=h[L],q=O[D],nt=r[L],k=0;k<_;k++)q[k]+=nt[k];p=!0;for(var xt=0;xt<t;xt++){for(var X=a[xt],it=O[xt],vt=l[xt],pt=M[xt],et=0;et<_;et++)X[et]=it[et]/pt||0;if(p){for(var ot=0;ot<_;ot++)if(vt[ot]!=X[ot]){p=!1;break}}}}else{for(var V=0;V<g;V++){var K=h[V];O[K]+=r[V]}for(var at=0;at<t;at++)a[at]=O[at]/M[at]||0;p=!0;for(var Tt=0;Tt<t;Tt++)if(l[Tt]!=a[Tt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:C_-d,k:t,idxs:h,centroids:a}}R_.exports=jP});var _u=Zt((Dd,Fd)=>{(function(r,t){typeof Dd=="object"&&typeof Fd!="undefined"?Fd.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Dd,function(){"use strict";function r(J,N){if(!(J instanceof N))throw new TypeError("Cannot call a class as a function")}function t(J,N){for(var b=0;b<N.length;b++){var R=N[b];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(J,R.key,R)}}function e(J,N,b){return N&&t(J.prototype,N),b&&t(J,b),J}var o=function(){function J(N,b){this.next=null,this.key=N,this.data=b,this.left=null,this.right=null}return J}();function a(J,N){return J>N?1:J<N?-1:0}function l(J,N,b){for(var R=new o(null,null),W=R,Z=R;;){var I=b(J,N.key);if(I<0){if(N.left===null)break;if(b(J,N.left.key)<0){var P=N.left;if(N.left=P.right,P.right=N,N=P,N.left===null)break}Z.left=N,Z=N,N=N.left}else if(I>0){if(N.right===null)break;if(b(J,N.right.key)>0){var P=N.right;if(N.right=P.left,P.left=N,N=P,N.right===null)break}W.right=N,W=N,N=N.right}else break}return W.right=N.left,Z.left=N.right,N.left=R.right,N.right=R.left,N}function h(J,N,b,R){var W=new o(J,N);if(b===null)return W.left=W.right=null,W;b=l(J,b,R);var Z=R(J,b.key);return Z<0?(W.left=b.left,W.right=b,b.left=null):Z>=0&&(W.right=b.right,W.left=b,b.right=null),W}function f(J,N,b){var R=null,W=null;if(N){N=l(J,N,b);var Z=b(N.key,J);Z===0?(R=N.left,W=N.right):Z<0?(W=N.right,N.right=null,R=N):(R=N.left,N.left=null,W=N)}return{left:R,right:W}}function p(J,N,b){return N===null?J:(J===null||(N=l(J.key,N,b),N.left=J),N)}function d(J,N,b,R,W){if(J){R(""+N+(b?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+W(J)+\`
|
|
91
100
|
\`);var Z=N+(b?" ":"\\u2502 ");J.left&&d(J.left,Z,!1,R,W),J.right&&d(J.right,Z,!0,R,W)}}var g=function(){function J(N){N===void 0&&(N=a),this._root=null,this._size=0,this._comparator=N}return J.prototype.insert=function(N,b){return this._size++,this._root=h(N,b,this._root,this._comparator)},J.prototype.add=function(N,b){var R=new o(N,b);this._root===null&&(R.left=R.right=null,this._size++,this._root=R);var W=this._comparator,Z=l(N,this._root,W),I=W(N,Z.key);return I===0?this._root=Z:(I<0?(R.left=Z.left,R.right=Z,Z.left=null):I>0&&(R.right=Z.right,R.left=Z,Z.right=null),this._size++,this._root=R),this._root},J.prototype.remove=function(N){this._root=this._remove(N,this._root,this._comparator)},J.prototype._remove=function(N,b,R){var W;if(b===null)return null;b=l(N,b,R);var Z=R(N,b.key);return Z===0?(b.left===null?W=b.right:(W=l(N,b.left,R),W.right=b.right),this._size--,W):b},J.prototype.pop=function(){var N=this._root;if(N){for(;N.left;)N=N.left;return this._root=l(N.key,this._root,this._comparator),this._root=this._remove(N.key,this._root,this._comparator),{key:N.key,data:N.data}}return null},J.prototype.findStatic=function(N){for(var b=this._root,R=this._comparator;b;){var W=R(N,b.key);if(W===0)return b;W<0?b=b.left:b=b.right}return null},J.prototype.find=function(N){return this._root&&(this._root=l(N,this._root,this._comparator),this._comparator(N,this._root.key)!==0)?null:this._root},J.prototype.contains=function(N){for(var b=this._root,R=this._comparator;b;){var W=R(N,b.key);if(W===0)return!0;W<0?b=b.left:b=b.right}return!1},J.prototype.forEach=function(N,b){for(var R=this._root,W=[],Z=!1;!Z;)R!==null?(W.push(R),R=R.left):W.length!==0?(R=W.pop(),N.call(b,R),R=R.right):Z=!0;return this},J.prototype.range=function(N,b,R,W){for(var Z=[],I=this._comparator,P=this._root,B;Z.length!==0||P;)if(P)Z.push(P),P=P.left;else{if(P=Z.pop(),B=I(P.key,b),B>0)break;if(I(P.key,N)>=0&&R.call(W,P))return this;P=P.right}return this},J.prototype.keys=function(){var N=[];return this.forEach(function(b){var R=b.key;return N.push(R)}),N},J.prototype.values=function(){var N=[];return this.forEach(function(b){var R=b.data;return N.push(R)}),N},J.prototype.min=function(){return this._root?this.minNode(this._root).key:null},J.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},J.prototype.minNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.left;)N=N.left;return N},J.prototype.maxNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.right;)N=N.right;return N},J.prototype.at=function(N){for(var b=this._root,R=!1,W=0,Z=[];!R;)if(b)Z.push(b),b=b.left;else if(Z.length>0){if(b=Z.pop(),W===N)return b;W++,b=b.right}else R=!0;return null},J.prototype.next=function(N){var b=this._root,R=null;if(N.right){for(R=N.right;R.left;)R=R.left;return R}for(var W=this._comparator;b;){var Z=W(N.key,b.key);if(Z===0)break;Z<0?(R=b,b=b.left):b=b.right}return R},J.prototype.prev=function(N){var b=this._root,R=null;if(N.left!==null){for(R=N.left;R.right;)R=R.right;return R}for(var W=this._comparator;b;){var Z=W(N.key,b.key);if(Z===0)break;Z<0?b=b.left:(R=b,b=b.right)}return R},J.prototype.clear=function(){return this._root=null,this._size=0,this},J.prototype.toList=function(){return M(this._root)},J.prototype.load=function(N,b,R){b===void 0&&(b=[]),R===void 0&&(R=!1);var W=N.length,Z=this._comparator;if(R&&x(N,b,0,W-1,Z),this._root===null)this._root=_(N,b,0,W),this._size=W;else{var I=T(this.toList(),y(N,b),Z);W=this._size+W,this._root=S({head:I},0,W)}return this},J.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(J.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(J.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),J.prototype.toString=function(N){N===void 0&&(N=function(W){return String(W.key)});var b=[];return d(this._root,"",!0,function(R){return b.push(R)},N),b.join("")},J.prototype.update=function(N,b,R){var W=this._comparator,Z=f(N,this._root,W),I=Z.left,P=Z.right;W(N,b)<0?P=h(b,R,P,W):I=h(b,R,I,W),this._root=p(I,P,W)},J.prototype.split=function(N){return f(N,this._root,this._comparator)},J}();function _(J,N,b,R){var W=R-b;if(W>0){var Z=b+Math.floor(W/2),I=J[Z],P=N[Z],B=new o(I,P);return B.left=_(J,N,b,Z),B.right=_(J,N,Z+1,R),B}return null}function y(J,N){for(var b=new o(null,null),R=b,W=0;W<J.length;W++)R=R.next=new o(J[W],N[W]);return R.next=null,b.next}function M(J){for(var N=J,b=[],R=!1,W=new o(null,null),Z=W;!R;)N?(b.push(N),N=N.left):b.length>0?(N=Z=Z.next=b.pop(),N=N.right):R=!0;return Z.next=null,W.next}function S(J,N,b){var R=b-N;if(R>0){var W=N+Math.floor(R/2),Z=S(J,N,W),I=J.head;return I.left=Z,J.head=J.head.next,I.right=S(J,W+1,b),I}return null}function T(J,N,b){for(var R=new o(null,null),W=R,Z=J,I=N;Z!==null&&I!==null;)b(Z.key,I.key)<0?(W.next=Z,Z=Z.next):(W.next=I,I=I.next),W=W.next;return Z!==null?W.next=Z:I!==null&&(W.next=I),R.next}function x(J,N,b,R,W){if(!(b>=R)){for(var Z=J[b+R>>1],I=b-1,P=R+1;;){do I++;while(W(J[I],Z)<0);do P--;while(W(J[P],Z)>0);if(I>=P)break;var B=J[I];J[I]=J[P],J[P]=B,B=N[I],N[I]=N[P],N[P]=B}x(J,N,b,P,W),x(J,N,P+1,R,W)}}var v=function(N,b){return N.ll.x<=b.x&&b.x<=N.ur.x&&N.ll.y<=b.y&&b.y<=N.ur.y},C=function(N,b){if(b.ur.x<N.ll.x||N.ur.x<b.ll.x||b.ur.y<N.ll.y||N.ur.y<b.ll.y)return null;var R=N.ll.x<b.ll.x?b.ll.x:N.ll.x,W=N.ur.x<b.ur.x?N.ur.x:b.ur.x,Z=N.ll.y<b.ll.y?b.ll.y:N.ll.y,I=N.ur.y<b.ur.y?N.ur.y:b.ur.y;return{ll:{x:R,y:Z},ur:{x:W,y:I}}},w=Number.EPSILON;w===void 0&&(w=Math.pow(2,-52));var O=w*w,F=function(N,b){if(-w<N&&N<w&&-w<b&&b<w)return 0;var R=N-b;return R*R<O*N*b?0:N<b?-1:1},G=function(){function J(){r(this,J),this.reset()}return e(J,[{key:"reset",value:function(){this.xRounder=new z,this.yRounder=new z}},{key:"round",value:function(b,R){return{x:this.xRounder.round(b),y:this.yRounder.round(R)}}}]),J}(),z=function(){function J(){r(this,J),this.tree=new g,this.round(0)}return e(J,[{key:"round",value:function(b){var R=this.tree.add(b),W=this.tree.prev(R);if(W!==null&&F(R.key,W.key)===0)return this.tree.remove(b),W.key;var Z=this.tree.next(R);return Z!==null&&F(R.key,Z.key)===0?(this.tree.remove(b),Z.key):b}}]),J}(),L=new G,D=function(N,b){return N.x*b.y-N.y*b.x},q=function(N,b){return N.x*b.x+N.y*b.y},nt=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},Z={x:R.x-N.x,y:R.y-N.y},I=D(W,Z);return F(I,0)},k=function(N){return Math.sqrt(q(N,N))},xt=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},Z={x:R.x-N.x,y:R.y-N.y};return D(Z,W)/k(Z)/k(W)},X=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},Z={x:R.x-N.x,y:R.y-N.y};return q(Z,W)/k(Z)/k(W)},it=function(N,b,R){return b.y===0?null:{x:N.x+b.x/b.y*(R-N.y),y:R}},vt=function(N,b,R){return b.x===0?null:{x:R,y:N.y+b.y/b.x*(R-N.x)}},pt=function(N,b,R,W){if(b.x===0)return vt(R,W,N.x);if(W.x===0)return vt(N,b,R.x);if(b.y===0)return it(R,W,N.y);if(W.y===0)return it(N,b,R.y);var Z=D(b,W);if(Z==0)return null;var I={x:R.x-N.x,y:R.y-N.y},P=D(I,b)/Z,B=D(I,W)/Z,lt=N.x+B*b.x,ct=R.x+P*W.x,j=N.y+B*b.y,wt=R.y+P*W.y,_t=(lt+ct)/2,Mt=(j+wt)/2;return{x:_t,y:Mt}},et=function(){e(J,null,[{key:"compare",value:function(b,R){var W=J.comparePoints(b.point,R.point);return W!==0?W:(b.point!==R.point&&b.link(R),b.isLeft!==R.isLeft?b.isLeft?1:-1:V.compare(b.segment,R.segment))}},{key:"comparePoints",value:function(b,R){return b.x<R.x?-1:b.x>R.x?1:b.y<R.y?-1:b.y>R.y?1:0}}]);function J(N,b){r(this,J),N.events===void 0?N.events=[this]:N.events.push(this),this.point=N,this.isLeft=b}return e(J,[{key:"link",value:function(b){if(b.point===this.point)throw new Error("Tried to link already linked events");for(var R=b.point.events,W=0,Z=R.length;W<Z;W++){var I=R[W];this.point.events.push(I),I.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var b=this.point.events.length,R=0;R<b;R++){var W=this.point.events[R];if(W.segment.consumedBy===void 0)for(var Z=R+1;Z<b;Z++){var I=this.point.events[Z];I.consumedBy===void 0&&W.otherSE.point.events===I.otherSE.point.events&&W.segment.consume(I.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var b=[],R=0,W=this.point.events.length;R<W;R++){var Z=this.point.events[R];Z!==this&&!Z.segment.ringOut&&Z.segment.isInResult()&&b.push(Z)}return b}},{key:"getLeftmostComparator",value:function(b){var R=this,W=new Map,Z=function(P){var B=P.otherSE;W.set(P,{sine:xt(R.point,b.point,B.point),cosine:X(R.point,b.point,B.point)})};return function(I,P){W.has(I)||Z(I),W.has(P)||Z(P);var B=W.get(I),lt=B.sine,ct=B.cosine,j=W.get(P),wt=j.sine,_t=j.cosine;return lt>=0&&wt>=0?ct<_t?1:ct>_t?-1:0:lt<0&&wt<0?ct<_t?-1:ct>_t?1:0:wt<lt?-1:wt>lt?1:0}}}]),J}(),ot=0,V=function(){e(J,null,[{key:"compare",value:function(b,R){var W=b.leftSE.point.x,Z=R.leftSE.point.x,I=b.rightSE.point.x,P=R.rightSE.point.x;if(P<W)return 1;if(I<Z)return-1;var B=b.leftSE.point.y,lt=R.leftSE.point.y,ct=b.rightSE.point.y,j=R.rightSE.point.y;if(W<Z){if(lt<B&<<ct)return 1;if(lt>B&<>ct)return-1;var wt=b.comparePoint(R.leftSE.point);if(wt<0)return 1;if(wt>0)return-1;var _t=R.comparePoint(b.rightSE.point);return _t!==0?_t:-1}if(W>Z){if(B<lt&&B<j)return-1;if(B>lt&&B>j)return 1;var Mt=R.comparePoint(b.leftSE.point);if(Mt!==0)return Mt;var Lt=b.comparePoint(R.rightSE.point);return Lt<0?1:Lt>0?-1:1}if(B<lt)return-1;if(B>lt)return 1;if(I<P){var Jt=R.comparePoint(b.rightSE.point);if(Jt!==0)return Jt}if(I>P){var Et=b.comparePoint(R.rightSE.point);if(Et<0)return 1;if(Et>0)return-1}if(I!==P){var oe=ct-B,Qt=I-W,Ht=j-lt,Ot=P-Z;if(oe>Qt&&Ht<Ot)return 1;if(oe<Qt&&Ht>Ot)return-1}return I>P?1:I<P||ct<j?-1:ct>j?1:b.id<R.id?-1:b.id>R.id?1:0}}]);function J(N,b,R,W){r(this,J),this.id=++ot,this.leftSE=N,N.segment=this,N.otherSE=b,this.rightSE=b,b.segment=this,b.otherSE=N,this.rings=R,this.windings=W}return e(J,[{key:"replaceRightSE",value:function(b){this.rightSE=b,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var b=this.leftSE.point.y,R=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:b<R?b:R},ur:{x:this.rightSE.point.x,y:b>R?b:R}}}},{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(b){return b.x===this.leftSE.point.x&&b.y===this.leftSE.point.y||b.x===this.rightSE.point.x&&b.y===this.rightSE.point.y}},{key:"comparePoint",value:function(b){if(this.isAnEndpoint(b))return 0;var R=this.leftSE.point,W=this.rightSE.point,Z=this.vector();if(R.x===W.x)return b.x===R.x?0:b.x<R.x?1:-1;var I=(b.y-R.y)/Z.y,P=R.x+I*Z.x;if(b.x===P)return 0;var B=(b.x-R.x)/Z.x,lt=R.y+B*Z.y;return b.y===lt?0:b.y<lt?-1:1}},{key:"getIntersection",value:function(b){var R=this.bbox(),W=b.bbox(),Z=C(R,W);if(Z===null)return null;var I=this.leftSE.point,P=this.rightSE.point,B=b.leftSE.point,lt=b.rightSE.point,ct=v(R,B)&&this.comparePoint(B)===0,j=v(W,I)&&b.comparePoint(I)===0,wt=v(R,lt)&&this.comparePoint(lt)===0,_t=v(W,P)&&b.comparePoint(P)===0;if(j&&ct)return _t&&!wt?P:!_t&&wt?lt:null;if(j)return wt&&I.x===lt.x&&I.y===lt.y?null:I;if(ct)return _t&&P.x===B.x&&P.y===B.y?null:B;if(_t&&wt)return null;if(_t)return P;if(wt)return lt;var Mt=pt(I,this.vector(),B,b.vector());return Mt===null||!v(Z,Mt)?null:L.round(Mt.x,Mt.y)}},{key:"split",value:function(b){var R=[],W=b.events!==void 0,Z=new et(b,!0),I=new et(b,!1),P=this.rightSE;this.replaceRightSE(I),R.push(I),R.push(Z);var B=new J(Z,P,this.rings.slice(),this.windings.slice());return et.comparePoints(B.leftSE.point,B.rightSE.point)>0&&B.swapEvents(),et.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),W&&(Z.checkForConsuming(),I.checkForConsuming()),R}},{key:"swapEvents",value:function(){var b=this.rightSE;this.rightSE=this.leftSE,this.leftSE=b,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var R=0,W=this.windings.length;R<W;R++)this.windings[R]*=-1}},{key:"consume",value:function(b){for(var R=this,W=b;R.consumedBy;)R=R.consumedBy;for(;W.consumedBy;)W=W.consumedBy;var Z=J.compare(R,W);if(Z!==0){if(Z>0){var I=R;R=W,W=I}if(R.prev===W){var P=R;R=W,W=P}for(var B=0,lt=W.rings.length;B<lt;B++){var ct=W.rings[B],j=W.windings[B],wt=R.rings.indexOf(ct);wt===-1?(R.rings.push(ct),R.windings.push(j)):R.windings[wt]+=j}W.rings=null,W.windings=null,W.consumedBy=R,W.leftSE.consumedBy=R.leftSE,W.rightSE.consumedBy=R.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 b=this.prev.consumedBy||this.prev;this._beforeState=b.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var b=this.beforeState();this._afterState={rings:b.rings.slice(0),windings:b.windings.slice(0),multiPolys:[]};for(var R=this._afterState.rings,W=this._afterState.windings,Z=this._afterState.multiPolys,I=0,P=this.rings.length;I<P;I++){var B=this.rings[I],lt=this.windings[I],ct=R.indexOf(B);ct===-1?(R.push(B),W.push(lt)):W[ct]+=lt}for(var j=[],wt=[],_t=0,Mt=R.length;_t<Mt;_t++)if(W[_t]!==0){var Lt=R[_t],Jt=Lt.poly;if(wt.indexOf(Jt)===-1)if(Lt.isExterior)j.push(Jt);else{wt.indexOf(Jt)===-1&&wt.push(Jt);var Et=j.indexOf(Lt.poly);Et!==-1&&j.splice(Et,1)}}for(var oe=0,Qt=j.length;oe<Qt;oe++){var Ht=j[oe].multiPoly;Z.indexOf(Ht)===-1&&Z.push(Ht)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var b=this.beforeState().multiPolys,R=this.afterState().multiPolys;switch(Xt.type){case"union":{var W=b.length===0,Z=R.length===0;this._isInResult=W!==Z;break}case"intersection":{var I,P;b.length<R.length?(I=b.length,P=R.length):(I=R.length,P=b.length),this._isInResult=P===Xt.numMultiPolys&&I<P;break}case"xor":{var B=Math.abs(b.length-R.length);this._isInResult=B%2===1;break}case"difference":{var lt=function(j){return j.length===1&&j[0].isSubject};this._isInResult=lt(b)!==lt(R);break}default:throw new Error("Unrecognized operation type found ".concat(Xt.type))}return this._isInResult}}],[{key:"fromRing",value:function(b,R,W){var Z,I,P,B=et.comparePoints(b,R);if(B<0)Z=b,I=R,P=1;else if(B>0)Z=R,I=b,P=-1;else throw new Error("Tried to create degenerate segment at [".concat(b.x,", ").concat(b.y,"]"));var lt=new et(Z,!0),ct=new et(I,!1);return new J(lt,ct,[W],[P])}}]),J}(),K=function(){function J(N,b,R){if(r(this,J),!Array.isArray(N)||N.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=b,this.isExterior=R,this.segments=[],typeof N[0][0]!="number"||typeof N[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var W=L.round(N[0][0],N[0][1]);this.bbox={ll:{x:W.x,y:W.y},ur:{x:W.x,y:W.y}};for(var Z=W,I=1,P=N.length;I<P;I++){if(typeof N[I][0]!="number"||typeof N[I][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var B=L.round(N[I][0],N[I][1]);B.x===Z.x&&B.y===Z.y||(this.segments.push(V.fromRing(Z,B,this)),B.x<this.bbox.ll.x&&(this.bbox.ll.x=B.x),B.y<this.bbox.ll.y&&(this.bbox.ll.y=B.y),B.x>this.bbox.ur.x&&(this.bbox.ur.x=B.x),B.y>this.bbox.ur.y&&(this.bbox.ur.y=B.y),Z=B)}(W.x!==Z.x||W.y!==Z.y)&&this.segments.push(V.fromRing(Z,W,this))}return e(J,[{key:"getSweepEvents",value:function(){for(var b=[],R=0,W=this.segments.length;R<W;R++){var Z=this.segments[R];b.push(Z.leftSE),b.push(Z.rightSE)}return b}}]),J}(),at=function(){function J(N,b){if(r(this,J),!Array.isArray(N))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new K(N[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 R=1,W=N.length;R<W;R++){var Z=new K(N[R],this,!1);Z.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=Z.bbox.ll.x),Z.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=Z.bbox.ll.y),Z.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=Z.bbox.ur.x),Z.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=Z.bbox.ur.y),this.interiorRings.push(Z)}this.multiPoly=b}return e(J,[{key:"getSweepEvents",value:function(){for(var b=this.exteriorRing.getSweepEvents(),R=0,W=this.interiorRings.length;R<W;R++)for(var Z=this.interiorRings[R].getSweepEvents(),I=0,P=Z.length;I<P;I++)b.push(Z[I]);return b}}]),J}(),Tt=function(){function J(N,b){if(r(this,J),!Array.isArray(N))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof N[0][0][0]=="number"&&(N=[N])}catch(I){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var R=0,W=N.length;R<W;R++){var Z=new at(N[R],this);Z.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=Z.bbox.ll.x),Z.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=Z.bbox.ll.y),Z.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=Z.bbox.ur.x),Z.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=Z.bbox.ur.y),this.polys.push(Z)}this.isSubject=b}return e(J,[{key:"getSweepEvents",value:function(){for(var b=[],R=0,W=this.polys.length;R<W;R++)for(var Z=this.polys[R].getSweepEvents(),I=0,P=Z.length;I<P;I++)b.push(Z[I]);return b}}]),J}(),dt=function(){e(J,null,[{key:"factory",value:function(b){for(var R=[],W=0,Z=b.length;W<Z;W++){var I=b[W];if(!(!I.isInResult()||I.ringOut)){for(var P=null,B=I.leftSE,lt=I.rightSE,ct=[B],j=B.point,wt=[];P=B,B=lt,ct.push(B),B.point!==j;)for(;;){var _t=B.getAvailableLinkedEvents();if(_t.length===0){var Mt=ct[0].point,Lt=ct[ct.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(Mt.x,",")+" ".concat(Mt.y,"]. Last matching segment found ends at")+" [".concat(Lt.x,", ").concat(Lt.y,"]."))}if(_t.length===1){lt=_t[0].otherSE;break}for(var Jt=null,Et=0,oe=wt.length;Et<oe;Et++)if(wt[Et].point===B.point){Jt=Et;break}if(Jt!==null){var Qt=wt.splice(Jt)[0],Ht=ct.splice(Qt.index);Ht.unshift(Ht[0].otherSE),R.push(new J(Ht.reverse()));continue}wt.push({index:ct.length,point:B.point});var Ot=B.getLeftmostComparator(P);lt=_t.sort(Ot)[0].otherSE;break}R.push(new J(ct))}}return R}}]);function J(N){r(this,J),this.events=N;for(var b=0,R=N.length;b<R;b++)N[b].segment.ringOut=this;this.poly=null}return e(J,[{key:"getGeom",value:function(){for(var b=this.events[0].point,R=[b],W=1,Z=this.events.length-1;W<Z;W++){var I=this.events[W].point,P=this.events[W+1].point;nt(I,b,P)!==0&&(R.push(I),b=I)}if(R.length===1)return null;var B=R[0],lt=R[1];nt(B,b,lt)===0&&R.shift(),R.push(R[0]);for(var ct=this.isExteriorRing()?1:-1,j=this.isExteriorRing()?0:R.length-1,wt=this.isExteriorRing()?R.length:-1,_t=[],Mt=j;Mt!=wt;Mt+=ct)_t.push([R[Mt].x,R[Mt].y]);return _t}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var b=this.enclosingRing();this._isExteriorRing=b?!b.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 b=this.events[0],R=1,W=this.events.length;R<W;R++){var Z=this.events[R];et.compare(b,Z)>0&&(b=Z)}for(var I=b.segment.prevInResult(),P=I?I.prevInResult():null;;){if(!I)return null;if(!P)return I.ringOut;if(P.ringOut!==I.ringOut)return P.ringOut.enclosingRing()!==I.ringOut?I.ringOut:I.ringOut.enclosingRing();I=P.prevInResult(),P=I?I.prevInResult():null}}}]),J}(),Ct=function(){function J(N){r(this,J),this.exteriorRing=N,N.poly=this,this.interiorRings=[]}return e(J,[{key:"addInterior",value:function(b){this.interiorRings.push(b),b.poly=this}},{key:"getGeom",value:function(){var b=[this.exteriorRing.getGeom()];if(b[0]===null)return null;for(var R=0,W=this.interiorRings.length;R<W;R++){var Z=this.interiorRings[R].getGeom();Z!==null&&b.push(Z)}return b}}]),J}(),Yt=function(){function J(N){r(this,J),this.rings=N,this.polys=this._composePolys(N)}return e(J,[{key:"getGeom",value:function(){for(var b=[],R=0,W=this.polys.length;R<W;R++){var Z=this.polys[R].getGeom();Z!==null&&b.push(Z)}return b}},{key:"_composePolys",value:function(b){for(var R=[],W=0,Z=b.length;W<Z;W++){var I=b[W];if(!I.poly)if(I.isExteriorRing())R.push(new Ct(I));else{var P=I.enclosingRing();P.poly||R.push(new Ct(P)),P.poly.addInterior(I)}}return R}}]),J}(),Wt=function(){function J(N){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:V.compare;r(this,J),this.queue=N,this.tree=new g(b),this.segments=[]}return e(J,[{key:"process",value:function(b){var R=b.segment,W=[];if(b.consumedBy)return b.isLeft?this.queue.remove(b.otherSE):this.tree.remove(R),W;var Z=b.isLeft?this.tree.insert(R):this.tree.find(R);if(!Z)throw new Error("Unable to find segment #".concat(R.id," ")+"[".concat(R.leftSE.point.x,", ").concat(R.leftSE.point.y,"] -> ")+"[".concat(R.rightSE.point.x,", ").concat(R.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var I=Z,P=Z,B=void 0,lt=void 0;B===void 0;)I=this.tree.prev(I),I===null?B=null:I.key.consumedBy===void 0&&(B=I.key);for(;lt===void 0;)P=this.tree.next(P),P===null?lt=null:P.key.consumedBy===void 0&&(lt=P.key);if(b.isLeft){var ct=null;if(B){var j=B.getIntersection(R);if(j!==null&&(R.isAnEndpoint(j)||(ct=j),!B.isAnEndpoint(j)))for(var wt=this._splitSafely(B,j),_t=0,Mt=wt.length;_t<Mt;_t++)W.push(wt[_t])}var Lt=null;if(lt){var Jt=lt.getIntersection(R);if(Jt!==null&&(R.isAnEndpoint(Jt)||(Lt=Jt),!lt.isAnEndpoint(Jt)))for(var Et=this._splitSafely(lt,Jt),oe=0,Qt=Et.length;oe<Qt;oe++)W.push(Et[oe])}if(ct!==null||Lt!==null){var Ht=null;if(ct===null)Ht=Lt;else if(Lt===null)Ht=ct;else{var Ot=et.comparePoints(ct,Lt);Ht=Ot<=0?ct:Lt}this.queue.remove(R.rightSE),W.push(R.rightSE);for(var Y=R.split(Ht),St=0,Q=Y.length;St<Q;St++)W.push(Y[St])}W.length>0?(this.tree.remove(R),W.push(b)):(this.segments.push(R),R.prev=B)}else{if(B&<){var Ut=B.getIntersection(lt);if(Ut!==null){if(!B.isAnEndpoint(Ut))for(var Dt=this._splitSafely(B,Ut),ht=0,Kt=Dt.length;ht<Kt;ht++)W.push(Dt[ht]);if(!lt.isAnEndpoint(Ut))for(var re=this._splitSafely(lt,Ut),gn=0,He=re.length;gn<He;gn++)W.push(re[gn])}}this.tree.remove(R)}return W}},{key:"_splitSafely",value:function(b,R){this.tree.remove(b);var W=b.rightSE;this.queue.remove(W);var Z=b.split(R);return Z.push(W),b.consumedBy===void 0&&this.tree.insert(b),Z}}]),J}(),Nt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ne=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Pt=function(){function J(){r(this,J)}return e(J,[{key:"run",value:function(b,R,W){Xt.type=b,L.reset();for(var Z=[new Tt(R,!0)],I=0,P=W.length;I<P;I++)Z.push(new Tt(W[I],!1));if(Xt.numMultiPolys=Z.length,Xt.type==="difference")for(var B=Z[0],lt=1;lt<Z.length;)C(Z[lt].bbox,B.bbox)!==null?lt++:Z.splice(lt,1);if(Xt.type==="intersection"){for(var ct=0,j=Z.length;ct<j;ct++)for(var wt=Z[ct],_t=ct+1,Mt=Z.length;_t<Mt;_t++)if(C(wt.bbox,Z[_t].bbox)===null)return[]}for(var Lt=new g(et.compare),Jt=0,Et=Z.length;Jt<Et;Jt++)for(var oe=Z[Jt].getSweepEvents(),Qt=0,Ht=oe.length;Qt<Ht;Qt++)if(Lt.insert(oe[Qt]),Lt.size>Nt)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var Ot=new Wt(Lt),Y=Lt.size,St=Lt.pop();St;){var Q=St.key;if(Lt.size===Y){var Ut=Q.segment;throw new Error("Unable to pop() ".concat(Q.isLeft?"left":"right"," SweepEvent ")+"[".concat(Q.point.x,", ").concat(Q.point.y,"] from segment #").concat(Ut.id," ")+"[".concat(Ut.leftSE.point.x,", ").concat(Ut.leftSE.point.y,"] -> ")+"[".concat(Ut.rightSE.point.x,", ").concat(Ut.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(Lt.size>Nt)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(Ot.segments.length>ne)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var Dt=Ot.process(Q),ht=0,Kt=Dt.length;ht<Kt;ht++){var re=Dt[ht];re.consumedBy===void 0&&Lt.insert(re)}Y=Lt.size,St=Lt.pop()}L.reset();var gn=dt.factory(Ot.segments),He=new Yt(gn);return He.getGeom()}}]),J}(),Xt=new Pt,tt=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("union",N,R)},nn=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("intersection",N,R)},Gt=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("xor",N,R)},te=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("difference",N,R)},qt={union:tt,intersection:nn,xor:Gt,difference:te};return qt})});var K_=Zt((hh,J_)=>{(function(r,t){typeof hh=="object"&&typeof J_!="undefined"?t(hh):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(hh,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 l(){}function h(n){return n===null?di:n.color}function f(n){return n===null?null:n.parent}function p(n,i){n!==null&&(n.color=i)}function d(n){return n===null?null:n.left}function g(n){return n===null?null:n.right}function _(){this.root_=null,this.size_=0}function y(){}function M(){this.array_=[],arguments[0]instanceof Ot&&this.addAll(arguments[0])}function S(){}function T(n){this.message=n||""}function x(){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,u=1 in arguments&&parseInt(Number(arguments[1]),10)||0;u=u<0?Math.max(s+u,0):Math.min(u,s);var c=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:s;for(c=c<0?Math.max(s+arguments[2],0):Math.min(c,s);u<c;)i[u]=n,++u;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 v=function(){};v.prototype.interfaces_=function(){return[]},v.prototype.getClass=function(){return v},v.prototype.equalsWithTolerance=function(n,i,s){return Math.abs(n-i)<=s};var C=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),w=function(){},O={MAX_VALUE:{configurable:!0}};w.isNaN=function(n){return Number.isNaN(n)},w.doubleToLongBits=function(n){return n},w.longBitsToDouble=function(n){return n},w.isInfinite=function(n){return!Number.isFinite(n)},O.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(w,O);var F=function(){},G=function(){},z=function(){},L=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])},D={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};L.prototype.setOrdinate=function(n,i){switch(n){case L.X:this.x=i;break;case L.Y:this.y=i;break;case L.Z:this.z=i;break;default:throw new C("Invalid ordinate index: "+n)}},L.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!!v.equalsWithTolerance(this.x,i.x,s)&&!!v.equalsWithTolerance(this.y,i.y,s)}},L.prototype.getOrdinate=function(n){switch(n){case L.X:return this.x;case L.Y:return this.y;case L.Z:return this.z}throw new C("Invalid ordinate index: "+n)},L.prototype.equals3D=function(n){return this.x===n.x&&this.y===n.y&&(this.z===n.z||w.isNaN(this.z))&&w.isNaN(n.z)},L.prototype.equals=function(n){return n instanceof L&&this.equals2D(n)},L.prototype.equalInZ=function(n,i){return v.equalsWithTolerance(this.z,n.z,i)},L.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},L.prototype.clone=function(){},L.prototype.copy=function(){return new L(this)},L.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},L.prototype.distance3D=function(n){var i=this.x-n.x,s=this.y-n.y,u=this.z-n.z;return Math.sqrt(i*i+s*s+u*u)},L.prototype.distance=function(n){var i=this.x-n.x,s=this.y-n.y;return Math.sqrt(i*i+s*s)},L.prototype.hashCode=function(){var n=17;return n=37*n+L.hashCode(this.x),n=37*n+L.hashCode(this.y)},L.prototype.setCoordinate=function(n){this.x=n.x,this.y=n.y,this.z=n.z},L.prototype.interfaces_=function(){return[F,G,t]},L.prototype.getClass=function(){return L},L.hashCode=function(){if(arguments.length===1){var n=arguments[0],i=w.doubleToLongBits(n);return Math.trunc((i^i)>>>32)}},D.DimensionalComparator.get=function(){return q},D.serialVersionUID.get=function(){return 6683108902428367e3},D.NULL_ORDINATE.get=function(){return w.NaN},D.X.get=function(){return 0},D.Y.get=function(){return 1},D.Z.get=function(){return 2},Object.defineProperties(L,D);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 C("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};q.prototype.compare=function(n,i){var s=n,u=i,c=q.compare(s.x,u.x);if(c!==0)return c;var m=q.compare(s.y,u.y);return m!==0?m:this._dimensionsToTest<=2?0:q.compare(s.z,u.z)},q.prototype.interfaces_=function(){return[z]},q.prototype.getClass=function(){return q},q.compare=function(n,i){return n<i?-1:n>i?1:w.isNaN(n)?w.isNaN(i)?0:-1:w.isNaN(i)?1:0};var nt=function(){};nt.prototype.create=function(){},nt.prototype.interfaces_=function(){return[]},nt.prototype.getClass=function(){return nt};var k=function(){},xt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};k.prototype.interfaces_=function(){return[]},k.prototype.getClass=function(){return k},k.toLocationSymbol=function(n){switch(n){case k.EXTERIOR:return"e";case k.BOUNDARY:return"b";case k.INTERIOR:return"i";case k.NONE:return"-"}throw new C("Unknown location value: "+n)},xt.INTERIOR.get=function(){return 0},xt.BOUNDARY.get=function(){return 1},xt.EXTERIOR.get=function(){return 2},xt.NONE.get=function(){return-1},Object.defineProperties(k,xt);var X=function(n,i){return n.interfaces_&&n.interfaces_().indexOf(i)>-1},it=function(){},vt={LOG_10:{configurable:!0}};it.prototype.interfaces_=function(){return[]},it.prototype.getClass=function(){return it},it.log10=function(n){var i=Math.log(n);return w.isInfinite(i)||w.isNaN(i)?i:i/it.LOG_10},it.min=function(n,i,s,u){var c=n;return i<c&&(c=i),s<c&&(c=s),u<c&&(c=u),c},it.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 u=arguments[0],c=arguments[1],m=arguments[2];return u<c?c:u>m?m:u}},it.wrap=function(n,i){return n<0?i- -n%i:n%i},it.max=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],u=n;return i>u&&(u=i),s>u&&(u=s),u}if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3],U=c;return m>U&&(U=m),E>U&&(U=E),A>U&&(U=A),U}},it.average=function(n,i){return(n+i)/2},vt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(it,vt);var pt=function(n){this.str=n};pt.prototype.append=function(n){this.str+=n},pt.prototype.setCharAt=function(n,i){this.str=this.str.substr(0,n)+i+this.str.substr(n+1)},pt.prototype.toString=function(n){return this.str};var et=function(n){this.value=n};et.prototype.intValue=function(){return this.value},et.prototype.compareTo=function(n){return this.value<n?-1:this.value>n?1:0},et.isNaN=function(n){return Number.isNaN(n)};var ot=function(){};ot.isWhitespace=function(n){return n<=32&&n>=0||n===127},ot.toUpperCase=function(n){return n.toUpperCase()};var V=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 u=arguments[0];n.call(this,n.parse(u))}}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.init(c,m)}},K={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}};V.prototype.le=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<=n._lo},V.prototype.extractSignificantDigits=function(n,i){var s=this.abs(),u=V.magnitude(s._hi),c=V.TEN.pow(u);(s=s.divide(c)).gt(V.TEN)?(s=s.divide(V.TEN),u+=1):s.lt(V.ONE)&&(s=s.multiply(V.TEN),u-=1);for(var m=u+1,E=new pt,A=V.MAX_PRINT_DIGITS-1,U=0;U<=A;U++){n&&U===m&&E.append(".");var $=Math.trunc(s._hi);if($<0)break;var ut=!1,ft=0;$>9?(ut=!0,ft="9"):ft="0"+$,E.append(ft),s=s.subtract(V.valueOf($)).multiply(V.TEN),ut&&s.selfAdd(V.TEN);var At=!0,Rt=V.magnitude(s._hi);if(Rt<0&&Math.abs(Rt)>=A-U&&(At=!1),!At)break}return i[0]=u,E.toString()},V.prototype.sqr=function(){return this.multiply(this)},V.prototype.doubleValue=function(){return this._hi+this._lo},V.prototype.subtract=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},V.prototype.equals=function(){if(arguments.length===1){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}},V.prototype.isZero=function(){return this._hi===0&&this._lo===0},V.prototype.selfSubtract=function(){if(arguments[0]instanceof V){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)}},V.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},V.prototype.min=function(n){return this.le(n)?this:n},V.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof V){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],u=arguments[1],c=null,m=null,E=null,A=null,U=null,$=null,ut=null,ft=null;return U=this._hi/s,$=V.SPLIT*U,c=$-U,ft=V.SPLIT*s,c=$-c,m=U-c,E=ft-s,ut=U*s,E=ft-E,A=s-E,ft=c*E-ut+c*A+m*E+m*A,$=(this._hi-ut-ft+this._lo-U*u)/s,ft=U+$,this._hi=ft,this._lo=U-ft+$,this}},V.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},V.prototype.divide=function(){if(arguments[0]instanceof V){var n=arguments[0],i=null,s=null,u=null,c=null,m=null,E=null,A=null,U=null;return s=(m=this._hi/n._hi)-(i=(E=V.SPLIT*m)-(i=E-m)),U=i*(u=(U=V.SPLIT*n._hi)-(u=U-n._hi))-(A=m*n._hi)+i*(c=n._hi-u)+s*u+s*c,E=(this._hi-A-U+this._lo-m*n._lo)/n._hi,new V(U=m+E,m-U+E)}if(typeof arguments[0]=="number"){var $=arguments[0];return w.isNaN($)?V.createNaN():V.copy(this).selfDivide($,0)}},V.prototype.ge=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>=n._lo},V.prototype.pow=function(n){if(n===0)return V.valueOf(1);var i=new V(this),s=V.valueOf(1),u=Math.abs(n);if(u>1)for(;u>0;)u%2==1&&s.selfMultiply(i),(u/=2)>0&&(i=i.sqr());else s=i;return n<0?s.reciprocal():s},V.prototype.ceil=function(){if(this.isNaN())return V.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new V(n,i)},V.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},V.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},V.prototype.setValue=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},V.prototype.max=function(n){return this.ge(n)?this:n},V.prototype.sqrt=function(){if(this.isZero())return V.valueOf(0);if(this.isNegative())return V.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,s=V.valueOf(i),u=this.subtract(s.sqr())._hi*(.5*n);return s.add(u)},V.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],s=null,u=null,c=null,m=null,E=null,A=null;return c=this._hi+i,E=c-this._hi,m=c-E,m=i-E+(this._hi-m),A=m+this._lo,s=c+A,u=A+(c-s),this._hi=s+u,this._lo=u+(s-this._hi),this}}else if(arguments.length===2){var U=arguments[0],$=arguments[1],ut=null,ft=null,At=null,Rt=null,kt=null,ee=null,on=null;Rt=this._hi+U,ft=this._lo+$,kt=Rt-(ee=Rt-this._hi),At=ft-(on=ft-this._lo);var Rn=(ut=Rt+(ee=(kt=U-ee+(this._hi-kt))+ft))+(ee=(At=$-on+(this._lo-At))+(ee+(Rt-ut))),dr=ee+(ut-Rn);return this._hi=Rn,this._lo=dr,this}},V.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof V){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],u=arguments[1],c=null,m=null,E=null,A=null,U=null,$=null;c=(U=V.SPLIT*this._hi)-this._hi,$=V.SPLIT*s,c=U-c,m=this._hi-c,E=$-s;var ut=(U=this._hi*s)+($=c*(E=$-E)-U+c*(A=s-E)+m*E+m*A+(this._hi*u+this._lo*s)),ft=$+(c=U-ut);return this._hi=ut,this._lo=ft,this}},V.prototype.selfSqr=function(){return this.selfMultiply(this)},V.prototype.floor=function(){if(this.isNaN())return V.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new V(n,i)},V.prototype.negate=function(){return this.isNaN()?this:new V(-this._hi,-this._lo)},V.prototype.clone=function(){},V.prototype.multiply=function(){if(arguments[0]instanceof V){var n=arguments[0];return n.isNaN()?V.createNaN():V.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return w.isNaN(i)?V.createNaN():V.copy(this).selfMultiply(i,0)}},V.prototype.isNaN=function(){return w.isNaN(this._hi)},V.prototype.intValue=function(){return Math.trunc(this._hi)},V.prototype.toString=function(){var n=V.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()},V.prototype.toStandardNotation=function(){var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!0,i),u=i[0]+1,c=s;if(s.charAt(0)===".")c="0"+s;else if(u<0)c="0."+V.stringOfChar("0",-u)+s;else if(s.indexOf(".")===-1){var m=u-s.length;c=s+V.stringOfChar("0",m)+".0"}return this.isNegative()?"-"+c:c},V.prototype.reciprocal=function(){var n=null,i=null,s=null,u=null,c=null,m=null,E=null,A=null;i=(c=1/this._hi)-(n=(m=V.SPLIT*c)-(n=m-c)),s=(A=V.SPLIT*this._hi)-this._hi;var U=c+(m=(1-(E=c*this._hi)-(A=n*(s=A-s)-E+n*(u=this._hi-s)+i*s+i*u)-c*this._lo)/this._hi);return new V(U,c-U+m)},V.prototype.toSciNotation=function(){if(this.isZero())return V.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!1,i),u=V.SCI_NOT_EXPONENT_CHAR+i[0];if(s.charAt(0)==="0")throw new Error("Found leading zero: "+s);var c="";s.length>1&&(c=s.substring(1));var m=s.charAt(0)+"."+c;return this.isNegative()?"-"+m+u:m+u},V.prototype.abs=function(){return this.isNaN()?V.NaN:this.isNegative()?this.negate():new V(this)},V.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},V.prototype.lt=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<n._lo},V.prototype.add=function(){if(arguments[0]instanceof V){var n=arguments[0];return V.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return V.copy(this).selfAdd(i)}},V.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 V){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._hi=s,this._lo=u}},V.prototype.gt=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>n._lo},V.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},V.prototype.trunc=function(){return this.isNaN()?V.NaN:this.isPositive()?this.floor():this.ceil()},V.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},V.prototype.interfaces_=function(){return[t,F,G]},V.prototype.getClass=function(){return V},V.sqr=function(n){return V.valueOf(n).selfMultiply(n)},V.valueOf=function(){if(typeof arguments[0]=="string"){var n=arguments[0];return V.parse(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return new V(i)}},V.sqrt=function(n){return V.valueOf(n).sqrt()},V.parse=function(n){for(var i=0,s=n.length;ot.isWhitespace(n.charAt(i));)i++;var u=!1;if(i<s){var c=n.charAt(i);c!=="-"&&c!=="+"||(i++,c==="-"&&(u=!0))}for(var m=new V,E=0,A=0,U=0;!(i>=s);){var $=n.charAt(i);if(i++,ot.isDigit($)){var ut=$-"0";m.selfMultiply(V.TEN),m.selfAdd(ut),E++}else{if($!=="."){if($==="e"||$==="E"){var ft=n.substring(i);try{U=et.parseInt(ft)}catch(on){throw on instanceof Error?new Error("Invalid exponent "+ft+" in string "+n):on}break}throw new Error("Unexpected character '"+$+"' at position "+i+" in string "+n)}A=E}}var At=m,Rt=E-A-U;if(Rt===0)At=m;else if(Rt>0){var kt=V.TEN.pow(Rt);At=m.divide(kt)}else if(Rt<0){var ee=V.TEN.pow(-Rt);At=m.multiply(ee)}return u?At.negate():At},V.createNaN=function(){return new V(w.NaN,w.NaN)},V.copy=function(n){return new V(n)},V.magnitude=function(n){var i=Math.abs(n),s=Math.log(i)/Math.log(10),u=Math.trunc(Math.floor(s));return 10*Math.pow(10,u)<=i&&(u+=1),u},V.stringOfChar=function(n,i){for(var s=new pt,u=0;u<i;u++)s.append(n);return s.toString()},K.PI.get=function(){return new V(3.141592653589793,12246467991473532e-32)},K.TWO_PI.get=function(){return new V(6.283185307179586,24492935982947064e-32)},K.PI_2.get=function(){return new V(1.5707963267948966,6123233995736766e-32)},K.E.get=function(){return new V(2.718281828459045,14456468917292502e-32)},K.NaN.get=function(){return new V(w.NaN,w.NaN)},K.EPS.get=function(){return 123259516440783e-46},K.SPLIT.get=function(){return 134217729},K.MAX_PRINT_DIGITS.get=function(){return 32},K.TEN.get=function(){return V.valueOf(10)},K.ONE.get=function(){return V.valueOf(1)},K.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},K.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(V,K);var at=function(){},Tt={DP_SAFE_EPSILON:{configurable:!0}};at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.orientationIndex=function(n,i,s){var u=at.orientationIndexFilter(n,i,s);if(u<=1)return u;var c=V.valueOf(i.x).selfAdd(-n.x),m=V.valueOf(i.y).selfAdd(-n.y),E=V.valueOf(s.x).selfAdd(-i.x),A=V.valueOf(s.y).selfAdd(-i.y);return c.selfMultiply(A).selfSubtract(m.selfMultiply(E)).signum()},at.signOfDet2x2=function(n,i,s,u){return n.multiply(u).selfSubtract(i.multiply(s)).signum()},at.intersection=function(n,i,s,u){var c=V.valueOf(u.y).selfSubtract(s.y).selfMultiply(V.valueOf(i.x).selfSubtract(n.x)),m=V.valueOf(u.x).selfSubtract(s.x).selfMultiply(V.valueOf(i.y).selfSubtract(n.y)),E=c.subtract(m),A=V.valueOf(u.x).selfSubtract(s.x).selfMultiply(V.valueOf(n.y).selfSubtract(s.y)),U=V.valueOf(u.y).selfSubtract(s.y).selfMultiply(V.valueOf(n.x).selfSubtract(s.x)),$=A.subtract(U).selfDivide(E).doubleValue(),ut=V.valueOf(n.x).selfAdd(V.valueOf(i.x).selfSubtract(n.x).selfMultiply($)).doubleValue(),ft=V.valueOf(i.x).selfSubtract(n.x).selfMultiply(V.valueOf(n.y).selfSubtract(s.y)),At=V.valueOf(i.y).selfSubtract(n.y).selfMultiply(V.valueOf(n.x).selfSubtract(s.x)),Rt=ft.subtract(At).selfDivide(E).doubleValue(),kt=V.valueOf(s.y).selfAdd(V.valueOf(u.y).selfSubtract(s.y).selfMultiply(Rt)).doubleValue();return new L(ut,kt)},at.orientationIndexFilter=function(n,i,s){var u=null,c=(n.x-s.x)*(i.y-s.y),m=(n.y-s.y)*(i.x-s.x),E=c-m;if(c>0){if(m<=0)return at.signum(E);u=c+m}else{if(!(c<0)||m>=0)return at.signum(E);u=-c-m}var A=at.DP_SAFE_EPSILON*u;return E>=A||-E>=A?at.signum(E):2},at.signum=function(n){return n>0?1:n<0?-1:0},Tt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(at,Tt);var dt=function(){},Ct={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ct.X.get=function(){return 0},Ct.Y.get=function(){return 1},Ct.Z.get=function(){return 2},Ct.M.get=function(){return 3},dt.prototype.setOrdinate=function(n,i,s){},dt.prototype.size=function(){},dt.prototype.getOrdinate=function(n,i){},dt.prototype.getCoordinate=function(){},dt.prototype.getCoordinateCopy=function(n){},dt.prototype.getDimension=function(){},dt.prototype.getX=function(n){},dt.prototype.clone=function(){},dt.prototype.expandEnvelope=function(n){},dt.prototype.copy=function(){},dt.prototype.getY=function(n){},dt.prototype.toCoordinateArray=function(){},dt.prototype.interfaces_=function(){return[G]},dt.prototype.getClass=function(){return dt},Object.defineProperties(dt,Ct);var Yt=function(){},Wt=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}(Yt),Nt=function(){};Nt.arraycopy=function(n,i,s,u,c){for(var m=0,E=i;E<i+c;E++)s[u+m]=n[E],m++},Nt.getProperty=function(n){return{"line.separator":\`
|
|
92
101
|
\`}[n]};var ne=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],u=arguments[1];this.x=s,this.y=u,this.w=1}else if(arguments[0]instanceof n&&arguments[1]instanceof n){var c=arguments[0],m=arguments[1];this.x=c.y*m.w-m.y*c.w,this.y=m.x*c.w-c.x*m.w,this.w=c.x*m.y-m.x*c.y}else if(arguments[0]instanceof L&&arguments[1]instanceof L){var E=arguments[0],A=arguments[1];this.x=E.y-A.y,this.y=A.x-E.x,this.w=E.x*A.y-A.x*E.y}}else if(arguments.length===3){var U=arguments[0],$=arguments[1],ut=arguments[2];this.x=U,this.y=$,this.w=ut}else if(arguments.length===4){var ft=arguments[0],At=arguments[1],Rt=arguments[2],kt=arguments[3],ee=ft.y-At.y,on=At.x-ft.x,Rn=ft.x*At.y-At.x*ft.y,dr=Rt.y-kt.y,Ji=kt.x-Rt.x,Bo=Rt.x*kt.y-kt.x*Rt.y;this.x=on*Bo-Ji*Rn,this.y=dr*Rn-ee*Bo,this.w=ee*Ji-dr*on}};ne.prototype.getY=function(){var n=this.y/this.w;if(w.isNaN(n)||w.isInfinite(n))throw new Wt;return n},ne.prototype.getX=function(){var n=this.x/this.w;if(w.isNaN(n)||w.isInfinite(n))throw new Wt;return n},ne.prototype.getCoordinate=function(){var n=new L;return n.x=this.getX(),n.y=this.getY(),n},ne.prototype.interfaces_=function(){return[]},ne.prototype.getClass=function(){return ne},ne.intersection=function(n,i,s,u){var c=n.y-i.y,m=i.x-n.x,E=n.x*i.y-i.x*n.y,A=s.y-u.y,U=u.x-s.x,$=s.x*u.y-u.x*s.y,ut=c*U-A*m,ft=(m*$-U*E)/ut,At=(A*E-c*$)/ut;if(w.isNaN(ft)||w.isInfinite(ft)||w.isNaN(At)||w.isInfinite(At))throw new Wt;return new L(ft,At)};var Pt=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 L){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 u=arguments[0],c=arguments[1];this.init(u.x,c.x,u.y,c.y)}else if(arguments.length===4){var m=arguments[0],E=arguments[1],A=arguments[2],U=arguments[3];this.init(m,E,A,U)}},Xt={serialVersionUID:{configurable:!0}};Pt.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Pt.prototype.equals=function(n){if(!(n instanceof Pt))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()},Pt.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new Pt;var i=this._minx>n._minx?this._minx:n._minx,s=this._miny>n._miny?this._miny:n._miny,u=this._maxx<n._maxx?this._maxx:n._maxx,c=this._maxy<n._maxy?this._maxy:n._maxy;return new Pt(i,u,s,c)},Pt.prototype.isNull=function(){return this._maxx<this._minx},Pt.prototype.getMaxX=function(){return this._maxx},Pt.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof Pt){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],u=arguments[1];return!this.isNull()&&s>=this._minx&&s<=this._maxx&&u>=this._miny&&u<=this._maxy}},Pt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Pt){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 L){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||u>this._maxy||u<this._miny)}},Pt.prototype.getMinY=function(){return this._miny},Pt.prototype.getMinX=function(){return this._minx},Pt.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof Pt){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],u=arguments[1];this.isNull()?(this._minx=s,this._maxx=s,this._miny=u,this._maxy=u):(s<this._minx&&(this._minx=s),s>this._maxx&&(this._maxx=s),u<this._miny&&(this._miny=u),u>this._maxy&&(this._maxy=u))}},Pt.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},Pt.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Pt.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},Pt.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},Pt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Pt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Pt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Pt.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},Pt.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()}},Pt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Pt){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof L){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.covers(s,u)}},Pt.prototype.centre=function(){return this.isNull()?null:new L((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Pt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof Pt){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],u=arguments[1];this.init(s.x,u.x,s.y,u.y)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];c<m?(this._minx=c,this._maxx=m):(this._minx=m,this._maxx=c),E<A?(this._miny=E,this._maxy=A):(this._miny=A,this._maxy=E)}},Pt.prototype.getMaxY=function(){return this._maxy},Pt.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)},Pt.prototype.hashCode=function(){var n=17;return n=37*n+L.hashCode(this._minx),n=37*n+L.hashCode(this._maxx),n=37*n+L.hashCode(this._miny),n=37*n+L.hashCode(this._maxy)},Pt.prototype.interfaces_=function(){return[F,t]},Pt.prototype.getClass=function(){return Pt},Pt.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 u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],A=Math.min(m.x,E.x),U=Math.max(m.x,E.x),$=Math.min(u.x,c.x),ut=Math.max(u.x,c.x);return!($>U)&&!(ut<A)&&(A=Math.min(m.y,E.y),U=Math.max(m.y,E.y),$=Math.min(u.y,c.y),ut=Math.max(u.y,c.y),!($>U)&&!(ut<A))}},Xt.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Pt,Xt);var tt={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*$/},nn=function(n){this.geometryFactory=n||new le};nn.prototype.read=function(n){var i,s,u;n=n.replace(/[\\n\\r]/g," ");var c=tt.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((c=tt.emptyTypeStr.exec(n))[2]=void 0),c&&(s=c[1].toLowerCase(),u=c[2],te[s]&&(i=te[s].apply(this,[u]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},nn.prototype.write=function(n){return this.extractGeometry(n)},nn.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!Gt[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+Gt[i].apply(this,[n])+")"};var Gt={coordinate:function(n){return n.x+" "+n.y},point:function(n){return Gt.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.point.apply(this,[n._geometries[s]])+")");return i.join(",")},linestring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Gt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},linearring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Gt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},multilinestring:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+Gt.linestring.apply(this,[n._shell])+")");for(var s=0,u=n._holes.length;s<u;++s)i.push("("+Gt.linestring.apply(this,[n._holes[s]])+")");return i.join(",")},multipolygon:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.polygon.apply(this,[n._geometries[s]])+")");return i.join(",")},geometrycollection:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push(this.extractGeometry(n._geometries[s]));return i.join(",")}},te={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(tt.spaces);return this.geometryFactory.createPoint(new L(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(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(u)},linestring:function(n){if(n===void 0)return this.geometryFactory.createLineString();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(tt.spaces),u.push(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(u)},linearring:function(n){if(n===void 0)return this.geometryFactory.createLinearRing();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(tt.spaces),u.push(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(u)},multilinestring:function(n){if(n===void 0)return this.geometryFactory.createMultiLineString();for(var i,s=n.trim().split(tt.parenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(u)},polygon:function(n){if(n===void 0)return this.geometryFactory.createPolygon();for(var i,s,u,c,m=n.trim().split(tt.parenComma),E=[],A=0,U=m.length;A<U;++A)i=m[A].replace(tt.trimParens,"$1"),s=te.linestring.apply(this,[i]),u=this.geometryFactory.createLinearRing(s._points),A===0?c=u:E.push(u);return this.geometryFactory.createPolygon(c,E)},multipolygon:function(n){if(n===void 0)return this.geometryFactory.createMultiPolygon();for(var i,s=n.trim().split(tt.doubleParenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(u)},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=[],u=0,c=i.length;u<c;++u)s.push(this.read(i[u]));return this.geometryFactory.createGeometryCollection(s)}},qt=function(n){this.parser=new nn(n)};qt.prototype.write=function(n){return this.parser.write(n)},qt.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var J=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),N=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}(J),b=function(){};b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b.shouldNeverReachHere=function(){if(arguments.length===0)b.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new N("Should never reach here"+(n!==null?": "+n:""))}},b.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],b.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new N:new N(i)},b.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],b.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new N("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var R=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 L,this._intPt[1]=new L,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},W={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};R.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},R.prototype.getTopologySummary=function(){var n=new pt;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},R.prototype.computeIntersection=function(n,i,s,u){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=s,this._inputLines[1][1]=u,this._result=this.computeIntersect(n,i,s,u)},R.prototype.getIntersectionNum=function(){return this._result},R.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)}},R.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},R.prototype.setPrecisionModel=function(n){this._precisionModel=n},R.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}},R.prototype.getIntersection=function(n){return this._intPt[n]},R.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},R.prototype.hasIntersection=function(){return this._result!==R.NO_INTERSECTION},R.prototype.getEdgeDistance=function(n,i){return R.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},R.prototype.isCollinear=function(){return this._result===R.COLLINEAR_INTERSECTION},R.prototype.toString=function(){return qt.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+qt.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},R.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},R.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},R.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},R.prototype.interfaces_=function(){return[]},R.prototype.getClass=function(){return R},R.computeEdgeDistance=function(n,i,s){var u=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y),m=-1;if(n.equals(i))m=0;else if(n.equals(s))m=u>c?u:c;else{var E=Math.abs(n.x-i.x),A=Math.abs(n.y-i.y);(m=u>c?E:A)!==0||n.equals(i)||(m=Math.max(E,A))}return b.isTrue(!(m===0&&!n.equals(i)),"Bad distance calculation"),m},R.nonRobustComputeEdgeDistance=function(n,i,s){var u=n.x-i.x,c=n.y-i.y,m=Math.sqrt(u*u+c*c);return b.isTrue(!(m===0&&!n.equals(i)),"Invalid distance calculation"),m},W.DONT_INTERSECT.get=function(){return 0},W.DO_INTERSECT.get=function(){return 1},W.COLLINEAR.get=function(){return 2},W.NO_INTERSECTION.get=function(){return 0},W.POINT_INTERSECTION.get=function(){return 1},W.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(R,W);var Z=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 u=new Pt(this._inputLines[0][0],this._inputLines[0][1]),c=new Pt(this._inputLines[1][0],this._inputLines[1][1]);return u.contains(s)&&c.contains(s)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return n.prototype.computeIntersection.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2];if(this._isProper=!1,Pt.intersects(u,c,s)&&B.orientationIndex(u,c,s)===0&&B.orientationIndex(c,u,s)===0)return this._isProper=!0,(s.equals(u)||s.equals(c))&&(this._isProper=!1),this._result=n.POINT_INTERSECTION,null;this._result=n.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(s,u,c,m,E){E.x=this.smallestInAbsValue(s.x,u.x,c.x,m.x),E.y=this.smallestInAbsValue(s.y,u.y,c.y,m.y),s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.safeHCoordinateIntersection=function(s,u,c,m){var E=null;try{E=ne.intersection(s,u,c,m)}catch(A){if(!(A instanceof Wt))throw A;E=i.nearestEndpoint(s,u,c,m)}return E},i.prototype.intersection=function(s,u,c,m){var E=this.intersectionWithNormalization(s,u,c,m);return this.isInSegmentEnvelopes(E)||(E=new L(i.nearestEndpoint(s,u,c,m))),this._precisionModel!==null&&this._precisionModel.makePrecise(E),E},i.prototype.smallestInAbsValue=function(s,u,c,m){var E=s,A=Math.abs(E);return Math.abs(u)<A&&(E=u,A=Math.abs(u)),Math.abs(c)<A&&(E=c,A=Math.abs(c)),Math.abs(m)<A&&(E=m),E},i.prototype.checkDD=function(s,u,c,m,E){var A=at.intersection(s,u,c,m),U=this.isInSegmentEnvelopes(A);Nt.out.println("DD in env = "+U+" --------------------- "+A),E.distance(A)>1e-4&&Nt.out.println("Distance = "+E.distance(A))},i.prototype.intersectionWithNormalization=function(s,u,c,m){var E=new L(s),A=new L(u),U=new L(c),$=new L(m),ut=new L;this.normalizeToEnvCentre(E,A,U,$,ut);var ft=this.safeHCoordinateIntersection(E,A,U,$);return ft.x+=ut.x,ft.y+=ut.y,ft},i.prototype.computeCollinearIntersection=function(s,u,c,m){var E=Pt.intersects(s,u,c),A=Pt.intersects(s,u,m),U=Pt.intersects(c,m,s),$=Pt.intersects(c,m,u);return E&&A?(this._intPt[0]=c,this._intPt[1]=m,n.COLLINEAR_INTERSECTION):U&&$?(this._intPt[0]=s,this._intPt[1]=u,n.COLLINEAR_INTERSECTION):E&&U?(this._intPt[0]=c,this._intPt[1]=s,!c.equals(s)||A||$?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):E&&$?(this._intPt[0]=c,this._intPt[1]=u,!c.equals(u)||A||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&U?(this._intPt[0]=m,this._intPt[1]=s,!m.equals(s)||E||$?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&$?(this._intPt[0]=m,this._intPt[1]=u,!m.equals(u)||E||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):n.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(s,u,c,m,E){var A=s.x<u.x?s.x:u.x,U=s.y<u.y?s.y:u.y,$=s.x>u.x?s.x:u.x,ut=s.y>u.y?s.y:u.y,ft=c.x<m.x?c.x:m.x,At=c.y<m.y?c.y:m.y,Rt=c.x>m.x?c.x:m.x,kt=c.y>m.y?c.y:m.y,ee=((A>ft?A:ft)+($<Rt?$:Rt))/2,on=((U>At?U:At)+(ut<kt?ut:kt))/2;E.x=ee,E.y=on,s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.computeIntersect=function(s,u,c,m){if(this._isProper=!1,!Pt.intersects(s,u,c,m))return n.NO_INTERSECTION;var E=B.orientationIndex(s,u,c),A=B.orientationIndex(s,u,m);if(E>0&&A>0||E<0&&A<0)return n.NO_INTERSECTION;var U=B.orientationIndex(c,m,s),$=B.orientationIndex(c,m,u);return U>0&&$>0||U<0&&$<0?n.NO_INTERSECTION:E===0&&A===0&&U===0&&$===0?this.computeCollinearIntersection(s,u,c,m):(E===0||A===0||U===0||$===0?(this._isProper=!1,s.equals2D(c)||s.equals2D(m)?this._intPt[0]=s:u.equals2D(c)||u.equals2D(m)?this._intPt[0]=u:E===0?this._intPt[0]=new L(c):A===0?this._intPt[0]=new L(m):U===0?this._intPt[0]=new L(s):$===0&&(this._intPt[0]=new L(u))):(this._isProper=!0,this._intPt[0]=this.intersection(s,u,c,m)),n.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(s,u,c,m){var E=s,A=B.distancePointLine(s,c,m),U=B.distancePointLine(u,c,m);return U<A&&(A=U,E=u),(U=B.distancePointLine(c,s,u))<A&&(A=U,E=c),(U=B.distancePointLine(m,s,u))<A&&(A=U,E=m),E},i}(R),I=function(){};I.prototype.interfaces_=function(){return[]},I.prototype.getClass=function(){return I},I.orientationIndex=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=s.x-i.x,E=s.y-i.y;return I.signOfDet2x2(u,c,m,E)},I.signOfDet2x2=function(n,i,s,u){var c=null,m=null,E=null;if(c=1,n===0||u===0)return i===0||s===0?0:i>0?s>0?-c:c:s>0?c:-c;if(i===0||s===0)return u>0?n>0?c:-c:n>0?-c:c;if(i>0?u>0?i<=u||(c=-c,m=n,n=s,s=m,m=i,i=u,u=m):i<=-u?(c=-c,s=-s,u=-u):(m=n,n=-s,s=m,m=i,i=-u,u=m):u>0?-i<=u?(c=-c,n=-n,i=-i):(m=-n,n=s,s=m,m=-i,i=u,u=m):i>=u?(n=-n,i=-i,s=-s,u=-u):(c=-c,m=-n,n=-s,s=m,m=-i,i=-u,u=m),n>0){if(!(s>0)||!(n<=s))return c}else{if(s>0||!(n>=s))return-c;c=-c,n=-n,s=-s}for(;;){if(E=Math.floor(s/n),s-=E*n,(u-=E*i)<0)return-c;if(u>i)return c;if(n>s+s){if(i<u+u)return c}else{if(i>u+u)return-c;s=n-s,u=i-u,c=-c}if(u===0)return s===0?0:-c;if(s===0||(E=Math.floor(n/s),n-=E*s,(i-=E*u)<0))return c;if(i>u)return-c;if(s>n+n){if(u<i+i)return-c}else{if(u>i+i)return c;n=s-n,i=u-i,c=-c}if(i===0)return n===0?0:c;if(n===0)return-c}};var P=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};P.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,u=i.x;return s>u&&(s=i.x,u=n.x),this._p.x>=s&&this._p.x<=u&&(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 c=n.x-this._p.x,m=n.y-this._p.y,E=i.x-this._p.x,A=i.y-this._p.y,U=I.signOfDet2x2(c,m,E,A);if(U===0)return this._isPointOnSegment=!0,null;A<m&&(U=-U),U>0&&this._crossingCount++}},P.prototype.isPointInPolygon=function(){return this.getLocation()!==k.EXTERIOR},P.prototype.getLocation=function(){return this._isPointOnSegment?k.BOUNDARY:this._crossingCount%2==1?k.INTERIOR:k.EXTERIOR},P.prototype.isOnSegment=function(){return this._isPointOnSegment},P.prototype.interfaces_=function(){return[]},P.prototype.getClass=function(){return P},P.locatePointInRing=function(){if(arguments[0]instanceof L&&X(arguments[1],dt)){for(var n=arguments[0],i=arguments[1],s=new P(n),u=new L,c=new L,m=1;m<i.size();m++)if(i.getCoordinate(m,u),i.getCoordinate(m-1,c),s.countSegment(u,c),s.isOnSegment())return s.getLocation();return s.getLocation()}if(arguments[0]instanceof L&&arguments[1]instanceof Array){for(var E=arguments[0],A=arguments[1],U=new P(E),$=1;$<A.length;$++){var ut=A[$],ft=A[$-1];if(U.countSegment(ut,ft),U.isOnSegment())return U.getLocation()}return U.getLocation()}};var B=function(){},lt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};B.prototype.interfaces_=function(){return[]},B.prototype.getClass=function(){return B},B.orientationIndex=function(n,i,s){return at.orientationIndex(n,i,s)},B.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,u=1;u<n.length-1;u++){var c=n[u].x-s,m=n[u+1].y;i+=c*(n[u-1].y-m)}return i/2}if(X(arguments[0],dt)){var E=arguments[0],A=E.size();if(A<3)return 0;var U=new L,$=new L,ut=new L;E.getCoordinate(0,$),E.getCoordinate(1,ut);var ft=$.x;ut.x-=ft;for(var At=0,Rt=1;Rt<A-1;Rt++)U.y=$.y,$.x=ut.x,$.y=ut.y,E.getCoordinate(Rt+1,ut),ut.x-=ft,At+=$.x*(U.y-ut.y);return At/2}},B.distanceLineLine=function(n,i,s,u){if(n.equals(i))return B.distancePointLine(n,s,u);if(s.equals(u))return B.distancePointLine(u,n,i);var c=!1;if(Pt.intersects(n,i,s,u)){var m=(i.x-n.x)*(u.y-s.y)-(i.y-n.y)*(u.x-s.x);if(m===0)c=!0;else{var E=(n.y-s.y)*(u.x-s.x)-(n.x-s.x)*(u.y-s.y),A=((n.y-s.y)*(i.x-n.x)-(n.x-s.x)*(i.y-n.y))/m,U=E/m;(U<0||U>1||A<0||A>1)&&(c=!0)}}else c=!0;return c?it.min(B.distancePointLine(n,s,u),B.distancePointLine(i,s,u),B.distancePointLine(s,n,i),B.distancePointLine(u,n,i)):0},B.isPointInRing=function(n,i){return B.locatePointInRing(n,i)!==k.EXTERIOR},B.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,u=new L;n.getCoordinate(0,u);for(var c=u.x,m=u.y,E=1;E<i;E++){n.getCoordinate(E,u);var A=u.x,U=u.y,$=A-c,ut=U-m;s+=Math.sqrt($*$+ut*ut),c=A,m=U}return s},B.isCCW=function(n){var i=n.length-1;if(i<3)throw new C("Ring has fewer than 4 points, so orientation cannot be determined");for(var s=n[0],u=0,c=1;c<=i;c++){var m=n[c];m.y>s.y&&(s=m,u=c)}var E=u;do(E-=1)<0&&(E=i);while(n[E].equals2D(s)&&E!==u);var A=u;do A=(A+1)%i;while(n[A].equals2D(s)&&A!==u);var U=n[E],$=n[A];if(U.equals2D(s)||$.equals2D(s)||U.equals2D($))return!1;var ut=B.computeOrientation(U,s,$),ft=!1;return ft=ut===0?U.x>$.x:ut>0,ft},B.locatePointInRing=function(n,i){return P.locatePointInRing(n,i)},B.distancePointLinePerpendicular=function(n,i,s){var u=(s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.y-i.y),c=((i.y-n.y)*(s.x-i.x)-(i.x-n.x)*(s.y-i.y))/u;return Math.abs(c)*Math.sqrt(u)},B.computeOrientation=function(n,i,s){return B.orientationIndex(n,i,s)},B.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new C("Line array must contain at least one vertex");for(var s=n.distance(i[0]),u=0;u<i.length-1;u++){var c=B.distancePointLine(n,i[u],i[u+1]);c<s&&(s=c)}return s}if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];if(E.x===A.x&&E.y===A.y)return m.distance(E);var U=(A.x-E.x)*(A.x-E.x)+(A.y-E.y)*(A.y-E.y),$=((m.x-E.x)*(A.x-E.x)+(m.y-E.y)*(A.y-E.y))/U;if($<=0)return m.distance(E);if($>=1)return m.distance(A);var ut=((E.y-m.y)*(A.x-E.x)-(E.x-m.x)*(A.y-E.y))/U;return Math.abs(ut)*Math.sqrt(U)}},B.isOnLine=function(n,i){for(var s=new Z,u=1;u<i.length;u++){var c=i[u-1],m=i[u];if(s.computeIntersection(n,c,m),s.hasIntersection())return!0}return!1},lt.CLOCKWISE.get=function(){return-1},lt.RIGHT.get=function(){return B.CLOCKWISE},lt.COUNTERCLOCKWISE.get=function(){return 1},lt.LEFT.get=function(){return B.COUNTERCLOCKWISE},lt.COLLINEAR.get=function(){return 0},lt.STRAIGHT.get=function(){return B.COLLINEAR},Object.defineProperties(B,lt);var ct=function(){};ct.prototype.filter=function(n){},ct.prototype.interfaces_=function(){return[]},ct.prototype.getClass=function(){return ct};var j=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},wt={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}};j.prototype.isGeometryCollection=function(){return this.getSortIndex()===j.SORTINDEX_GEOMETRYCOLLECTION},j.prototype.getFactory=function(){return this._factory},j.prototype.getGeometryN=function(n){return this},j.prototype.getArea=function(){return 0},j.prototype.isRectangle=function(){return!1},j.prototype.equals=function(){if(arguments[0]instanceof j){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof j))return!1;var s=i;return this.equalsExact(s)}},j.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},j.prototype.geometryChanged=function(){this.apply(j.geometryChangedFilter)},j.prototype.geometryChangedAction=function(){this._envelope=null},j.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},j.prototype.getLength=function(){return 0},j.prototype.getNumGeometries=function(){return 1},j.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],u=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,u)}},j.prototype.getUserData=function(){return this._userData},j.prototype.getSRID=function(){return this._SRID},j.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},j.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===j.SORTINDEX_GEOMETRYCOLLECTION)throw new C("This method does not support GeometryCollection arguments")},j.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},j.prototype.norm=function(){var n=this.copy();return n.normalize(),n},j.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},j.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Pt(this._envelope)},j.prototype.setSRID=function(n){this._SRID=n},j.prototype.setUserData=function(n){this._userData=n},j.prototype.compare=function(n,i){for(var s=n.iterator(),u=i.iterator();s.hasNext()&&u.hasNext();){var c=s.next(),m=u.next(),E=c.compareTo(m);if(E!==0)return E}return s.hasNext()?1:u.hasNext()?-1:0},j.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},j.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===j.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===j.SORTINDEX_MULTIPOINT||this.getSortIndex()===j.SORTINDEX_MULTILINESTRING||this.getSortIndex()===j.SORTINDEX_MULTIPOLYGON},j.prototype.interfaces_=function(){return[G,F,t]},j.prototype.getClass=function(){return j},j.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},j.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},wt.serialVersionUID.get=function(){return 8763622679187377e3},wt.SORTINDEX_POINT.get=function(){return 0},wt.SORTINDEX_MULTIPOINT.get=function(){return 1},wt.SORTINDEX_LINESTRING.get=function(){return 2},wt.SORTINDEX_LINEARRING.get=function(){return 3},wt.SORTINDEX_MULTILINESTRING.get=function(){return 4},wt.SORTINDEX_POLYGON.get=function(){return 5},wt.SORTINDEX_MULTIPOLYGON.get=function(){return 6},wt.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},wt.geometryChangedFilter.get=function(){return _t},Object.defineProperties(j,wt);var _t=function(){};_t.interfaces_=function(){return[ct]},_t.filter=function(n){n.geometryChangedAction()};var Mt=function(){};Mt.prototype.filter=function(n){},Mt.prototype.interfaces_=function(){return[]},Mt.prototype.getClass=function(){return Mt};var Lt=function(){},Jt={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}};Lt.prototype.isInBoundary=function(n){},Lt.prototype.interfaces_=function(){return[]},Lt.prototype.getClass=function(){return Lt},Jt.Mod2BoundaryNodeRule.get=function(){return Et},Jt.EndPointBoundaryNodeRule.get=function(){return oe},Jt.MultiValentEndPointBoundaryNodeRule.get=function(){return Qt},Jt.MonoValentEndPointBoundaryNodeRule.get=function(){return Ht},Jt.MOD2_BOUNDARY_RULE.get=function(){return new Et},Jt.ENDPOINT_BOUNDARY_RULE.get=function(){return new oe},Jt.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Qt},Jt.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Ht},Jt.OGC_SFS_BOUNDARY_RULE.get=function(){return Lt.MOD2_BOUNDARY_RULE},Object.defineProperties(Lt,Jt);var Et=function(){};Et.prototype.isInBoundary=function(n){return n%2==1},Et.prototype.interfaces_=function(){return[Lt]},Et.prototype.getClass=function(){return Et};var oe=function(){};oe.prototype.isInBoundary=function(n){return n>0},oe.prototype.interfaces_=function(){return[Lt]},oe.prototype.getClass=function(){return oe};var Qt=function(){};Qt.prototype.isInBoundary=function(n){return n>1},Qt.prototype.interfaces_=function(){return[Lt]},Qt.prototype.getClass=function(){return Qt};var Ht=function(){};Ht.prototype.isInBoundary=function(n){return n===1},Ht.prototype.interfaces_=function(){return[Lt]},Ht.prototype.getClass=function(){return Ht};var Ot=function(){};Ot.prototype.add=function(){},Ot.prototype.addAll=function(){},Ot.prototype.isEmpty=function(){},Ot.prototype.iterator=function(){},Ot.prototype.size=function(){},Ot.prototype.toArray=function(){},Ot.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var Y=function(){};Y.prototype.hasNext=function(){},Y.prototype.next=function(){},Y.prototype.remove=function(){};var St=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}(Ot);(o.prototype=new Error).name="NoSuchElementException";var Q=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Ot&&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,Ot]},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 u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.set=function(s,u){var c=this.array_[s];return this.array_[s]=u,c},i.prototype.iterator=function(){return new Ut(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=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.remove=function(s){for(var u=!1,c=0,m=this.array_.length;c<m;c++)if(this.array_[c]===s){this.array_.splice(c,1),u=!0;break}return u},i}(St),Ut=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}(Y),Dt=function(n){function i(){if(n.call(this),arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.ensureCapacity(u.length),this.add(u,!0)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.ensureCapacity(c.length),this.add(c,m)}}}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(u){return this.get(u)},i.prototype.addAll=function(){if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m=!1,E=u.iterator();E.hasNext();)this.add(E.next(),c),m=!0;return m}return n.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var u=n.prototype.clone.call(this),c=0;c<this.size();c++)u.add(c,this.get(c).copy());return u},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var u=arguments[0];n.prototype.add.call(this,u)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var c=arguments[0],m=arguments[1];return this.add(c,m,!0),!0}if(arguments[0]instanceof L&&typeof arguments[1]=="boolean"){var E=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(E))return null;n.prototype.add.call(this,E)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var A=arguments[0],U=arguments[1];return this.add(A,U),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var $=arguments[0],ut=arguments[1];if(arguments[2])for(var ft=0;ft<$.length;ft++)this.add($[ft],ut);else for(var At=$.length-1;At>=0;At--)this.add($[At],ut);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof L){var Rt=arguments[0],kt=arguments[1];if(!arguments[2]){var ee=this.size();if(ee>0&&(Rt>0&&this.get(Rt-1).equals2D(kt)||Rt<ee&&this.get(Rt).equals2D(kt)))return null}n.prototype.add.call(this,Rt,kt)}}else if(arguments.length===4){var on=arguments[0],Rn=arguments[1],dr=arguments[2],Ji=arguments[3],Bo=1;dr>Ji&&(Bo=-1);for(var Oh=dr;Oh!==Ji;Oh+=Bo)this.add(on[Oh],Rn);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new L(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(Q),ht=function(){},Kt={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Kt.ForwardComparator.get=function(){return re},Kt.BidirectionalComparator.get=function(){return gn},Kt.coordArrayType.get=function(){return new Array(0).fill(null)},ht.prototype.interfaces_=function(){return[]},ht.prototype.getClass=function(){return ht},ht.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},ht.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var u=n[s];if(ht.indexOf(u,i)<0)return u}return null},ht.scroll=function(n,i){var s=ht.indexOf(i,n);if(s<0)return null;var u=new Array(n.length).fill(null);Nt.arraycopy(n,s,u,0,n.length-s),Nt.arraycopy(n,0,u,n.length-s,s),Nt.arraycopy(u,0,n,0,n.length)},ht.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 u=arguments[0],c=arguments[1],m=arguments[2];if(u===c)return!0;if(u===null||c===null||u.length!==c.length)return!1;for(var E=0;E<u.length;E++)if(m.compare(u[E],c[E])!==0)return!1;return!0}},ht.intersection=function(n,i){for(var s=new Dt,u=0;u<n.length;u++)i.intersects(n[u])&&s.add(n[u],!0);return s.toCoordinateArray()},ht.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},ht.removeRepeatedPoints=function(n){return ht.hasRepeatedPoints(n)?new Dt(n,!1).toCoordinateArray():n},ht.reverse=function(n){for(var i=n.length-1,s=Math.trunc(i/2),u=0;u<=s;u++){var c=n[u];n[u]=n[i-u],n[i-u]=c}},ht.removeNull=function(n){for(var i=0,s=0;s<n.length;s++)n[s]!==null&&i++;var u=new Array(i).fill(null);if(i===0)return u;for(var c=0,m=0;m<n.length;m++)n[m]!==null&&(u[c++]=n[m]);return u},ht.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 L(n[s]);return i}if(arguments.length===5)for(var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],A=arguments[4],U=0;U<A;U++)m[E+U]=new L(u[c+U])},ht.isEqualReversed=function(n,i){for(var s=0;s<n.length;s++){var u=n[s],c=i[n.length-s-1];if(u.compareTo(c)!==0)return!1}return!0},ht.envelope=function(n){for(var i=new Pt,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},ht.toCoordinateArray=function(n){return n.toArray(ht.coordArrayType)},ht.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},ht.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},ht.increasingDirection=function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var s=n.length-1-i,u=n[i].compareTo(n[s]);if(u!==0)return u}return 1},ht.compare=function(n,i){for(var s=0;s<n.length&&s<i.length;){var u=n[s].compareTo(i[s]);if(u!==0)return u;s++}return s<i.length?-1:s<n.length?1:0},ht.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},ht.extract=function(n,i,s){i=it.clamp(i,0,n.length);var u=(s=it.clamp(s,-1,n.length))-i+1;s<0&&(u=0),i>=n.length&&(u=0),s<i&&(u=0);var c=new Array(u).fill(null);if(u===0)return c;for(var m=0,E=i;E<=s;E++)c[m++]=n[E];return c},Object.defineProperties(ht,Kt);var re=function(){};re.prototype.compare=function(n,i){return ht.compare(n,i)},re.prototype.interfaces_=function(){return[z]},re.prototype.getClass=function(){return re};var gn=function(){};gn.prototype.compare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;var c=ht.compare(s,u);return ht.isEqualReversed(s,u)?0:c},gn.prototype.OLDcompare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;for(var c=ht.increasingDirection(s),m=ht.increasingDirection(u),E=c>0?0:s.length-1,A=m>0?0:s.length-1,U=0;U<s.length;U++){var $=s[E].compareTo(u[A]);if($!==0)return $;E+=c,A+=m}return 0},gn.prototype.interfaces_=function(){return[z]},gn.prototype.getClass=function(){return gn};var He=function(){};He.prototype.get=function(){},He.prototype.put=function(){},He.prototype.size=function(){},He.prototype.values=function(){},He.prototype.entrySet=function(){};var Si=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}(He);(a.prototype=new Error).name="OperationNotSupported",(l.prototype=new Ot).contains=function(){};var Kn=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Ot&&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 u=0,c=this.array_.length;u<c;u++)if(this.array_[u]===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 u=s.iterator();u.hasNext();)this.add(u.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=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.iterator=function(){return new Ml(this)},i}(l),Ml=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}(Y),di=0;(_.prototype=new Si).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},_.prototype.put=function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:di,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,u,c=this.root_;do if(s=c,(u=n.compareTo(c.key))<0)c=c.left;else{if(!(u>0)){var m=c.value;return c.value=i,m}c=c.right}while(c!==null);var E={key:n,left:null,right:null,value:i,parent:s,color:di,getValue:function(){return this.value},getKey:function(){return this.key}};return u<0?s.left=E:s.right=E,this.fixAfterInsertion(E),this.size_++,null},_.prototype.fixAfterInsertion=function(n){for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)if(f(n)===d(f(f(n)))){var i=g(f(f(n)));h(i)===1?(p(f(n),di),p(i,di),p(f(f(n)),1),n=f(f(n))):(n===g(f(n))&&(n=f(n),this.rotateLeft(n)),p(f(n),di),p(f(f(n)),1),this.rotateRight(f(f(n))))}else{var s=d(f(f(n)));h(s)===1?(p(f(n),di),p(s,di),p(f(f(n)),1),n=f(f(n))):(n===d(f(n))&&(n=f(n),this.rotateRight(n)),p(f(n),di),p(f(f(n)),1),this.rotateLeft(f(f(n))))}this.root_.color=di},_.prototype.values=function(){var n=new Q,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=_.successor(i))!==null;)n.add(i.value);return n},_.prototype.entrySet=function(){var n=new Kn,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=_.successor(i))!==null;)n.add(i);return n},_.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}},_.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}},_.prototype.getFirstEntry=function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n},_.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,u=n;s!==null&&u===s.right;)u=s,s=s.parent;return s},_.prototype.size=function(){return this.size_};var Is=function(){};Is.prototype.interfaces_=function(){return[]},Is.prototype.getClass=function(){return Is},y.prototype=new l,(M.prototype=new y).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},M.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},M.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next());return!0},M.prototype.remove=function(n){throw new a},M.prototype.size=function(){return this.array_.length},M.prototype.isEmpty=function(){return this.array_.length===0},M.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n},M.prototype.iterator=function(){return new bo(this)};var bo=function(n){this.treeSet_=n,this.position_=0};bo.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},bo.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},bo.prototype.remove=function(){throw new a};var ki=function(){};ki.sort=function(){var n,i,s,u,c=arguments[0];if(arguments.length===1)u=function(E,A){return E.compareTo(A)},c.sort(u);else if(arguments.length===2)s=arguments[1],u=function(E,A){return s.compare(E,A)},c.sort(u);else if(arguments.length===3){(i=c.slice(arguments[1],arguments[2])).sort();var m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length));for(c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])}else if(arguments.length===4)for(i=c.slice(arguments[1],arguments[2]),s=arguments[3],u=function(E,A){return s.compare(E,A)},i.sort(u),m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length)),c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])},ki.asList=function(n){for(var i=new Q,s=0,u=n.length;s<u;s++)i.add(n[s]);return i};var pe=function(){},Lr={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}};Lr.P.get=function(){return 0},Lr.L.get=function(){return 1},Lr.A.get=function(){return 2},Lr.FALSE.get=function(){return-1},Lr.TRUE.get=function(){return-2},Lr.DONTCARE.get=function(){return-3},Lr.SYM_FALSE.get=function(){return"F"},Lr.SYM_TRUE.get=function(){return"T"},Lr.SYM_DONTCARE.get=function(){return"*"},Lr.SYM_P.get=function(){return"0"},Lr.SYM_L.get=function(){return"1"},Lr.SYM_A.get=function(){return"2"},pe.prototype.interfaces_=function(){return[]},pe.prototype.getClass=function(){return pe},pe.toDimensionSymbol=function(n){switch(n){case pe.FALSE:return pe.SYM_FALSE;case pe.TRUE:return pe.SYM_TRUE;case pe.DONTCARE:return pe.SYM_DONTCARE;case pe.P:return pe.SYM_P;case pe.L:return pe.SYM_L;case pe.A:return pe.SYM_A}throw new C("Unknown dimension value: "+n)},pe.toDimensionValue=function(n){switch(ot.toUpperCase(n)){case pe.SYM_FALSE:return pe.FALSE;case pe.SYM_TRUE:return pe.TRUE;case pe.SYM_DONTCARE:return pe.DONTCARE;case pe.SYM_P:return pe.P;case pe.SYM_L:return pe.L;case pe.SYM_A:return pe.A}throw new C("Unknown dimension symbol: "+n)},Object.defineProperties(pe,Lr);var ni=function(){};ni.prototype.filter=function(n){},ni.prototype.interfaces_=function(){return[]},ni.prototype.getClass=function(){return ni};var Hr=function(){};Hr.prototype.filter=function(n,i){},Hr.prototype.isDone=function(){},Hr.prototype.isGeometryChanged=function(){},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr};var Hn=function(n){function i(u,c){if(n.call(this,c),this._geometries=u||[],n.hasNullElements(this._geometries))throw new C("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 u=new Pt,c=0;c<this._geometries.length;c++)u.expandToInclude(this._geometries[c].getEnvelopeInternal());return u},i.prototype.getGeometryN=function(u){return this._geometries[u]},i.prototype.getSortIndex=function(){return n.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=0;m<this._geometries.length;m++)for(var E=this._geometries[m].getCoordinates(),A=0;A<E.length;A++)u[++c]=E[A];return u},i.prototype.getArea=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getArea();return u},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._geometries.length!==m._geometries.length)return!1;for(var E=0;E<this._geometries.length;E++)if(!this._geometries[E].equalsExact(m._geometries[E],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<this._geometries.length;u++)this._geometries[u].normalize();ki.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var u=pe.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getBoundaryDimension());return u},i.prototype.getDimension=function(){for(var u=pe.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getDimension());return u},i.prototype.getLength=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getNumPoints();return u},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createGeometryCollection(c)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=new M(ki.asList(this._geometries)),m=new M(ki.asList(u._geometries));return this.compare(c,m)}if(arguments.length===2){for(var E=arguments[0],A=arguments[1],U=E,$=this.getNumGeometries(),ut=U.getNumGeometries(),ft=0;ft<$&&ft<ut;){var At=this.getGeometryN(ft),Rt=U.getGeometryN(ft),kt=At.compareToSameClass(Rt,A);if(kt!==0)return kt;ft++}return ft<$?1:ft<ut?-1:0}},i.prototype.apply=function(){if(X(arguments[0],Mt))for(var u=arguments[0],c=0;c<this._geometries.length;c++)this._geometries[c].apply(u);else if(X(arguments[0],Hr)){var m=arguments[0];if(this._geometries.length===0)return null;for(var E=0;E<this._geometries.length&&(this._geometries[E].apply(m),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else if(X(arguments[0],ni)){var A=arguments[0];A.filter(this);for(var U=0;U<this._geometries.length;U++)this._geometries[U].apply(A)}else if(X(arguments[0],ct)){var $=arguments[0];$.filter(this);for(var ut=0;ut<this._geometries.length;ut++)this._geometries[ut].apply($)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),b.shouldNeverReachHere(),null},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._geometries=new Array(this._geometries.length).fill(null);for(var c=0;c<this._geometries.length;c++)u._geometries[c]=this._geometries[c].clone();return u},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.isEmpty=function(){for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].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}(j),H=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 j.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[u-1-m]=this._geometries[m].reverse();return this.getFactory().createMultiLineString(c)},i.prototype.getBoundary=function(){return new rt(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[Is]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(Hn),rt=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=Lt.MOD2_BOUNDARY_RULE;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._geom=s,this._geomFact=s.getFactory(),this._bnRule=u}};rt.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)},rt.prototype.getBoundary=function(){return this._geom instanceof Bt?this.boundaryLineString(this._geom):this._geom instanceof H?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},rt.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()])},rt.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},rt.prototype.computeBoundaryCoordinates=function(n){var i=new Q;this._endpointMap=new _;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);u.getNumPoints()!==0&&(this.addEndpoint(u.getCoordinateN(0)),this.addEndpoint(u.getCoordinateN(u.getNumPoints()-1)))}for(var c=this._endpointMap.entrySet().iterator();c.hasNext();){var m=c.next(),E=m.getValue().count;this._bnRule.isInBoundary(E)&&i.add(m.getKey())}return ht.toCoordinateArray(i)},rt.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new gt,this._endpointMap.put(n,i)),i.count++},rt.prototype.interfaces_=function(){return[]},rt.prototype.getClass=function(){return rt},rt.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new rt(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new rt(i,s).getBoundary()}};var gt=function(){this.count=null};gt.prototype.interfaces_=function(){return[]},gt.prototype.getClass=function(){return gt};var st=function(){},yt={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.chars=function(n,i){for(var s=new Array(i).fill(null),u=0;u<i;u++)s[u]=n;return String(s)},st.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 u=arguments[0],c=arguments[1],m="",E=new function(){}(new function(){}(st.getStackTrace(u))),A=0;A<c;A++)try{m+=E.readLine()+st.NEWLINE}catch(U){if(!(U instanceof S))throw U;b.shouldNeverReachHere()}return m}},st.split=function(n,i){for(var s=i.length,u=new Q,c=""+n,m=c.indexOf(i);m>=0;){var E=c.substring(0,m);u.add(E),m=(c=c.substring(m+s)).indexOf(i)}c.length>0&&u.add(c);for(var A=new Array(u.size()).fill(null),U=0;U<A.length;U++)A[U]=u.get(U);return A},st.toString=function(){if(arguments.length===1){var n=arguments[0];return st.SIMPLE_ORDINATE_FORMAT.format(n)}},st.spaces=function(n){return st.chars(" ",n)},yt.NEWLINE.get=function(){return Nt.getProperty("line.separator")},yt.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(st,yt);var It=function(){};It.prototype.interfaces_=function(){return[]},It.prototype.getClass=function(){return It},It.copyCoord=function(n,i,s,u){for(var c=Math.min(n.getDimension(),s.getDimension()),m=0;m<c;m++)s.setOrdinate(u,m,n.getOrdinate(i,m))},It.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,dt.X)===n.getOrdinate(i-1,dt.X)&&n.getOrdinate(0,dt.Y)===n.getOrdinate(i-1,dt.Y)},It.isEqual=function(n,i){var s=n.size();if(s!==i.size())return!1;for(var u=Math.min(n.getDimension(),i.getDimension()),c=0;c<s;c++)for(var m=0;m<u;m++){var E=n.getOrdinate(c,m),A=i.getOrdinate(c,m);if(n.getOrdinate(c,m)!==i.getOrdinate(c,m)&&(!w.isNaN(E)||!w.isNaN(A)))return!1}return!0},It.extend=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();if(It.copy(i,0,u,0,c),c>0)for(var m=c;m<s;m++)It.copy(i,c-1,u,m,1);return u},It.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),u=0;u<=s;u++)It.swap(n,u,i-u)},It.swap=function(n,i,s){if(i===s)return null;for(var u=0;u<n.getDimension();u++){var c=n.getOrdinate(i,u);n.setOrdinate(i,u,n.getOrdinate(s,u)),n.setOrdinate(s,u,c)}},It.copy=function(n,i,s,u,c){for(var m=0;m<c;m++)It.copyCoord(n,i+m,s,u+m)},It.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),u=new pt;u.append("(");for(var c=0;c<i;c++){c>0&&u.append(" ");for(var m=0;m<s;m++)m>0&&u.append(","),u.append(st.toString(n.getOrdinate(c,m)))}return u.append(")"),u.toString()}},It.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?It.createClosedRing(n,i,4):i.getOrdinate(0,dt.X)===i.getOrdinate(s-1,dt.X)&&i.getOrdinate(0,dt.Y)===i.getOrdinate(s-1,dt.Y)?i:It.createClosedRing(n,i,s+1)},It.createClosedRing=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();It.copy(i,0,u,0,c);for(var m=c;m<s;m++)It.copy(i,0,u,m,1);return u};var Bt=function(n){function i(u,c){n.call(this,c),this._points=null,this.init(u)}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 Pt:this._points.expandEnvelope(new Pt)},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 u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._points.size()!==m._points.size())return!1;for(var E=0;E<this._points.size();E++)if(!this.equal(this._points.getCoordinate(E),m._points.getCoordinate(E),c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<Math.trunc(this._points.size()/2);u++){var c=this._points.size()-1-u;if(!this._points.getCoordinate(u).equals(this._points.getCoordinate(c)))return this._points.getCoordinate(u).compareTo(this._points.getCoordinate(c))>0&&It.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.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 B.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var u=this._points.copy();return It.reverse(u),this.getFactory().createLineString(u)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var u=arguments[0],c=0,m=0;c<this._points.size()&&m<u._points.size();){var E=this._points.getCoordinate(c).compareTo(u._points.getCoordinate(m));if(E!==0)return E;c++,m++}return c<this._points.size()?1:m<u._points.size()?-1:0}if(arguments.length===2){var A=arguments[0];return arguments[1].compare(this._points,A._points)}},i.prototype.apply=function(){if(X(arguments[0],Mt))for(var u=arguments[0],c=0;c<this._points.size();c++)u.filter(this._points.getCoordinate(c));else if(X(arguments[0],Hr)){var m=arguments[0];if(this._points.size()===0)return null;for(var E=0;E<this._points.size()&&(m.filter(this._points,E),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],ni)?arguments[0].filter(this):X(arguments[0],ct)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new rt(this).getBoundary()},i.prototype.isEquivalentClass=function(u){return u instanceof i},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._points=this._points.clone(),u},i.prototype.getCoordinateN=function(u){return this._points.getCoordinate(u)},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(u){if(u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),u.size()===1)throw new C("Invalid number of points in LineString (found "+u.size()+" - must be 0 or >= 2)");this._points=u},i.prototype.isCoordinate=function(u){for(var c=0;c<this._points.size();c++)if(this._points.getCoordinate(c).equals(u))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(u){return this.getFactory().createPoint(this._points.getCoordinate(u))},i.prototype.interfaces_=function(){return[Is]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(j),se=function(){};se.prototype.interfaces_=function(){return[]},se.prototype.getClass=function(){return se};var jt=function(n){function i(u,c){n.call(this,c),this._coordinates=u||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 Pt;var u=new Pt;return u.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),u},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 u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&(!(!this.isEmpty()||!u.isEmpty())||this.isEmpty()===u.isEmpty()&&this.equal(u.getCoordinate(),this.getCoordinate(),c))}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 pe.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 u=arguments[0];return this.getCoordinate().compareTo(u.getCoordinate())}if(arguments.length===2){var c=arguments[0];return arguments[1].compare(this._coordinates,c._coordinates)}},i.prototype.apply=function(){if(X(arguments[0],Mt)){var u=arguments[0];if(this.isEmpty())return null;u.filter(this.getCoordinate())}else if(X(arguments[0],Hr)){var c=arguments[0];if(this.isEmpty())return null;c.filter(this._coordinates,0),c.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],ni)?arguments[0].filter(this):X(arguments[0],ct)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._coordinates=this._coordinates.clone(),u},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(u){u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),b.isTrue(u.size()<=1),this._coordinates=u},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[se]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(j),ce=function(){};ce.prototype.interfaces_=function(){return[]},ce.prototype.getClass=function(){return ce};var Vt=function(n){function i(u,c,m){if(n.call(this,m),this._shell=null,this._holes=null,u===null&&(u=this.getFactory().createLinearRing()),c===null&&(c=[]),n.hasNullElements(c))throw new C("holes must not contain null elements");if(u.isEmpty()&&n.hasNonEmptyElements(c))throw new C("shell is empty but holes are not");this._shell=u,this._holes=c}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 u=new Array(this.getNumPoints()).fill(null),c=-1,m=this._shell.getCoordinates(),E=0;E<m.length;E++)u[++c]=m[E];for(var A=0;A<this._holes.length;A++)for(var U=this._holes[A].getCoordinates(),$=0;$<U.length;$++)u[++c]=U[$];return u},i.prototype.getArea=function(){var u=0;u+=Math.abs(B.signedArea(this._shell.getCoordinateSequence()));for(var c=0;c<this._holes.length;c++)u-=Math.abs(B.signedArea(this._holes[c].getCoordinateSequence()));return u},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var u=this._shell.getCoordinateSequence(),c=this.getEnvelopeInternal(),m=0;m<5;m++){var E=u.getX(m);if(E!==c.getMinX()&&E!==c.getMaxX())return!1;var A=u.getY(m);if(A!==c.getMinY()&&A!==c.getMaxY())return!1}for(var U=u.getX(0),$=u.getY(0),ut=1;ut<=4;ut++){var ft=u.getX(ut),At=u.getY(ut);if(ft!==U==(At!==$))return!1;U=ft,$=At}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u,E=this._shell,A=m._shell;if(!E.equalsExact(A,c)||this._holes.length!==m._holes.length)return!1;for(var U=0;U<this._holes.length;U++)if(!this._holes[U].equalsExact(m._holes[U],c))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 u=0;u<this._holes.length;u++)this.normalize(this._holes[u],!1);ki.sort(this._holes)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];if(c.isEmpty())return null;var E=new Array(c.getCoordinates().length-1).fill(null);Nt.arraycopy(c.getCoordinates(),0,E,0,E.length);var A=ht.minCoordinate(c.getCoordinates());ht.scroll(E,A),Nt.arraycopy(E,0,c.getCoordinates(),0,E.length),c.getCoordinates()[E.length]=E[0],B.isCCW(c.getCoordinates())===m&&ht.reverse(c.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 u=0;u+=this._shell.getLength();for(var c=0;c<this._holes.length;c++)u+=this._holes[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=this._shell.getNumPoints(),c=0;c<this._holes.length;c++)u+=this._holes[c].getNumPoints();return u},i.prototype.reverse=function(){var u=this.copy();u._shell=this._shell.copy().reverse(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].copy().reverse();return u},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=this._shell,m=u._shell;return c.compareToSameClass(m)}if(arguments.length===2){var E=arguments[0],A=arguments[1],U=E,$=this._shell,ut=U._shell,ft=$.compareToSameClass(ut,A);if(ft!==0)return ft;for(var At=this.getNumInteriorRing(),Rt=U.getNumInteriorRing(),kt=0;kt<At&&kt<Rt;){var ee=this.getInteriorRingN(kt),on=U.getInteriorRingN(kt),Rn=ee.compareToSameClass(on,A);if(Rn!==0)return Rn;kt++}return kt<At?1:kt<Rt?-1:0}},i.prototype.apply=function(u){if(X(u,Mt)){this._shell.apply(u);for(var c=0;c<this._holes.length;c++)this._holes[c].apply(u)}else if(X(u,Hr)){if(this._shell.apply(u),!u.isDone())for(var m=0;m<this._holes.length&&(this._holes[m].apply(u),!u.isDone());m++);u.isGeometryChanged()&&this.geometryChanged()}else if(X(u,ni))u.filter(this);else if(X(u,ct)){u.filter(this),this._shell.apply(u);for(var E=0;E<this._holes.length;E++)this._holes[E].apply(u)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var u=new Array(this._holes.length+1).fill(null);u[0]=this._shell;for(var c=0;c<this._holes.length;c++)u[c+1]=this._holes[c];return u.length<=1?this.getFactory().createLinearRing(u[0].getCoordinateSequence()):this.getFactory().createMultiLineString(u)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._shell=this._shell.clone(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].clone();return u},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var u=this._shell.copy(),c=new Array(this._holes.length).fill(null),m=0;m<c.length;m++)c[m]=this._holes[m].copy();return new i(u,c,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(u){return this._holes[u]},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,s),i}(j),he=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 j.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var u=arguments[0];return this._geometries[u].getCoordinate()}return n.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return pe.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 u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[se]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(Hn),sn=function(n){function i(u,c){u instanceof L&&c instanceof le&&(u=c.getCoordinateSequenceFactory().create(u)),n.call(this,u,c),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 j.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return pe.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var u=this._points.copy();return It.reverse(u),this.getFactory().createLinearRing(u)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new C("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new C("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}(Bt),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 j.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}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 u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createMultiPolygon(c)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var u=new Q,c=0;c<this._geometries.length;c++)for(var m=this._geometries[c].getBoundary(),E=0;E<m.getNumGeometries();E++)u.add(m.getGeometryN(E));var A=new Array(u.size()).fill(null);return this.getFactory().createMultiLineString(u.toArray(A))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,s),i}(Hn),_n=function(n){this._factory=n||null,this._isUserDataCopied=!1},ri={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};_n.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},_n.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},_n.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof Hn?this.editGeometryCollection(n,i):n instanceof Vt?this.editPolygon(n,i):n instanceof jt?i.edit(n,this._factory):n instanceof Bt?i.edit(n,this._factory):(b.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},_n.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),u=new Q,c=0;c<s.getNumGeometries();c++){var m=this.edit(s.getGeometryN(c),i);m===null||m.isEmpty()||u.add(m)}return s.getClass()===he?this._factory.createMultiPoint(u.toArray([])):s.getClass()===H?this._factory.createMultiLineString(u.toArray([])):s.getClass()===un?this._factory.createMultiPolygon(u.toArray([])):this._factory.createGeometryCollection(u.toArray([]))},_n.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 u=this.edit(s.getExteriorRing(),i);if(u===null||u.isEmpty())return this._factory.createPolygon();for(var c=new Q,m=0;m<s.getNumInteriorRing();m++){var E=this.edit(s.getInteriorRingN(m),i);E===null||E.isEmpty()||c.add(E)}return this._factory.createPolygon(u,c.toArray([]))},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n},_n.GeometryEditorOperation=function(){},ri.NoOpGeometryOperation.get=function(){return Mn},ri.CoordinateOperation.get=function(){return de},ri.CoordinateSequenceOperation.get=function(){return To},Object.defineProperties(_n,ri);var Mn=function(){};Mn.prototype.edit=function(n,i){return n},Mn.prototype.interfaces_=function(){return[_n.GeometryEditorOperation]},Mn.prototype.getClass=function(){return Mn};var de=function(){};de.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof sn?i.createLinearRing(s):n instanceof Bt?i.createLineString(s):n instanceof jt?s.length>0?i.createPoint(s[0]):i.createPoint():n},de.prototype.interfaces_=function(){return[_n.GeometryEditorOperation]},de.prototype.getClass=function(){return de};var To=function(){};To.prototype.edit=function(n,i){return n instanceof sn?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof Bt?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof jt?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},To.prototype.interfaces_=function(){return[_n.GeometryEditorOperation]},To.prototype.getClass=function(){return To};var fe=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 L}else if(X(arguments[0],dt)){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 u=0;u<this._coordinates.length;u++)this._coordinates[u]=s.getCoordinateCopy(u)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var c=arguments[0],m=arguments[1];this._coordinates=c,this._dimension=m,c===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var E=arguments[0],A=arguments[1];this._coordinates=new Array(E).fill(null),this._dimension=A;for(var U=0;U<E;U++)this._coordinates[U]=new L}}},ao={serialVersionUID:{configurable:!0}};fe.prototype.setOrdinate=function(n,i,s){switch(i){case dt.X:this._coordinates[n].x=s;break;case dt.Y:this._coordinates[n].y=s;break;case dt.Z:this._coordinates[n].z=s;break;default:throw new C("invalid ordinateIndex")}},fe.prototype.size=function(){return this._coordinates.length},fe.prototype.getOrdinate=function(n,i){switch(i){case dt.X:return this._coordinates[n].x;case dt.Y:return this._coordinates[n].y;case dt.Z:return this._coordinates[n].z}return w.NaN},fe.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}},fe.prototype.getCoordinateCopy=function(n){return new L(this._coordinates[n])},fe.prototype.getDimension=function(){return this._dimension},fe.prototype.getX=function(n){return this._coordinates[n].x},fe.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 fe(n,this._dimension)},fe.prototype.expandEnvelope=function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n},fe.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 fe(n,this._dimension)},fe.prototype.toString=function(){if(this._coordinates.length>0){var n=new pt(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"()"},fe.prototype.getY=function(n){return this._coordinates[n].y},fe.prototype.toCoordinateArray=function(){return this._coordinates},fe.prototype.interfaces_=function(){return[dt,t]},fe.prototype.getClass=function(){return fe},ao.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(fe,ao);var ii=function(){},Ao={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};ii.prototype.readResolve=function(){return ii.instance()},ii.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new fe(n)}if(X(arguments[0],dt)){var i=arguments[0];return new fe(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return u>3&&(u=3),u<2?new fe(s):new fe(s,u)}},ii.prototype.interfaces_=function(){return[nt,t]},ii.prototype.getClass=function(){return ii},ii.instance=function(){return ii.instanceObject},Ao.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Ao.instanceObject.get=function(){return new ii},Object.defineProperties(ii,Ao);var ca=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,u){return this.map_.set(s,u),u},i.prototype.values=function(){for(var s=new Q,u=this.map_.values(),c=u.next();!c.done;)s.add(c.value),c=u.next();return s},i.prototype.entrySet=function(){var s=new Kn;return this.map_.entries().forEach(function(u){return s.add(u)}),s},i.prototype.size=function(){return this.map_.size()},i}(He),ie=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 Nr){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 u=arguments[0];this._modelType=u._modelType,this._scale=u._scale}}},Gi={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ie.prototype.equals=function(n){if(!(n instanceof ie))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale},ie.prototype.compareTo=function(n){var i=n,s=this.getMaximumSignificantDigits(),u=i.getMaximumSignificantDigits();return new et(s).compareTo(new et(u))},ie.prototype.getScale=function(){return this._scale},ie.prototype.isFloating=function(){return this._modelType===ie.FLOATING||this._modelType===ie.FLOATING_SINGLE},ie.prototype.getType=function(){return this._modelType},ie.prototype.toString=function(){var n="UNKNOWN";return this._modelType===ie.FLOATING?n="Floating":this._modelType===ie.FLOATING_SINGLE?n="Floating-Single":this._modelType===ie.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n},ie.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var n=arguments[0];return w.isNaN(n)||this._modelType===ie.FLOATING_SINGLE?n:this._modelType===ie.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof L){var i=arguments[0];if(this._modelType===ie.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},ie.prototype.getMaximumSignificantDigits=function(){var n=16;return this._modelType===ie.FLOATING?n=16:this._modelType===ie.FLOATING_SINGLE?n=6:this._modelType===ie.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n},ie.prototype.setScale=function(n){this._scale=Math.abs(n)},ie.prototype.interfaces_=function(){return[t,F]},ie.prototype.getClass=function(){return ie},ie.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Gi.serialVersionUID.get=function(){return 7777263578777804e3},Gi.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ie,Gi);var Nr=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},Er={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Nr.prototype.readResolve=function(){return Nr.nameToTypeMap.get(this._name)},Nr.prototype.toString=function(){return this._name},Nr.prototype.interfaces_=function(){return[t]},Nr.prototype.getClass=function(){return Nr},Er.serialVersionUID.get=function(){return-552860263173159e4},Er.nameToTypeMap.get=function(){return new ca},Object.defineProperties(Nr,Er),ie.Type=Nr,ie.FIXED=new Nr("FIXED"),ie.FLOATING=new Nr("FLOATING"),ie.FLOATING_SINGLE=new Nr("FLOATING SINGLE");var le=function n(){this._precisionModel=new ie,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?X(arguments[0],nt)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ie&&(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]))},wl={serialVersionUID:{configurable:!0}};le.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new L(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new L(n.getMinX(),n.getMinY()),new L(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new L(n.getMinX(),n.getMinY()),new L(n.getMinX(),n.getMaxY()),new L(n.getMaxX(),n.getMaxY()),new L(n.getMaxX(),n.getMinY()),new L(n.getMinX(),n.getMinY())]),null)},le.prototype.createLineString=function(n){return n?n instanceof Array?new Bt(this.getCoordinateSequenceFactory().create(n),this):X(n,dt)?new Bt(n,this):void 0:new Bt(this.getCoordinateSequenceFactory().create([]),this)},le.prototype.createMultiLineString=function(){if(arguments.length===0)return new H(null,this);if(arguments.length===1){var n=arguments[0];return new H(n,this)}},le.prototype.buildGeometry=function(n){for(var i=null,s=!1,u=!1,c=n.iterator();c.hasNext();){var m=c.next(),E=m.getClass();i===null&&(i=E),E!==i&&(s=!0),m.isGeometryCollectionOrDerived()&&(u=!0)}if(i===null)return this.createGeometryCollection();if(s||u)return this.createGeometryCollection(le.toGeometryArray(n));var A=n.iterator().next();if(n.size()>1){if(A instanceof Vt)return this.createMultiPolygon(le.toPolygonArray(n));if(A instanceof Bt)return this.createMultiLineString(le.toLineStringArray(n));if(A instanceof jt)return this.createMultiPoint(le.toPointArray(n));b.shouldNeverReachHere("Unhandled class: "+A.getClass().getName())}return A},le.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},le.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(X(arguments[0],dt)){var i=arguments[0];return new jt(i,this)}}},le.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},le.prototype.createPolygon=function(){if(arguments.length===0)return new Vt(null,null,this);if(arguments.length===1){if(X(arguments[0],dt)){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 sn){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];return new Vt(u,c,this)}},le.prototype.getSRID=function(){return this._SRID},le.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Hn(null,this);if(arguments.length===1){var n=arguments[0];return new Hn(n,this)}},le.prototype.createGeometry=function(n){return new _n(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},le.prototype.getPrecisionModel=function(){return this._precisionModel},le.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(X(arguments[0],dt)){var i=arguments[0];return new sn(i,this)}}},le.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)}},le.prototype.createMultiPoint=function(){if(arguments.length===0)return new he(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new he(n,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if(X(arguments[0],dt)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var u=new Array(s.size()).fill(null),c=0;c<s.size();c++){var m=this.getCoordinateSequenceFactory().create(1,s.getDimension());It.copy(s,c,m,0,1),u[c]=this.createPoint(m)}return this.createMultiPoint(u)}}},le.prototype.interfaces_=function(){return[t]},le.prototype.getClass=function(){return le},le.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},le.getDefaultCoordinateSequenceFactory=function(){return ii.instance()},le.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},wl.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(le,wl);var Sl=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],bl=function(n){this.geometryFactory=n||new le};bl.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!bi[s])throw new Error("Unknown GeoJSON type: "+i.type);return Sl.indexOf(s)!==-1?bi[s].apply(this,[i.coordinates]):s==="GeometryCollection"?bi[s].apply(this,[i.geometries]):bi[s].apply(this,[i])},bl.prototype.write=function(n){var i=n.getGeometryType();if(!uo[i])throw new Error("Geometry is not supported");return uo[i].apply(this,[n])};var bi={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var u=n.geometry.type;if(!bi[u])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=bi.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 u=n[s];i.push(new L(u[0],u[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new L(n[0],n[1]),new L(n[2],n[1]),new L(n[2],n[3]),new L(n[0],n[3]),new L(n[0],n[1])])},Point:function(n){var i=new L(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(bi.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=bi.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(bi.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=bi.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),u=[],c=1;c<n.length;++c){var m=n[c],E=bi.coordinates.apply(this,[m]),A=this.geometryFactory.createLinearRing(E);u.push(A)}return this.geometryFactory.createPolygon(s,u)},MultiPolygon:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(bi.Polygon.apply(this,[u]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(this.read(u))}return this.geometryFactory.createGeometryCollection(i)}},uo={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:uo.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=uo.Point.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(n){for(var i=[],s=n.getCoordinates(),u=0;u<s.length;++u){var c=s[u];i.push(uo.coordinate.apply(this,[c]))}return{type:"LineString",coordinates:i}},MultiLineString:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=uo.LineString.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=uo.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var u=0;u<n._holes.length;++u){var c=n._holes[u],m=uo.LineString.apply(this,[c]);i.push(m.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=uo.Polygon.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=u.getGeometryType();i.push(uo[c].apply(this,[u]))}return{type:"GeometryCollection",geometries:i}}},Sh=function(n){this.geometryFactory=n||new le,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new bl(this.geometryFactory)};Sh.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===ie.FIXED&&this.reducePrecision(i),i},Sh.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 Jd=function(){this.parser=new bl(this.geometryFactory)};Jd.prototype.write=function(n){return this.parser.write(n)};var bt=function(){},Tl={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};bt.prototype.interfaces_=function(){return[]},bt.prototype.getClass=function(){return bt},bt.opposite=function(n){return n===bt.LEFT?bt.RIGHT:n===bt.RIGHT?bt.LEFT:n},Tl.ON.get=function(){return 0},Tl.LEFT.get=function(){return 1},Tl.RIGHT.get=function(){return 2},Object.defineProperties(bt,Tl),(T.prototype=new Error).name="EmptyStackException",(x.prototype=new St).add=function(n){return this.array_.push(n),!0},x.prototype.get=function(n){if(n<0||n>=this.size())throw new Error;return this.array_[n]},x.prototype.push=function(n){return this.array_.push(n),n},x.prototype.pop=function(n){if(this.array_.length===0)throw new T;return this.array_.pop()},x.prototype.peek=function(){if(this.array_.length===0)throw new T;return this.array_[this.array_.length-1]},x.prototype.empty=function(){return this.array_.length===0},x.prototype.isEmpty=function(){return this.empty()},x.prototype.search=function(n){return this.array_.indexOf(n)},x.prototype.size=function(){return this.array_.length},x.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n};var Ti=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Ti.prototype.getCoordinate=function(){return this._minCoord},Ti.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},Ti.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();b.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],u=B.computeOrientation(this._minCoord,s,i),c=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&u===B.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&u===B.CLOCKWISE)&&(c=!0),c&&(this._minIndex=this._minIndex-1)},Ti.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 u=bt.LEFT;return s[i].y<s[i+1].y&&(u=bt.RIGHT),u},Ti.prototype.getEdge=function(){return this._orientedDe},Ti.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])},Ti.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)},Ti.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}b.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)===bt.LEFT&&(this._orientedDe=this._minDe.getSym())},Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti};var lo=function(n){function i(s,u){n.call(this,i.msgWithCoord(s,u)),this.pt=u?new L(u):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,u){return u?s:s+" [ "+u+" ]"},i}(J),Al=function(){this.array_=[]};Al.prototype.addLast=function(n){this.array_.push(n)},Al.prototype.removeFirst=function(){return this.array_.shift()},Al.prototype.isEmpty=function(){return this.array_.length===0};var ar=function(){this._finder=null,this._dirEdgeList=new Q,this._nodes=new Q,this._rightMostCoord=null,this._env=null,this._finder=new Ti};ar.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},ar.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},ar.prototype.computeNodeDepth=function(n){for(var i=null,s=n.getEdges().iterator();s.hasNext();){var u=s.next();if(u.isVisited()||u.getSym().isVisited()){i=u;break}}if(i===null)throw new lo("unable to find edge to compute depths at "+n.getCoordinate());n.getEdges().computeDepths(i);for(var c=n.getEdges().iterator();c.hasNext();){var m=c.next();m.setVisited(!0),this.copySymDepths(m)}},ar.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(bt.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},ar.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},ar.prototype.findResultEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();){var i=n.next();i.getDepth(bt.RIGHT)>=1&&i.getDepth(bt.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},ar.prototype.computeDepths=function(n){var i=new Kn,s=new Al,u=n.getNode();for(s.addLast(u),i.add(u),n.setVisited(!0);!s.isEmpty();){var c=s.removeFirst();i.add(c),this.computeNodeDepth(c);for(var m=c.getEdges().iterator();m.hasNext();){var E=m.next().getSym();if(!E.isVisited()){var A=E.getNode();i.contains(A)||(s.addLast(A),i.add(A))}}}},ar.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},ar.prototype.getEnvelope=function(){if(this._env===null){for(var n=new Pt,i=this._dirEdgeList.iterator();i.hasNext();)for(var s=i.next().getEdge().getCoordinates(),u=0;u<s.length-1;u++)n.expandToInclude(s[u]);this._env=n}return this._env},ar.prototype.addReachable=function(n){var i=new x;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},ar.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(bt.LEFT,n.getDepth(bt.RIGHT)),i.setDepth(bt.RIGHT,n.getDepth(bt.LEFT))},ar.prototype.add=function(n,i){n.setVisited(!0),this._nodes.add(n);for(var s=n.getEdges().iterator();s.hasNext();){var u=s.next();this._dirEdgeList.add(u);var c=u.getSym().getNode();c.isVisited()||i.push(c)}},ar.prototype.getNodes=function(){return this._nodes},ar.prototype.getDirectedEdges=function(){return this._dirEdgeList},ar.prototype.interfaces_=function(){return[F]},ar.prototype.getClass=function(){return ar};var fn=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[bt.ON]=s}else if(arguments[0]instanceof n){var u=arguments[0];if(this.init(u.location.length),u!==null)for(var c=0;c<this.location.length;c++)this.location[c]=u.location[c]}}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this.init(3),this.location[bt.ON]=m,this.location[bt.LEFT]=E,this.location[bt.RIGHT]=A}};fn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},fn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==k.NONE)return!1;return!0},fn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===k.NONE&&(this.location[i]=n)},fn.prototype.isLine=function(){return this.location.length===1},fn.prototype.merge=function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[bt.ON]=this.location[bt.ON],i[bt.LEFT]=k.NONE,i[bt.RIGHT]=k.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===k.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},fn.prototype.getLocations=function(){return this.location},fn.prototype.flip=function(){if(this.location.length<=1)return null;var n=this.location[bt.LEFT];this.location[bt.LEFT]=this.location[bt.RIGHT],this.location[bt.RIGHT]=n},fn.prototype.toString=function(){var n=new pt;return this.location.length>1&&n.append(k.toLocationSymbol(this.location[bt.LEFT])),n.append(k.toLocationSymbol(this.location[bt.ON])),this.location.length>1&&n.append(k.toLocationSymbol(this.location[bt.RIGHT])),n.toString()},fn.prototype.setLocations=function(n,i,s){this.location[bt.ON]=n,this.location[bt.LEFT]=i,this.location[bt.RIGHT]=s},fn.prototype.get=function(n){return n<this.location.length?this.location[n]:k.NONE},fn.prototype.isArea=function(){return this.location.length>1},fn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===k.NONE)return!0;return!1},fn.prototype.setLocation=function(){if(arguments.length===1){var n=arguments[0];this.setLocation(bt.ON,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.location[i]=s}},fn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations(k.NONE)},fn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},fn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},fn.prototype.interfaces_=function(){return[]},fn.prototype.getClass=function(){return fn};var rn=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 fn(i),this.elt[1]=new fn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new fn(s.elt[0]),this.elt[1]=new fn(s.elt[1])}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.elt[0]=new fn(k.NONE),this.elt[1]=new fn(k.NONE),this.elt[u].setLocation(c)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this.elt[0]=new fn(m,E,A),this.elt[1]=new fn(m,E,A)}else if(arguments.length===4){var U=arguments[0],$=arguments[1],ut=arguments[2],ft=arguments[3];this.elt[0]=new fn(k.NONE,k.NONE,k.NONE),this.elt[1]=new fn(k.NONE,k.NONE,k.NONE),this.elt[U].setLocations($,ut,ft)}};rn.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},rn.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},rn.prototype.isNull=function(n){return this.elt[n].isNull()},rn.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)}},rn.prototype.isLine=function(n){return this.elt[n].isLine()},rn.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new fn(n.elt[i]):this.elt[i].merge(n.elt[i])},rn.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},rn.prototype.getLocation=function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(bt.ON)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.elt[i].get(s)}},rn.prototype.toString=function(){var n=new pt;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()},rn.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()}},rn.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},rn.prototype.setLocation=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(bt.ON,i)}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this.elt[s].setLocation(u,c)}},rn.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},rn.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},rn.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new fn(this.elt[n].location[0]))},rn.prototype.interfaces_=function(){return[]},rn.prototype.getClass=function(){return rn},rn.toLineLabel=function(n){for(var i=new rn(k.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var Cn=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new Q,this._pts=new Q,this._label=new rn(k.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new Q,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};Cn.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=B.isCCW(this._ring.getCoordinates())},Cn.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Cn.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new lo("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new lo("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var u=i.getLabel();b.isTrue(u.isArea()),this.mergeLabel(u),this.addPoints(i.getEdge(),i.isForward(),s),s=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},Cn.prototype.getLinearRing=function(){return this._ring},Cn.prototype.getCoordinate=function(n){return this._pts.get(n)},Cn.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},Cn.prototype.addPoints=function(n,i,s){var u=n.getCoordinates();if(i){var c=1;s&&(c=0);for(var m=c;m<u.length;m++)this._pts.add(u[m])}else{var E=u.length-2;s&&(E=u.length-1);for(var A=E;A>=0;A--)this._pts.add(u[A])}},Cn.prototype.isHole=function(){return this._isHole},Cn.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},Cn.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!B.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},Cn.prototype.addHole=function(n){this._holes.add(n)},Cn.prototype.isShell=function(){return this._shell===null},Cn.prototype.getLabel=function(){return this._label},Cn.prototype.getEdges=function(){return this._edges},Cn.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Cn.prototype.getShell=function(){return this._shell},Cn.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],u=i.getLocation(s,bt.RIGHT);if(u===k.NONE)return null;if(this._label.getLocation(s)===k.NONE)return this._label.setLocation(s,u),null}},Cn.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},Cn.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)},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn};var R1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(s,u){s.setMinEdgeRing(u)},i.prototype.getNext=function(s){return s.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Cn),L1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var s=new Q,u=this._startDe;do{if(u.getMinEdgeRing()===null){var c=new R1(u,this._geometryFactory);s.add(c)}u=u.getNext()}while(u!==this._startDe);return s},i.prototype.setEdgeRing=function(s,u){s.setEdgeRing(u)},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}(Cn),Wr=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}}};Wr.prototype.setVisited=function(n){this._isVisited=n},Wr.prototype.setInResult=function(n){this._isInResult=n},Wr.prototype.isCovered=function(){return this._isCovered},Wr.prototype.isCoveredSet=function(){return this._isCoveredSet},Wr.prototype.setLabel=function(n){this._label=n},Wr.prototype.getLabel=function(){return this._label},Wr.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},Wr.prototype.updateIM=function(n){b.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},Wr.prototype.isInResult=function(){return this._isInResult},Wr.prototype.isVisited=function(){return this._isVisited},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr};var Cl=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var s=arguments[0],u=arguments[1];this._coord=s,this._edges=u,this._label=new rn(0,k.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,u){var c=k.NONE;if(c=this._label.getLocation(u),!s.isNull(u)){var m=s.getLocation(u);c!==k.BOUNDARY&&(c=m)}return c},i.prototype.setLabel=function(){if(arguments.length!==2)return n.prototype.setLabel.apply(this,arguments);var s=arguments[0],u=arguments[1];this._label===null?this._label=new rn(s,u):this._label.setLocation(s,u)},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 rn)for(var u=arguments[0],c=0;c<2;c++){var m=this.computeMergedLocation(u,c);this._label.getLocation(c)===k.NONE&&this._label.setLocation(c,m)}},i.prototype.add=function(s){this._edges.insert(s),s.setNode(this)},i.prototype.setLabelBoundary=function(s){if(this._label===null)return null;var u=k.NONE;this._label!==null&&(u=this._label.getLocation(s));var c=null;switch(u){case k.BOUNDARY:c=k.INTERIOR;break;case k.INTERIOR:default:c=k.BOUNDARY}this._label.setLocation(s,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Wr),Ai=function(){this.nodeMap=new _,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};Ai.prototype.find=function(n){return this.nodeMap.get(n)},Ai.prototype.addNode=function(){if(arguments[0]instanceof L){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 Cl){var s=arguments[0],u=this.nodeMap.get(s.getCoordinate());return u===null?(this.nodeMap.put(s.getCoordinate(),s),s):(u.mergeLabel(s),u)}},Ai.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},Ai.prototype.iterator=function(){return this.nodeMap.values().iterator()},Ai.prototype.values=function(){return this.nodeMap.values()},Ai.prototype.getBoundaryNodes=function(n){for(var i=new Q,s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().getLocation(n)===k.BOUNDARY&&i.add(u)}return i},Ai.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},Ai.prototype.interfaces_=function(){return[]},Ai.prototype.getClass=function(){return Ai};var ln=function(){},Eu={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},ln.isNorthern=function(n){return n===ln.NE||n===ln.NW},ln.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},ln.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},ln.isInHalfPlane=function(n,i){return i===ln.SE?n===ln.SE||n===ln.SW:n===i||n===i+1},ln.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 C("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?ln.NE:ln.SE:i>=0?ln.NW:ln.SW}if(arguments[0]instanceof L&&arguments[1]instanceof L){var s=arguments[0],u=arguments[1];if(u.x===s.x&&u.y===s.y)throw new C("Cannot compute the quadrant for two identical points "+s);return u.x>=s.x?u.y>=s.y?ln.NE:ln.SE:u.y>=s.y?ln.NW:ln.SW}},Eu.NE.get=function(){return 0},Eu.NW.get=function(){return 1},Eu.SW.get=function(){return 2},Eu.SE.get=function(){return 3},Object.defineProperties(ln,Eu);var Qn=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],u=arguments[2];this._edge=i,this.init(s,u),this._label=null}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];this._edge=c,this.init(m,E),this._label=A}};Qn.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:B.computeOrientation(n._p0,n._p1,this._p1)},Qn.prototype.getDy=function(){return this._dy},Qn.prototype.getCoordinate=function(){return this._p0},Qn.prototype.setNode=function(n){this._node=n},Qn.prototype.print=function(n){var i=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),u=s.lastIndexOf("."),c=s.substring(u+1);n.print(" "+c+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},Qn.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},Qn.prototype.getDirectedCoordinate=function(){return this._p1},Qn.prototype.getDx=function(){return this._dx},Qn.prototype.getLabel=function(){return this._label},Qn.prototype.getEdge=function(){return this._edge},Qn.prototype.getQuadrant=function(){return this._quadrant},Qn.prototype.getNode=function(){return this._node},Qn.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},Qn.prototype.computeLabel=function(n){},Qn.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=ln.quadrant(this._dx,this._dy),b.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},Qn.prototype.interfaces_=function(){return[F]},Qn.prototype.getClass=function(){return Qn};var bh=function(n){function i(){var s=arguments[0],u=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=u,u)this.init(s.getCoordinate(0),s.getCoordinate(1));else{var c=s.getNumPoints()-1;this.init(s.getCoordinate(c),s.getCoordinate(c-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 rn(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(s,u){if(this._depth[s]!==-999&&this._depth[s]!==u)throw new lo("assigned depths do not match",this.getCoordinate());this._depth[s]=u},i.prototype.isInteriorAreaEdge=function(){for(var s=!0,u=0;u<2;u++)this._label.isArea(u)&&this._label.getLocation(u,bt.LEFT)===k.INTERIOR&&this._label.getLocation(u,bt.RIGHT)===k.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[bt.LEFT]+"/"+this._depth[bt.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),u=!this._label.isArea(0)||this._label.allPositionsEqual(0,k.EXTERIOR),c=!this._label.isArea(1)||this._label.allPositionsEqual(1,k.EXTERIOR);return s&&u&&c},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,u){var c=this.getEdge().getDepthDelta();this._isForward||(c=-c);var m=1;s===bt.LEFT&&(m=-1);var E=bt.opposite(s),A=u+c*m;this.setDepth(s,u),this.setDepth(E,A)},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,u){return s===k.EXTERIOR&&u===k.INTERIOR?1:s===k.INTERIOR&&u===k.EXTERIOR?-1:0},i}(Qn),ha=function(){};ha.prototype.createNode=function(n){return new Cl(n,null)},ha.prototype.interfaces_=function(){return[]},ha.prototype.getClass=function(){return ha};var xn=function(){if(this._edges=new Q,this._nodes=null,this._edgeEndList=new Q,arguments.length===0)this._nodes=new Ai(new ha);else if(arguments.length===1){var n=arguments[0];this._nodes=new Ai(n)}};xn.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)}},xn.prototype.find=function(n){return this._nodes.find(n)},xn.prototype.addNode=function(){if(arguments[0]instanceof Cl){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof L){var i=arguments[0];return this._nodes.addNode(i)}},xn.prototype.getNodeIterator=function(){return this._nodes.iterator()},xn.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},xn.prototype.debugPrintln=function(n){Nt.out.println(n)},xn.prototype.isBoundaryNode=function(n,i){var s=this._nodes.find(i);if(s===null)return!1;var u=s.getLabel();return u!==null&&u.getLocation(n)===k.BOUNDARY},xn.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},xn.prototype.matchInSameDirection=function(n,i,s,u){return!!n.equals(s)&&B.computeOrientation(n,i,u)===B.COLLINEAR&&ln.quadrant(n,i)===ln.quadrant(s,u)},xn.prototype.getEdgeEnds=function(){return this._edgeEndList},xn.prototype.debugPrint=function(n){Nt.out.print(n)},xn.prototype.getEdgeIterator=function(){return this._edges.iterator()},xn.prototype.findEdgeInSameDirection=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(this.matchInSameDirection(n,i,c[0],c[1])||this.matchInSameDirection(n,i,c[c.length-1],c[c.length-2]))return u}return null},xn.prototype.insertEdge=function(n){this._edges.add(n)},xn.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},xn.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var u=new bh(s,!0),c=new bh(s,!1);u.setSym(c),c.setSym(u),this.add(u),this.add(c)}},xn.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},xn.prototype.getNodes=function(){return this._nodes.values()},xn.prototype.findEdge=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(n.equals(c[0])&&i.equals(c[1]))return u}return null},xn.prototype.interfaces_=function(){return[]},xn.prototype.getClass=function(){return xn},xn.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Or=function(){this._geometryFactory=null,this._shellList=new Q;var n=arguments[0];this._geometryFactory=n};Or.prototype.sortShellsAndHoles=function(n,i,s){for(var u=n.iterator();u.hasNext();){var c=u.next();c.isHole()?s.add(c):i.add(c)}},Or.prototype.computePolygons=function(n){for(var i=new Q,s=n.iterator();s.hasNext();){var u=s.next().toPolygon(this._geometryFactory);i.add(u)}return i},Or.prototype.placeFreeHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();if(u.getShell()===null){var c=this.findEdgeRingContaining(u,n);if(c===null)throw new lo("unable to assign hole to a shell",u.getCoordinate(0));u.setShell(c)}}},Or.prototype.buildMinimalEdgeRings=function(n,i,s){for(var u=new Q,c=n.iterator();c.hasNext();){var m=c.next();if(m.getMaxNodeDegree()>2){m.linkDirectedEdgesForMinimalEdgeRings();var E=m.buildMinimalRings(),A=this.findShell(E);A!==null?(this.placePolygonHoles(A,E),i.add(A)):s.addAll(E)}else u.add(m)}return u},Or.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},Or.prototype.buildMaximalEdgeRings=function(n){for(var i=new Q,s=n.iterator();s.hasNext();){var u=s.next();if(u.isInResult()&&u.getLabel().isArea()&&u.getEdgeRing()===null){var c=new L1(u,this._geometryFactory);i.add(c),c.setInResult()}}return i},Or.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();u.isHole()&&u.setShell(n)}},Or.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Or.prototype.findEdgeRingContaining=function(n,i){for(var s=n.getLinearRing(),u=s.getEnvelopeInternal(),c=s.getCoordinateN(0),m=null,E=null,A=i.iterator();A.hasNext();){var U=A.next(),$=U.getLinearRing(),ut=$.getEnvelopeInternal();m!==null&&(E=m.getLinearRing().getEnvelopeInternal());var ft=!1;ut.contains(u)&&B.isPointInRing(c,$.getCoordinates())&&(ft=!0),ft&&(m===null||E.contains(ut))&&(m=U)}return m},Or.prototype.findShell=function(n){for(var i=0,s=null,u=n.iterator();u.hasNext();){var c=u.next();c.isHole()||(s=c,i++)}return b.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},Or.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];xn.linkResultDirectedEdges(s);var u=this.buildMaximalEdgeRings(i),c=new Q,m=this.buildMinimalEdgeRings(u,this._shellList,c);this.sortShellsAndHoles(m,this._shellList,c),this.placeFreeHoles(this._shellList,c)}},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or};var fa=function(){};fa.prototype.getBounds=function(){},fa.prototype.interfaces_=function(){return[]},fa.prototype.getClass=function(){return fa};var mi=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};mi.prototype.getItem=function(){return this._item},mi.prototype.getBounds=function(){return this._bounds},mi.prototype.interfaces_=function(){return[fa,t]},mi.prototype.getClass=function(){return mi};var co=function(){this._size=null,this._items=null,this._size=0,this._items=new Q,this._items.add(null)};co.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},co.prototype.size=function(){return this._size},co.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)},co.prototype.clear=function(){this._size=0,this._items.clear()},co.prototype.isEmpty=function(){return this._size===0},co.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)},co.prototype.interfaces_=function(){return[]},co.prototype.getClass=function(){return co};var Co=function(){};Co.prototype.visitItem=function(n){},Co.prototype.interfaces_=function(){return[]},Co.prototype.getClass=function(){return Co};var Rs=function(){};Rs.prototype.insert=function(n,i){},Rs.prototype.remove=function(n,i){},Rs.prototype.query=function(){},Rs.prototype.interfaces_=function(){return[]},Rs.prototype.getClass=function(){return Rs};var Dn=function(){if(this._childBoundables=new Q,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},Kd={serialVersionUID:{configurable:!0}};Dn.prototype.getLevel=function(){return this._level},Dn.prototype.size=function(){return this._childBoundables.size()},Dn.prototype.getChildBoundables=function(){return this._childBoundables},Dn.prototype.addChildBoundable=function(n){b.isTrue(this._bounds===null),this._childBoundables.add(n)},Dn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Dn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Dn.prototype.interfaces_=function(){return[fa,t]},Dn.prototype.getClass=function(){return Dn},Kd.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Dn,Kd);var gi=function(){};gi.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},gi.min=function(n){return gi.sort(n),n.get(0)},gi.sort=function(n,i){var s=n.toArray();i?ki.sort(s,i):ki.sort(s);for(var u=n.iterator(),c=0,m=s.length;c<m;c++)u.next(),u.set(s[c])},gi.singletonList=function(n){var i=new Q;return i.add(n),i};var Pn=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()};Pn.prototype.expandToQueue=function(n,i){var s=Pn.isComposite(this._boundable1),u=Pn.isComposite(this._boundable2);if(s&&u)return Pn.area(this._boundable1)>Pn.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(u)return this.expand(this._boundable2,this._boundable1,n,i),null;throw new C("neither boundable is composite")},Pn.prototype.isLeaves=function(){return!(Pn.isComposite(this._boundable1)||Pn.isComposite(this._boundable2))},Pn.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},Pn.prototype.expand=function(n,i,s,u){for(var c=n.getChildBoundables().iterator();c.hasNext();){var m=c.next(),E=new Pn(m,i,this._itemDistance);E.getDistance()<u&&s.add(E)}},Pn.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},Pn.prototype.getDistance=function(){return this._distance},Pn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Pn.prototype.interfaces_=function(){return[F]},Pn.prototype.getClass=function(){return Pn},Pn.area=function(n){return n.getBounds().getArea()},Pn.isComposite=function(n){return n instanceof Dn};var kn=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new Q,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];b.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},Pl={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};kn.prototype.getNodeCapacity=function(){return this._nodeCapacity},kn.prototype.lastNode=function(n){return n.get(n.size()-1)},kn.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 Dn?n+=this.size(s):s instanceof mi&&(n+=1)}return n}},kn.prototype.removeItem=function(n,i){for(var s=null,u=n.getChildBoundables().iterator();u.hasNext();){var c=u.next();c instanceof mi&&c.getItem()===i&&(s=c)}return s!==null&&(n.getChildBoundables().remove(s),!0)},kn.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new Q:n}if(arguments.length===1){for(var i=arguments[0],s=new Q,u=i.getChildBoundables().iterator();u.hasNext();){var c=u.next();if(c instanceof Dn){var m=this.itemsTree(c);m!==null&&s.add(m)}else c instanceof mi?s.add(c.getItem()):b.shouldNeverReachHere()}return s.size()<=0?null:s}},kn.prototype.insert=function(n,i){b.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new mi(n,i))},kn.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new Q;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];if(b.isTrue(s>-2),u.getLevel()===s)return c.add(u),null;for(var m=u.getChildBoundables().iterator();m.hasNext();){var E=m.next();E instanceof Dn?this.boundablesAtLevel(s,E,c):(b.isTrue(E instanceof mi),s===-1&&c.add(E))}return null}},kn.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new Q;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],u=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,u)}else if(arguments.length===3){if(X(arguments[2],Co)&&arguments[0]instanceof Object&&arguments[1]instanceof Dn)for(var c=arguments[0],m=arguments[1],E=arguments[2],A=m.getChildBoundables(),U=0;U<A.size();U++){var $=A.get(U);this.getIntersectsOp().intersects($.getBounds(),c)&&($ instanceof Dn?this.query(c,$,E):$ instanceof mi?E.visitItem($.getItem()):b.shouldNeverReachHere())}else if(X(arguments[2],St)&&arguments[0]instanceof Object&&arguments[1]instanceof Dn)for(var ut=arguments[0],ft=arguments[1],At=arguments[2],Rt=ft.getChildBoundables(),kt=0;kt<Rt.size();kt++){var ee=Rt.get(kt);this.getIntersectsOp().intersects(ee.getBounds(),ut)&&(ee instanceof Dn?this.query(ut,ee,At):ee instanceof mi?At.add(ee.getItem()):b.shouldNeverReachHere())}}},kn.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},kn.prototype.getRoot=function(){return this.build(),this._root},kn.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],u=arguments[1],c=arguments[2],m=this.removeItem(u,c);if(m)return!0;for(var E=null,A=u.getChildBoundables().iterator();A.hasNext();){var U=A.next();if(this.getIntersectsOp().intersects(U.getBounds(),s)&&U instanceof Dn&&(m=this.remove(s,U,c))){E=U;break}}return E!==null&&E.getChildBoundables().isEmpty()&&u.getChildBoundables().remove(E),m}},kn.prototype.createHigherLevels=function(n,i){b.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},kn.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 Dn){var u=this.depth(s);u>n&&(n=u)}}return n+1}},kn.prototype.createParentBoundables=function(n,i){b.isTrue(!n.isEmpty());var s=new Q;s.add(this.createNode(i));var u=new Q(n);gi.sort(u,this.getComparator());for(var c=u.iterator();c.hasNext();){var m=c.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(i)),this.lastNode(s).addChildBoundable(m)}return s},kn.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},kn.prototype.interfaces_=function(){return[t]},kn.prototype.getClass=function(){return kn},kn.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},Pl.IntersectsOp.get=function(){return N1},Pl.serialVersionUID.get=function(){return-3886435814360241e3},Pl.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(kn,Pl);var N1=function(){},pa=function(){};pa.prototype.distance=function(n,i){},pa.prototype.interfaces_=function(){return[]},pa.prototype.getClass=function(){return pa};var Qd=function(n){function i(u){u=u||i.DEFAULT_NODE_CAPACITY,n.call(this,u)}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(u,c){b.isTrue(u.length>0);for(var m=new Q,E=0;E<u.length;E++)m.addAll(this.createParentBoundablesFromVerticalSlice(u[E],c));return m},i.prototype.createNode=function(u){return new jd(u)},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 u=arguments[0],c=arguments[1];if(u.isNull())return null;n.prototype.insert.call(this,u,c)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(u,c){for(var m=Math.trunc(Math.ceil(u.size()/c)),E=new Array(c).fill(null),A=u.iterator(),U=0;U<c;U++){E[U]=new Q;for(var $=0;A.hasNext()&&$<m;){var ut=A.next();E[U].add(ut),$++}}return E},i.prototype.query=function(){if(arguments.length===1){var u=arguments[0];return n.prototype.query.call(this,u)}if(arguments.length===2){var c=arguments[0],m=arguments[1];n.prototype.query.call(this,c,m)}else if(arguments.length===3){if(X(arguments[2],Co)&&arguments[0]instanceof Object&&arguments[1]instanceof Dn){var E=arguments[0],A=arguments[1],U=arguments[2];n.prototype.query.call(this,E,A,U)}else if(X(arguments[2],St)&&arguments[0]instanceof Object&&arguments[1]instanceof Dn){var $=arguments[0],ut=arguments[1],ft=arguments[2];n.prototype.query.call(this,$,ut,ft)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(u,c){return n.prototype.createParentBoundables.call(this,u,c)},i.prototype.remove=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return n.prototype.remove.call(this,u,c)}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(u,c){b.isTrue(!u.isEmpty());var m=Math.trunc(Math.ceil(u.size()/this.getNodeCapacity())),E=new Q(u);gi.sort(E,i.xComparator);var A=this.verticalSlices(E,Math.trunc(Math.ceil(Math.sqrt(m))));return this.createParentBoundablesFromVerticalSlices(A,c)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if(X(arguments[0],pa)){var u=arguments[0],c=new Pn(this.getRoot(),this.getRoot(),u);return this.nearestNeighbour(c)}if(arguments[0]instanceof Pn){var m=arguments[0];return this.nearestNeighbour(m,w.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&X(arguments[1],pa)){var E=arguments[0],A=arguments[1],U=new Pn(this.getRoot(),E.getRoot(),A);return this.nearestNeighbour(U)}if(arguments[0]instanceof Pn&&typeof arguments[1]=="number"){var $=arguments[0],ut=arguments[1],ft=null,At=new co;for(At.add($);!At.isEmpty()&&ut>0;){var Rt=At.poll(),kt=Rt.getDistance();if(kt>=ut)break;Rt.isLeaves()?(ut=kt,ft=Rt):Rt.expandToQueue(At,ut)}return[ft.getBoundable(0).getItem(),ft.getBoundable(1).getItem()]}}else if(arguments.length===3){var ee=arguments[0],on=arguments[1],Rn=arguments[2],dr=new mi(ee,on),Ji=new Pn(this.getRoot(),dr,Rn);return this.nearestNeighbour(Ji)[0]}},i.prototype.interfaces_=function(){return[Rs,t]},i.prototype.getClass=function(){return i},i.centreX=function(u){return i.avg(u.getMinX(),u.getMaxX())},i.avg=function(u,c){return(u+c)/2},i.centreY=function(u){return i.avg(u.getMinY(),u.getMaxY())},s.STRtreeNode.get=function(){return jd},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[z]},compare:function(u,c){return n.compareDoubles(i.centreX(u.getBounds()),i.centreX(c.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[z]},compare:function(u,c){return n.compareDoubles(i.centreY(u.getBounds()),i.centreY(c.getBounds()))}}},s.intersectsOp.get=function(){return{interfaces_:function(){return[n.IntersectsOp]},intersects:function(u,c){return u.intersects(c)}}},s.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,s),i}(kn),jd=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,u=this.getChildBoundables().iterator();u.hasNext();){var c=u.next();s===null?s=new Pt(c.getBounds()):s.expandToInclude(c.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Dn),Mr=function(){};Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr},Mr.relativeSign=function(n,i){return n<i?-1:n>i?1:0},Mr.compare=function(n,i,s){if(i.equals2D(s))return 0;var u=Mr.relativeSign(i.x,s.x),c=Mr.relativeSign(i.y,s.y);switch(n){case 0:return Mr.compareValue(u,c);case 1:return Mr.compareValue(c,u);case 2:return Mr.compareValue(c,-u);case 3:return Mr.compareValue(-u,c);case 4:return Mr.compareValue(-u,-c);case 5:return Mr.compareValue(-c,-u);case 6:return Mr.compareValue(-c,u);case 7:return Mr.compareValue(u,-c)}return b.shouldNeverReachHere("invalid octant value"),0},Mr.compareValue=function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0};var Po=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],u=arguments[3];this._segString=n,this.coord=new L(i),this.segmentIndex=s,this._segmentOctant=u,this._isInterior=!i.equals2D(n.getCoordinate(s))};Po.prototype.getCoordinate=function(){return this.coord},Po.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},Po.prototype.compareTo=function(n){var i=n;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:Mr.compare(this._segmentOctant,this.coord,i.coord)},Po.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},Po.prototype.isInterior=function(){return this._isInterior},Po.prototype.interfaces_=function(){return[F]},Po.prototype.getClass=function(){return Po};var ur=function(){this._nodeMap=new _,this._edge=null;var n=arguments[0];this._edge=n};ur.prototype.getSplitCoordinates=function(){var n=new Dt;this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next();this.addEdgeCoordinates(s,u,n),s=u}return n.toCoordinateArray()},ur.prototype.addCollapsedNodes=function(){var n=new Q;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)}},ur.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},ur.prototype.findCollapsesFromExistingVertices=function(n){for(var i=0;i<this._edge.size()-2;i++){var s=this._edge.getCoordinate(i),u=this._edge.getCoordinate(i+2);s.equals2D(u)&&n.add(new et(i+1))}},ur.prototype.addEdgeCoordinates=function(n,i,s){var u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);s.add(new L(n.coord),!1);for(var m=n.segmentIndex+1;m<=i.segmentIndex;m++)s.add(this._edge.getCoordinate(m));c&&s.add(new L(i.coord))},ur.prototype.iterator=function(){return this._nodeMap.values().iterator()},ur.prototype.addSplitEdges=function(n){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},ur.prototype.findCollapseIndex=function(n,i,s){if(!n.coord.equals2D(i.coord))return!1;var u=i.segmentIndex-n.segmentIndex;return i.isInterior()||u--,u===1&&(s[0]=n.segmentIndex+1,!0)},ur.prototype.findCollapsesFromInsertedNodes=function(n){for(var i=new Array(1).fill(null),s=this.iterator(),u=s.next();s.hasNext();){var c=s.next();this.findCollapseIndex(u,c,i)&&n.add(new et(i[0])),u=c}},ur.prototype.getEdge=function(){return this._edge},ur.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},ur.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new L(n.coord);for(var A=n.segmentIndex+1;A<=i.segmentIndex;A++)m[E++]=this._edge.getCoordinate(A);return c&&(m[E]=new L(i.coord)),new bn(m,this._edge.getData())},ur.prototype.add=function(n,i){var s=new Po(this._edge,n,i,this._edge.getSegmentOctant(i)),u=this._nodeMap.get(s);return u!==null?(b.isTrue(u.coord.equals2D(n),"Found equal nodes with different coordinates"),u):(this._nodeMap.put(s,s),s)},ur.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new J("bad split edge start point at "+s);var u=n.get(n.size()-1).getCoordinates(),c=u[u.length-1];if(!c.equals2D(i[i.length-1]))throw new J("bad split edge end point at "+c)},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur};var Ls=function(){};Ls.prototype.interfaces_=function(){return[]},Ls.prototype.getClass=function(){return Ls},Ls.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 C("Cannot compute the octant for point ( "+n+", "+i+" )");var s=Math.abs(n),u=Math.abs(i);return n>=0?i>=0?s>=u?0:1:s>=u?7:6:i>=0?s>=u?3:2:s>=u?4:5}if(arguments[0]instanceof L&&arguments[1]instanceof L){var c=arguments[0],m=arguments[1],E=m.x-c.x,A=m.y-c.y;if(E===0&&A===0)throw new C("Cannot compute the octant for two identical points "+c);return Ls.octant(E,A)}};var Vi=function(){};Vi.prototype.getCoordinates=function(){},Vi.prototype.size=function(){},Vi.prototype.getCoordinate=function(n){},Vi.prototype.isClosed=function(){},Vi.prototype.setData=function(n){},Vi.prototype.getData=function(){},Vi.prototype.interfaces_=function(){return[]},Vi.prototype.getClass=function(){return Vi};var Mu=function(){};Mu.prototype.addIntersection=function(n,i){},Mu.prototype.interfaces_=function(){return[Vi]},Mu.prototype.getClass=function(){return Mu};var bn=function(){this._nodeList=new ur(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};bn.prototype.getCoordinates=function(){return this._pts},bn.prototype.size=function(){return this._pts.length},bn.prototype.getCoordinate=function(n){return this._pts[n]},bn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},bn.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},bn.prototype.setData=function(n){this._data=n},bn.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:Ls.octant(n,i)},bn.prototype.getData=function(){return this._data},bn.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],u=arguments[1],c=arguments[3],m=new L(s.getIntersection(c));this.addIntersection(m,u)}},bn.prototype.toString=function(){return qt.toLineString(new fe(this._pts))},bn.prototype.getNodeList=function(){return this._nodeList},bn.prototype.addIntersectionNode=function(n,i){var s=i,u=s+1;if(u<this._pts.length){var c=this._pts[u];n.equals2D(c)&&(s=u)}return this._nodeList.add(n,s)},bn.prototype.addIntersections=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++)this.addIntersection(n,i,s,u)},bn.prototype.interfaces_=function(){return[Mu]},bn.prototype.getClass=function(){return bn},bn.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new Q;return bn.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var s=arguments[0],u=arguments[1],c=s.iterator();c.hasNext();)c.next().getNodeList().addSplitEdges(u)};var $t=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new L,this.p1=new L;else if(arguments.length===1){var n=arguments[0];this.p0=new L(n.p0),this.p1=new L(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],u=arguments[2],c=arguments[3];this.p0=new L(i,s),this.p1=new L(u,c)}},tm={serialVersionUID:{configurable:!0}};$t.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},$t.prototype.orientationIndex=function(){if(arguments[0]instanceof $t){var n=arguments[0],i=B.orientationIndex(this.p0,this.p1,n.p0),s=B.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 L){var u=arguments[0];return B.orientationIndex(this.p0,this.p1,u)}},$t.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},$t.prototype.isVertical=function(){return this.p0.x===this.p1.x},$t.prototype.equals=function(n){if(!(n instanceof $t))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},$t.prototype.intersection=function(n){var i=new Z;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},$t.prototype.project=function(){if(arguments[0]instanceof L){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new L(n);var i=this.projectionFactor(n),s=new L;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 $t){var u=arguments[0],c=this.projectionFactor(u.p0),m=this.projectionFactor(u.p1);if(c>=1&&m>=1||c<=0&&m<=0)return null;var E=this.project(u.p0);c<0&&(E=this.p0),c>1&&(E=this.p1);var A=this.project(u.p1);return m<0&&(A=this.p0),m>1&&(A=this.p1),new $t(E,A)}},$t.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},$t.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},$t.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},$t.prototype.distancePerpendicular=function(n){return B.distancePointLinePerpendicular(n,this.p0,this.p1)},$t.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},$t.prototype.midPoint=function(){return $t.midPoint(this.p0,this.p1)},$t.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,u=i*i+s*s;return u<=0?w.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/u},$t.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),u=w.MAX_VALUE,c=null,m=this.closestPoint(n.p0);u=m.distance(n.p0),s[0]=m,s[1]=n.p0;var E=this.closestPoint(n.p1);(c=E.distance(n.p1))<u&&(u=c,s[0]=E,s[1]=n.p1);var A=n.closestPoint(this.p0);(c=A.distance(this.p0))<u&&(u=c,s[0]=this.p0,s[1]=A);var U=n.closestPoint(this.p1);return(c=U.distance(this.p1))<u&&(u=c,s[0]=this.p1,s[1]=U),s},$t.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},$t.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},$t.prototype.getLength=function(){return this.p0.distance(this.p1)},$t.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},$t.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},$t.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)},$t.prototype.lineIntersection=function(n){try{return ne.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof Wt))throw i}return null},$t.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},$t.prototype.pointAlongOffset=function(n,i){var s=this.p0.x+n*(this.p1.x-this.p0.x),u=this.p0.y+n*(this.p1.y-this.p0.y),c=this.p1.x-this.p0.x,m=this.p1.y-this.p0.y,E=Math.sqrt(c*c+m*m),A=0,U=0;if(i!==0){if(E<=0)throw new Error("Cannot compute offset from zero-length line segment");A=i*c/E,U=i*m/E}return new L(s-U,u+A)},$t.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}},$t.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||w.isNaN(i))&&(i=1),i},$t.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},$t.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},$t.prototype.distance=function(){if(arguments[0]instanceof $t){var n=arguments[0];return B.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof L){var i=arguments[0];return B.distancePointLine(i,this.p0,this.p1)}},$t.prototype.pointAlong=function(n){var i=new L;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},$t.prototype.hashCode=function(){var n=w.doubleToLongBits(this.p0.x);n^=31*w.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=w.doubleToLongBits(this.p1.x);return s^=31*w.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},$t.prototype.interfaces_=function(){return[F,t]},$t.prototype.getClass=function(){return $t},$t.midPoint=function(n,i){return new L((n.x+i.x)/2,(n.y+i.y)/2)},tm.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties($t,tm);var wu=function(){this.tempEnv1=new Pt,this.tempEnv2=new Pt,this._overlapSeg1=new $t,this._overlapSeg2=new $t};wu.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];n.getLineSegment(i,this._overlapSeg1),s.getLineSegment(u,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},wu.prototype.interfaces_=function(){return[]},wu.prototype.getClass=function(){return wu};var Dr=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],u=arguments[3];this._pts=n,this._start=i,this._end=s,this._context=u};Dr.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},Dr.prototype.computeSelect=function(n,i,s,u){var c=this._pts[i],m=this._pts[s];if(u.tempEnv1.init(c,m),s-i==1)return u.select(this,i),null;if(!n.intersects(u.tempEnv1))return null;var E=Math.trunc((i+s)/2);i<E&&this.computeSelect(n,i,E,u),E<s&&this.computeSelect(n,E,s,u)},Dr.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},Dr.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},Dr.prototype.setId=function(n){this._id=n},Dr.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},Dr.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new Pt(n,i)}return this._env},Dr.prototype.getEndIndex=function(){return this._end},Dr.prototype.getStartIndex=function(){return this._start},Dr.prototype.getContext=function(){return this._context},Dr.prototype.getId=function(){return this._id},Dr.prototype.computeOverlapsInternal=function(n,i,s,u,c,m){var E=this._pts[n],A=this._pts[i],U=s._pts[u],$=s._pts[c];if(i-n==1&&c-u==1)return m.overlap(this,n,s,u),null;if(m.tempEnv1.init(E,A),m.tempEnv2.init(U,$),!m.tempEnv1.intersects(m.tempEnv2))return null;var ut=Math.trunc((n+i)/2),ft=Math.trunc((u+c)/2);n<ut&&(u<ft&&this.computeOverlapsInternal(n,ut,s,u,ft,m),ft<c&&this.computeOverlapsInternal(n,ut,s,ft,c,m)),ut<i&&(u<ft&&this.computeOverlapsInternal(ut,i,s,u,ft,m),ft<c&&this.computeOverlapsInternal(ut,i,s,ft,c,m))},Dr.prototype.interfaces_=function(){return[]},Dr.prototype.getClass=function(){return Dr};var Ci=function(){};Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci},Ci.getChainStartIndices=function(n){var i=0,s=new Q;s.add(new et(i));do{var u=Ci.findChainEnd(n,i);s.add(new et(u)),i=u}while(i<n.length-1);return Ci.toIntArray(s)},Ci.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 u=ln.quadrant(n[s],n[s+1]),c=i+1;c<n.length&&!(!n[c-1].equals2D(n[c])&&ln.quadrant(n[c-1],n[c])!==u);)c++;return c-1},Ci.getChains=function(){if(arguments.length===1){var n=arguments[0];return Ci.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],u=new Q,c=Ci.getChainStartIndices(i),m=0;m<c.length-1;m++){var E=new Dr(i,c[m],c[m+1],s);u.add(E)}return u}},Ci.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 ts=function(){};ts.prototype.computeNodes=function(n){},ts.prototype.getNodedSubstrings=function(){},ts.prototype.interfaces_=function(){return[]},ts.prototype.getClass=function(){return ts};var Su=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};Su.prototype.setSegmentIntersector=function(n){this._segInt=n},Su.prototype.interfaces_=function(){return[ts]},Su.prototype.getClass=function(){return Su};var Th=function(n){function i(u){u?n.call(this,u):n.call(this),this._monoChains=new Q,this._index=new Qd,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 bn.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(u){for(var c=Ci.getChains(u.getCoordinates(),u).iterator();c.hasNext();){var m=c.next();m.setId(this._idCounter++),this._index.insert(m.getEnvelope(),m),this._monoChains.add(m)}},i.prototype.computeNodes=function(u){this._nodedSegStrings=u;for(var c=u.iterator();c.hasNext();)this.add(c.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var u=new em(this._segInt),c=this._monoChains.iterator();c.hasNext();)for(var m=c.next(),E=this._index.query(m.getEnvelope()).iterator();E.hasNext();){var A=E.next();if(A.getId()>m.getId()&&(m.computeOverlaps(A,u),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.SegmentOverlapAction.get=function(){return em},Object.defineProperties(i,s),i}(Su),em=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],u=arguments[1],c=arguments[2],m=arguments[3],E=s.getContext(),A=c.getContext();this._si.processIntersections(E,u,A,m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(wu),We=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],u=arguments[1];this.setQuadrantSegments(s),this.setEndCapStyle(u)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];this.setQuadrantSegments(c),this.setEndCapStyle(m),this.setJoinStyle(E),this.setMitreLimit(A)}}},ho={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}};We.prototype.getEndCapStyle=function(){return this._endCapStyle},We.prototype.isSingleSided=function(){return this._isSingleSided},We.prototype.setQuadrantSegments=function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=We.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=We.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==We.JOIN_ROUND&&(this._quadrantSegments=We.DEFAULT_QUADRANT_SEGMENTS)},We.prototype.getJoinStyle=function(){return this._joinStyle},We.prototype.setJoinStyle=function(n){this._joinStyle=n},We.prototype.setSimplifyFactor=function(n){this._simplifyFactor=n<0?0:n},We.prototype.getSimplifyFactor=function(){return this._simplifyFactor},We.prototype.getQuadrantSegments=function(){return this._quadrantSegments},We.prototype.setEndCapStyle=function(n){this._endCapStyle=n},We.prototype.getMitreLimit=function(){return this._mitreLimit},We.prototype.setMitreLimit=function(n){this._mitreLimit=n},We.prototype.setSingleSided=function(n){this._isSingleSided=n},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We},We.bufferDistanceError=function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)},ho.CAP_ROUND.get=function(){return 1},ho.CAP_FLAT.get=function(){return 2},ho.CAP_SQUARE.get=function(){return 3},ho.JOIN_ROUND.get=function(){return 1},ho.JOIN_MITRE.get=function(){return 2},ho.JOIN_BEVEL.get=function(){return 3},ho.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},ho.DEFAULT_MITRE_LIMIT.get=function(){return 5},ho.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(We,ho);var wn=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=B.COUNTERCLOCKWISE,this._inputLine=n||null},bu={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};wn.prototype.isDeletable=function(n,i,s,u){var c=this._inputLine[n],m=this._inputLine[i],E=this._inputLine[s];return!!this.isConcave(c,m,E)&&!!this.isShallow(c,m,E,u)&&this.isShallowSampled(c,m,n,s,u)},wn.prototype.deleteShallowConcavities=function(){for(var n=1,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i),u=!1;s<this._inputLine.length;){var c=!1;this.isDeletable(n,i,s,this._distanceTol)&&(this._isDeleted[i]=wn.DELETE,c=!0,u=!0),n=c?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return u},wn.prototype.isShallowConcavity=function(n,i,s,u){return B.computeOrientation(n,i,s)!==this._angleOrientation?!1:B.distancePointLine(i,n,s)<u},wn.prototype.isShallowSampled=function(n,i,s,u,c){var m=Math.trunc((u-s)/wn.NUM_PTS_TO_CHECK);m<=0&&(m=1);for(var E=s;E<u;E+=m)if(!this.isShallow(n,i,this._inputLine[E],c))return!1;return!0},wn.prototype.isConcave=function(n,i,s){var u=B.computeOrientation(n,i,s)===this._angleOrientation;return u},wn.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=B.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},wn.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===wn.DELETE;)i++;return i},wn.prototype.isShallow=function(n,i,s,u){return B.distancePointLine(i,n,s)<u},wn.prototype.collapseLine=function(){for(var n=new Dt,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==wn.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},wn.prototype.interfaces_=function(){return[]},wn.prototype.getClass=function(){return wn},wn.simplify=function(n,i){return new wn(n).simplify(i)},bu.INIT.get=function(){return 0},bu.DELETE.get=function(){return 1},bu.KEEP.get=function(){return 1},bu.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(wn,bu);var qr=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new Q},nm={COORDINATE_ARRAY_TYPE:{configurable:!0}};qr.prototype.getCoordinates=function(){return this._ptList.toArray(qr.COORDINATE_ARRAY_TYPE)},qr.prototype.setPrecisionModel=function(n){this._precisionModel=n},qr.prototype.addPt=function(n){var i=new L(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},qr.prototype.revere=function(){},qr.prototype.addPts=function(n,i){if(i)for(var s=0;s<n.length;s++)this.addPt(n[s]);else for(var u=n.length-1;u>=0;u--)this.addPt(n[u])},qr.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},qr.prototype.toString=function(){return new le().createLineString(this.getCoordinates()).toString()},qr.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new L(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},qr.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr},nm.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(qr,nm);var me=function(){},Ns={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};me.prototype.interfaces_=function(){return[]},me.prototype.getClass=function(){return me},me.toDegrees=function(n){return 180*n/Math.PI},me.normalize=function(n){for(;n>Math.PI;)n-=me.PI_TIMES_2;for(;n<=-Math.PI;)n+=me.PI_TIMES_2;return n},me.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],u=s.x-i.x,c=s.y-i.y;return Math.atan2(c,u)}},me.isAcute=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)>0},me.isObtuse=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)<0},me.interiorAngle=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return Math.abs(c-u)},me.normalizePositive=function(n){if(n<0){for(;n<0;)n+=me.PI_TIMES_2;n>=me.PI_TIMES_2&&(n=0)}else{for(;n>=me.PI_TIMES_2;)n-=me.PI_TIMES_2;n<0&&(n=0)}return n},me.angleBetween=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return me.diff(u,c)},me.diff=function(n,i){var s=null;return(s=n<i?i-n:n-i)>Math.PI&&(s=2*Math.PI-s),s},me.toRadians=function(n){return n*Math.PI/180},me.getTurn=function(n,i){var s=Math.sin(i-n);return s>0?me.COUNTERCLOCKWISE:s<0?me.CLOCKWISE:me.NONE},me.angleBetweenOriented=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s)-u;return c<=-Math.PI?c+me.PI_TIMES_2:c>Math.PI?c-me.PI_TIMES_2:c},Ns.PI_TIMES_2.get=function(){return 2*Math.PI},Ns.PI_OVER_2.get=function(){return Math.PI/2},Ns.PI_OVER_4.get=function(){return Math.PI/4},Ns.COUNTERCLOCKWISE.get=function(){return B.COUNTERCLOCKWISE},Ns.CLOCKWISE.get=function(){return B.CLOCKWISE},Ns.NONE.get=function(){return B.COLLINEAR},Object.defineProperties(me,Ns);var pn=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 $t,this._seg1=new $t,this._offset0=new $t,this._offset1=new $t,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],s=arguments[1],u=arguments[2];this._precisionModel=i,this._bufParams=s,this._li=new Z,this._filletAngleQuantum=Math.PI/2/s.getQuadrantSegments(),s.getQuadrantSegments()>=8&&s.getJoinStyle()===We.JOIN_ROUND&&(this._closingSegLengthFactor=n.MAX_CLOSING_SEG_LEN_FACTOR),this.init(u)},Tu={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}};pn.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=B.computeOrientation(this._s0,this._s1,this._s2),u=s===B.CLOCKWISE&&this._side===bt.LEFT||s===B.COUNTERCLOCKWISE&&this._side===bt.RIGHT;s===0?this.addCollinear(i):u?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},pn.prototype.addLineEndCap=function(n,i){var s=new $t(n,i),u=new $t;this.computeOffsetSegment(s,bt.LEFT,this._distance,u);var c=new $t;this.computeOffsetSegment(s,bt.RIGHT,this._distance,c);var m=i.x-n.x,E=i.y-n.y,A=Math.atan2(E,m);switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:this._segList.addPt(u.p1),this.addFilletArc(i,A+Math.PI/2,A-Math.PI/2,B.CLOCKWISE,this._distance),this._segList.addPt(c.p1);break;case We.CAP_FLAT:this._segList.addPt(u.p1),this._segList.addPt(c.p1);break;case We.CAP_SQUARE:var U=new L;U.x=Math.abs(this._distance)*Math.cos(A),U.y=Math.abs(this._distance)*Math.sin(A);var $=new L(u.p1.x+U.x,u.p1.y+U.y),ut=new L(c.p1.x+U.x,c.p1.y+U.y);this._segList.addPt($),this._segList.addPt(ut)}},pn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},pn.prototype.addMitreJoin=function(n,i,s,u){var c=!0,m=null;try{m=ne.intersection(i.p0,i.p1,s.p0,s.p1),(u<=0?1:m.distance(n)/Math.abs(u))>this._bufParams.getMitreLimit()&&(c=!1)}catch(E){if(!(E instanceof Wt))throw E;m=new L(0,0),c=!1}c?this._segList.addPt(m):this.addLimitedMitreJoin(i,s,u,this._bufParams.getMitreLimit())},pn.prototype.addFilletCorner=function(n,i,s,u,c){var m=i.x-n.x,E=i.y-n.y,A=Math.atan2(E,m),U=s.x-n.x,$=s.y-n.y,ut=Math.atan2($,U);u===B.CLOCKWISE?A<=ut&&(A+=2*Math.PI):A>=ut&&(A-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,A,ut,u,c),this._segList.addPt(s)},pn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*pn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===We.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===We.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))},pn.prototype.createSquare=function(n){this._segList.addPt(new L(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new L(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new L(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new L(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},pn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},pn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},pn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},pn.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)},pn.prototype.addLimitedMitreJoin=function(n,i,s,u){var c=this._seg0.p1,m=me.angle(c,this._seg0.p0),E=me.angleBetweenOriented(this._seg0.p0,c,this._seg1.p1)/2,A=me.normalize(m+E),U=me.normalize(A+Math.PI),$=u*s,ut=s-$*Math.abs(Math.sin(E)),ft=c.x+$*Math.cos(U),At=c.y+$*Math.sin(U),Rt=new L(ft,At),kt=new $t(c,Rt),ee=kt.pointAlongOffset(1,ut),on=kt.pointAlongOffset(1,-ut);this._side===bt.LEFT?(this._segList.addPt(ee),this._segList.addPt(on)):(this._segList.addPt(on),this._segList.addPt(ee))},pn.prototype.computeOffsetSegment=function(n,i,s,u){var c=i===bt.LEFT?1:-1,m=n.p1.x-n.p0.x,E=n.p1.y-n.p0.y,A=Math.sqrt(m*m+E*E),U=c*s*m/A,$=c*s*E/A;u.p0.x=n.p0.x-$,u.p0.y=n.p0.y+U,u.p1.x=n.p1.x-$,u.p1.y=n.p1.y+U},pn.prototype.addFilletArc=function(n,i,s,u,c){var m=u===B.CLOCKWISE?-1:1,E=Math.abs(i-s),A=Math.trunc(E/this._filletAngleQuantum+.5);if(A<1)return null;for(var U=E/A,$=0,ut=new L;$<E;){var ft=i+m*$;ut.x=n.x+c*Math.cos(ft),ut.y=n.y+c*Math.sin(ft),this._segList.addPt(ut),$+=U}},pn.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*pn.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 L((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 u=new L((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(u)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},pn.prototype.createCircle=function(n){var i=new L(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},pn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},pn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new qr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*pn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},pn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===We.JOIN_BEVEL||this._bufParams.getJoinStyle()===We.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,B.CLOCKWISE,this._distance))},pn.prototype.closeRing=function(){this._segList.closeRing()},pn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn},Tu.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},Tu.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},Tu.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Tu.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(pn,Tu);var wr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};wr.prototype.getOffsetCurve=function(n,i){if(this._distance=i,i===0)return null;var s=i<0,u=Math.abs(i),c=this.getSegGen(u);n.length<=1?this.computePointCurve(n[0],c):this.computeOffsetCurve(n,s,c);var m=c.getCoordinates();return s&&ht.reverse(m),m},wr.prototype.computeSingleSidedBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var c=wn.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{s.addSegments(n,!1);var A=wn.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var $=2;$<=U;$++)s.addNextSegment(A[$],!0)}s.addLastSegment(),s.closeRing()},wr.prototype.computeRingBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);i===bt.RIGHT&&(u=-u);var c=wn.simplify(n,u),m=c.length-1;s.initSideSegments(c[m-1],c[0],i);for(var E=1;E<=m;E++){var A=E!==1;s.addNextSegment(c[E],A)}s.closeRing()},wr.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),u=wn.simplify(n,s),c=u.length-1;i.initSideSegments(u[0],u[1],bt.LEFT);for(var m=2;m<=c;m++)i.addNextSegment(u[m],!0);i.addLastSegment(),i.addLineEndCap(u[c-1],u[c]);var E=wn.simplify(n,-s),A=E.length-1;i.initSideSegments(E[A],E[A-1],bt.LEFT);for(var U=A-2;U>=0;U--)i.addNextSegment(E[U],!0);i.addLastSegment(),i.addLineEndCap(E[1],E[0]),i.closeRing()},wr.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:i.createCircle(n);break;case We.CAP_SQUARE:i.createSquare(n)}},wr.prototype.getLineCurve=function(n,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var s=Math.abs(i),u=this.getSegGen(s);if(n.length<=1)this.computePointCurve(n[0],u);else if(this._bufParams.isSingleSided()){var c=i<0;this.computeSingleSidedBufferCurve(n,c,u)}else this.computeLineBufferCurve(n,u);return u.getCoordinates()},wr.prototype.getBufferParameters=function(){return this._bufParams},wr.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},wr.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return wr.copyCoordinates(n);var u=this.getSegGen(s);return this.computeRingBufferCurve(n,i,u),u.getCoordinates()},wr.prototype.computeOffsetCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){var c=wn.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{var A=wn.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var $=2;$<=U;$++)s.addNextSegment(A[$],!0)}s.addLastSegment()},wr.prototype.getSegGen=function(n){return new pn(this._precisionModel,this._bufParams,n)},wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr},wr.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new L(n[s]);return i};var Os=function(){this._subgraphs=null,this._seg=new $t,this._cga=new B;var n=arguments[0];this._subgraphs=n},rm={DepthSegment:{configurable:!0}};Os.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new Q,s=this._subgraphs.iterator();s.hasNext();){var u=s.next(),c=u.getEnvelope();n.y<c.getMinY()||n.y>c.getMaxY()||this.findStabbedSegments(n,u.getDirectedEdges(),i)}return i}if(arguments.length===3){if(X(arguments[2],St)&&arguments[0]instanceof L&&arguments[1]instanceof bh){for(var m=arguments[0],E=arguments[1],A=arguments[2],U=E.getEdge().getCoordinates(),$=0;$<U.length-1;$++)if(this._seg.p0=U[$],this._seg.p1=U[$+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<m.x)&&!(this._seg.isHorizontal()||m.y<this._seg.p0.y||m.y>this._seg.p1.y||B.computeOrientation(this._seg.p0,this._seg.p1,m)===B.RIGHT)){var ut=E.getDepth(bt.LEFT);this._seg.p0.equals(U[$])||(ut=E.getDepth(bt.RIGHT));var ft=new es(this._seg,ut);A.add(ft)}}else if(X(arguments[2],St)&&arguments[0]instanceof L&&X(arguments[1],St))for(var At=arguments[0],Rt=arguments[1],kt=arguments[2],ee=Rt.iterator();ee.hasNext();){var on=ee.next();on.isForward()&&this.findStabbedSegments(At,on,kt)}}},Os.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:gi.min(i)._leftDepth},Os.prototype.interfaces_=function(){return[]},Os.prototype.getClass=function(){return Os},rm.DepthSegment.get=function(){return es},Object.defineProperties(Os,rm);var es=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new $t(n),this._leftDepth=i};es.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)},es.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},es.prototype.toString=function(){return this._upwardSeg.toString()},es.prototype.interfaces_=function(){return[F]},es.prototype.getClass=function(){return es};var qe=function(n,i,s){this.p0=n||null,this.p1=i||null,this.p2=s||null};qe.prototype.area=function(){return qe.area(this.p0,this.p1,this.p2)},qe.prototype.signedArea=function(){return qe.signedArea(this.p0,this.p1,this.p2)},qe.prototype.interpolateZ=function(n){if(n===null)throw new C("Supplied point is null.");return qe.interpolateZ(n,this.p0,this.p1,this.p2)},qe.prototype.longestSideLength=function(){return qe.longestSideLength(this.p0,this.p1,this.p2)},qe.prototype.isAcute=function(){return qe.isAcute(this.p0,this.p1,this.p2)},qe.prototype.circumcentre=function(){return qe.circumcentre(this.p0,this.p1,this.p2)},qe.prototype.area3D=function(){return qe.area3D(this.p0,this.p1,this.p2)},qe.prototype.centroid=function(){return qe.centroid(this.p0,this.p1,this.p2)},qe.prototype.inCentre=function(){return qe.inCentre(this.p0,this.p1,this.p2)},qe.prototype.interfaces_=function(){return[]},qe.prototype.getClass=function(){return qe},qe.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)},qe.signedArea=function(n,i,s){return((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2},qe.det=function(n,i,s,u){return n*u-i*s},qe.interpolateZ=function(n,i,s,u){var c=i.x,m=i.y,E=s.x-c,A=u.x-c,U=s.y-m,$=u.y-m,ut=E*$-A*U,ft=n.x-c,At=n.y-m,Rt=($*ft-A*At)/ut,kt=(-U*ft+E*At)/ut;return i.z+Rt*(s.z-i.z)+kt*(u.z-i.z)},qe.longestSideLength=function(n,i,s){var u=n.distance(i),c=i.distance(s),m=s.distance(n),E=u;return c>E&&(E=c),m>E&&(E=m),E},qe.isAcute=function(n,i,s){return!!me.isAcute(n,i,s)&&!!me.isAcute(i,s,n)&&!!me.isAcute(s,n,i)},qe.circumcentre=function(n,i,s){var u=s.x,c=s.y,m=n.x-u,E=n.y-c,A=i.x-u,U=i.y-c,$=2*qe.det(m,E,A,U),ut=qe.det(E,m*m+E*E,U,A*A+U*U),ft=qe.det(m,m*m+E*E,A,A*A+U*U);return new L(u-ut/$,c+ft/$)},qe.perpendicularBisector=function(n,i){var s=i.x-n.x,u=i.y-n.y,c=new ne(n.x+s/2,n.y+u/2,1),m=new ne(n.x-u+s/2,n.y+s+u/2,1);return new ne(c,m)},qe.angleBisector=function(n,i,s){var u=i.distance(n),c=u/(u+i.distance(s)),m=s.x-n.x,E=s.y-n.y;return new L(n.x+c*m,n.y+c*E)},qe.area3D=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=i.z-n.z,E=s.x-n.x,A=s.y-n.y,U=s.z-n.z,$=c*U-m*A,ut=m*E-u*U,ft=u*A-c*E,At=$*$+ut*ut+ft*ft,Rt=Math.sqrt(At)/2;return Rt},qe.centroid=function(n,i,s){var u=(n.x+i.x+s.x)/3,c=(n.y+i.y+s.y)/3;return new L(u,c)},qe.inCentre=function(n,i,s){var u=i.distance(s),c=n.distance(s),m=n.distance(i),E=u+c+m,A=(u*n.x+c*i.x+m*s.x)/E,U=(u*n.y+c*i.y+m*s.y)/E;return new L(A,U)};var oi=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Q;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};oi.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,k.EXTERIOR,k.INTERIOR)},oi.prototype.addPolygon=function(n){var i=this._distance,s=bt.LEFT;this._distance<0&&(i=-this._distance,s=bt.RIGHT);var u=n.getExteriorRing(),c=ht.removeRepeatedPoints(u.getCoordinates());if(this._distance<0&&this.isErodedCompletely(u,this._distance)||this._distance<=0&&c.length<3)return null;this.addPolygonRing(c,i,s,k.EXTERIOR,k.INTERIOR);for(var m=0;m<n.getNumInteriorRing();m++){var E=n.getInteriorRingN(m),A=ht.removeRepeatedPoints(E.getCoordinates());this._distance>0&&this.isErodedCompletely(E,-this._distance)||this.addPolygonRing(A,i,bt.opposite(s),k.INTERIOR,k.EXTERIOR)}},oi.prototype.isTriangleErodedCompletely=function(n,i){var s=new qe(n[0],n[1],n[2]),u=s.inCentre();return B.distancePointLine(u,s.p0,s.p1)<Math.abs(i)},oi.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=ht.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,k.EXTERIOR,k.INTERIOR)},oi.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var u=new bn(n,new rn(0,k.BOUNDARY,i,s));this._curveList.add(u)},oi.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},oi.prototype.addPolygonRing=function(n,i,s,u,c){if(i===0&&n.length<sn.MINIMUM_VALID_SIZE)return null;var m=u,E=c;n.length>=sn.MINIMUM_VALID_SIZE&&B.isCCW(n)&&(m=c,E=u,s=bt.opposite(s));var A=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(A,m,E)},oi.prototype.add=function(n){if(n.isEmpty())return null;n instanceof Vt?this.addPolygon(n):n instanceof Bt?this.addLineString(n):n instanceof jt?this.addPoint(n):n instanceof he?this.addCollection(n):n instanceof H?this.addCollection(n):n instanceof un?this.addCollection(n):n instanceof Hn&&this.addCollection(n)},oi.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 u=n.getEnvelopeInternal(),c=Math.min(u.getHeight(),u.getWidth());return i<0&&2*Math.abs(i)>c},oi.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi};var da=function(){};da.prototype.locate=function(n){},da.prototype.interfaces_=function(){return[]},da.prototype.getClass=function(){return da};var Hi=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()};Hi.prototype.next=function(){if(this._atStart)return this._atStart=!1,Hi.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 Hn?(this._subcollectionIterator=new Hi(n),this._subcollectionIterator.next()):n},Hi.prototype.remove=function(){throw new Error(this.getClass().getName())},Hi.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)},Hi.prototype.interfaces_=function(){return[Y]},Hi.prototype.getClass=function(){return Hi},Hi.isAtomic=function(n){return!(n instanceof Hn)};var Xr=function(){this._geom=null;var n=arguments[0];this._geom=n};Xr.prototype.locate=function(n){return Xr.locate(n,this._geom)},Xr.prototype.interfaces_=function(){return[da]},Xr.prototype.getClass=function(){return Xr},Xr.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&B.isPointInRing(n,i.getCoordinates())},Xr.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!Xr.isPointInRing(n,s))return!1;for(var u=0;u<i.getNumInteriorRing();u++){var c=i.getInteriorRingN(u);if(Xr.isPointInRing(n,c))return!1}return!0},Xr.containsPoint=function(n,i){if(i instanceof Vt)return Xr.containsPointInPolygon(n,i);if(i instanceof Hn)for(var s=new Hi(i);s.hasNext();){var u=s.next();if(u!==i&&Xr.containsPoint(n,u))return!0}return!1},Xr.locate=function(n,i){return i.isEmpty()?k.EXTERIOR:Xr.containsPoint(n,i)?k.INTERIOR:k.EXTERIOR};var jn=function(){this._edgeMap=new _,this._edgeList=null,this._ptInAreaLocation=[k.NONE,k.NONE]};jn.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)},jn.prototype.propagateSideLabels=function(n){for(var i=k.NONE,s=this.iterator();s.hasNext();){var u=s.next().getLabel();u.isArea(n)&&u.getLocation(n,bt.LEFT)!==k.NONE&&(i=u.getLocation(n,bt.LEFT))}if(i===k.NONE)return null;for(var c=i,m=this.iterator();m.hasNext();){var E=m.next(),A=E.getLabel();if(A.getLocation(n,bt.ON)===k.NONE&&A.setLocation(n,bt.ON,c),A.isArea(n)){var U=A.getLocation(n,bt.LEFT),$=A.getLocation(n,bt.RIGHT);if($!==k.NONE){if($!==c)throw new lo("side location conflict",E.getCoordinate());U===k.NONE&&b.shouldNeverReachHere("found single null side (at "+E.getCoordinate()+")"),c=U}else b.isTrue(A.getLocation(n,bt.LEFT)===k.NONE,"found single null side"),A.setLocation(n,bt.RIGHT,c),A.setLocation(n,bt.LEFT,c)}}},jn.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},jn.prototype.print=function(n){Nt.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},jn.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},jn.prototype.checkAreaLabelsConsistent=function(n){var i=this.getEdges();if(i.size()<=0)return!0;var s=i.size()-1,u=i.get(s).getLabel().getLocation(n,bt.LEFT);b.isTrue(u!==k.NONE,"Found unlabelled area edge");for(var c=u,m=this.iterator();m.hasNext();){var E=m.next().getLabel();b.isTrue(E.isArea(n),"Found non-area edge");var A=E.getLocation(n,bt.LEFT),U=E.getLocation(n,bt.RIGHT);if(A===U||U!==c)return!1;c=A}return!0},jn.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},jn.prototype.iterator=function(){return this.getEdges().iterator()},jn.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new Q(this._edgeMap.values())),this._edgeList},jn.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===k.NONE&&(this._ptInAreaLocation[n]=Xr.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},jn.prototype.toString=function(){var n=new pt;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(\`
|
|
93
102
|
\`);for(var i=this.iterator();i.hasNext();){var s=i.next();n.append(s),n.append(\`
|
|
@@ -3773,7 +3782,7 @@ three/build/three.module.js:
|
|
|
3773
3782
|
* along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.
|
|
3774
3783
|
*)
|
|
3775
3784
|
*/
|
|
3776
|
-
`)}var D=y("three");var _=y("three"),H=class extends _.BufferGeometry{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new _.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(n){this.setGeometry(n,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(n){this.setPoints(n,this.widthCallback)}}})}};H.prototype.setMatrixWorld=function(o){this.matrixWorld=o};H.prototype.setGeometry=function(o,n){this._geometry=o,this.setPoints(o.getAttribute("position").array,n)};H.prototype.setPoints=function(o,n){if(!(o instanceof Float32Array)&&!(o instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=o,this.widthCallback=n,this.positions=[],this.counters=[],o.length&&o[0]instanceof _.Vector3)for(var t=0;t<o.length;t++){var e=o[t],i=t/o.length;this.positions.push(e.x,e.y,e.z),this.positions.push(e.x,e.y,e.z),this.counters.push(i),this.counters.push(i)}else for(var t=0;t<o.length;t+=3){var i=t/o.length;this.positions.push(o[t],o[t+1],o[t+2]),this.positions.push(o[t],o[t+1],o[t+2]),this.counters.push(i),this.counters.push(i)}this.process()};function ji(o,n){var t=new _.Matrix4,e=new _.Ray,i=new _.Sphere,r=new _.Vector3,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(this.matrixWorld),o.ray.intersectSphere(i,r)!==!1){t.copy(this.matrixWorld).invert(),e.copy(o.ray).applyMatrix4(t);var
|
|
3785
|
+
`)}var D=y("three");var _=y("three"),H=class extends _.BufferGeometry{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new _.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(n){this.setGeometry(n,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(n){this.setPoints(n,this.widthCallback)}}})}};H.prototype.setMatrixWorld=function(o){this.matrixWorld=o};H.prototype.setGeometry=function(o,n){this._geometry=o,this.setPoints(o.getAttribute("position").array,n)};H.prototype.setPoints=function(o,n){if(!(o instanceof Float32Array)&&!(o instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=o,this.widthCallback=n,this.positions=[],this.counters=[],o.length&&o[0]instanceof _.Vector3)for(var t=0;t<o.length;t++){var e=o[t],i=t/o.length;this.positions.push(e.x,e.y,e.z),this.positions.push(e.x,e.y,e.z),this.counters.push(i),this.counters.push(i)}else for(var t=0;t<o.length;t+=3){var i=t/o.length;this.positions.push(o[t],o[t+1],o[t+2]),this.positions.push(o[t],o[t+1],o[t+2]),this.counters.push(i),this.counters.push(i)}this.process()};function ji(o,n){var t=new _.Matrix4,e=new _.Ray,i=new _.Sphere,r=new _.Vector3,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(this.matrixWorld),o.ray.intersectSphere(i,r)!==!1){t.copy(this.matrixWorld).invert(),e.copy(o.ray).applyMatrix4(t);var l=new _.Vector3,u=new _.Vector3,a=new _.Vector3,h=this instanceof _.LineSegments?2:1,p=s.index,f=s.attributes;if(p!==null)for(var m=p.array,c=f.position.array,d=f.width.array,g=0,v=m.length-1;g<v;g+=h){var L=m[g],C=m[g+1];l.fromArray(c,L*3),u.fromArray(c,C*3);var x=d[Math.floor(g/3)]!==void 0?d[Math.floor(g/3)]:1,w=o.params.Line.threshold+this.material.lineWidth*x/2,dt=w*w,lt=e.distanceSqToSegment(l,u,r,a);if(!(lt>dt)){r.applyMatrix4(this.matrixWorld);var Ut=o.ray.origin.distanceTo(r);Ut<o.near||Ut>o.far||(n.push({distance:Ut,point:a.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}),g=v)}}}}H.prototype.raycast=ji;H.prototype.compareV3=function(o,n){var t=o*6,e=n*6;return this.positions[t]===this.positions[e]&&this.positions[t+1]===this.positions[e+1]&&this.positions[t+2]===this.positions[e+2]};H.prototype.copyV3=function(o){var n=o*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]};H.prototype.getDistance=function(o){let n=0;for(let t=0;t<o;t++){let e=6*t,i=new _.Vector3(this.positions[e],this.positions[e+1],this.positions[e+2]),r=new _.Vector3(this.positions[e+6],this.positions[e+7],this.positions[e+8]),s=i.distanceTo(r);n+=s}return n};H.prototype.process=function(){var o=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var n;let t=this.getDistance(o-1);var e;this.compareV3(0,o-1)?e=this.copyV3(o-2):e=this.copyV3(0),this.previous.push(e[0],e[1],e[2]),this.previous.push(e[0],e[1],e[2]);for(var i=0;i<o;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?n=this.widthCallback(i/(o-1)):n=1,this.width.push(n),this.width.push(n),i===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(i===o-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(i)/t;this.uvs.push(s,0),this.uvs.push(s,1)}if(i<o-1){e=this.copyV3(i),this.previous.push(e[0],e[1],e[2]),this.previous.push(e[0],e[1],e[2]);var r=i*2;this.indices_array.push(r,r+1,r+2),this.indices_array.push(r+2,r+1,r+3)}i>0&&(e=this.copyV3(i),this.next.push(e[0],e[1],e[2]),this.next.push(e[0],e[1],e[2]))}this.compareV3(o-1,0)?e=this.copyV3(1):e=this.copyV3(o-1),this.next.push(e[0],e[1],e[2]),this.next.push(e[0],e[1],e[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new _.BufferAttribute(new Float32Array(this.positions),3),previous:new _.BufferAttribute(new Float32Array(this.previous),3),next:new _.BufferAttribute(new Float32Array(this.next),3),side:new _.BufferAttribute(new Float32Array(this.side),1),width:new _.BufferAttribute(new Float32Array(this.width),1),uv:new _.BufferAttribute(new Float32Array(this.uvs),2),index:new _.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new _.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Fe(o,n,t,e,i){var r;if(o=o.subarray||o.slice?o:o.buffer,t=t.subarray||t.slice?t:t.buffer,o=n?o.subarray?o.subarray(n,i&&n+i):o.slice(n,i&&n+i):o,t.set)t.set(o,e);else for(r=0;r<o.length;r++)t[r+e]=o[r];return t}H.prototype.advance=function(o){var n=this._attributes.position.array,t=this._attributes.previous.array,e=this._attributes.next.array,i=n.length;Fe(n,0,t,0,i),Fe(n,6,n,0,i-6),n[i-6]=o.x,n[i-5]=o.y,n[i-4]=o.z,n[i-3]=o.x,n[i-2]=o.y,n[i-1]=o.z,Fe(n,6,e,0,i-6),e[i-6]=o.x,e[i-5]=o.y,e[i-4]=o.z,e[i-3]=o.x,e[i-2]=o.y,e[i-1]=o.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};_.ShaderChunk.meshline_vert=["",_.ShaderChunk.logdepthbuf_pars_vertex,_.ShaderChunk.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",_.ShaderChunk.logdepthbuf_vertex,_.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",_.ShaderChunk.fog_vertex,"}"].join(`
|
|
3777
3786
|
`);_.ShaderChunk.meshline_frag=["",_.ShaderChunk.fog_pars_fragment,_.ShaderChunk.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","uniform float thresholdRatio;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {","",_.ShaderChunk.logdepthbuf_fragment,""," vec4 c = vColor;"," if( useMap == 1. ) c *= texture2D( map, vUV * repeat );"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","",_.ShaderChunk.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
|
|
3778
|
-
`);var Ot=class extends _.ShaderMaterial{constructor(n){super({uniforms:Object.assign({},_.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new _.Color(16777215)},opacity:{value:1},resolution:{value:new _.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new _.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:_.ShaderChunk.meshline_vert,fragmentShader:_.ShaderChunk.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(n)}};Ot.prototype.copy=function(o){return _.ShaderMaterial.prototype.copy.call(this,o),this.lineWidth=o.lineWidth,this.map=o.map,this.useMap=o.useMap,this.alphaMap=o.alphaMap,this.useAlphaMap=o.useAlphaMap,this.color.copy(o.color),this.opacity=o.opacity,this.resolution.copy(o.resolution),this.sizeAttenuation=o.sizeAttenuation,this.dashArray.copy(o.dashArray),this.dashOffset.copy(o.dashOffset),this.dashRatio.copy(o.dashRatio),this.useDash=o.useDash,this.visibility=o.visibility,this.alphaTest=o.alphaTest,this.repeat.copy(o.repeat),this};var ni="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 ii={texture_url:ni,lineWidth:8,color:16777215},xe=class extends D.Object3D{constructor(t,e){super();this.navigation=t;this.config=Object.assign({},ii,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}mesh=null;geometry=null;material=null;texture=null;config=ii;points=[];pathDistance=0;basicRepeat=1;prevCameraZoom=0;registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate)}onControlChange=()=>{let t=this.navigation.bmap.context.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.changeRepeat())};onUpdate=()=>{this.texture};getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:i,height:r}}}}}=this,s=t.map(([u,l])=>E(new D.Vector3(u,l,0),e,i,r)).map(({x:u,y:l})=>[u,l]);return ht(s)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new D.Vector2(t,1)}loadTexture(t){return new Promise((e,i)=>{new D.TextureLoader().load(t,e,void 0,i)})}transformPoints(t){let e=[];for(let i=0;i<t.length;i++)e.push(...t[i],0);return e}updatePoints(t){this.points=t,this.pathDistance=ht(t),this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){if(!this.material||!this.pathDistance)return;let e=t/this.pathDistance;this.material.thresholdRatio=e}async create(t){let e=this.geometry=new H;if(this.updatePoints(t),!this.texture){let s=this.texture=await this.loadTexture(this.config.texture_url);s.wrapS=s.wrapT=D.RepeatWrapping}let i=this.material=new Ot({useMap:!0,color:new D.Color(this.config.color),transparent:!0,resolution:new D.Vector2(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:D.NormalBlending,repeat:new D.Vector2(this.getRepeat(),1)}),r=this.mesh=new D.Mesh(e,i);return r.renderOrder=9,this.add(r),r}dispose(){this.unRegistryEvent(),this.clear(),this.geometry?.dispose(),this.material?.dispose(),this.texture?.dispose()}};var Ft=y("@tweenjs/tween.js"),tt=y("three"),$i={path:{},speed:10,cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},loadRoad:!0,roadNetwork:"RoadNetwork"},ri=class extends st{path=null;worker=Oe();fetchRoadStatus=!1;uniqueKey=new Tt;paths=[];options;pathTween=new Ft.Group;startPoi=null;movedDistance=0;pathStart=[0,0];animationPathOptions={cPathIndex:0};cPath=[];constructor(n,t,e={}){super(n),this.options=Object.assign({},$i,e);let{apiDomain:i,apiPath:{roadNetwork:r},apiInfo:s}=this.bmap.config;this.registryEvent(),this.options.loadRoad&&Pt(this.worker,"load_road",{url:`${i||location.origin}${r}?project=${t}`,...s}).then(a=>{this.fetchRoadStatus=!0,this.dispatchEvent({type:"fetch-road-status",status:!0}),this.dispatchEvent({type:"fetch-road-data",roadInfo:a})}).catch(a=>{console.log("[\u52A0\u8F7D\u8DEF\u7F51\u5931\u8D25]",a)}),this.options.roadNetwork!=="RoadNetwork"&&Pt(this.worker,"change_road_network",this.options.roadNetwork)}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor)}onUpdate=()=>{this.pathTween.update()};async setRoadData(n){this.fetchRoadStatus=!1,this.dispatchEvent({type:"fetch-road-status",status:!1}),await Pt(this.worker,"set_road_info",n),this.fetchRoadStatus=!0,this.dispatchEvent({type:"fetch-road-status",status:!0})}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.pathTween.getAll().forEach(n=>n.stop()),this.pathTween.removeAll()),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null)}onSwitchFloor=({data:{curFloor:n}})=>{if(this.paths.length){let t=this.paths.find(e=>e.floor===n.name);t?this.renderPath(this.translatePoints(t.points)):this.clearPath()}else this.clearPath()};getDirectionPath(n){return Pt(this.worker,"get_direction_path",n)}addPath(n){this.paths=n;let t=this.bmap.context.currentFloor?.name,e=n.find(i=>i.floor===t);if(e)if(this.bmap.currentBuildGround)this.renderPath(this.translatePoints(e.points));else{let i=()=>{this.bmap.removeEventListener("center-change",i),this.renderPath(this.translatePoints(e.points))};this.bmap.addEventListener("center-change",i)}else this.clearPath()}translatePoints(n){let[t,e]=this.bmap.buildingCenter;return n.map(i=>[i[0]-t,i[1]-e])}getPath(n,t,e=""){return new Promise((i,r)=>{let s=()=>{Pt(this.worker,"get_path",{start:n,end:t,type:e}).then(a=>{a?typeof a=="string"?r(a):i(a):r("no-path")})};if(this.fetchRoadStatus)s();else{let a=({status:u})=>{u&&(this.removeEventListener("fetch-road-status",a),s())};this.addEventListener("fetch-road-status",a)}})}renderPath(n){let t=this.catmullRomCurve3(n);this.cPath=t,this.animationPathOptions={cPathIndex:0},this.movedDistance=0,this.pathStart=t[0],this.path?this.path.updatePoints(t):(this.path=new xe(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 k(this.bmap.context,{...this.options.startPoi,id:"navigation_start_poi",position:{x:t[0][0],y:t[0][1],z:1e-4},collision_enable:!1})||null,this.bmap.context.currentFloor?.poiLayer2.pushPoi(this.startPoi))}catmullRomCurve3(n){return fn(n,!1,!0,.1,150,2.5)}async animationTo(n,t=this.options.speed){if(n.floor!==this.bmap.context.currentFloor?.name||!this.path)return;let{animationPathOptions:{cPathIndex:e}}=this,i=[this.pathStart,...this.cPath.slice(e+1)],r=this.translatePoints([n.pos])[0],{distance:s,pos:a,index:u}=i.reduce((g,v,P,C)=>{if(P===C.length-1)return g;let{distance:x,closestPoint:w}=dn(r,v,C[P+1]);return x<g.distance&&(g.distance=x,g.pos=w,g.index=P),g},{distance:Number.MAX_SAFE_INTEGER,pos:n.pos,index:0});if(s>this.options.cheapMaximumDistance||this.path.points[0][0]===a[0]&&this.path.points[0][1]===a[1])return;let l=0,h=[];if(u===0)l=R(i[0],a),h=[l];else{h=[R(i[0],i[1])];for(let g=1;g<u;g++)h.push(R(i[g],i[g+1]));h.push(R(i[u],a)),l=h.reduce((g,v)=>g+v,0)}let p=l/t;this.pathTween.getAll().forEach(g=>g.stop()),this.pathTween.removeAll();let f={distance:0},m=this.animationPathOptions.cPathIndex,c=0,d=0;return new Promise(g=>{let v=new Ft.Tween(f,this.pathTween).to({distance:l},p*1e3).onUpdate(async()=>{let P=f.distance-c;for(;h.length&&P>h[0];)c+=h.shift(),d++,P=f.distance-c;let C=i[d],x=i[d+1];if(!x)return;let w=gn(C,x,P);if(this.pathStart=w,this.path?.movePath(this.movedDistance+f.distance),this.animationPathOptions.cPathIndex=m+d,this.startPoi){this.startPoi.position.setX(w[0]).setY(w[1]);let ft=new tt.Vector3(w[0],w[1],0),lt=new tt.Vector3;lt.setFromMatrixColumn(this.bmap.context.camera.matrix,1),lt.normalize(),lt.multiplyScalar(150/this.bmap.context.camera.zoom),ft.add(lt),this.bmap.context.setCameraPosition(ft,0)}v.pause(),await this.changeCameraToPathUp(500),v.resume(),this.dispatchEvent({type:"path-animation",pathIndex:this.animationPathOptions.cPathIndex})}).onComplete(()=>{this.pathTween.remove(v),this.dispatchEvent({type:"path-animation-end"}),this.movedDistance+=l,g(!0)}).start()})}getPathDirection(){let n=this.cPath.slice(this.animationPathOptions.cPathIndex);if(n.length<3)return null;let t=n[0],e=n[1],i=n[2],r=zt(t,e,i);if(Math.abs(r)>=179&&Math.abs(r)<=180){let s=new tt.Vector3(i[0]-e[0],i[1]-e[1],0).normalize(),a=new tt.Vector3(0,1,0).normalize(),u=s.angleTo(a),l=new tt.Vector3().crossVectors(a,s);return(Object.is(l.y,0)?-1:1)*u}else return null}async changeCameraToPathUp(n=100){let t=this.getPathDirection();if(t===null)return;let e=this.bmap.context.control.getAzimuthalAngle();Math.abs(e-t)>Math.PI&&(e>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:r}=this.bmap.context,s=n/Math.PI*6*i,a=150/this.bmap.context.camera.zoom,u=this.bmap.context.control.getPolarAngle(),l=this.bmap.context.control.maxPolarAngle,h=this.bmap.context.control.minPolarAngle;return this.bmap.context.control.minPolarAngle=this.bmap.context.control.maxPolarAngle=u,new Promise(p=>{let f={azimuthal:r.getAzimuthalAngle()},m={azimuthal:t},c=new Ft.Tween(f,this.pathTween).to(m,s).onUpdate(async()=>{this.bmap.context.control.target.copy(this.startPoi.position),this.bmap.context.setAzimuthalAngle(f.azimuthal,0);let d=r.target.clone(),g=new tt.Vector3;g.setFromMatrixColumn(this.bmap.context.camera.matrix,1),g.normalize(),g.multiplyScalar(a),d.add(g),this.bmap.context.setCameraPosition(d,0)}).onComplete(()=>{r.enabled=!0,this.pathTween.remove(c),this.bmap.context.control.minPolarAngle=h,this.bmap.context.control.maxPolarAngle=l,p(!0)}).onStart(()=>{r.enabled=!1}).start()})}async initNavigationCamera(){await this.translateCameraToStartPoi(300),await this.changeCameraToPathUp(300)}async translateCameraToStartPoi(n=100){if(!this.startPoi)return;let{clientSize:{width:t,height:e},camera:i,control:r}=this.bmap.context,s=Math.round(t/2),a=Math.round(e/2),u=r.target.clone(),l=E(this.startPoi.position,i,t,e),h=l.x-s,p=a-l.y+150;if(console.log(l,h,p,this.startPoi.position,s,a),!(Math.abs(h)<1&&Math.abs(p)<1)){if(Math.abs(h)>=1){let f=new tt.Vector3;f.setFromMatrixColumn(i.matrix,0),f.normalize(),f.multiplyScalar(h/i.zoom),u.add(new tt.Vector3(f.x,0,0))}if(Math.abs(p)>=1){let f=new tt.Vector3;f.setFromMatrixColumn(i.matrix,1),f.normalize(),f.multiplyScalar(p/i.zoom),u.add(new tt.Vector3(0,f.y,0))}return this.bmap.context.setCameraPosition(u,n)}}async initCameraZoom(n=100){if(!this.startPoi)return;let{clientSize:{width:t,height:e},currentFloor:i}=this.bmap.context,{max:r,min:s}=i.box,u=Math.min(t/(r.x-s.x),e/(r.y-s.y))*(r.x-s.x)/20;return this.bmap.context.setZoom(u,this.startPoi.position,n)}dispose(){this.worker.terminate(),this.unRegistryEvent(),this.path?.dispose(),this.uniqueKey.dispose(),this.startPoi?.dispose()}};var oi=class extends st{cacheData=new Map;floorDataLengthMap=new Map;async load(n){let t=Q(n);if(this.cacheData.has(t))return this.cacheData.get(t);console.time("floor/get\u8BF7\u6C42"+n.resource_type_list);let[,e]=await Promise.all([this.loadBuildGround(n),_e(n,this.bmap.config)]);console.timeEnd("floor/get\u8BF7\u6C42"+n.resource_type_list);let i=Q({floor:n.floor,ts:n.ts});this.bmap.transformGraphicData(e,this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),e.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(t,e);let r=this.floorDataLengthMap.get(i)||0;return this.floorDataLengthMap.set(i,r+e.length),e}isSameFloor(n){return this.bmap.context.currentFloor?.key===Q(n)}switchFloorByData(n,t){if(this.isSameFloor(t)){if(!n.length)return;let e=this.bmap.context.currentFloor,i=e.userData.legacyToGraphicMap,r=e.userData.graphicMap,s=[];for(let a of n){if(a.info.group==="ground")e.createGround(a.info);else{let u=e.addGraphic(a.info);u.userData.data=a,i.set(a.legacy_id,u),s.push(u)}r.set(a.element_uuid,a)}this.bmap.triggerHooks("switch_floor_before",{curFloor:e,graphics:s}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:e,graphics:s})}else{let e=Q(t),{curFloor:i,graphics:r}=this.bmap.createFloor(n);i.name=t.floor,i.key=e;let s=new Map;n.forEach(a=>{s.set(a.element_uuid,a)}),i.userData.graphicMap=s,this.bmap.triggerHooks("switch_floor_before",{curFloor:i,graphics:r}),this.bmap.context.switchFloor(i),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:i,graphics:r})}}filterData(n,t){if(!this.isSameFloor(t))return n;let e=this.bmap.context.currentFloor.userData.graphicMap;return n.filter(i=>!e.has(i.element_uuid))}async switchFloorByStoreData(n){let t=await this.load({...n,resource_type_list:"6"}),e=this.filterData(t,n);this.switchFloorByData(e,n)}async switchFloorByOtherData(n){let t=await this.load({...n,resource_type_list:"1,2,3,4"}),e=this.filterData(t,n);this.switchFloorByData(e,n)}async loadBuildGround({brand:n,project:t}){let e=Q({brand:n,project:t});return await this.bmap.loadBuildingGround({brand:n,project:t}),this.bmap.currentBuildGround=this.bmap.buildingGroundMap.get(e)||null,this.bmap.currentBuildGround}async changeFloor(n){return await Promise.all([this.switchFloorByStoreData(n),this.switchFloorByOtherData(n)]),Array.from(this.bmap.context.currentFloor.userData.graphicMap.values())}};var ai=y("three"),si=class extends st{poiLayer;floors=[];group=new ai.Group;constructor(n){super(n),this.poiLayer=new Lt(n.context)}show(n){let t=n[0].userData.height;n.forEach(r=>{r.poiLayer.pois.forEach(s=>{this.poiLayer.pushPoi(s)}),r.poiLayer.pois.length=0,r.poiLayer.dispose(),r.position.z=t,t+=r.userData.height});let{scene:e,currentFloor:i}=this.bmap.context;i&&(e.remove(i),i.dispose()),this.group.add(this.poiLayer,...n),e.add(this.group),this.floors=n,this.bmap.context.cameraBound.updateBox()}hide(){let{scene:n}=this.bmap.context;n.remove(this.group),this.poiLayer.clear(!0),this.floors.forEach(t=>{t.dispose()}),this.floors=[],this.group.clear()}fitCamera(){let{context:n,config:t,type:e}=this.bmap;n.cameraBound.setEnable(!1),n.control.minZoom=0,n.control.maxZoom=1/0,n.camera.zoom=1,n.setAzimuthalAngle(t.control.defaultAzimuthal,0),n.setPolarAngle(t.control.defaultPolar,0),n.fitCameraToObject(this.group,void 0,0);let i=n.camera.zoom;n.control.minZoom=i,n.control.maxZoom=i*25,e==="3d"&&n.fitCameraToObject(this.group,t.defaultPadding,0,!1),this.bmap.basicZoom=n.camera.zoom,n.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),n.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(n=>n.dispose()),this.floors=[]}};var et;function li(o="aibee_map"){return new Promise((n,t)=>{if(et)return n({db:et,type:"success"});let e=indexedDB.open(o);e.onupgradeneeded=function(i){et=i.target.result,console.log("onupgradeneeded"),n({db:et,type:"onupgradeneeded"})},e.onsuccess=i=>{et=i.target.result,n({db:et,type:"success"})},e.onerror=i=>{t(i)}})}function ui(o,n,t=et){return new Promise((e,i)=>{t||i("\u6CA1\u6709db");let s=t.transaction([o],"readonly").objectStore(o).get(n);s.onsuccess=()=>{s.result?e(s.result.value):e(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),e(null)}})}function hi(o,n,t,e=et){return new Promise((i,r)=>(e||r("\u6CA1\u6709db"),new Promise((s,a)=>{let l=e.transaction([o],"readwrite").objectStore(o).add({key:n,value:t});l.onsuccess=function(h){s(h)},l.onerror=function(h){a(h)}})))}function Ee(o,n=et){n&&(n.objectStoreNames.contains(o)||n.createObjectStore(o,{keyPath:"key"}))}function ci(){et?.close(),et=null}function at(o,n,t=0){o.forEach(e=>{e.geometry.coords=JSON.parse(JSON.stringify(e.geometry.cds)),e.geometry.type==="polygon"?(e.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(r=>{r[0]-=n[0],r[1]-=n[1]})}),e.geometry.otherCds&&(e.geometry.otherCoords=e.geometry.otherCds.map(i=>i.map(r=>ut(r,n)))),e.doors?.length&&e.doors.map(i=>{i.coord=ut(i.coordinate,n)})):e.geometry.coords=ut(e.geometry.cds,n)});for(let e=0;e<o.length;e++){let i=o[e];i.deltaHeight=1e-5*(t+e+1)}}function ut(o,n){return[o[0]-n[0],o[1]-n[1]]}var pi='data:image/svg+xml,<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1722508608758" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1737" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M671.672075 807.841824l-12.086033-1.711297-5.561715 10.695605a235.303309 235.303309 0 1 1-328.889852-310.172544l8.128659-4.813022v-9.519089c0.855648-28.236397-13.369506-48.45109-38.183309-54.226717l-6.738232-1.497385-5.989538 3.52955a314.450786 314.450786 0 1 0 438.519803 419.695539l3.850418-6.952143-2.887813-7.807792a60.216256 60.216256 0 0 0-50.162388-37.220705z" fill="%23ffffff" p-id="1738"></path><path d="M893.498922 805.167922c-2.994769-21.39121-16.578188-37.541573-30.268562-35.616364l-70.911861 9.839956-57.64931-189.633075a10.695605 10.695605 0 0 1 0-1.069561 37.969398 37.969398 0 0 0-35.830277-25.99032H435.620074V414.029649h157.760173v-78.826609H435.620074v-50.162387a39.466782 39.466782 0 1 0-78.826609 0v305.787346a44.065892 44.065892 0 0 0-1.711297 11.337341 39.680694 39.680694 0 0 0 17.540793 33.156376A37.755486 37.755486 0 0 0 407.918457 641.846035h260.117113l61.71364 203.216494a30.268562 30.268562 0 0 0 28.98509 19.145133h0.855648a48.985871 48.985871 0 0 0 16.364276-2.139121h0.641736l97.330005-13.369506c13.79733-2.887813 22.567726-21.92599 19.572957-43.531113zM406.955852 197.229736a98.613478 98.613478 0 1 0-98.506521-98.506521 98.506522 98.506522 0 0 0 98.506521 98.506521z" fill="%23ffffff" p-id="1739"></path></svg>';var fi='data:image/svg+xml,<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1722508633972" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3840" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M568 171.84v285.312h144.64a12.8 12.8 0 0 1 10.816 19.648l-243.84 382.208a12.8 12.8 0 0 1-23.616-6.848V566.848h-144.64a12.8 12.8 0 0 1-10.816-19.648l243.84-382.208a12.8 12.8 0 0 1 23.616 6.848z" fill="%23ffffff" fill-opacity=".88" p-id="3841"></path></svg>';var di='data:image/svg+xml,<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1722508689425" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9597" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M354.1 768.4l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z" p-id="9598" fill="%23ffffff"></path><path d="M354.3 769.6v15.9c0 0.3 0 0.6-0.1 0.9h-63.1c-0.1-0.3-0.1-0.6-0.1-0.9V762v-0.6l63.1 7.1c0.1 0.3 0.2 0.7 0.2 1.1z" p-id="9599" fill="%23ffffff"></path><path d="M354.3 769.6v15.9c0 0.3 0 0.6-0.1 0.9h-63.1c-0.1-0.3-0.1-0.6-0.1-0.9V762v-0.6l63.1 7.1c0.1 0.3 0.2 0.7 0.2 1.1zM729.7 761.9v23.5c0 0.3 0 0.6-0.1 0.9h-63.1c-0.1-0.3-0.1-0.6-0.1-0.9v-15.9c0-0.4 0.1-0.8 0.2-1.1l63.1-7.1v0.6z" p-id="9600" fill="%23ffffff"></path><path d="M729.7 761.9v23.5c0 0.3 0 0.6-0.1 0.9h-63.1c-0.1-0.3-0.1-0.6-0.1-0.9v-15.9c0-0.4 0.1-0.8 0.2-1.1l63.1-7.1v0.6zM158.3 132.8h50.6v38h-50.6zM253.8 132.8h50.6v38h-50.6zM353.8 132.8h50.6v38h-50.6zM441.3 132.8h139.2v38H441.3zM614.8 132.8h50.6v38h-50.6zM711.6 132.8h50.6v38h-50.6zM809.1 132.8h50.6v38h-50.6z" p-id="9601" fill="%23ffffff"></path><path d="M158.3 132.8h50.6v38h-50.6zM253.8 132.8h50.6v38h-50.6zM353.8 132.8h50.6v38h-50.6zM441.3 132.8h139.2v38H441.3zM614.8 132.8h50.6v38h-50.6zM711.6 132.8h50.6v38h-50.6zM809.1 132.8h50.6v38h-50.6z" p-id="9602" fill="%23ffffff"></path><path d="M967.6 202.4V101.2c0-24.4-19.8-44.3-44.3-44.3H100.7c-24.5 0-44.3 19.8-44.3 44.3v101.3c0 24 19.2 43.6 43 44.3v673.8h-24c-10.5 0-19 8.5-19 19s8.5 19 19 19h873.2c10.5 0 19-8.5 19-19s-8.5-19-19-19h-22.8v-674c23.3-1.3 41.8-20.6 41.8-44.2z m-873.2 0V101.2c0-3.5 2.8-6.3 6.3-6.3h822.6c3.5 0.1 6.3 2.9 6.3 6.3v101.3c0 3.5-2.8 6.3-6.3 6.3H100.7c-3.4-0.1-6.3-3-6.3-6.4zM253 785.5V762c0-11.9 4.9-23 13.5-30.4 7.5-6.6 17.5-9.5 27.4-8.1l66.7 7.5c18.3 2.8 31.6 19.3 31.6 38.6v15.9c0 21.4-16.1 38.9-35.9 38.9H289c-19.9-0.1-36-17.5-36-38.9z m60.3 116c0 10.5-8.5 19-19 19s-19-8.5-19-19V884l38 0.2v17.3z m34.5 19c2.1-6 3.5-12.3 3.5-19v-17.1l159.7 0.8h0.2l155.2-0.8v17.1c0 6.7 1.4 13 3.5 19H347.8z m394.5-19c0 10.5-8.5 19-19 19s-19-8.5-19-19v-17.3l38-0.2v17.5z m25.3-116.1c0 21.4-16.1 38.9-35.9 38.9h-67.3c-19.8 0-35.9-17.4-35.9-38.9v-15.9c0-19.3 13.3-35.8 30.9-38.5l68.1-7.7c9.1-1.4 19 1.6 26.7 8.2 8.6 7.4 13.5 18.5 13.5 30.4v23.5zM611.1 661.7c4.1-12.8 15.9-22.1 30-22.1s26 9.4 30 22.1h-60z m98.8-0.2c-4.7-33.8-33.8-59.9-68.8-59.9-35.1 0-64.2 26.2-68.9 60.1H315.9c-27 0-45.6-10.5-63.7-26.7 2.9-7.8 5.7-15.4 8.2-22.2 3.7-10 6.7-18.2 8.3-22.7 0.9-2.6 1.7-5.2 2.2-7.8l27.9-75.6c20.8-54.4 74.5-55.6 76.7-55.7h270c0.6 0 55.3 0.6 77.9 55.4l27.9 75.8c0.6 2.7 1.3 5.2 2.2 7.8l8.3 22.6c2.4 6.4 5.1 13.9 7.9 21.6-19.7 16.3-35.4 26.3-59.8 27.3z m178 259H776.8c2.1-6 3.5-12.3 3.5-19v-17.7h2c15.1 0.1 29.6-5.8 40.3-16.5 11.3-11.2 17.6-26.4 17.5-42.3v-83.2c0-17.6-13.8-62.2-13.9-62.7-2.7-8.4-15.1-42.4-28.8-79.5l-8.2-22.4c-0.4-1.1-0.7-2.3-0.9-3.5-0.2-1.1-0.5-2.1-0.9-3.1l-28.7-77.9c-32.3-78.7-110-79.6-113.2-79.6h-270c-3.3 0-81.9 0.9-112.2 80.3l-28.4 77.2c-0.4 1-0.7 2.1-0.9 3.1-0.2 1.2-0.5 2.3-0.9 3.5-1.6 4.4-4.6 12.6-8.3 22.5-10.6 28.8-25.2 68.1-28.7 79.5-0.2 0.4-13.9 44.9-13.9 62.6V825c-0.1 15.9 6.2 31.1 17.5 42.3 10.3 10.2 23.9 15.6 37.8 16.3v17.9c0 6.7 1.4 13 3.5 19H137.4V246.7h750.5v673.8z" p-id="9603" fill="%23ffffff"></path><path d="M441.3 132.8h139.2v38H441.3zM353.8 132.8h50.6v38h-50.6zM253.8 132.8h50.6v38h-50.6zM158.3 132.8h50.6v38h-50.6zM809.1 132.8h50.6v38h-50.6zM711.6 132.8h50.6v38h-50.6zM614.8 132.8h50.6v38h-50.6z" p-id="9604" fill="%23ffffff"></path></svg>';var Uu={loadRoadNetwork:!1},be="version",Ue="map_data",Me="road_network_data",gi={half:pi,power:fi,mechanical:di},mi=class{constructor(n){this.bmap=n;this.initDb()}floors=[];async initDb(){try{let{db:n,type:t}=await li();t==="onupgradeneeded"&&(Ee(be),Ee(Ue),Ee(Me))}catch(n){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",n)}}async load(n){if(this.clear(),Array.isArray(n))this.floors=n;else{let t=await fetch(n).then(e=>e.json());t.code==="0"&&(this.floors=t.data.list)}}setCacheData(n,t,e){return hi(n,`${t}`,e)}getCacheData(n,t){return ui(n,`${t}`)}getFloorCacheKey(n){return`${n.floor_id}`}async getFloorData(n){let t=this.floors.find(i=>i.floor===n);if(!t)return null;let e=this.getFloorCacheKey(t);try{if(await this.getCacheData(be,e)===t.version_id){let r=await this.getCacheData(Ue,e);if(r)return this.getDataByJson(r)}return this.getFloorDataByFloorInfo(t)}catch{return this.getFloorDataByFloorInfo(t)}}async getFloorDataByFloorInfo(n){let t=this.getFloorCacheKey(n);console.time("zstd_json");let e=await fetch(n.map_url).then(i=>i.json());return e.floor=n.floor,console.timeEnd("zstd_json"),this.setCacheData(Ue,t,e),this.setCacheData(be,t,n.version_id),this.getDataByJson(e)}async getRoadNetworkData(){return(await Promise.all(this.floors.map(async t=>{let e=this.getFloorCacheKey(t);try{if(await this.getCacheData(be,e)===t.version_id){let s=await this.getCacheData(Me,e);if(s)return s}let r=await fetch(t.route_url).then(s=>s.json());return this.setCacheData(Me,e,r),r}catch{let i=await fetch(t.route_url).then(r=>r.json());return this.setCacheData(Me,e,i),i}}))).filter(t=>t.points)}async getOtherDataByFreeTime(){}async getMulFloorsData(n){return Promise.all(n.map(t=>this.getFloorData(t))).then(t=>t.filter(e=>e))}async getDataByUrl(n){let t=await fetch(n).then(e=>e.json());return this.getDataByJson(t)}getDataByJson(n){let t=new rt(this.bmap.context);t.userData.graphics=[],t.userData.graphicMap=new Map;let e=[0,0];return n.layers.forEach(i=>{switch(i.l_type){case"range":let r=i.elements[0];e=[r.center_x,r.center_y];break;case"graph":at(i.elements,e);let s=[];i.elements.forEach(c=>{c.group==="ground"?t.createGround(c):s.push(c)});let a=s.reduce((c,d)=>{let{fillColor:g,fillOpacity:v,strokeColor:P,strokeOpacity:C,height:x}=d,w=`${g.toLowerCase()}-${v}-${P.toLowerCase()}-${C}-${x}`;return C===0&&(w=`${g.toLowerCase()}-${v}-${x}`),c[w]?c[w].push(d):c[w]=[d],c},{});Object.values(a).forEach(c=>{let d=new ue(this.bmap.context,c);t.mergeGraphicLayer.add(d)});break;case"ground":at(i.elements,e);let u=i.elements.map(c=>new U(this.bmap.context,c));t.addGrounds(u);break;case"wall":at(i.elements,e);let l=i.elements.reduce((c,d)=>{let{fillColor:g,fillOpacity:v,strokeColor:P,strokeOpacity:C,height:x}=d,w=`${g.toLowerCase()}-${v}-${P.toLowerCase()}-${C}-${x}`;return C===0&&(w=`${g.toLowerCase()}-${v}-${x}`),c[w]?c[w].push(d):c[w]=[d],c},{});Object.values(l).forEach(c=>{let d=new se(this.bmap.context,c);t.wallLayer.add(d)});break;case"lane":at(i.elements,e);let h=i.elements.reduce((c,d)=>{let{fillColor:g,fillOpacity:v,strokeColor:P,strokeOpacity:C}=d,x=`${g.toLowerCase()}-${v}-${P.toLowerCase()}-${C}`;return C===0&&(x=`${g.toLowerCase()}-${v}`),c[x]?c[x].push(d):c[x]=[d],c},{});Object.values(h).forEach(c=>{let d=new le(this.bmap.context,c);t.laneLayer.add(d)});break;case"texture2d":case"texture3d":if(at(i.elements,e),i.elements.length){let c=new Dt(this.bmap.context,i.elements);t.textureLayer.add(c)}break;case"glb":at(i.elements,e),i.elements.forEach(c=>{let d=ut([c.center_x,c.center_y],e),g=new ae(this.bmap.context,{...c,url:c.secondUrl,rotate:c.secondRotate,width:c.secondWidth,center_x:d[0],center_y:d[1]});t.glbModelLayer.add(g)});break;case"store":at(i.elements,e),i.elements.map(c=>{let d=ut([c.center_x,c.center_y],e),g=t.addGraphic(c);t.userData.graphics.push(g),t.userData.graphicMap.set(c.id,g);let v=new k(this.bmap.context,{id:c.id,icon:c.poi_info.icon,text:c.poi_info.showName||c.store_name||c.poi_info.text,position:{x:d[0],y:d[1],z:c.airHeight+c.height},icon_size:[18,18]});t.poiLayer2.pushPoi(v),v&&(v.userData.type="store",v.userData.data=c)});break;case"facility":at(i.elements,e),i.elements.map(c=>{let d=ut(c.geometry.cds,e),g=t.addGraphic(c);if(t.userData.graphics.push(g),t.userData.graphicMap.set(c.id,g),c.poi_info){let v=new k(this.bmap.context,{id:c.id,icon:c.poi_info.icon,text:c.poi_info.showName||c.store_name||c.poi_info.text,position:{x:d[0],y:d[1],z:c.airHeight+c.height},icon_size:[18,18]});t.poiLayer2.pushPoi(v),v.userData.type="facility",v.userData.data=c}});break;case"parkingSpace":at(i.elements,e);let p=[],f=new Map;i.elements.forEach(c=>{let d=t.addGraphic(c);p.push(d),f.set(c.id,d);let g=ut([c.center_x,c.center_y],e);if(c.texts[0]){let v=new k(this.bmap.context,{id:c.id,text:c.texts[0],position:{x:g[0],y:g[1],z:c.airHeight+c.height}});v&&(v.userData.type="parkingSpace",v.userData.data=c),t.poiLayer2.pushPoi(v)}});let m=i.elements.filter(c=>gi[c.parkingType]).map(c=>{let d=ut([c.center_x,c.center_y],e),g=Je(c.geometry.coords,d);return{uuid:c.id,iconUrl:gi[c.parkingType],name:c.texts[0],deltaHeight:c.deltaHeight,airHeight:c.airHeight,height:c.height,geometry:{...c.geometry,coords:g},opacity:c.fillOpacity,visible:!0}});if(m.length){let c=new Dt(this.bmap.context,m);t.textureLayer.add(c)}t.userData.parkingSpaces=p,t.userData.parkingSpacesGraphicMap=f;break}}),t.userData.center=e,t.userData.height=n.floorHeight,t.name=n.floor,t.userData.data=n,t.updateBox(),t}clear(){}dispose(){this.clear(),ci()}};})();
|
|
3787
|
+
`);var Ot=class extends _.ShaderMaterial{constructor(n){super({uniforms:Object.assign({},_.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new _.Color(16777215)},opacity:{value:1},resolution:{value:new _.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new _.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:_.ShaderChunk.meshline_vert,fragmentShader:_.ShaderChunk.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(n)}};Ot.prototype.copy=function(o){return _.ShaderMaterial.prototype.copy.call(this,o),this.lineWidth=o.lineWidth,this.map=o.map,this.useMap=o.useMap,this.alphaMap=o.alphaMap,this.useAlphaMap=o.useAlphaMap,this.color.copy(o.color),this.opacity=o.opacity,this.resolution.copy(o.resolution),this.sizeAttenuation=o.sizeAttenuation,this.dashArray.copy(o.dashArray),this.dashOffset.copy(o.dashOffset),this.dashRatio.copy(o.dashRatio),this.useDash=o.useDash,this.visibility=o.visibility,this.alphaTest=o.alphaTest,this.repeat.copy(o.repeat),this};var ni="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 ii={texture_url:ni,lineWidth:8,color:16777215},xe=class extends D.Object3D{constructor(t,e){super();this.navigation=t;this.config=Object.assign({},ii,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}mesh=null;geometry=null;material=null;texture=null;config=ii;points=[];pathDistance=0;basicRepeat=1;prevCameraZoom=0;registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate)}onControlChange=()=>{let t=this.navigation.bmap.context.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.changeRepeat())};onUpdate=()=>{this.texture};getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:i,height:r}}}}}=this,s=t.map(([u,a])=>E(new D.Vector3(u,a,0),e,i,r)).map(({x:u,y:a})=>[u,a]);return ct(s)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new D.Vector2(t,1)}loadTexture(t){return new Promise((e,i)=>{new D.TextureLoader().load(t,e,void 0,i)})}transformPoints(t){let e=[];for(let i=0;i<t.length;i++)e.push(...t[i],0);return e}updatePoints(t){this.points=t,this.pathDistance=ct(t),this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){if(!this.material||!this.pathDistance)return;let e=t/this.pathDistance;this.material.thresholdRatio=e}async create(t){let e=this.geometry=new H;if(this.updatePoints(t),!this.texture){let s=this.texture=await this.loadTexture(this.config.texture_url);s.wrapS=s.wrapT=D.RepeatWrapping}let i=this.material=new Ot({useMap:!0,color:new D.Color(this.config.color),transparent:!0,resolution:new D.Vector2(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:D.NormalBlending,repeat:new D.Vector2(this.getRepeat(),1)}),r=this.mesh=new D.Mesh(e,i);return r.renderOrder=9,this.add(r),r}dispose(){this.unRegistryEvent(),this.clear(),this.geometry?.dispose(),this.material?.dispose(),this.texture?.dispose()}};var Ft=y("@tweenjs/tween.js"),tt=y("three"),$i={path:{},speed:10,cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},loadRoad:!0,roadNetwork:"RoadNetwork"},ri=class extends st{path=null;worker=Oe();fetchRoadStatus=!1;uniqueKey=new Ct;paths=[];options;pathTween=new Ft.Group;startPoi=null;movedDistance=0;pathStart=[0,0];animationPathOptions={cPathIndex:0};cPath=[];constructor(n,t,e={}){super(n),this.options=Object.assign({},$i,e);let{apiDomain:i,apiPath:{roadNetwork:r},apiInfo:s}=this.bmap.config;this.registryEvent(),this.options.loadRoad&&Lt(this.worker,"load_road",{url:`${i||location.origin}${r}?project=${t}`,...s}).then(l=>{this.fetchRoadStatus=!0,this.dispatchEvent({type:"fetch-road-status",status:!0}),this.dispatchEvent({type:"fetch-road-data",roadInfo:l})}).catch(l=>{console.log("[\u52A0\u8F7D\u8DEF\u7F51\u5931\u8D25]",l)}),this.options.roadNetwork!=="RoadNetwork"&&Lt(this.worker,"change_road_network",this.options.roadNetwork)}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor)}onUpdate=()=>{this.pathTween.update()};async setRoadData(n){this.fetchRoadStatus=!1,this.dispatchEvent({type:"fetch-road-status",status:!1}),await Lt(this.worker,"set_road_info",n),this.fetchRoadStatus=!0,this.dispatchEvent({type:"fetch-road-status",status:!0})}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.pathTween.getAll().forEach(n=>n.stop()),this.pathTween.removeAll()),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null)}onSwitchFloor=({data:{curFloor:n}})=>{if(this.paths.length){let t=this.paths.find(e=>e.floor===n.name);t?this.renderPath(this.translatePoints(t.points)):this.clearPath()}else this.clearPath()};getDirectionPath(n){return Lt(this.worker,"get_direction_path",n)}addPath(n){this.paths=n;let t=this.bmap.context.currentFloor?.name,e=n.find(i=>i.floor===t);if(e)if(this.bmap.currentBuildGround)this.renderPath(this.translatePoints(e.points));else{let i=()=>{this.bmap.removeEventListener("center-change",i),this.renderPath(this.translatePoints(e.points))};this.bmap.addEventListener("center-change",i)}else this.clearPath()}translatePoints(n){let[t,e]=this.bmap.buildingCenter;return n.map(i=>[i[0]-t,i[1]-e])}getPath(n,t,e=""){return new Promise((i,r)=>{let s=()=>{Lt(this.worker,"get_path",{start:n,end:t,type:e}).then(l=>{l?typeof l=="string"?r(l):i(l):r("no-path")})};if(this.fetchRoadStatus)s();else{let l=({status:u})=>{u&&(this.removeEventListener("fetch-road-status",l),s())};this.addEventListener("fetch-road-status",l)}})}renderPath(n){let t=this.catmullRomCurve3(n);this.cPath=t,this.animationPathOptions={cPathIndex:0},this.movedDistance=0,this.pathStart=t[0],this.path?this.path.updatePoints(t):(this.path=new xe(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 k(this.bmap.context,{...this.options.startPoi,id:"navigation_start_poi",position:{x:t[0][0],y:t[0][1],z:1e-4},collision_enable:!1})||null,this.bmap.context.currentFloor?.poiLayer2.pushPoi(this.startPoi))}catmullRomCurve3(n){return fn(n,!1,!0,.1,150,2.5)}async animationTo(n,t=this.options.speed){if(n.floor!==this.bmap.context.currentFloor?.name||!this.path)return;let{animationPathOptions:{cPathIndex:e}}=this,i=[this.pathStart,...this.cPath.slice(e+1)],r=this.translatePoints([n.pos])[0],{distance:s,pos:l,index:u}=i.reduce((g,v,L,C)=>{if(L===C.length-1)return g;let{distance:x,closestPoint:w}=dn(r,v,C[L+1]);return x<g.distance&&(g.distance=x,g.pos=w,g.index=L),g},{distance:Number.MAX_SAFE_INTEGER,pos:n.pos,index:0});if(s>this.options.cheapMaximumDistance||this.path.points[0][0]===l[0]&&this.path.points[0][1]===l[1])return;let a=0,h=[];if(u===0)a=I(i[0],l),h=[a];else{h=[I(i[0],i[1])];for(let g=1;g<u;g++)h.push(I(i[g],i[g+1]));h.push(I(i[u],l)),a=h.reduce((g,v)=>g+v,0)}let p=a/t;this.pathTween.getAll().forEach(g=>g.stop()),this.pathTween.removeAll();let f={distance:0},m=this.animationPathOptions.cPathIndex,c=0,d=0;return new Promise(g=>{let v=new Ft.Tween(f,this.pathTween).to({distance:a},p*1e3).onUpdate(async()=>{let L=f.distance-c;for(;h.length&&L>h[0];)c+=h.shift(),d++,L=f.distance-c;let C=i[d],x=i[d+1];if(!x)return;let w=gn(C,x,L);if(this.pathStart=w,this.path?.movePath(this.movedDistance+f.distance),this.animationPathOptions.cPathIndex=m+d,this.startPoi){this.startPoi.position.setX(w[0]).setY(w[1]);let dt=new tt.Vector3(w[0],w[1],0),lt=new tt.Vector3;lt.setFromMatrixColumn(this.bmap.context.camera.matrix,1),lt.normalize(),lt.multiplyScalar(150/this.bmap.context.camera.zoom),dt.add(lt),this.bmap.context.setCameraPosition(dt,0)}v.pause(),await this.changeCameraToPathUp(500),v.resume(),this.dispatchEvent({type:"path-animation",pathIndex:this.animationPathOptions.cPathIndex})}).onComplete(()=>{this.pathTween.remove(v),this.dispatchEvent({type:"path-animation-end"}),this.movedDistance+=a,g(!0)}).start()})}getPathDirection(){let n=this.cPath.slice(this.animationPathOptions.cPathIndex);if(n.length<3)return null;let t=n[0],e=n[1],i=n[2],r=zt(t,e,i);if(Math.abs(r)>=179&&Math.abs(r)<=180){let s=new tt.Vector3(i[0]-e[0],i[1]-e[1],0).normalize(),l=new tt.Vector3(0,1,0).normalize(),u=s.angleTo(l),a=new tt.Vector3().crossVectors(l,s);return(Object.is(a.y,0)?-1:1)*u}else return null}async changeCameraToPathUp(n=100){let t=this.getPathDirection();if(t===null)return;let e=this.bmap.context.control.getAzimuthalAngle();Math.abs(e-t)>Math.PI&&(e>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:r}=this.bmap.context,s=n/Math.PI*6*i,l=150/this.bmap.context.camera.zoom,u=this.bmap.context.control.getPolarAngle(),a=this.bmap.context.control.maxPolarAngle,h=this.bmap.context.control.minPolarAngle;return this.bmap.context.control.minPolarAngle=this.bmap.context.control.maxPolarAngle=u,new Promise(p=>{let f={azimuthal:r.getAzimuthalAngle()},m={azimuthal:t},c=new Ft.Tween(f,this.pathTween).to(m,s).onUpdate(async()=>{this.bmap.context.control.target.copy(this.startPoi.position),this.bmap.context.setAzimuthalAngle(f.azimuthal,0);let d=r.target.clone(),g=new tt.Vector3;g.setFromMatrixColumn(this.bmap.context.camera.matrix,1),g.normalize(),g.multiplyScalar(l),d.add(g),this.bmap.context.setCameraPosition(d,0)}).onComplete(()=>{r.enabled=!0,this.pathTween.remove(c),this.bmap.context.control.minPolarAngle=h,this.bmap.context.control.maxPolarAngle=a,p(!0)}).onStart(()=>{r.enabled=!1}).start()})}async initNavigationCamera(){await this.translateCameraToStartPoi(300),await this.changeCameraToPathUp(300)}async translateCameraToStartPoi(n=100){if(!this.startPoi)return;let{clientSize:{width:t,height:e},camera:i,control:r}=this.bmap.context,s=Math.round(t/2),l=Math.round(e/2),u=r.target.clone(),a=E(this.startPoi.position,i,t,e),h=a.x-s,p=l-a.y+150;if(console.log(a,h,p,this.startPoi.position,s,l),!(Math.abs(h)<1&&Math.abs(p)<1)){if(Math.abs(h)>=1){let f=new tt.Vector3;f.setFromMatrixColumn(i.matrix,0),f.normalize(),f.multiplyScalar(h/i.zoom),u.add(new tt.Vector3(f.x,0,0))}if(Math.abs(p)>=1){let f=new tt.Vector3;f.setFromMatrixColumn(i.matrix,1),f.normalize(),f.multiplyScalar(p/i.zoom),u.add(new tt.Vector3(0,f.y,0))}return this.bmap.context.setCameraPosition(u,n)}}async initCameraZoom(n=100){if(!this.startPoi)return;let{clientSize:{width:t,height:e},currentFloor:i}=this.bmap.context,{max:r,min:s}=i.box,u=Math.min(t/(r.x-s.x),e/(r.y-s.y))*(r.x-s.x)/20;return this.bmap.context.setZoom(u,this.startPoi.position,n)}dispose(){this.worker.terminate(),this.unRegistryEvent(),this.path?.dispose(),this.uniqueKey.dispose(),this.startPoi?.dispose()}};var oi=class extends st{cacheData=new Map;floorDataLengthMap=new Map;async load(n){let t=Q(n);if(this.cacheData.has(t))return this.cacheData.get(t);console.time("floor/get\u8BF7\u6C42"+n.resource_type_list);let[,e]=await Promise.all([this.loadBuildGround(n),_e(n,this.bmap.config)]);console.timeEnd("floor/get\u8BF7\u6C42"+n.resource_type_list);let i=Q({floor:n.floor,ts:n.ts});this.bmap.transformGraphicData(e,this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),e.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(t,e);let r=this.floorDataLengthMap.get(i)||0;return this.floorDataLengthMap.set(i,r+e.length),e}isSameFloor(n){return this.bmap.context.currentFloor?.key===Q(n)}switchFloorByData(n,t){if(this.isSameFloor(t)){if(!n.length)return;let e=this.bmap.context.currentFloor,i=e.userData.legacyToGraphicMap,r=e.userData.graphicMap,s=[];for(let l of n){if(l.info.group==="ground")e.createGround(l.info);else{let u=e.addGraphic(l.info);u.userData.data=l,i.set(l.legacy_id,u),s.push(u)}r.set(l.element_uuid,l)}this.bmap.triggerHooks("switch_floor_before",{curFloor:e,graphics:s}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:e,graphics:s})}else{let e=Q(t),{curFloor:i,graphics:r}=this.bmap.createFloor(n);i.name=t.floor,i.key=e;let s=new Map;n.forEach(l=>{s.set(l.element_uuid,l)}),i.userData.graphicMap=s,this.bmap.triggerHooks("switch_floor_before",{curFloor:i,graphics:r}),this.bmap.context.switchFloor(i),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:i,graphics:r})}}filterData(n,t){if(!this.isSameFloor(t))return n;let e=this.bmap.context.currentFloor.userData.graphicMap;return n.filter(i=>!e.has(i.element_uuid))}async switchFloorByStoreData(n){let t=await this.load({...n,resource_type_list:"6"}),e=this.filterData(t,n);this.switchFloorByData(e,n)}async switchFloorByOtherData(n){let t=await this.load({...n,resource_type_list:"1,2,3,4"}),e=this.filterData(t,n);this.switchFloorByData(e,n)}async loadBuildGround({brand:n,project:t}){let e=Q({brand:n,project:t});return await this.bmap.loadBuildingGround({brand:n,project:t}),this.bmap.currentBuildGround=this.bmap.buildingGroundMap.get(e)||null,this.bmap.currentBuildGround}async changeFloor(n){return await Promise.all([this.switchFloorByStoreData(n),this.switchFloorByOtherData(n)]),Array.from(this.bmap.context.currentFloor.userData.graphicMap.values())}};var ai=y("three"),si=class extends st{poiLayer;floors=[];group=new ai.Group;constructor(n){super(n),this.poiLayer=new At(n.context)}show(n){let t=n[0].userData.height;n.forEach(r=>{r.poiLayer.pois.forEach(s=>{this.poiLayer.pushPoi(s)}),r.poiLayer.pois.length=0,r.poiLayer.dispose(),r.position.z=t,t+=r.userData.height});let{scene:e,currentFloor:i}=this.bmap.context;i&&(e.remove(i),i.dispose()),this.group.add(this.poiLayer,...n),e.add(this.group),this.floors=n,this.bmap.context.cameraBound.updateBox()}hide(){let{scene:n}=this.bmap.context;n.remove(this.group),this.poiLayer.clear(!0),this.floors.forEach(t=>{t.dispose()}),this.floors=[],this.group.clear()}fitCamera(){let{context:n,config:t,type:e}=this.bmap;n.cameraBound.setEnable(!1),n.control.minZoom=0,n.control.maxZoom=1/0,n.camera.zoom=1,n.setAzimuthalAngle(t.control.defaultAzimuthal,0),n.setPolarAngle(t.control.defaultPolar,0),n.fitCameraToObject(this.group,void 0,0);let i=n.camera.zoom;n.control.minZoom=i,n.control.maxZoom=i*25,e==="3d"&&n.fitCameraToObject(this.group,t.defaultPadding,0,!1),this.bmap.basicZoom=n.camera.zoom,n.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),n.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(n=>n.dispose()),this.floors=[]}};var et;function li(o="aibee_map"){return new Promise((n,t)=>{if(et)return n({db:et,type:"success"});let e=indexedDB.open(o);e.onupgradeneeded=function(i){et=i.target.result,console.log("onupgradeneeded"),n({db:et,type:"onupgradeneeded"})},e.onsuccess=i=>{et=i.target.result,n({db:et,type:"success"})},e.onerror=i=>{t(i)}})}function ui(o,n,t=et){return new Promise((e,i)=>{t||i("\u6CA1\u6709db");let s=t.transaction([o],"readonly").objectStore(o).get(n);s.onsuccess=()=>{s.result?e(s.result.value):e(null)},s.onerror=l=>{console.log("[getVersionByKey]",l),e(null)}})}function hi(o,n,t,e=et){return new Promise((i,r)=>(e||r("\u6CA1\u6709db"),new Promise((s,l)=>{let a=e.transaction([o],"readwrite").objectStore(o).add({key:n,value:t});a.onsuccess=function(h){s(h)},a.onerror=function(h){l(h)}})))}function Ee(o,n=et){n&&(n.objectStoreNames.contains(o)||n.createObjectStore(o,{keyPath:"key"}))}function ci(){et?.close(),et=null}function at(o,n,t=0){o.forEach(e=>{e.geometry.coords=JSON.parse(JSON.stringify(e.geometry.cds)),e.geometry.type==="polygon"?(e.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(r=>{r[0]-=n[0],r[1]-=n[1]})}),e.geometry.otherCds&&(e.geometry.otherCoords=e.geometry.otherCds.map(i=>i.map(r=>ht(r,n)))),e.doors?.length&&e.doors.map(i=>{i.coord=ht(i.coordinate,n)})):e.geometry.coords=ht(e.geometry.cds,n)});for(let e=0;e<o.length;e++){let i=o[e];i.deltaHeight=1e-5*(t+e+1)}}function ht(o,n){return[o[0]-n[0],o[1]-n[1]]}var pi='data:image/svg+xml,<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1722508608758" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1737" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M671.672075 807.841824l-12.086033-1.711297-5.561715 10.695605a235.303309 235.303309 0 1 1-328.889852-310.172544l8.128659-4.813022v-9.519089c0.855648-28.236397-13.369506-48.45109-38.183309-54.226717l-6.738232-1.497385-5.989538 3.52955a314.450786 314.450786 0 1 0 438.519803 419.695539l3.850418-6.952143-2.887813-7.807792a60.216256 60.216256 0 0 0-50.162388-37.220705z" fill="%23ffffff" p-id="1738"></path><path d="M893.498922 805.167922c-2.994769-21.39121-16.578188-37.541573-30.268562-35.616364l-70.911861 9.839956-57.64931-189.633075a10.695605 10.695605 0 0 1 0-1.069561 37.969398 37.969398 0 0 0-35.830277-25.99032H435.620074V414.029649h157.760173v-78.826609H435.620074v-50.162387a39.466782 39.466782 0 1 0-78.826609 0v305.787346a44.065892 44.065892 0 0 0-1.711297 11.337341 39.680694 39.680694 0 0 0 17.540793 33.156376A37.755486 37.755486 0 0 0 407.918457 641.846035h260.117113l61.71364 203.216494a30.268562 30.268562 0 0 0 28.98509 19.145133h0.855648a48.985871 48.985871 0 0 0 16.364276-2.139121h0.641736l97.330005-13.369506c13.79733-2.887813 22.567726-21.92599 19.572957-43.531113zM406.955852 197.229736a98.613478 98.613478 0 1 0-98.506521-98.506521 98.506522 98.506522 0 0 0 98.506521 98.506521z" fill="%23ffffff" p-id="1739"></path></svg>';var fi='data:image/svg+xml,<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1722508633972" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3840" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M568 171.84v285.312h144.64a12.8 12.8 0 0 1 10.816 19.648l-243.84 382.208a12.8 12.8 0 0 1-23.616-6.848V566.848h-144.64a12.8 12.8 0 0 1-10.816-19.648l243.84-382.208a12.8 12.8 0 0 1 23.616 6.848z" fill="%23ffffff" fill-opacity=".88" p-id="3841"></path></svg>';var di='data:image/svg+xml,<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1722508689425" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9597" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M354.1 768.4l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z" p-id="9598" fill="%23ffffff"></path><path d="M354.3 769.6v15.9c0 0.3 0 0.6-0.1 0.9h-63.1c-0.1-0.3-0.1-0.6-0.1-0.9V762v-0.6l63.1 7.1c0.1 0.3 0.2 0.7 0.2 1.1z" p-id="9599" fill="%23ffffff"></path><path d="M354.3 769.6v15.9c0 0.3 0 0.6-0.1 0.9h-63.1c-0.1-0.3-0.1-0.6-0.1-0.9V762v-0.6l63.1 7.1c0.1 0.3 0.2 0.7 0.2 1.1zM729.7 761.9v23.5c0 0.3 0 0.6-0.1 0.9h-63.1c-0.1-0.3-0.1-0.6-0.1-0.9v-15.9c0-0.4 0.1-0.8 0.2-1.1l63.1-7.1v0.6z" p-id="9600" fill="%23ffffff"></path><path d="M729.7 761.9v23.5c0 0.3 0 0.6-0.1 0.9h-63.1c-0.1-0.3-0.1-0.6-0.1-0.9v-15.9c0-0.4 0.1-0.8 0.2-1.1l63.1-7.1v0.6zM158.3 132.8h50.6v38h-50.6zM253.8 132.8h50.6v38h-50.6zM353.8 132.8h50.6v38h-50.6zM441.3 132.8h139.2v38H441.3zM614.8 132.8h50.6v38h-50.6zM711.6 132.8h50.6v38h-50.6zM809.1 132.8h50.6v38h-50.6z" p-id="9601" fill="%23ffffff"></path><path d="M158.3 132.8h50.6v38h-50.6zM253.8 132.8h50.6v38h-50.6zM353.8 132.8h50.6v38h-50.6zM441.3 132.8h139.2v38H441.3zM614.8 132.8h50.6v38h-50.6zM711.6 132.8h50.6v38h-50.6zM809.1 132.8h50.6v38h-50.6z" p-id="9602" fill="%23ffffff"></path><path d="M967.6 202.4V101.2c0-24.4-19.8-44.3-44.3-44.3H100.7c-24.5 0-44.3 19.8-44.3 44.3v101.3c0 24 19.2 43.6 43 44.3v673.8h-24c-10.5 0-19 8.5-19 19s8.5 19 19 19h873.2c10.5 0 19-8.5 19-19s-8.5-19-19-19h-22.8v-674c23.3-1.3 41.8-20.6 41.8-44.2z m-873.2 0V101.2c0-3.5 2.8-6.3 6.3-6.3h822.6c3.5 0.1 6.3 2.9 6.3 6.3v101.3c0 3.5-2.8 6.3-6.3 6.3H100.7c-3.4-0.1-6.3-3-6.3-6.4zM253 785.5V762c0-11.9 4.9-23 13.5-30.4 7.5-6.6 17.5-9.5 27.4-8.1l66.7 7.5c18.3 2.8 31.6 19.3 31.6 38.6v15.9c0 21.4-16.1 38.9-35.9 38.9H289c-19.9-0.1-36-17.5-36-38.9z m60.3 116c0 10.5-8.5 19-19 19s-19-8.5-19-19V884l38 0.2v17.3z m34.5 19c2.1-6 3.5-12.3 3.5-19v-17.1l159.7 0.8h0.2l155.2-0.8v17.1c0 6.7 1.4 13 3.5 19H347.8z m394.5-19c0 10.5-8.5 19-19 19s-19-8.5-19-19v-17.3l38-0.2v17.5z m25.3-116.1c0 21.4-16.1 38.9-35.9 38.9h-67.3c-19.8 0-35.9-17.4-35.9-38.9v-15.9c0-19.3 13.3-35.8 30.9-38.5l68.1-7.7c9.1-1.4 19 1.6 26.7 8.2 8.6 7.4 13.5 18.5 13.5 30.4v23.5zM611.1 661.7c4.1-12.8 15.9-22.1 30-22.1s26 9.4 30 22.1h-60z m98.8-0.2c-4.7-33.8-33.8-59.9-68.8-59.9-35.1 0-64.2 26.2-68.9 60.1H315.9c-27 0-45.6-10.5-63.7-26.7 2.9-7.8 5.7-15.4 8.2-22.2 3.7-10 6.7-18.2 8.3-22.7 0.9-2.6 1.7-5.2 2.2-7.8l27.9-75.6c20.8-54.4 74.5-55.6 76.7-55.7h270c0.6 0 55.3 0.6 77.9 55.4l27.9 75.8c0.6 2.7 1.3 5.2 2.2 7.8l8.3 22.6c2.4 6.4 5.1 13.9 7.9 21.6-19.7 16.3-35.4 26.3-59.8 27.3z m178 259H776.8c2.1-6 3.5-12.3 3.5-19v-17.7h2c15.1 0.1 29.6-5.8 40.3-16.5 11.3-11.2 17.6-26.4 17.5-42.3v-83.2c0-17.6-13.8-62.2-13.9-62.7-2.7-8.4-15.1-42.4-28.8-79.5l-8.2-22.4c-0.4-1.1-0.7-2.3-0.9-3.5-0.2-1.1-0.5-2.1-0.9-3.1l-28.7-77.9c-32.3-78.7-110-79.6-113.2-79.6h-270c-3.3 0-81.9 0.9-112.2 80.3l-28.4 77.2c-0.4 1-0.7 2.1-0.9 3.1-0.2 1.2-0.5 2.3-0.9 3.5-1.6 4.4-4.6 12.6-8.3 22.5-10.6 28.8-25.2 68.1-28.7 79.5-0.2 0.4-13.9 44.9-13.9 62.6V825c-0.1 15.9 6.2 31.1 17.5 42.3 10.3 10.2 23.9 15.6 37.8 16.3v17.9c0 6.7 1.4 13 3.5 19H137.4V246.7h750.5v673.8z" p-id="9603" fill="%23ffffff"></path><path d="M441.3 132.8h139.2v38H441.3zM353.8 132.8h50.6v38h-50.6zM253.8 132.8h50.6v38h-50.6zM158.3 132.8h50.6v38h-50.6zM809.1 132.8h50.6v38h-50.6zM711.6 132.8h50.6v38h-50.6zM614.8 132.8h50.6v38h-50.6z" p-id="9604" fill="%23ffffff"></path></svg>';var Uu={loadRoadNetwork:!1},be="version",Ue="map_data",Me="road_network_data",gi={half:pi,power:fi,mechanical:di},mi=class{constructor(n){this.bmap=n;this.initDb()}floors=[];async initDb(){try{let{db:n,type:t}=await li();t==="onupgradeneeded"&&(Ee(be),Ee(Ue),Ee(Me))}catch(n){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",n)}}async load(n){if(this.clear(),Array.isArray(n))this.floors=n;else{let t=await fetch(n).then(e=>e.json());t.code==="0"&&(this.floors=t.data.list)}}setCacheData(n,t,e){return hi(n,`${t}`,e)}getCacheData(n,t){return ui(n,`${t}`)}getFloorCacheKey(n){return`${n.floor_id}`}async getFloorData(n){let t=this.floors.find(i=>i.floor===n);if(!t)return null;let e=this.getFloorCacheKey(t);try{if(await this.getCacheData(be,e)===t.version_id){let r=await this.getCacheData(Ue,e);if(r)return this.getDataByJson(r)}return this.getFloorDataByFloorInfo(t)}catch{return this.getFloorDataByFloorInfo(t)}}async getFloorDataByFloorInfo(n){let t=this.getFloorCacheKey(n);console.time("zstd_json");let e=await fetch(n.map_url).then(i=>i.json());return e.floor=n.floor,console.timeEnd("zstd_json"),this.setCacheData(Ue,t,e),this.setCacheData(be,t,n.version_id),this.getDataByJson(e)}async getRoadNetworkData(){return(await Promise.all(this.floors.map(async t=>{let e=this.getFloorCacheKey(t);try{if(await this.getCacheData(be,e)===t.version_id){let s=await this.getCacheData(Me,e);if(s)return s}let r=await fetch(t.route_url).then(s=>s.json());return this.setCacheData(Me,e,r),r}catch{let i=await fetch(t.route_url).then(r=>r.json());return this.setCacheData(Me,e,i),i}}))).filter(t=>t.points)}async getOtherDataByFreeTime(){}async getMulFloorsData(n){return Promise.all(n.map(t=>this.getFloorData(t))).then(t=>t.filter(e=>e))}async getDataByUrl(n){let t=await fetch(n).then(e=>e.json());return this.getDataByJson(t)}getDataByJson(n){let t=new rt(this.bmap.context);t.userData.graphics=[],t.userData.graphicMap=new Map;let e=[0,0];return n.layers.forEach(i=>{switch(i.l_type){case"range":let r=i.elements[0];e=[r.center_x,r.center_y];break;case"graph":at(i.elements,e);let s=[];i.elements.forEach(c=>{c.group==="ground"?t.createGround(c):s.push(c)});let l=s.reduce((c,d)=>{let{fillColor:g,fillOpacity:v,strokeColor:L,strokeOpacity:C,height:x}=d,w=`${g.toLowerCase()}-${v}-${L.toLowerCase()}-${C}-${x}`;return C===0&&(w=`${g.toLowerCase()}-${v}-${x}`),c[w]?c[w].push(d):c[w]=[d],c},{});Object.values(l).forEach(c=>{let d=new ue(this.bmap.context,c);t.mergeGraphicLayer.add(d)});break;case"ground":at(i.elements,e);let u=i.elements.map(c=>new U(this.bmap.context,c));t.addGrounds(u);break;case"wall":at(i.elements,e);let a=i.elements.reduce((c,d)=>{let{fillColor:g,fillOpacity:v,strokeColor:L,strokeOpacity:C,height:x}=d,w=`${g.toLowerCase()}-${v}-${L.toLowerCase()}-${C}-${x}`;return C===0&&(w=`${g.toLowerCase()}-${v}-${x}`),c[w]?c[w].push(d):c[w]=[d],c},{});Object.values(a).forEach(c=>{let d=new se(this.bmap.context,c);t.wallLayer.add(d)});break;case"lane":at(i.elements,e);let h=i.elements.reduce((c,d)=>{let{fillColor:g,fillOpacity:v,strokeColor:L,strokeOpacity:C}=d,x=`${g.toLowerCase()}-${v}-${L.toLowerCase()}-${C}`;return C===0&&(x=`${g.toLowerCase()}-${v}`),c[x]?c[x].push(d):c[x]=[d],c},{});Object.values(h).forEach(c=>{let d=new le(this.bmap.context,c);t.laneLayer.add(d)});break;case"texture2d":case"texture3d":if(at(i.elements,e),i.elements.length){let c=new Dt(this.bmap.context,i.elements);t.textureLayer.add(c)}break;case"glb":at(i.elements,e),i.elements.forEach(c=>{let d=ht([c.center_x,c.center_y],e),g=new ae(this.bmap.context,{...c,url:c.secondUrl,rotate:c.secondRotate,width:c.secondWidth,center_x:d[0],center_y:d[1]});t.glbModelLayer.add(g)});break;case"store":at(i.elements,e),i.elements.map(c=>{let d=ht([c.center_x,c.center_y],e),g=t.addGraphic(c);t.userData.graphics.push(g),t.userData.graphicMap.set(c.id,g);let v=new k(this.bmap.context,{id:c.id,icon:c.poi_info.icon,text:c.poi_info.showName||c.store_name||c.poi_info.text,position:{x:d[0],y:d[1],z:c.airHeight+c.height},icon_size:[18,18]});t.poiLayer2.pushPoi(v),v&&(v.userData.type="store",v.userData.data=c)});break;case"facility":at(i.elements,e),i.elements.map(c=>{let d=ht(c.geometry.cds,e),g=t.addGraphic(c);if(t.userData.graphics.push(g),t.userData.graphicMap.set(c.id,g),c.poi_info){let v=new k(this.bmap.context,{id:c.id,icon:c.poi_info.icon,text:c.poi_info.showName||c.store_name||c.poi_info.text,position:{x:d[0],y:d[1],z:c.airHeight+c.height},icon_size:[18,18]});t.poiLayer2.pushPoi(v),v.userData.type="facility",v.userData.data=c}});break;case"parkingSpace":at(i.elements,e);let p=[],f=new Map;i.elements.forEach(c=>{let d=t.addGraphic(c);p.push(d),f.set(c.id,d);let g=ht([c.center_x,c.center_y],e);if(c.texts[0]){let v=new k(this.bmap.context,{id:c.id,text:c.texts[0],position:{x:g[0],y:g[1],z:c.airHeight+c.height}});v&&(v.userData.type="parkingSpace",v.userData.data=c),t.poiLayer2.pushPoi(v)}});let m=i.elements.filter(c=>gi[c.parkingType]).map(c=>{let d=ht([c.center_x,c.center_y],e),g=Je(c.geometry.coords,d);return{uuid:c.id,iconUrl:gi[c.parkingType],name:c.texts[0],deltaHeight:c.deltaHeight,airHeight:c.airHeight,height:c.height,geometry:{...c.geometry,coords:g},opacity:c.fillOpacity,visible:!0}});if(m.length){let c=new Dt(this.bmap.context,m);t.textureLayer.add(c)}t.userData.parkingSpaces=p,t.userData.parkingSpacesGraphicMap=f;break}}),t.userData.center=e,t.userData.height=n.floorHeight,t.name=n.floor,t.userData.data=n,t.updateBox(),t}clear(){}dispose(){this.clear(),ci()}};})();
|
|
3779
3788
|
//# sourceMappingURL=bmap.min.js.map
|