@aibee/crc-bmap 0.6.6 → 0.6.8
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 +5 -134
- package/lib/bmap.cjs.min.js.map +2 -2
- package/lib/bmap.esm.js +2 -1
- package/lib/bmap.esm.js.map +2 -2
- package/lib/bmap.esm.min.js +2 -2
- package/lib/bmap.esm.min.js.map +2 -2
- package/lib/bmap.min.js +7 -136
- package/lib/bmap.min.js.map +2 -2
- package/package.json +1 -1
package/lib/bmap.cjs.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var mi=Object.create;var Se=Object.defineProperty;var _i=Object.getOwnPropertyDescriptor;var yi=Object.getOwnPropertyNames;var vi=Object.getPrototypeOf,xi=Object.prototype.hasOwnProperty;var Ct=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),Ei=(s,e)=>{for(var t in e)Se(s,t,{get:e[t],enumerable:!0})},jn=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of yi(e))!xi.call(s,r)&&r!==t&&Se(s,r,{get:()=>e[r],enumerable:!(n=_i(e,r))||n.enumerable});return s};var Zt=(s,e,t)=>(t=s!=null?mi(vi(s)):{},jn(e||!s||!s.__esModule?Se(t,"default",{value:s,enumerable:!0}):t,s)),bi=s=>jn(Se({},"__esModule",{value:!0}),s);var $n=Ct((So,Yn)=>{Yn.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var Jn=Ct((Mo,Zn)=>{var Kn=$n();Zn.exports=function(s,e){Array.isArray(e)||(e=[]),s.length>0&&e.push(Kn([0,0],s[0]));for(var t=0;t<s.length-1;t++){var n=s[t],r=s[t+1],i=n[0],o=n[1],a=r[0],l=r[1],u=[.75*i+.25*a,.75*o+.25*l],c=[.25*i+.75*a,.25*o+.75*l];e.push(u),e.push(c)}return s.length>1&&e.push(Kn([0,0],s[s.length-1])),e}});var rr=Ct((Co,nr)=>{var dn=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,t)=>e.priority-t.priority)}set(e,t){let n=Number(t);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(e)?this.queue.map(r=>(r.key===e&&Object.assign(r,{priority:n}),r)):(this.keys.add(e),this.queue.push({key:e,priority:n})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(t=>t.key===e)}};nr.exports=dn});var sr=Ct((Po,or)=>{function ir(s,e){let t=new Map;for(let[n,r]of s)n!==e&&r instanceof Map?t.set(n,ir(r,e)):n!==e&&t.set(n,r);return t}or.exports=ir});var ur=Ct((Ao,lr)=>{function Ni(s){let e=Number(s);return!(isNaN(e)||e<=0)}function ar(s){let e=new Map;return Object.keys(s).forEach(n=>{let r=s[n];if(r!==null&&typeof r=="object"&&!Array.isArray(r))return e.set(n,ar(r));if(!Ni(r))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,r);return e.set(n,Number(r))}),e}lr.exports=ar});var pr=Ct((Io,hr)=>{function cr(s){if(!(s instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof s}`);s.forEach((e,t)=>{if(typeof e=="object"&&e instanceof Map){cr(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}hr.exports=cr});var mn=Ct((Ro,gr)=>{var Di=rr(),Oi=sr(),fr=ur(),dr=pr(),gn=class{constructor(e){e instanceof Map?(dr(e),this.graph=e):e?this.graph=fr(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(dr(t),n=t):n=fr(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=Oi(this.graph,e),this}path(e,t,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let r=new Set,i=new Di,o=new Map,a=[],l=0,u=[];if(n.avoid&&(u=[].concat(n.avoid)),u.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(u.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(i.set(e,0);!i.isEmpty();){let c=i.next();if(c.key===t){l=c.priority;let p=c.key;for(;o.has(p);)a.push(p),p=o.get(p);break}r.add(c.key),(this.graph.get(c.key)||new Map).forEach((p,d)=>{if(r.has(d)||u.includes(d))return null;if(!i.has(d))return o.set(d,c.key),i.set(d,c.priority+p);let m=i.get(d).priority,f=c.priority+p;return f<m?(o.set(d,c.key),i.set(d,f)):null})}return a.length?(n.trim?a.shift():a=a.concat([e]),n.reverse||(a=a.reverse()),n.cost?{path:a,cost:l}:a):n.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};gr.exports=gn});var no={};Ei(no,{AibeeLoader:()=>Xn,BMap:()=>Tn,BMapSelect:()=>On,BaseSvg:()=>J,Context:()=>_e,CrLoader:()=>qn,CrNavPath:()=>Dn,Equipment:()=>Cn,Events:()=>ln,Floor:()=>ct,GlbModel:()=>he,Graphic:()=>R,GraphicLayer:()=>se,GroundTexture:()=>qt,HeatmapElement:()=>ie,HooksName:()=>Wt,HoverHelper:()=>me,Lane:()=>pe,Layer:()=>F,MapTypePolar:()=>Vr,MergeGraphic:()=>fe,Model:()=>oe,MulFloors:()=>In,NavPath:()=>Ln,Navigation:()=>An,Overlay:()=>re,PathDirection:()=>pn,PdrPosition:()=>Fn,Poi:()=>bt,Poi2:()=>q,PoiLayer:()=>ae,PoiLayer2:()=>Ut,RoadNetwork:()=>_n,RoadNetwork2:()=>yn,SelectBox:()=>En,Selection:()=>ge,Sensor:()=>Ee,Shadow:()=>ne,SvgLine:()=>le,SvgPolygon:()=>ue,TextTexture:()=>de,Timer:()=>D,TweenUtil:()=>Dt,UA:()=>sn,Wall:()=>ce,addAlphaToHexColor:()=>Ci,calc_angle:()=>tn,calc_direction:()=>we,convertToSnakeCase:()=>vn,createCircle:()=>Vt,createLine:()=>te,createRect:()=>mt,createSvg:()=>rn,createSvgElement:()=>Qt,createThreeBox:()=>Bi,createThreeLine:()=>Ui,darkenColor:()=>pt,defaultAibeeLoaderOption:()=>eo,defaultConfig:()=>zr,defaultGraphicOptions:()=>Te,defaultOptions:()=>Cr,defaultTextTextureOptions:()=>Nr,dispose:()=>V,distancePointToSegment:()=>hn,generatorKeyByObj:()=>Lt,getAngle:()=>tr,getCenter:()=>Jt,getConfig:()=>wn,getDirectPath:()=>Li,getDistanceByPathPos:()=>fn,getLength:()=>A,getLongestSideDir:()=>Si,getMinEdgeSquare:()=>en,getPathLength:()=>at,getPointEdgeIndex:()=>Pt,getPosByPathDistance:()=>ee,hasChinese:()=>Qe,hexToRgb:()=>Me,initDirectionalLight:()=>Je,initLight:()=>Ze,initShape:()=>st,isAndroid:()=>Pi,isContain:()=>gt,isControl:()=>Rt,isIphone:()=>Ht,isMac:()=>It,isPointInPolygon:()=>nn,loadBuildingGround:()=>Un,loadExternalStreet:()=>$i,loadGraphics:()=>Bn,moveOnRoute:()=>Ri,proxyOptions:()=>At,removeWeightPath:()=>er,setCirclePosition:()=>_t,setLineStartEnd:()=>et,setRectPosition:()=>B,simplifyPath:()=>cn,sleepOnePromise:()=>on,sleepOneRf:()=>wi,smoothPath:()=>un,strToNumber:()=>Ti,timeoutPromise:()=>Z,toWebWorker:()=>Fi,transformGraphicData:()=>X,translatePosToCenter:()=>rt,triggerWorker:()=>lt,vector3ToDevice:()=>y,xhrGet:()=>Ai});module.exports=bi(no);var Ge=require("three");var D=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(e){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),e()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(e){this.tasks.requestAnimation.delete(e),window.cancelAnimationFrame(e)}setTimeout(e,t){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),e()},t);return this.tasks.timeout.add(n),n}clearTimeout(e){this.tasks.timeout.delete(e),window.clearTimeout(e)}setInterval(e,t){let n=window.setInterval(()=>{this.tasks.interval.delete(n),e()},t);return this.tasks.interval.add(n),n}clearInterval(e){this.tasks.interval.delete(e),window.clearInterval(e)}dispose(){this.tasks.requestAnimation.forEach(e=>{window.cancelAnimationFrame(e)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(e=>{window.clearTimeout(e)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(e=>{window.clearInterval(e)}),this.tasks.interval.clear()}};var K=require("three");function Ze(){let s=new K.Group,e=new K.AmbientLight(16777215,2.6);return s.add(e),s}function st(s,e=[]){let t=new K.Shape(s.map(n=>new K.Vector2(...n)));return e.length&&e.forEach(n=>{var r=new K.Path(n.map(i=>new K.Vector2(...i)));t.holes.push(r)}),t}function Je(s=16777215,e=1){let t=new K.DirectionalLight(s,e);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function V(s,e){if(e&&s.children&&s.children.length&&s.children.forEach(t=>{V(t,e)}),s.isMesh){let t=s;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n.dispose()}):t.material.dispose())}s.isLight&&s.dispose?.()}function Qe(s){return/[\u4E00-\u9FA5]+/g.test(s)}var C=require("three"),kt=require("@turf/turf");function y(s,e,t,n){let r=s.clone().project(e),i=t/2,o=n/2,a=Math.round(r.x*i+i),l=Math.round(-r.y*o+o);return{x:a,y:l}}function Jt(s){let e=(0,kt.featureCollection)(s.map(n=>(0,kt.point)(n)));return(0,kt.center)(e).geometry.coordinates}function gt(s,e,t){return s.x>=e.x&&s.x<=t.x&&s.y>=e.y&&s.y<=t.y}function Si(s){let e=0,t=new C.Vector3;for(let n=1;n<s.length;n++){let r=new C.Vector3(s[n-1][0],s[n-1][1],0),i=new C.Vector3(s[n][0],s[n][1],0),o=i.distanceTo(r);o>e&&(e=o,t=i.clone().sub(r).normalize())}return t}function A(s,e){return Math.sqrt((e[0]-s[0])**2+(e[1]-s[1])**2)}function at(s){let e=0;for(let t=0;t<s.length-1;t++)e+=A(s[t],s[t+1]);return e}function tn(s,e,t){let n=new C.Vector2(e[0]-s[0],e[1]-s[1]),r=new C.Vector2(e[0]-t[0],e[1]-t[1]),o=n.angleTo(r)*180/Math.PI,a=new C.Vector2(e[0]-s[0],e[1]-s[1]);return new C.Vector2(t[0]-s[0],t[1]-s[1]).cross(a)>0?o:-o}function en(s,e){let t=Math.min(A(s[0][0],s[0][1]),A(s[0][2],s[0][1]))-1;e||(e=Jt(s[0]));let n=Mi(e,t),r=new C.Vector2(s[0][0][0],s[0][0][1]),i=new C.Vector2(s[0][1][0],s[0][1][1]),o=new C.Vector2(s[0][2][0],s[0][2][1]),l=(r.distanceTo(i)>i.distanceTo(o)?i.clone().sub(r):o.clone().sub(i)).angleTo(new C.Vector2(0,1)),u=new C.Matrix3;return u.multiply(new C.Matrix3().translate(e[0],e[1])).multiply(new C.Matrix3().rotate(l)).multiply(new C.Matrix3().translate(-e[0],-e[1])),[n.map(c=>{let h=new C.Vector2(c[0],c[1]).applyMatrix3(u);return[h.x,h.y]})]}function Mi(s,e){let t=e/2;return[[s[0]-t,s[1]+t],[s[0]+t,s[1]+t],[s[0]+t,s[1]-t],[s[0]-t,s[1]-t],[s[0]-t,s[1]+t]]}function Pt(s,e){let t=0,n=1/0,[r,i]=e;for(let o=0;o<s.length-1;o++){let[a,l]=s[o],[u,c]=s[o+1],h=Math.min(a,u)<=r&&r<=Math.max(a,u),p=Math.min(l,c)<=i&&i<=Math.max(l,c);if(h&&p){let d=Math.abs((u-a)*(i-l)-(c-l)*(r-a));d<n&&(n=d,t=o)}}return t}function nn(s,e){let t=s[0],n=s[1],r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let a=e[i][0],l=e[i][1],u=e[o][0],c=e[o][1];l>n!=c>n&&t<(u-a)*(n-l)/(c-l)+a&&(r=!r)}return r}function At(s,e){return new Proxy(s,{get:(t,n,r)=>Reflect.get(t,n,r),set:(t,n,r,i)=>{let o=Reflect.get(t,n,i),a=Reflect.set(t,n,r,i);return o!==r&&e.dispatchEvent({type:`change-${n}`,value:r}),a}})}function Z(s,e){return Promise.race([s,new Promise((t,n)=>{setTimeout(()=>n(new Error("Promise timeout")),e)})])}function Qt(s){return document.createElementNS("http://www.w3.org/2000/svg",s)}function rn(s,e){let t=Qt("svg");return t.setAttribute("width",s),t.setAttribute("height",e),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function Vt(s="2",e){let t=Qt("circle");return t.setAttribute("r",s),t.setAttribute("fill",e),t}function te(s){let e=Qt("line");return e.setAttribute("stroke",s),e}function mt(s,e){let t=Qt("rect");return t.setAttribute("stroke",s),t.setAttribute("fill",e),t}function _t(s,e,t){s.setAttribute("cx",`${e}`),s.setAttribute("cy",`${t}`)}function et(s,e,t){e&&(s.setAttribute("x1",`${e.x}`),s.setAttribute("y1",`${e.y}`)),t&&(s.setAttribute("x2",`${t.x}`),s.setAttribute("y2",`${t.y}`))}function B(s,e,t,n,r){s.setAttribute("x",`${e}`),s.setAttribute("y",`${t}`),s.setAttribute("width",`${n}`),s.setAttribute("height",`${r}`)}function on(){return Promise.resolve()}function wi(){return new Promise(s=>{requestAnimationFrame(s)})}function Ti(s){return parseInt(s.replace("#","0x"),16)}function Ci(s,e){let t=parseInt(s.substring(1,3),16),n=parseInt(s.substring(3,5),16),r=parseInt(s.substring(5,7),16),i=Math.round(t*e),o=Math.round(n*e),a=Math.round(r*e);return`#${(1<<24|i<<16|o<<8|a).toString(16).slice(1)}`}function pt(s,e=.85){let t,n,r;if(s.startsWith("#"))t=parseInt(s.substring(1,3),16),n=parseInt(s.substring(3,5),16),r=parseInt(s.substring(5,7),16);else{let o=s.slice(4,-1).split(",");t=parseInt(o[0].trim()),n=parseInt(o[1].trim()),r=parseInt(o[2].trim())}return t=Math.min(Math.floor(t*e),255),n=Math.min(Math.floor(n*e),255),r=Math.min(Math.floor(r*e),255),"#"+((1<<24)+(t<<16)+(n<<8)+r).toString(16).slice(1)}function Me(s,e){s=s.replace(/^#/,"");let t=parseInt(s.substring(0,2),16),n=parseInt(s.substring(2,4),16),r=parseInt(s.substring(4,6),16);return e!==void 0?`rgba(${t}, ${n}, ${r}, ${e})`:`rgb(${t}, ${n}, ${r})`}var It=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,sn=(window.navigator.userAgent||"").toLocaleLowerCase(),Ht=/ios|iphone/i.test(sn),Pi=/android|adr|linux/gi.test(sn);function Rt(s){return It?s==="Meta":s==="Control"}var an="__once__",ln=class{events=new Map;on(e,t){if(typeof t!="function")return;let n=this.events.get(e);return n?n.add(t):this.events.set(e,new Set([t]))}once(e,t){if(typeof t!="function")return;let n=`${an}${e}`,r=this.events.get(n);return r?r.add(t):this.events.set(n,new Set([t]))}off(e,t){let n=this.events.get(e),r=this.events.get(`${an}${e}`);!n&&!r||(t===void 0&&(n?.clear(),r?.clear()),n?.has(t)&&n.delete(t),r?.has(t)&&r.delete(t))}offAll(){this.events.clear()}emit(e,...t){let n=this.events.get(e),r=this.events.get(`${an}${e}`);!n&&!r||(n?.forEach(i=>{typeof i=="function"&&i(...t)}),r?.forEach(i=>{typeof i=="function"&&i(...t)}),r?.clear())}};var Wt=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(Wt||{});function Lt(s){return Object.keys(s).sort().map(e=>`${e}=${s[e]}`).join("&")}function Ai(s,e){return new Promise((t,n)=>{let r=new XMLHttpRequest;r.open("GET",s,!0),Object.keys(e.headers||{}).forEach(i=>{r.setRequestHeader(i,e.headers[i])}),e.responseType&&(r.responseType=e.responseType),r.onload=()=>{if(r.status>=200&&r.status<300)if(e.responseType==="arraybuffer")t(r.response);else try{let i=JSON.parse(r.responseText);t(i)}catch(i){n(i)}else n(r.statusText)},r.onerror=()=>{n(r.statusText)},r.send()})}var Xt=require("three"),Qn=Zt(Jn(),1);function tr(s,e){let t=s.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function Ii(s){let e=0;return s.reduce(([t,n],[r,i])=>(e+=Math.sqrt((r-t)**2+(i-n)**2),[r,i])),e/s.length}function un(s,e=.25){if(Ii(s)<e)return s;let t=(0,Qn.default)(s);return un(t,e)}function cn(s,e=!1,t=!0,n=5,r=150,i=3){let o=[],a=!e;if(o.push(s[0]),s.length<2)return o;for(let u=0;u<s.length-2;u+=1){let c=s[u],h=s[u+1],p=s[u+2],d=new Xt.Vector2(c[0]-h[0],c[1]-h[1]),m=new Xt.Vector2(p[0]-h[0],p[1]-h[1]),f=tr(d,m)/Math.PI*180,g=d.length()+m.length();(!a||f<r&&g>.01||g>n)&&(o.push(s[u+1]),a=!0)}if(o.push(s[s.length-1]),!t)return o;let l=[];l.push(o[0]);for(let u=0;u<o.length-2;u+=1){let c=new Xt.Vector2(o[u][0],o[u][1]),h=new Xt.Vector2(o[u+1][0],o[u+1][1]),p=new Xt.Vector2(o[u+2][0],o[u+2][1]),d=c.distanceTo(h)/2,m=p.distanceTo(h)/2,f=h.clone(),g=h.clone();f.add(c.clone().sub(h).normalize().multiplyScalar(d>i?i/2:d)),g.add(p.clone().sub(h).normalize().multiplyScalar(m>i?i/2:m));let E=[[f.x,f.y],[h.x,h.y],[g.x,g.y]];l.push(...un(E,i/25))}return l.push(o[o.length-1]),er(l)}function er(s){if(s.length<=1)return s;let e=[],t;return s.forEach(([n,r])=>{t?n===t[0]&&r===t[1]||(t=[n,r],e.push([n,r])):(t=[n,r],e.push([n,r]))}),e}function hn(s,e,t){let n=Math.sqrt((t[0]-e[0])**2+(t[1]-e[1])**2);if(n===0)return{distance:Math.sqrt((s[0]-e[0])**2+(s[1]-e[1])**2),closestPoint:e.slice(0)};let r=Math.max(0,Math.min(1,((s[0]-e[0])*(t[0]-e[0])+(s[1]-e[1])*(t[1]-e[1]))/n**2)),i=[e[0]+r*(t[0]-e[0]),e[1]+r*(t[1]-e[1])];return{distance:Math.sqrt((s[0]-i[0])**2+(s[1]-i[1])**2),closestPoint:i}}function Ri(s,e,t){let[n,r]=s,[i,o]=e,a=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2));if(a===0||a<t)return[...e];let l=t/a,u=n+(i-n)*l,c=r+(o-r)*l;return[u,c]}var pn=(u=>(u.START="start",u.END="end",u.FRONT="front",u.RIGHT="right",u.LEFT="left",u.RIGHT_FRONT="right_front",u.LEFT_FRONT="left_front",u.RIGHT_BACK="right_back",u.LEFT_BACK="left_back",u))(pn||{});function we(s,e,t){let n=tn(s,e,t);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function Li(s){if(!s.length)return[];let e=[{direction:"start",distance:A(s[0],s[1]),points:[s[0],s[1]]}];for(let t=2;t<s.length;t++){let n=we(s[t-2],s[t-1],s[t]);if(n==="front"){let r=e[e.length-1],i=A(s[t-1],s[t]);r.distance+=i,t!==2&&r.points.push(s[t-1])}else e.push({direction:n,distance:A(s[t-1],s[t]),points:[s[t-1],s[t]]})}return e.push({direction:"end",distance:0,points:[s[s.length-1]]}),e}function fn(s,e){if(s.length<2)return-1;let t=0;for(let n=1;n<s.length;n++){let r=s[n-1],i=s[n],o=[e[0]-r[0],e[1]-r[1]],a=[i[0]-r[0],i[1]-r[1]],l=Math.min(i[0],r[0])<=e[0]&&e[0]<=Math.max(i[0],r[0]),u=Math.min(i[1],r[1])<=e[1]&&e[1]<=Math.max(i[1],r[1]);if(l&&u){let c=o[0]*a[1]-o[1]*a[0];if(Math.abs(c)<1e-6){let h=Math.sqrt((e[0]-r[0])**2+(e[1]-r[1])**2);return t+h}}t+=Math.sqrt((i[0]-r[0])**2+(i[1]-r[1])**2)}return-1}function ee(s,e){if(s.length<2)return s[0]??null;let t=0;for(let n=1;n<s.length;n++){let r=s[n-1],i=s[n],o=Math.sqrt((i[0]-r[0])**2+(i[1]-r[1])**2);if(t+=o,t>=e){let a=(e-(t-o))/o,l=r[0]+(i[0]-r[0])*a,u=r[1]+(i[1]-r[1])*a;return[l,u]}}return null}var ft=Zt(mn(),1);var nt="___",_n=class{constructor(e=3){this.lift_priority=e}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new ft.default;escalatorRoute=new ft.default;straightLadderRoute=new ft.default;initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(t=>{t.points.forEach(n=>{let r=`${t.floor}${nt}${n.id}`;if(this.pointMap.set(r,n),this.nodeMap.set(`${n.floor}${nt}${n.nodeId}`,r),n.type==="straightLadder"){let i=this.straightLadderMap.get(n.name)||[];i.push({...n}),this.straightLadderMap.set(n.name,i)}if(n.type==="staircase"){let i=this.staircaseMap.get(n.name)||[];i.push({...n}),this.staircaseMap.set(n.name,i)}if(n.type==="escalator"){let i=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?i.end={floor:n.floor,id:n.id}:i.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,i)}if(n.type==="facility"){let i=this.facilityMap.get(n.targetId)||[];i.push({...n}),this.facilityMap.set(n.targetId,i)}}),t.lines.filter(n=>n.direction!=="no").forEach(n=>{let r=`${t.floor}${nt}${n.from}`,i=`${t.floor}${nt}${n.to}`,o=this.pointMap.get(r)?.cds,a=this.pointMap.get(i)?.cds;if(o?.length&&a?.length){let l=A(o,a);this.addLineItem(r,i,l),n.direction==="double"&&this.addLineItem(i,r,l)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,t,n,r=this.lineMap){let i=r.get(e)||new Map;i.set(t,n),r.set(e,i)}addFacilityToLineMap(e,t,n,r){[...this.straightLadderMap,...this.staircaseMap].forEach(([i,o])=>{if(!(o.length<2))for(let a=0;a<o.length;a++){let l=`${o[a].floor}${nt}${o[a].id}`;for(let u=0;u<o.length;u++)if(a!==u){let c=`${o[u].floor}${nt}${o[u].id}`,h=this.pointMap.get(l)?.cds,p=this.pointMap.get(c)?.cds;if(h?.length&&p?.length)if(o[a].type==="straightLadder"){let d=t;this.addLineItem(l,c,d,r)}else{let d=n;this.addLineItem(l,c,d,r)}}}}),this.escalatorMap.forEach((i,o)=>{if(i.start&&i.end){let a=`${i.start.floor}${nt}${i.start.id}`,l=`${i.end.floor}${nt}${i.end.id}`,u=this.pointMap.get(a)?.cds,c=this.pointMap.get(l)?.cds;if(u?.length&&c?.length){let h=e;this.addLineItem(a,l,h,r)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new ft.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new ft.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new ft.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${nt}${e.nodeId}`);if(t){let[n,r]=t.split(nt);return{floor:n,id:r}}}if(e.coord?.length){let t=this.roadInfo.find(r=>r.floor===e.floor);if(!t)return null;let n=t.points.reduce((r,i)=>{let o=A(e.coord,i.cds);return o<r.min&&(r.min=o,r.point=i),r},{min:1/0,point:t.points[0]});return{floor:n.point.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let r=this.transformStart(e);if(!r)return"no-start";let i=this.transformEnd(t);if(!i)return"no-end";let o=this.getBasePath.bind(this);switch(n){case"escalator":o=this.getEscalatorPath.bind(this);break;case"straightLadder":o=this.getStraightLadderPath.bind(this);break;default:o=this.getBasePath.bind(this);break}if(i.id)return o(r,i);if(i.facility){let a=this.facilityMap.get(i.facility).filter(u=>i.floor?u.floor===i.floor:!0);if(!a.length)return null;let l=a.map(u=>o(r,{floor:u.floor,id:u.id})).filter(u=>!!u);return l.reduce((u,c)=>{let h=c.reduce((p,d)=>p+at(d.points),0);return h<u.distance&&(u.distance=h,u.path=c),u},{distance:1/0,path:l[0]}).path}}getRoutePath(e,t,n){let r=`${e.floor}${nt}${e.id}`,i=`${t.floor}${nt}${t.id}`,o=n.path(r,i);if(!o)return null;let a=[];return o.map(l=>{let u=this.pointMap.get(l);if(u){let{floor:c}=u;if(a[a.length-1]?.floor===c){let h=a[a.length-1];h.points.push(u.cds),h.endType=u.type,h.destId=u.nodeId,h.distance=at(h.points)}else a.push({floor:c,points:[u.cds],endType:u.type,destId:u.nodeId,distance:0})}}),a}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new ft.default,this.escalatorRoute=new ft.default,this.straightLadderRoute=new ft.default}};var G=Zt(mn(),1);var yt=require("lodash"),w="___",yn=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new G.default;escalatorRoute=new G.default;straightLadderRoute=new G.default;forwardLineMap=new Map;forwardRoute=new G.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(t=>{let n=[];try{n=JSON.parse(t.entry_end_floor)}catch{n=[]}let r=[];try{r=JSON.parse(t.entry_start_floor)}catch{r=[]}return{...t,entry_start_floor:r,entry_end_floor:n}})}initRoute(e,t){this.clear(),this.roadInfo=e,this.initFacilities(t);let n=new Date,r=n.getHours()*60+n.getMinutes();e.length&&(e.forEach(i=>{(i.points||[]).filter(o=>o.openStatus!==!1).filter(o=>{if(!o.startTime||!o.endTime)return!0;let[a,l]=o.startTime.split(":").map(d=>+d),[u,c]=o.endTime.split(":").map(d=>+d),h=a*60+l,p=u*60+c;return r>=h&&r<=p}).forEach(o=>{o.floor=i.floor;let a=`${i.floor}${w}${o.id}`;if(this.nodeMap.set(`${i.floor}${w}${o.nodeId}`,`${i.floor}${w}${o.relatedId||o.id}`),this.pointMap.set(a,o),this.isFacilityByType(o.type)){let l=this.facilities.find(u=>u.id===+o.targetId);if(l){switch(l.entry_infra_type){case"straightLadder":if(l.entry_end_floor.find(p=>p.floor===i.floor)&&l.entry_start_floor.find(p=>p.floor===i.floor)){let p=this.straightLadderMap.get(o.targetId)||[];p.push({...o}),this.straightLadderMap.set(o.targetId,p)}break;case"staircase":if(l.entry_end_floor.find(p=>p.floor===i.floor)&&l.entry_start_floor.find(p=>p.floor===i.floor)){let p=this.staircaseMap.get(o.targetId)||[];p.push({...o}),this.staircaseMap.set(o.targetId,p)}break;case"escalator":let c=this.escalatorMap.get(o.targetId)||[];if(l.entry_start_floor.find(p=>p.floor===i.floor)){let p=c.find(d=>d.end?.floor!==i.floor&&!d.start);p?p.start=o:c.push({start:o})}if(l.entry_end_floor.find(p=>p.floor===i.floor)){let p=c.find(d=>d.start?.floor!==i.floor&&!d.end);p?p.end=o:c.push({end:o})}this.escalatorMap.set(o.targetId,c);break;case"ramp":let h=this.rampMap.get(o.targetId)||[];if(l.entry_start_floor.find(p=>p.floor===i.floor)){let p=h.find(d=>d.end?.floor!==i.floor&&!d.start);p?p.start=o:h.push({start:o})}if(l.entry_end_floor.find(p=>p.floor===i.floor)){let p=h.find(d=>d.start?.floor!==i.floor&&!d.end);p?p.end=o:h.push({end:o})}this.rampMap.set(o.targetId,h);break}let u=this.facilityMap.get(o.targetId)||[];u.push({...o}),this.facilityMap.set(o.targetId,u)}}o.type==="parkingSpace"&&this.parkingMap.set(`${i.floor}${w}${o.name}`,o)}),(i.lines||[]).filter(o=>o.direction!=="no").forEach(o=>{let a=`${i.floor}${w}${o.from}`,l=`${i.floor}${w}${o.to}`,u=this.pointMap.get(a),c=this.pointMap.get(l);if(!u||!c)return;let h=u.cds,p=c.cds,d=A(h,p);if(!u.permission&&!c.permission)switch(this.addLineItem(a,l,d),this.addLineItem(l,a,d),o.direction){case"double":this.addLineItem(a,l,d,this.forwardLineMap),this.addLineItem(l,a,d,this.forwardLineMap);break;case"single":this.addLineItem(a,l,d,this.forwardLineMap);break;case"back":this.addLineItem(l,a,d,this.forwardLineMap);break}else u.permission&&(this.setPermissionLine(a,l,u.permission,d,""),this.setPermissionLine(l,a,u.permission,d,"")),c.permission&&c.permission!==u.permission&&(this.setPermissionLine(a,l,c.permission,d,""),this.setPermissionLine(l,a,c.permission,d,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[`permission_${e}`]||(this[`permission_${e}`]=new Set),this[`permission_${e}`]}setPermissionLine(e,t,n,r,i){this.getPermissionMap(n).add({fromKey:e,toKey:t,distance:r,type:i})}addPermissionFacility(){this.straightLadderMap.forEach((e,t)=>{if(e.length<2){this.straightLadderMap.delete(t);return}for(let n=0;n<e.length;n++){let r=`${e[n].floor}${w}${e[n].id}`,i=this.pointMap.get(r);if(i){for(let o=0;o<e.length;o++)if(n!==o){let a=`${e[o].floor}${w}${e[o].id}`,l=this.pointMap.get(a);if(!l)continue;i.permission&&this.setPermissionLine(r,a,i.permission,1,"straightLadder"),l.permission&&l.permission!==i.permission&&this.setPermissionLine(r,a,l.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,t)=>{if(e.length<2){this.staircaseMap.delete(t);return}for(let n=0;n<e.length;n++){let r=`${e[n].floor}${w}${e[n].id}`,i=this.pointMap.get(r);if(i){for(let o=0;o<e.length;o++)if(n!==o){let a=`${e[o].floor}${w}${e[o].id}`,l=this.pointMap.get(a);if(!l)continue;i.permission&&this.setPermissionLine(r,a,i.permission,1,"staircase"),l.permission&&l.permission!==i.permission&&this.setPermissionLine(r,a,l.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let r=`${n.start.floor}${w}${n.start.id}`,i=`${n.end.floor}${w}${n.end.id}`,o=this.pointMap.get(r),a=this.pointMap.get(i);o&&a&&(o.permission&&this.setPermissionLine(r,i,o.permission,1,"escalator"),a.permission&&a.permission!==o.permission&&this.setPermissionLine(r,i,a.permission,1,"escalator"))}})}),this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let r=`${n.start.floor}${w}${n.start.id}`,i=`${n.end.floor}${w}${n.end.id}`,o=this.pointMap.get(r),a=this.pointMap.get(i);o&&a&&(o.permission&&this.setPermissionLine(r,i,o.permission,10,"ramp"),a.permission&&a.permission!==o.permission&&this.setPermissionLine(r,i,a.permission,10,"ramp"))}})})}addPermissionLineToMap(e,t,n,r){let i=this.getPermissionMap(e);console.log(i),i.forEach(o=>{t.includes(o.type)&&(o.type===""?this.addLineItem(o.fromKey,o.toKey,o.distance,n):this.addLineItem(o.fromKey,o.toKey,r.get(o.type),n))})}addLineItem(e,t,n,r=this.lineMap){let i=r.get(e)||new Map;i.set(t,n),r.set(e,i)}addFacilityToLineMap(e,t,n,r){[...this.straightLadderMap,...this.staircaseMap].forEach(([i,o])=>{if(!(o.length<2))for(let a=0;a<o.length;a++){let l=`${o[a].floor}${w}${o[a].id}`,u=this.pointMap.get(l);if(!(!u||u.permission)){for(let c=0;c<o.length;c++)if(a!==c){let h=`${o[c].floor}${w}${o[c].id}`,p=this.pointMap.get(h);if(!p||p.permission)continue;if(o[a].type==="straightLadder"){let d=t;this.addLineItem(l,h,d,r)}else{let d=n;this.addLineItem(l,h,d,r)}}}}}),this.escalatorMap.forEach((i,o)=>{i.forEach(a=>{if(a.start&&a.end){let l=`${a.start.floor}${w}${a.start.id}`,u=`${a.end.floor}${w}${a.end.id}`,c=this.pointMap.get(l),h=this.pointMap.get(u);if(c&&h&&!c.permission&&!h.permission){let p=e;this.addLineItem(l,u,p,r)}}})})}initBaseRoute(){let e=new Map((0,yt.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new G.default(e)}initEscalatorRoute(){let e=new Map((0,yt.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new G.default(e)}initStraightLadderRoute(){let e=new Map((0,yt.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new G.default(e)}initForwardRoute(){this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let r=`${n.start.floor}${w}${n.start.id}`,i=`${n.end.floor}${w}${n.end.id}`,o=this.pointMap.get(r),a=this.pointMap.get(i);o&&a&&!o.permission&&!a.permission&&this.addLineItem(r,i,10,this.forwardLineMap)}})}),this.forwardRoute=new G.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${w}${e.nodeId}`);if(t){let[n,r]=t.split(w);return{floor:n,id:r}}}if(e.coord?.length){let t=this.roadInfo.find(r=>r.floor===e.floor);if(!t)return null;let n=t.points.reduce((r,i)=>{let o=A(e.coord,i.cds);return o<r.min&&(r.min=o,r.point=i),r},{min:1/0,point:t.points[0]});return{floor:t.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let n=this.parkingMap.get(`${e.floor}${w}${e.parkingSpace}`);if(n)return{floor:e.floor,id:n.id}}let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilities.filter(r=>+r.type_id==+e.facility).map(r=>r.id).map(r=>this.facilityMap.get(`${r}`)).flat(2)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n="",r){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;case"forward":a=this.getForwardPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o,r);if(o.facility){let u=this.facilities.filter(h=>+h.type_id==+t.facility).map(h=>h.id).map(h=>this.facilityMap.get(`${h}`)).flat(2).filter(h=>h).filter(h=>o.floor?h.floor===o.floor:!0);if(!u.length)return null;let c=u.map(h=>a(i,{floor:h.floor,id:h.id},r)).filter(h=>!!h);return c.reduce((h,p)=>{let d=p.reduce((m,f)=>m+at(f.points),0);return d<h.distance&&(h.distance=d,h.path=p),h},{distance:1/0,path:c[0]}).path}}getRoutePath(e,t,n){let r=`${e.floor}${w}${e.id}`,i=`${t.floor}${w}${t.id}`,o=n.path(r,i);if(!o)return null;let a=[];return o.map(l=>{let u=this.pointMap.get(l);if(u){let{floor:c}=u,h=u.type;if(this.isFacilityByType(u.type)){let p=this.facilities.find(d=>d.id===+u.targetId);p&&(h=p.entry_infra_type)}if(a[a.length-1]?.floor===c){let p=a[a.length-1];p.points.push(u.cds),p.endType=h,p.destId=u.nodeId,p.distance=at(p.points)}else a.push({floor:c,points:[u.cds],endType:h,destId:u.nodeId,distance:0})}}),a}getBasePath(e,t,n){if(!n)return this.getRoutePath(e,t,this.baseRoute);let r=(0,yt.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],r,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let i=new G.default(r);return this.getRoutePath(e,t,i)}getEscalatorPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.escalatorRoute);let r=(0,yt.cloneDeep)(this.escalatorRoute.graph),i=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],r,new Map([["escalator",1*i],["straightLadder",this.lift_priority*i],["staircase",3e4*i]]));let o=new G.default(r);return this.getRoutePath(e,t,o)}getStraightLadderPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.straightLadderRoute);let r=(0,yt.cloneDeep)(this.straightLadderRoute.graph),i=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],r,new Map([["escalator",3*i],["straightLadder",1*i],["staircase",3e4*i]]));let o=new G.default(r);return this.getRoutePath(e,t,o)}getForwardPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.forwardRoute);let r=(0,yt.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],r,new Map([["ramp",10]]));let i=new G.default(r);return this.getRoutePath(e,t,i)}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 G.default,this.escalatorRoute=new G.default,this.straightLadderRoute=new G.default}};var Nt=class{static keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let e=this.createKey();for(;this.keySet.has(e);)e=this.createKey();return e}static removeKey(e){this.keySet.delete(e)}static dispose(){this.keySet.clear()}};function vn(s){return s.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function lt(s,e,t){return new Promise((n,r)=>{let i=Nt.genUniqueKey(),o=({data:a})=>{a.type===`${e}_result`&&a.key===i&&(Nt.removeKey(i),self.removeEventListener("message",o),a.error?r(a.error):n(a.data))};s.addEventListener("message",o),s.postMessage({type:e,key:i,data:t})})}function Fi(s){let e={};for(let n in s)n.startsWith("on")&&(e[vn(n.slice(2))]=s[n]);let t=async({data:n})=>{if(e[n.type])try{let r=await e[n.type](n.data);self.postMessage({type:`${n.type}_result`,key:n.key,data:r})}catch(r){self.postMessage({type:`${n.type}_result`,key:n.key,error:r})}else self.postMessage({type:`${n.type}_result`,key:n.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var ut=require("three");function Ui(s,e=16711680){let t=new ut.LineBasicMaterial({color:e}),n=new ut.BufferGeometry().setFromPoints(s);return new ut.Line(n,t)}function Bi(s,e=16711680){let t=new ut.LineBasicMaterial({color:e}),n=new ut.BoxGeometry(1,1,1),r=new ut.Mesh(n,t);return r.position.copy(s),r}function X(s,e,t=0){s.forEach(n=>{n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"?(n.geometry.coords.map(r=>{Array.isArray(r)&&r.forEach(i=>{i[0]-=e[0],i[1]-=e[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(r=>r.map(i=>rt(i,e)))),n.doors?.length&&n.doors.map(r=>{r.coord=rt(r.coordinate,e)}),n.center&&(n.center=rt(n.center,e))):n.geometry.coords=rt(n.geometry.cds,e)});for(let n=0;n<s.length;n++){let r=s[n];r.deltaHeight=1e-5*(t+n+1)}}function rt(s,e){return[s[0]-e[0],s[1]-e[1]]}var mr=require("@tweenjs/tween.js"),Dt=class{pauseTween=!1;tweenStore=new Set;group=new mr.Group;constructor(){}update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(e=>{this.tweenStore.add(e),e.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(e=>{e.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(e){this.group.remove(e)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(e=>e.stop()),this.group.removeAll()}dispose(){this.clear()}};var S=require("three");var Or=require("three");var v=require("three");var yr=require("three/examples/jsm/lines/LineMaterial"),H=require("three");function _r(s){return`${s.x}-${s.y}-${s.z}`}var I=class{static lineMaterialMap=new Map;static meshStandardMaterialMap=new Map;static meshBasicMaterialMap=new Map;static shaderMaterialMap=new Map;static line2MaterialMap=new Map;static generateLineMaterialKey({color:e,opacity:t}){return`${e}-${t}`}static createLineMaterial({color:e,opacity:t}){let n=this.generateLineMaterialKey({color:e,opacity:t});if(this.lineMaterialMap.has(n))return this.lineMaterialMap.get(n);let r=new H.LineBasicMaterial({color:new H.Color(e).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(n,r),r}static createMeshStandardMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let r=new H.MeshStandardMaterial({color:new H.Color(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(n,r),r}static createMeshBasicMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshBasicMaterialMap.has(n))return this.meshBasicMaterialMap.get(n);let r=new H.MeshBasicMaterial({color:e,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(n,r),r}static createShaderMaterial({gradualColor:e,center:t,maxValue:n,opacity:r,direction:i,max:o,min:a}){let l=`${e.toString()}-${_r(t)}-${n}-${r}-${_r(i)}`;if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let u=`
|
|
1
|
+
"use strict";var mi=Object.create;var Me=Object.defineProperty;var _i=Object.getOwnPropertyDescriptor;var yi=Object.getOwnPropertyNames;var vi=Object.getPrototypeOf,xi=Object.prototype.hasOwnProperty;var Ct=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),Ei=(s,e)=>{for(var t in e)Me(s,t,{get:e[t],enumerable:!0})},jn=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of yi(e))!xi.call(s,r)&&r!==t&&Me(s,r,{get:()=>e[r],enumerable:!(n=_i(e,r))||n.enumerable});return s};var Zt=(s,e,t)=>(t=s!=null?mi(vi(s)):{},jn(e||!s||!s.__esModule?Me(t,"default",{value:s,enumerable:!0}):t,s)),bi=s=>jn(Me({},"__esModule",{value:!0}),s);var $n=Ct((Mo,Yn)=>{Yn.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var Jn=Ct((So,Zn)=>{var Kn=$n();Zn.exports=function(s,e){Array.isArray(e)||(e=[]),s.length>0&&e.push(Kn([0,0],s[0]));for(var t=0;t<s.length-1;t++){var n=s[t],r=s[t+1],i=n[0],o=n[1],a=r[0],l=r[1],u=[.75*i+.25*a,.75*o+.25*l],c=[.25*i+.75*a,.25*o+.75*l];e.push(u),e.push(c)}return s.length>1&&e.push(Kn([0,0],s[s.length-1])),e}});var rr=Ct((Co,nr)=>{var dn=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,t)=>e.priority-t.priority)}set(e,t){let n=Number(t);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(e)?this.queue.map(r=>(r.key===e&&Object.assign(r,{priority:n}),r)):(this.keys.add(e),this.queue.push({key:e,priority:n})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(t=>t.key===e)}};nr.exports=dn});var sr=Ct((Po,or)=>{function ir(s,e){let t=new Map;for(let[n,r]of s)n!==e&&r instanceof Map?t.set(n,ir(r,e)):n!==e&&t.set(n,r);return t}or.exports=ir});var ur=Ct((Ao,lr)=>{function Ni(s){let e=Number(s);return!(isNaN(e)||e<=0)}function ar(s){let e=new Map;return Object.keys(s).forEach(n=>{let r=s[n];if(r!==null&&typeof r=="object"&&!Array.isArray(r))return e.set(n,ar(r));if(!Ni(r))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,r);return e.set(n,Number(r))}),e}lr.exports=ar});var pr=Ct((Io,hr)=>{function cr(s){if(!(s instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof s}`);s.forEach((e,t)=>{if(typeof e=="object"&&e instanceof Map){cr(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}hr.exports=cr});var mn=Ct((Ro,gr)=>{var Di=rr(),Oi=sr(),fr=ur(),dr=pr(),gn=class{constructor(e){e instanceof Map?(dr(e),this.graph=e):e?this.graph=fr(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(dr(t),n=t):n=fr(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=Oi(this.graph,e),this}path(e,t,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let r=new Set,i=new Di,o=new Map,a=[],l=0,u=[];if(n.avoid&&(u=[].concat(n.avoid)),u.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(u.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(i.set(e,0);!i.isEmpty();){let c=i.next();if(c.key===t){l=c.priority;let p=c.key;for(;o.has(p);)a.push(p),p=o.get(p);break}r.add(c.key),(this.graph.get(c.key)||new Map).forEach((p,d)=>{if(r.has(d)||u.includes(d))return null;if(!i.has(d))return o.set(d,c.key),i.set(d,c.priority+p);let m=i.get(d).priority,f=c.priority+p;return f<m?(o.set(d,c.key),i.set(d,f)):null})}return a.length?(n.trim?a.shift():a=a.concat([e]),n.reverse||(a=a.reverse()),n.cost?{path:a,cost:l}:a):n.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};gr.exports=gn});var no={};Ei(no,{AibeeLoader:()=>Xn,BMap:()=>Tn,BMapSelect:()=>On,BaseSvg:()=>J,Context:()=>_e,CrLoader:()=>qn,CrNavPath:()=>Dn,Equipment:()=>Cn,Events:()=>ln,Floor:()=>ct,GlbModel:()=>he,Graphic:()=>R,GraphicLayer:()=>se,GroundTexture:()=>qt,HeatmapElement:()=>ie,HooksName:()=>Wt,HoverHelper:()=>me,Lane:()=>pe,Layer:()=>F,MapTypePolar:()=>Vr,MergeGraphic:()=>fe,Model:()=>oe,MulFloors:()=>In,NavPath:()=>Ln,Navigation:()=>An,Overlay:()=>re,PathDirection:()=>pn,PdrPosition:()=>Fn,Poi:()=>bt,Poi2:()=>q,PoiLayer:()=>ae,PoiLayer2:()=>Ut,RoadNetwork:()=>_n,RoadNetwork2:()=>yn,SelectBox:()=>En,Selection:()=>ge,Sensor:()=>Ee,Shadow:()=>ne,SvgLine:()=>le,SvgPolygon:()=>ue,TextTexture:()=>de,Timer:()=>D,TweenUtil:()=>Dt,UA:()=>sn,Wall:()=>ce,addAlphaToHexColor:()=>Ci,calc_angle:()=>tn,calc_direction:()=>we,convertToSnakeCase:()=>vn,createCircle:()=>Vt,createLine:()=>te,createRect:()=>mt,createSvg:()=>rn,createSvgElement:()=>Qt,createThreeBox:()=>Bi,createThreeLine:()=>Ui,darkenColor:()=>pt,defaultAibeeLoaderOption:()=>eo,defaultConfig:()=>zr,defaultGraphicOptions:()=>Te,defaultOptions:()=>Cr,defaultTextTextureOptions:()=>Nr,dispose:()=>V,distancePointToSegment:()=>hn,generatorKeyByObj:()=>Lt,getAngle:()=>tr,getCenter:()=>Jt,getConfig:()=>wn,getDirectPath:()=>Li,getDistanceByPathPos:()=>fn,getLength:()=>A,getLongestSideDir:()=>Mi,getMinEdgeSquare:()=>en,getPathLength:()=>at,getPointEdgeIndex:()=>Pt,getPosByPathDistance:()=>ee,hasChinese:()=>Qe,hexToRgb:()=>Se,initDirectionalLight:()=>Je,initLight:()=>Ze,initShape:()=>st,isAndroid:()=>Pi,isContain:()=>gt,isControl:()=>Rt,isIphone:()=>Ht,isMac:()=>It,isPointInPolygon:()=>nn,loadBuildingGround:()=>Un,loadExternalStreet:()=>$i,loadGraphics:()=>Bn,moveOnRoute:()=>Ri,proxyOptions:()=>At,removeWeightPath:()=>er,setCirclePosition:()=>_t,setLineStartEnd:()=>et,setRectPosition:()=>B,simplifyPath:()=>cn,sleepOnePromise:()=>on,sleepOneRf:()=>wi,smoothPath:()=>un,strToNumber:()=>Ti,timeoutPromise:()=>Z,toWebWorker:()=>Fi,transformGraphicData:()=>X,translatePosToCenter:()=>rt,triggerWorker:()=>lt,vector3ToDevice:()=>y,xhrGet:()=>Ai});module.exports=bi(no);var Ge=require("three");var D=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(e){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),e()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(e){this.tasks.requestAnimation.delete(e),window.cancelAnimationFrame(e)}setTimeout(e,t){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),e()},t);return this.tasks.timeout.add(n),n}clearTimeout(e){this.tasks.timeout.delete(e),window.clearTimeout(e)}setInterval(e,t){let n=window.setInterval(()=>{this.tasks.interval.delete(n),e()},t);return this.tasks.interval.add(n),n}clearInterval(e){this.tasks.interval.delete(e),window.clearInterval(e)}dispose(){this.tasks.requestAnimation.forEach(e=>{window.cancelAnimationFrame(e)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(e=>{window.clearTimeout(e)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(e=>{window.clearInterval(e)}),this.tasks.interval.clear()}};var K=require("three");function Ze(){let s=new K.Group,e=new K.AmbientLight(16777215,2.6);return s.add(e),s}function st(s,e=[]){let t=new K.Shape(s.map(n=>new K.Vector2(...n)));return e.length&&e.forEach(n=>{var r=new K.Path(n.map(i=>new K.Vector2(...i)));t.holes.push(r)}),t}function Je(s=16777215,e=1){let t=new K.DirectionalLight(s,e);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function V(s,e){if(e&&s.children&&s.children.length&&s.children.forEach(t=>{V(t,e)}),s.isMesh){let t=s;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n.dispose()}):t.material.dispose())}s.isLight&&s.dispose?.()}function Qe(s){return/[\u4E00-\u9FA5]+/g.test(s)}var C=require("three"),kt=require("@turf/turf");function y(s,e,t,n){let r=s.clone().project(e),i=t/2,o=n/2,a=Math.round(r.x*i+i),l=Math.round(-r.y*o+o);return{x:a,y:l}}function Jt(s){let e=(0,kt.featureCollection)(s.map(n=>(0,kt.point)(n)));return(0,kt.center)(e).geometry.coordinates}function gt(s,e,t){return s.x>=e.x&&s.x<=t.x&&s.y>=e.y&&s.y<=t.y}function Mi(s){let e=0,t=new C.Vector3;for(let n=1;n<s.length;n++){let r=new C.Vector3(s[n-1][0],s[n-1][1],0),i=new C.Vector3(s[n][0],s[n][1],0),o=i.distanceTo(r);o>e&&(e=o,t=i.clone().sub(r).normalize())}return t}function A(s,e){return Math.sqrt((e[0]-s[0])**2+(e[1]-s[1])**2)}function at(s){let e=0;for(let t=0;t<s.length-1;t++)e+=A(s[t],s[t+1]);return e}function tn(s,e,t){let n=new C.Vector2(e[0]-s[0],e[1]-s[1]),r=new C.Vector2(e[0]-t[0],e[1]-t[1]),o=n.angleTo(r)*180/Math.PI,a=new C.Vector2(e[0]-s[0],e[1]-s[1]);return new C.Vector2(t[0]-s[0],t[1]-s[1]).cross(a)>0?o:-o}function en(s,e){let t=Math.min(A(s[0][0],s[0][1]),A(s[0][2],s[0][1]))-1;e||(e=Jt(s[0]));let n=Si(e,t),r=new C.Vector2(s[0][0][0],s[0][0][1]),i=new C.Vector2(s[0][1][0],s[0][1][1]),o=new C.Vector2(s[0][2][0],s[0][2][1]),l=(r.distanceTo(i)>i.distanceTo(o)?i.clone().sub(r):o.clone().sub(i)).angleTo(new C.Vector2(0,1)),u=new C.Matrix3;return u.multiply(new C.Matrix3().translate(e[0],e[1])).multiply(new C.Matrix3().rotate(l)).multiply(new C.Matrix3().translate(-e[0],-e[1])),[n.map(c=>{let h=new C.Vector2(c[0],c[1]).applyMatrix3(u);return[h.x,h.y]})]}function Si(s,e){let t=e/2;return[[s[0]-t,s[1]+t],[s[0]+t,s[1]+t],[s[0]+t,s[1]-t],[s[0]-t,s[1]-t],[s[0]-t,s[1]+t]]}function Pt(s,e){let t=0,n=1/0,[r,i]=e;for(let o=0;o<s.length-1;o++){let[a,l]=s[o],[u,c]=s[o+1],h=Math.min(a,u)<=r&&r<=Math.max(a,u),p=Math.min(l,c)<=i&&i<=Math.max(l,c);if(h&&p){let d=Math.abs((u-a)*(i-l)-(c-l)*(r-a));d<n&&(n=d,t=o)}}return t}function nn(s,e){let t=s[0],n=s[1],r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let a=e[i][0],l=e[i][1],u=e[o][0],c=e[o][1];l>n!=c>n&&t<(u-a)*(n-l)/(c-l)+a&&(r=!r)}return r}function At(s,e){return new Proxy(s,{get:(t,n,r)=>Reflect.get(t,n,r),set:(t,n,r,i)=>{let o=Reflect.get(t,n,i),a=Reflect.set(t,n,r,i);return o!==r&&e.dispatchEvent({type:`change-${n}`,value:r}),a}})}function Z(s,e){return Promise.race([s,new Promise((t,n)=>{setTimeout(()=>n(new Error("Promise timeout")),e)})])}function Qt(s){return document.createElementNS("http://www.w3.org/2000/svg",s)}function rn(s,e){let t=Qt("svg");return t.setAttribute("width",s),t.setAttribute("height",e),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function Vt(s="2",e){let t=Qt("circle");return t.setAttribute("r",s),t.setAttribute("fill",e),t}function te(s){let e=Qt("line");return e.setAttribute("stroke",s),e}function mt(s,e){let t=Qt("rect");return t.setAttribute("stroke",s),t.setAttribute("fill",e),t}function _t(s,e,t){s.setAttribute("cx",`${e}`),s.setAttribute("cy",`${t}`)}function et(s,e,t){e&&(s.setAttribute("x1",`${e.x}`),s.setAttribute("y1",`${e.y}`)),t&&(s.setAttribute("x2",`${t.x}`),s.setAttribute("y2",`${t.y}`))}function B(s,e,t,n,r){s.setAttribute("x",`${e}`),s.setAttribute("y",`${t}`),s.setAttribute("width",`${n}`),s.setAttribute("height",`${r}`)}function on(){return Promise.resolve()}function wi(){return new Promise(s=>{requestAnimationFrame(s)})}function Ti(s){return parseInt(s.replace("#","0x"),16)}function Ci(s,e){let t=parseInt(s.substring(1,3),16),n=parseInt(s.substring(3,5),16),r=parseInt(s.substring(5,7),16),i=Math.round(t*e),o=Math.round(n*e),a=Math.round(r*e);return`#${(1<<24|i<<16|o<<8|a).toString(16).slice(1)}`}function pt(s,e=.85){let t,n,r;if(s.startsWith("#"))t=parseInt(s.substring(1,3),16),n=parseInt(s.substring(3,5),16),r=parseInt(s.substring(5,7),16);else{let o=s.slice(4,-1).split(",");t=parseInt(o[0].trim()),n=parseInt(o[1].trim()),r=parseInt(o[2].trim())}return t=Math.min(Math.floor(t*e),255),n=Math.min(Math.floor(n*e),255),r=Math.min(Math.floor(r*e),255),"#"+((1<<24)+(t<<16)+(n<<8)+r).toString(16).slice(1)}function Se(s,e){s=s.replace(/^#/,"");let t=parseInt(s.substring(0,2),16),n=parseInt(s.substring(2,4),16),r=parseInt(s.substring(4,6),16);return e!==void 0?`rgba(${t}, ${n}, ${r}, ${e})`:`rgb(${t}, ${n}, ${r})`}var It=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,sn=(window.navigator.userAgent||"").toLocaleLowerCase(),Ht=/ios|iphone/i.test(sn),Pi=/android|adr|linux/gi.test(sn);function Rt(s){return It?s==="Meta":s==="Control"}var an="__once__",ln=class{events=new Map;on(e,t){if(typeof t!="function")return;let n=this.events.get(e);return n?n.add(t):this.events.set(e,new Set([t]))}once(e,t){if(typeof t!="function")return;let n=`${an}${e}`,r=this.events.get(n);return r?r.add(t):this.events.set(n,new Set([t]))}off(e,t){let n=this.events.get(e),r=this.events.get(`${an}${e}`);!n&&!r||(t===void 0&&(n?.clear(),r?.clear()),n?.has(t)&&n.delete(t),r?.has(t)&&r.delete(t))}offAll(){this.events.clear()}emit(e,...t){let n=this.events.get(e),r=this.events.get(`${an}${e}`);!n&&!r||(n?.forEach(i=>{typeof i=="function"&&i(...t)}),r?.forEach(i=>{typeof i=="function"&&i(...t)}),r?.clear())}};var Wt=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(Wt||{});function Lt(s){return Object.keys(s).sort().map(e=>`${e}=${s[e]}`).join("&")}function Ai(s,e){return new Promise((t,n)=>{let r=new XMLHttpRequest;r.open("GET",s,!0),Object.keys(e.headers||{}).forEach(i=>{r.setRequestHeader(i,e.headers[i])}),e.responseType&&(r.responseType=e.responseType),r.onload=()=>{if(r.status>=200&&r.status<300)if(e.responseType==="arraybuffer")t(r.response);else try{let i=JSON.parse(r.responseText);t(i)}catch(i){n(i)}else n(r.statusText)},r.onerror=()=>{n(r.statusText)},r.send()})}var Xt=require("three"),Qn=Zt(Jn(),1);function tr(s,e){let t=s.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function Ii(s){let e=0;return s.reduce(([t,n],[r,i])=>(e+=Math.sqrt((r-t)**2+(i-n)**2),[r,i])),e/s.length}function un(s,e=.25){if(Ii(s)<e)return s;let t=(0,Qn.default)(s);return un(t,e)}function cn(s,e=!1,t=!0,n=5,r=150,i=3){let o=[],a=!e;if(o.push(s[0]),s.length<2)return o;for(let u=0;u<s.length-2;u+=1){let c=s[u],h=s[u+1],p=s[u+2],d=new Xt.Vector2(c[0]-h[0],c[1]-h[1]),m=new Xt.Vector2(p[0]-h[0],p[1]-h[1]),f=tr(d,m)/Math.PI*180,g=d.length()+m.length();(!a||f<r&&g>.01||g>n)&&(o.push(s[u+1]),a=!0)}if(o.push(s[s.length-1]),!t)return o;let l=[];l.push(o[0]);for(let u=0;u<o.length-2;u+=1){let c=new Xt.Vector2(o[u][0],o[u][1]),h=new Xt.Vector2(o[u+1][0],o[u+1][1]),p=new Xt.Vector2(o[u+2][0],o[u+2][1]),d=c.distanceTo(h)/2,m=p.distanceTo(h)/2,f=h.clone(),g=h.clone();f.add(c.clone().sub(h).normalize().multiplyScalar(d>i?i/2:d)),g.add(p.clone().sub(h).normalize().multiplyScalar(m>i?i/2:m));let E=[[f.x,f.y],[h.x,h.y],[g.x,g.y]];l.push(...un(E,i/25))}return l.push(o[o.length-1]),er(l)}function er(s){if(s.length<=1)return s;let e=[],t;return s.forEach(([n,r])=>{t?n===t[0]&&r===t[1]||(t=[n,r],e.push([n,r])):(t=[n,r],e.push([n,r]))}),e}function hn(s,e,t){let n=Math.sqrt((t[0]-e[0])**2+(t[1]-e[1])**2);if(n===0)return{distance:Math.sqrt((s[0]-e[0])**2+(s[1]-e[1])**2),closestPoint:e.slice(0)};let r=Math.max(0,Math.min(1,((s[0]-e[0])*(t[0]-e[0])+(s[1]-e[1])*(t[1]-e[1]))/n**2)),i=[e[0]+r*(t[0]-e[0]),e[1]+r*(t[1]-e[1])];return{distance:Math.sqrt((s[0]-i[0])**2+(s[1]-i[1])**2),closestPoint:i}}function Ri(s,e,t){let[n,r]=s,[i,o]=e,a=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2));if(a===0||a<t)return[...e];let l=t/a,u=n+(i-n)*l,c=r+(o-r)*l;return[u,c]}var pn=(u=>(u.START="start",u.END="end",u.FRONT="front",u.RIGHT="right",u.LEFT="left",u.RIGHT_FRONT="right_front",u.LEFT_FRONT="left_front",u.RIGHT_BACK="right_back",u.LEFT_BACK="left_back",u))(pn||{});function we(s,e,t){let n=tn(s,e,t);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function Li(s){if(!s.length)return[];let e=[{direction:"start",distance:A(s[0],s[1]),points:[s[0],s[1]]}];for(let t=2;t<s.length;t++){let n=we(s[t-2],s[t-1],s[t]);if(n==="front"){let r=e[e.length-1],i=A(s[t-1],s[t]);r.distance+=i,t!==2&&r.points.push(s[t-1])}else e.push({direction:n,distance:A(s[t-1],s[t]),points:[s[t-1],s[t]]})}return e.push({direction:"end",distance:0,points:[s[s.length-1]]}),e}function fn(s,e){if(s.length<2)return-1;let t=0;for(let n=1;n<s.length;n++){let r=s[n-1],i=s[n],o=[e[0]-r[0],e[1]-r[1]],a=[i[0]-r[0],i[1]-r[1]],l=Math.min(i[0],r[0])<=e[0]&&e[0]<=Math.max(i[0],r[0]),u=Math.min(i[1],r[1])<=e[1]&&e[1]<=Math.max(i[1],r[1]);if(l&&u){let c=o[0]*a[1]-o[1]*a[0];if(Math.abs(c)<1e-6){let h=Math.sqrt((e[0]-r[0])**2+(e[1]-r[1])**2);return t+h}}t+=Math.sqrt((i[0]-r[0])**2+(i[1]-r[1])**2)}return-1}function ee(s,e){if(s.length<2)return s[0]??null;let t=0;for(let n=1;n<s.length;n++){let r=s[n-1],i=s[n],o=Math.sqrt((i[0]-r[0])**2+(i[1]-r[1])**2);if(t+=o,t>=e){let a=(e-(t-o))/o,l=r[0]+(i[0]-r[0])*a,u=r[1]+(i[1]-r[1])*a;return[l,u]}}return null}var ft=Zt(mn(),1);var nt="___",_n=class{constructor(e=3){this.lift_priority=e}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new ft.default;escalatorRoute=new ft.default;straightLadderRoute=new ft.default;initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(t=>{t.points.forEach(n=>{let r=`${t.floor}${nt}${n.id}`;if(this.pointMap.set(r,n),this.nodeMap.set(`${n.floor}${nt}${n.nodeId}`,r),n.type==="straightLadder"){let i=this.straightLadderMap.get(n.name)||[];i.push({...n}),this.straightLadderMap.set(n.name,i)}if(n.type==="staircase"){let i=this.staircaseMap.get(n.name)||[];i.push({...n}),this.staircaseMap.set(n.name,i)}if(n.type==="escalator"){let i=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?i.end={floor:n.floor,id:n.id}:i.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,i)}if(n.type==="facility"){let i=this.facilityMap.get(n.targetId)||[];i.push({...n}),this.facilityMap.set(n.targetId,i)}}),t.lines.filter(n=>n.direction!=="no").forEach(n=>{let r=`${t.floor}${nt}${n.from}`,i=`${t.floor}${nt}${n.to}`,o=this.pointMap.get(r)?.cds,a=this.pointMap.get(i)?.cds;if(o?.length&&a?.length){let l=A(o,a);this.addLineItem(r,i,l),n.direction==="double"&&this.addLineItem(i,r,l)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,t,n,r=this.lineMap){let i=r.get(e)||new Map;i.set(t,n),r.set(e,i)}addFacilityToLineMap(e,t,n,r){[...this.straightLadderMap,...this.staircaseMap].forEach(([i,o])=>{if(!(o.length<2))for(let a=0;a<o.length;a++){let l=`${o[a].floor}${nt}${o[a].id}`;for(let u=0;u<o.length;u++)if(a!==u){let c=`${o[u].floor}${nt}${o[u].id}`,h=this.pointMap.get(l)?.cds,p=this.pointMap.get(c)?.cds;if(h?.length&&p?.length)if(o[a].type==="straightLadder"){let d=t;this.addLineItem(l,c,d,r)}else{let d=n;this.addLineItem(l,c,d,r)}}}}),this.escalatorMap.forEach((i,o)=>{if(i.start&&i.end){let a=`${i.start.floor}${nt}${i.start.id}`,l=`${i.end.floor}${nt}${i.end.id}`,u=this.pointMap.get(a)?.cds,c=this.pointMap.get(l)?.cds;if(u?.length&&c?.length){let h=e;this.addLineItem(a,l,h,r)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new ft.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new ft.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new ft.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${nt}${e.nodeId}`);if(t){let[n,r]=t.split(nt);return{floor:n,id:r}}}if(e.coord?.length){let t=this.roadInfo.find(r=>r.floor===e.floor);if(!t)return null;let n=t.points.reduce((r,i)=>{let o=A(e.coord,i.cds);return o<r.min&&(r.min=o,r.point=i),r},{min:1/0,point:t.points[0]});return{floor:n.point.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let r=this.transformStart(e);if(!r)return"no-start";let i=this.transformEnd(t);if(!i)return"no-end";let o=this.getBasePath.bind(this);switch(n){case"escalator":o=this.getEscalatorPath.bind(this);break;case"straightLadder":o=this.getStraightLadderPath.bind(this);break;default:o=this.getBasePath.bind(this);break}if(i.id)return o(r,i);if(i.facility){let a=this.facilityMap.get(i.facility).filter(u=>i.floor?u.floor===i.floor:!0);if(!a.length)return null;let l=a.map(u=>o(r,{floor:u.floor,id:u.id})).filter(u=>!!u);return l.reduce((u,c)=>{let h=c.reduce((p,d)=>p+at(d.points),0);return h<u.distance&&(u.distance=h,u.path=c),u},{distance:1/0,path:l[0]}).path}}getRoutePath(e,t,n){let r=`${e.floor}${nt}${e.id}`,i=`${t.floor}${nt}${t.id}`,o=n.path(r,i);if(!o)return null;let a=[];return o.map(l=>{let u=this.pointMap.get(l);if(u){let{floor:c}=u;if(a[a.length-1]?.floor===c){let h=a[a.length-1];h.points.push(u.cds),h.endType=u.type,h.destId=u.nodeId,h.distance=at(h.points)}else a.push({floor:c,points:[u.cds],endType:u.type,destId:u.nodeId,distance:0})}}),a}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new ft.default,this.escalatorRoute=new ft.default,this.straightLadderRoute=new ft.default}};var G=Zt(mn(),1);var yt=require("lodash"),w="___",yn=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new G.default;escalatorRoute=new G.default;straightLadderRoute=new G.default;forwardLineMap=new Map;forwardRoute=new G.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(t=>{let n=[];try{n=JSON.parse(t.entry_end_floor)}catch{n=[]}let r=[];try{r=JSON.parse(t.entry_start_floor)}catch{r=[]}return{...t,entry_start_floor:r,entry_end_floor:n}})}initRoute(e,t){this.clear(),this.roadInfo=e,this.initFacilities(t);let n=new Date,r=n.getHours()*60+n.getMinutes();e.length&&(e.forEach(i=>{(i.points||[]).filter(o=>o.openStatus!==!1).filter(o=>{if(!o.startTime||!o.endTime)return!0;let[a,l]=o.startTime.split(":").map(d=>+d),[u,c]=o.endTime.split(":").map(d=>+d),h=a*60+l,p=u*60+c;return r>=h&&r<=p}).forEach(o=>{o.floor=i.floor;let a=`${i.floor}${w}${o.id}`;if(this.nodeMap.set(`${i.floor}${w}${o.nodeId}`,`${i.floor}${w}${o.relatedId||o.id}`),this.pointMap.set(a,o),this.isFacilityByType(o.type)){let l=this.facilities.find(u=>u.id===+o.targetId);if(l){switch(l.entry_infra_type){case"straightLadder":if(l.entry_end_floor.find(p=>p.floor===i.floor)&&l.entry_start_floor.find(p=>p.floor===i.floor)){let p=this.straightLadderMap.get(o.targetId)||[];p.push({...o}),this.straightLadderMap.set(o.targetId,p)}break;case"staircase":if(l.entry_end_floor.find(p=>p.floor===i.floor)&&l.entry_start_floor.find(p=>p.floor===i.floor)){let p=this.staircaseMap.get(o.targetId)||[];p.push({...o}),this.staircaseMap.set(o.targetId,p)}break;case"escalator":let c=this.escalatorMap.get(o.targetId)||[];if(l.entry_start_floor.find(p=>p.floor===i.floor)){let p=c.find(d=>d.end?.floor!==i.floor&&!d.start);p?p.start=o:c.push({start:o})}if(l.entry_end_floor.find(p=>p.floor===i.floor)){let p=c.find(d=>d.start?.floor!==i.floor&&!d.end);p?p.end=o:c.push({end:o})}this.escalatorMap.set(o.targetId,c);break;case"ramp":let h=this.rampMap.get(o.targetId)||[];if(l.entry_start_floor.find(p=>p.floor===i.floor)){let p=h.find(d=>d.end?.floor!==i.floor&&!d.start);p?p.start=o:h.push({start:o})}if(l.entry_end_floor.find(p=>p.floor===i.floor)){let p=h.find(d=>d.start?.floor!==i.floor&&!d.end);p?p.end=o:h.push({end:o})}this.rampMap.set(o.targetId,h);break}let u=this.facilityMap.get(o.targetId)||[];u.push({...o}),this.facilityMap.set(o.targetId,u)}}o.type==="parkingSpace"&&this.parkingMap.set(`${i.floor}${w}${o.name}`,o)}),(i.lines||[]).filter(o=>o.direction!=="no").forEach(o=>{let a=`${i.floor}${w}${o.from}`,l=`${i.floor}${w}${o.to}`,u=this.pointMap.get(a),c=this.pointMap.get(l);if(!u||!c)return;let h=u.cds,p=c.cds,d=A(h,p);if(!u.permission&&!c.permission)switch(this.addLineItem(a,l,d),this.addLineItem(l,a,d),o.direction){case"double":this.addLineItem(a,l,d,this.forwardLineMap),this.addLineItem(l,a,d,this.forwardLineMap);break;case"single":this.addLineItem(a,l,d,this.forwardLineMap);break;case"back":this.addLineItem(l,a,d,this.forwardLineMap);break}else u.permission&&(this.setPermissionLine(a,l,u.permission,d,""),this.setPermissionLine(l,a,u.permission,d,"")),c.permission&&c.permission!==u.permission&&(this.setPermissionLine(a,l,c.permission,d,""),this.setPermissionLine(l,a,c.permission,d,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[`permission_${e}`]||(this[`permission_${e}`]=new Set),this[`permission_${e}`]}setPermissionLine(e,t,n,r,i){this.getPermissionMap(n).add({fromKey:e,toKey:t,distance:r,type:i})}addPermissionFacility(){this.straightLadderMap.forEach((e,t)=>{if(e.length<2){this.straightLadderMap.delete(t);return}for(let n=0;n<e.length;n++){let r=`${e[n].floor}${w}${e[n].id}`,i=this.pointMap.get(r);if(i){for(let o=0;o<e.length;o++)if(n!==o){let a=`${e[o].floor}${w}${e[o].id}`,l=this.pointMap.get(a);if(!l)continue;i.permission&&this.setPermissionLine(r,a,i.permission,1,"straightLadder"),l.permission&&l.permission!==i.permission&&this.setPermissionLine(r,a,l.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,t)=>{if(e.length<2){this.staircaseMap.delete(t);return}for(let n=0;n<e.length;n++){let r=`${e[n].floor}${w}${e[n].id}`,i=this.pointMap.get(r);if(i){for(let o=0;o<e.length;o++)if(n!==o){let a=`${e[o].floor}${w}${e[o].id}`,l=this.pointMap.get(a);if(!l)continue;i.permission&&this.setPermissionLine(r,a,i.permission,1,"staircase"),l.permission&&l.permission!==i.permission&&this.setPermissionLine(r,a,l.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let r=`${n.start.floor}${w}${n.start.id}`,i=`${n.end.floor}${w}${n.end.id}`,o=this.pointMap.get(r),a=this.pointMap.get(i);o&&a&&(o.permission&&this.setPermissionLine(r,i,o.permission,1,"escalator"),a.permission&&a.permission!==o.permission&&this.setPermissionLine(r,i,a.permission,1,"escalator"))}})}),this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let r=`${n.start.floor}${w}${n.start.id}`,i=`${n.end.floor}${w}${n.end.id}`,o=this.pointMap.get(r),a=this.pointMap.get(i);o&&a&&(o.permission&&this.setPermissionLine(r,i,o.permission,10,"ramp"),a.permission&&a.permission!==o.permission&&this.setPermissionLine(r,i,a.permission,10,"ramp"))}})})}addPermissionLineToMap(e,t,n,r){let i=this.getPermissionMap(e);console.log(i),i.forEach(o=>{t.includes(o.type)&&(o.type===""?this.addLineItem(o.fromKey,o.toKey,o.distance,n):this.addLineItem(o.fromKey,o.toKey,r.get(o.type),n))})}addLineItem(e,t,n,r=this.lineMap){let i=r.get(e)||new Map;i.set(t,n),r.set(e,i)}addFacilityToLineMap(e,t,n,r){[...this.straightLadderMap,...this.staircaseMap].forEach(([i,o])=>{if(!(o.length<2))for(let a=0;a<o.length;a++){let l=`${o[a].floor}${w}${o[a].id}`,u=this.pointMap.get(l);if(!(!u||u.permission)){for(let c=0;c<o.length;c++)if(a!==c){let h=`${o[c].floor}${w}${o[c].id}`,p=this.pointMap.get(h);if(!p||p.permission)continue;if(o[a].type==="straightLadder"){let d=t;this.addLineItem(l,h,d,r)}else{let d=n;this.addLineItem(l,h,d,r)}}}}}),this.escalatorMap.forEach((i,o)=>{i.forEach(a=>{if(a.start&&a.end){let l=`${a.start.floor}${w}${a.start.id}`,u=`${a.end.floor}${w}${a.end.id}`,c=this.pointMap.get(l),h=this.pointMap.get(u);if(c&&h&&!c.permission&&!h.permission){let p=e;this.addLineItem(l,u,p,r)}}})})}initBaseRoute(){let e=new Map((0,yt.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new G.default(e)}initEscalatorRoute(){let e=new Map((0,yt.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new G.default(e)}initStraightLadderRoute(){let e=new Map((0,yt.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new G.default(e)}initForwardRoute(){this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let r=`${n.start.floor}${w}${n.start.id}`,i=`${n.end.floor}${w}${n.end.id}`,o=this.pointMap.get(r),a=this.pointMap.get(i);o&&a&&!o.permission&&!a.permission&&this.addLineItem(r,i,10,this.forwardLineMap)}})}),this.forwardRoute=new G.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${w}${e.nodeId}`);if(t){let[n,r]=t.split(w);return{floor:n,id:r}}}if(e.coord?.length){let t=this.roadInfo.find(r=>r.floor===e.floor);if(!t)return null;let n=t.points.reduce((r,i)=>{let o=A(e.coord,i.cds);return o<r.min&&(r.min=o,r.point=i),r},{min:1/0,point:t.points[0]});return{floor:t.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let n=this.parkingMap.get(`${e.floor}${w}${e.parkingSpace}`);if(n)return{floor:e.floor,id:n.id}}let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilities.filter(r=>+r.type_id==+e.facility).map(r=>r.id).map(r=>this.facilityMap.get(`${r}`)).flat(2)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n="",r){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;case"forward":a=this.getForwardPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o,r);if(o.facility){let u=this.facilities.filter(h=>+h.type_id==+t.facility).map(h=>h.id).map(h=>this.facilityMap.get(`${h}`)).flat(2).filter(h=>h).filter(h=>o.floor?h.floor===o.floor:!0);if(!u.length)return null;let c=u.map(h=>a(i,{floor:h.floor,id:h.id},r)).filter(h=>!!h);return c.reduce((h,p)=>{let d=p.reduce((m,f)=>m+at(f.points),0);return d<h.distance&&(h.distance=d,h.path=p),h},{distance:1/0,path:c[0]}).path}}getRoutePath(e,t,n){let r=`${e.floor}${w}${e.id}`,i=`${t.floor}${w}${t.id}`,o=n.path(r,i);if(!o)return null;let a=[];return o.map(l=>{let u=this.pointMap.get(l);if(u){let{floor:c}=u,h=u.type;if(this.isFacilityByType(u.type)){let p=this.facilities.find(d=>d.id===+u.targetId);p&&(h=p.entry_infra_type)}if(a[a.length-1]?.floor===c){let p=a[a.length-1];p.points.push(u.cds),p.endType=h,p.destId=u.nodeId,p.distance=at(p.points)}else a.push({floor:c,points:[u.cds],endType:h,destId:u.nodeId,distance:0})}}),a}getBasePath(e,t,n){if(!n)return this.getRoutePath(e,t,this.baseRoute);let r=(0,yt.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],r,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let i=new G.default(r);return this.getRoutePath(e,t,i)}getEscalatorPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.escalatorRoute);let r=(0,yt.cloneDeep)(this.escalatorRoute.graph),i=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],r,new Map([["escalator",1*i],["straightLadder",this.lift_priority*i],["staircase",3e4*i]]));let o=new G.default(r);return this.getRoutePath(e,t,o)}getStraightLadderPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.straightLadderRoute);let r=(0,yt.cloneDeep)(this.straightLadderRoute.graph),i=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],r,new Map([["escalator",3*i],["straightLadder",1*i],["staircase",3e4*i]]));let o=new G.default(r);return this.getRoutePath(e,t,o)}getForwardPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.forwardRoute);let r=(0,yt.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],r,new Map([["ramp",10]]));let i=new G.default(r);return this.getRoutePath(e,t,i)}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 G.default,this.escalatorRoute=new G.default,this.straightLadderRoute=new G.default}};var Nt=class{static keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let e=this.createKey();for(;this.keySet.has(e);)e=this.createKey();return e}static removeKey(e){this.keySet.delete(e)}static dispose(){this.keySet.clear()}};function vn(s){return s.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function lt(s,e,t){return new Promise((n,r)=>{let i=Nt.genUniqueKey(),o=({data:a})=>{a.type===`${e}_result`&&a.key===i&&(Nt.removeKey(i),self.removeEventListener("message",o),a.error?r(a.error):n(a.data))};s.addEventListener("message",o),s.postMessage({type:e,key:i,data:t})})}function Fi(s){let e={};for(let n in s)n.startsWith("on")&&(e[vn(n.slice(2))]=s[n]);let t=async({data:n})=>{if(e[n.type])try{let r=await e[n.type](n.data);self.postMessage({type:`${n.type}_result`,key:n.key,data:r})}catch(r){self.postMessage({type:`${n.type}_result`,key:n.key,error:r})}else self.postMessage({type:`${n.type}_result`,key:n.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var ut=require("three");function Ui(s,e=16711680){let t=new ut.LineBasicMaterial({color:e}),n=new ut.BufferGeometry().setFromPoints(s);return new ut.Line(n,t)}function Bi(s,e=16711680){let t=new ut.LineBasicMaterial({color:e}),n=new ut.BoxGeometry(1,1,1),r=new ut.Mesh(n,t);return r.position.copy(s),r}function X(s,e,t=0){s.forEach(n=>{n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"?(n.geometry.coords.map(r=>{Array.isArray(r)&&r.forEach(i=>{i[0]-=e[0],i[1]-=e[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(r=>r.map(i=>rt(i,e)))),n.doors?.length&&n.doors.map(r=>{r.coord=rt(r.coordinate,e)}),n.center&&(n.center=rt(n.center,e))):n.geometry.coords=rt(n.geometry.cds,e)});for(let n=0;n<s.length;n++){let r=s[n];r.deltaHeight=1e-5*(t+n+1)}}function rt(s,e){return[s[0]-e[0],s[1]-e[1]]}var mr=require("@tweenjs/tween.js"),Dt=class{pauseTween=!1;tweenStore=new Set;group=new mr.Group;constructor(){}update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(e=>{this.tweenStore.add(e),e.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(e=>{e.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(e){this.group.remove(e)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(e=>e.stop()),this.group.removeAll()}dispose(){this.clear()}};var M=require("three");var Or=require("three");var v=require("three");var yr=require("three/examples/jsm/lines/LineMaterial"),H=require("three");function _r(s){return`${s.x}-${s.y}-${s.z}`}var I=class{static lineMaterialMap=new Map;static meshStandardMaterialMap=new Map;static meshBasicMaterialMap=new Map;static shaderMaterialMap=new Map;static line2MaterialMap=new Map;static generateLineMaterialKey({color:e,opacity:t}){return`${e}-${t}`}static createLineMaterial({color:e,opacity:t}){let n=this.generateLineMaterialKey({color:e,opacity:t});if(this.lineMaterialMap.has(n))return this.lineMaterialMap.get(n);let r=new H.LineBasicMaterial({color:new H.Color(e).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(n,r),r}static createMeshStandardMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let r=new H.MeshStandardMaterial({color:new H.Color(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(n,r),r}static createMeshBasicMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshBasicMaterialMap.has(n))return this.meshBasicMaterialMap.get(n);let r=new H.MeshBasicMaterial({color:e,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(n,r),r}static createShaderMaterial({gradualColor:e,center:t,maxValue:n,opacity:r,direction:i,max:o,min:a}){let l=`${e.toString()}-${_r(t)}-${n}-${r}-${_r(i)}`;if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let u=`
|
|
2
2
|
uniform vec3 uColor;
|
|
3
3
|
uniform vec3 uGradualColor;
|
|
4
4
|
uniform vec3 center;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
void main() {
|
|
36
36
|
gl_FragColor = vec4(vColor.x, vColor.y, vColor.z, opacity);
|
|
37
37
|
}
|
|
38
|
-
`,h=new H.ShaderMaterial({uniforms:{uColor:{value:new H.Color(e[0]).convertLinearToSRGB()},uGradualColor:{value:new H.Color(e[1]).convertLinearToSRGB()},center:{value:t},maxValue:{value:n},opacity:{value:r},uDirection:{value:i},uMax:{value:o},uMin:{value:a}},vertexShader:u,fragmentShader:c,side:H.DoubleSide});return this.shaderMaterialMap.set(l,h),h}static createLine2MaterialMap({color:e,width:t,dashed:n,resolution:r}){let i=`${e}-${t}-${n}-${r.x}-${r.y}`;if(this.line2MaterialMap.has(i))return this.line2MaterialMap.get(i);let o=new yr.LineMaterial({color:parseInt(e.slice(1),16),dashed:n,linewidth:t,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:r});return this.line2MaterialMap.set(i,o),o}static dispose(){this.lineMaterialMap.forEach((e,t)=>{e.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((e,t)=>{e.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((e,t)=>{e.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((e,t)=>{e.dispose()}),this.shaderMaterialMap.clear(),this.line2MaterialMap.forEach((e,t)=>{e.dispose()}),this.line2MaterialMap.clear()}};var Ot=require("three");var vt=class{static canvas=document.createElement("canvas");static ctx=this.canvas.getContext("2d");static cacheMap=new Map;static options={width:1024,height:64,font:"54px sans-serif",textBaseline:"hanging",lineWidth:12,fillStyle:"rgba(0,0,0,1)",strokeStyle:"white"};static getCanvas(){if(this.canvas)return this.canvas;{let e=document.createElement("canvas");return this.canvas=e,e}}static getCtx(){if(this.ctx)return this.ctx;let t=this.getCanvas().getContext("2d");return this.ctx=t,t}static getMergedOptions(e){return{...this.options,...e}}static setCtxStyle(e){let t=this.getCanvas(),n=this.getCtx();t.width=e.width,t.height=e.height,n.font=e.font,n.textBaseline=e.textBaseline,n.lineWidth=e.lineWidth,n.fillStyle=e.fillStyle,n.strokeStyle=e.strokeStyle}static getTextureByText(e,t){let n=this.getMergedOptions(t),r=Lt({...n,text:e});if(this.cacheMap.has(r))return this.cacheMap.get(r);let i=this.getCanvas(),o=this.getCtx();o.clearRect(0,0,i.width,i.height),this.setCtxStyle(n);let a=Qe(e)?4:8;n.lineWidth&&o.strokeText(e,2,a),o.fillText(e,2,a);let l=Math.ceil(o.measureText(e).width);l=l%2===0?l:l+1,l+=2;let u=o.getImageData(0,0,l,64),c=new Ot.DataTexture(Uint8Array.from(u.data),l,64,Ot.RGBAFormat);return c.flipY=!0,c.minFilter=Ot.LinearFilter,c.magFilter=Ot.LinearFilter,this.cacheMap.set(r,c),c}static dispose(){this.ctx=null,this.canvas=null,this.cacheMap.forEach(e=>e.dispose()),this.cacheMap.clear()}};var Ft=require("three"),xt=class{static textureLoader=new Ft.TextureLoader;static urlTextureMap=new Map;static getTextureByUrl(e){if(this.urlTextureMap.has(e))return this.urlTextureMap.get(e);let t=this.textureLoader.loadAsync(e);return t.then(n=>{n.format=Ft.RGBAFormat,n.magFilter=Ft.LinearFilter,n.minFilter=Ft.LinearFilter,n.colorSpace="srgb",this.urlTextureMap.set(e,n)}),this.urlTextureMap.set(e,t),t}static dispose(){this.urlTextureMap.forEach(e=>{e instanceof Promise?e.then(t=>t.dispose()):e.dispose()}),this.urlTextureMap.clear()}};var vr=require("three/examples/jsm/loaders/GLTFLoader"),Et=class{static loader=new vr.GLTFLoader;static modelMap=new Map;static async loadModel(e){if(this.modelMap.has(e)){let n=this.modelMap.get(e);if(n instanceof Promise)n.then(r=>({...r,scene:r.scene.clone()}));else return{...n,scene:n.scene.clone()}}let t=new Promise((n,r)=>{this.loader.load(e,i=>{n(i),this.modelMap.set(e,i)},void 0,r)});return this.modelMap.set(e,t),t.then(n=>({...n,scene:n.scene.clone()}))}static dispose(){this.modelMap.forEach(e=>{e instanceof Promise?e.then(t=>V(t.scene)):V(e.scene)}),this.modelMap.clear()}};var xr=require("lodash"),Te={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},R=class extends v.Object3D{constructor(t,n){super();this.context=t;if(this.options=At((0,xr.cloneDeep)({...Te,...n}),this),this.options.geometry.type==="point"){let[r,i]=this.options.geometry.coords;return this.position.set(r,i,this.options.height+this.options.airHeight),this}this.initDoor(),this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",({value:r})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",({value:r})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",({value:r})=>{this.dispose(),this.init()}),this.addEventListener("change-strokeColor",({value:r})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",({value:r})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-airHeight",({value:r})=>{this.position.z=r}),this.addEventListener("change-visible",({value:r})=>{this.visible=r}),this.addEventListener("change-stroke",({value:r})=>{if(r){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 v.Vector3,n=new v.Box3;return n.setFromObject(this),n.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new v.Vector3(0,0,0);let t=new v.Box3,n=new v.Vector3;return t.setFromObject(this),t.getSize(n),n}getPosition(){let t=this.getCenter();return t.setZ(t.z+this.options.height/2),t}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&this.options.strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){if(this.options.doors?.length&&this.options.geometry.type==="polygon"){let t=this.options.geometry.coords[0];this.options.doors.forEach(n=>{let r=n.type==="single"?.5:1,i=.5,o=Pt(t,n.coord),a=new v.Vector2(...n.coord),l=new v.Vector2(...t[o]).sub(new v.Vector2(...n.coord)).normalize(),u=new v.Vector2().addVectors(a,l.clone().multiplyScalar(r)),c=new v.Vector2().addVectors(a,l.clone().multiplyScalar(-r)),h=new v.Vector2(-l.y,l.x),p=new v.Vector2().addVectors(u,h.clone().multiplyScalar(i));nn([p.x,p.y],t)||(h.multiplyScalar(-1),p=new v.Vector2().addVectors(u,h.clone().multiplyScalar(i)));let d=new v.Vector2().addVectors(c,h.clone().multiplyScalar(i)),m=[[u.x,u.y],[p.x,p.y],[d.x,d.y],[c.x,c.y]];this.options.geometry.coords=[[...t.slice(0,o+1),...m,...t.slice(o+1)]],t=this.options.geometry.coords[0]})}}initGeometry(){let t=st(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new v.ExtrudeGeometry(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=I.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.height<=.1)return this.material=t,t;let n=I.createMeshBasicMaterial({color:pt(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,n],[t,n]}getMaxAndMin(t,n){let r=new v.Box3().setFromObject(this),i=t.clone().add(n.clone().multiplyScalar(1e3)),o=new v.Ray(i,n.clone().multiplyScalar(-1)),a=new v.Vector3;o.intersectBox(r,a);let l=t.clone().add(n.clone().multiplyScalar(-1e3)),u=new v.Ray(l,n.clone()),c=new v.Vector3;return u.intersectBox(r,c),{max:c,min:a}}initGradualMaterial(){let{max:t,min:n}=new v.Box3().setFromObject(this),r=t.clone().sub(n),i=Math.max(r.x,r.y,r.z)/2,o=this.getPosition(),a=new v.Vector3(-1,.2,0).normalize(),{max:l,min:u}=this.getMaxAndMin(o,a),c=I.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:i,opacity:this.options.fillOpacity,direction:new v.Vector3(-1,.2,0),max:l,min:u});if(this.options.height<=.1)return this.material=c,c;let h=this.getCenter(),p=new v.Vector3(-1,.2,1).normalize(),{max:d,min:m}=this.getMaxAndMin(h,p),f=I.createShaderMaterial({gradualColor:[pt(this.options.gradualColor[0],this.options.colorFactor),pt(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:i,opacity:this.options.fillOpacity,direction:new v.Vector3(-1,.2,1),max:d,min:m});return this.material=[c,f],[c,f]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){let t=I.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new v.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],n=this.options.height+this.options.deltaHeight,{coords:r}=this.options.geometry;for(let i=0;i<r.length;i++){let o=r[i];for(let a=0;a<o.length;a++){let l=o[a],u=a+1===o.length?o[0]:o[a+1];t.push(new v.Vector3(l[0],l[1],n)),t.push(new v.Vector3(u[0],u[1],n))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),n=new v.BufferGeometry().setFromPoints(t);this.lineGeometry=n}createBorder(){this.line&&this.remove(this.line);let t=new v.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 n=t.intersectObject(this.mesh);if(n[0]){let{point:r,distance:i}=n[0];return{position:r,distance:i}}return!1}dispose(){this.geometry?.dispose(),this.line?.geometry.dispose(),this.clear()}};var it=require("three");var ne=class extends it.Object3D{directionalLight;plane;basicOpacity=.07;constructor(){super(),this.directionalLight=this.initLight(),this.initPlane()}initLight(){let e=Je(16777215,.5);return e.position.set(0,0,100),this.add(e),e}changeLightCamera(e){let t=e.x,n=e.y;this.directionalLight.shadow.camera.left=-t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.top=n,this.directionalLight.shadow.camera.bottom=-n,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(t,n)}changeLightColor(e){this.directionalLight.color=new it.Color(e)}setPosition(e){this.position.copy(e),this.directionalLight.position.set(-e.x/2,-e.y/2,100)}initPlane(e=1e3,t=1e3){let n=new it.PlaneGeometry(e,t),r=new it.ShadowMaterial({transparent:!0,opacity:0,side:it.DoubleSide}),i=new it.Mesh(n,r);return i.receiveShadow=!0,i.position.z=-10,this.add(i),this.plane=i,i}setTarget(e){this.directionalLight.target=e}transformOpacity(e){return e*this.basicOpacity}setOpacity(e){this.plane.material.opacity=this.transformOpacity(e)}dispose(){V(this,!0)}};var Ce=require("three");var M=require("three");var Er=require("lodash");var Gi={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},re=class extends M.EventDispatcher{constructor(t,n={}){super();this.context=t;this.options={...Gi,...n},this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}div;element;position=new M.Vector3;clientPos={x:0,y:0};visible=!0;options;placement="top";observer=null;initObserver(){let t=new MutationObserver((0,Er.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){if(this.element instanceof R&&this.element.options.geometry.type==="polygon"){let{max:i,min:o}=new M.Box3().setFromObject(this.element),a=(i.x+o.x)/2,l=(i.y+o.y)/2;return{left:new M.Vector3(o.x,l,i.z),leftTop:new M.Vector3(o.x,i.y,i.z),top:new M.Vector3(a,i.y,i.z),rightTop:new M.Vector3(i.x,i.y,i.z),right:new M.Vector3(i.x,l,i.z),rightBottom:new M.Vector3(i.x,o.y,i.z),bottom:new M.Vector3(a,o.y,i.z),leftBottom:new M.Vector3(o.x,o.y,i.z),center:new M.Vector3(a,l,i.z)}}let{x:t,y:n,z:r}=this.element?.getPosition?.()||this.position;return{left:new M.Vector3(t,n,r),leftTop:new M.Vector3(t,n,r),top:new M.Vector3(t,n,r),rightTop:new M.Vector3(t,n,r),right:new M.Vector3(t,n,r),rightBottom:new M.Vector3(t,n,r),bottom:new M.Vector3(t,n,r),leftBottom:new M.Vector3(t,n,r),center:new M.Vector3(t,n,r)}}getPlacementScreenPosition(){let{width:t,height:n}=this.context.clientSize,r=this.getPlacementPosition();return Object.keys(r).reduce((i,o)=>{let{x:a,y:l}=y(r[o],this.context.camera,t,n);return i[o]={x:a,y:l},i},{})}checkOverflow(t,n){let{width:r,height:i}=this.context.clientSize;return n.x>0&&t.x<r&&n.y<i&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:n}=this.div,r=this.getPlacementScreenPosition(),i=t/2,o=n/2,a=[{type:"center",getBox(l,u){return{max:{x:i+l,y:u-n},min:{x:l-i,y:u}}}},{type:"left",getBox(l,u){return{max:{x:l,y:u-o},min:{x:l-t,y:u+o}}}},{type:"leftTop",getBox(l,u){return{max:{x:l,y:u-n},min:{x:l-t,y:u}}}},{type:"top",getBox(l,u){return{max:{x:l+i,y:u-n},min:{x:l-i,y:u}}}},{type:"rightTop",getBox(l,u){return{max:{x:l+t,y:u-n},min:{x:l,y:u}}}},{type:"right",getBox(l,u){return{max:{x:l+t,y:u-o},min:{x:l,y:u+o}}}},{type:"rightBottom",getBox(l,u){return{max:{x:l+t,y:u},min:{x:l,y:u+n}}}},{type:"bottom",getBox(l,u){return{max:{x:l+i,y:u},min:{x:l-i,y:u+n}}}},{type:"leftBottom",getBox(l,u){return{max:{x:l,y:u},min:{x:l-t,y:u+o}}}}];for(let l=0;l<a.length;l++){let u=a[l],c=r[u.type],{max:h,min:p}=u.getBox(c.x,c.y);if(this.checkOverflow(h,p))return{type:u.type,position:c}}return{type:"center",position:r.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className=`overlay_${t.type}`,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,n="block"){t!==this.visible&&(this.div.style.display=t?n:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=`${t}`}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new M.Box3().setFromObject(this.element).getCenter(new M.Vector3):this.position}get withinDisplayRange(){let{x:t,y:n}=this.clientPos,{width:r,height:i}=this.context.clientSize;return t>=0&&t<=r&&n>=0&&n<=i}_updatePosition(t,n){this.clientPos={x:t,y:n};let{width:r,height:i,x:o,y:a}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=`${o}px`,this.div.style.top=`${a+i}px`),this.options.autoUpdate?this.div.style.transform=`translate3d(${t}px, ${-i+n}px, 0)`:this.dispatchEvent({type:"update-position",x:t,y:n,width:r,height:i})}updatePosition(t=!1){let n=this.getPosition(),{width:r,height:i}=this.context.clientSize,{x:o,y:a}=y(n,this.context.camera,r,i);this.clientPos.x===o&&this.clientPos.y===a&&!t||this._updatePosition(o,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 zi={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},bt=class extends Ce.EventDispatcher{constructor(t,n){super();this.context=t;this.options=At({...zi,...n},this),this.position.set(n.position?.x||0,n.position?.y||0,n.position?.z||0),this.overlay=new re(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",({x:r,y:i,height:o})=>{this.overlay.div.style.transform=`translate3d(calc(${r}px - 50%), calc(${-o+i}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:r})=>{r?this.img?this.img.setAttribute("src",r):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",({value:r})=>{let i=this.textDiv;if(i){let o=this.initText();this.div.replaceChild(o,i)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",({value:r})=>{this.overlay.setOpacity(r)}),this.addEventListener("change-icon_size",({value:r})=>{this.img&&(this.img.style.width=`${r?.[0]||32}px`,this.img.style.height=`${r?.[1]||32}px`,this.resetSize())}),this.addEventListener("change-icon_opacity",({value:r})=>{this.img&&(this.img.style.opacity=`${r}`)}),this.addEventListener("change-icon_border",({value:r})=>{this.img&&(this.img.style.border=`${r.width}px solid ${r.color}`)}),this.addEventListener("change-background",({value:r})=>{this.div.style.background=r})}div;textDiv;img;overlay;options;visible=!0;size={width:0,height:0};position=new Ce.Vector3;userData={};showTextStatus=!0;disposed=!1;get withinDisplayRange(){return this.overlay.withinDisplayRange}async resetSize(){if(await on(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:n}=this.img.getBoundingClientRect();this.size={width:t+2,height:n+2}}else{let{width:t,height:n}=this.div.getBoundingClientRect();this.size={width:t+2,height:n+2}}}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(n=>{let r=document.createElement("div");if(r.style.whiteSpace="nowrap",n.styles)for(let[i,o]of Object.entries(n.styles))r.style[i]=o;r.textContent=n.text,t.appendChild(r)}),t}initIcon(){let t=document.createElement("img");return t.setAttribute("src",this.options.icon),t.style.width=`${this.options.icon_size?.[0]||32}px`,t.style.height=`${this.options.icon_size?.[1]||32}px`,t.style.opacity=`${this.options.icon_opacity}px`,t.style.borderRadius="50%",this.options.icon_border.width&&(t.style.border=`${this.options.icon_border.width}px solid ${this.options.icon_border.color}`),t.onload=()=>{this.resetSize()},this.img=t,t}_changePosition=()=>{this.overlay.updatePosition(!0)};registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t=this.context.config.poi.boxScale){let{width:n,height:r}=this.size,i=n*t,o=r*t,{x:a,y:l}=this.overlay.clientPos;return{left:a-i/2,right:a+i/2,top:this.options.icon?l-o:l-o/2,bottom:this.options.icon?l:l+o/2}}getOriginBox(){return this.getBox(1)}isContain(t,n){if(!this.overlay.visible||!this.visible)return!1;let r=this.getOriginBox();return t>=r.left&&t<=r.right&&n>=r.top&&n<=r.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}};var j=require("three");var O=require("three"),br=require("@mars3d/heatmap.js"),St=require("@turf/turf"),ie=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:n,height:r,leftTop:i,center:o}=this.getBox(t);this.heatmap=(0,br.create)({width:n,height:r,container:this.div,...this.context.config.heatMap}),this.heatmap.setData(this.transformData(t,i)),this.initPlane(n,r),this.position.set(o[0],o[1],this.position.z)}initPlane(t,n){this.plane&&this.remove(this.plane);let r=new O.PlaneGeometry(t,n),i=new O.Texture(this.div.firstChild);i.needsUpdate=!0;let o=new O.MeshBasicMaterial({transparent:!0,side:O.DoubleSide,map:i});o.needsUpdate=!0,this.plane=new O.Mesh(r,o),this.add(this.plane)}getTransMatrix({x:t,y:n}){return new O.Matrix3().makeScale(1,-1).multiply(new O.Matrix3().makeTranslation(0-t,0-n))}transformData(t,n){let r=this.getTransMatrix(n);return{data:t.data.map(o=>{let a=new O.Vector2(o.x,o.y).applyMatrix3(r);return{x:a.x,y:a.y,value:o.value}}),max:t.max,min:t.min}}getBox(t){let n=(0,St.featureCollection)(t.data.map(u=>(0,St.point)([u.x,u.y]))),r=(0,St.bbox)(n),i=r[2]-r[0],o=r[3]-r[1],a={x:r[0],y:r[3]},l=(0,St.center)(n);return{width:i,height:o,leftTop:a,center:l.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}};var Pe=require("three");var oe=class extends Pe.Object3D{constructor(t,n){super();this.context=t;this.options=n;this.position.copy(n.position||new Pe.Vector3(0,0,0)),this.loadModel()}model=null;async loadModel(){let t=await Et.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t}dispose(){V(this),this.model=null}};var Ae=require("three");var Sr=require("three");var F=class extends Sr.Object3D{constructor(t){super();this.context=t}dispose(){V(this),this.children.forEach(t=>t.dispose?.()),this.clear()}};var se=class extends F{graphicMap=new Map;constructor(e){super(e)}getCenter(){return new Ae.Box3().setFromObject(this).getCenter(new Ae.Vector3)}createGraphic(e){let t=new R(this.context,e);return this.add(t),this.graphicMap.set(e.id,t),t}removeGraphic(e){this.remove(e),this.graphicMap.delete(e.options.id),e.dispose()}removeGraphicById(e){this.graphicMap.has(e)&&this.removeGraphic(this.graphicMap.get(e))}getGraphicByNodeId(e){return this.graphicMap.get(e)||null}getGraphicByRaycaster(e){let t={distance:1e4,graphic:null,position:null},n=this.children.reduce((r,i)=>{if(i instanceof R){let o=i.raycast(e);if(o){let{distance:a}=o;if(a<r.distance)return{distance:o.distance,position:o.position,graphic:i}}return r}else return r},t);return n===t?{graphics:[],position:null}:{graphics:[n.graphic],position:n.position}}};var Mr=require("lodash");var ae=class extends F{pois=[];debounceCollisionDetection;timer=new D;constructor(e){super(e),this.registryEvent(),this.debounceCollisionDetection=(0,Mr.debounce)(this.collisionDetection,10)}clear(e=!1){return this.pois.forEach(t=>{t.options.built_in&&!e||t.dispose()}),this.pois=e?[]:this.pois.filter(t=>t.options.built_in),this}createPoi(e){let t=new bt(this.context,e);return this.pushPoi(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),t}changePoiLevelOrCollisionEnable(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.pois.splice(t,1),this.pushPoi(e))}removePoi(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.pois.splice(t,1),e.dispose())}removePoiById(e){let t=this.pois.find(n=>n.options.id===e);t&&this.removePoi(t)}getPoiById(e){return this.pois.find(n=>n.options.id===e)||null}pushPoi(e){if(!e.options.collision_enable){this.pois.unshift(e);return}if(e.options.level===0){this.pois.push(e);return}for(let t=0;t<this.pois.length;t++){let n=this.pois[t];if(n.options.collision_enable&&n.options.level<=e.options.level){this.pois.splice(t,0,e);return}}this.pois.push(e)}getPoiByDeviceXy(e,t){return this.pois.filter(r=>r instanceof bt&&r.isContain(e,t))}onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let e=[];this.pois.filter(n=>n.visible&&n.withinDisplayRange).forEach((n,r)=>{let{left:i,right:o,top:a,bottom:l}=n.getBox();if(r===0||!n.options.collision_enable){e.push({left:i,right:o,top:a,bottom:l}),n.parentSetVisible(!0);return}let u=e.some(c=>c.left<o&&c.right>i&&c.top<l&&c.bottom>a);n.parentSetVisible(!u),u||e.push({left:i,right:o,top:a,bottom:l})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(e=>e.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var xn=require("lodash");var Ie=require("three"),Ut=class extends F{pois=[];debounceCollisionDetection;debounceChangeParkingSpaceVisibleByZoom;timer=new D;constructor(e){super(e),this.registryEvent(),this.debounceCollisionDetection=(0,xn.debounce)(this.collisionDetection,10),this.debounceChangeParkingSpaceVisibleByZoom=(0,xn.debounce)(this.changeParkingSpaceVisibleByZoom,10)}clear(){return this.pois.forEach(e=>{e.dispose()}),this.pois=[],this}createPoi(e){let t=new q(this.context,e);return this.pushPoi(t),t}changePoiLevelOrCollisionEnable(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.pois.splice(t,1),this.pushPoi(e))}removePoi(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.remove(e),this.pois.splice(t,1),e.dispose())}removePoiById(e){let t=this.pois.find(n=>n.options.id===e);t&&this.removePoi(t)}getPoiById(e){return this.pois.find(n=>n.options.id===e)||null}pushPoi(e){if(this.add(e),e.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(e)),e.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(e)),Promise.resolve().then(()=>{this.debounceChangeParkingSpaceVisibleByZoom(),this.debounceCollisionDetection()}),!e.options.collision_enable){this.pois.unshift(e);return}if(e.options.level===0){this.pois.push(e);return}for(let t=0;t<this.pois.length;t++){let n=this.pois[t];if(n.options.collision_enable&&n.options.level<=e.options.level){this.pois.splice(t,0,e);return}}this.pois.push(e)}getPoiByDeviceXy(e,t){let n=new Ie.Vector2(e,t);return this.pois.filter(i=>i instanceof q&&i.canSelect&&i.box.containsPoint(n))}changeParkingSpaceVisibleByZoom=()=>{let e=this.parent?.parent;if(e&&e instanceof ct){let{clientSize:{width:t,height:n}}=this.context,{max:r,min:i}=e.box,a=Math.min(t/(r.x-i.x),n/(r.y-i.y))*(r.x-i.x)/45;this.pois.filter(l=>l.userData.type==="parkingSpace").map(l=>{let u=this.context.camera.zoom>=a;l.visible=u,u||l.parentSetVisible(u)})}};onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let e=[],{camera:t}=this.context;t.updateMatrixWorld();let n=o=>o<=1&&o>=-1,r=t.projectionMatrix.clone();r.multiply(t.matrixWorldInverse),this.pois.filter(o=>{if(o.visible){let a=o.spriteIcon?o.spriteIcon?.matrixWorld:o.spriteText?.matrixWorld||o.matrixWorld,l=new Ie.Vector3().setFromMatrixPosition(a);return l.applyMatrix4(r),o.screenPosition=l,n(l.x)&&n(l.y)&&n(l.z)}return!1}).forEach((o,a)=>{let l=o.getBox(o.screenPosition);if(a===0||!o.options.collision_enable){e.push(l),o.parentSetVisible(!0);return}let u=e.some(c=>c.intersectsBox(l));o.parentSetVisible(!u),u||e.push(l)})}registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}dispose(){this.timer.dispose(),this.pois.forEach(e=>e.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var ct=class extends j.Object3D{constructor(t){super();this.context=t;this.groundLayer=new F(this.context),this.graphicLayer=new se(this.context),this.poiLayer=new ae(this.context),this.poiLayer2=new Ut(this.context),this.wallLayer=new F(this.context),this.textureLayer=new F(this.context),this.glbModelLayer=new F(this.context),this.laneLayer=new F(this.context),this.mergeGraphicLayer=new F(this.context),this.textTextureLayer=new F(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}graphicLayer;poiLayer;poiLayer2;wallLayer;textureLayer;glbModelLayer;laneLayer;mergeGraphicLayer;textTextureLayer;grounds=new Set;groundLayer;shadow=new ne;heatmap;groundUpper=new j.Object3D;models=new j.Object3D;modelMap=new Map;groundMaxHeight=0;name="";key="";box=new j.Box3;getPosition(){return this.box.getCenter(new j.Vector3)}createGround(t){let n=new R(this.context,t);this.addGrounds([n])}addGrounds(t){t.forEach(n=>{this.grounds.has(n)||(n.mesh.castShadow=!0,this.grounds.add(n),this.groundLayer.add(n))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(n=>n.options.height+n.options.airHeight+n.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new j.Box3().setFromObject(this).getCenter(new j.Vector3)}addModel(t){let n=new oe(this.context,t);return this.models.add(n),this.modelMap.set(t.id,n),n}addShadow(){let t=new j.Box3().setFromObject(this.groundUpper),n=t.getCenter(new j.Vector3),r=t.getSize(new j.Vector3);this.shadow.setPosition(n),this.shadow.changeLightCamera(r)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addHeatmap(t){this.heatmap||(this.heatmap=new ie(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let n=new j.Box3().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(n.max.z),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}updateBox(){this.box.setFromObject(this)}dispose(){console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.heatmap?.dispose(),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}};var Re=require("three");var J=class extends Re.EventDispatcher{constructor(t){super();this.context=t;this.svg=rn(`${t.container.clientWidth}`,`${t.container.clientHeight}`),t.container.appendChild(this.svg),this._registryEvent()}points=[];svg;enable=!0;_onResize=({width:t,height:n})=>{this.svg&&(this.svg.setAttribute("width",`${t}`),this.svg.setAttribute("height",`${n}`))};_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:n,renderer:r}=this.context,{offsetX:i,offsetY:o}=t,{clientWidth:a,clientHeight:l}=r.domElement,u=i/a*2-1,c=1-o/l*2;return new Re.Vector3(u,c,0).unproject(n)}getSvgCoordinate(t){let{camera:n,container:r}=this.context;return y(t,n,r.clientWidth,r.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}};var le=class extends J{constructor(t){super(t);this.context=t;let{config:{svg:{circle:n,line:r}}}=t;this.circles=[Vt(n.radius,n.fill),Vt(n.radius,n.fill)],this.line=te(r.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),et(this.line,t)}if(this.points[1]){let t=this.getSvgCoordinate(this.points[1]);_t(this.circles[1],t.x,t.y),et(this.line,void 0,t)}};onPointermove=t=>{this.points.length===1&&(this.line.style.display="block",et(this.line,void 0,{x:t.offsetX,y:t.offsetY}))};onPointerleave=()=>{this.points[1]||(this.line.style.display="none")};onPointerdown=t=>{if(this.points[1])return;let n=this.getIntersectByPointerEvent(t);if(n){let{offsetX:r,offsetY:i}=t,o=this.circles[this.points.length];_t(o,r,i),this.points.length||et(this.line,{x:r,y:i},{x:r,y:i}),this.addPoint(n)}};addPoint(t){if(this.points.push(t),this.points.length>=2){let n=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:n})}}calculatedDistance(){let[{x:t,y:n},{x:r,y:i}]=this.points;return Math.sqrt((r-t)**2+(i-n)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}};var ue=class extends J{circles=[];lines=[];isClose=!1;constructor(e){super(e),this.registryEvent()}setEnable(e){super.setEnable(e),e?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(e){this.circles.push(e),this.svg.appendChild(e)}addLine(e){this.lines.push(e),this.svg.appendChild(e)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{this.points.length&&this.points.forEach((e,t)=>{let n=this.getSvgCoordinate(e);this.circles[t]&&_t(this.circles[t],n.x,n.y),t!==0&&et(this.lines[t-1],void 0,n),this.lines[t]&&et(this.lines[t],n)})};onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",et(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))};onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")};onPointerdown=e=>{if(this.isClose)return;let t=this.getIntersectByPointerEvent(e);if(t){let{offsetX:n,offsetY:r}=e;this.checkAdsorb(n,r)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(t);let{circle:{fill:i,radius:o},line:{stroke:a}}=this.context.config.svg;if(!this.isClose){let l=Vt(o,i);_t(l,n,r),this.addCircle(l)}if(this.lines.length&&et(this.lastLine,void 0,{x:n,y:r}),!this.isClose){let l=te(a);et(l,{x:n,y:r},{x:n,y:r}),this.addLine(l)}}};checkAdsorb(e,t){if(this.points.length<3)return!1;let n=this.circles[0],r=+n.getAttribute("cx"),i=+n.getAttribute("cy");return Math.sqrt((e-r)**2+(t-i)**2)<=5}addPoint(e){if(this.points.push(e),this.isClose){let t=this.calculatedArea();this.dispatchEvent({type:"area",area:t})}}calculatedArea(){let e=this.points.map(r=>[r.x,r.y]),t=0,n=e.length;for(let r=0;r<n;r++){let i=(r+1)%n;t+=e[r][0]*e[i][1]-e[i][0]*e[r][1]}return Math.abs(t/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}};var wr=require("three");var En=class extends J{constructor(t){super(t);this.context=t;let{config:{svg:{line:n}}}=t;this.rect=mt(n.stroke,"transparent"),this.svg.appendChild(this.rect);for(let r=0;r<4;r++)this.cornerRect[r]=mt(n.stroke,"#ffffff"),this.centerRect[r]=mt(n.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[r]),this.svg.appendChild(this.centerRect[r]);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 wr.Box3().setFromObject(this.graphic),{camera:n,container:{clientWidth:r,clientHeight:i}}=this.context,{min:o,max:a}=t,l=y(o,n,r,i),u=y(a,n,r,i);B(this.rect,l.x,u.y,Math.abs(u.x-l.x),Math.abs(u.y-l.y));let{x:c,y:h}=l,{x:p,y:d}=u,m=5,f=[{x:c-m,y:d-m},{x:p-m,y:d-m},{x:c-m,y:h-m},{x:p-m,y:h-m}];for(let b=0;b<f.length;b++)B(this.cornerRect[b],f[b].x,f[b].y,m*2,m*2);let g=4,E=(c+p)/2,x=(h+d)/2,z=[{x:E-g,y:d-g},{x:c-g,y:x-g},{x:p-g,y:x-g},{x:E-g,y:h-g}];for(let b=0;b<z.length;b++)B(this.centerRect[b],z[b].x,z[b].y,g*2,g*2)}else{B(this.rect,0,0,0,0);for(let t=0;t<this.cornerRect.length;t++)B(this.cornerRect[t],0,0,0,0),B(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=require("three");var bn=require("three/examples/jsm/utils/BufferGeometryUtils");var ce=class extends P.Object3D{constructor(t,n){super();this.context=t;this.options=n;n.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;initGeometry(){let t=this.options.map(n=>{let r=st(n.geometry.coords[0],n.geometry.coords.slice(1));return new P.ExtrudeGeometry(r,{steps:1,bevelEnabled:!1,depth:n.height,curveSegments:4})});this.geometry=(0,bn.mergeGeometries)(t),t.forEach(n=>n.dispose())}initMaterial(){let t=`
|
|
38
|
+
`,h=new H.ShaderMaterial({uniforms:{uColor:{value:new H.Color(e[0]).convertLinearToSRGB()},uGradualColor:{value:new H.Color(e[1]).convertLinearToSRGB()},center:{value:t},maxValue:{value:n},opacity:{value:r},uDirection:{value:i},uMax:{value:o},uMin:{value:a}},vertexShader:u,fragmentShader:c,side:H.DoubleSide});return this.shaderMaterialMap.set(l,h),h}static createLine2MaterialMap({color:e,width:t,dashed:n,resolution:r}){let i=`${e}-${t}-${n}-${r.x}-${r.y}`;if(this.line2MaterialMap.has(i))return this.line2MaterialMap.get(i);let o=new yr.LineMaterial({color:parseInt(e.slice(1),16),dashed:n,linewidth:t,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:r});return this.line2MaterialMap.set(i,o),o}static dispose(){this.lineMaterialMap.forEach((e,t)=>{e.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((e,t)=>{e.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((e,t)=>{e.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((e,t)=>{e.dispose()}),this.shaderMaterialMap.clear(),this.line2MaterialMap.forEach((e,t)=>{e.dispose()}),this.line2MaterialMap.clear()}};var Ot=require("three");var vt=class{static canvas=document.createElement("canvas");static ctx=this.canvas.getContext("2d");static cacheMap=new Map;static options={width:1024,height:64,font:"54px sans-serif",textBaseline:"hanging",lineWidth:12,fillStyle:"rgba(0,0,0,1)",strokeStyle:"white"};static getCanvas(){if(this.canvas)return this.canvas;{let e=document.createElement("canvas");return this.canvas=e,e}}static getCtx(){if(this.ctx)return this.ctx;let t=this.getCanvas().getContext("2d");return this.ctx=t,t}static getMergedOptions(e){return{...this.options,...e}}static setCtxStyle(e){let t=this.getCanvas(),n=this.getCtx();t.width=e.width,t.height=e.height,n.font=e.font,n.textBaseline=e.textBaseline,n.lineWidth=e.lineWidth,n.fillStyle=e.fillStyle,n.strokeStyle=e.strokeStyle}static getTextureByText(e,t){let n=this.getMergedOptions(t),r=Lt({...n,text:e});if(this.cacheMap.has(r))return this.cacheMap.get(r);let i=this.getCanvas(),o=this.getCtx();o.clearRect(0,0,i.width,i.height),this.setCtxStyle(n);let a=Qe(e)?4:8;n.lineWidth&&o.strokeText(e,2,a),o.fillText(e,2,a);let l=Math.ceil(o.measureText(e).width);l=l%2===0?l:l+1,l+=2;let u=o.getImageData(0,0,l,64),c=new Ot.DataTexture(Uint8Array.from(u.data),l,64,Ot.RGBAFormat);return c.flipY=!0,c.minFilter=Ot.LinearFilter,c.magFilter=Ot.LinearFilter,this.cacheMap.set(r,c),c}static dispose(){this.ctx=null,this.canvas=null,this.cacheMap.forEach(e=>e.dispose()),this.cacheMap.clear()}};var Ft=require("three"),xt=class{static textureLoader=new Ft.TextureLoader;static urlTextureMap=new Map;static getTextureByUrl(e){if(this.urlTextureMap.has(e))return this.urlTextureMap.get(e);let t=this.textureLoader.loadAsync(e);return t.then(n=>{n.format=Ft.RGBAFormat,n.magFilter=Ft.LinearFilter,n.minFilter=Ft.LinearFilter,n.colorSpace="srgb",this.urlTextureMap.set(e,n)}),this.urlTextureMap.set(e,t),t}static dispose(){this.urlTextureMap.forEach(e=>{e instanceof Promise?e.then(t=>t.dispose()):e.dispose()}),this.urlTextureMap.clear()}};var vr=require("three/examples/jsm/loaders/GLTFLoader"),Et=class{static loader=new vr.GLTFLoader;static modelMap=new Map;static async loadModel(e){if(this.modelMap.has(e)){let n=this.modelMap.get(e);if(n instanceof Promise)n.then(r=>({...r,scene:r.scene.clone()}));else return{...n,scene:n.scene.clone()}}let t=new Promise((n,r)=>{this.loader.load(e,i=>{n(i),this.modelMap.set(e,i)},void 0,r)});return this.modelMap.set(e,t),t.then(n=>({...n,scene:n.scene.clone()}))}static dispose(){this.modelMap.forEach(e=>{e instanceof Promise?e.then(t=>V(t.scene)):V(e.scene)}),this.modelMap.clear()}};var xr=require("lodash"),Te={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},R=class extends v.Object3D{constructor(t,n){super();this.context=t;if(this.options=At((0,xr.cloneDeep)({...Te,...n}),this),this.options.geometry.type==="point"){let[r,i]=this.options.geometry.coords;return this.position.set(r,i,this.options.height+this.options.airHeight),this}this.initDoor(),this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",({value:r})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",({value:r})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",({value:r})=>{this.dispose(),this.init()}),this.addEventListener("change-strokeColor",({value:r})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",({value:r})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-airHeight",({value:r})=>{this.position.z=r}),this.addEventListener("change-visible",({value:r})=>{this.visible=r}),this.addEventListener("change-stroke",({value:r})=>{if(r){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 v.Vector3,n=new v.Box3;return n.setFromObject(this),n.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new v.Vector3(0,0,0);let t=new v.Box3,n=new v.Vector3;return t.setFromObject(this),t.getSize(n),n}getPosition(){let t=this.getCenter();return t.setZ(t.z+this.options.height/2),t}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&this.options.strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){if(this.options.doors?.length&&this.options.geometry.type==="polygon"){let t=this.options.geometry.coords[0];this.options.doors.forEach(n=>{let r=n.type==="single"?.5:1,i=.5,o=Pt(t,n.coord),a=new v.Vector2(...n.coord),l=new v.Vector2(...t[o]).sub(new v.Vector2(...n.coord)).normalize(),u=new v.Vector2().addVectors(a,l.clone().multiplyScalar(r)),c=new v.Vector2().addVectors(a,l.clone().multiplyScalar(-r)),h=new v.Vector2(-l.y,l.x),p=new v.Vector2().addVectors(u,h.clone().multiplyScalar(i));nn([p.x,p.y],t)||(h.multiplyScalar(-1),p=new v.Vector2().addVectors(u,h.clone().multiplyScalar(i)));let d=new v.Vector2().addVectors(c,h.clone().multiplyScalar(i)),m=[[u.x,u.y],[p.x,p.y],[d.x,d.y],[c.x,c.y]];this.options.geometry.coords=[[...t.slice(0,o+1),...m,...t.slice(o+1)]],t=this.options.geometry.coords[0]})}}initGeometry(){let t=st(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new v.ExtrudeGeometry(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=I.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.height<=.1)return this.material=t,t;let n=I.createMeshBasicMaterial({color:pt(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,n],[t,n]}getMaxAndMin(t,n){let r=new v.Box3().setFromObject(this),i=t.clone().add(n.clone().multiplyScalar(1e3)),o=new v.Ray(i,n.clone().multiplyScalar(-1)),a=new v.Vector3;o.intersectBox(r,a);let l=t.clone().add(n.clone().multiplyScalar(-1e3)),u=new v.Ray(l,n.clone()),c=new v.Vector3;return u.intersectBox(r,c),{max:c,min:a}}initGradualMaterial(){let{max:t,min:n}=new v.Box3().setFromObject(this),r=t.clone().sub(n),i=Math.max(r.x,r.y,r.z)/2,o=this.getPosition(),a=new v.Vector3(-1,.2,0).normalize(),{max:l,min:u}=this.getMaxAndMin(o,a),c=I.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:i,opacity:this.options.fillOpacity,direction:new v.Vector3(-1,.2,0),max:l,min:u});if(this.options.height<=.1)return this.material=c,c;let h=this.getCenter(),p=new v.Vector3(-1,.2,1).normalize(),{max:d,min:m}=this.getMaxAndMin(h,p),f=I.createShaderMaterial({gradualColor:[pt(this.options.gradualColor[0],this.options.colorFactor),pt(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:i,opacity:this.options.fillOpacity,direction:new v.Vector3(-1,.2,1),max:d,min:m});return this.material=[c,f],[c,f]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){let t=I.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new v.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],n=this.options.height+this.options.deltaHeight,{coords:r}=this.options.geometry;for(let i=0;i<r.length;i++){let o=r[i];for(let a=0;a<o.length;a++){let l=o[a],u=a+1===o.length?o[0]:o[a+1];t.push(new v.Vector3(l[0],l[1],n)),t.push(new v.Vector3(u[0],u[1],n))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),n=new v.BufferGeometry().setFromPoints(t);this.lineGeometry=n}createBorder(){this.line&&this.remove(this.line);let t=new v.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 n=t.intersectObject(this.mesh);if(n[0]){let{point:r,distance:i}=n[0];return{position:r,distance:i}}return!1}dispose(){this.geometry?.dispose(),this.line?.geometry.dispose(),this.clear()}};var it=require("three");var ne=class extends it.Object3D{directionalLight;plane;basicOpacity=.07;constructor(){super(),this.directionalLight=this.initLight(),this.initPlane()}initLight(){let e=Je(16777215,.5);return e.position.set(0,0,100),this.add(e),e}changeLightCamera(e){let t=e.x,n=e.y;this.directionalLight.shadow.camera.left=-t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.top=n,this.directionalLight.shadow.camera.bottom=-n,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(t,n)}changeLightColor(e){this.directionalLight.color=new it.Color(e)}setPosition(e){this.position.copy(e),this.directionalLight.position.set(-e.x/2,-e.y/2,100)}initPlane(e=1e3,t=1e3){let n=new it.PlaneGeometry(e,t),r=new it.ShadowMaterial({transparent:!0,opacity:0,side:it.DoubleSide}),i=new it.Mesh(n,r);return i.receiveShadow=!0,i.position.z=-10,this.add(i),this.plane=i,i}setTarget(e){this.directionalLight.target=e}transformOpacity(e){return e*this.basicOpacity}setOpacity(e){this.plane.material.opacity=this.transformOpacity(e)}dispose(){V(this,!0)}};var Ce=require("three");var S=require("three");var Er=require("lodash");var Gi={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},re=class extends S.EventDispatcher{constructor(t,n={}){super();this.context=t;this.options={...Gi,...n},this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}div;element;position=new S.Vector3;clientPos={x:0,y:0};visible=!0;options;placement="top";observer=null;initObserver(){let t=new MutationObserver((0,Er.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){if(this.element instanceof R&&this.element.options.geometry.type==="polygon"){let{max:i,min:o}=new S.Box3().setFromObject(this.element),a=(i.x+o.x)/2,l=(i.y+o.y)/2;return{left:new S.Vector3(o.x,l,i.z),leftTop:new S.Vector3(o.x,i.y,i.z),top:new S.Vector3(a,i.y,i.z),rightTop:new S.Vector3(i.x,i.y,i.z),right:new S.Vector3(i.x,l,i.z),rightBottom:new S.Vector3(i.x,o.y,i.z),bottom:new S.Vector3(a,o.y,i.z),leftBottom:new S.Vector3(o.x,o.y,i.z),center:new S.Vector3(a,l,i.z)}}let{x:t,y:n,z:r}=this.element?.getPosition?.()||this.position;return{left:new S.Vector3(t,n,r),leftTop:new S.Vector3(t,n,r),top:new S.Vector3(t,n,r),rightTop:new S.Vector3(t,n,r),right:new S.Vector3(t,n,r),rightBottom:new S.Vector3(t,n,r),bottom:new S.Vector3(t,n,r),leftBottom:new S.Vector3(t,n,r),center:new S.Vector3(t,n,r)}}getPlacementScreenPosition(){let{width:t,height:n}=this.context.clientSize,r=this.getPlacementPosition();return Object.keys(r).reduce((i,o)=>{let{x:a,y:l}=y(r[o],this.context.camera,t,n);return i[o]={x:a,y:l},i},{})}checkOverflow(t,n){let{width:r,height:i}=this.context.clientSize;return n.x>0&&t.x<r&&n.y<i&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:n}=this.div,r=this.getPlacementScreenPosition(),i=t/2,o=n/2,a=[{type:"center",getBox(l,u){return{max:{x:i+l,y:u-n},min:{x:l-i,y:u}}}},{type:"left",getBox(l,u){return{max:{x:l,y:u-o},min:{x:l-t,y:u+o}}}},{type:"leftTop",getBox(l,u){return{max:{x:l,y:u-n},min:{x:l-t,y:u}}}},{type:"top",getBox(l,u){return{max:{x:l+i,y:u-n},min:{x:l-i,y:u}}}},{type:"rightTop",getBox(l,u){return{max:{x:l+t,y:u-n},min:{x:l,y:u}}}},{type:"right",getBox(l,u){return{max:{x:l+t,y:u-o},min:{x:l,y:u+o}}}},{type:"rightBottom",getBox(l,u){return{max:{x:l+t,y:u},min:{x:l,y:u+n}}}},{type:"bottom",getBox(l,u){return{max:{x:l+i,y:u},min:{x:l-i,y:u+n}}}},{type:"leftBottom",getBox(l,u){return{max:{x:l,y:u},min:{x:l-t,y:u+o}}}}];for(let l=0;l<a.length;l++){let u=a[l],c=r[u.type],{max:h,min:p}=u.getBox(c.x,c.y);if(this.checkOverflow(h,p))return{type:u.type,position:c}}return{type:"center",position:r.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className=`overlay_${t.type}`,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,n="block"){t!==this.visible&&(this.div.style.display=t?n:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=`${t}`}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new S.Box3().setFromObject(this.element).getCenter(new S.Vector3):this.position}get withinDisplayRange(){let{x:t,y:n}=this.clientPos,{width:r,height:i}=this.context.clientSize;return t>=0&&t<=r&&n>=0&&n<=i}_updatePosition(t,n){this.clientPos={x:t,y:n};let{width:r,height:i,x:o,y:a}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=`${o}px`,this.div.style.top=`${a+i}px`),this.options.autoUpdate?this.div.style.transform=`translate3d(${t}px, ${-i+n}px, 0)`:this.dispatchEvent({type:"update-position",x:t,y:n,width:r,height:i})}updatePosition(t=!1){let n=this.getPosition(),{width:r,height:i}=this.context.clientSize,{x:o,y:a}=y(n,this.context.camera,r,i);this.clientPos.x===o&&this.clientPos.y===a&&!t||this._updatePosition(o,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 zi={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},bt=class extends Ce.EventDispatcher{constructor(t,n){super();this.context=t;this.options=At({...zi,...n},this),this.position.set(n.position?.x||0,n.position?.y||0,n.position?.z||0),this.overlay=new re(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",({x:r,y:i,height:o})=>{this.overlay.div.style.transform=`translate3d(calc(${r}px - 50%), calc(${-o+i}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:r})=>{r?this.img?this.img.setAttribute("src",r):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",({value:r})=>{let i=this.textDiv;if(i){let o=this.initText();this.div.replaceChild(o,i)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",({value:r})=>{this.overlay.setOpacity(r)}),this.addEventListener("change-icon_size",({value:r})=>{this.img&&(this.img.style.width=`${r?.[0]||32}px`,this.img.style.height=`${r?.[1]||32}px`,this.resetSize())}),this.addEventListener("change-icon_opacity",({value:r})=>{this.img&&(this.img.style.opacity=`${r}`)}),this.addEventListener("change-icon_border",({value:r})=>{this.img&&(this.img.style.border=`${r.width}px solid ${r.color}`)}),this.addEventListener("change-background",({value:r})=>{this.div.style.background=r})}div;textDiv;img;overlay;options;visible=!0;size={width:0,height:0};position=new Ce.Vector3;userData={};showTextStatus=!0;disposed=!1;get withinDisplayRange(){return this.overlay.withinDisplayRange}async resetSize(){if(await on(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:n}=this.img.getBoundingClientRect();this.size={width:t+2,height:n+2}}else{let{width:t,height:n}=this.div.getBoundingClientRect();this.size={width:t+2,height:n+2}}}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(n=>{let r=document.createElement("div");if(r.style.whiteSpace="nowrap",n.styles)for(let[i,o]of Object.entries(n.styles))r.style[i]=o;r.textContent=n.text,t.appendChild(r)}),t}initIcon(){let t=document.createElement("img");return t.setAttribute("src",this.options.icon),t.style.width=`${this.options.icon_size?.[0]||32}px`,t.style.height=`${this.options.icon_size?.[1]||32}px`,t.style.opacity=`${this.options.icon_opacity}px`,t.style.borderRadius="50%",this.options.icon_border.width&&(t.style.border=`${this.options.icon_border.width}px solid ${this.options.icon_border.color}`),t.onload=()=>{this.resetSize()},this.img=t,t}_changePosition=()=>{this.overlay.updatePosition(!0)};registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t=this.context.config.poi.boxScale){let{width:n,height:r}=this.size,i=n*t,o=r*t,{x:a,y:l}=this.overlay.clientPos;return{left:a-i/2,right:a+i/2,top:this.options.icon?l-o:l-o/2,bottom:this.options.icon?l:l+o/2}}getOriginBox(){return this.getBox(1)}isContain(t,n){if(!this.overlay.visible||!this.visible)return!1;let r=this.getOriginBox();return t>=r.left&&t<=r.right&&n>=r.top&&n<=r.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}};var j=require("three");var O=require("three"),br=require("@mars3d/heatmap.js"),Mt=require("@turf/turf"),ie=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:n,height:r,leftTop:i,center:o}=this.getBox(t);this.heatmap=(0,br.create)({width:n,height:r,container:this.div,...this.context.config.heatMap}),this.heatmap.setData(this.transformData(t,i)),this.initPlane(n,r),this.position.set(o[0],o[1],this.position.z)}initPlane(t,n){this.plane&&this.remove(this.plane);let r=new O.PlaneGeometry(t,n),i=new O.Texture(this.div.firstChild);i.needsUpdate=!0;let o=new O.MeshBasicMaterial({transparent:!0,side:O.DoubleSide,map:i});o.needsUpdate=!0,this.plane=new O.Mesh(r,o),this.add(this.plane)}getTransMatrix({x:t,y:n}){return new O.Matrix3().makeScale(1,-1).multiply(new O.Matrix3().makeTranslation(0-t,0-n))}transformData(t,n){let r=this.getTransMatrix(n);return{data:t.data.map(o=>{let a=new O.Vector2(o.x,o.y).applyMatrix3(r);return{x:a.x,y:a.y,value:o.value}}),max:t.max,min:t.min}}getBox(t){let n=(0,Mt.featureCollection)(t.data.map(u=>(0,Mt.point)([u.x,u.y]))),r=(0,Mt.bbox)(n),i=r[2]-r[0],o=r[3]-r[1],a={x:r[0],y:r[3]},l=(0,Mt.center)(n);return{width:i,height:o,leftTop:a,center:l.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}};var Pe=require("three");var oe=class extends Pe.Object3D{constructor(t,n){super();this.context=t;this.options=n;this.position.copy(n.position||new Pe.Vector3(0,0,0)),this.loadModel()}model=null;async loadModel(){let t=await Et.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t}dispose(){V(this),this.model=null}};var Ae=require("three");var Mr=require("three");var F=class extends Mr.Object3D{constructor(t){super();this.context=t}dispose(){V(this),this.children.forEach(t=>t.dispose?.()),this.clear()}};var se=class extends F{graphicMap=new Map;constructor(e){super(e)}getCenter(){return new Ae.Box3().setFromObject(this).getCenter(new Ae.Vector3)}createGraphic(e){let t=new R(this.context,e);return this.add(t),this.graphicMap.set(e.id,t),t}removeGraphic(e){this.remove(e),this.graphicMap.delete(e.options.id),e.dispose()}removeGraphicById(e){this.graphicMap.has(e)&&this.removeGraphic(this.graphicMap.get(e))}getGraphicByNodeId(e){return this.graphicMap.get(e)||null}getGraphicByRaycaster(e){let t={distance:1e4,graphic:null,position:null},n=this.children.reduce((r,i)=>{if(i instanceof R){let o=i.raycast(e);if(o){let{distance:a}=o;if(a<r.distance)return{distance:o.distance,position:o.position,graphic:i}}return r}else return r},t);return n===t?{graphics:[],position:null}:{graphics:[n.graphic],position:n.position}}};var Sr=require("lodash");var ae=class extends F{pois=[];debounceCollisionDetection;timer=new D;constructor(e){super(e),this.registryEvent(),this.debounceCollisionDetection=(0,Sr.debounce)(this.collisionDetection,10)}clear(e=!1){return this.pois.forEach(t=>{t.options.built_in&&!e||t.dispose()}),this.pois=e?[]:this.pois.filter(t=>t.options.built_in),this}createPoi(e){let t=new bt(this.context,e);return this.pushPoi(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),t}changePoiLevelOrCollisionEnable(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.pois.splice(t,1),this.pushPoi(e))}removePoi(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.pois.splice(t,1),e.dispose())}removePoiById(e){let t=this.pois.find(n=>n.options.id===e);t&&this.removePoi(t)}getPoiById(e){return this.pois.find(n=>n.options.id===e)||null}pushPoi(e){if(!e.options.collision_enable){this.pois.unshift(e);return}if(e.options.level===0){this.pois.push(e);return}for(let t=0;t<this.pois.length;t++){let n=this.pois[t];if(n.options.collision_enable&&n.options.level<=e.options.level){this.pois.splice(t,0,e);return}}this.pois.push(e)}getPoiByDeviceXy(e,t){return this.pois.filter(r=>r instanceof bt&&r.isContain(e,t))}onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let e=[];this.pois.filter(n=>n.visible&&n.withinDisplayRange).forEach((n,r)=>{let{left:i,right:o,top:a,bottom:l}=n.getBox();if(r===0||!n.options.collision_enable){e.push({left:i,right:o,top:a,bottom:l}),n.parentSetVisible(!0);return}let u=e.some(c=>c.left<o&&c.right>i&&c.top<l&&c.bottom>a);n.parentSetVisible(!u),u||e.push({left:i,right:o,top:a,bottom:l})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(e=>e.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var xn=require("lodash");var Ie=require("three"),Ut=class extends F{pois=[];debounceCollisionDetection;debounceChangeParkingSpaceVisibleByZoom;timer=new D;constructor(e){super(e),this.registryEvent(),this.debounceCollisionDetection=(0,xn.debounce)(this.collisionDetection,10),this.debounceChangeParkingSpaceVisibleByZoom=(0,xn.debounce)(this.changeParkingSpaceVisibleByZoom,10)}clear(){return this.pois.forEach(e=>{e.dispose()}),this.pois=[],this}createPoi(e){let t=new q(this.context,e);return this.pushPoi(t),t}changePoiLevelOrCollisionEnable(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.pois.splice(t,1),this.pushPoi(e))}removePoi(e){let t=this.pois.findIndex(n=>n===e);t!==-1&&(this.remove(e),this.pois.splice(t,1),e.dispose())}removePoiById(e){let t=this.pois.find(n=>n.options.id===e);t&&this.removePoi(t)}getPoiById(e){return this.pois.find(n=>n.options.id===e)||null}pushPoi(e){if(this.add(e),e.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(e)),e.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(e)),Promise.resolve().then(()=>{this.debounceChangeParkingSpaceVisibleByZoom(),this.debounceCollisionDetection()}),!e.options.collision_enable){this.pois.unshift(e);return}if(e.options.level===0){this.pois.push(e);return}for(let t=0;t<this.pois.length;t++){let n=this.pois[t];if(n.options.collision_enable&&n.options.level<=e.options.level){this.pois.splice(t,0,e);return}}this.pois.push(e)}getPoiByDeviceXy(e,t){let n=new Ie.Vector2(e,t);return this.pois.filter(i=>i instanceof q&&i.canSelect&&i.box.containsPoint(n))}changeParkingSpaceVisibleByZoom=()=>{let e=this.parent?.parent;if(e&&e instanceof ct){let{clientSize:{width:t,height:n}}=this.context,{max:r,min:i}=e.box,a=Math.min(t/(r.x-i.x),n/(r.y-i.y))*(r.x-i.x)/45;this.pois.filter(l=>l.userData.type==="parkingSpace").map(l=>{let u=this.context.camera.zoom>=a;l.visible=u,u||l.parentSetVisible(u)})}};onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let e=[],{camera:t}=this.context;t.updateMatrixWorld();let n=o=>o<=1&&o>=-1,r=t.projectionMatrix.clone();r.multiply(t.matrixWorldInverse),this.pois.filter(o=>{if(o.visible){let a=o.spriteIcon?o.spriteIcon?.matrixWorld:o.spriteText?.matrixWorld||o.matrixWorld,l=new Ie.Vector3().setFromMatrixPosition(a);return l.applyMatrix4(r),o.screenPosition=l,n(l.x)&&n(l.y)&&n(l.z)}return!1}).forEach((o,a)=>{let l=o.getBox(o.screenPosition);if(a===0||!o.options.collision_enable){e.push(l),o.parentSetVisible(!0);return}let u=e.some(c=>c.intersectsBox(l));o.parentSetVisible(!u),u||e.push(l)})}registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}dispose(){this.timer.dispose(),this.pois.forEach(e=>e.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var ct=class extends j.Object3D{constructor(t){super();this.context=t;this.groundLayer=new F(this.context),this.graphicLayer=new se(this.context),this.poiLayer=new ae(this.context),this.poiLayer2=new Ut(this.context),this.wallLayer=new F(this.context),this.textureLayer=new F(this.context),this.glbModelLayer=new F(this.context),this.laneLayer=new F(this.context),this.mergeGraphicLayer=new F(this.context),this.textTextureLayer=new F(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}graphicLayer;poiLayer;poiLayer2;wallLayer;textureLayer;glbModelLayer;laneLayer;mergeGraphicLayer;textTextureLayer;grounds=new Set;groundLayer;shadow=new ne;heatmap;groundUpper=new j.Object3D;models=new j.Object3D;modelMap=new Map;groundMaxHeight=0;name="";key="";box=new j.Box3;getPosition(){return this.box.getCenter(new j.Vector3)}createGround(t){let n=new R(this.context,t);this.addGrounds([n])}addGrounds(t){t.forEach(n=>{this.grounds.has(n)||(n.mesh.castShadow=!0,this.grounds.add(n),this.groundLayer.add(n))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(n=>n.options.height+n.options.airHeight+n.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight+.001}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new j.Box3().setFromObject(this).getCenter(new j.Vector3)}addModel(t){let n=new oe(this.context,t);return this.models.add(n),this.modelMap.set(t.id,n),n}addShadow(){let t=new j.Box3().setFromObject(this.groundUpper),n=t.getCenter(new j.Vector3),r=t.getSize(new j.Vector3);this.shadow.setPosition(n),this.shadow.changeLightCamera(r)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addHeatmap(t){this.heatmap||(this.heatmap=new ie(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let n=new j.Box3().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(n.max.z),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}updateBox(){this.box.setFromObject(this)}dispose(){console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.heatmap?.dispose(),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}};var Re=require("three");var J=class extends Re.EventDispatcher{constructor(t){super();this.context=t;this.svg=rn(`${t.container.clientWidth}`,`${t.container.clientHeight}`),t.container.appendChild(this.svg),this._registryEvent()}points=[];svg;enable=!0;_onResize=({width:t,height:n})=>{this.svg&&(this.svg.setAttribute("width",`${t}`),this.svg.setAttribute("height",`${n}`))};_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:n,renderer:r}=this.context,{offsetX:i,offsetY:o}=t,{clientWidth:a,clientHeight:l}=r.domElement,u=i/a*2-1,c=1-o/l*2;return new Re.Vector3(u,c,0).unproject(n)}getSvgCoordinate(t){let{camera:n,container:r}=this.context;return y(t,n,r.clientWidth,r.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}};var le=class extends J{constructor(t){super(t);this.context=t;let{config:{svg:{circle:n,line:r}}}=t;this.circles=[Vt(n.radius,n.fill),Vt(n.radius,n.fill)],this.line=te(r.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),et(this.line,t)}if(this.points[1]){let t=this.getSvgCoordinate(this.points[1]);_t(this.circles[1],t.x,t.y),et(this.line,void 0,t)}};onPointermove=t=>{this.points.length===1&&(this.line.style.display="block",et(this.line,void 0,{x:t.offsetX,y:t.offsetY}))};onPointerleave=()=>{this.points[1]||(this.line.style.display="none")};onPointerdown=t=>{if(this.points[1])return;let n=this.getIntersectByPointerEvent(t);if(n){let{offsetX:r,offsetY:i}=t,o=this.circles[this.points.length];_t(o,r,i),this.points.length||et(this.line,{x:r,y:i},{x:r,y:i}),this.addPoint(n)}};addPoint(t){if(this.points.push(t),this.points.length>=2){let n=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:n})}}calculatedDistance(){let[{x:t,y:n},{x:r,y:i}]=this.points;return Math.sqrt((r-t)**2+(i-n)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}};var ue=class extends J{circles=[];lines=[];isClose=!1;constructor(e){super(e),this.registryEvent()}setEnable(e){super.setEnable(e),e?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(e){this.circles.push(e),this.svg.appendChild(e)}addLine(e){this.lines.push(e),this.svg.appendChild(e)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{this.points.length&&this.points.forEach((e,t)=>{let n=this.getSvgCoordinate(e);this.circles[t]&&_t(this.circles[t],n.x,n.y),t!==0&&et(this.lines[t-1],void 0,n),this.lines[t]&&et(this.lines[t],n)})};onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",et(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))};onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")};onPointerdown=e=>{if(this.isClose)return;let t=this.getIntersectByPointerEvent(e);if(t){let{offsetX:n,offsetY:r}=e;this.checkAdsorb(n,r)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(t);let{circle:{fill:i,radius:o},line:{stroke:a}}=this.context.config.svg;if(!this.isClose){let l=Vt(o,i);_t(l,n,r),this.addCircle(l)}if(this.lines.length&&et(this.lastLine,void 0,{x:n,y:r}),!this.isClose){let l=te(a);et(l,{x:n,y:r},{x:n,y:r}),this.addLine(l)}}};checkAdsorb(e,t){if(this.points.length<3)return!1;let n=this.circles[0],r=+n.getAttribute("cx"),i=+n.getAttribute("cy");return Math.sqrt((e-r)**2+(t-i)**2)<=5}addPoint(e){if(this.points.push(e),this.isClose){let t=this.calculatedArea();this.dispatchEvent({type:"area",area:t})}}calculatedArea(){let e=this.points.map(r=>[r.x,r.y]),t=0,n=e.length;for(let r=0;r<n;r++){let i=(r+1)%n;t+=e[r][0]*e[i][1]-e[i][0]*e[r][1]}return Math.abs(t/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}};var wr=require("three");var En=class extends J{constructor(t){super(t);this.context=t;let{config:{svg:{line:n}}}=t;this.rect=mt(n.stroke,"transparent"),this.svg.appendChild(this.rect);for(let r=0;r<4;r++)this.cornerRect[r]=mt(n.stroke,"#ffffff"),this.centerRect[r]=mt(n.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[r]),this.svg.appendChild(this.centerRect[r]);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 wr.Box3().setFromObject(this.graphic),{camera:n,container:{clientWidth:r,clientHeight:i}}=this.context,{min:o,max:a}=t,l=y(o,n,r,i),u=y(a,n,r,i);B(this.rect,l.x,u.y,Math.abs(u.x-l.x),Math.abs(u.y-l.y));let{x:c,y:h}=l,{x:p,y:d}=u,m=5,f=[{x:c-m,y:d-m},{x:p-m,y:d-m},{x:c-m,y:h-m},{x:p-m,y:h-m}];for(let b=0;b<f.length;b++)B(this.cornerRect[b],f[b].x,f[b].y,m*2,m*2);let g=4,E=(c+p)/2,x=(h+d)/2,z=[{x:E-g,y:d-g},{x:c-g,y:x-g},{x:p-g,y:x-g},{x:E-g,y:h-g}];for(let b=0;b<z.length;b++)B(this.centerRect[b],z[b].x,z[b].y,g*2,g*2)}else{B(this.rect,0,0,0,0);for(let t=0;t<this.cornerRect.length;t++)B(this.cornerRect[t],0,0,0,0),B(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=require("three");var bn=require("three/examples/jsm/utils/BufferGeometryUtils");var ce=class extends P.Object3D{constructor(t,n){super();this.context=t;this.options=n;n.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;initGeometry(){let t=this.options.map(n=>{let r=st(n.geometry.coords[0],n.geometry.coords.slice(1));return new P.ExtrudeGeometry(r,{steps:1,bevelEnabled:!1,depth:n.height,curveSegments:4})});this.geometry=(0,bn.mergeGeometries)(t),t.forEach(n=>n.dispose())}initMaterial(){let t=`
|
|
39
39
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
40
40
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
41
41
|
uniform vec3 uColor;
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
gl_FragColor = vec4(vColor, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
`,r=-1/0,i=1/0,o=this.geometry.getAttribute("position");if(o)for(let l=0;l<o.count;l++){let u=o.getZ(l);u>r&&(r=u),u<i&&(i=u)}let a=new P.ShaderMaterial({uniforms:{maxZ:{value:r},uColor:{value:new P.Color(this.options[0].fillColor)},uGradualColor1:{value:new P.Color(pt(this.options[0].fillColor,.99))},uGradualColor2:{value:new P.Color(pt(this.options[0].fillColor,.9))},uOpacity:{value:this.options[0].fillOpacity},minZ:{value:i}},vertexShader:t,fragmentShader:n,transparent:!0});this.material=a}initLineMaterial(){let{strokeColor:t,strokeOpacity:n}=this.options[0],r=I.createLineMaterial({color:t,opacity:n});return this.lineMaterial=r,r}getBorderPoints(t){let{height:n,deltaHeight:r,geometry:i}=t,o=[],a=n+(r||0),{coords:l}=i;for(let u=0;u<l.length;u++){let c=l[u];for(let h=0;h<c.length;h++){let p=c[h],d=h+1===c.length?c[0]:c[h+1];o.push(new P.Vector3(p[0],p[1],a)),o.push(new P.Vector3(d[0],d[1],a))}}return o}initLineGeometry(){let t=this.options.map(n=>{let r=this.getBorderPoints(n);return new P.BufferGeometry().setFromPoints(r)});this.lineGeometry=(0,bn.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())}dispose(){this.geometry?.dispose(),this.material?.dispose(),this.lineGeometry?.dispose(),this.clear()}};var ot=require("three"),Tr=require("three/examples/jsm/utils/BufferGeometryUtils");var Cr={uuid:"",iconUrl:"",name:"",airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},qt=class extends ot.Object3D{constructor(t,n){super();this.context=t;this.options=n.map(r=>({...Cr,...r})),this.init()}options;mesh;async init(){let t=this.options.map(o=>{let{geometry:a}=o,l=st(a.coords[0],a.coords.slice(1)),u=new ot.ShapeGeometry(l,4),c=o.height+o.deltaHeight+o.airHeight,h=u.getAttribute("position");for(let d=0;d<h.count;d++)h.setZ(d,c);let p=[0,1,1,1,1,0,0,0];return u.setAttribute("uv",new ot.Float32BufferAttribute(p,2)),u}),n=(0,Tr.mergeGeometries)(t,!0);t.forEach(o=>o.dispose());let r=await Promise.all(this.options.map(async o=>{let{iconUrl:a}=o,l=await xt.getTextureByUrl(a);return new ot.MeshBasicMaterial({map:l,alphaTest:1,side:ot.DoubleSide})})),i=new ot.Mesh(n,r);this.mesh=i,this.position.z+=.004,this.add(i)}dispose(){this.mesh?.geometry.dispose(),(this.mesh?.material).forEach(t=>t.dispose()),this.clear()}};var
|
|
77
|
+
`,r=-1/0,i=1/0,o=this.geometry.getAttribute("position");if(o)for(let l=0;l<o.count;l++){let u=o.getZ(l);u>r&&(r=u),u<i&&(i=u)}let a=new P.ShaderMaterial({uniforms:{maxZ:{value:r},uColor:{value:new P.Color(this.options[0].fillColor)},uGradualColor1:{value:new P.Color(pt(this.options[0].fillColor,.99))},uGradualColor2:{value:new P.Color(pt(this.options[0].fillColor,.9))},uOpacity:{value:this.options[0].fillOpacity},minZ:{value:i}},vertexShader:t,fragmentShader:n,transparent:!0});this.material=a}initLineMaterial(){let{strokeColor:t,strokeOpacity:n}=this.options[0],r=I.createLineMaterial({color:t,opacity:n});return this.lineMaterial=r,r}getBorderPoints(t){let{height:n,deltaHeight:r,geometry:i}=t,o=[],a=n+(r||0),{coords:l}=i;for(let u=0;u<l.length;u++){let c=l[u];for(let h=0;h<c.length;h++){let p=c[h],d=h+1===c.length?c[0]:c[h+1];o.push(new P.Vector3(p[0],p[1],a)),o.push(new P.Vector3(d[0],d[1],a))}}return o}initLineGeometry(){let t=this.options.map(n=>{let r=this.getBorderPoints(n);return new P.BufferGeometry().setFromPoints(r)});this.lineGeometry=(0,bn.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())}dispose(){this.geometry?.dispose(),this.material?.dispose(),this.lineGeometry?.dispose(),this.clear()}};var ot=require("three"),Tr=require("three/examples/jsm/utils/BufferGeometryUtils");var Cr={uuid:"",iconUrl:"",name:"",airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},qt=class extends ot.Object3D{constructor(t,n){super();this.context=t;this.options=n.map(r=>({...Cr,...r})),this.init()}options;mesh;async init(){let t=this.options.map(o=>{let{geometry:a}=o,l=st(a.coords[0],a.coords.slice(1)),u=new ot.ShapeGeometry(l,4),c=o.height+o.deltaHeight+o.airHeight,h=u.getAttribute("position");for(let d=0;d<h.count;d++)h.setZ(d,c);let p=[0,1,1,1,1,0,0,0];return u.setAttribute("uv",new ot.Float32BufferAttribute(p,2)),u}),n=(0,Tr.mergeGeometries)(t,!0);t.forEach(o=>o.dispose());let r=await Promise.all(this.options.map(async o=>{let{iconUrl:a}=o,l=await xt.getTextureByUrl(a);return new ot.MeshBasicMaterial({map:l,alphaTest:1,side:ot.DoubleSide})})),i=new ot.Mesh(n,r);this.mesh=i,this.position.z+=.004,this.add(i)}dispose(){this.mesh?.geometry.dispose(),(this.mesh?.material).forEach(t=>t.dispose()),this.clear()}};var St=require("three");var ki={url:"",geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},id:"",width:0,rotate:1,airHeight:1,deltaHeight:0,center_x:0,center_y:0},he=class extends St.Object3D{constructor(t,n){super();this.context=t;this.options=Object.assign({},ki,n),this.loadModel()}model=null;options;async loadModel(){let t=await Et.loadModel(this.options.url);t.scene.rotation.set(Math.PI/2,0,0);let r=new St.Box3().setFromObject(t.scene).getSize(new St.Vector3),i=Math.max(r.x,r.y),o=this.options.width/i;this.scale.set(o,o,o),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 St.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(r=>{this.meshSetMaterial(r)})}dispose(){V(this),this.model=null}};var W=require("three");var Mn=require("three/examples/jsm/utils/BufferGeometryUtils"),Pr=require("three/examples/jsm/lines/Line2"),Ar=require("three/examples/jsm/lines/LineGeometry");var pe=class extends W.Object3D{constructor(t,n){super();this.context=t;this.options=n;n.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;doubleLines=[];initGeometry(){let t=this.options.map(n=>{let r=st(n.geometry.coords[0].slice(0,-1),n.geometry.coords.slice(1)),i=new W.ShapeGeometry(r,4),o=i.getAttribute("position");for(let a=0;a<o.count;a++)o.setZ(a,n.airHeight+(n.deltaHeight||0));return i});this.geometry=(0,Mn.mergeGeometries)(t),t.forEach(n=>n.dispose())}initMaterial(){let{fillColor:t,fillOpacity:n}=this.options[0],r=I.createMeshBasicMaterial({color:t,opacity:n});return this.material=r,r}initLineMaterial(){let{strokeColor:t,strokeOpacity:n}=this.options[0],r=I.createLineMaterial({color:t,opacity:n});return this.lineMaterial=r,r}getBorderPoints(t){let{deltaHeight:n,geometry:r}=t,i=[],o=n||0,{coords:a}=r;for(let l=0;l<a.length;l++){let u=a[l];for(let c=0;c<u.length;c++){let h=u[c],p=c+1===u.length?u[0]:u[c+1];i.push(new W.Vector3(h[0],h[1],o)),i.push(new W.Vector3(p[0],p[1],o))}}return i}initDoubleLine(){let t=this.options.filter(r=>r.double&&r.geometry.otherCoords?.[1]?.length);if(!t.length)return;let n=t.reduce((r,i)=>{let o=`${i.secondColor}-${i.dashed}`;return r[o]&&r[o].push(i),r[o]||(r[o]=[i]),r},{});this.doubleLines=Object.values(n).map(r=>{let i=I.createLine2MaterialMap({color:r[0].secondColor,width:.2,dashed:r[0].dashed,resolution:new W.Vector2(this.context.clientSize.width,this.context.clientSize.height)});return r.map(o=>{let a=new Ar.LineGeometry,l=o.geometry.otherCoords[1].map(c=>[...c,o.airHeight+(o.deltaHeight||0)]).flat(2);a.setPositions(l);let u=new Pr.Line2(a,i);return u.computeLineDistances(),u.position.z+=.001,this.add(u),u})}).flat(2)}initLineGeometry(){let t=this.options.map(n=>{let r=this.getBorderPoints(n);return new W.BufferGeometry().setFromPoints(r)});this.lineGeometry=(0,Mn.mergeGeometries)(t)}createBorder(){let t=new W.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new W.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 L=require("three");var Ir=require("three/examples/jsm/utils/BufferGeometryUtils");var fe=class extends L.Object3D{constructor(t,n){super();this.context=t;this.options=n.map(r=>({...Te,...r})),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].airHeight,this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initGeometry(){let t=this.options.map(r=>{let i=st(r.geometry.coords[0],r.geometry.coords.slice(1));return new L.ExtrudeGeometry(i,{steps:1,bevelEnabled:!1,depth:r.height,curveSegments:4})}),n=(0,Ir.mergeGeometries)(t);return t.forEach(r=>r.dispose()),n}initMaterial(){let t=`
|
|
78
78
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
79
79
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
80
80
|
uniform vec3 uColor;
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
`,r=-1/0,i=this.geometry.getAttribute("position");if(i)for(let a=0;a<i.count;a++){let l=i.getZ(a);l>r&&(r=l)}let o=new L.ShaderMaterial({uniforms:{maxZ:{value:r},uColor:{value:new L.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new L.Color(pt(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:n,transparent:!0});this.material=o}initLineMaterial(){let t=I.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 L.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],n=this.options[0].height+this.options[0].deltaHeight;return this.options.map(r=>{let{coords:i}=r.geometry;for(let o=0;o<i.length;o++){let a=i[o];for(let l=0;l<a.length;l++){let u=a[l],c=l+1===a.length?a[0]:a[l+1];t.push(new L.Vector3(u[0],u[1],n)),t.push(new L.Vector3(c[0],c[1],n))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),n=new L.BufferGeometry().setFromPoints(t);this.lineGeometry=n}createBorder(){this.line&&this.remove(this.line);let t=new L.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 U=require("three");var Rr=require("lodash"),Vi={text:"",icon:"",icon_size:[18,18],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1},q=class extends U.Object3D{constructor(t,n){super();this.context=t;this.options=At((0,Rr.cloneDeep)({...Vi,...n}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}options;textAspect=1;spriteText;spriteIcon;box=new U.Box2;boxHelper;_initIconPromise=null;get durIconAndText(){return this.options.icon&&this.options.text?2:0}get offset(){return this.options.icon&&this.options.text?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.options.text?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.options.text?this.options.text_font_size:0}get deltaZ(){return!this.options.icon&&this.options.text?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:.1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",async({value:t})=>{this._initIconPromise&&await this._initIconPromise,this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),await this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text",({value:t})=>{this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",({value:t})=>{this.spriteIcon&&(this.spriteIcon.material.rotation=t/180*Math.PI)}),this.addEventListener("change-icon_size",({value:t})=>{this.spriteIcon&&this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-depth_test",({value:t})=>{this.spriteIcon&&(this.spriteIcon.material.depthTest=t),this.spriteText&&(this.spriteText.material.depthTest=t)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}async initIcon(){if(this.options.icon)return this._initIconPromise=new Promise(async t=>{let n=await xt.getTextureByUrl(this.options.icon),r=new U.Sprite(new U.SpriteMaterial({map:n,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));r.visible=!1,r.renderOrder=1e5+this.options.level,n.needsUpdate=!0,this.add(r),this.spriteIcon=r,t(r)}).then(()=>{this._initIconPromise=null})}initText(){if(this.options.text){let t=vt.getTextureByText(this.options.text);this.textAspect=t.image.width/t.image.height;let n=new U.Sprite(new U.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test}));n.visible=!1,n.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=n,this.add(n)}}initSize(){let t=0,n=0,{icon:r,text:i}=this.options;r?i?(t=0,n=t*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(t=.5,n=0):i?(n=.5,t=0):(t=0,n=0),this.spriteIcon?.center.set(.5,t),this.spriteText?.center.set(.5,n)}async init(){await this.initIcon(),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}_initScale=({zoom:t})=>{if(this.spriteText){let n=this.textHeight/t;this.spriteText.scale.set(this.textAspect*n,n,.1)}this.spriteIcon&&this.spriteIcon?.scale.set(this.options.icon_size[0]/t,this.options.icon_size[1]/t,.1),this.resetZ()};resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:n,height:r}}=this.context,i=n*(t.x+1)/2,o=r*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let a=this.iconWidth/2,l=new U.Box2(new U.Vector2(i-a,o-this.iconHeight),new U.Vector2(i+a,o)),u=this.textWidth/2,c=new U.Box2(new U.Vector2(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new U.Vector2(i+u,o-this.iconHeight-this.durIconAndText));return this.box=c.union(l),this.box}renderBoxHelper(t,n){if(!this.boxHelper){let r=document.createElement("div");r.style.position="absolute",r.style.zIndex="999",r.style.border="1px solid red",r.style.pointerEvents="none",this.boxHelper=r,this.context.container.appendChild(r)}t&&n?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=n+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(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 Q=require("three"),Lr=require("three/examples/jsm/utils/BufferGeometryUtils");var Nr={airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},texts:[],fillColor:"#ffffff",fillOpacity:0,strokeColor:"#ffffff",strokeOpacity:0,secondHeight:0,secondRotate:0,center_x:0,center_y:0},de=class extends Q.Object3D{constructor(t,n){super();this.context=t;this.options=n.map(r=>({...Nr,...r})),this.init()}options;mesh;async init(){let t=this.options.map(a=>vt.getTextureByText(a.texts[0],{fillStyle:Me(a.fillColor,a.fillOpacity),strokeStyle:Me(a.strokeColor,a.strokeOpacity),lineWidth:6,font:"54px sans-serif"})),n=t.map((a,l)=>{let u=this.options[l],{width:c,height:h}=a.image,p=c/h,d=u.secondHeight*p,m=new Q.PlaneGeometry(d,u.secondHeight),f=new Q.Matrix4().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new Q.Matrix4().makeRotationZ(u.secondRotate));return m.applyMatrix4(f),m}),r=(0,Lr.mergeGeometries)(n,!0);n.forEach(a=>a.dispose());let i=t.map(a=>{let l=new Q.MeshBasicMaterial({map:a,alphaTest:1,side:Q.DoubleSide});return a.needsUpdate=!0,l}),o=new Q.Mesh(r,i);this.mesh=o,this.position.z+=.004,this.add(o)}dispose(){this.mesh?.geometry.dispose(),(this.mesh?.material).forEach(t=>t.dispose()),this.clear()}};var Dr=require("three"),Le=class extends J{startPoint;endPoint;rect;frustum=new Dr.Frustum;constructor(e){super(e);let{config:{selectBox:{fill:t,stroke:n}}}=e;this.rect=mt(n,t),this.svg.appendChild(this.rect),this.registryEvent()}setEnable(e){super.setEnable(e),B(this.rect,0,0,0,0),e?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}onPointerDown=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.startPoint=t),this.endPoint=void 0};onPointerMove=e=>{if(!this.enable||!this.startPoint)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t)};onPointerUp=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t),this.doSelect(),this.startPoint=void 0};onUpdate=()=>{if(this.startPoint){let e=this.getSvgCoordinate(this.startPoint),t={...e};this.endPoint&&(t=this.getSvgCoordinate(this.endPoint));let n={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y)},r=Math.abs(t.x-e.x),i=Math.abs(t.y-e.y);B(this.rect,n.x,n.y,r,i)}else B(this.rect,0,0,0,0)};registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:t,container:{clientWidth:n,clientHeight:r}}}=this,i=y(this.startPoint,t,n,r),o=y(this.endPoint,t,n,r),a={x:Math.min(i.x,o.x),y:Math.min(i.y,o.y)},l={x:Math.max(i.x,o.x),y:Math.max(i.y,o.y)},u=this.searchMapInFrustum(a,l);this.dispatchEvent({type:"selected",list:u})}}searchMapInFrustum(e,t){let{context:n}=this;return n.currentFloor?.graphicLayer.children.filter(r=>r instanceof R&&this.searchChildInFrustum(r,e,t))||[]}searchChildInFrustum(e,t,n){let{context:{camera:r,container:{clientWidth:i,clientHeight:o}}}=this;if(!e)return!1;if(!e.mesh){let p=e.getPosition();if(p){let d=y(p,r,i,o);return gt(d,t,n)}return!1}e.mesh.geometry.boundingBox||e.mesh.geometry.computeBoundingBox();let a=e.mesh.geometry.boundingBox;if(!a)return!1;let{min:l,max:u}=a,c=y(l,r,i,o),h=y(u,r,i,o);return!(!gt(c,t,n)||!gt(h,t,n))}dispose(){this.unRegistryEvent()}};var ge=class extends Or.EventDispatcher{constructor(t){super();this.context=t;this.boxSelection=new Le(t),this.boxSelection.setEnable(!1),this.registryEvent()}_list=new Set;boxSelection;prevPanStatus;prevRotateStatus;downPoint=null;isMultipleSelect=!1;get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.context.config.enableBoxSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}onPointerDown=t=>{this.downPoint={x:t.offsetX,y:t.offsetY}};onPointerUp=t=>{if(!this.downPoint)return;let{offsetX:n,offsetY:r}=t,{x:i,y:o}=this.downPoint;if(Math.sqrt((i-n)**2+(o-r)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,r),l=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(n,r).forEach(c=>{if(!l.has(c.options.id)){let h=this.context.currentFloor?.graphicLayer.graphicMap.get(c.options.id)||null;h&&h.options.geometry.type==="point"&&(a.push(h),l.add(c.options.id))}}),(It?t.metaKey:t.ctrlKey)||this._list.clear(),a.forEach(c=>this._list.add(c)),this.selectEnd(),this.downPoint=null};onPointerOut=t=>{this.disableBoxSelection()};onKeyDown=t=>{Rt(t.key)&&this.enableBoxSelection()};onKeyUp=t=>{Rt(t.key)&&this.disableBoxSelection()};onBoxSelected=({list:t})=>{this._list.clear(),t.forEach(n=>{this._list.add(n)}),this.selectEnd()};selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}};var Ne=require("three");var me=class extends Ne.EventDispatcher{constructor(t){super();this.context=t;this.registryEvent()}curGraphics=new Set;timer=new D;graphicTimerMap=new Map;onPointerMove=({graphics:t,pois:n,e:r})=>{let i=n.map(u=>this.context.currentFloor?.graphicLayer.graphicMap.get(u.options.id)).filter(u=>u&&u.options.geometry.type==="point");if(!t.length&&!i.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:o}=this.context.config.hover,a=new Set;if(i.length){let u,c=1e4;i.forEach(h=>{let p=n.find(d=>d.options.id===h.options.id);if(p instanceof bt){let{x:d,y:m}=p.clientPos,f=Math.sqrt((d-r.offsetX)**2+(m-r.offsetY)**2);f<c&&(c=f,u=h)}else if(p instanceof q){let{x:d,y:m}=p.box.getCenter(new Ne.Vector2),f=Math.sqrt((d-r.offsetX)**2+(m-r.offsetY)**2);f<c&&(c=f,u=h)}}),a.add(u)}a.size||t.forEach(u=>a.add(u)),a.forEach(u=>{if(this.graphicTimerMap.get(u)||this.curGraphics.has(u))return;let c=this.timer.setTimeout(()=>{this.curGraphics.add(u),this.graphicTimerMap.delete(u),this.timer.clearTimeout(c),this.handleHoverGraphicsChange()},o);this.graphicTimerMap.set(u,c)}),this.graphicTimerMap.forEach((u,c)=>{a.has(c)||(this.timer.clearTimeout(u),this.graphicTimerMap.delete(c))});let l=this.curGraphics.size;this.curGraphics.forEach(u=>{a.has(u)||this.curGraphics.delete(u)}),l!==this.curGraphics.size&&this.handleHoverGraphicsChange()};onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()};onBodyPointerMove=t=>{if(this.curGraphics.size){let n=this.context.container.getBoundingClientRect();(t.clientX<n.left||t.clientX>n.right||t.clientY<n.top||t.clientY>n.bottom)&&this.onPointerLevel()}};handleHoverGraphicsChange(t=this.curGraphics){this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}};var Bt=require("three");var De=class{constructor(e){this.context=e;this.registryEvent(),this.changePrevCamera()}prevCamera={position:new Bt.Vector3,zoom:1,target:new Bt.Vector3};enable=!0;box=new Bt.Box3;updateBox(){this.box.setFromObject(this.context.scene)}setEnable(e){this.enable=e,e?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.scene.children.filter(g=>g instanceof ct).length)return null;let t=this.box,{camera:n,clientSize:{width:r,height:i}}=this.context,{min:o,max:a}=t,l=y(o,n,r,i),u=y(a,n,r,i),c=y(new Bt.Vector3(o.x,a.y,a.z),n,r,i),h=y(new Bt.Vector3(a.x,o.y,o.z),n,r,i),p=Math.min(l.x,u.x,c.x,h.x),d=Math.max(l.x,u.x,c.x,h.x),m=Math.min(l.y,u.y,c.y,h.y),f=Math.max(l.y,u.y,c.y,h.y);return{left:p,right:d,top:m,bottom:f}}checkDistanceToScreenEdge({left:e,right:t,top:n,bottom:r}){let{width:i,height:o}=this.context.clientSize,[a,l,u,c]=this.context.config.cameraBound.padding,h=t>=c,p=i-e>=l,d=o-n>=u,m=r>=a;return h&&p&&d&&m}onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:t,right:n,top:r,bottom:i}=e;this.checkDistanceToScreenEdge({left:t,right:n,top:r,bottom:i})?this.changePrevCamera():this.backToPrevCamera()}};dispose(){this.unRegistryEvent()}};var Mn=require("three"),Fr=require("three/examples/jsm/controls/MapControls"),Gt=require("@tweenjs/tween.js");var Oe=class extends Fr.MapControls{constructor(t,n,r){super(n,r);this.context=t;this.camera=n;this.domElement=r;this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=n.zoom,this.registryEvent()}prevCameraZoom=1;tweenGroup=new Gt.Group;offsetY=0;registryEvent(){this.addEventListener("change",()=>{let t=this.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.dispatchEvent({type:"change-zoom",zoom:t}))}),this.context.addEventListener("update",this.tweenUpdate)}tweenUpdate=()=>{this.tweenGroup.update()};setPolarAngle(t,n=!1){let{maxPolarAngle:r,minPolarAngle:i}=this,o=r===i;(n||t<=r&&t>=i)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=r,this.minPolarAngle=i)}async setPolarAngleByDuration(t,n=!1,r=500){return r<=0?this.setPolarAngle(t,n):Z(new Promise(i=>{let o={polar:this.getPolarAngle()},a={polar:t},l=new Gt.Tween(o,this.tweenGroup).to(a,r).onUpdate(()=>{this.setPolarAngle(o.polar,n)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(l),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),r+500)}setAzimuthalAngle(t,n){let{maxAzimuthAngle:r,minAzimuthAngle:i,maxPolarAngle:o,minPolarAngle:a}=this,l=r===i;if(n||t<=r&&t>=i){this.maxAzimuthAngle=t,this.minAzimuthAngle=t;let u=this.getPolarAngle();this.maxPolarAngle=u,this.minPolarAngle=u,this.update(),this.maxPolarAngle=o,this.minPolarAngle=a}l||(this.maxAzimuthAngle=r,this.minAzimuthAngle=i)}setAzimuthalAngleDuration(t,n=!1,r=500){return r<=0?this.setAzimuthalAngle(t,n):Z(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},a={azimuthal:t},l=new Gt.Tween(o,this.tweenGroup).to(a,r).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,n)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(l),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),r+500)}getCameraLookAt(){return new Mn.Vector3().subVectors(this.target,this.camera.position)}async setCameraPositionByTarget(t,n){let r=this.target.clone(),i=this.getCameraLookAt();if(!n){this.camera.position.copy(t.clone().sub(i)),this.target.copy(t.clone()),this.update();return}return Z(new Promise(o=>{let a=new Gt.Tween(r,this.tweenGroup).to(t,n).onUpdate(()=>{this.camera.position.copy(r.clone().sub(i)),this.target.copy(r.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(a),this.camera.position.copy(t.clone().sub(i)),this.target.copy(t.clone()),this.update(),this.enabled=!0,o(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}setZoom(t,n,r=!1){let{minZoom:i,maxZoom:o}=this;(r||t>=i&&t<=o)&&(this.camera.position.copy(n.clone().sub(this.getCameraLookAt())),this.target.copy(n),this.camera.zoom=t,this.update())}async setZoomByDuration(t,n,r=!1,i=500){let o=this.getCameraLookAt(),a={zoom:this.camera.zoom,target:this.target.clone()};return i?Z(new Promise(l=>{let u=new Gt.Tween(a,this.tweenGroup).to({zoom:t,target:n},i).onUpdate(()=>{this.setZoom(a.zoom,a.target,r)}).onComplete(()=>{this.tweenGroup.remove(u),this.enabled=!0,l(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500):this.setZoom(t,n,r)}setTargetByOffset(t,n=this.target.clone()){if(!t)return;let r=new Mn.Vector3;r.setFromMatrixColumn(this.camera.matrix,1),r.normalize(),r.multiplyScalar(t/this.camera.zoom),n.add(r),this.setCameraPositionByTarget(n,0)}clearTween(){this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll()}dispose(){this.clearTween()}};var jt=require("three");var Fe=class extends jt.WebGLRenderer{event=new jt.EventDispatcher;scene;camera;enable=!0;timer=new D;constructor(e){super({antialias:!0,alpha:!0,...e}),this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=jt.PCFSoftShadowMap}setCameraAndScene(e,t){this.scene=e,this.camera=t}autoRender(){this.scene&&this.camera&&this.enable&&(this.event.dispatchEvent({type:"update"}),this.render(this.scene,this.camera)),this.timer.requestAnimationFrame(()=>{this.autoRender()})}pauseRender(){this.enable=!1}continueRender(){this.enable=!0}addEventListener(e,t){this.event.addEventListener(e,t)}removeEventListener(e,t){this.event.removeEventListener(e,t)}dispose(){this.timer.dispose(),this.enable=!1,super.dispose()}};var Ur=require("three"),Ue=class extends Ur.Scene{constructor(){super()}};var Br=require("three"),Be=class extends Br.OrthographicCamera{constructor(e,t){super(-e/2,e/2,t/2,-t/2,-1e3,5e3),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var _e=class extends S.EventDispatcher{constructor(t,n){super();this.container=t;this.config=n;this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new ge(this),this.hoverHelper=new me(this),this.resizeClientSize(),this.registryEvent()}scene=new Ue;renderer=new Fe;camera;control;lights=Ze();currentFloor;selection;hoverHelper;basicRatio;cameraBound;clientSize={width:0,height:0,x:0,y:0};renderRf=0;resizeClientSize(){let{x:t,y:n,width:r,height:i}=this.container.getBoundingClientRect();this.clientSize={width:r||this.container.clientWidth,height:i||this.container.clientHeight,x:t,y:n}}init(){let{clientWidth:t,clientHeight:n}=this.container;this.camera=new Be(t,n),this.renderer.setSize(t,n),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new Oe(this,this.camera,this.renderer.domElement),this.control.maxPolarAngle=this.config.control.maxPolar,this.container.appendChild(this.renderer.domElement),this.scene.add(this.lights),this.basicRatio=this.getRatio(),this.control.addEventListener("change",()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})}),this.control.addEventListener("change-zoom",({zoom:r})=>{this.dispatchEvent({type:"control-zoom-change",zoom:r})}),this.renderer.addEventListener("update",()=>{this.dispatchEvent({type:"update"})}),this.cameraBound=new De(this)}getRatio(t=new S.Vector3(0,0,0),n=new S.Vector3(100,0,0)){let{clientWidth:r,clientHeight:i}=this.container,o=y(t,this.camera,r,i),a=y(n,this.camera,r,i);return Math.ceil(Math.sqrt((a.x-o.x)**2+(a.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(n=>{n instanceof S.AmbientLight&&(n.color=new S.Color(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let n=t.getCenter();n&&(this.lights.position.x=n.x,this.lights.position.y=n.y),this.cameraBound.updateBox()}onWindowResize=()=>{let{container:t,camera:n,renderer:r}=this,{clientWidth:i,clientHeight:o}=t;i=Math.max(1,i),o=Math.max(1,o),n.left=-i/2,n.right=i/2,n.top=o/2,n.bottom=-o/2,n.updateProjectionMatrix(),r.setSize(i,o),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:i,height:o})};onClick=t=>{let{graphics:n,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY);n.length&&this.dispatchEvent({type:"graphic-click",graphics:n,position:r});let i=this.getPoisByDeviceXy(t.offsetX,t.offsetY);i.length&&this.dispatchEvent({type:"poi-click",pois:i})};getGraphicsByDeviceXy(t,n){let r=new S.Vector2;r.x=t/this.clientSize.width*2-1,r.y=n/this.clientSize.height*-2+1;let i=new S.Raycaster;return i.setFromCamera(r,this.camera),i.ray.origin.sub(i.ray.direction.clone().multiplyScalar(100)),this.currentFloor?.graphicLayer.getGraphicByRaycaster(i)||{graphics:[],position:null}}getPoisByDeviceXy(t,n){let r=this.currentFloor?.poiLayer.getPoiByDeviceXy(t,n),i=this.currentFloor?.poiLayer2.getPoiByDeviceXy(t,n);return(r||[]).concat(i||[])}onPointerover=t=>{let{graphics:n,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),i=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-over",e:t,graphics:n,pois:i,position:r})};onPointermove=t=>{let{graphics:n,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),i=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-move",e:t,graphics:n,pois:i,position:r})};onPointerleave=t=>{this.dispatchEvent({type:"pointer-level"})};onSelectionSelect=({graphics:t,isMultipleSelect:n})=>{this.dispatchEvent({type:"select-graphic",graphics:t,isMultipleSelect:n})};onHoverChange=({graphics:t})=>{this.dispatchEvent({type:"hover",graphics:t})};registryEvent(){window.addEventListener("resize",this.onWindowResize),this.container.addEventListener("click",this.onClick),this.container.addEventListener("pointerover",this.onPointerover),this.container.addEventListener("pointermove",this.onPointermove),this.container.addEventListener("pointerleave",this.onPointerleave),this.container.addEventListener("pointercancel",this.onPointerleave),this.container.addEventListener("pointerout",this.onPointerleave),this.selection.addEventListener("select",this.onSelectionSelect),this.hoverHelper.addEventListener("hover-change",this.onHoverChange)}unRegistryEvent(){window.removeEventListener("resize",this.onWindowResize),this.container.removeEventListener("click",this.onClick),this.container.removeEventListener("pointerover",this.onPointerover),this.container.removeEventListener("pointermove",this.onPointermove),this.container.removeEventListener("pointerleave",this.onPointerleave),this.container.removeEventListener("pointercancel",this.onPointerleave),this.container.removeEventListener("pointerout",this.onPointerleave),this.selection.removeEventListener("select",this.onSelectionSelect),this.hoverHelper.removeEventListener("hover-change",this.onHoverChange)}setPolarAngle(t,n=500){return this.control.setPolarAngleByDuration(t,!0,n)}setAzimuthalAngle(t,n=500){return this.control.setAzimuthalAngleDuration(t,!0,n)}getCameraLookAt(){return this.control.getCameraLookAt()}setZoom(t,n,r=500){return this.control.setZoomByDuration(t,n,!0,r)}getFitCameraToObjectZoom(t,n=[20,20,20,20],r=500,i=!0){let[o,a,l,u]=n,{clientSize:{width:c,height:h}}=this,p=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let d=new S.Box3().setFromObject(t);this.setPolarAngle(p,0);let{max:m,min:f}=d,g=new S.Vector3(f.x,m.y,m.z),E=new S.Vector3(m.x,m.y,m.z),x=new S.Vector3(m.x,f.y,f.z),z=new S.Vector3(f.x,f.y,f.z),b=y(g,this.camera,c,h),T=y(E,this.camera,c,h),k=y(z,this.camera,c,h),$=y(x,this.camera,c,h),Kt=new S.Box2().setFromPoints([new S.Vector2(b.x,b.y),new S.Vector2(T.x,T.y),new S.Vector2(k.x,k.y),new S.Vector2($.x,$.y)]).getSize(new S.Vector2),Ke=(c-a-u)/Kt.x,fi=(h-o-l)/Kt.y,di=Math.min(Ke,fi),gi=new S.Vector3((m.x+f.x)/2,(m.y+f.y)/2,(m.z+f.z)/2);return{zoom:di*this.camera.zoom,center:gi}}fitCameraToObject(t,n=[20,20,20,20],r=500,i=!0){let{zoom:o,center:a}=this.getFitCameraToObjectZoom(t,n,r,i);return this.setZoom(o,a,r)}getFitCameraToGroundZoom(t=[20,20,20,20],n=500,r=!0){if(this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,n,r).zoom}fitCameraToGround(t=[20,20,20,20],n=500,r=!0){return this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundUpper,t,n,r):Promise.resolve(!1)}async setCameraPosition(t,n){return this.control.setCameraPositionByTarget(t,n)}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.renderer.dispose(),this.lights.children.forEach(t=>t.dispose()),V(this.scene)}};var Gr=require("lodash"),zr={apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get"},enableBoxSelect:!0,resizeObserver:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1}};function wn(s){return(0,Gr.merge)({},zr,s)}var kr=require("lodash");var Vr=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(Vr||{}),Tn=class extends Ge.EventDispatcher{constructor(t,n={}){super();this.container=t;this.config=wn(n),this.context=new _e(t,this.config),this.registryEvent()}config;context;polarKeys=[];azimuthalKeys=[];svgLine;svgPolygon;basicZoom=1;prevCameraZoom=1;type="2d";currentBuildGround=null;observe=null;buildingCenter=[0,0];timer=new D;plugins=[];changeBuildingCenter(t,{brand:n,project:r}){let i=t?Jt(t.info.geometry.cds[0]):[0,0];this.buildingCenter=i,this.dispatchEvent({type:"center-change",center:i,project:r,brand:n})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(n=>n!==t)}triggerHooks(t,n){this.dispatchEvent({type:t,data:n})}switchFloorByFloor(t,n=t.graphicLayer.children){this.triggerHooks("switch_floor_before",{curFloor:t,graphics:n}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",{curFloor:t,graphics:n})}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(void 0,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*30,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}onControlChange=()=>{let{camera:{zoom:t}}=this.context;t!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=t)};addModel(t,n){if(t.options.geometry.type==="polygon"){let r=this.context.currentFloor?.addModel({...n,position:t.getPosition().setZ(.1),id:t.options.id});if(r){let{facilityAngle:i=0,facilityXScale:o=1,facilityYScale:a=1}=t.options.userData;r.rotateZ((180-i)/180*Math.PI),r.scale.set(o,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 R)||[]}createGraphicPoi(t,n){if(this.context.currentFloor){n.id===void 0&&(n.id=t.options.id);let r=t.options.center,i=t.getCenter(),o=r?.[0]||i.x,a=r?.[1]||i.y;return console.log(o,a,r,i),this.context.currentFloor.addPoi({...n,position:{x:o,y:a,z:i.z+t.options.height/2}})}return null}removeHeatMap(){this.context.currentFloor?.removeHeatMap()}translateElementToCenter(t,n=500){let r=t.getPosition();return this.context.setCameraPosition(r,n)}async translateElementToCenterX(t,n=500){return Z(new Promise(r=>{let i=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:a,height:l},camera:u}=this.context,h=y(o,u,a,l).x-a/2,p=new Ge.Vector3;p.setFromMatrixColumn(this.context.camera.matrix,0),p.normalize(),p.multiplyScalar(h/this.context.camera.zoom),i.add(p),this.context.setCameraPosition(i,n).then(r)})}),n+500)}getElementDeviceCoordinate(t){let n=t.position.clone(),{clientWidth:r,clientHeight:i}=this.container;return y(n,this.context.camera,r,i)}changeMapType(t,n=500){return this.type=t,t==="2d"?this.context.setPolarAngle(0,n):this.context.setPolarAngle(1.1,n)}async resetView(t=300){let n=t/3;await this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,n),await this.context.setPolarAngle(this.config.control.defaultPolar,n),await this.context.fitCameraToGround(this.config.defaultPadding,n,!1)}reduceMap(t=.5,n=500){let r=this.context.camera.zoom;return this.context.setZoom(r-t,this.context.control.target,n)}enlargeMap(t=.5,n=500){let r=this.context.camera.zoom;return this.context.setZoom(r+t,this.context.control.target,n)}onKeydown=t=>{this.polarKeys.includes(t.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(t.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)};onKeyUp=t=>{if(this.polarKeys.includes(t.code)){let n=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=n,this.context.control.minPolarAngle=n}if(this.azimuthalKeys.includes(t.code)){let n=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=n,this.context.control.minAzimuthAngle=n}};registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver((0,kr.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 n=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(n+t,500)}async measureDistance(){return this.cancelDistance(),new Promise((t,n)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new le(this.context);let r=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){r(),n("cancel")},this.svgLine.addEventListener("distance",({distance:i})=>{t(i)})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,n)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new ue(this.context);let r=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){r(),n("cancel")},this.svgPolygon.addEventListener("area",({area:i})=>{t(i)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){return this.context.currentFloor?.graphicLayer.getGraphicByNodeId(t)||null}deleteGraphic(t){this.context.currentFloor?.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){if(!t.transformToBuildingGround&&this.currentBuildGround){let n=Jt(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(r=>{Array.isArray(r)&&r.forEach(i=>{i[0]-=n[0],i[1]-=n[1]})});else{let[r,i]=t.geometry.cds;t.geometry.coords=[r-n[0],i-n[1]]}}return this.context.currentFloor?.graphicLayer.createGraphic(t)}removePoiById(t){this.context.currentFloor?.poiLayer.removePoiById(t),this.context.currentFloor?.poiLayer2.removePoiById(t)}getPoiById(t){return this.context.currentFloor?.poiLayer.getPoiById(t)||this.context.currentFloor?.poiLayer2.getPoiById(t)}getPois(){return[...(this.context.currentFloor?.poiLayer.pois||[]).filter(t=>!t.options.built_in),...this.context.currentFloor?.poiLayer2.pois||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let t=this.context.control.getAzimuthalAngle(),n=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let r=this.context.getFitCameraToGroundZoom(void 0,0)||1;this.context.camera.zoom=n,this.context.control.minZoom=r,this.context.control.maxZoom=r*25,this.basicZoom=n,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(t,0),this.context.cameraBound.setEnable(!0)};dispose(){this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.context.dispose(),this.unRegistryEvent(),vt.dispose(),xt.dispose(),Nt.dispose(),Et.dispose(),I.dispose()}};var Hr=require("three"),dt=class extends Hr.EventDispatcher{bmap;constructor(e){super(),this.bmap=e,this.bmap.use(this)}dispose(){}};var Cn=class extends dt{equipmentList=[];equipmentMap=new Map;constructor(e){super(e),this.fetchEquipment(),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}async fetchEquipment(){let{apiDomain:e,apiPath:{equipmentList:t},apiInfo:n}=this.bmap.config,r=`${e}${t}`;await fetch(r,n).then(i=>i.json()).then(i=>i.data).then(i=>{this.equipmentList=i,this.equipmentMap=new Map(i.map(o=>[o.equipment_id,o]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)}onSwitchFloor=({data:{graphics:e}})=>{this.equipmentList.length&&this.changeGraphicToEquipment(e)};getGraphicEquipment(e){return e.userData.data.info.userData.equipment}changeGraphicToEquipment(e){e.filter(t=>{let n=this.getGraphicEquipment(t);return n&&this.equipmentMap.has(n)}).forEach(t=>{let n=this.equipmentMap.get(this.getGraphicEquipment(t)),r=this.bmap.createGraphicPoi(t,{icon:n?.equipment_icon,built_in:!0,icon_size:[14,14]});r&&(r.userData.data=n,r.userData.type="equipment")})}dispose(){this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),Array.from(this.bmap.context.currentFloor?.poiLayer.pois||[]).forEach(e=>{e.userData.type==="equipment"&&this.bmap.context.currentFloor?.poiLayer.removePoi(e)})}};var N=require("three");var _=require("three"),tt=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(e){this.setGeometry(e,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(e){this.setPoints(e,this.widthCallback)}}})}};tt.prototype.setMatrixWorld=function(s){this.matrixWorld=s};tt.prototype.setGeometry=function(s,e){this._geometry=s,this.setPoints(s.getAttribute("position").array,e)};tt.prototype.setPoints=function(s,e){if(!(s instanceof Float32Array)&&!(s instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=s,this.widthCallback=e,this.positions=[],this.counters=[],s.length&&s[0]instanceof _.Vector3)for(var t=0;t<s.length;t++){var n=s[t],r=t/s.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(r),this.counters.push(r)}else for(var t=0;t<s.length;t+=3){var r=t/s.length;this.positions.push(s[t],s[t+1],s[t+2]),this.positions.push(s[t],s[t+1],s[t+2]),this.counters.push(r),this.counters.push(r)}this.process()};function Hi(s,e){var t=new _.Matrix4,n=new _.Ray,r=new _.Sphere,i=new _.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),r.copy(o.boundingSphere),r.applyMatrix4(this.matrixWorld),s.ray.intersectSphere(r,i)!==!1){t.copy(this.matrixWorld).invert(),n.copy(s.ray).applyMatrix4(t);var a=new _.Vector3,l=new _.Vector3,u=new _.Vector3,c=this instanceof _.LineSegments?2:1,h=o.index,p=o.attributes;if(h!==null)for(var d=h.array,m=p.position.array,f=p.width.array,g=0,E=d.length-1;g<E;g+=c){var x=d[g],z=d[g+1];a.fromArray(m,x*3),l.fromArray(m,z*3);var b=f[Math.floor(g/3)]!==void 0?f[Math.floor(g/3)]:1,T=s.params.Line.threshold+this.material.lineWidth*b/2,k=T*T,$=n.distanceSqToSegment(a,l,i,u);if(!($>k)){i.applyMatrix4(this.matrixWorld);var Tt=s.ray.origin.distanceTo(i);Tt<s.near||Tt>s.far||(e.push({distance:Tt,point:u.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}),g=E)}}}}tt.prototype.raycast=Hi;tt.prototype.compareV3=function(s,e){var t=s*6,n=e*6;return this.positions[t]===this.positions[n]&&this.positions[t+1]===this.positions[n+1]&&this.positions[t+2]===this.positions[n+2]};tt.prototype.copyV3=function(s){var e=s*6;return[this.positions[e],this.positions[e+1],this.positions[e+2]]};tt.prototype.getDistance=function(s){let e=0;for(let t=0;t<s;t++){let n=6*t,r=new _.Vector3(this.positions[n],this.positions[n+1],this.positions[n+2]),i=new _.Vector3(this.positions[n+6],this.positions[n+7],this.positions[n+8]),o=r.distanceTo(i);e+=o}return e};tt.prototype.process=function(){var s=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var e;let t=this.getDistance(s-1);var n;this.compareV3(0,s-1)?n=this.copyV3(s-2):n=this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var r=0;r<s;r++){if(this.side.push(1),this.side.push(-1),this.widthCallback?e=this.widthCallback(r/(s-1)):e=1,this.width.push(e),this.width.push(e),r===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(r===s-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let o=this.getDistance(r)/t;this.uvs.push(o,0),this.uvs.push(o,1)}if(r<s-1){n=this.copyV3(r),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var i=r*2;this.indices_array.push(i,i+1,i+2),this.indices_array.push(i+2,i+1,i+3)}r>0&&(n=this.copyV3(r),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(s-1,0)?n=this.copyV3(1):n=this.copyV3(s-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new _.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 Pn(s,e,t,n,r){var i;if(s=s.subarray||s.slice?s:s.buffer,t=t.subarray||t.slice?t:t.buffer,s=e?s.subarray?s.subarray(e,r&&e+r):s.slice(e,r&&e+r):s,t.set)t.set(s,n);else for(i=0;i<s.length;i++)t[i+n]=s[i];return t}tt.prototype.advance=function(s){var e=this._attributes.position.array,t=this._attributes.previous.array,n=this._attributes.next.array,r=e.length;Pn(e,0,t,0,r),Pn(e,6,e,0,r-6),e[r-6]=s.x,e[r-5]=s.y,e[r-4]=s.z,e[r-3]=s.x,e[r-2]=s.y,e[r-1]=s.z,Pn(e,6,n,0,r-6),n[r-6]=s.x,n[r-5]=s.y,n[r-4]=s.z,n[r-3]=s.x,n[r-2]=s.y,n[r-1]=s.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(`
|
|
103
|
+
`,r=-1/0,i=this.geometry.getAttribute("position");if(i)for(let a=0;a<i.count;a++){let l=i.getZ(a);l>r&&(r=l)}let o=new L.ShaderMaterial({uniforms:{maxZ:{value:r},uColor:{value:new L.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new L.Color(pt(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:n,transparent:!0});this.material=o}initLineMaterial(){let t=I.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 L.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],n=this.options[0].height+this.options[0].deltaHeight;return this.options.map(r=>{let{coords:i}=r.geometry;for(let o=0;o<i.length;o++){let a=i[o];for(let l=0;l<a.length;l++){let u=a[l],c=l+1===a.length?a[0]:a[l+1];t.push(new L.Vector3(u[0],u[1],n)),t.push(new L.Vector3(c[0],c[1],n))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),n=new L.BufferGeometry().setFromPoints(t);this.lineGeometry=n}createBorder(){this.line&&this.remove(this.line);let t=new L.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 U=require("three");var Rr=require("lodash"),Vi={text:"",icon:"",icon_size:[18,18],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1},q=class extends U.Object3D{constructor(t,n){super();this.context=t;this.options=At((0,Rr.cloneDeep)({...Vi,...n}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}options;textAspect=1;spriteText;spriteIcon;box=new U.Box2;boxHelper;_initIconPromise=null;get durIconAndText(){return this.options.icon&&this.options.text?2:0}get offset(){return this.options.icon&&this.options.text?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.options.text?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.options.text?this.options.text_font_size:0}get deltaZ(){return!this.options.icon&&this.options.text?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:.1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",async({value:t})=>{this._initIconPromise&&await this._initIconPromise,this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),await this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text",({value:t})=>{this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",({value:t})=>{this.spriteIcon&&(this.spriteIcon.material.rotation=t/180*Math.PI)}),this.addEventListener("change-icon_size",({value:t})=>{this.spriteIcon&&this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-depth_test",({value:t})=>{this.spriteIcon&&(this.spriteIcon.material.depthTest=t),this.spriteText&&(this.spriteText.material.depthTest=t)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}async initIcon(){if(this.options.icon)return this._initIconPromise=new Promise(async t=>{let n=await xt.getTextureByUrl(this.options.icon),r=new U.Sprite(new U.SpriteMaterial({map:n,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));r.visible=!1,r.renderOrder=1e5+this.options.level,n.needsUpdate=!0,this.add(r),this.spriteIcon=r,t(r)}).then(()=>{this._initIconPromise=null})}initText(){if(this.options.text){let t=vt.getTextureByText(this.options.text);this.textAspect=t.image.width/t.image.height;let n=new U.Sprite(new U.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test}));n.visible=!1,n.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=n,this.add(n)}}initSize(){let t=0,n=0,{icon:r,text:i}=this.options;r?i?(t=0,n=t*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(t=.5,n=0):i?(n=.5,t=0):(t=0,n=0),this.spriteIcon?.center.set(.5,t),this.spriteText?.center.set(.5,n)}async init(){await this.initIcon(),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}_initScale=({zoom:t})=>{if(this.spriteText){let n=this.textHeight/t;this.spriteText.scale.set(this.textAspect*n,n,.1)}this.spriteIcon&&this.spriteIcon?.scale.set(this.options.icon_size[0]/t,this.options.icon_size[1]/t,.1),this.resetZ()};resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:n,height:r}}=this.context,i=n*(t.x+1)/2,o=r*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let a=this.iconWidth/2,l=new U.Box2(new U.Vector2(i-a,o-this.iconHeight),new U.Vector2(i+a,o)),u=this.textWidth/2,c=new U.Box2(new U.Vector2(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new U.Vector2(i+u,o-this.iconHeight-this.durIconAndText));return this.box=c.union(l),this.box}renderBoxHelper(t,n){if(!this.boxHelper){let r=document.createElement("div");r.style.position="absolute",r.style.zIndex="999",r.style.border="1px solid red",r.style.pointerEvents="none",this.boxHelper=r,this.context.container.appendChild(r)}t&&n?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=n+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(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 Q=require("three"),Lr=require("three/examples/jsm/utils/BufferGeometryUtils");var Nr={airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},texts:[],fillColor:"#ffffff",fillOpacity:0,strokeColor:"#ffffff",strokeOpacity:0,secondHeight:0,secondRotate:0,center_x:0,center_y:0},de=class extends Q.Object3D{constructor(t,n){super();this.context=t;this.options=n.map(r=>({...Nr,...r})),this.init()}options;mesh;async init(){let t=this.options.map(a=>vt.getTextureByText(a.texts[0],{fillStyle:Se(a.fillColor,a.fillOpacity),strokeStyle:Se(a.strokeColor,a.strokeOpacity),lineWidth:6,font:"54px sans-serif"})),n=t.map((a,l)=>{let u=this.options[l],{width:c,height:h}=a.image,p=c/h,d=u.secondHeight*p,m=new Q.PlaneGeometry(d,u.secondHeight),f=new Q.Matrix4().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new Q.Matrix4().makeRotationZ(u.secondRotate));return m.applyMatrix4(f),m}),r=(0,Lr.mergeGeometries)(n,!0);n.forEach(a=>a.dispose());let i=t.map(a=>{let l=new Q.MeshBasicMaterial({map:a,alphaTest:1,side:Q.DoubleSide});return a.needsUpdate=!0,l}),o=new Q.Mesh(r,i);this.mesh=o,this.position.z+=.004,this.add(o)}dispose(){this.mesh?.geometry.dispose(),(this.mesh?.material).forEach(t=>t.dispose()),this.clear()}};var Dr=require("three"),Le=class extends J{startPoint;endPoint;rect;frustum=new Dr.Frustum;constructor(e){super(e);let{config:{selectBox:{fill:t,stroke:n}}}=e;this.rect=mt(n,t),this.svg.appendChild(this.rect),this.registryEvent()}setEnable(e){super.setEnable(e),B(this.rect,0,0,0,0),e?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}onPointerDown=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.startPoint=t),this.endPoint=void 0};onPointerMove=e=>{if(!this.enable||!this.startPoint)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t)};onPointerUp=e=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(e);t&&(this.endPoint=t),this.doSelect(),this.startPoint=void 0};onUpdate=()=>{if(this.startPoint){let e=this.getSvgCoordinate(this.startPoint),t={...e};this.endPoint&&(t=this.getSvgCoordinate(this.endPoint));let n={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y)},r=Math.abs(t.x-e.x),i=Math.abs(t.y-e.y);B(this.rect,n.x,n.y,r,i)}else B(this.rect,0,0,0,0)};registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:t,container:{clientWidth:n,clientHeight:r}}}=this,i=y(this.startPoint,t,n,r),o=y(this.endPoint,t,n,r),a={x:Math.min(i.x,o.x),y:Math.min(i.y,o.y)},l={x:Math.max(i.x,o.x),y:Math.max(i.y,o.y)},u=this.searchMapInFrustum(a,l);this.dispatchEvent({type:"selected",list:u})}}searchMapInFrustum(e,t){let{context:n}=this;return n.currentFloor?.graphicLayer.children.filter(r=>r instanceof R&&this.searchChildInFrustum(r,e,t))||[]}searchChildInFrustum(e,t,n){let{context:{camera:r,container:{clientWidth:i,clientHeight:o}}}=this;if(!e)return!1;if(!e.mesh){let p=e.getPosition();if(p){let d=y(p,r,i,o);return gt(d,t,n)}return!1}e.mesh.geometry.boundingBox||e.mesh.geometry.computeBoundingBox();let a=e.mesh.geometry.boundingBox;if(!a)return!1;let{min:l,max:u}=a,c=y(l,r,i,o),h=y(u,r,i,o);return!(!gt(c,t,n)||!gt(h,t,n))}dispose(){this.unRegistryEvent()}};var ge=class extends Or.EventDispatcher{constructor(t){super();this.context=t;this.boxSelection=new Le(t),this.boxSelection.setEnable(!1),this.registryEvent()}_list=new Set;boxSelection;prevPanStatus;prevRotateStatus;downPoint=null;isMultipleSelect=!1;get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.context.config.enableBoxSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}onPointerDown=t=>{this.downPoint={x:t.offsetX,y:t.offsetY}};onPointerUp=t=>{if(!this.downPoint)return;let{offsetX:n,offsetY:r}=t,{x:i,y:o}=this.downPoint;if(Math.sqrt((i-n)**2+(o-r)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,r),l=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(n,r).forEach(c=>{if(!l.has(c.options.id)){let h=this.context.currentFloor?.graphicLayer.graphicMap.get(c.options.id)||null;h&&h.options.geometry.type==="point"&&(a.push(h),l.add(c.options.id))}}),(It?t.metaKey:t.ctrlKey)||this._list.clear(),a.forEach(c=>this._list.add(c)),this.selectEnd(),this.downPoint=null};onPointerOut=t=>{this.disableBoxSelection()};onKeyDown=t=>{Rt(t.key)&&this.enableBoxSelection()};onKeyUp=t=>{Rt(t.key)&&this.disableBoxSelection()};onBoxSelected=({list:t})=>{this._list.clear(),t.forEach(n=>{this._list.add(n)}),this.selectEnd()};selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}};var Ne=require("three");var me=class extends Ne.EventDispatcher{constructor(t){super();this.context=t;this.registryEvent()}curGraphics=new Set;timer=new D;graphicTimerMap=new Map;onPointerMove=({graphics:t,pois:n,e:r})=>{let i=n.map(u=>this.context.currentFloor?.graphicLayer.graphicMap.get(u.options.id)).filter(u=>u&&u.options.geometry.type==="point");if(!t.length&&!i.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:o}=this.context.config.hover,a=new Set;if(i.length){let u,c=1e4;i.forEach(h=>{let p=n.find(d=>d.options.id===h.options.id);if(p instanceof bt){let{x:d,y:m}=p.clientPos,f=Math.sqrt((d-r.offsetX)**2+(m-r.offsetY)**2);f<c&&(c=f,u=h)}else if(p instanceof q){let{x:d,y:m}=p.box.getCenter(new Ne.Vector2),f=Math.sqrt((d-r.offsetX)**2+(m-r.offsetY)**2);f<c&&(c=f,u=h)}}),a.add(u)}a.size||t.forEach(u=>a.add(u)),a.forEach(u=>{if(this.graphicTimerMap.get(u)||this.curGraphics.has(u))return;let c=this.timer.setTimeout(()=>{this.curGraphics.add(u),this.graphicTimerMap.delete(u),this.timer.clearTimeout(c),this.handleHoverGraphicsChange()},o);this.graphicTimerMap.set(u,c)}),this.graphicTimerMap.forEach((u,c)=>{a.has(c)||(this.timer.clearTimeout(u),this.graphicTimerMap.delete(c))});let l=this.curGraphics.size;this.curGraphics.forEach(u=>{a.has(u)||this.curGraphics.delete(u)}),l!==this.curGraphics.size&&this.handleHoverGraphicsChange()};onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()};onBodyPointerMove=t=>{if(this.curGraphics.size){let n=this.context.container.getBoundingClientRect();(t.clientX<n.left||t.clientX>n.right||t.clientY<n.top||t.clientY>n.bottom)&&this.onPointerLevel()}};handleHoverGraphicsChange(t=this.curGraphics){this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}};var Bt=require("three");var De=class{constructor(e){this.context=e;this.registryEvent(),this.changePrevCamera()}prevCamera={position:new Bt.Vector3,zoom:1,target:new Bt.Vector3};enable=!0;box=new Bt.Box3;updateBox(){this.box.setFromObject(this.context.scene)}setEnable(e){this.enable=e,e?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.scene.children.filter(g=>g instanceof ct).length)return null;let t=this.box,{camera:n,clientSize:{width:r,height:i}}=this.context,{min:o,max:a}=t,l=y(o,n,r,i),u=y(a,n,r,i),c=y(new Bt.Vector3(o.x,a.y,a.z),n,r,i),h=y(new Bt.Vector3(a.x,o.y,o.z),n,r,i),p=Math.min(l.x,u.x,c.x,h.x),d=Math.max(l.x,u.x,c.x,h.x),m=Math.min(l.y,u.y,c.y,h.y),f=Math.max(l.y,u.y,c.y,h.y);return{left:p,right:d,top:m,bottom:f}}checkDistanceToScreenEdge({left:e,right:t,top:n,bottom:r}){let{width:i,height:o}=this.context.clientSize,[a,l,u,c]=this.context.config.cameraBound.padding,h=t>=c,p=i-e>=l,d=o-n>=u,m=r>=a;return h&&p&&d&&m}onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:t,right:n,top:r,bottom:i}=e;this.checkDistanceToScreenEdge({left:t,right:n,top:r,bottom:i})?this.changePrevCamera():this.backToPrevCamera()}};dispose(){this.unRegistryEvent()}};var Sn=require("three"),Fr=require("three/examples/jsm/controls/MapControls"),Gt=require("@tweenjs/tween.js");var Oe=class extends Fr.MapControls{constructor(t,n,r){super(n,r);this.context=t;this.camera=n;this.domElement=r;this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=n.zoom,this.registryEvent()}prevCameraZoom=1;tweenGroup=new Gt.Group;offsetY=0;registryEvent(){this.addEventListener("change",()=>{let t=this.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.dispatchEvent({type:"change-zoom",zoom:t}))}),this.context.addEventListener("update",this.tweenUpdate)}tweenUpdate=()=>{this.tweenGroup.update()};setPolarAngle(t,n=!1){let{maxPolarAngle:r,minPolarAngle:i}=this,o=r===i;(n||t<=r&&t>=i)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=r,this.minPolarAngle=i)}async setPolarAngleByDuration(t,n=!1,r=500){return r<=0?this.setPolarAngle(t,n):Z(new Promise(i=>{let o={polar:this.getPolarAngle()},a={polar:t},l=new Gt.Tween(o,this.tweenGroup).to(a,r).onUpdate(()=>{this.setPolarAngle(o.polar,n)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(l),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),r+500)}setAzimuthalAngle(t,n){let{maxAzimuthAngle:r,minAzimuthAngle:i,maxPolarAngle:o,minPolarAngle:a}=this,l=r===i;if(n||t<=r&&t>=i){this.maxAzimuthAngle=t,this.minAzimuthAngle=t;let u=this.getPolarAngle();this.maxPolarAngle=u,this.minPolarAngle=u,this.update(),this.maxPolarAngle=o,this.minPolarAngle=a}l||(this.maxAzimuthAngle=r,this.minAzimuthAngle=i)}setAzimuthalAngleDuration(t,n=!1,r=500){return r<=0?this.setAzimuthalAngle(t,n):Z(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},a={azimuthal:t},l=new Gt.Tween(o,this.tweenGroup).to(a,r).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,n)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(l),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),r+500)}getCameraLookAt(){return new Sn.Vector3().subVectors(this.target,this.camera.position)}async setCameraPositionByTarget(t,n){let r=this.target.clone(),i=this.getCameraLookAt();if(!n){this.camera.position.copy(t.clone().sub(i)),this.target.copy(t.clone()),this.update();return}return Z(new Promise(o=>{let a=new Gt.Tween(r,this.tweenGroup).to(t,n).onUpdate(()=>{this.camera.position.copy(r.clone().sub(i)),this.target.copy(r.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(a),this.camera.position.copy(t.clone().sub(i)),this.target.copy(t.clone()),this.update(),this.enabled=!0,o(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}setZoom(t,n,r=!1){let{minZoom:i,maxZoom:o}=this;(r||t>=i&&t<=o)&&(this.camera.position.copy(n.clone().sub(this.getCameraLookAt())),this.target.copy(n),this.camera.zoom=t,this.update())}async setZoomByDuration(t,n,r=!1,i=500){let o=this.getCameraLookAt(),a={zoom:this.camera.zoom,target:this.target.clone()};return i?Z(new Promise(l=>{let u=new Gt.Tween(a,this.tweenGroup).to({zoom:t,target:n},i).onUpdate(()=>{this.setZoom(a.zoom,a.target,r)}).onComplete(()=>{this.tweenGroup.remove(u),this.enabled=!0,l(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+500):this.setZoom(t,n,r)}setTargetByOffset(t,n=this.target.clone()){if(!t)return;this.camera.updateMatrix();let r=new Sn.Vector3;r.setFromMatrixColumn(this.camera.matrix,1),r.normalize(),r.multiplyScalar(t/this.camera.zoom),n.add(r),this.setCameraPositionByTarget(n,0)}clearTween(){this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll()}dispose(){this.clearTween()}};var jt=require("three");var Fe=class extends jt.WebGLRenderer{event=new jt.EventDispatcher;scene;camera;enable=!0;timer=new D;constructor(e){super({antialias:!0,alpha:!0,...e}),this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=jt.PCFSoftShadowMap}setCameraAndScene(e,t){this.scene=e,this.camera=t}autoRender(){this.scene&&this.camera&&this.enable&&(this.event.dispatchEvent({type:"update"}),this.render(this.scene,this.camera)),this.timer.requestAnimationFrame(()=>{this.autoRender()})}pauseRender(){this.enable=!1}continueRender(){this.enable=!0}addEventListener(e,t){this.event.addEventListener(e,t)}removeEventListener(e,t){this.event.removeEventListener(e,t)}dispose(){this.timer.dispose(),this.enable=!1,super.dispose()}};var Ur=require("three"),Ue=class extends Ur.Scene{constructor(){super()}};var Br=require("three"),Be=class extends Br.OrthographicCamera{constructor(e,t){super(-e/2,e/2,t/2,-t/2,-1e3,5e3),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var _e=class extends M.EventDispatcher{constructor(t,n){super();this.container=t;this.config=n;this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new ge(this),this.hoverHelper=new me(this),this.resizeClientSize(),this.registryEvent()}scene=new Ue;renderer=new Fe;camera;control;lights=Ze();currentFloor;selection;hoverHelper;basicRatio;cameraBound;clientSize={width:0,height:0,x:0,y:0};renderRf=0;resizeClientSize(){let{x:t,y:n,width:r,height:i}=this.container.getBoundingClientRect();this.clientSize={width:r||this.container.clientWidth,height:i||this.container.clientHeight,x:t,y:n}}init(){let{clientWidth:t,clientHeight:n}=this.container;this.camera=new Be(t,n),this.renderer.setSize(t,n),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new Oe(this,this.camera,this.renderer.domElement),this.control.maxPolarAngle=this.config.control.maxPolar,this.container.appendChild(this.renderer.domElement),this.scene.add(this.lights),this.basicRatio=this.getRatio(),this.control.addEventListener("change",()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})}),this.control.addEventListener("change-zoom",({zoom:r})=>{this.dispatchEvent({type:"control-zoom-change",zoom:r})}),this.renderer.addEventListener("update",()=>{this.dispatchEvent({type:"update"})}),this.cameraBound=new De(this)}getRatio(t=new M.Vector3(0,0,0),n=new M.Vector3(100,0,0)){let{clientWidth:r,clientHeight:i}=this.container,o=y(t,this.camera,r,i),a=y(n,this.camera,r,i);return Math.ceil(Math.sqrt((a.x-o.x)**2+(a.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(n=>{n instanceof M.AmbientLight&&(n.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 n=t.getCenter();n&&(this.lights.position.x=n.x,this.lights.position.y=n.y),this.cameraBound.updateBox()}onWindowResize=()=>{let{container:t,camera:n,renderer:r}=this,{clientWidth:i,clientHeight:o}=t;i=Math.max(1,i),o=Math.max(1,o),n.left=-i/2,n.right=i/2,n.top=o/2,n.bottom=-o/2,n.updateProjectionMatrix(),r.setSize(i,o),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:i,height:o})};onClick=t=>{let{graphics:n,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY);n.length&&this.dispatchEvent({type:"graphic-click",graphics:n,position:r});let i=this.getPoisByDeviceXy(t.offsetX,t.offsetY);i.length&&this.dispatchEvent({type:"poi-click",pois:i})};getGraphicsByDeviceXy(t,n){let r=new M.Vector2;r.x=t/this.clientSize.width*2-1,r.y=n/this.clientSize.height*-2+1;let i=new M.Raycaster;return i.setFromCamera(r,this.camera),i.ray.origin.sub(i.ray.direction.clone().multiplyScalar(100)),this.currentFloor?.graphicLayer.getGraphicByRaycaster(i)||{graphics:[],position:null}}getPoisByDeviceXy(t,n){let r=this.currentFloor?.poiLayer.getPoiByDeviceXy(t,n),i=this.currentFloor?.poiLayer2.getPoiByDeviceXy(t,n);return(r||[]).concat(i||[])}onPointerover=t=>{let{graphics:n,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),i=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-over",e:t,graphics:n,pois:i,position:r})};onPointermove=t=>{let{graphics:n,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),i=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-move",e:t,graphics:n,pois:i,position:r})};onPointerleave=t=>{this.dispatchEvent({type:"pointer-level"})};onSelectionSelect=({graphics:t,isMultipleSelect:n})=>{this.dispatchEvent({type:"select-graphic",graphics:t,isMultipleSelect:n})};onHoverChange=({graphics:t})=>{this.dispatchEvent({type:"hover",graphics:t})};registryEvent(){window.addEventListener("resize",this.onWindowResize),this.container.addEventListener("click",this.onClick),this.container.addEventListener("pointerover",this.onPointerover),this.container.addEventListener("pointermove",this.onPointermove),this.container.addEventListener("pointerleave",this.onPointerleave),this.container.addEventListener("pointercancel",this.onPointerleave),this.container.addEventListener("pointerout",this.onPointerleave),this.selection.addEventListener("select",this.onSelectionSelect),this.hoverHelper.addEventListener("hover-change",this.onHoverChange)}unRegistryEvent(){window.removeEventListener("resize",this.onWindowResize),this.container.removeEventListener("click",this.onClick),this.container.removeEventListener("pointerover",this.onPointerover),this.container.removeEventListener("pointermove",this.onPointermove),this.container.removeEventListener("pointerleave",this.onPointerleave),this.container.removeEventListener("pointercancel",this.onPointerleave),this.container.removeEventListener("pointerout",this.onPointerleave),this.selection.removeEventListener("select",this.onSelectionSelect),this.hoverHelper.removeEventListener("hover-change",this.onHoverChange)}setPolarAngle(t,n=500){return this.control.setPolarAngleByDuration(t,!0,n)}setAzimuthalAngle(t,n=500){return this.control.setAzimuthalAngleDuration(t,!0,n)}getCameraLookAt(){return this.control.getCameraLookAt()}setZoom(t,n,r=500){return this.control.setZoomByDuration(t,n,!0,r)}getFitCameraToObjectZoom(t,n=[20,20,20,20],r=500,i=!0){let[o,a,l,u]=n,{clientSize:{width:c,height:h}}=this,p=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let d=new M.Box3().setFromObject(t);this.setPolarAngle(p,0);let{max:m,min:f}=d,g=new M.Vector3(f.x,m.y,m.z),E=new M.Vector3(m.x,m.y,m.z),x=new M.Vector3(m.x,f.y,f.z),z=new M.Vector3(f.x,f.y,f.z),b=y(g,this.camera,c,h),T=y(E,this.camera,c,h),k=y(z,this.camera,c,h),$=y(x,this.camera,c,h),Kt=new M.Box2().setFromPoints([new M.Vector2(b.x,b.y),new M.Vector2(T.x,T.y),new M.Vector2(k.x,k.y),new M.Vector2($.x,$.y)]).getSize(new M.Vector2),Ke=(c-a-u)/Kt.x,fi=(h-o-l)/Kt.y,di=Math.min(Ke,fi),gi=new M.Vector3((m.x+f.x)/2,(m.y+f.y)/2,(m.z+f.z)/2);return{zoom:di*this.camera.zoom,center:gi}}fitCameraToObject(t,n=[20,20,20,20],r=500,i=!0){let{zoom:o,center:a}=this.getFitCameraToObjectZoom(t,n,r,i);return this.setZoom(o,a,r)}getFitCameraToGroundZoom(t=[20,20,20,20],n=500,r=!0){if(this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,n,r).zoom}fitCameraToGround(t=[20,20,20,20],n=500,r=!0){return this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundUpper,t,n,r):Promise.resolve(!1)}async setCameraPosition(t,n){return this.control.setCameraPositionByTarget(t,n)}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.renderer.dispose(),this.lights.children.forEach(t=>t.dispose()),V(this.scene)}};var Gr=require("lodash"),zr={apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get"},enableBoxSelect:!0,resizeObserver:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1}};function wn(s){return(0,Gr.merge)({},zr,s)}var kr=require("lodash");var Vr=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(Vr||{}),Tn=class extends Ge.EventDispatcher{constructor(t,n={}){super();this.container=t;this.config=wn(n),this.context=new _e(t,this.config),this.registryEvent()}config;context;polarKeys=[];azimuthalKeys=[];svgLine;svgPolygon;basicZoom=1;prevCameraZoom=1;type="2d";currentBuildGround=null;observe=null;buildingCenter=[0,0];timer=new D;plugins=[];changeBuildingCenter(t,{brand:n,project:r}){let i=t?Jt(t.info.geometry.cds[0]):[0,0];this.buildingCenter=i,this.dispatchEvent({type:"center-change",center:i,project:r,brand:n})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(n=>n!==t)}triggerHooks(t,n){this.dispatchEvent({type:t,data:n})}switchFloorByFloor(t,n=t.graphicLayer.children){this.triggerHooks("switch_floor_before",{curFloor:t,graphics:n}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",{curFloor:t,graphics:n})}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(void 0,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*30,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}onControlChange=()=>{let{camera:{zoom:t}}=this.context;t!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=t)};addModel(t,n){if(t.options.geometry.type==="polygon"){let r=this.context.currentFloor?.addModel({...n,position:t.getPosition().setZ(.1),id:t.options.id});if(r){let{facilityAngle:i=0,facilityXScale:o=1,facilityYScale:a=1}=t.options.userData;r.rotateZ((180-i)/180*Math.PI),r.scale.set(o,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 R)||[]}createGraphicPoi(t,n){if(this.context.currentFloor){n.id===void 0&&(n.id=t.options.id);let r=t.options.center,i=t.getCenter(),o=r?.[0]||i.x,a=r?.[1]||i.y;return console.log(o,a,r,i),this.context.currentFloor.addPoi({...n,position:{x:o,y:a,z:i.z+t.options.height/2}})}return null}removeHeatMap(){this.context.currentFloor?.removeHeatMap()}translateElementToCenter(t,n=500){let r=t.getPosition();return this.context.setCameraPosition(r,n)}async translateElementToCenterX(t,n=500){return Z(new Promise(r=>{let i=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:a,height:l},camera:u}=this.context,h=y(o,u,a,l).x-a/2,p=new Ge.Vector3;p.setFromMatrixColumn(this.context.camera.matrix,0),p.normalize(),p.multiplyScalar(h/this.context.camera.zoom),i.add(p),this.context.setCameraPosition(i,n).then(r)})}),n+500)}getElementDeviceCoordinate(t){let n=t.position.clone(),{clientWidth:r,clientHeight:i}=this.container;return y(n,this.context.camera,r,i)}changeMapType(t,n=500){return this.type=t,t==="2d"?this.context.setPolarAngle(0,n):this.context.setPolarAngle(1.1,n)}async resetView(t=300){let n=t/3;await this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,n),await this.context.setPolarAngle(this.config.control.defaultPolar,n),await this.context.fitCameraToGround(this.config.defaultPadding,n,!1)}reduceMap(t=.5,n=500){let r=this.context.camera.zoom;return this.context.setZoom(r-t,this.context.control.target,n)}enlargeMap(t=.5,n=500){let r=this.context.camera.zoom;return this.context.setZoom(r+t,this.context.control.target,n)}onKeydown=t=>{this.polarKeys.includes(t.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(t.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)};onKeyUp=t=>{if(this.polarKeys.includes(t.code)){let n=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=n,this.context.control.minPolarAngle=n}if(this.azimuthalKeys.includes(t.code)){let n=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=n,this.context.control.minAzimuthAngle=n}};registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver((0,kr.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 n=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(n+t,500)}async measureDistance(){return this.cancelDistance(),new Promise((t,n)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new le(this.context);let r=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){r(),n("cancel")},this.svgLine.addEventListener("distance",({distance:i})=>{t(i)})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,n)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new ue(this.context);let r=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){r(),n("cancel")},this.svgPolygon.addEventListener("area",({area:i})=>{t(i)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){return this.context.currentFloor?.graphicLayer.getGraphicByNodeId(t)||null}deleteGraphic(t){this.context.currentFloor?.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){if(!t.transformToBuildingGround&&this.currentBuildGround){let n=Jt(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(r=>{Array.isArray(r)&&r.forEach(i=>{i[0]-=n[0],i[1]-=n[1]})});else{let[r,i]=t.geometry.cds;t.geometry.coords=[r-n[0],i-n[1]]}}return this.context.currentFloor?.graphicLayer.createGraphic(t)}removePoiById(t){this.context.currentFloor?.poiLayer.removePoiById(t),this.context.currentFloor?.poiLayer2.removePoiById(t)}getPoiById(t){return this.context.currentFloor?.poiLayer.getPoiById(t)||this.context.currentFloor?.poiLayer2.getPoiById(t)}getPois(){return[...(this.context.currentFloor?.poiLayer.pois||[]).filter(t=>!t.options.built_in),...this.context.currentFloor?.poiLayer2.pois||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let t=this.context.control.getAzimuthalAngle(),n=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let r=this.context.getFitCameraToGroundZoom(void 0,0)||1;this.context.camera.zoom=n,this.context.control.minZoom=r,this.context.control.maxZoom=r*25,this.basicZoom=n,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(t,0),this.context.cameraBound.setEnable(!0)};dispose(){this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.context.dispose(),this.unRegistryEvent(),vt.dispose(),xt.dispose(),Nt.dispose(),Et.dispose(),I.dispose()}};var Hr=require("three"),dt=class extends Hr.EventDispatcher{bmap;constructor(e){super(),this.bmap=e,this.bmap.use(this)}dispose(){}};var Cn=class extends dt{equipmentList=[];equipmentMap=new Map;constructor(e){super(e),this.fetchEquipment(),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}async fetchEquipment(){let{apiDomain:e,apiPath:{equipmentList:t},apiInfo:n}=this.bmap.config,r=`${e}${t}`;await fetch(r,n).then(i=>i.json()).then(i=>i.data).then(i=>{this.equipmentList=i,this.equipmentMap=new Map(i.map(o=>[o.equipment_id,o]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)}onSwitchFloor=({data:{graphics:e}})=>{this.equipmentList.length&&this.changeGraphicToEquipment(e)};getGraphicEquipment(e){return e.userData.data.info.userData.equipment}changeGraphicToEquipment(e){e.filter(t=>{let n=this.getGraphicEquipment(t);return n&&this.equipmentMap.has(n)}).forEach(t=>{let n=this.equipmentMap.get(this.getGraphicEquipment(t)),r=this.bmap.createGraphicPoi(t,{icon:n?.equipment_icon,built_in:!0,icon_size:[14,14]});r&&(r.userData.data=n,r.userData.type="equipment")})}dispose(){this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),Array.from(this.bmap.context.currentFloor?.poiLayer.pois||[]).forEach(e=>{e.userData.type==="equipment"&&this.bmap.context.currentFloor?.poiLayer.removePoi(e)})}};var N=require("three");var _=require("three"),tt=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(e){this.setGeometry(e,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(e){this.setPoints(e,this.widthCallback)}}})}};tt.prototype.setMatrixWorld=function(s){this.matrixWorld=s};tt.prototype.setGeometry=function(s,e){this._geometry=s,this.setPoints(s.getAttribute("position").array,e)};tt.prototype.setPoints=function(s,e){if(!(s instanceof Float32Array)&&!(s instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=s,this.widthCallback=e,this.positions=[],this.counters=[],s.length&&s[0]instanceof _.Vector3)for(var t=0;t<s.length;t++){var n=s[t],r=t/s.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(r),this.counters.push(r)}else for(var t=0;t<s.length;t+=3){var r=t/s.length;this.positions.push(s[t],s[t+1],s[t+2]),this.positions.push(s[t],s[t+1],s[t+2]),this.counters.push(r),this.counters.push(r)}this.process()};function Hi(s,e){var t=new _.Matrix4,n=new _.Ray,r=new _.Sphere,i=new _.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),r.copy(o.boundingSphere),r.applyMatrix4(this.matrixWorld),s.ray.intersectSphere(r,i)!==!1){t.copy(this.matrixWorld).invert(),n.copy(s.ray).applyMatrix4(t);var a=new _.Vector3,l=new _.Vector3,u=new _.Vector3,c=this instanceof _.LineSegments?2:1,h=o.index,p=o.attributes;if(h!==null)for(var d=h.array,m=p.position.array,f=p.width.array,g=0,E=d.length-1;g<E;g+=c){var x=d[g],z=d[g+1];a.fromArray(m,x*3),l.fromArray(m,z*3);var b=f[Math.floor(g/3)]!==void 0?f[Math.floor(g/3)]:1,T=s.params.Line.threshold+this.material.lineWidth*b/2,k=T*T,$=n.distanceSqToSegment(a,l,i,u);if(!($>k)){i.applyMatrix4(this.matrixWorld);var Tt=s.ray.origin.distanceTo(i);Tt<s.near||Tt>s.far||(e.push({distance:Tt,point:u.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}),g=E)}}}}tt.prototype.raycast=Hi;tt.prototype.compareV3=function(s,e){var t=s*6,n=e*6;return this.positions[t]===this.positions[n]&&this.positions[t+1]===this.positions[n+1]&&this.positions[t+2]===this.positions[n+2]};tt.prototype.copyV3=function(s){var e=s*6;return[this.positions[e],this.positions[e+1],this.positions[e+2]]};tt.prototype.getDistance=function(s){let e=0;for(let t=0;t<s;t++){let n=6*t,r=new _.Vector3(this.positions[n],this.positions[n+1],this.positions[n+2]),i=new _.Vector3(this.positions[n+6],this.positions[n+7],this.positions[n+8]),o=r.distanceTo(i);e+=o}return e};tt.prototype.process=function(){var s=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var e;let t=this.getDistance(s-1);var n;this.compareV3(0,s-1)?n=this.copyV3(s-2):n=this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var r=0;r<s;r++){if(this.side.push(1),this.side.push(-1),this.widthCallback?e=this.widthCallback(r/(s-1)):e=1,this.width.push(e),this.width.push(e),r===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(r===s-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let o=this.getDistance(r)/t;this.uvs.push(o,0),this.uvs.push(o,1)}if(r<s-1){n=this.copyV3(r),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var i=r*2;this.indices_array.push(i,i+1,i+2),this.indices_array.push(i+2,i+1,i+3)}r>0&&(n=this.copyV3(r),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(s-1,0)?n=this.copyV3(1):n=this.copyV3(s-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new _.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 Pn(s,e,t,n,r){var i;if(s=s.subarray||s.slice?s:s.buffer,t=t.subarray||t.slice?t:t.buffer,s=e?s.subarray?s.subarray(e,r&&e+r):s.slice(e,r&&e+r):s,t.set)t.set(s,n);else for(i=0;i<s.length;i++)t[i+n]=s[i];return t}tt.prototype.advance=function(s){var e=this._attributes.position.array,t=this._attributes.previous.array,n=this._attributes.next.array,r=e.length;Pn(e,0,t,0,r),Pn(e,6,e,0,r-6),e[r-6]=s.x,e[r-5]=s.y,e[r-4]=s.z,e[r-3]=s.x,e[r-2]=s.y,e[r-1]=s.z,Pn(e,6,n,0,r-6),n[r-6]=s.x,n[r-5]=s.y,n[r-4]=s.z,n[r-3]=s.x,n[r-2]=s.y,n[r-1]=s.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(`
|
|
104
104
|
`);_.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(`
|
|
105
105
|
`);var ye=class extends _.ShaderMaterial{constructor(e){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(e)}};ye.prototype.copy=function(s){return _.ShaderMaterial.prototype.copy.call(this,s),this.lineWidth=s.lineWidth,this.map=s.map,this.useMap=s.useMap,this.alphaMap=s.alphaMap,this.useAlphaMap=s.useAlphaMap,this.color.copy(s.color),this.opacity=s.opacity,this.resolution.copy(s.resolution),this.sizeAttenuation=s.sizeAttenuation,this.dashArray.copy(s.dashArray),this.dashOffset.copy(s.dashOffset),this.dashRatio.copy(s.dashRatio),this.useDash=s.useDash,this.visibility=s.visibility,this.alphaTest=s.alphaTest,this.repeat.copy(s.repeat),this};var Wr="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 Xr={texture_url:Wr,lineWidth:8,color:16777215},ze=class extends N.Object3D{constructor(t,n){super();this.navigation=t;this.config=Object.assign({},Xr,n),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom,this.setDepthTest(this.getDepthTestByControl())}mesh=null;geometry=null;material=null;texture=null;config=Xr;points=[];basicRepeat=1;prevCameraZoom=0;depthTest=!0;registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}onControlChange=()=>{let t=this.navigation.bmap.context.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.changeRepeat()),this.setDepthTest(this.getDepthTestByControl())};getDepthTestByControl(){let t=this.navigation.bmap.context.control.getPolarAngle();return!(t>=0&&t<=.15)}setDepthTest(t){this.depthTest=t,this.material&&(this.material.depthTest=t)}onUpdate=()=>{this.texture};onResize=()=>{if(this.material){let{width:t,height:n}=this.navigation.bmap.context.clientSize;this.material.resolution.set(t,n)}};getRepeat(){let{points:t,navigation:{bmap:{context:{camera:n,clientSize:{width:r,height:i}}}}}=this,o=t.map(([l,u])=>y(new N.Vector3(l,u,0),n,r,i)).map(({x:l,y:u})=>[l,u]);return at(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new N.Vector2(t,1)}loadTexture(t){return new Promise((n,r)=>{new N.TextureLoader().load(t,n,void 0,r)})}transformPoints(t){let n=[];for(let r=0;r<t.length;r++)n.push(...t[r],0);return n}updatePoints(t){this.points=t,this.changeRepeat();let n=this.transformPoints(t);this.geometry&&this.geometry.setPoints(n)}movePath(t){this.material&&(this.material.thresholdRatio=t)}async create(t){let n=this.geometry=new tt;if(this.updatePoints(t),!this.texture){let o=this.texture=await this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=N.RepeatWrapping}let r=this.material=new ye({useMap:!0,color:new N.Color(this.config.color),transparent:!0,resolution:new N.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:N.NormalBlending,repeat:new N.Vector2(this.getRepeat(),1)}),i=this.mesh=new N.Mesh(n,r);return i.renderOrder=9,this.add(i),i}dispose(){this.unRegistryEvent(),this.clear(),this.geometry?.dispose(),this.material?.dispose(),this.texture?.dispose()}};var Yt=require("@tweenjs/tween.js"),wt=require("three");var qr=require("three");var jr=require("@tweenjs/tween.js"),Yr=require("lodash"),Xi={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},ke=class extends qr.EventDispatcher{constructor(t,n){super();this.navigation=t;this.options=Object.assign({},Xi,n),this.registryEvent()}offset=!1;reset=!1;position=[0,0];routeIndex=0;pointIndex=0;paths=[];options;timer=new D;resetTimer=null;tweenUtil=new Dt;simulationTween;get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){return this.curRoutePath?.points||[]}registryEvent(){this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.addEventListener("add-path",this.onAddPaths)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.removeEventListener("add-path",this.onAddPaths)}onAddPaths=({paths:t})=>{this.paths=t,this.resetStatus(t)};onUpdate=()=>{this.tweenUtil.update()};resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,n){let{curRoutePathPoints:r,position:i,curRoutePath:o,paths:a,routeIndex:l}=this;if(!r.length)return null;let u=r;if(i){let f=Pt(r,i);u=u.slice(f+1),u.unshift(i)}let c=[{floor:o?.floor,points:u},...a.slice(l+1)],{distance:h,closestPoint:p,index:d,i:m}=c.reduce((f,g,E)=>{if(g.floor!==t)return f;let{distance:x,closestPoint:z,index:b}=g.points.reduce((T,k,$,Tt)=>{if(!Tt[$+1])return{...T,distance:T.distance===1/0?A(k,n):T.distance};let{distance:Kt,closestPoint:Ke}=hn(n,k,Tt[$+1]);return Kt<T.distance?{distance:Kt,closestPoint:Ke,index:$}:T},{distance:1/0,closestPoint:g.points[0],index:0});return x<f.distance?{distance:x,closestPoint:z,index:E,i:b}:f},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:h,closestPoint:p,routeIndex:d+l,pointIndex:d===0?m+this.pointIndex:m}}toPosition(t,n){let r=this.adsorb(t,n);if(console.log("adsorbData",r),!r)return;let{distance:i,closestPoint:o,routeIndex:a,pointIndex:l}=r;i>this.options.offsetDistance?(this.offset=!0,this.resetTimer||(this.resetTimer=this.timer.setTimeout(()=>{this.reset=!0,this.resetTimer=null},this.options.offsetToResetTime))):(this.offset=!1,this.reset=!1,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null)),this.routeIndex=a,this.pointIndex=l,this.position=o,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}async startCurRouteSimulation(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let n=[];return new Promise(r=>{let i=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),a=o/this.options.simulationSpeed,l=(0,Yr.throttle)(c=>{let h=ee(i,c.distance);h&&(n.push({floor:t.floor,pos:h}),this.toPosition(t.floor,h))},200),u=this.simulationTween=new jr.Tween({distance:0},this.tweenUtil.group).to({distance:o},a*1e3).onUpdate(l).onComplete(()=>{this.tweenUtil.remove(u),l.flush(),l.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,r(this.startCurRouteSimulation())):(r(!0),console.log(n,this.routeIndex,this.paths))}).start()})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:n,position:r}=this;if(!t.length)return 0;let i=[r,...t.slice(n+1)];return at(i)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((i,o)=>i+o.distance,0)+t,curRoute:t}}getNextDirDistance(){if(!this.position)return null;let{pointIndex:t,curRoutePathPoints:n,position:r}=this,i=n[t],o=n[t+1],a=n[t+2];if(!i||!o)return{dir:"end",distance:0};let l=A(r,o);return t===0&&A(i,r)<5?{dir:"start",distance:l}:a?{dir:we(i,o,a),distance:l}:{dir:"end",distance:l}}getNavigationInfo(){let{total:t,curRoute:n}=this.getRemainDistance();console.log(t,n,this.paths);let r=this.getNextDirDistance();if(!r)return null;let{dir:i,distance:o}=r;return i==="end"&&o>15&&(i="front"),i!=="start"&&o>=this.options.directionEmitThreshold&&(i="front"),n<=10&&(i="end"),{distance:t,curRouteDistance:n,nextDirDistance:o,dir:i,pos:this.position,routeIndex:this.routeIndex,offset:this.offset,reset:this.reset}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear()}};var $r=require("three"),ve=class extends $r.EventDispatcher{_task=[];started=!1;activeTask=null;_id=0;constructor(e=!0){super(),e&&this.start()}_isEffectiveTask(e){return e&&typeof e.run=="function"}_getIndexByTid(e){return this._task.findIndex(t=>t.tid===e)}_createTask(e){return this._isEffectiveTask(e)?{...e,tid:++this._id,meta:e.meta||{}}:!1}get task(){return[...this._task]}getTasks(){return[...this._task]}add(e){if(this._isEffectiveTask(e)){let t=this._createTask(e);return this._task.push(t),this.started&&!this.activeTask&&this.start(),t.tid}return!1}replace(e,t){if(!this._isEffectiveTask(t))return console.warn("[TaskQueue] replace\u65B9\u6CD5\u4F20\u5165\u7684task\u53C2\u6570\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;let n=this._getIndexByTid(e);if(n===-1)return console.warn(`[TaskQueue] \u6CA1\u6709\u627E\u5230id=${e}\u7684\u4EFB\u52A1`),!1;let r=this._createTask(t);return this._task.splice(n,1,r),r.tid}remove(e){let t=this._getIndexByTid(e);return t===-1?(console.warn(`[TaskQueue] remove\u65B9\u6CD5\u4F20\u5165\u7684id\uFF1A${e}\u627E\u4E0D\u5230\u5BF9\u5E94\u7684task`),!1):(this._task.splice(t,1),!0)}clear(){this._task.length=0}start(){this.started=!0,!this.activeTask&&this._task.length&&this.exec()}stop(){this.started=!1}async exec(){if(!this.started||!this._task.length)return!1;let e=this._task.shift();this.activeTask=e,this.dispatchEvent({type:"active-task-start",task:e});try{await e.run()}catch(t){console.warn("[task run err]",t,e)}return this.activeTask=null,this.dispatchEvent({type:"active-task-end",task:e}),this.exec()}};var qi={path:{},cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},positionNavigation:{},offsetY:150,directionEmitThreshold:5,disablePathAnimation:!1,speed:1},An=class extends dt{path=null;fetchRoadStatus=!1;paths=[];curPathIndex=0;curFloorPath=null;translatePath=null;currentPathPosition=null;options;pathTween=null;startPoi=null;movedDistance=0;pathStart=[0,0];tweenUtil=new Dt;taskQueue=new ve;animationPathOptions={cPathIndex:0};cPath=[];positionNavigation;constructor(e,t={},n){super(e),!n&&typeof t=="object"&&(n=t),this.options=Object.assign({},qi,n);let{apiDomain:r,apiPath:{roadNetwork:i},apiInfo:o}=this.bmap.config;this.positionNavigation=new ke(this,{simulationSpeed:this.options.speed,...this.options.positionNavigation}),this.registryEvent()}get curFloorPathLength(){return this.curFloorPath?.distance??0}get curFloorPathPoints(){return this.curFloorPath?.points??[]}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor),this.positionNavigation.addEventListener("navigation-info",this.onNavigationInfo)}onNavigationInfo=({info:e})=>{if(this.dispatchEvent({type:"navigation-info",info:e}),!e.offset){if(e.routeIndex!==this.curPathIndex)return;this.toPositionByTask(e.pos)}};toPositionByTask(e){let n=this.taskQueue.getTasks().find(i=>i.meta.type==="toPosition")?.tid,r={run:()=>this.toPositionBySpeed(e,this.options.speed),meta:{type:"toPosition"}};n?this.taskQueue.replace(n,r):this.taskQueue.add(r)}pauseAnimation(){this.tweenUtil.pause(),this.positionNavigation.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue(),this.positionNavigation.tweenUtil.continue()}clearTween(){this.tweenUtil.clear(),this.taskQueue.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),this.positionNavigation.removeEventListener("navigation-info",this.onNavigationInfo)}onUpdate=()=>{this.tweenUtil.update()};clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.clearTween()),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null),this.translatePath=null}setCurFloorPath(e){e===null?(this.curFloorPath=null,this.currentPathPosition=null):(this.curFloorPath=e,this.currentPathPosition=e.points[0]),this.movedDistance=0,this.clearTween()}setCurPathIndex(e){this.curPathIndex=e,this.paths[e]?.floor===this.bmap.context.currentFloor?.name?(this.setCurFloorPath(this.paths[e]),this.renderPath(this.translatePoints(this.curFloorPathPoints))):this.clearPath()}onSwitchFloor=({data:{curFloor:e}})=>{if(this.clearTween(),this.paths[this.curPathIndex]){let t=this.paths[this.curPathIndex];this.setCurFloorPath(t??null),t?this.renderPath(this.translatePoints(t.points)):this.clearPath()}else this.clearPath()};addPath(e,t=0){this.paths=e,this.curPathIndex=t,this.clearTween();let n=this.bmap.context.currentFloor?.name,r=e[t];if(n&&r?.floor===n)if(this.setCurFloorPath(r),this.bmap.currentBuildGround)this.renderPath(this.translatePoints(r.points));else{let i=()=>{this.bmap.removeEventListener("center-change",i),this.renderPath(this.translatePoints(r.points))};this.bmap.addEventListener("center-change",i)}else this.clearPath();this.dispatchEvent({type:"add-path",paths:e})}translatePoints(e){let[t,n]=this.bmap.buildingCenter;return e.map(r=>[r[0]-t,r[1]-n])}renderPath(e){this.translatePath=e;let t=this.catmullRomCurve3(e);this.cPath=t,this.animationPathOptions={cPathIndex:0},this.pathStart=t[0],this.path?this.path.updatePoints(t):(this.path=new ze(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.path.movePath(0),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null),this.options.needStartPoi&&(this.startPoi=new q(this.bmap.context,{...this.options.startPoi,id:"navigation_start_poi",position:{x:t[0][0],y:t[0][1],z:.51},collision_enable:!1})||null,this.bmap.context.currentFloor?.poiLayer2.pushPoi(this.startPoi)),this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(e){return cn(e,!1,!0,.1,170,2.5)}getPathDirection(){if(!this.curFloorPath||!this.currentPathPosition||this.curFloorPathPoints.length<2)return null;let e=Pt(this.curFloorPathPoints,this.currentPathPosition),t=this.curFloorPathPoints[e],n=this.curFloorPathPoints[e+1],r=new wt.Vector3(n[0]-t[0],n[1]-t[1],0).normalize(),i=new wt.Vector3(0,1,0).normalize(),o=r.angleTo(i),a=new wt.Vector3().crossVectors(i,r);return(Object.is(a.y,0)?-1:1)*o}async changeCameraToPathUp(e=100){let t=this.getPathDirection();if(t===null)return;let n=this.bmap.context.control.getAzimuthalAngle();Math.abs(n-t)>Math.PI&&(n>0?t=Math.PI*2+t:t=t-Math.PI*2);let r=Math.abs(t-this.bmap.context.control.getAzimuthalAngle());if(r<.01)return;let{control:i}=this.bmap.context,o=e/Math.PI*6*r;return Z(new Promise(a=>{let l={azimuthal:i.getAzimuthalAngle()},u={azimuthal:t},c=new Yt.Tween(l,this.tweenUtil.group).to(u,o).easing(Yt.Easing.Quadratic.InOut).onUpdate(async()=>{this.startPoi&&i.target.copy(this.startPoi.position),i.setAzimuthalAngle(l.azimuthal,!0),i.setTargetByOffset(this.options.offsetY)}).onComplete(()=>{i.enabled=!0,this.tweenUtil.remove(c),a(!0)}).onStart(()=>{i.enabled=!1}).start()}),o+500).finally(()=>{this.bmap.context.control.enabled=!0})}async initNavigationCamera(e=1e3){let n=this.taskQueue.getTasks().find(i=>i.meta.type==="initNavigationCamera")?.tid,r={run:()=>Z((async()=>{await this.initCameraZoom(e/2),await this.changeCameraToPathUp(e/4),await this.translateCameraToStartPoi(e/4)})(),e+500).finally(()=>{this.bmap.context.control.enabled=!0}),meta:{type:"initNavigationCamera"}};n?this.taskQueue.replace(n,r):this.taskQueue.add(r)}async translateCameraToStartPoi(e=100){if(!this.startPoi)return;let{clientSize:{width:t,height:n},camera:r,control:i}=this.bmap.context,o=Math.round(t/2),a=Math.round(n/2),l=i.target.clone(),u=y(this.startPoi.position,r,t,n),c=u.x-o,h=a-u.y+this.options.offsetY;if(console.log("start",l.clone()),!(Math.abs(c)<=1&&Math.abs(h)<=1)){if(Math.abs(c)>=1){let p=new wt.Vector3;p.setFromMatrixColumn(r.matrix,0),p.normalize(),p.multiplyScalar(c/r.zoom),l.add(new wt.Vector3(p.x,p.y,0))}if(Math.abs(h)>=1){let p=new wt.Vector3;p.setFromMatrixColumn(r.matrix,1),p.normalize(),p.multiplyScalar(h/r.zoom),l.add(new wt.Vector3(p.x,p.y,0))}return console.log("start1",l.clone()),Z(new Promise(p=>{let d=i.target.clone();console.log(d,l,e);let m=new Yt.Tween(d,this.tweenUtil.group).to(l,e).onUpdate(()=>{this.bmap.context.control.setCameraPositionByTarget(d,0)}).onComplete(()=>{this.bmap.context.control.setCameraPositionByTarget(l,0),this.tweenUtil.remove(m),this.bmap.context.control.enabled=!0,p(!0)}).onStart(()=>{this.bmap.context.control.enabled=!1}).start()}),e+500).then(()=>{this.bmap.context.control.enabled=!0})}}async initCameraZoom(e=100){if(!this.startPoi)return;let{clientSize:{width:t,height:n},currentFloor:r}=this.bmap.context,{max:i,min:o}=r.box,l=Math.min(t/(i.x-o.x),n/(i.y-o.y))*(i.x-o.x)/40;return this.bmap.context.setZoom(l,this.startPoi.position,e).finally(()=>{this.bmap.context.control.enabled=!0})}toPosition(e,t){this.positionNavigation.toPosition(e,t)}startSimulation(){this.positionNavigation.startSimulation()}setSimulationSpeed(e){this.positionNavigation.changeSimulationSpeed(e)}async toPositionBySpeed(e,t){let{currentPathPosition:n,curFloorPath:r,curFloorPathPoints:i}=this;if(!r||!n)return null;let o=this.movedDistance,a=fn(i,e);if(o===-1||a===-1||a<=o)return null;let l=a-o;if(!l)return;let u=Math.min(l/t,1);return this.pathTween&&this.clearTween(),Z(new Promise(c=>{let h=this.pathTween=new Yt.Tween({distance:0},this.tweenUtil.group).to({distance:l},u*1e3).onUpdate(async p=>{this.moveDistance(p.distance+o,h)}).onComplete(()=>{this.tweenUtil.remove(h),c(!0)}).start()}),u*1e3+500).finally(()=>{this.bmap.context.control.enabled=!0})}async moveDistance(e,t){this.movedDistance=e,this.path?.movePath(this.movedDistance/this.curFloorPathLength);let n=ee(this.curFloorPathPoints,this.movedDistance);if(n===null)return;this.currentPathPosition=n;let r=this.translatePoints([n])[0];this.startPoi&&(this.startPoi.position.setX(r[0]).setY(r[1]),this.options.disablePathAnimation||this.bmap.context.control.setTargetByOffset(this.options.offsetY,this.startPoi.position.clone())),this.options.disablePathAnimation||(t?.pause(),this.positionNavigation.tweenUtil.pause(),await this.changeCameraToPathUp(500/this.options.speed),this.positionNavigation.tweenUtil.continue(),t?.resume())}setStartPoiRotate(e){if(this.startPoi){let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-e-n)%360}}dispose(){this.tweenUtil.dispose(),this.unRegistryEvent(),this.path?.dispose(),this.startPoi?.dispose(),this.positionNavigation.dispose()}};var Kr=require("three"),In=class extends dt{poiLayer;floors=[];group=new Kr.Group;constructor(e){super(e),this.poiLayer=new Ut(e.context)}show(e){let t=e[0].userData.height;e.forEach(i=>{i.poiLayer2.pois.forEach(o=>{o.position.setZ(o.position.z+t),o.options.depth_test=!0,this.poiLayer.pushPoi(o)}),i.poiLayer2.pois.length=0,i.poiLayer2.dispose(),i.position.z=t,t+=i.userData.height});let{scene:n,currentFloor:r}=this.bmap.context;r&&(n.remove(r),r.dispose()),this.group.add(this.poiLayer,...e),n.add(this.group),this.floors=e,this.fitCamera(),this.bmap.context.cameraBound.updateBox()}hide(){let{scene:e}=this.bmap.context;e.remove(this.group),this.poiLayer.clear(),this.floors.forEach(t=>{t.dispose()}),this.floors=[],this.group.clear()}fitCamera(){let{context:e,config:t,type:n}=this.bmap;e.cameraBound.setEnable(!1),e.control.minZoom=0,e.control.maxZoom=1/0,e.camera.zoom=1,e.setAzimuthalAngle(t.control.defaultAzimuthal,0),e.setPolarAngle(t.control.defaultPolar,0),e.fitCameraToObject(this.group,void 0,0);let r=e.camera.zoom;e.control.minZoom=r,e.control.maxZoom=r*25,n==="3d"&&e.fitCameraToObject(this.group,t.defaultPadding,0,!1),this.bmap.basicZoom=e.camera.zoom,e.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),e.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(e=>e.dispose()),this.floors=[]}};var Zr=require("three");function xe(s){let e=new Blob([s],{type:"text/javascript"}),t=URL.createObjectURL(e),n=new Worker(t);return URL.revokeObjectURL(t),n}function Rn(){return xe(`var XP=Object.create;var Jd=Object.defineProperty,YP=Object.defineProperties,$P=Object.getOwnPropertyDescriptor,ZP=Object.getOwnPropertyDescriptors,JP=Object.getOwnPropertyNames,qv=Object.getOwnPropertySymbols,KP=Object.getPrototypeOf,Xv=Object.prototype.hasOwnProperty,QP=Object.prototype.propertyIsEnumerable;var Zd=(r,t,e)=>t in r?Jd(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,qc=(r,t)=>{for(var e in t||(t={}))Xv.call(t,e)&&Zd(r,e,t[e]);if(qv)for(var e of qv(t))QP.call(t,e)&&Zd(r,e,t[e]);return r},Yv=(r,t)=>YP(r,ZP(t));var ce=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var jP=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of JP(t))!Xv.call(r,a)&&a!==e&&Jd(r,a,{get:()=>t[a],enumerable:!(o=$P(t,a))||o.enumerable});return r};var Nr=(r,t,e)=>(e=r!=null?XP(KP(r)):{},jP(t||!r||!r.__esModule?Jd(e,"default",{value:r,enumerable:!0}):e,r));var Ii=(r,t,e)=>Zd(r,typeof t!="symbol"?t+"":t,e);var Zv=ce((Pz,$v)=>{var Kd=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)}};$v.exports=Kd});var Qv=ce((Iz,Kv)=>{function Jv(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,Jv(a,t)):o!==t&&e.set(o,a);return e}Kv.exports=Jv});var e_=ce((Rz,t_)=>{function tI(r){let t=Number(r);return!(isNaN(t)||t<=0)}function jv(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,jv(a));if(!tI(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}t_.exports=jv});var i_=ce((Lz,r_)=>{function n_(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){n_(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}r_.exports=n_});var u_=ce((Nz,a_)=>{var eI=Zv(),nI=Qv(),o_=e_(),s_=i_(),Qd=class{constructor(t){t instanceof Map?(s_(t),this.graph=t):t?this.graph=o_(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(s_(e),o=e):o=o_(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=nI(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,c=new eI,p=new Map,d=[],g=0,y=[];if(o.avoid&&(y=[].concat(o.avoid)),y.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(y.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(c.set(t,0);!c.isEmpty();){let _=c.next();if(_.key===e){g=_.priority;let x=_.key;for(;p.has(x);)d.push(x),x=p.get(x);break}a.add(_.key),(this.graph.get(_.key)||new Map).forEach((x,b)=>{if(a.has(b)||y.includes(b))return null;if(!c.has(b))return p.set(b,_.key),c.set(b,_.priority+x);let P=c.get(b).priority,I=_.priority+x;return I<P?(p.set(b,_.key),c.set(b,I)):null})}return d.length?(o.trim?d.shift():d=d.concat([t]),o.reverse||(d=d.reverse()),o.cost?{path:d,cost:g}:d):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};a_.exports=Qd});var Qh=ce((Hz,Q1)=>{"use strict";var K1=Object.getOwnPropertySymbols,rD=Object.prototype.hasOwnProperty,iD=Object.prototype.propertyIsEnumerable;function oD(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function sD(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(c){return t[c]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(c){a[c]=c}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(c){return!1}}Q1.exports=sD()?Object.assign:function(r,t){for(var e,o=oD(r),a,c=1;c<arguments.length;c++){e=Object(arguments[c]);for(var p in e)rD.call(e,p)&&(o[p]=e[p]);if(K1){a=K1(e);for(var d=0;d<a.length;d++)iD.call(e,a[d])&&(o[a[d]]=e[a[d]])}}return o}});var Sm=ce((wm,Mm)=>{(function(r,t){typeof wm=="object"&&typeof Mm!="undefined"?Mm.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(wm,function(){"use strict";function r(M,E,N,A,U){(function z($,q,D,G,Q){for(;G>D;){if(G-D>600){var _t=G-D+1,Z=q-D+1,Dt=Math.log(_t),et=.5*Math.exp(2*Dt/3),vt=.5*Math.sqrt(Dt*et*(_t-et)/_t)*(Z-_t/2<0?-1:1),It=Math.max(D,Math.floor(q-Z*et/_t+vt)),Pt=Math.min(G,Math.floor(q+(_t-Z)*et/_t+vt));z($,q,It,Pt,Q)}var Et=$[q],yt=D,Y=G;for(t($,D,q),Q($[G],Et)>0&&t($,D,G);yt<Y;){for(t($,yt,Y),yt++,Y--;Q($[yt],Et)<0;)yt++;for(;Q($[Y],Et)>0;)Y--}Q($[D],Et)===0?t($,D,Y):t($,++Y,G),Y<=q&&(D=Y+1),q<=Y&&(G=Y-1)}})(M,E,N||0,A||M.length-1,U||e)}function t(M,E,N){var A=M[E];M[E]=M[N],M[N]=A}function e(M,E){return M<E?-1:M>E?1:0}var o=function(M){M===void 0&&(M=9),this._maxEntries=Math.max(4,M),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(M,E,N){if(!N)return E.indexOf(M);for(var A=0;A<E.length;A++)if(N(M,E[A]))return A;return-1}function c(M,E){p(M,0,M.children.length,E,M)}function p(M,E,N,A,U){U||(U=P(null)),U.minX=1/0,U.minY=1/0,U.maxX=-1/0,U.maxY=-1/0;for(var z=E;z<N;z++){var $=M.children[z];d(U,M.leaf?A($):$)}return U}function d(M,E){return M.minX=Math.min(M.minX,E.minX),M.minY=Math.min(M.minY,E.minY),M.maxX=Math.max(M.maxX,E.maxX),M.maxY=Math.max(M.maxY,E.maxY),M}function g(M,E){return M.minX-E.minX}function y(M,E){return M.minY-E.minY}function _(M){return(M.maxX-M.minX)*(M.maxY-M.minY)}function w(M){return M.maxX-M.minX+(M.maxY-M.minY)}function x(M,E){return M.minX<=E.minX&&M.minY<=E.minY&&E.maxX<=M.maxX&&E.maxY<=M.maxY}function b(M,E){return E.minX<=M.maxX&&E.minY<=M.maxY&&E.maxX>=M.minX&&E.maxY>=M.minY}function P(M){return{children:M,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function I(M,E,N,A,U){for(var z=[E,N];z.length;)if(!((N=z.pop())-(E=z.pop())<=A)){var $=E+Math.ceil((N-E)/A/2)*A;r(M,$,E,N,U),z.push(E,$,$,N)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(M){var E=this.data,N=[];if(!b(M,E))return N;for(var A=this.toBBox,U=[];E;){for(var z=0;z<E.children.length;z++){var $=E.children[z],q=E.leaf?A($):$;b(M,q)&&(E.leaf?N.push($):x(M,q)?this._all($,N):U.push($))}E=U.pop()}return N},o.prototype.collides=function(M){var E=this.data;if(!b(M,E))return!1;for(var N=[];E;){for(var A=0;A<E.children.length;A++){var U=E.children[A],z=E.leaf?this.toBBox(U):U;if(b(M,z)){if(E.leaf||x(M,z))return!0;N.push(U)}}E=N.pop()}return!1},o.prototype.load=function(M){if(!M||!M.length)return this;if(M.length<this._minEntries){for(var E=0;E<M.length;E++)this.insert(M[E]);return this}var N=this._build(M.slice(),0,M.length-1,0);if(this.data.children.length)if(this.data.height===N.height)this._splitRoot(this.data,N);else{if(this.data.height<N.height){var A=this.data;this.data=N,N=A}this._insert(N,this.data.height-N.height-1,!0)}else this.data=N;return this},o.prototype.insert=function(M){return M&&this._insert(M,this.data.height-1),this},o.prototype.clear=function(){return this.data=P([]),this},o.prototype.remove=function(M,E){if(!M)return this;for(var N,A,U,z=this.data,$=this.toBBox(M),q=[],D=[];z||q.length;){if(z||(z=q.pop(),A=q[q.length-1],N=D.pop(),U=!0),z.leaf){var G=a(M,z.children,E);if(G!==-1)return z.children.splice(G,1),q.push(z),this._condense(q),this}U||z.leaf||!x(z,$)?A?(N++,z=A.children[N],U=!1):z=null:(q.push(z),D.push(N),N=0,A=z,z=z.children[0])}return this},o.prototype.toBBox=function(M){return M},o.prototype.compareMinX=function(M,E){return M.minX-E.minX},o.prototype.compareMinY=function(M,E){return M.minY-E.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(M){return this.data=M,this},o.prototype._all=function(M,E){for(var N=[];M;)M.leaf?E.push.apply(E,M.children):N.push.apply(N,M.children),M=N.pop();return E},o.prototype._build=function(M,E,N,A){var U,z=N-E+1,$=this._maxEntries;if(z<=$)return c(U=P(M.slice(E,N+1)),this.toBBox),U;A||(A=Math.ceil(Math.log(z)/Math.log($)),$=Math.ceil(z/Math.pow($,A-1))),(U=P([])).leaf=!1,U.height=A;var q=Math.ceil(z/$),D=q*Math.ceil(Math.sqrt($));I(M,E,N,D,this.compareMinX);for(var G=E;G<=N;G+=D){var Q=Math.min(G+D-1,N);I(M,G,Q,q,this.compareMinY);for(var _t=G;_t<=Q;_t+=q){var Z=Math.min(_t+q-1,Q);U.children.push(this._build(M,_t,Z,A-1))}}return c(U,this.toBBox),U},o.prototype._chooseSubtree=function(M,E,N,A){for(;A.push(E),!E.leaf&&A.length-1!==N;){for(var U=1/0,z=1/0,$=void 0,q=0;q<E.children.length;q++){var D=E.children[q],G=_(D),Q=(_t=M,Z=D,(Math.max(Z.maxX,_t.maxX)-Math.min(Z.minX,_t.minX))*(Math.max(Z.maxY,_t.maxY)-Math.min(Z.minY,_t.minY))-G);Q<z?(z=Q,U=G<U?G:U,$=D):Q===z&&G<U&&(U=G,$=D)}E=$||E.children[0]}var _t,Z;return E},o.prototype._insert=function(M,E,N){var A=N?M:this.toBBox(M),U=[],z=this._chooseSubtree(A,this.data,E,U);for(z.children.push(M),d(z,A);E>=0&&U[E].children.length>this._maxEntries;)this._split(U,E),E--;this._adjustParentBBoxes(A,U,E)},o.prototype._split=function(M,E){var N=M[E],A=N.children.length,U=this._minEntries;this._chooseSplitAxis(N,U,A);var z=this._chooseSplitIndex(N,U,A),$=P(N.children.splice(z,N.children.length-z));$.height=N.height,$.leaf=N.leaf,c(N,this.toBBox),c($,this.toBBox),E?M[E-1].children.push($):this._splitRoot(N,$)},o.prototype._splitRoot=function(M,E){this.data=P([M,E]),this.data.height=M.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(M,E,N){for(var A,U,z,$,q,D,G,Q=1/0,_t=1/0,Z=E;Z<=N-E;Z++){var Dt=p(M,0,Z,this.toBBox),et=p(M,Z,N,this.toBBox),vt=(U=Dt,z=et,$=void 0,q=void 0,D=void 0,G=void 0,$=Math.max(U.minX,z.minX),q=Math.max(U.minY,z.minY),D=Math.min(U.maxX,z.maxX),G=Math.min(U.maxY,z.maxY),Math.max(0,D-$)*Math.max(0,G-q)),It=_(Dt)+_(et);vt<Q?(Q=vt,A=Z,_t=It<_t?It:_t):vt===Q&&It<_t&&(_t=It,A=Z)}return A||N-E},o.prototype._chooseSplitAxis=function(M,E,N){var A=M.leaf?this.compareMinX:g,U=M.leaf?this.compareMinY:y;this._allDistMargin(M,E,N,A)<this._allDistMargin(M,E,N,U)&&M.children.sort(A)},o.prototype._allDistMargin=function(M,E,N,A){M.children.sort(A);for(var U=this.toBBox,z=p(M,0,E,U),$=p(M,N-E,N,U),q=w(z)+w($),D=E;D<N-E;D++){var G=M.children[D];d(z,M.leaf?U(G):G),q+=w(z)}for(var Q=N-E-1;Q>=E;Q--){var _t=M.children[Q];d($,M.leaf?U(_t):_t),q+=w($)}return q},o.prototype._adjustParentBBoxes=function(M,E,N){for(var A=N;A>=0;A--)d(E[A],M)},o.prototype._condense=function(M){for(var E=M.length-1,N=void 0;E>=0;E--)M[E].children.length===0?E>0?(N=M[E-1].children).splice(N.indexOf(M[E]),1):this.clear():c(M[E],this.toBBox)},o})});var j1=ce((bm,Tm)=>{(function(r,t){typeof bm=="object"&&typeof Tm!="undefined"?Tm.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(bm,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var c=(this.length>>1)-1;c>=0;c--)this._down(c)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,c=a.data,p=a.compare,d=c[o];o>0;){var g=o-1>>1,y=c[g];if(p(d,y)>=0)break;c[o]=y,o=g}c[o]=d},r.prototype._down=function(o){for(var a=this,c=a.data,p=a.compare,d=this.length>>1,g=c[o];o<d;){var y=(o<<1)+1,_=c[y],w=y+1;if(w<this.length&&p(c[w],_)<0&&(y=w,_=c[w]),p(_,g)>=0)break;c[o]=_,o=y}c[o]=g};function t(e,o){return e<o?-1:e>o?1:0}return r})});var ex=ce(($z,tx)=>{tx.exports=function(t,e,o,a){var c=t[0],p=t[1],d=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var g=(a-o)/2,y=0,_=g-1;y<g;_=y++){var w=e[o+y*2+0],x=e[o+y*2+1],b=e[o+_*2+0],P=e[o+_*2+1],I=x>p!=P>p&&c<(b-w)*(p-x)/(P-x)+w;I&&(d=!d)}return d}});var rx=ce((Zz,nx)=>{nx.exports=function(t,e,o,a){var c=t[0],p=t[1],d=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var g=a-o,y=0,_=g-1;y<g;_=y++){var w=e[y+o][0],x=e[y+o][1],b=e[_+o][0],P=e[_+o][1],I=x>p!=P>p&&c<(b-w)*(p-x)/(P-x)+w;I&&(d=!d)}return d}});var sx=ce((Jz,ep)=>{var ix=ex(),ox=rx();ep.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?ox(t,e,o,a):ix(t,e,o,a)};ep.exports.nested=ox;ep.exports.flat=ix});var ux=ce((np,ax)=>{(function(r,t){typeof np=="object"&&typeof ax!="undefined"?t(np):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(np,function(r){"use strict";let e=33306690738754706e-32;function o(b,P,I,M,E){let N,A,U,z,$=P[0],q=M[0],D=0,G=0;q>$==q>-$?(N=$,$=P[++D]):(N=q,q=M[++G]);let Q=0;if(D<b&&G<I)for(q>$==q>-$?(U=N-((A=$+N)-$),$=P[++D]):(U=N-((A=q+N)-q),q=M[++G]),N=A,U!==0&&(E[Q++]=U);D<b&&G<I;)q>$==q>-$?(U=N-((A=N+$)-(z=A-N))+($-z),$=P[++D]):(U=N-((A=N+q)-(z=A-N))+(q-z),q=M[++G]),N=A,U!==0&&(E[Q++]=U);for(;D<b;)U=N-((A=N+$)-(z=A-N))+($-z),$=P[++D],N=A,U!==0&&(E[Q++]=U);for(;G<I;)U=N-((A=N+q)-(z=A-N))+(q-z),q=M[++G],N=A,U!==0&&(E[Q++]=U);return N===0&&Q!==0||(E[Q++]=N),Q}function a(b){return new Float64Array(b)}let c=33306690738754716e-32,p=22204460492503146e-32,d=11093356479670487e-47,g=a(4),y=a(8),_=a(12),w=a(16),x=a(4);r.orient2d=function(b,P,I,M,E,N){let A=(P-N)*(I-E),U=(b-E)*(M-N),z=A-U;if(A===0||U===0||A>0!=U>0)return z;let $=Math.abs(A+U);return Math.abs(z)>=c*$?z:-function(q,D,G,Q,_t,Z,Dt){let et,vt,It,Pt,Et,yt,Y,ht,Mt,zt,At,$t,ue,le,Qt,me,Xt,Ee,ft=q-_t,He=G-_t,te=D-Z,fe=Q-Z;Et=(Qt=(ht=ft-(Y=(yt=134217729*ft)-(yt-ft)))*(zt=fe-(Mt=(yt=134217729*fe)-(yt-fe)))-((le=ft*fe)-Y*Mt-ht*Mt-Y*zt))-(At=Qt-(Xt=(ht=te-(Y=(yt=134217729*te)-(yt-te)))*(zt=He-(Mt=(yt=134217729*He)-(yt-He)))-((me=te*He)-Y*Mt-ht*Mt-Y*zt))),g[0]=Qt-(At+Et)+(Et-Xt),Et=(ue=le-(($t=le+At)-(Et=$t-le))+(At-Et))-(At=ue-me),g[1]=ue-(At+Et)+(Et-me),Et=(Ee=$t+At)-$t,g[2]=$t-(Ee-Et)+(At-Et),g[3]=Ee;let de=function(Vn,$n){let j=$n[0];for(let H=1;H<Vn;H++)j+=$n[H];return j}(4,g),Ue=p*Dt;if(de>=Ue||-de>=Ue||(et=q-(ft+(Et=q-ft))+(Et-_t),It=G-(He+(Et=G-He))+(Et-_t),vt=D-(te+(Et=D-te))+(Et-Z),Pt=Q-(fe+(Et=Q-fe))+(Et-Z),et===0&&vt===0&&It===0&&Pt===0)||(Ue=d*Dt+e*Math.abs(de),(de+=ft*Pt+fe*et-(te*It+He*vt))>=Ue||-de>=Ue))return de;Et=(Qt=(ht=et-(Y=(yt=134217729*et)-(yt-et)))*(zt=fe-(Mt=(yt=134217729*fe)-(yt-fe)))-((le=et*fe)-Y*Mt-ht*Mt-Y*zt))-(At=Qt-(Xt=(ht=vt-(Y=(yt=134217729*vt)-(yt-vt)))*(zt=He-(Mt=(yt=134217729*He)-(yt-He)))-((me=vt*He)-Y*Mt-ht*Mt-Y*zt))),x[0]=Qt-(At+Et)+(Et-Xt),Et=(ue=le-(($t=le+At)-(Et=$t-le))+(At-Et))-(At=ue-me),x[1]=ue-(At+Et)+(Et-me),Et=(Ee=$t+At)-$t,x[2]=$t-(Ee-Et)+(At-Et),x[3]=Ee;let be=o(4,g,4,x,y);Et=(Qt=(ht=ft-(Y=(yt=134217729*ft)-(yt-ft)))*(zt=Pt-(Mt=(yt=134217729*Pt)-(yt-Pt)))-((le=ft*Pt)-Y*Mt-ht*Mt-Y*zt))-(At=Qt-(Xt=(ht=te-(Y=(yt=134217729*te)-(yt-te)))*(zt=It-(Mt=(yt=134217729*It)-(yt-It)))-((me=te*It)-Y*Mt-ht*Mt-Y*zt))),x[0]=Qt-(At+Et)+(Et-Xt),Et=(ue=le-(($t=le+At)-(Et=$t-le))+(At-Et))-(At=ue-me),x[1]=ue-(At+Et)+(Et-me),Et=(Ee=$t+At)-$t,x[2]=$t-(Ee-Et)+(At-Et),x[3]=Ee;let kt=o(be,y,4,x,_);Et=(Qt=(ht=et-(Y=(yt=134217729*et)-(yt-et)))*(zt=Pt-(Mt=(yt=134217729*Pt)-(yt-Pt)))-((le=et*Pt)-Y*Mt-ht*Mt-Y*zt))-(At=Qt-(Xt=(ht=vt-(Y=(yt=134217729*vt)-(yt-vt)))*(zt=It-(Mt=(yt=134217729*It)-(yt-It)))-((me=vt*It)-Y*Mt-ht*Mt-Y*zt))),x[0]=Qt-(At+Et)+(Et-Xt),Et=(ue=le-(($t=le+At)-(Et=$t-le))+(At-Et))-(At=ue-me),x[1]=ue-(At+Et)+(Et-me),Et=(Ee=$t+At)-$t,x[2]=$t-(Ee-Et)+(At-Et),x[3]=Ee;let ye=o(kt,_,4,x,w);return w[ye-1]}(b,P,I,M,E,N,$)},r.orient2dfast=function(b,P,I,M,E,N){return(P-N)*(I-E)-(b-E)*(M-N)},Object.defineProperty(r,"__esModule",{value:!0})})});var dx=ce((Kz,Im)=>{"use strict";var lx=Sm(),ip=j1(),uD=sx(),lD=ux().orient2d;ip.default&&(ip=ip.default);Im.exports=px;Im.exports.default=px;function px(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=dD(r),a=new lx(16);a.toBBox=function(N){return{minX:N[0],minY:N[1],maxX:N[0],maxY:N[1]}},a.compareMinX=function(N,A){return N[0]-A[0]},a.compareMinY=function(N,A){return N[1]-A[1]},a.load(r);for(var c=[],p=0,d;p<o.length;p++){var g=o[p];a.remove(g),d=hx(g,d),c.push(d)}var y=new lx(16);for(p=0;p<c.length;p++)y.insert(Am(c[p]));for(var _=t*t,w=e*e;c.length;){var x=c.shift(),b=x.p,P=x.next.p,I=Cm(b,P);if(!(I<w)){var M=I/_;g=cD(a,x.prev.p,b,P,x.next.next.p,M,y),g&&Math.min(Cm(g,b),Cm(g,P))<=M&&(c.push(x),c.push(hx(g,x)),a.remove(g),y.remove(x),y.insert(Am(x)),y.insert(Am(x.next)))}}x=d;var E=[];do E.push(x.p),x=x.next;while(x!==d);return E.push(x.p),E}function cD(r,t,e,o,a,c,p){for(var d=new ip([],fD),g=r.data;g;){for(var y=0;y<g.children.length;y++){var _=g.children[y],w=g.leaf?Pm(_,e,o):hD(e,o,_);w>c||d.push({node:_,dist:w})}for(;d.length&&!d.peek().node.children;){var x=d.pop(),b=x.node,P=Pm(b,t,e),I=Pm(b,o,a);if(x.dist<P&&x.dist<I&&fx(e,b,p)&&fx(o,b,p))return b}g=d.pop(),g&&(g=g.node)}return null}function fD(r,t){return r.dist-t.dist}function hD(r,t,e){if(cx(r,e)||cx(t,e))return 0;var o=rp(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=rp(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var c=rp(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(c===0)return 0;var p=rp(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return p===0?0:Math.min(o,a,c,p)}function cx(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function fx(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),c=Math.max(r[0],t[0]),p=Math.max(r[1],t[1]),d=e.search({minX:o,minY:a,maxX:c,maxY:p}),g=0;g<d.length;g++)if(pD(d[g].p,d[g].next.p,r,t))return!1;return!0}function ic(r,t,e){return lD(r[0],r[1],t[0],t[1],e[0],e[1])}function pD(r,t,e,o){return r!==o&&t!==e&&ic(r,t,e)>0!=ic(r,t,o)>0&&ic(e,o,r)>0!=ic(e,o,t)>0}function Am(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 dD(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],c=0;c<r.length;c++){var p=r[c];p[0]<t[0]&&(t=p),p[0]>o[0]&&(o=p),p[1]<e[1]&&(e=p),p[1]>a[1]&&(a=p)}var d=[t,e,o,a],g=d.slice();for(c=0;c<r.length;c++)uD(r[c],d)||g.push(r[c]);return mD(g)}function hx(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 Cm(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function Pm(r,t,e){var o=t[0],a=t[1],c=e[0]-o,p=e[1]-a;if(c!==0||p!==0){var d=((r[0]-o)*c+(r[1]-a)*p)/(c*c+p*p);d>1?(o=e[0],a=e[1]):d>0&&(o+=c*d,a+=p*d)}return c=r[0]-o,p=r[1]-a,c*c+p*p}function rp(r,t,e,o,a,c,p,d){var g=e-r,y=o-t,_=p-a,w=d-c,x=r-a,b=t-c,P=g*g+y*y,I=g*_+y*w,M=_*_+w*w,E=g*x+y*b,N=_*x+w*b,A=P*M-I*I,U,z,$,q,D=A,G=A;A===0?(z=0,D=1,q=N,G=M):(z=I*N-M*E,q=P*N-I*E,z<0?(z=0,q=N,G=M):z>D&&(z=D,q=N+I,G=M)),q<0?(q=0,-E<0?z=0:-E>P?z=D:(z=-E,D=P)):q>G&&(q=G,-E+I<0?z=0:-E+I>P?z=D:(z=-E+I,D=P)),U=z===0?0:z/D,$=q===0?0:q/G;var Q=(1-U)*r+U*e,_t=(1-U)*t+U*o,Z=(1-$)*a+$*p,Dt=(1-$)*c+$*d,et=Z-Q,vt=Dt-_t;return et*et+vt*vt}function gD(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function mD(r){r.sort(gD);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&ic(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&&ic(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 xx=ce((Lm,Nm)=>{(function(r,t){typeof Lm=="object"&&typeof Nm!="undefined"?Nm.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(Lm,function(){"use strict";function r(a,c,p,d,g){t(a,c,p||0,d||a.length-1,g||o)}function t(a,c,p,d,g){for(;d>p;){if(d-p>600){var y=d-p+1,_=c-p+1,w=Math.log(y),x=.5*Math.exp(2*w/3),b=.5*Math.sqrt(w*x*(y-x)/y)*(_-y/2<0?-1:1),P=Math.max(p,Math.floor(c-_*x/y+b)),I=Math.min(d,Math.floor(c+(y-_)*x/y+b));t(a,c,P,I,g)}var M=a[c],E=p,N=d;for(e(a,p,c),g(a[d],M)>0&&e(a,p,d);E<N;){for(e(a,E,N),E++,N--;g(a[E],M)<0;)E++;for(;g(a[N],M)>0;)N--}g(a[p],M)===0?e(a,p,N):(N++,e(a,N,d)),N<=c&&(p=N+1),c<=N&&(d=N-1)}}function e(a,c,p){var d=a[c];a[c]=a[p],a[p]=d}function o(a,c){return a<c?-1:a>c?1:0}return r})});var Um=ce((Mk,Fm)=>{"use strict";Fm.exports=lf;Fm.exports.default=lf;var PD=xx();function lf(r,t){if(!(this instanceof lf))return new lf(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()}lf.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!sp(r,t))return e;for(var a=[],c,p,d,g;t;){for(c=0,p=t.children.length;c<p;c++)d=t.children[c],g=t.leaf?o(d):d,sp(r,g)&&(t.leaf?e.push(d):Dm(r,g)?this._all(d,e):a.push(d));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!sp(r,t))return!1;for(var o=[],a,c,p,d;t;){for(a=0,c=t.children.length;a<c;a++)if(p=t.children[a],d=t.leaf?e(p):p,sp(r,d)){if(t.leaf||Dm(r,d))return!0;o.push(p)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=ac([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],c=[],p,d,g,y;e||a.length;){if(e||(e=a.pop(),d=a[a.length-1],p=c.pop(),y=!0),e.leaf&&(g=ID(r,e.children,t),g!==-1))return e.children.splice(g,1),a.push(e),this._condense(a),this;!y&&!e.leaf&&Dm(e,o)?(a.push(e),c.push(p),p=0,d=e,e=e.children[0]):d?(p++,e=d.children[p],y=!1):e=null}return this},toBBox:function(r){return r},compareMinX:Ex,compareMinY:wx,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,c=this._maxEntries,p;if(a<=c)return p=ac(r.slice(t,e+1)),sc(p,this.toBBox),p;o||(o=Math.ceil(Math.log(a)/Math.log(c)),c=Math.ceil(a/Math.pow(c,o-1))),p=ac([]),p.leaf=!1,p.height=o;var d=Math.ceil(a/c),g=d*Math.ceil(Math.sqrt(c)),y,_,w,x;for(Mx(r,t,e,g,this.compareMinX),y=t;y<=e;y+=g)for(w=Math.min(y+g-1,e),Mx(r,y,w,d,this.compareMinY),_=y;_<=w;_+=d)x=Math.min(_+d-1,w),p.children.push(this._build(r,_,x,o-1));return sc(p,this.toBBox),p},_chooseSubtree:function(r,t,e,o){for(var a,c,p,d,g,y,_,w;o.push(t),!(t.leaf||o.length-1===e);){for(_=w=1/0,a=0,c=t.children.length;a<c;a++)p=t.children[a],g=Om(p),y=RD(r,p)-g,y<w?(w=y,_=g<_?g:_,d=p):y===w&&g<_&&(_=g,d=p);t=d||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),c=[],p=this._chooseSubtree(a,this.data,t,c);for(p.children.push(r),uf(p,a);t>=0&&c[t].children.length>this._maxEntries;)this._split(c,t),t--;this._adjustParentBBoxes(a,c,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var c=this._chooseSplitIndex(e,a,o),p=ac(e.children.splice(c,e.children.length-c));p.height=e.height,p.leaf=e.leaf,sc(e,this.toBBox),sc(p,this.toBBox),t?r[t-1].children.push(p):this._splitRoot(e,p)},_splitRoot:function(r,t){this.data=ac([r,t]),this.data.height=r.height+1,this.data.leaf=!1,sc(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,c,p,d,g,y,_;for(g=y=1/0,o=t;o<=e-t;o++)a=af(r,0,o,this.toBBox),c=af(r,o,e,this.toBBox),p=LD(a,c),d=Om(a)+Om(c),p<g?(g=p,_=o,y=d<y?d:y):p===g&&d<y&&(y=d,_=o);return _},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:Ex,a=r.leaf?this.compareMinY:wx,c=this._allDistMargin(r,t,e,o),p=this._allDistMargin(r,t,e,a);c<p&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,c=af(r,0,t,a),p=af(r,e-t,e,a),d=op(c)+op(p),g,y;for(g=t;g<e-t;g++)y=r.children[g],uf(c,r.leaf?a(y):y),d+=op(c);for(g=e-t-1;g>=t;g--)y=r.children[g],uf(p,r.leaf?a(y):y),d+=op(p);return d},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)uf(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():sc(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 ID(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 sc(r,t){af(r,0,r.children.length,t,r)}function af(r,t,e,o,a){a||(a=ac(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var c=t,p;c<e;c++)p=r.children[c],uf(a,r.leaf?o(p):p);return a}function uf(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 Ex(r,t){return r.minX-t.minX}function wx(r,t){return r.minY-t.minY}function Om(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function op(r){return r.maxX-r.minX+(r.maxY-r.minY)}function RD(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 LD(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),c=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,c-o)}function Dm(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function sp(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function ac(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Mx(r,t,e,o,a){for(var c=[t,e],p;c.length;)e=c.pop(),t=c.pop(),!(e-t<=o)&&(p=t+Math.ceil((e-t)/o/2)*o,PD(r,p,t,e,a),c.push(t,p,p,e))}});var Px=ce((F5,Vm)=>{"use strict";Vm.exports=cp;Vm.exports.default=cp;function cp(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,c=Tx(r,0,a,e,!0),p=[];if(!c||c.next===c.prev)return p;var d,g,y,_,w,x,b;if(o&&(c=HD(r,t,c,e)),r.length>80*e){d=y=r[0],g=_=r[1];for(var P=e;P<a;P+=e)w=r[P],x=r[P+1],w<d&&(d=w),x<g&&(g=x),w>y&&(y=w),x>_&&(_=x);b=Math.max(y-d,_-g),b=b!==0?32767/b:0}return hf(c,p,e,d,g,b,0),p}function Tx(r,t,e,o,a){var c,p;if(a===Hm(r,t,e,o)>0)for(c=t;c<e;c+=o)p=bx(c,r[c],r[c+1],p);else for(c=e-o;c>=t;c-=o)p=bx(c,r[c],r[c+1],p);return p&&fp(p,p.next)&&(df(p),p=p.next),p}function al(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(fp(e,e.next)||Vr(e.prev,e,e.next)===0)){if(df(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function hf(r,t,e,o,a,c,p){if(r){!p&&c&&YD(r,o,a,c);for(var d=r,g,y;r.prev!==r.next;){if(g=r.prev,y=r.next,c?zD(r,o,a,c):BD(r)){t.push(g.i/e|0),t.push(r.i/e|0),t.push(y.i/e|0),df(r),r=y.next,d=y.next;continue}if(r=y,r===d){p?p===1?(r=GD(al(r),t,e),hf(r,t,e,o,a,c,2)):p===2&&kD(r,t,e,o,a,c):hf(al(r),t,e,o,a,c,1);break}}}}function BD(r){var t=r.prev,e=r,o=r.next;if(Vr(t,e,o)>=0)return!1;for(var a=t.x,c=e.x,p=o.x,d=t.y,g=e.y,y=o.y,_=a<c?a<p?a:p:c<p?c:p,w=d<g?d<y?d:y:g<y?g:y,x=a>c?a>p?a:p:c>p?c:p,b=d>g?d>y?d:y:g>y?g:y,P=o.next;P!==t;){if(P.x>=_&&P.x<=x&&P.y>=w&&P.y<=b&&cc(a,d,c,g,p,y,P.x,P.y)&&Vr(P.prev,P,P.next)>=0)return!1;P=P.next}return!0}function zD(r,t,e,o){var a=r.prev,c=r,p=r.next;if(Vr(a,c,p)>=0)return!1;for(var d=a.x,g=c.x,y=p.x,_=a.y,w=c.y,x=p.y,b=d<g?d<y?d:y:g<y?g:y,P=_<w?_<x?_:x:w<x?w:x,I=d>g?d>y?d:y:g>y?g:y,M=_>w?_>x?_:x:w>x?w:x,E=Gm(b,P,t,e,o),N=Gm(I,M,t,e,o),A=r.prevZ,U=r.nextZ;A&&A.z>=E&&U&&U.z<=N;){if(A.x>=b&&A.x<=I&&A.y>=P&&A.y<=M&&A!==a&&A!==p&&cc(d,_,g,w,y,x,A.x,A.y)&&Vr(A.prev,A,A.next)>=0||(A=A.prevZ,U.x>=b&&U.x<=I&&U.y>=P&&U.y<=M&&U!==a&&U!==p&&cc(d,_,g,w,y,x,U.x,U.y)&&Vr(U.prev,U,U.next)>=0))return!1;U=U.nextZ}for(;A&&A.z>=E;){if(A.x>=b&&A.x<=I&&A.y>=P&&A.y<=M&&A!==a&&A!==p&&cc(d,_,g,w,y,x,A.x,A.y)&&Vr(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;U&&U.z<=N;){if(U.x>=b&&U.x<=I&&U.y>=P&&U.y<=M&&U!==a&&U!==p&&cc(d,_,g,w,y,x,U.x,U.y)&&Vr(U.prev,U,U.next)>=0)return!1;U=U.nextZ}return!0}function GD(r,t,e){var o=r;do{var a=o.prev,c=o.next.next;!fp(a,c)&&Ax(a,o,o.next,c)&&pf(a,c)&&pf(c,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(c.i/e|0),df(o),df(o.next),o=r=c),o=o.next}while(o!==r);return al(o)}function kD(r,t,e,o,a,c){var p=r;do{for(var d=p.next.next;d!==p.prev;){if(p.i!==d.i&&JD(p,d)){var g=Cx(p,d);p=al(p,p.next),g=al(g,g.next),hf(p,t,e,o,a,c,0),hf(g,t,e,o,a,c,0);return}d=d.next}p=p.next}while(p!==r)}function HD(r,t,e,o){var a=[],c,p,d,g,y;for(c=0,p=t.length;c<p;c++)d=t[c]*o,g=c<p-1?t[c+1]*o:r.length,y=Tx(r,d,g,o,!1),y===y.next&&(y.steiner=!0),a.push(ZD(y));for(a.sort(VD),c=0;c<a.length;c++)e=WD(a[c],e);return e}function VD(r,t){return r.x-t.x}function WD(r,t){var e=qD(r,t);if(!e)return t;var o=Cx(e,r);return al(o,o.next),al(e,e.next)}function qD(r,t){var e=t,o=r.x,a=r.y,c=-1/0,p;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var d=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=o&&d>c&&(c=d,p=e.x<e.next.x?e:e.next,d===o))return p}e=e.next}while(e!==t);if(!p)return null;var g=p,y=p.x,_=p.y,w=1/0,x;e=p;do o>=e.x&&e.x>=y&&o!==e.x&&cc(a<_?o:c,a,y,_,a<_?c:o,a,e.x,e.y)&&(x=Math.abs(a-e.y)/(o-e.x),pf(e,r)&&(x<w||x===w&&(e.x>p.x||e.x===p.x&&XD(p,e)))&&(p=e,w=x)),e=e.next;while(e!==g);return p}function XD(r,t){return Vr(r.prev,r,t.prev)<0&&Vr(t.next,r,r.next)<0}function YD(r,t,e,o){var a=r;do a.z===0&&(a.z=Gm(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,$D(a)}function $D(r){var t,e,o,a,c,p,d,g,y=1;do{for(e=r,r=null,c=null,p=0;e;){for(p++,o=e,d=0,t=0;t<y&&(d++,o=o.nextZ,!!o);t++);for(g=y;d>0||g>0&&o;)d!==0&&(g===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,d--):(a=o,o=o.nextZ,g--),c?c.nextZ=a:r=a,a.prevZ=c,c=a;e=o}c.nextZ=null,y*=2}while(p>1);return r}function Gm(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 ZD(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 cc(r,t,e,o,a,c,p,d){return(a-p)*(t-d)>=(r-p)*(c-d)&&(r-p)*(o-d)>=(e-p)*(t-d)&&(e-p)*(c-d)>=(a-p)*(o-d)}function JD(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!KD(r,t)&&(pf(r,t)&&pf(t,r)&&QD(r,t)&&(Vr(r.prev,r,t.prev)||Vr(r,t.prev,t))||fp(r,t)&&Vr(r.prev,r,r.next)>0&&Vr(t.prev,t,t.next)>0)}function Vr(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function fp(r,t){return r.x===t.x&&r.y===t.y}function Ax(r,t,e,o){var a=lp(Vr(r,t,e)),c=lp(Vr(r,t,o)),p=lp(Vr(e,o,r)),d=lp(Vr(e,o,t));return!!(a!==c&&p!==d||a===0&&up(r,e,t)||c===0&&up(r,o,t)||p===0&&up(e,r,o)||d===0&&up(e,t,o))}function up(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 lp(r){return r>0?1:r<0?-1:0}function KD(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&&Ax(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function pf(r,t){return Vr(r.prev,r,r.next)<0?Vr(r,t,r.next)>=0&&Vr(r,r.prev,t)>=0:Vr(r,t,r.prev)<0||Vr(r,r.next,t)<0}function QD(r,t){var e=r,o=!1,a=(r.x+t.x)/2,c=(r.y+t.y)/2;do e.y>c!=e.next.y>c&&e.next.y!==e.y&&a<(e.next.x-e.x)*(c-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function Cx(r,t){var e=new km(r.i,r.x,r.y),o=new km(t.i,t.x,t.y),a=r.next,c=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,c.next=o,o.prev=c,o}function bx(r,t,e,o){var a=new km(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function df(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function km(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}cp.deviation=function(r,t,e,o){var a=t&&t.length,c=a?t[0]*e:r.length,p=Math.abs(Hm(r,0,c,e));if(a)for(var d=0,g=t.length;d<g;d++){var y=t[d]*e,_=d<g-1?t[d+1]*e:r.length;p-=Math.abs(Hm(r,y,_,e))}var w=0;for(d=0;d<o.length;d+=3){var x=o[d]*e,b=o[d+1]*e,P=o[d+2]*e;w+=Math.abs((r[x]-r[P])*(r[b+1]-r[x+1])-(r[x]-r[b])*(r[P+1]-r[x+1]))}return p===0&&w===0?0:Math.abs((w-p)/p)};function Hm(r,t,e,o){for(var a=0,c=t,p=e-o;c<e;c+=o)a+=(r[p]-r[c])*(r[c+1]+r[p+1]),p=c;return a}cp.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var c=0;c<r[a].length;c++)for(var p=0;p<t;p++)e.vertices.push(r[a][c][p]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var $m=ce(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.earthRadius=63710088e-1;Ie.factors={centimeters:Ie.earthRadius*100,centimetres:Ie.earthRadius*100,degrees:Ie.earthRadius/111325,feet:Ie.earthRadius*3.28084,inches:Ie.earthRadius*39.37,kilometers:Ie.earthRadius/1e3,kilometres:Ie.earthRadius/1e3,meters:Ie.earthRadius,metres:Ie.earthRadius,miles:Ie.earthRadius/1609.344,millimeters:Ie.earthRadius*1e3,millimetres:Ie.earthRadius*1e3,nauticalmiles:Ie.earthRadius/1852,radians:1,yards:Ie.earthRadius*1.0936};Ie.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Ie.earthRadius,yards:1.0936133};Ie.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Au(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}Ie.feature=Au;function t3(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Wm(t).geometry;case"LineString":return Xm(t).geometry;case"Polygon":return qm(t).geometry;case"MultiPoint":return Rx(t).geometry;case"MultiLineString":return Ix(t).geometry;case"MultiPolygon":return Lx(t).geometry;default:throw new Error(r+" is invalid")}}Ie.geometry=t3;function Wm(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(!hp(r[0])||!hp(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Au(o,t,e)}Ie.point=Wm;function e3(r,t,e){return e===void 0&&(e={}),pp(r.map(function(o){return Wm(o,t)}),e)}Ie.points=e3;function qm(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var c=a[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<c[c.length-1].length;p++)if(c[c.length-1][p]!==c[0][p])throw new Error("First and last Position are not equivalent.")}var d={type:"Polygon",coordinates:r};return Au(d,t,e)}Ie.polygon=qm;function n3(r,t,e){return e===void 0&&(e={}),pp(r.map(function(o){return qm(o,t)}),e)}Ie.polygons=n3;function Xm(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return Au(o,t,e)}Ie.lineString=Xm;function r3(r,t,e){return e===void 0&&(e={}),pp(r.map(function(o){return Xm(o,t)}),e)}Ie.lineStrings=r3;function pp(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}Ie.featureCollection=pp;function Ix(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Au(o,t,e)}Ie.multiLineString=Ix;function Rx(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Au(o,t,e)}Ie.multiPoint=Rx;function Lx(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Au(o,t,e)}Ie.multiPolygon=Lx;function i3(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Au(o,t,e)}Ie.geometryCollection=i3;function o3(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}Ie.round=o3;function Nx(r,t){t===void 0&&(t="kilometers");var e=Ie.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}Ie.radiansToLength=Nx;function Ym(r,t){t===void 0&&(t="kilometers");var e=Ie.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}Ie.lengthToRadians=Ym;function s3(r,t){return Ox(Ym(r,t))}Ie.lengthToDegrees=s3;function a3(r){var t=r%360;return t<0&&(t+=360),t}Ie.bearingToAzimuth=a3;function Ox(r){var t=r%(2*Math.PI);return t*180/Math.PI}Ie.radiansToDegrees=Ox;function u3(r){var t=r%360;return t*Math.PI/180}Ie.degreesToRadians=u3;function l3(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 Nx(Ym(r,t),e)}Ie.convertLength=l3;function c3(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=Ie.areaFactors[t];if(!o)throw new Error("invalid original units");var a=Ie.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}Ie.convertArea=c3;function hp(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}Ie.isNumber=hp;function f3(r){return!!r&&r.constructor===Object}Ie.isObject=f3;function h3(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(!hp(t))throw new Error("bbox must only contain numbers")})}Ie.validateBBox=h3;function p3(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}Ie.validateId=p3});var Jm=ce(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});var oo=$m();function gf(r,t,e){if(r!==null)for(var o,a,c,p,d,g,y,_=0,w=0,x,b=r.type,P=b==="FeatureCollection",I=b==="Feature",M=P?r.features.length:1,E=0;E<M;E++){y=P?r.features[E].geometry:I?r.geometry:r,x=y?y.type==="GeometryCollection":!1,d=x?y.geometries.length:1;for(var N=0;N<d;N++){var A=0,U=0;if(p=x?y.geometries[N]:y,p!==null){g=p.coordinates;var z=p.type;switch(_=e&&(z==="Polygon"||z==="MultiPolygon")?1:0,z){case null:break;case"Point":if(t(g,w,E,A,U)===!1)return!1;w++,A++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],w,E,A,U)===!1)return!1;w++,z==="MultiPoint"&&A++}z==="LineString"&&A++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(a=0;a<g[o].length-_;a++){if(t(g[o][a],w,E,A,U)===!1)return!1;w++}z==="MultiLineString"&&A++,z==="Polygon"&&U++}z==="Polygon"&&A++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(U=0,a=0;a<g[o].length;a++){for(c=0;c<g[o][a].length-_;c++){if(t(g[o][a][c],w,E,A,U)===!1)return!1;w++}U++}A++}break;case"GeometryCollection":for(o=0;o<p.geometries.length;o++)if(gf(p.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function d3(r,t,e,o){var a=e;return gf(r,function(c,p,d,g,y){p===0&&e===void 0?a=c:a=t(a,c,p,d,g,y)},o),a}function Dx(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 g3(r,t,e){var o=e;return Dx(r,function(a,c){c===0&&e===void 0?o=a:o=t(o,a,c)}),o}function Fx(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 m3(r,t,e){var o=e;return Fx(r,function(a,c){c===0&&e===void 0?o=a:o=t(o,a,c)}),o}function y3(r){var t=[];return gf(r,function(e){t.push(e)}),t}function Zm(r,t){var e,o,a,c,p,d,g,y,_,w,x=0,b=r.type==="FeatureCollection",P=r.type==="Feature",I=b?r.features.length:1;for(e=0;e<I;e++){for(d=b?r.features[e].geometry:P?r.geometry:r,y=b?r.features[e].properties:P?r.properties:{},_=b?r.features[e].bbox:P?r.bbox:void 0,w=b?r.features[e].id:P?r.id:void 0,g=d?d.type==="GeometryCollection":!1,p=g?d.geometries.length:1,a=0;a<p;a++){if(c=g?d.geometries[a]:d,c===null){if(t(null,x,y,_,w)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,y,_,w)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,y,_,w)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function v3(r,t,e){var o=e;return Zm(r,function(a,c,p,d,g){c===0&&e===void 0?o=a:o=t(o,a,c,p,d,g)}),o}function dp(r,t){Zm(r,function(e,o,a,c,p){var d=e===null?null:e.type;switch(d){case null:case"Point":case"LineString":case"Polygon":return t(oo.feature(e,a,{bbox:c,id:p}),o,0)===!1?!1:void 0}var g;switch(d){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var y=0;y<e.coordinates.length;y++){var _=e.coordinates[y],w={type:g,coordinates:_};if(t(oo.feature(w,a),o,y)===!1)return!1}})}function _3(r,t,e){var o=e;return dp(r,function(a,c,p){c===0&&p===0&&e===void 0?o=a:o=t(o,a,c,p)}),o}function Ux(r,t){dp(r,function(e,o,a){var c=0;if(e.geometry){var p=e.geometry.type;if(!(p==="Point"||p==="MultiPoint")){var d,g=0,y=0,_=0;if(gf(e,function(w,x,b,P,I){if(d===void 0||o>g||P>y||I>_){d=w,g=o,y=P,_=I,c=0;return}var M=oo.lineString([d,w],e.properties);if(t(M,o,a,I,c)===!1)return!1;c++,d=w})===!1)return!1}}})}function x3(r,t,e){var o=e,a=!1;return Ux(r,function(c,p,d,g,y){a===!1&&e===void 0?o=c:o=t(o,c,p,d,g,y),a=!0}),o}function Bx(r,t){if(!r)throw new Error("geojson is required");dp(r,function(e,o,a){if(e.geometry!==null){var c=e.geometry.type,p=e.geometry.coordinates;switch(c){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var d=0;d<p.length;d++)if(t(oo.lineString(p[d],e.properties),o,a,d)===!1)return!1;break}}})}function E3(r,t,e){var o=e;return Bx(r,function(a,c,p,d){c===0&&e===void 0?o=a:o=t(o,a,c,p,d)}),o}function w3(r,t){if(t=t||{},!oo.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,c=t.segmentIndex||0,p=t.properties,d;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),p=p||r.features[e].properties,d=r.features[e].geometry;break;case"Feature":p=p||r.properties,d=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":d=r;break;default:throw new Error("geojson is invalid")}if(d===null)return null;var g=d.coordinates;switch(d.type){case"Point":case"MultiPoint":return null;case"LineString":return c<0&&(c=g.length+c-1),oo.lineString([g[c],g[c+1]],p,t);case"Polygon":return a<0&&(a=g.length+a),c<0&&(c=g[a].length+c-1),oo.lineString([g[a][c],g[a][c+1]],p,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c-1),oo.lineString([g[o][c],g[o][c+1]],p,t);case"MultiPolygon":return o<0&&(o=g.length+o),a<0&&(a=g[o].length+a),c<0&&(c=g[o][a].length-c-1),oo.lineString([g[o][a][c],g[o][a][c+1]],p,t)}throw new Error("geojson is invalid")}function M3(r,t){if(t=t||{},!oo.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,c=t.coordIndex||0,p=t.properties,d;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),p=p||r.features[e].properties,d=r.features[e].geometry;break;case"Feature":p=p||r.properties,d=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":d=r;break;default:throw new Error("geojson is invalid")}if(d===null)return null;var g=d.coordinates;switch(d.type){case"Point":return oo.point(g,p,t);case"MultiPoint":return o<0&&(o=g.length+o),oo.point(g[o],p,t);case"LineString":return c<0&&(c=g.length+c),oo.point(g[c],p,t);case"Polygon":return a<0&&(a=g.length+a),c<0&&(c=g[a].length+c),oo.point(g[a][c],p,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c),oo.point(g[o][c],p,t);case"MultiPolygon":return o<0&&(o=g.length+o),a<0&&(a=g[o].length+a),c<0&&(c=g[o][a].length-c),oo.point(g[o][a][c],p,t)}throw new Error("geojson is invalid")}_i.coordAll=y3;_i.coordEach=gf;_i.coordReduce=d3;_i.featureEach=Fx;_i.featureReduce=m3;_i.findPoint=M3;_i.findSegment=w3;_i.flattenEach=dp;_i.flattenReduce=_3;_i.geomEach=Zm;_i.geomReduce=v3;_i.lineEach=Bx;_i.lineReduce=E3;_i.propEach=Dx;_i.propReduce=g3;_i.segmentEach=Ux;_i.segmentReduce=x3});var zx=ce(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});var S3=Jm();function Km(r){var t=[1/0,1/0,-1/0,-1/0];return S3.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}Km.default=Km;Qm.default=Km});var gp=ce((Q5,jm)=>{var da=Sm(),kx=$m(),Hx=Jm(),fc=zx().default,b3=Hx.featureEach,J5=Hx.coordEach,K5=kx.polygon,Gx=kx.featureCollection;function Vx(r){var t=new da(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:fc(e),da.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:fc(a),o.push(a)}):b3(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:fc(a),o.push(a)}),da.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:fc(e),da.prototype.remove.call(this,e,o)},t.clear=function(){return da.prototype.clear.call(this)},t.search=function(e){var o=da.prototype.search.call(this,this.toBBox(e));return Gx(o)},t.collides=function(e){return da.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=da.prototype.all.call(this);return Gx(e)},t.toJSON=function(){return da.prototype.toJSON.call(this)},t.fromJSON=function(e){return da.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=fc(e);else if(e.type==="FeatureCollection")o=fc(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}jm.exports=Vx;jm.exports.default=Vx});var o0=ce((a6,jx)=>{"use strict";var Qx=Object.prototype.toString;jx.exports=function(t){var e=Qx.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Qx.call(t.callee)==="[object Function]"),o}});var uE=ce((u6,aE)=>{"use strict";var sE;Object.keys||(vf=Object.prototype.hasOwnProperty,s0=Object.prototype.toString,tE=o0(),a0=Object.prototype.propertyIsEnumerable,eE=!a0.call({toString:null},"toString"),nE=a0.call(function(){},"prototype"),_f=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],xp=function(r){var t=r.constructor;return t&&t.prototype===r},rE={$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},iE=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!rE["$"+r]&&vf.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{xp(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),oE=function(r){if(typeof window=="undefined"||!iE)return xp(r);try{return xp(r)}catch(t){return!1}},sE=function(t){var e=t!==null&&typeof t=="object",o=s0.call(t)==="[object Function]",a=tE(t),c=e&&s0.call(t)==="[object String]",p=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var d=nE&&o;if(c&&t.length>0&&!vf.call(t,0))for(var g=0;g<t.length;++g)p.push(String(g));if(a&&t.length>0)for(var y=0;y<t.length;++y)p.push(String(y));else for(var _ in t)!(d&&_==="prototype")&&vf.call(t,_)&&p.push(String(_));if(eE)for(var w=oE(t),x=0;x<_f.length;++x)!(w&&_f[x]==="constructor")&&vf.call(t,_f[x])&&p.push(_f[x]);return p});var vf,s0,tE,a0,eE,nE,_f,xp,rE,iE,oE;aE.exports=sE});var u0=ce((l6,fE)=>{"use strict";var D3=Array.prototype.slice,F3=o0(),lE=Object.keys,Ep=lE?function(t){return lE(t)}:uE(),cE=Object.keys;Ep.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 F3(o)?cE(D3.call(o)):cE(o)})}else Object.keys=Ep;return Object.keys||Ep};fE.exports=Ep});var l0=ce((c6,hE)=>{"use strict";hE.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var c=Object.getOwnPropertySymbols(t);if(c.length!==1||c[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var p=Object.getOwnPropertyDescriptor(t,e);if(p.value!==a||p.enumerable!==!0)return!1}return!0}});var wp=ce((f6,pE)=>{"use strict";var U3=l0();pE.exports=function(){return U3()&&!!Symbol.toStringTag}});var gE=ce((h6,dE)=>{"use strict";dE.exports=Error});var yE=ce((p6,mE)=>{"use strict";mE.exports=EvalError});var _E=ce((d6,vE)=>{"use strict";vE.exports=RangeError});var EE=ce((g6,xE)=>{"use strict";xE.exports=ReferenceError});var c0=ce((m6,wE)=>{"use strict";wE.exports=SyntaxError});var ul=ce((y6,ME)=>{"use strict";ME.exports=TypeError});var bE=ce((v6,SE)=>{"use strict";SE.exports=URIError});var CE=ce((_6,AE)=>{"use strict";var TE=typeof Symbol!="undefined"&&Symbol,B3=l0();AE.exports=function(){return typeof TE!="function"||typeof Symbol!="function"||typeof TE("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:B3()}});var IE=ce((x6,PE)=>{"use strict";var f0={__proto__:null,foo:{}},z3=Object;PE.exports=function(){return{__proto__:f0}.foo===f0.foo&&!(f0 instanceof z3)}});var NE=ce((E6,LE)=>{"use strict";var G3="Function.prototype.bind called on incompatible ",k3=Object.prototype.toString,H3=Math.max,V3="[object Function]",RE=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var c=0;c<e.length;c+=1)o[c+t.length]=e[c];return o},W3=function(t,e){for(var o=[],a=e||0,c=0;a<t.length;a+=1,c+=1)o[c]=t[a];return o},q3=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};LE.exports=function(t){var e=this;if(typeof e!="function"||k3.apply(e)!==V3)throw new TypeError(G3+e);for(var o=W3(arguments,1),a,c=function(){if(this instanceof a){var _=e.apply(this,RE(o,arguments));return Object(_)===_?_:this}return e.apply(t,RE(o,arguments))},p=H3(0,e.length-o.length),d=[],g=0;g<p;g++)d[g]="$"+g;if(a=Function("binder","return function ("+q3(d,",")+"){ return binder.apply(this,arguments); }")(c),e.prototype){var y=function(){};y.prototype=e.prototype,a.prototype=new y,y.prototype=null}return a}});var Mp=ce((w6,OE)=>{"use strict";var X3=NE();OE.exports=Function.prototype.bind||X3});var FE=ce((M6,DE)=>{"use strict";var Y3=Function.prototype.call,$3=Object.prototype.hasOwnProperty,Z3=Mp();DE.exports=Z3.call(Y3,$3)});var mc=ce((S6,kE)=>{"use strict";var zn,J3=gE(),K3=yE(),Q3=_E(),j3=EE(),gc=c0(),dc=ul(),tF=bE(),GE=Function,h0=function(r){try{return GE('"use strict"; return ('+r+").constructor;")()}catch(t){}},ll=Object.getOwnPropertyDescriptor;if(ll)try{ll({},"")}catch(r){ll=null}var p0=function(){throw new dc},eF=ll?function(){try{return arguments.callee,p0}catch(r){try{return ll(arguments,"callee").get}catch(t){return p0}}}():p0,hc=CE()(),nF=IE()(),Di=Object.getPrototypeOf||(nF?function(r){return r.__proto__}:null),pc={},rF=typeof Uint8Array=="undefined"||!Di?zn:Di(Uint8Array),cl={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?zn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?zn:ArrayBuffer,"%ArrayIteratorPrototype%":hc&&Di?Di([][Symbol.iterator]()):zn,"%AsyncFromSyncIteratorPrototype%":zn,"%AsyncFunction%":pc,"%AsyncGenerator%":pc,"%AsyncGeneratorFunction%":pc,"%AsyncIteratorPrototype%":pc,"%Atomics%":typeof Atomics=="undefined"?zn:Atomics,"%BigInt%":typeof BigInt=="undefined"?zn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?zn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?zn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?zn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":J3,"%eval%":eval,"%EvalError%":K3,"%Float32Array%":typeof Float32Array=="undefined"?zn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?zn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?zn:FinalizationRegistry,"%Function%":GE,"%GeneratorFunction%":pc,"%Int8Array%":typeof Int8Array=="undefined"?zn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?zn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?zn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hc&&Di?Di(Di([][Symbol.iterator]())):zn,"%JSON%":typeof JSON=="object"?JSON:zn,"%Map%":typeof Map=="undefined"?zn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!hc||!Di?zn:Di(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?zn:Promise,"%Proxy%":typeof Proxy=="undefined"?zn:Proxy,"%RangeError%":Q3,"%ReferenceError%":j3,"%Reflect%":typeof Reflect=="undefined"?zn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?zn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!hc||!Di?zn:Di(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?zn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hc&&Di?Di(""[Symbol.iterator]()):zn,"%Symbol%":hc?Symbol:zn,"%SyntaxError%":gc,"%ThrowTypeError%":eF,"%TypedArray%":rF,"%TypeError%":dc,"%Uint8Array%":typeof Uint8Array=="undefined"?zn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?zn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?zn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?zn:Uint32Array,"%URIError%":tF,"%WeakMap%":typeof WeakMap=="undefined"?zn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?zn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?zn:WeakSet};if(Di)try{null.error}catch(r){UE=Di(Di(r)),cl["%Error.prototype%"]=UE}var UE,iF=function r(t){var e;if(t==="%AsyncFunction%")e=h0("async function () {}");else if(t==="%GeneratorFunction%")e=h0("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=h0("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&Di&&(e=Di(a.prototype))}return cl[t]=e,e},BE={__proto__:null,"%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"]},xf=Mp(),Sp=FE(),oF=xf.call(Function.call,Array.prototype.concat),sF=xf.call(Function.apply,Array.prototype.splice),zE=xf.call(Function.call,String.prototype.replace),bp=xf.call(Function.call,String.prototype.slice),aF=xf.call(Function.call,RegExp.prototype.exec),uF=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,lF=/\\\\(\\\\)?/g,cF=function(t){var e=bp(t,0,1),o=bp(t,-1);if(e==="%"&&o!=="%")throw new gc("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new gc("invalid intrinsic syntax, expected opening \`%\`");var a=[];return zE(t,uF,function(c,p,d,g){a[a.length]=d?zE(g,lF,"$1"):p||c}),a},fF=function(t,e){var o=t,a;if(Sp(BE,o)&&(a=BE[o],o="%"+a[0]+"%"),Sp(cl,o)){var c=cl[o];if(c===pc&&(c=iF(o)),typeof c=="undefined"&&!e)throw new dc("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:c}}throw new gc("intrinsic "+t+" does not exist!")};kE.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new dc("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new dc('"allowMissing" argument must be a boolean');if(aF(/^%?[^%]*%?$/,t)===null)throw new gc("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=cF(t),a=o.length>0?o[0]:"",c=fF("%"+a+"%",e),p=c.name,d=c.value,g=!1,y=c.alias;y&&(a=y[0],sF(o,oF([0,1],y)));for(var _=1,w=!0;_<o.length;_+=1){var x=o[_],b=bp(x,0,1),P=bp(x,-1);if((b==='"'||b==="'"||b==="\`"||P==='"'||P==="'"||P==="\`")&&b!==P)throw new gc("property names with quotes must have matching quotes");if((x==="constructor"||!w)&&(g=!0),a+="."+x,p="%"+a+"%",Sp(cl,p))d=cl[p];else if(d!=null){if(!(x in d)){if(!e)throw new dc("base intrinsic for "+t+" exists, but the property is not available.");return}if(ll&&_+1>=o.length){var I=ll(d,x);w=!!I,w&&"get"in I&&!("originalValue"in I.get)?d=I.get:d=d[x]}else w=Sp(d,x),d=d[x];w&&!g&&(cl[p]=d)}}return d}});var Ap=ce((b6,HE)=>{"use strict";var hF=mc(),Tp=hF("%Object.defineProperty%",!0)||!1;if(Tp)try{Tp({},"a",{value:1})}catch(r){Tp=!1}HE.exports=Tp});var d0=ce((T6,VE)=>{"use strict";var pF=mc(),Cp=pF("%Object.getOwnPropertyDescriptor%",!0);if(Cp)try{Cp([],"length")}catch(r){Cp=null}VE.exports=Cp});var Pp=ce((A6,XE)=>{"use strict";var WE=Ap(),dF=c0(),yc=ul(),qE=d0();XE.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new yc("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new yc("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new yc("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new yc("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new yc("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new yc("\`loose\`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,g=!!qE&&qE(t,e);if(WE)WE(t,e,{configurable:p===null&&g?g.configurable:!p,enumerable:a===null&&g?g.enumerable:!a,value:o,writable:c===null&&g?g.writable:!c});else if(d||!a&&!c&&!p)t[e]=o;else throw new dF("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Ip=ce((C6,$E)=>{"use strict";var g0=Ap(),YE=function(){return!!g0};YE.hasArrayLengthDefineBug=function(){if(!g0)return null;try{return g0([],"length",{value:1}).length!==1}catch(t){return!0}};$E.exports=YE});var jE=ce((P6,QE)=>{"use strict";var gF=mc(),ZE=Pp(),mF=Ip()(),JE=d0(),KE=ul(),yF=gF("%Math.floor%");QE.exports=function(t,e){if(typeof t!="function")throw new KE("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||yF(e)!==e)throw new KE("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,c=!0;if("length"in t&&JE){var p=JE(t,"length");p&&!p.configurable&&(a=!1),p&&!p.writable&&(c=!1)}return(a||c||!o)&&(mF?ZE(t,"length",e,!0,!0):ZE(t,"length",e)),t}});var Np=ce((I6,Rp)=>{"use strict";var m0=Mp(),Lp=mc(),vF=jE(),_F=ul(),nw=Lp("%Function.prototype.apply%"),rw=Lp("%Function.prototype.call%"),iw=Lp("%Reflect.apply%",!0)||m0.call(rw,nw),tw=Ap(),xF=Lp("%Math.max%");Rp.exports=function(t){if(typeof t!="function")throw new _F("a function is required");var e=iw(m0,rw,arguments);return vF(e,1+xF(0,t.length-(arguments.length-1)),!0)};var ew=function(){return iw(m0,nw,arguments)};tw?tw(Rp.exports,"apply",{value:ew}):Rp.exports.apply=ew});var y0=ce((R6,aw)=>{"use strict";var ow=mc(),sw=Np(),EF=sw(ow("String.prototype.indexOf"));aw.exports=function(t,e){var o=ow(t,!!e);return typeof o=="function"&&EF(t,".prototype.")>-1?sw(o):o}});var cw=ce((L6,lw)=>{"use strict";var wF=wp()(),MF=y0(),v0=MF("Object.prototype.toString"),Op=function(t){return wF&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:v0(t)==="[object Arguments]"},uw=function(t){return Op(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&v0(t)!=="[object Array]"&&v0(t.callee)==="[object Function]"},SF=function(){return Op(arguments)}();Op.isLegacyArguments=uw;lw.exports=SF?Op:uw});var vc=ce((N6,dw)=>{"use strict";var bF=u0(),TF=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",AF=Object.prototype.toString,CF=Array.prototype.concat,fw=Pp(),PF=function(r){return typeof r=="function"&&AF.call(r)==="[object Function]"},hw=Ip()(),IF=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!PF(o)||!o())return}hw?fw(r,t,e,!0):fw(r,t,e)},pw=function(r,t){var e=arguments.length>2?arguments[2]:{},o=bF(t);TF&&(o=CF.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)IF(r,o[a],t[o[a]],e[o[a]])};pw.supportsDescriptors=!!hw;dw.exports=pw});var _0=ce((O6,mw)=>{"use strict";var gw=function(r){return r!==r};mw.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||gw(t)&&gw(e))}});var x0=ce((D6,yw)=>{"use strict";var RF=_0();yw.exports=function(){return typeof Object.is=="function"?Object.is:RF}});var _w=ce((F6,vw)=>{"use strict";var LF=x0(),NF=vc();vw.exports=function(){var t=LF();return NF(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Mw=ce((U6,ww)=>{"use strict";var OF=vc(),DF=Np(),FF=_0(),xw=x0(),UF=_w(),Ew=DF(xw(),Object);OF(Ew,{getPolyfill:xw,implementation:FF,shim:UF});ww.exports=Ew});var Cw=ce((B6,Aw)=>{"use strict";var E0=y0(),Sw=wp()(),bw,Tw,w0,M0;Sw&&(bw=E0("Object.prototype.hasOwnProperty"),Tw=E0("RegExp.prototype.exec"),w0={},Dp=function(){throw w0},M0={toString:Dp,valueOf:Dp},typeof Symbol.toPrimitive=="symbol"&&(M0[Symbol.toPrimitive]=Dp));var Dp,BF=E0("Object.prototype.toString"),zF=Object.getOwnPropertyDescriptor,GF="[object RegExp]";Aw.exports=Sw?function(t){if(!t||typeof t!="object")return!1;var e=zF(t,"lastIndex"),o=e&&bw(e,"value");if(!o)return!1;try{Tw(t,M0)}catch(a){return a===w0}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:BF(t)===GF}});var Iw=ce((z6,Pw)=>{"use strict";var wf=function(){return typeof function(){}.name=="string"},Ef=Object.getOwnPropertyDescriptor;if(Ef)try{Ef([],"length")}catch(r){Ef=null}wf.functionsHaveConfigurableNames=function(){if(!wf()||!Ef)return!1;var t=Ef(function(){},"name");return!!t&&!!t.configurable};var kF=Function.prototype.bind;wf.boundFunctionsHaveNames=function(){return wf()&&typeof kF=="function"&&function(){}.bind().name!==""};Pw.exports=wf});var Nw=ce((G6,Lw)=>{"use strict";var Rw=Pp(),HF=Ip()(),VF=Iw().functionsHaveConfigurableNames(),WF=ul();Lw.exports=function(t,e){if(typeof t!="function")throw new WF("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||VF)&&(HF?Rw(t,"name",e,!0,!0):Rw(t,"name",e)),t}});var S0=ce((k6,Ow)=>{"use strict";var qF=Nw(),XF=ul(),YF=Object;Ow.exports=qF(function(){if(this==null||this!==YF(this))throw new XF("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 b0=ce((H6,Dw)=>{"use strict";var $F=S0(),ZF=vc().supportsDescriptors,JF=Object.getOwnPropertyDescriptor;Dw.exports=function(){if(ZF&&/a/mig.flags==="gim"){var t=JF(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),t.get.call(o),e==="dy")return t.get}}return $F}});var Bw=ce((V6,Uw)=>{"use strict";var KF=vc().supportsDescriptors,QF=b0(),jF=Object.getOwnPropertyDescriptor,tU=Object.defineProperty,eU=TypeError,Fw=Object.getPrototypeOf,nU=/a/;Uw.exports=function(){if(!KF||!Fw)throw new eU("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=QF(),e=Fw(nU),o=jF(e,"flags");return(!o||o.get!==t)&&tU(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Hw=ce((W6,kw)=>{"use strict";var rU=vc(),iU=Np(),oU=S0(),zw=b0(),sU=Bw(),Gw=iU(zw());rU(Gw,{getPolyfill:zw,implementation:oU,shim:sU});kw.exports=Gw});var Ww=ce((q6,Vw)=>{"use strict";var aU=Date.prototype.getDay,uU=function(t){try{return aU.call(t),!0}catch(e){return!1}},lU=Object.prototype.toString,cU="[object Date]",fU=wp()();Vw.exports=function(t){return typeof t!="object"||t===null?!1:fU?uU(t):lU.call(t)===cU}});var T0=ce((X6,eM)=>{var qw=u0(),Xw=cw(),Yw=Mw(),$w=Cw(),Zw=Hw(),Jw=Ww(),Kw=Date.prototype.getTime;function tM(r,t,e){var o=e||{};return(o.strict?Yw(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?Yw(r,t):r==t:hU(r,t,o)}function Qw(r){return r==null}function jw(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 hU(r,t,e){var o,a;if(typeof r!=typeof t||Qw(r)||Qw(t)||r.prototype!==t.prototype||Xw(r)!==Xw(t))return!1;var c=$w(r),p=$w(t);if(c!==p)return!1;if(c||p)return r.source===t.source&&Zw(r)===Zw(t);if(Jw(r)&&Jw(t))return Kw.call(r)===Kw.call(t);var d=jw(r),g=jw(t);if(d!==g)return!1;if(d||g){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var y=qw(r),_=qw(t)}catch(w){return!1}if(y.length!==_.length)return!1;for(y.sort(),_.sort(),o=y.length-1;o>=0;o--)if(y[o]!=_[o])return!1;for(o=y.length-1;o>=0;o--)if(a=y[o],!tM(r[a],t[a],e))return!1;return!0}eM.exports=tM});var B0=ce((QW,uM)=>{var nB=T0(),ga=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:rB};ga.prototype.compare=function(r,t){if(r.type!==t.type||!aM(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=sM(r),a=sM(t);return o.every(function(c){return this.some(function(p){return e.compare(c,p)})},a)}}return!1};function sM(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function aM(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}ga.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};ga.prototype.compareLine=function(r,t,e,o){if(!aM(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),c=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],c[0])&&(c=this.fixStartIndex(c,a),!c))){var p=this.compareCoord(a[e],c[e]);return this.direction||p?this.comparePath(a,c):this.compareCoord(a[e],c[c.length-(1+e)])?this.comparePath(a.slice().reverse(),c):!1}};ga.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};ga.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};ga.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(c){return this.some(function(p){return a.compareLine(c,p,1,!0)})},o)}else return!1};ga.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)};ga.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};ga.prototype.removePseudo=function(r){return r};function rB(r,t){return nB(r,t,{strict:!0})}uM.exports=ga});var lM=ce((cq,Bp)=>{function Pu(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}Pu.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var c=this._regionQuery(a);if(c.length<this.minPts)this.noise.push(a);else{var p=this.clusters.length;this.clusters.push([]),this._addToCluster(a,p),this._expandCluster(p,c)}}return this.clusters};Pu.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Pu.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};Pu.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};Pu.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};Pu.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};Pu.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Bp!="undefined"&&Bp.exports&&(Bp.exports=Pu)});var cM=ce((fq,zp)=>{function Iu(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}Iu.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};Iu.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var c=0;c<this.k;c++){for(var p=new Array(_),d=0,g=0;g<_;g++)p[g]=0;for(var y=0;y<e;y++){var _=this.dataset[y].length;if(c===this.assignments[y]){for(var g=0;g<_;g++)p[g]+=this.dataset[y][g];d++}}if(d>0){for(var g=0;g<_;g++)p[g]/=d;this.centroids[c]=p}else this.centroids[c]=this.randomCentroid(),a=!0}}return this.getClusters()};Iu.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};Iu.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};Iu.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};Iu.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,c=t.length,p,d=0;d<c;d++)p=e(r,t[d]),p<o&&(o=p,a=d);return a};Iu.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof zp!="undefined"&&zp.exports&&(zp.exports=Iu)});var z0=ce((hq,Gp)=>{function ma(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}ma.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)};ma.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}}};ma.prototype.forEach=function(r){this._queue.forEach(r)};ma.prototype.getElements=function(){return this._queue};ma.prototype.getElementPriority=function(r){return this._priorities[r]};ma.prototype.getPriorities=function(){return this._priorities};ma.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};ma.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)};ma.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 Gp!="undefined"&&Gp.exports&&(Gp.exports=ma)});var hM=ce((pq,xc)=>{typeof xc!="undefined"&&xc.exports&&(fM=z0());var fM;function Ja(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)}Ja.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,c=this.dataset.length;a<c;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var p=this.clusters.length-1;this._orderedList.push(a);var d=new fM(null,null,"asc"),g=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,g,d),this._expandCluster(p,d))}return this.clusters};Ja.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};Ja.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)};Ja.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var c=o.distance(o.dataset[r],o.dataset[a]),p=Math.max(o._coreDistance,c);o._reachability[a]===void 0?(o._reachability[a]=p,e.insert(a,p)):p<o._reachability[a]&&(o._reachability[a]=p,e.remove(a),e.insert(a,p))}})};Ja.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var c=e[o];if(this._processed[c]===void 0){var p=this._regionQuery(c);this._processed[c]=1,this.clusters[r].push(c),this._orderedList.push(c),this._distanceToCore(c)!==void 0&&(this._updateQueue(c,p,t),this._expandCluster(r,t))}}};Ja.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}};Ja.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};Ja.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 xc!="undefined"&&xc.exports&&(xc.exports=Ja)});var pM=ce((dq,kp)=>{typeof kp!="undefined"&&kp.exports&&(kp.exports={DBSCAN:lM(),KMEANS:cM(),OPTICS:hM(),PriorityQueue:z0()})});var G0=ce((xq,gM)=>{"use strict";gM.exports={eudist:function(t,e,o){for(var a=t.length,c=0,p=0;p<a;p++){var d=(t[p]||0)-(e[p]||0);c+=d*d}return o?Math.sqrt(c):c},mandist:function(t,e,o){for(var a=t.length,c=0,p=0;p<a;p++)c+=Math.abs((t[p]||0)-(e[p]||0));return o?Math.sqrt(c):c},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var vM=ce((Eq,yM)=>{"use strict";var mM=G0(),lB=mM.eudist,cB=mM.dist;yM.exports={kmrand:function(t,e){for(var o={},a=[],c=e<<2,p=t.length,d=t[0].length>0;a.length<e&&c-- >0;){var g=t[Math.floor(Math.random()*p)],y=d?g.join("_"):""+g;o[y]||(o[y]=!0,a.push(g))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?lB:cB,a=[],c=t.length,p=t[0].length>0,d={},g=t[Math.floor(Math.random()*c)],y=p?g.join("_"):""+g;for(a.push(g),d[y]=!0;a.length<e;){for(var _=[],w=a.length,x=0,b=[],P=0;P<c;P++){for(var I=1/0,M=0;M<w;M++){var E=o(t[P],a[M]);E<=I&&(I=E)}_[P]=I}for(var N=0;N<c;N++)x+=_[N];for(var A=0;A<c;A++)b[A]={i:A,v:t[A],pr:_[A]/x,cs:0};b.sort(function(q,D){return q.pr-D.pr}),b[0].cs=b[0].pr;for(var U=1;U<c;U++)b[U].cs=b[U-1].cs+b[U].pr;for(var z=Math.random(),$=0;$<c-1&&b[$++].cs<z;);a.push(b[$-1].v)}return a}}});var MM=ce((Sq,wM)=>{"use strict";var k0=G0(),EM=vM(),fB=k0.eudist,wq=k0.mandist,Mq=k0.dist,hB=EM.kmrand,pB=EM.kmpp,_M=1e4;function xM(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function dB(r,t,e,o){var a=[],c=[],p=[],d=[],g=!1,y=o||_M,_=r.length,w=r[0].length,x=w>0,b=[];if(e)e=="kmrand"?a=hB(r,t):e=="kmpp"?a=pB(r,t):a=e;else for(var P={};a.length<t;){var I=Math.floor(Math.random()*_);P[I]||(P[I]=!0,a.push(r[I]))}do{xM(t,0,b);for(var M=0;M<_;M++){for(var E=1/0,N=0,A=0;A<t;A++){var d=x?fB(r[M],a[A]):Math.abs(r[M]-a[A]);d<=E&&(E=d,N=A)}p[M]=N,b[N]++}for(var U=[],c=[],z=0,$=0;$<t;$++)U[$]=x?xM(w,0,U[$]):0,c[$]=a[$];if(x){for(var q=0;q<t;q++)a[q]=[];for(var D=0;D<_;D++)for(var G=p[D],Q=U[G],_t=r[D],Z=0;Z<w;Z++)Q[Z]+=_t[Z];g=!0;for(var Dt=0;Dt<t;Dt++){for(var et=a[Dt],vt=U[Dt],It=c[Dt],Pt=b[Dt],Et=0;Et<w;Et++)et[Et]=vt[Et]/Pt||0;if(g){for(var yt=0;yt<w;yt++)if(It[yt]!=et[yt]){g=!1;break}}}}else{for(var Y=0;Y<_;Y++){var ht=p[Y];U[ht]+=r[Y]}for(var Mt=0;Mt<t;Mt++)a[Mt]=U[Mt]/b[Mt]||0;g=!0;for(var zt=0;zt<t;zt++)if(c[zt]!=a[zt]){g=!1;break}}g=g||--y<=0}while(!g);return{it:_M-y,k:t,idxs:p,centroids:a}}wM.exports=dB});var bc=ce((Y0,$0)=>{(function(r,t){typeof Y0=="object"&&typeof $0!="undefined"?$0.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Y0,function(){"use strict";function r(tt,C){var L={label:0,sent:function(){if(X[0]&1)throw X[1];return X[1]},trys:[],ops:[]},F,J,X,pt;return pt={next:st(0),throw:st(1),return:st(2)},typeof Symbol=="function"&&(pt[Symbol.iterator]=function(){return this}),pt;function st(ut){return function(nt){return k([ut,nt])}}function k(ut){if(F)throw new TypeError("Generator is already executing.");for(;L;)try{if(F=1,J&&(X=ut[0]&2?J.return:ut[0]?J.throw||((X=J.return)&&X.call(J),0):J.next)&&!(X=X.call(J,ut[1])).done)return X;switch(J=0,X&&(ut=[ut[0]&2,X.value]),ut[0]){case 0:case 1:X=ut;break;case 4:return L.label++,{value:ut[1],done:!1};case 5:L.label++,J=ut[1],ut=[0];continue;case 7:ut=L.ops.pop(),L.trys.pop();continue;default:if(X=L.trys,!(X=X.length>0&&X[X.length-1])&&(ut[0]===6||ut[0]===2)){L=0;continue}if(ut[0]===3&&(!X||ut[1]>X[0]&&ut[1]<X[3])){L.label=ut[1];break}if(ut[0]===6&&L.label<X[1]){L.label=X[1],X=ut;break}if(X&&L.label<X[2]){L.label=X[2],L.ops.push(ut);break}X[2]&&L.ops.pop(),L.trys.pop();continue}ut=C.call(tt,L)}catch(nt){ut=[6,nt],J=0}finally{F=X=0}if(ut[0]&5)throw ut[1];return{value:ut[0]?ut[1]:void 0,done:!0}}}var t=function(){function tt(C,L){this.next=null,this.key=C,this.data=L,this.left=null,this.right=null}return tt}();function e(tt,C){return tt>C?1:tt<C?-1:0}function o(tt,C,L){for(var F=new t(null,null),J=F,X=F;;){var pt=L(tt,C.key);if(pt<0){if(C.left===null)break;if(L(tt,C.left.key)<0){var st=C.left;if(C.left=st.right,st.right=C,C=st,C.left===null)break}X.left=C,X=C,C=C.left}else if(pt>0){if(C.right===null)break;if(L(tt,C.right.key)>0){var st=C.right;if(C.right=st.left,st.left=C,C=st,C.right===null)break}J.right=C,J=C,C=C.right}else break}return J.right=C.left,X.left=C.right,C.left=F.right,C.right=F.left,C}function a(tt,C,L,F){var J=new t(tt,C);if(L===null)return J.left=J.right=null,J;L=o(tt,L,F);var X=F(tt,L.key);return X<0?(J.left=L.left,J.right=L,L.left=null):X>=0&&(J.right=L.right,J.left=L,L.right=null),J}function c(tt,C,L){var F=null,J=null;if(C){C=o(tt,C,L);var X=L(C.key,tt);X===0?(F=C.left,J=C.right):X<0?(J=C.right,C.right=null,F=C):(F=C.left,C.left=null,J=C)}return{left:F,right:J}}function p(tt,C,L){return C===null?tt:(tt===null||(C=o(tt.key,C,L),C.left=tt),C)}function d(tt,C,L,F,J){if(tt){F(""+C+(L?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+J(tt)+\`
|
|
106
106
|
\`);var X=C+(L?" ":"\\u2502 ");tt.left&&d(tt.left,X,!1,F,J),tt.right&&d(tt.right,X,!0,F,J)}}var g=function(){function tt(C){C===void 0&&(C=e),this._root=null,this._size=0,this._comparator=C}return tt.prototype.insert=function(C,L){return this._size++,this._root=a(C,L,this._root,this._comparator)},tt.prototype.add=function(C,L){var F=new t(C,L);this._root===null&&(F.left=F.right=null,this._size++,this._root=F);var J=this._comparator,X=o(C,this._root,J),pt=J(C,X.key);return pt===0?this._root=X:(pt<0?(F.left=X.left,F.right=X,X.left=null):pt>0&&(F.right=X.right,F.left=X,X.right=null),this._size++,this._root=F),this._root},tt.prototype.remove=function(C){this._root=this._remove(C,this._root,this._comparator)},tt.prototype._remove=function(C,L,F){var J;if(L===null)return null;L=o(C,L,F);var X=F(C,L.key);return X===0?(L.left===null?J=L.right:(J=o(C,L.left,F),J.right=L.right),this._size--,J):L},tt.prototype.pop=function(){var C=this._root;if(C){for(;C.left;)C=C.left;return this._root=o(C.key,this._root,this._comparator),this._root=this._remove(C.key,this._root,this._comparator),{key:C.key,data:C.data}}return null},tt.prototype.findStatic=function(C){for(var L=this._root,F=this._comparator;L;){var J=F(C,L.key);if(J===0)return L;J<0?L=L.left:L=L.right}return null},tt.prototype.find=function(C){return this._root&&(this._root=o(C,this._root,this._comparator),this._comparator(C,this._root.key)!==0)?null:this._root},tt.prototype.contains=function(C){for(var L=this._root,F=this._comparator;L;){var J=F(C,L.key);if(J===0)return!0;J<0?L=L.left:L=L.right}return!1},tt.prototype.forEach=function(C,L){for(var F=this._root,J=[],X=!1;!X;)F!==null?(J.push(F),F=F.left):J.length!==0?(F=J.pop(),C.call(L,F),F=F.right):X=!0;return this},tt.prototype.range=function(C,L,F,J){for(var X=[],pt=this._comparator,st=this._root,k;X.length!==0||st;)if(st)X.push(st),st=st.left;else{if(st=X.pop(),k=pt(st.key,L),k>0)break;if(pt(st.key,C)>=0&&F.call(J,st))return this;st=st.right}return this},tt.prototype.keys=function(){var C=[];return this.forEach(function(L){var F=L.key;return C.push(F)}),C},tt.prototype.values=function(){var C=[];return this.forEach(function(L){var F=L.data;return C.push(F)}),C},tt.prototype.min=function(){return this._root?this.minNode(this._root).key:null},tt.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},tt.prototype.minNode=function(C){if(C===void 0&&(C=this._root),C)for(;C.left;)C=C.left;return C},tt.prototype.maxNode=function(C){if(C===void 0&&(C=this._root),C)for(;C.right;)C=C.right;return C},tt.prototype.at=function(C){for(var L=this._root,F=!1,J=0,X=[];!F;)if(L)X.push(L),L=L.left;else if(X.length>0){if(L=X.pop(),J===C)return L;J++,L=L.right}else F=!0;return null},tt.prototype.next=function(C){var L=this._root,F=null;if(C.right){for(F=C.right;F.left;)F=F.left;return F}for(var J=this._comparator;L;){var X=J(C.key,L.key);if(X===0)break;X<0?(F=L,L=L.left):L=L.right}return F},tt.prototype.prev=function(C){var L=this._root,F=null;if(C.left!==null){for(F=C.left;F.right;)F=F.right;return F}for(var J=this._comparator;L;){var X=J(C.key,L.key);if(X===0)break;X<0?L=L.left:(F=L,L=L.right)}return F},tt.prototype.clear=function(){return this._root=null,this._size=0,this},tt.prototype.toList=function(){return w(this._root)},tt.prototype.load=function(C,L,F){L===void 0&&(L=[]),F===void 0&&(F=!1);var J=C.length,X=this._comparator;if(F&&P(C,L,0,J-1,X),this._root===null)this._root=y(C,L,0,J),this._size=J;else{var pt=b(this.toList(),_(C,L),X);J=this._size+J,this._root=x({head:pt},0,J)}return this},tt.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(tt.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(tt.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),tt.prototype.toString=function(C){C===void 0&&(C=function(F){return String(F.key)});var L=[];return d(this._root,"",!0,function(F){return L.push(F)},C),L.join("")},tt.prototype.update=function(C,L,F){var J=this._comparator,X=c(C,this._root,J),pt=X.left,st=X.right;J(C,L)<0?st=a(L,F,st,J):pt=a(L,F,pt,J),this._root=p(pt,st,J)},tt.prototype.split=function(C){return c(C,this._root,this._comparator)},tt.prototype[Symbol.iterator]=function(){var C,L,F;return r(this,function(J){switch(J.label){case 0:C=this._root,L=[],F=!1,J.label=1;case 1:return F?[3,6]:C===null?[3,2]:(L.push(C),C=C.left,[3,5]);case 2:return L.length===0?[3,4]:(C=L.pop(),[4,C]);case 3:return J.sent(),C=C.right,[3,5];case 4:F=!0,J.label=5;case 5:return[3,1];case 6:return[2]}})},tt}();function y(tt,C,L,F){var J=F-L;if(J>0){var X=L+Math.floor(J/2),pt=tt[X],st=C[X],k=new t(pt,st);return k.left=y(tt,C,L,X),k.right=y(tt,C,X+1,F),k}return null}function _(tt,C){for(var L=new t(null,null),F=L,J=0;J<tt.length;J++)F=F.next=new t(tt[J],C[J]);return F.next=null,L.next}function w(tt){for(var C=tt,L=[],F=!1,J=new t(null,null),X=J;!F;)C?(L.push(C),C=C.left):L.length>0?(C=X=X.next=L.pop(),C=C.right):F=!0;return X.next=null,J.next}function x(tt,C,L){var F=L-C;if(F>0){var J=C+Math.floor(F/2),X=x(tt,C,J),pt=tt.head;return pt.left=X,tt.head=tt.head.next,pt.right=x(tt,J+1,L),pt}return null}function b(tt,C,L){for(var F=new t(null,null),J=F,X=tt,pt=C;X!==null&&pt!==null;)L(X.key,pt.key)<0?(J.next=X,X=X.next):(J.next=pt,pt=pt.next),J=J.next;return X!==null?J.next=X:pt!==null&&(J.next=pt),F.next}function P(tt,C,L,F,J){if(!(L>=F)){for(var X=tt[L+F>>1],pt=L-1,st=F+1;;){do pt++;while(J(tt[pt],X)<0);do st--;while(J(tt[st],X)>0);if(pt>=st)break;var k=tt[pt];tt[pt]=tt[st],tt[st]=k,k=C[pt],C[pt]=C[st],C[st]=k}P(tt,C,L,st,J),P(tt,C,st+1,F,J)}}let I=(tt,C)=>tt.ll.x<=C.x&&C.x<=tt.ur.x&&tt.ll.y<=C.y&&C.y<=tt.ur.y,M=(tt,C)=>{if(C.ur.x<tt.ll.x||tt.ur.x<C.ll.x||C.ur.y<tt.ll.y||tt.ur.y<C.ll.y)return null;let L=tt.ll.x<C.ll.x?C.ll.x:tt.ll.x,F=tt.ur.x<C.ur.x?tt.ur.x:C.ur.x,J=tt.ll.y<C.ll.y?C.ll.y:tt.ll.y,X=tt.ur.y<C.ur.y?tt.ur.y:C.ur.y;return{ll:{x:L,y:J},ur:{x:F,y:X}}},E=Number.EPSILON;E===void 0&&(E=Math.pow(2,-52));let N=E*E,A=(tt,C)=>{if(-E<tt&&tt<E&&-E<C&&C<E)return 0;let L=tt-C;return L*L<N*tt*C?0:tt<C?-1:1};class U{constructor(){this.reset()}reset(){this.xRounder=new z,this.yRounder=new z}round(C,L){return{x:this.xRounder.round(C),y:this.yRounder.round(L)}}}class z{constructor(){this.tree=new g,this.round(0)}round(C){let L=this.tree.add(C),F=this.tree.prev(L);if(F!==null&&A(L.key,F.key)===0)return this.tree.remove(C),F.key;let J=this.tree.next(L);return J!==null&&A(L.key,J.key)===0?(this.tree.remove(C),J.key):C}}let $=new U,q=11102230246251565e-32,D=134217729,G=(3+8*q)*q;function Q(tt,C,L,F,J){let X,pt,st,k,ut=C[0],nt=F[0],lt=0,dt=0;nt>ut==nt>-ut?(X=ut,ut=C[++lt]):(X=nt,nt=F[++dt]);let at=0;if(lt<tt&&dt<L)for(nt>ut==nt>-ut?(pt=ut+X,st=X-(pt-ut),ut=C[++lt]):(pt=nt+X,st=X-(pt-nt),nt=F[++dt]),X=pt,st!==0&&(J[at++]=st);lt<tt&&dt<L;)nt>ut==nt>-ut?(pt=X+ut,k=pt-X,st=X-(pt-k)+(ut-k),ut=C[++lt]):(pt=X+nt,k=pt-X,st=X-(pt-k)+(nt-k),nt=F[++dt]),X=pt,st!==0&&(J[at++]=st);for(;lt<tt;)pt=X+ut,k=pt-X,st=X-(pt-k)+(ut-k),ut=C[++lt],X=pt,st!==0&&(J[at++]=st);for(;dt<L;)pt=X+nt,k=pt-X,st=X-(pt-k)+(nt-k),nt=F[++dt],X=pt,st!==0&&(J[at++]=st);return(X!==0||at===0)&&(J[at++]=X),at}function _t(tt,C){let L=C[0];for(let F=1;F<tt;F++)L+=C[F];return L}function Z(tt){return new Float64Array(tt)}let Dt=(3+16*q)*q,et=(2+12*q)*q,vt=(9+64*q)*q*q,It=Z(4),Pt=Z(8),Et=Z(12),yt=Z(16),Y=Z(4);function ht(tt,C,L,F,J,X,pt){let st,k,ut,nt,lt,dt,at,Bt,qt,we,oe,Ve,je,ur,Qn,wr,Rr,er,Me=tt-J,nr=L-J,hr=C-X,lr=F-X;ur=Me*lr,dt=D*Me,at=dt-(dt-Me),Bt=Me-at,dt=D*lr,qt=dt-(dt-lr),we=lr-qt,Qn=Bt*we-(ur-at*qt-Bt*qt-at*we),wr=hr*nr,dt=D*hr,at=dt-(dt-hr),Bt=hr-at,dt=D*nr,qt=dt-(dt-nr),we=nr-qt,Rr=Bt*we-(wr-at*qt-Bt*qt-at*we),oe=Qn-Rr,lt=Qn-oe,It[0]=Qn-(oe+lt)+(lt-Rr),Ve=ur+oe,lt=Ve-ur,je=ur-(Ve-lt)+(oe-lt),oe=je-wr,lt=je-oe,It[1]=je-(oe+lt)+(lt-wr),er=Ve+oe,lt=er-Ve,It[2]=Ve-(er-lt)+(oe-lt),It[3]=er;let Zn=_t(4,It),K=et*pt;if(Zn>=K||-Zn>=K||(lt=tt-Me,st=tt-(Me+lt)+(lt-J),lt=L-nr,ut=L-(nr+lt)+(lt-J),lt=C-hr,k=C-(hr+lt)+(lt-X),lt=F-lr,nt=F-(lr+lt)+(lt-X),st===0&&k===0&&ut===0&&nt===0)||(K=vt*pt+G*Math.abs(Zn),Zn+=Me*nt+lr*st-(hr*ut+nr*k),Zn>=K||-Zn>=K))return Zn;ur=st*lr,dt=D*st,at=dt-(dt-st),Bt=st-at,dt=D*lr,qt=dt-(dt-lr),we=lr-qt,Qn=Bt*we-(ur-at*qt-Bt*qt-at*we),wr=k*nr,dt=D*k,at=dt-(dt-k),Bt=k-at,dt=D*nr,qt=dt-(dt-nr),we=nr-qt,Rr=Bt*we-(wr-at*qt-Bt*qt-at*we),oe=Qn-Rr,lt=Qn-oe,Y[0]=Qn-(oe+lt)+(lt-Rr),Ve=ur+oe,lt=Ve-ur,je=ur-(Ve-lt)+(oe-lt),oe=je-wr,lt=je-oe,Y[1]=je-(oe+lt)+(lt-wr),er=Ve+oe,lt=er-Ve,Y[2]=Ve-(er-lt)+(oe-lt),Y[3]=er;let xt=Q(4,It,4,Y,Pt);ur=Me*nt,dt=D*Me,at=dt-(dt-Me),Bt=Me-at,dt=D*nt,qt=dt-(dt-nt),we=nt-qt,Qn=Bt*we-(ur-at*qt-Bt*qt-at*we),wr=hr*ut,dt=D*hr,at=dt-(dt-hr),Bt=hr-at,dt=D*ut,qt=dt-(dt-ut),we=ut-qt,Rr=Bt*we-(wr-at*qt-Bt*qt-at*we),oe=Qn-Rr,lt=Qn-oe,Y[0]=Qn-(oe+lt)+(lt-Rr),Ve=ur+oe,lt=Ve-ur,je=ur-(Ve-lt)+(oe-lt),oe=je-wr,lt=je-oe,Y[1]=je-(oe+lt)+(lt-wr),er=Ve+oe,lt=er-Ve,Y[2]=Ve-(er-lt)+(oe-lt),Y[3]=er;let Lt=Q(xt,Pt,4,Y,Et);ur=st*nt,dt=D*st,at=dt-(dt-st),Bt=st-at,dt=D*nt,qt=dt-(dt-nt),we=nt-qt,Qn=Bt*we-(ur-at*qt-Bt*qt-at*we),wr=k*ut,dt=D*k,at=dt-(dt-k),Bt=k-at,dt=D*ut,qt=dt-(dt-ut),we=ut-qt,Rr=Bt*we-(wr-at*qt-Bt*qt-at*we),oe=Qn-Rr,lt=Qn-oe,Y[0]=Qn-(oe+lt)+(lt-Rr),Ve=ur+oe,lt=Ve-ur,je=ur-(Ve-lt)+(oe-lt),oe=je-wr,lt=je-oe,Y[1]=je-(oe+lt)+(lt-wr),er=Ve+oe,lt=er-Ve,Y[2]=Ve-(er-lt)+(oe-lt),Y[3]=er;let wt=Q(Lt,Et,4,Y,yt);return yt[wt-1]}function Mt(tt,C,L,F,J,X){let pt=(C-X)*(L-J),st=(tt-J)*(F-X),k=pt-st,ut=Math.abs(pt+st);return Math.abs(k)>=Dt*ut?k:-ht(tt,C,L,F,J,X,ut)}let zt=(tt,C)=>tt.x*C.y-tt.y*C.x,At=(tt,C)=>tt.x*C.x+tt.y*C.y,$t=(tt,C,L)=>{let F=Mt(tt.x,tt.y,C.x,C.y,L.x,L.y);return F>0?-1:F<0?1:0},ue=tt=>Math.sqrt(At(tt,tt)),le=(tt,C,L)=>{let F={x:C.x-tt.x,y:C.y-tt.y},J={x:L.x-tt.x,y:L.y-tt.y};return zt(J,F)/ue(J)/ue(F)},Qt=(tt,C,L)=>{let F={x:C.x-tt.x,y:C.y-tt.y},J={x:L.x-tt.x,y:L.y-tt.y};return At(J,F)/ue(J)/ue(F)},me=(tt,C,L)=>C.y===0?null:{x:tt.x+C.x/C.y*(L-tt.y),y:L},Xt=(tt,C,L)=>C.x===0?null:{x:L,y:tt.y+C.y/C.x*(L-tt.x)},Ee=(tt,C,L,F)=>{if(C.x===0)return Xt(L,F,tt.x);if(F.x===0)return Xt(tt,C,L.x);if(C.y===0)return me(L,F,tt.y);if(F.y===0)return me(tt,C,L.y);let J=zt(C,F);if(J==0)return null;let X={x:L.x-tt.x,y:L.y-tt.y},pt=zt(X,C)/J,st=zt(X,F)/J,k=tt.x+st*C.x,ut=L.x+pt*F.x,nt=tt.y+st*C.y,lt=L.y+pt*F.y,dt=(k+ut)/2,at=(nt+lt)/2;return{x:dt,y:at}};class ft{static compare(C,L){let F=ft.comparePoints(C.point,L.point);return F!==0?F:(C.point!==L.point&&C.link(L),C.isLeft!==L.isLeft?C.isLeft?1:-1:te.compare(C.segment,L.segment))}static comparePoints(C,L){return C.x<L.x?-1:C.x>L.x?1:C.y<L.y?-1:C.y>L.y?1:0}constructor(C,L){C.events===void 0?C.events=[this]:C.events.push(this),this.point=C,this.isLeft=L}link(C){if(C.point===this.point)throw new Error("Tried to link already linked events");let L=C.point.events;for(let F=0,J=L.length;F<J;F++){let X=L[F];this.point.events.push(X),X.point=this.point}this.checkForConsuming()}checkForConsuming(){let C=this.point.events.length;for(let L=0;L<C;L++){let F=this.point.events[L];if(F.segment.consumedBy===void 0)for(let J=L+1;J<C;J++){let X=this.point.events[J];X.consumedBy===void 0&&F.otherSE.point.events===X.otherSE.point.events&&F.segment.consume(X.segment)}}}getAvailableLinkedEvents(){let C=[];for(let L=0,F=this.point.events.length;L<F;L++){let J=this.point.events[L];J!==this&&!J.segment.ringOut&&J.segment.isInResult()&&C.push(J)}return C}getLeftmostComparator(C){let L=new Map,F=J=>{let X=J.otherSE;L.set(J,{sine:le(this.point,C.point,X.point),cosine:Qt(this.point,C.point,X.point)})};return(J,X)=>{L.has(J)||F(J),L.has(X)||F(X);let{sine:pt,cosine:st}=L.get(J),{sine:k,cosine:ut}=L.get(X);return pt>=0&&k>=0?st<ut?1:st>ut?-1:0:pt<0&&k<0?st<ut?-1:st>ut?1:0:k<pt?-1:k>pt?1:0}}}let He=0;class te{static compare(C,L){let F=C.leftSE.point.x,J=L.leftSE.point.x,X=C.rightSE.point.x,pt=L.rightSE.point.x;if(pt<F)return 1;if(X<J)return-1;let st=C.leftSE.point.y,k=L.leftSE.point.y,ut=C.rightSE.point.y,nt=L.rightSE.point.y;if(F<J){if(k<st&&k<ut)return 1;if(k>st&&k>ut)return-1;let lt=C.comparePoint(L.leftSE.point);if(lt<0)return 1;if(lt>0)return-1;let dt=L.comparePoint(C.rightSE.point);return dt!==0?dt:-1}if(F>J){if(st<k&&st<nt)return-1;if(st>k&&st>nt)return 1;let lt=L.comparePoint(C.leftSE.point);if(lt!==0)return lt;let dt=C.comparePoint(L.rightSE.point);return dt<0?1:dt>0?-1:1}if(st<k)return-1;if(st>k)return 1;if(X<pt){let lt=L.comparePoint(C.rightSE.point);if(lt!==0)return lt}if(X>pt){let lt=C.comparePoint(L.rightSE.point);if(lt<0)return 1;if(lt>0)return-1}if(X!==pt){let lt=ut-st,dt=X-F,at=nt-k,Bt=pt-J;if(lt>dt&&at<Bt)return 1;if(lt<dt&&at>Bt)return-1}return X>pt?1:X<pt||ut<nt?-1:ut>nt?1:C.id<L.id?-1:C.id>L.id?1:0}constructor(C,L,F,J){this.id=++He,this.leftSE=C,C.segment=this,C.otherSE=L,this.rightSE=L,L.segment=this,L.otherSE=C,this.rings=F,this.windings=J}static fromRing(C,L,F){let J,X,pt,st=ft.comparePoints(C,L);if(st<0)J=C,X=L,pt=1;else if(st>0)J=L,X=C,pt=-1;else throw new Error(\`Tried to create degenerate segment at [\${C.x}, \${C.y}]\`);let k=new ft(J,!0),ut=new ft(X,!1);return new te(k,ut,[F],[pt])}replaceRightSE(C){this.rightSE=C,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let C=this.leftSE.point.y,L=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:C<L?C:L},ur:{x:this.rightSE.point.x,y:C>L?C:L}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(C){return C.x===this.leftSE.point.x&&C.y===this.leftSE.point.y||C.x===this.rightSE.point.x&&C.y===this.rightSE.point.y}comparePoint(C){if(this.isAnEndpoint(C))return 0;let L=this.leftSE.point,F=this.rightSE.point,J=this.vector();if(L.x===F.x)return C.x===L.x?0:C.x<L.x?1:-1;let X=(C.y-L.y)/J.y,pt=L.x+X*J.x;if(C.x===pt)return 0;let st=(C.x-L.x)/J.x,k=L.y+st*J.y;return C.y===k?0:C.y<k?-1:1}getIntersection(C){let L=this.bbox(),F=C.bbox(),J=M(L,F);if(J===null)return null;let X=this.leftSE.point,pt=this.rightSE.point,st=C.leftSE.point,k=C.rightSE.point,ut=I(L,st)&&this.comparePoint(st)===0,nt=I(F,X)&&C.comparePoint(X)===0,lt=I(L,k)&&this.comparePoint(k)===0,dt=I(F,pt)&&C.comparePoint(pt)===0;if(nt&&ut)return dt&&!lt?pt:!dt&<?k:null;if(nt)return lt&&X.x===k.x&&X.y===k.y?null:X;if(ut)return dt&&pt.x===st.x&&pt.y===st.y?null:st;if(dt&<)return null;if(dt)return pt;if(lt)return k;let at=Ee(X,this.vector(),st,C.vector());return at===null||!I(J,at)?null:$.round(at.x,at.y)}split(C){let L=[],F=C.events!==void 0,J=new ft(C,!0),X=new ft(C,!1),pt=this.rightSE;this.replaceRightSE(X),L.push(X),L.push(J);let st=new te(J,pt,this.rings.slice(),this.windings.slice());return ft.comparePoints(st.leftSE.point,st.rightSE.point)>0&&st.swapEvents(),ft.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),F&&(J.checkForConsuming(),X.checkForConsuming()),L}swapEvents(){let C=this.rightSE;this.rightSE=this.leftSE,this.leftSE=C,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let L=0,F=this.windings.length;L<F;L++)this.windings[L]*=-1}consume(C){let L=this,F=C;for(;L.consumedBy;)L=L.consumedBy;for(;F.consumedBy;)F=F.consumedBy;let J=te.compare(L,F);if(J!==0){if(J>0){let X=L;L=F,F=X}if(L.prev===F){let X=L;L=F,F=X}for(let X=0,pt=F.rings.length;X<pt;X++){let st=F.rings[X],k=F.windings[X],ut=L.rings.indexOf(st);ut===-1?(L.rings.push(st),L.windings.push(k)):L.windings[ut]+=k}F.rings=null,F.windings=null,F.consumedBy=L,F.leftSE.consumedBy=L.leftSE,F.rightSE.consumedBy=L.rightSE}}prevInResult(){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)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let C=this.prev.consumedBy||this.prev;this._beforeState=C.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let C=this.beforeState();this._afterState={rings:C.rings.slice(0),windings:C.windings.slice(0),multiPolys:[]};let L=this._afterState.rings,F=this._afterState.windings,J=this._afterState.multiPolys;for(let st=0,k=this.rings.length;st<k;st++){let ut=this.rings[st],nt=this.windings[st],lt=L.indexOf(ut);lt===-1?(L.push(ut),F.push(nt)):F[lt]+=nt}let X=[],pt=[];for(let st=0,k=L.length;st<k;st++){if(F[st]===0)continue;let ut=L[st],nt=ut.poly;if(pt.indexOf(nt)===-1)if(ut.isExterior)X.push(nt);else{pt.indexOf(nt)===-1&&pt.push(nt);let lt=X.indexOf(ut.poly);lt!==-1&&X.splice(lt,1)}}for(let st=0,k=X.length;st<k;st++){let ut=X[st].multiPoly;J.indexOf(ut)===-1&&J.push(ut)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let C=this.beforeState().multiPolys,L=this.afterState().multiPolys;switch(rt.type){case"union":{let F=C.length===0,J=L.length===0;this._isInResult=F!==J;break}case"intersection":{let F,J;C.length<L.length?(F=C.length,J=L.length):(F=L.length,J=C.length),this._isInResult=J===rt.numMultiPolys&&F<J;break}case"xor":{let F=Math.abs(C.length-L.length);this._isInResult=F%2===1;break}case"difference":{let F=J=>J.length===1&&J[0].isSubject;this._isInResult=F(C)!==F(L);break}default:throw new Error(\`Unrecognized operation type found \${rt.type}\`)}return this._isInResult}}class fe{constructor(C,L,F){if(!Array.isArray(C)||C.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=L,this.isExterior=F,this.segments=[],typeof C[0][0]!="number"||typeof C[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let J=$.round(C[0][0],C[0][1]);this.bbox={ll:{x:J.x,y:J.y},ur:{x:J.x,y:J.y}};let X=J;for(let pt=1,st=C.length;pt<st;pt++){if(typeof C[pt][0]!="number"||typeof C[pt][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let k=$.round(C[pt][0],C[pt][1]);k.x===X.x&&k.y===X.y||(this.segments.push(te.fromRing(X,k,this)),k.x<this.bbox.ll.x&&(this.bbox.ll.x=k.x),k.y<this.bbox.ll.y&&(this.bbox.ll.y=k.y),k.x>this.bbox.ur.x&&(this.bbox.ur.x=k.x),k.y>this.bbox.ur.y&&(this.bbox.ur.y=k.y),X=k)}(J.x!==X.x||J.y!==X.y)&&this.segments.push(te.fromRing(X,J,this))}getSweepEvents(){let C=[];for(let L=0,F=this.segments.length;L<F;L++){let J=this.segments[L];C.push(J.leftSE),C.push(J.rightSE)}return C}}class de{constructor(C,L){if(!Array.isArray(C))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new fe(C[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(let F=1,J=C.length;F<J;F++){let X=new fe(C[F],this,!1);X.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=X.bbox.ll.x),X.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=X.bbox.ll.y),X.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=X.bbox.ur.x),X.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=X.bbox.ur.y),this.interiorRings.push(X)}this.multiPoly=L}getSweepEvents(){let C=this.exteriorRing.getSweepEvents();for(let L=0,F=this.interiorRings.length;L<F;L++){let J=this.interiorRings[L].getSweepEvents();for(let X=0,pt=J.length;X<pt;X++)C.push(J[X])}return C}}class Ue{constructor(C,L){if(!Array.isArray(C))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof C[0][0][0]=="number"&&(C=[C])}catch(F){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let F=0,J=C.length;F<J;F++){let X=new de(C[F],this);X.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=X.bbox.ll.x),X.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=X.bbox.ll.y),X.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=X.bbox.ur.x),X.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=X.bbox.ur.y),this.polys.push(X)}this.isSubject=L}getSweepEvents(){let C=[];for(let L=0,F=this.polys.length;L<F;L++){let J=this.polys[L].getSweepEvents();for(let X=0,pt=J.length;X<pt;X++)C.push(J[X])}return C}}class be{static factory(C){let L=[];for(let F=0,J=C.length;F<J;F++){let X=C[F];if(!X.isInResult()||X.ringOut)continue;let pt=null,st=X.leftSE,k=X.rightSE,ut=[st],nt=st.point,lt=[];for(;pt=st,st=k,ut.push(st),st.point!==nt;)for(;;){let dt=st.getAvailableLinkedEvents();if(dt.length===0){let qt=ut[0].point,we=ut[ut.length-1].point;throw new Error(\`Unable to complete output ring starting at [\${qt.x}, \${qt.y}]. Last matching segment found ends at [\${we.x}, \${we.y}].\`)}if(dt.length===1){k=dt[0].otherSE;break}let at=null;for(let qt=0,we=lt.length;qt<we;qt++)if(lt[qt].point===st.point){at=qt;break}if(at!==null){let qt=lt.splice(at)[0],we=ut.splice(qt.index);we.unshift(we[0].otherSE),L.push(new be(we.reverse()));continue}lt.push({index:ut.length,point:st.point});let Bt=st.getLeftmostComparator(pt);k=dt.sort(Bt)[0].otherSE;break}L.push(new be(ut))}return L}constructor(C){this.events=C;for(let L=0,F=C.length;L<F;L++)C[L].segment.ringOut=this;this.poly=null}getGeom(){let C=this.events[0].point,L=[C];for(let ut=1,nt=this.events.length-1;ut<nt;ut++){let lt=this.events[ut].point,dt=this.events[ut+1].point;$t(lt,C,dt)!==0&&(L.push(lt),C=lt)}if(L.length===1)return null;let F=L[0],J=L[1];$t(F,C,J)===0&&L.shift(),L.push(L[0]);let X=this.isExteriorRing()?1:-1,pt=this.isExteriorRing()?0:L.length-1,st=this.isExteriorRing()?L.length:-1,k=[];for(let ut=pt;ut!=st;ut+=X)k.push([L[ut].x,L[ut].y]);return k}isExteriorRing(){if(this._isExteriorRing===void 0){let C=this.enclosingRing();this._isExteriorRing=C?!C.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let C=this.events[0];for(let J=1,X=this.events.length;J<X;J++){let pt=this.events[J];ft.compare(C,pt)>0&&(C=pt)}let L=C.segment.prevInResult(),F=L?L.prevInResult():null;for(;;){if(!L)return null;if(!F)return L.ringOut;if(F.ringOut!==L.ringOut)return F.ringOut.enclosingRing()!==L.ringOut?L.ringOut:L.ringOut.enclosingRing();L=F.prevInResult(),F=L?L.prevInResult():null}}}class kt{constructor(C){this.exteriorRing=C,C.poly=this,this.interiorRings=[]}addInterior(C){this.interiorRings.push(C),C.poly=this}getGeom(){let C=[this.exteriorRing.getGeom()];if(C[0]===null)return null;for(let L=0,F=this.interiorRings.length;L<F;L++){let J=this.interiorRings[L].getGeom();J!==null&&C.push(J)}return C}}class ye{constructor(C){this.rings=C,this.polys=this._composePolys(C)}getGeom(){let C=[];for(let L=0,F=this.polys.length;L<F;L++){let J=this.polys[L].getGeom();J!==null&&C.push(J)}return C}_composePolys(C){let L=[];for(let F=0,J=C.length;F<J;F++){let X=C[F];if(!X.poly)if(X.isExteriorRing())L.push(new kt(X));else{let pt=X.enclosingRing();pt.poly||L.push(new kt(pt)),pt.poly.addInterior(X)}}return L}}class Vn{constructor(C){let L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:te.compare;this.queue=C,this.tree=new g(L),this.segments=[]}process(C){let L=C.segment,F=[];if(C.consumedBy)return C.isLeft?this.queue.remove(C.otherSE):this.tree.remove(L),F;let J=C.isLeft?this.tree.add(L):this.tree.find(L);if(!J)throw new Error(\`Unable to find segment #\${L.id} [\${L.leftSE.point.x}, \${L.leftSE.point.y}] -> [\${L.rightSE.point.x}, \${L.rightSE.point.y}] in SweepLine tree.\`);let X=J,pt=J,st,k;for(;st===void 0;)X=this.tree.prev(X),X===null?st=null:X.key.consumedBy===void 0&&(st=X.key);for(;k===void 0;)pt=this.tree.next(pt),pt===null?k=null:pt.key.consumedBy===void 0&&(k=pt.key);if(C.isLeft){let ut=null;if(st){let lt=st.getIntersection(L);if(lt!==null&&(L.isAnEndpoint(lt)||(ut=lt),!st.isAnEndpoint(lt))){let dt=this._splitSafely(st,lt);for(let at=0,Bt=dt.length;at<Bt;at++)F.push(dt[at])}}let nt=null;if(k){let lt=k.getIntersection(L);if(lt!==null&&(L.isAnEndpoint(lt)||(nt=lt),!k.isAnEndpoint(lt))){let dt=this._splitSafely(k,lt);for(let at=0,Bt=dt.length;at<Bt;at++)F.push(dt[at])}}if(ut!==null||nt!==null){let lt=null;ut===null?lt=nt:nt===null?lt=ut:lt=ft.comparePoints(ut,nt)<=0?ut:nt,this.queue.remove(L.rightSE),F.push(L.rightSE);let dt=L.split(lt);for(let at=0,Bt=dt.length;at<Bt;at++)F.push(dt[at])}F.length>0?(this.tree.remove(L),F.push(C)):(this.segments.push(L),L.prev=st)}else{if(st&&k){let ut=st.getIntersection(k);if(ut!==null){if(!st.isAnEndpoint(ut)){let nt=this._splitSafely(st,ut);for(let lt=0,dt=nt.length;lt<dt;lt++)F.push(nt[lt])}if(!k.isAnEndpoint(ut)){let nt=this._splitSafely(k,ut);for(let lt=0,dt=nt.length;lt<dt;lt++)F.push(nt[lt])}}}this.tree.remove(L)}return F}_splitSafely(C,L){this.tree.remove(C);let F=C.rightSE;this.queue.remove(F);let J=C.split(L);return J.push(F),C.consumedBy===void 0&&this.tree.add(C),J}}let $n=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,j=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class H{run(C,L,F){rt.type=C,$.reset();let J=[new Ue(L,!0)];for(let lt=0,dt=F.length;lt<dt;lt++)J.push(new Ue(F[lt],!1));if(rt.numMultiPolys=J.length,rt.type==="difference"){let lt=J[0],dt=1;for(;dt<J.length;)M(J[dt].bbox,lt.bbox)!==null?dt++:J.splice(dt,1)}if(rt.type==="intersection")for(let lt=0,dt=J.length;lt<dt;lt++){let at=J[lt];for(let Bt=lt+1,qt=J.length;Bt<qt;Bt++)if(M(at.bbox,J[Bt].bbox)===null)return[]}let X=new g(ft.compare);for(let lt=0,dt=J.length;lt<dt;lt++){let at=J[lt].getSweepEvents();for(let Bt=0,qt=at.length;Bt<qt;Bt++)if(X.insert(at[Bt]),X.size>$n)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let pt=new Vn(X),st=X.size,k=X.pop();for(;k;){let lt=k.key;if(X.size===st){let at=lt.segment;throw new Error(\`Unable to pop() \${lt.isLeft?"left":"right"} SweepEvent [\${lt.point.x}, \${lt.point.y}] from segment #\${at.id} [\${at.leftSE.point.x}, \${at.leftSE.point.y}] -> [\${at.rightSE.point.x}, \${at.rightSE.point.y}] from queue.\`)}if(X.size>$n)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(pt.segments.length>j)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let dt=pt.process(lt);for(let at=0,Bt=dt.length;at<Bt;at++){let qt=dt[at];qt.consumedBy===void 0&&X.insert(qt)}st=X.size,k=X.pop()}$.reset();let ut=be.factory(pt.segments);return new ye(ut).getGeom()}}let rt=new H;var Kt={union:function(tt){for(var C=arguments.length,L=new Array(C>1?C-1:0),F=1;F<C;F++)L[F-1]=arguments[F];return rt.run("union",tt,L)},intersection:function(tt){for(var C=arguments.length,L=new Array(C>1?C-1:0),F=1;F<C;F++)L[F-1]=arguments[F];return rt.run("intersection",tt,L)},xor:function(tt){for(var C=arguments.length,L=new Array(C>1?C-1:0),F=1;F<C;F++)L[F-1]=arguments[F];return rt.run("xor",tt,L)},difference:function(tt){for(var C=arguments.length,L=new Array(C>1?C-1:0),F=1;F<C;F++)L[F-1]=arguments[F];return rt.run("difference",tt,L)}};return Kt})});var HM=ce((qp,kM)=>{(function(r,t){typeof qp=="object"&&typeof kM!="undefined"?t(qp):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(qp,function(r){"use strict";function t(){}function e(n){this.message=n||""}function o(n){this.message=n||""}function a(n){this.message=n||""}function c(){}function p(n){return n===null?Qn:n.color}function d(n){return n===null?null:n.parent}function g(n,i){n!==null&&(n.color=i)}function y(n){return n===null?null:n.left}function _(n){return n===null?null:n.right}function w(){this.root_=null,this.size_=0}function x(){}function b(){this.array_=[],arguments[0]instanceof st&&this.addAll(arguments[0])}function P(){}function I(n){this.message=n||""}function M(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(n){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),s=Math.max(Math.min(i.length,9007199254740991),0)||0,l=1 in arguments&&parseInt(Number(arguments[1]),10)||0;l=l<0?Math.max(s+l,0):Math.min(l,s);var h=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:s;for(h=h<0?Math.max(s+arguments[2],0):Math.min(h,s);l<h;)i[l]=n,++l;return i},writable:!0}),Number.isFinite=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},Number.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(n){return n!=n},Math.trunc=Math.trunc||function(n){return n<0?Math.ceil(n):Math.floor(n)};var E=function(){};E.prototype.interfaces_=function(){return[]},E.prototype.getClass=function(){return E},E.prototype.equalsWithTolerance=function(n,i,s){return Math.abs(n-i)<=s};var N=function(n){function i(s){n.call(this,s),this.name="IllegalArgumentException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),A=function(){},U={MAX_VALUE:{configurable:!0}};A.isNaN=function(n){return Number.isNaN(n)},A.doubleToLongBits=function(n){return n},A.longBitsToDouble=function(n){return n},A.isInfinite=function(n){return!Number.isFinite(n)},U.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(A,U);var z=function(){},$=function(){},q=function(){},D=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])},G={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};D.prototype.setOrdinate=function(n,i){switch(n){case D.X:this.x=i;break;case D.Y:this.y=i;break;case D.Z:this.z=i;break;default:throw new N("Invalid ordinate index: "+n)}},D.prototype.equals2D=function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var i=arguments[0],s=arguments[1];return!!E.equalsWithTolerance(this.x,i.x,s)&&!!E.equalsWithTolerance(this.y,i.y,s)}},D.prototype.getOrdinate=function(n){switch(n){case D.X:return this.x;case D.Y:return this.y;case D.Z:return this.z}throw new N("Invalid ordinate index: "+n)},D.prototype.equals3D=function(n){return this.x===n.x&&this.y===n.y&&(this.z===n.z||A.isNaN(this.z))&&A.isNaN(n.z)},D.prototype.equals=function(n){return n instanceof D&&this.equals2D(n)},D.prototype.equalInZ=function(n,i){return E.equalsWithTolerance(this.z,n.z,i)},D.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},D.prototype.clone=function(){},D.prototype.copy=function(){return new D(this)},D.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},D.prototype.distance3D=function(n){var i=this.x-n.x,s=this.y-n.y,l=this.z-n.z;return Math.sqrt(i*i+s*s+l*l)},D.prototype.distance=function(n){var i=this.x-n.x,s=this.y-n.y;return Math.sqrt(i*i+s*s)},D.prototype.hashCode=function(){var n=17;return n=37*n+D.hashCode(this.x),n=37*n+D.hashCode(this.y)},D.prototype.setCoordinate=function(n){this.x=n.x,this.y=n.y,this.z=n.z},D.prototype.interfaces_=function(){return[z,$,t]},D.prototype.getClass=function(){return D},D.hashCode=function(){if(arguments.length===1){var n=arguments[0],i=A.doubleToLongBits(n);return Math.trunc((i^i)>>>32)}},G.DimensionalComparator.get=function(){return Q},G.serialVersionUID.get=function(){return 6683108902428367e3},G.NULL_ORDINATE.get=function(){return A.NaN},G.X.get=function(){return 0},G.Y.get=function(){return 1},G.Z.get=function(){return 2},Object.defineProperties(D,G);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 N("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};Q.prototype.compare=function(n,i){var s=n,l=i,h=Q.compare(s.x,l.x);if(h!==0)return h;var v=Q.compare(s.y,l.y);return v!==0?v:this._dimensionsToTest<=2?0:Q.compare(s.z,l.z)},Q.prototype.interfaces_=function(){return[q]},Q.prototype.getClass=function(){return Q},Q.compare=function(n,i){return n<i?-1:n>i?1:A.isNaN(n)?A.isNaN(i)?0:-1:A.isNaN(i)?1:0};var _t=function(){};_t.prototype.create=function(){},_t.prototype.interfaces_=function(){return[]},_t.prototype.getClass=function(){return _t};var Z=function(){},Dt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Z.prototype.interfaces_=function(){return[]},Z.prototype.getClass=function(){return Z},Z.toLocationSymbol=function(n){switch(n){case Z.EXTERIOR:return"e";case Z.BOUNDARY:return"b";case Z.INTERIOR:return"i";case Z.NONE:return"-"}throw new N("Unknown location value: "+n)},Dt.INTERIOR.get=function(){return 0},Dt.BOUNDARY.get=function(){return 1},Dt.EXTERIOR.get=function(){return 2},Dt.NONE.get=function(){return-1},Object.defineProperties(Z,Dt);var et=function(n,i){return n.interfaces_&&n.interfaces_().indexOf(i)>-1},vt=function(){},It={LOG_10:{configurable:!0}};vt.prototype.interfaces_=function(){return[]},vt.prototype.getClass=function(){return vt},vt.log10=function(n){var i=Math.log(n);return A.isInfinite(i)||A.isNaN(i)?i:i/vt.LOG_10},vt.min=function(n,i,s,l){var h=n;return i<h&&(h=i),s<h&&(h=s),l<h&&(h=l),h},vt.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1],s=arguments[2];return n<i?i:n>s?s:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var l=arguments[0],h=arguments[1],v=arguments[2];return l<h?h:l>v?v:l}},vt.wrap=function(n,i){return n<0?i- -n%i:n%i},vt.max=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],l=n;return i>l&&(l=i),s>l&&(l=s),l}if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3],V=h;return v>V&&(V=v),S>V&&(V=S),R>V&&(V=R),V}},vt.average=function(n,i){return(n+i)/2},It.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(vt,It);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 yt=function(){};yt.isWhitespace=function(n){return n<=32&&n>=0||n===127},yt.toUpperCase=function(n){return n.toUpperCase()};var Y=function n(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}else if(typeof arguments[0]=="string"){var l=arguments[0];n.call(this,n.parse(l))}}else if(arguments.length===2){var h=arguments[0],v=arguments[1];this.init(h,v)}},ht={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}};Y.prototype.le=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<=n._lo},Y.prototype.extractSignificantDigits=function(n,i){var s=this.abs(),l=Y.magnitude(s._hi),h=Y.TEN.pow(l);(s=s.divide(h)).gt(Y.TEN)?(s=s.divide(Y.TEN),l+=1):s.lt(Y.ONE)&&(s=s.multiply(Y.TEN),l-=1);for(var v=l+1,S=new Pt,R=Y.MAX_PRINT_DIGITS-1,V=0;V<=R;V++){n&&V===v&&S.append(".");var ot=Math.trunc(s._hi);if(ot<0)break;var St=!1,bt=0;ot>9?(St=!0,bt="9"):bt="0"+ot,S.append(bt),s=s.subtract(Y.valueOf(ot)).multiply(Y.TEN),St&&s.selfAdd(Y.TEN);var Yt=!0,Jt=Y.magnitude(s._hi);if(Jt<0&&Math.abs(Jt)>=R-V&&(Yt=!1),!Yt)break}return i[0]=l,S.toString()},Y.prototype.sqr=function(){return this.multiply(this)},Y.prototype.doubleValue=function(){return this._hi+this._lo},Y.prototype.subtract=function(){if(arguments[0]instanceof Y){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},Y.prototype.equals=function(){if(arguments.length===1){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}},Y.prototype.isZero=function(){return this._hi===0&&this._lo===0},Y.prototype.selfSubtract=function(){if(arguments[0]instanceof Y){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)}},Y.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},Y.prototype.min=function(n){return this.le(n)?this:n},Y.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof Y){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1],h=null,v=null,S=null,R=null,V=null,ot=null,St=null,bt=null;return V=this._hi/s,ot=Y.SPLIT*V,h=ot-V,bt=Y.SPLIT*s,h=ot-h,v=V-h,S=bt-s,St=V*s,S=bt-S,R=s-S,bt=h*S-St+h*R+v*S+v*R,ot=(this._hi-St-bt+this._lo-V*l)/s,bt=V+ot,this._hi=bt,this._lo=V-bt+ot,this}},Y.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},Y.prototype.divide=function(){if(arguments[0]instanceof Y){var n=arguments[0],i=null,s=null,l=null,h=null,v=null,S=null,R=null,V=null;return s=(v=this._hi/n._hi)-(i=(S=Y.SPLIT*v)-(i=S-v)),V=i*(l=(V=Y.SPLIT*n._hi)-(l=V-n._hi))-(R=v*n._hi)+i*(h=n._hi-l)+s*l+s*h,S=(this._hi-R-V+this._lo-v*n._lo)/n._hi,new Y(V=v+S,v-V+S)}if(typeof arguments[0]=="number"){var ot=arguments[0];return A.isNaN(ot)?Y.createNaN():Y.copy(this).selfDivide(ot,0)}},Y.prototype.ge=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>=n._lo},Y.prototype.pow=function(n){if(n===0)return Y.valueOf(1);var i=new Y(this),s=Y.valueOf(1),l=Math.abs(n);if(l>1)for(;l>0;)l%2==1&&s.selfMultiply(i),(l/=2)>0&&(i=i.sqr());else s=i;return n<0?s.reciprocal():s},Y.prototype.ceil=function(){if(this.isNaN())return Y.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new Y(n,i)},Y.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},Y.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},Y.prototype.setValue=function(){if(arguments[0]instanceof Y){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},Y.prototype.max=function(n){return this.ge(n)?this:n},Y.prototype.sqrt=function(){if(this.isZero())return Y.valueOf(0);if(this.isNegative())return Y.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,s=Y.valueOf(i),l=this.subtract(s.sqr())._hi*(.5*n);return s.add(l)},Y.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof Y){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],s=null,l=null,h=null,v=null,S=null,R=null;return h=this._hi+i,S=h-this._hi,v=h-S,v=i-S+(this._hi-v),R=v+this._lo,s=h+R,l=R+(h-s),this._hi=s+l,this._lo=l+(s-this._hi),this}}else if(arguments.length===2){var V=arguments[0],ot=arguments[1],St=null,bt=null,Yt=null,Jt=null,se=null,_e=null,Cn=null;Jt=this._hi+V,bt=this._lo+ot,se=Jt-(_e=Jt-this._hi),Yt=bt-(Cn=bt-this._lo);var Xn=(St=Jt+(_e=(se=V-_e+(this._hi-se))+bt))+(_e=(Yt=ot-Cn+(this._lo-Yt))+(_e+(Jt-St))),ui=_e+(St-Xn);return this._hi=Xn,this._lo=ui,this}},Y.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof Y){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1],h=null,v=null,S=null,R=null,V=null,ot=null;h=(V=Y.SPLIT*this._hi)-this._hi,ot=Y.SPLIT*s,h=V-h,v=this._hi-h,S=ot-s;var St=(V=this._hi*s)+(ot=h*(S=ot-S)-V+h*(R=s-S)+v*S+v*R+(this._hi*l+this._lo*s)),bt=ot+(h=V-St);return this._hi=St,this._lo=bt,this}},Y.prototype.selfSqr=function(){return this.selfMultiply(this)},Y.prototype.floor=function(){if(this.isNaN())return Y.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new Y(n,i)},Y.prototype.negate=function(){return this.isNaN()?this:new Y(-this._hi,-this._lo)},Y.prototype.clone=function(){},Y.prototype.multiply=function(){if(arguments[0]instanceof Y){var n=arguments[0];return n.isNaN()?Y.createNaN():Y.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return A.isNaN(i)?Y.createNaN():Y.copy(this).selfMultiply(i,0)}},Y.prototype.isNaN=function(){return A.isNaN(this._hi)},Y.prototype.intValue=function(){return Math.trunc(this._hi)},Y.prototype.toString=function(){var n=Y.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()},Y.prototype.toStandardNotation=function(){var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!0,i),l=i[0]+1,h=s;if(s.charAt(0)===".")h="0"+s;else if(l<0)h="0."+Y.stringOfChar("0",-l)+s;else if(s.indexOf(".")===-1){var v=l-s.length;h=s+Y.stringOfChar("0",v)+".0"}return this.isNegative()?"-"+h:h},Y.prototype.reciprocal=function(){var n=null,i=null,s=null,l=null,h=null,v=null,S=null,R=null;i=(h=1/this._hi)-(n=(v=Y.SPLIT*h)-(n=v-h)),s=(R=Y.SPLIT*this._hi)-this._hi;var V=h+(v=(1-(S=h*this._hi)-(R=n*(s=R-s)-S+n*(l=this._hi-s)+i*s+i*l)-h*this._lo)/this._hi);return new Y(V,h-V+v)},Y.prototype.toSciNotation=function(){if(this.isZero())return Y.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!1,i),l=Y.SCI_NOT_EXPONENT_CHAR+i[0];if(s.charAt(0)==="0")throw new Error("Found leading zero: "+s);var h="";s.length>1&&(h=s.substring(1));var v=s.charAt(0)+"."+h;return this.isNegative()?"-"+v+l:v+l},Y.prototype.abs=function(){return this.isNaN()?Y.NaN:this.isNegative()?this.negate():new Y(this)},Y.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},Y.prototype.lt=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<n._lo},Y.prototype.add=function(){if(arguments[0]instanceof Y){var n=arguments[0];return Y.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return Y.copy(this).selfAdd(i)}},Y.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 Y){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this._hi=s,this._lo=l}},Y.prototype.gt=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>n._lo},Y.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},Y.prototype.trunc=function(){return this.isNaN()?Y.NaN:this.isPositive()?this.floor():this.ceil()},Y.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},Y.prototype.interfaces_=function(){return[t,z,$]},Y.prototype.getClass=function(){return Y},Y.sqr=function(n){return Y.valueOf(n).selfMultiply(n)},Y.valueOf=function(){if(typeof arguments[0]=="string"){var n=arguments[0];return Y.parse(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return new Y(i)}},Y.sqrt=function(n){return Y.valueOf(n).sqrt()},Y.parse=function(n){for(var i=0,s=n.length;yt.isWhitespace(n.charAt(i));)i++;var l=!1;if(i<s){var h=n.charAt(i);h!=="-"&&h!=="+"||(i++,h==="-"&&(l=!0))}for(var v=new Y,S=0,R=0,V=0;!(i>=s);){var ot=n.charAt(i);if(i++,yt.isDigit(ot)){var St=ot-"0";v.selfMultiply(Y.TEN),v.selfAdd(St),S++}else{if(ot!=="."){if(ot==="e"||ot==="E"){var bt=n.substring(i);try{V=Et.parseInt(bt)}catch(Cn){throw Cn instanceof Error?new Error("Invalid exponent "+bt+" in string "+n):Cn}break}throw new Error("Unexpected character '"+ot+"' at position "+i+" in string "+n)}R=S}}var Yt=v,Jt=S-R-V;if(Jt===0)Yt=v;else if(Jt>0){var se=Y.TEN.pow(Jt);Yt=v.divide(se)}else if(Jt<0){var _e=Y.TEN.pow(-Jt);Yt=v.multiply(_e)}return l?Yt.negate():Yt},Y.createNaN=function(){return new Y(A.NaN,A.NaN)},Y.copy=function(n){return new Y(n)},Y.magnitude=function(n){var i=Math.abs(n),s=Math.log(i)/Math.log(10),l=Math.trunc(Math.floor(s));return 10*Math.pow(10,l)<=i&&(l+=1),l},Y.stringOfChar=function(n,i){for(var s=new Pt,l=0;l<i;l++)s.append(n);return s.toString()},ht.PI.get=function(){return new Y(3.141592653589793,12246467991473532e-32)},ht.TWO_PI.get=function(){return new Y(6.283185307179586,24492935982947064e-32)},ht.PI_2.get=function(){return new Y(1.5707963267948966,6123233995736766e-32)},ht.E.get=function(){return new Y(2.718281828459045,14456468917292502e-32)},ht.NaN.get=function(){return new Y(A.NaN,A.NaN)},ht.EPS.get=function(){return 123259516440783e-46},ht.SPLIT.get=function(){return 134217729},ht.MAX_PRINT_DIGITS.get=function(){return 32},ht.TEN.get=function(){return Y.valueOf(10)},ht.ONE.get=function(){return Y.valueOf(1)},ht.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},ht.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(Y,ht);var Mt=function(){},zt={DP_SAFE_EPSILON:{configurable:!0}};Mt.prototype.interfaces_=function(){return[]},Mt.prototype.getClass=function(){return Mt},Mt.orientationIndex=function(n,i,s){var l=Mt.orientationIndexFilter(n,i,s);if(l<=1)return l;var h=Y.valueOf(i.x).selfAdd(-n.x),v=Y.valueOf(i.y).selfAdd(-n.y),S=Y.valueOf(s.x).selfAdd(-i.x),R=Y.valueOf(s.y).selfAdd(-i.y);return h.selfMultiply(R).selfSubtract(v.selfMultiply(S)).signum()},Mt.signOfDet2x2=function(n,i,s,l){return n.multiply(l).selfSubtract(i.multiply(s)).signum()},Mt.intersection=function(n,i,s,l){var h=Y.valueOf(l.y).selfSubtract(s.y).selfMultiply(Y.valueOf(i.x).selfSubtract(n.x)),v=Y.valueOf(l.x).selfSubtract(s.x).selfMultiply(Y.valueOf(i.y).selfSubtract(n.y)),S=h.subtract(v),R=Y.valueOf(l.x).selfSubtract(s.x).selfMultiply(Y.valueOf(n.y).selfSubtract(s.y)),V=Y.valueOf(l.y).selfSubtract(s.y).selfMultiply(Y.valueOf(n.x).selfSubtract(s.x)),ot=R.subtract(V).selfDivide(S).doubleValue(),St=Y.valueOf(n.x).selfAdd(Y.valueOf(i.x).selfSubtract(n.x).selfMultiply(ot)).doubleValue(),bt=Y.valueOf(i.x).selfSubtract(n.x).selfMultiply(Y.valueOf(n.y).selfSubtract(s.y)),Yt=Y.valueOf(i.y).selfSubtract(n.y).selfMultiply(Y.valueOf(n.x).selfSubtract(s.x)),Jt=bt.subtract(Yt).selfDivide(S).doubleValue(),se=Y.valueOf(s.y).selfAdd(Y.valueOf(l.y).selfSubtract(s.y).selfMultiply(Jt)).doubleValue();return new D(St,se)},Mt.orientationIndexFilter=function(n,i,s){var l=null,h=(n.x-s.x)*(i.y-s.y),v=(n.y-s.y)*(i.x-s.x),S=h-v;if(h>0){if(v<=0)return Mt.signum(S);l=h+v}else{if(!(h<0)||v>=0)return Mt.signum(S);l=-h-v}var R=Mt.DP_SAFE_EPSILON*l;return S>=R||-S>=R?Mt.signum(S):2},Mt.signum=function(n){return n>0?1:n<0?-1:0},zt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Mt,zt);var At=function(){},$t={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};$t.X.get=function(){return 0},$t.Y.get=function(){return 1},$t.Z.get=function(){return 2},$t.M.get=function(){return 3},At.prototype.setOrdinate=function(n,i,s){},At.prototype.size=function(){},At.prototype.getOrdinate=function(n,i){},At.prototype.getCoordinate=function(){},At.prototype.getCoordinateCopy=function(n){},At.prototype.getDimension=function(){},At.prototype.getX=function(n){},At.prototype.clone=function(){},At.prototype.expandEnvelope=function(n){},At.prototype.copy=function(){},At.prototype.getY=function(n){},At.prototype.toCoordinateArray=function(){},At.prototype.interfaces_=function(){return[$]},At.prototype.getClass=function(){return At},Object.defineProperties(At,$t);var ue=function(){},le=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}(ue),Qt=function(){};Qt.arraycopy=function(n,i,s,l,h){for(var v=0,S=i;S<i+h;S++)s[l+v]=n[S],v++},Qt.getProperty=function(n){return{"line.separator":\`
|
|
@@ -3702,136 +3702,7 @@ void main() {
|
|
|
3702
3702
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3703
3703
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3704
3704
|
}\`;function UO(r,t,e){let o=new Yh,a=new tr,c=new tr,p=new Xi,d=new Jg({depthPacking:VI}),g=new Kg,y={},_=e.maxTextureSize,w={[Mu]:Vo,[Vo]:Mu,[Wa]:Wa},x=new Za({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new tr},radius:{value:4}},vertexShader:DO,fragmentShader:FO}),b=x.clone();b.defines.HORIZONTAL_PASS=1;let P=new il;P.setAttribute("position",new Ps(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let I=new fa(P,x),M=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=I1;let E=this.type;this.render=function(z,$,q){if(M.enabled===!1||M.autoUpdate===!1&&M.needsUpdate===!1||z.length===0)return;let D=r.getRenderTarget(),G=r.getActiveCubeFace(),Q=r.getActiveMipmapLevel(),_t=r.state;_t.setBlending(xu),_t.buffers.color.setClear(1,1,1,1),_t.buffers.depth.setTest(!0),_t.setScissorTest(!1);let Z=E!==Ha&&this.type===Ha,Dt=E===Ha&&this.type!==Ha;for(let et=0,vt=z.length;et<vt;et++){let It=z[et],Pt=It.shadow;if(Pt===void 0){console.warn("THREE.WebGLShadowMap:",It,"has no shadow.");continue}if(Pt.autoUpdate===!1&&Pt.needsUpdate===!1)continue;a.copy(Pt.mapSize);let Et=Pt.getFrameExtents();if(a.multiply(Et),c.copy(Pt.mapSize),(a.x>_||a.y>_)&&(a.x>_&&(c.x=Math.floor(_/Et.x),a.x=c.x*Et.x,Pt.mapSize.x=c.x),a.y>_&&(c.y=Math.floor(_/Et.y),a.y=c.y*Et.y,Pt.mapSize.y=c.y)),Pt.map===null||Z===!0||Dt===!0){let Y=this.type!==Ha?{minFilter:_o,magFilter:_o}:{};Pt.map!==null&&Pt.map.dispose(),Pt.map=new $a(a.x,a.y,Y),Pt.map.texture.name=It.name+".shadowMap",Pt.camera.updateProjectionMatrix()}r.setRenderTarget(Pt.map),r.clear();let yt=Pt.getViewportCount();for(let Y=0;Y<yt;Y++){let ht=Pt.getViewport(Y);p.set(c.x*ht.x,c.y*ht.y,c.x*ht.z,c.y*ht.w),_t.viewport(p),Pt.updateMatrices(It,Y),o=Pt.getFrustum(),U($,q,Pt.camera,It,this.type)}Pt.isPointLightShadow!==!0&&this.type===Ha&&N(Pt,q),Pt.needsUpdate=!1}E=this.type,M.needsUpdate=!1,r.setRenderTarget(D,G,Q)};function N(z,$){let q=t.update(I);x.defines.VSM_SAMPLES!==z.blurSamples&&(x.defines.VSM_SAMPLES=z.blurSamples,b.defines.VSM_SAMPLES=z.blurSamples,x.needsUpdate=!0,b.needsUpdate=!0),z.mapPass===null&&(z.mapPass=new $a(a.x,a.y)),x.uniforms.shadow_pass.value=z.map.texture,x.uniforms.resolution.value=z.mapSize,x.uniforms.radius.value=z.radius,r.setRenderTarget(z.mapPass),r.clear(),r.renderBufferDirect($,null,q,x,I,null),b.uniforms.shadow_pass.value=z.mapPass.texture,b.uniforms.resolution.value=z.mapSize,b.uniforms.radius.value=z.radius,r.setRenderTarget(z.map),r.clear(),r.renderBufferDirect($,null,q,b,I,null)}function A(z,$,q,D){let G=null,Q=q.isPointLight===!0?z.customDistanceMaterial:z.customDepthMaterial;if(Q!==void 0)G=Q;else if(G=q.isPointLight===!0?g:d,r.localClippingEnabled&&$.clipShadows===!0&&Array.isArray($.clippingPlanes)&&$.clippingPlanes.length!==0||$.displacementMap&&$.displacementScale!==0||$.alphaMap&&$.alphaTest>0||$.map&&$.alphaTest>0){let _t=G.uuid,Z=$.uuid,Dt=y[_t];Dt===void 0&&(Dt={},y[_t]=Dt);let et=Dt[Z];et===void 0&&(et=G.clone(),Dt[Z]=et),G=et}if(G.visible=$.visible,G.wireframe=$.wireframe,D===Ha?G.side=$.shadowSide!==null?$.shadowSide:$.side:G.side=$.shadowSide!==null?$.shadowSide:w[$.side],G.alphaMap=$.alphaMap,G.alphaTest=$.alphaTest,G.map=$.map,G.clipShadows=$.clipShadows,G.clippingPlanes=$.clippingPlanes,G.clipIntersection=$.clipIntersection,G.displacementMap=$.displacementMap,G.displacementScale=$.displacementScale,G.displacementBias=$.displacementBias,G.wireframeLinewidth=$.wireframeLinewidth,G.linewidth=$.linewidth,q.isPointLight===!0&&G.isMeshDistanceMaterial===!0){let _t=r.properties.get(G);_t.light=q}return G}function U(z,$,q,D,G){if(z.visible===!1)return;if(z.layers.test($.layers)&&(z.isMesh||z.isLine||z.isPoints)&&(z.castShadow||z.receiveShadow&&G===Ha)&&(!z.frustumCulled||o.intersectsObject(z))){z.modelViewMatrix.multiplyMatrices(q.matrixWorldInverse,z.matrixWorld);let Z=t.update(z),Dt=z.material;if(Array.isArray(Dt)){let et=Z.groups;for(let vt=0,It=et.length;vt<It;vt++){let Pt=et[vt],Et=Dt[Pt.materialIndex];if(Et&&Et.visible){let yt=A(z,Et,D,G);r.renderBufferDirect(q,null,Z,yt,z,Pt)}}}else if(Dt.visible){let et=A(z,Dt,D,G);r.renderBufferDirect(q,null,Z,et,z,null)}}let _t=z.children;for(let Z=0,Dt=_t.length;Z<Dt;Z++)U(_t[Z],$,q,D,G)}}function BO(r,t,e){let o=e.isWebGL2;function a(){let k=!1,ut=new Xi,nt=null,lt=new Xi(0,0,0,0);return{setMask:function(dt){nt!==dt&&!k&&(r.colorMask(dt,dt,dt,dt),nt=dt)},setLocked:function(dt){k=dt},setClear:function(dt,at,Bt,qt,we){we===!0&&(dt*=qt,at*=qt,Bt*=qt),ut.set(dt,at,Bt,qt),lt.equals(ut)===!1&&(r.clearColor(dt,at,Bt,qt),lt.copy(ut))},reset:function(){k=!1,nt=null,lt.set(-1,0,0,0)}}}function c(){let k=!1,ut=null,nt=null,lt=null;return{setTest:function(dt){dt?le(r.DEPTH_TEST):Qt(r.DEPTH_TEST)},setMask:function(dt){ut!==dt&&!k&&(r.depthMask(dt),ut=dt)},setFunc:function(dt){if(nt!==dt){switch(dt){case vI:r.depthFunc(r.NEVER);break;case _I:r.depthFunc(r.ALWAYS);break;case xI:r.depthFunc(r.LESS);break;case Pg:r.depthFunc(r.LEQUAL);break;case EI:r.depthFunc(r.EQUAL);break;case wI:r.depthFunc(r.GEQUAL);break;case MI:r.depthFunc(r.GREATER);break;case SI:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}nt=dt}},setLocked:function(dt){k=dt},setClear:function(dt){lt!==dt&&(r.clearDepth(dt),lt=dt)},reset:function(){k=!1,ut=null,nt=null,lt=null}}}function p(){let k=!1,ut=null,nt=null,lt=null,dt=null,at=null,Bt=null,qt=null,we=null;return{setTest:function(oe){k||(oe?le(r.STENCIL_TEST):Qt(r.STENCIL_TEST))},setMask:function(oe){ut!==oe&&!k&&(r.stencilMask(oe),ut=oe)},setFunc:function(oe,Ve,je){(nt!==oe||lt!==Ve||dt!==je)&&(r.stencilFunc(oe,Ve,je),nt=oe,lt=Ve,dt=je)},setOp:function(oe,Ve,je){(at!==oe||Bt!==Ve||qt!==je)&&(r.stencilOp(oe,Ve,je),at=oe,Bt=Ve,qt=je)},setLocked:function(oe){k=oe},setClear:function(oe){we!==oe&&(r.clearStencil(oe),we=oe)},reset:function(){k=!1,ut=null,nt=null,lt=null,dt=null,at=null,Bt=null,qt=null,we=null}}}let d=new a,g=new c,y=new p,_=new WeakMap,w=new WeakMap,x={},b={},P=new WeakMap,I=[],M=null,E=!1,N=null,A=null,U=null,z=null,$=null,q=null,D=null,G=!1,Q=null,_t=null,Z=null,Dt=null,et=null,vt=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS),It=!1,Pt=0,Et=r.getParameter(r.VERSION);Et.indexOf("WebGL")!==-1?(Pt=parseFloat(/^WebGL (\\d)/.exec(Et)[1]),It=Pt>=1):Et.indexOf("OpenGL ES")!==-1&&(Pt=parseFloat(/^OpenGL ES (\\d)/.exec(Et)[1]),It=Pt>=2);let yt=null,Y={},ht=r.getParameter(r.SCISSOR_BOX),Mt=r.getParameter(r.VIEWPORT),zt=new Xi().fromArray(ht),At=new Xi().fromArray(Mt);function $t(k,ut,nt,lt){let dt=new Uint8Array(4),at=r.createTexture();r.bindTexture(k,at),r.texParameteri(k,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(k,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Bt=0;Bt<nt;Bt++)o&&(k===r.TEXTURE_3D||k===r.TEXTURE_2D_ARRAY)?r.texImage3D(ut,0,r.RGBA,1,1,lt,0,r.RGBA,r.UNSIGNED_BYTE,dt):r.texImage2D(ut+Bt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,dt);return at}let ue={};ue[r.TEXTURE_2D]=$t(r.TEXTURE_2D,r.TEXTURE_2D,1),ue[r.TEXTURE_CUBE_MAP]=$t(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),o&&(ue[r.TEXTURE_2D_ARRAY]=$t(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),ue[r.TEXTURE_3D]=$t(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),d.setClear(0,0,0,1),g.setClear(1),y.setClear(0),le(r.DEPTH_TEST),g.setFunc(Pg),de(!1),Ue(l_),le(r.CULL_FACE),te(xu);function le(k){x[k]!==!0&&(r.enable(k),x[k]=!0)}function Qt(k){x[k]!==!1&&(r.disable(k),x[k]=!1)}function me(k,ut){return b[k]!==ut?(r.bindFramebuffer(k,ut),b[k]=ut,o&&(k===r.DRAW_FRAMEBUFFER&&(b[r.FRAMEBUFFER]=ut),k===r.FRAMEBUFFER&&(b[r.DRAW_FRAMEBUFFER]=ut)),!0):!1}function Xt(k,ut){let nt=I,lt=!1;if(k)if(nt=P.get(ut),nt===void 0&&(nt=[],P.set(ut,nt)),k.isWebGLMultipleRenderTargets){let dt=k.texture;if(nt.length!==dt.length||nt[0]!==r.COLOR_ATTACHMENT0){for(let at=0,Bt=dt.length;at<Bt;at++)nt[at]=r.COLOR_ATTACHMENT0+at;nt.length=dt.length,lt=!0}}else nt[0]!==r.COLOR_ATTACHMENT0&&(nt[0]=r.COLOR_ATTACHMENT0,lt=!0);else nt[0]!==r.BACK&&(nt[0]=r.BACK,lt=!0);lt&&(e.isWebGL2?r.drawBuffers(nt):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(nt))}function Ee(k){return M!==k?(r.useProgram(k),M=k,!0):!1}let ft={[Wl]:r.FUNC_ADD,[aI]:r.FUNC_SUBTRACT,[uI]:r.FUNC_REVERSE_SUBTRACT};if(o)ft[p_]=r.MIN,ft[d_]=r.MAX;else{let k=t.get("EXT_blend_minmax");k!==null&&(ft[p_]=k.MIN_EXT,ft[d_]=k.MAX_EXT)}let He={[lI]:r.ZERO,[cI]:r.ONE,[fI]:r.SRC_COLOR,[R1]:r.SRC_ALPHA,[yI]:r.SRC_ALPHA_SATURATE,[gI]:r.DST_COLOR,[pI]:r.DST_ALPHA,[hI]:r.ONE_MINUS_SRC_COLOR,[L1]:r.ONE_MINUS_SRC_ALPHA,[mI]:r.ONE_MINUS_DST_COLOR,[dI]:r.ONE_MINUS_DST_ALPHA};function te(k,ut,nt,lt,dt,at,Bt,qt){if(k===xu){E===!0&&(Qt(r.BLEND),E=!1);return}if(E===!1&&(le(r.BLEND),E=!0),k!==sI){if(k!==N||qt!==G){if((A!==Wl||$!==Wl)&&(r.blendEquation(r.FUNC_ADD),A=Wl,$=Wl),qt)switch(k){case $l:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case c_:r.blendFunc(r.ONE,r.ONE);break;case f_:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case h_:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}else switch(k){case $l:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case c_:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case f_:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case h_:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}U=null,z=null,q=null,D=null,N=k,G=qt}return}dt=dt||ut,at=at||nt,Bt=Bt||lt,(ut!==A||dt!==$)&&(r.blendEquationSeparate(ft[ut],ft[dt]),A=ut,$=dt),(nt!==U||lt!==z||at!==q||Bt!==D)&&(r.blendFuncSeparate(He[nt],He[lt],He[at],He[Bt]),U=nt,z=lt,q=at,D=Bt),N=k,G=!1}function fe(k,ut){k.side===Wa?Qt(r.CULL_FACE):le(r.CULL_FACE);let nt=k.side===Vo;ut&&(nt=!nt),de(nt),k.blending===$l&&k.transparent===!1?te(xu):te(k.blending,k.blendEquation,k.blendSrc,k.blendDst,k.blendEquationAlpha,k.blendSrcAlpha,k.blendDstAlpha,k.premultipliedAlpha),g.setFunc(k.depthFunc),g.setTest(k.depthTest),g.setMask(k.depthWrite),d.setMask(k.colorWrite);let lt=k.stencilWrite;y.setTest(lt),lt&&(y.setMask(k.stencilWriteMask),y.setFunc(k.stencilFunc,k.stencilRef,k.stencilFuncMask),y.setOp(k.stencilFail,k.stencilZFail,k.stencilZPass)),kt(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits),k.alphaToCoverage===!0?le(r.SAMPLE_ALPHA_TO_COVERAGE):Qt(r.SAMPLE_ALPHA_TO_COVERAGE)}function de(k){Q!==k&&(k?r.frontFace(r.CW):r.frontFace(r.CCW),Q=k)}function Ue(k){k!==rI?(le(r.CULL_FACE),k!==_t&&(k===l_?r.cullFace(r.BACK):k===iI?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Qt(r.CULL_FACE),_t=k}function be(k){k!==Z&&(It&&r.lineWidth(k),Z=k)}function kt(k,ut,nt){k?(le(r.POLYGON_OFFSET_FILL),(Dt!==ut||et!==nt)&&(r.polygonOffset(ut,nt),Dt=ut,et=nt)):Qt(r.POLYGON_OFFSET_FILL)}function ye(k){k?le(r.SCISSOR_TEST):Qt(r.SCISSOR_TEST)}function Vn(k){k===void 0&&(k=r.TEXTURE0+vt-1),yt!==k&&(r.activeTexture(k),yt=k)}function $n(k,ut,nt){nt===void 0&&(yt===null?nt=r.TEXTURE0+vt-1:nt=yt);let lt=Y[nt];lt===void 0&&(lt={type:void 0,texture:void 0},Y[nt]=lt),(lt.type!==k||lt.texture!==ut)&&(yt!==nt&&(r.activeTexture(nt),yt=nt),r.bindTexture(k,ut||ue[k]),lt.type=k,lt.texture=ut)}function j(){let k=Y[yt];k!==void 0&&k.type!==void 0&&(r.bindTexture(k.type,null),k.type=void 0,k.texture=void 0)}function H(){try{r.compressedTexImage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function rt(){try{r.compressedTexImage3D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Wt(){try{r.texSubImage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Gt(){try{r.texSubImage3D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Ct(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function he(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Kt(){try{r.texStorage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function tt(){try{r.texStorage3D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function C(){try{r.texImage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function L(){try{r.texImage3D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function F(k){zt.equals(k)===!1&&(r.scissor(k.x,k.y,k.z,k.w),zt.copy(k))}function J(k){At.equals(k)===!1&&(r.viewport(k.x,k.y,k.z,k.w),At.copy(k))}function X(k,ut){let nt=w.get(ut);nt===void 0&&(nt=new WeakMap,w.set(ut,nt));let lt=nt.get(k);lt===void 0&&(lt=r.getUniformBlockIndex(ut,k.name),nt.set(k,lt))}function pt(k,ut){let lt=w.get(ut).get(k);_.get(ut)!==lt&&(r.uniformBlockBinding(ut,lt,k.__bindingPointIndex),_.set(ut,lt))}function st(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),o===!0&&(r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),x={},yt=null,Y={},b={},P=new WeakMap,I=[],M=null,E=!1,N=null,A=null,U=null,z=null,$=null,q=null,D=null,G=!1,Q=null,_t=null,Z=null,Dt=null,et=null,zt.set(0,0,r.canvas.width,r.canvas.height),At.set(0,0,r.canvas.width,r.canvas.height),d.reset(),g.reset(),y.reset()}return{buffers:{color:d,depth:g,stencil:y},enable:le,disable:Qt,bindFramebuffer:me,drawBuffers:Xt,useProgram:Ee,setBlending:te,setMaterial:fe,setFlipSided:de,setCullFace:Ue,setLineWidth:be,setPolygonOffset:kt,setScissorTest:ye,activeTexture:Vn,bindTexture:$n,unbindTexture:j,compressedTexImage2D:H,compressedTexImage3D:rt,texImage2D:C,texImage3D:L,updateUBOMapping:X,uniformBlockBinding:pt,texStorage2D:Kt,texStorage3D:tt,texSubImage2D:Wt,texSubImage3D:Gt,compressedTexSubImage2D:Ct,compressedTexSubImage3D:he,scissor:F,viewport:J,reset:st}}function zO(r,t,e,o,a,c,p){let d=a.isWebGL2,g=a.maxTextures,y=a.maxCubemapSize,_=a.maxTextureSize,w=a.maxSamples,x=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,b=typeof navigator=="undefined"?!1:/OculusBrowser/g.test(navigator.userAgent),P=new WeakMap,I,M=new WeakMap,E=!1;try{E=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(j){}function N(j,H){return E?new OffscreenCanvas(j,H):Fh("canvas")}function A(j,H,rt,Wt){let Gt=1;if((j.width>Wt||j.height>Wt)&&(Gt=Wt/Math.max(j.width,j.height)),Gt<1||H===!0)if(typeof HTMLImageElement!="undefined"&&j instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&j instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&j instanceof ImageBitmap){let Ct=H?Fg:Math.floor,he=Ct(Gt*j.width),Kt=Ct(Gt*j.height);I===void 0&&(I=N(he,Kt));let tt=rt?N(he,Kt):I;return tt.width=he,tt.height=Kt,tt.getContext("2d").drawImage(j,0,0,he,Kt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+j.width+"x"+j.height+") to ("+he+"x"+Kt+")."),tt}else return"data"in j&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+j.width+"x"+j.height+")."),j;return j}function U(j){return X_(j.width)&&X_(j.height)}function z(j){return d?!1:j.wrapS!==Hs||j.wrapT!==Hs||j.minFilter!==_o&&j.minFilter!==As}function $(j,H){return j.generateMipmaps&&H&&j.minFilter!==_o&&j.minFilter!==As}function q(j){r.generateMipmap(j)}function D(j,H,rt,Wt,Gt=!1){if(d===!1)return H;if(j!==null){if(r[j]!==void 0)return r[j];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+j+"'")}let Ct=H;if(H===r.RED&&(rt===r.FLOAT&&(Ct=r.R32F),rt===r.HALF_FLOAT&&(Ct=r.R16F),rt===r.UNSIGNED_BYTE&&(Ct=r.R8)),H===r.RED_INTEGER&&(rt===r.UNSIGNED_BYTE&&(Ct=r.R8UI),rt===r.UNSIGNED_SHORT&&(Ct=r.R16UI),rt===r.UNSIGNED_INT&&(Ct=r.R32UI),rt===r.BYTE&&(Ct=r.R8I),rt===r.SHORT&&(Ct=r.R16I),rt===r.INT&&(Ct=r.R32I)),H===r.RG&&(rt===r.FLOAT&&(Ct=r.RG32F),rt===r.HALF_FLOAT&&(Ct=r.RG16F),rt===r.UNSIGNED_BYTE&&(Ct=r.RG8)),H===r.RGBA){let he=Gt?Lh:yr.getTransfer(Wt);rt===r.FLOAT&&(Ct=r.RGBA32F),rt===r.HALF_FLOAT&&(Ct=r.RGBA16F),rt===r.UNSIGNED_BYTE&&(Ct=he===Pr?r.SRGB8_ALPHA8:r.RGBA8),rt===r.UNSIGNED_SHORT_4_4_4_4&&(Ct=r.RGBA4),rt===r.UNSIGNED_SHORT_5_5_5_1&&(Ct=r.RGB5_A1)}return(Ct===r.R16F||Ct===r.R32F||Ct===r.RG16F||Ct===r.RG32F||Ct===r.RGBA16F||Ct===r.RGBA32F)&&t.get("EXT_color_buffer_float"),Ct}function G(j,H,rt){return $(j,rt)===!0||j.isFramebufferTexture&&j.minFilter!==_o&&j.minFilter!==As?Math.log2(Math.max(H.width,H.height))+1:j.mipmaps!==void 0&&j.mipmaps.length>0?j.mipmaps.length:j.isCompressedTexture&&Array.isArray(j.image)?H.mipmaps.length:1}function Q(j){return j===_o||j===g_||j===jd?r.NEAREST:r.LINEAR}function _t(j){let H=j.target;H.removeEventListener("dispose",_t),Dt(H),H.isVideoTexture&&P.delete(H)}function Z(j){let H=j.target;H.removeEventListener("dispose",Z),vt(H)}function Dt(j){let H=o.get(j);if(H.__webglInit===void 0)return;let rt=j.source,Wt=M.get(rt);if(Wt){let Gt=Wt[H.__cacheKey];Gt.usedTimes--,Gt.usedTimes===0&&et(j),Object.keys(Wt).length===0&&M.delete(rt)}o.remove(j)}function et(j){let H=o.get(j);r.deleteTexture(H.__webglTexture);let rt=j.source,Wt=M.get(rt);delete Wt[H.__cacheKey],p.memory.textures--}function vt(j){let H=j.texture,rt=o.get(j),Wt=o.get(H);if(Wt.__webglTexture!==void 0&&(r.deleteTexture(Wt.__webglTexture),p.memory.textures--),j.depthTexture&&j.depthTexture.dispose(),j.isWebGLCubeRenderTarget)for(let Gt=0;Gt<6;Gt++){if(Array.isArray(rt.__webglFramebuffer[Gt]))for(let Ct=0;Ct<rt.__webglFramebuffer[Gt].length;Ct++)r.deleteFramebuffer(rt.__webglFramebuffer[Gt][Ct]);else r.deleteFramebuffer(rt.__webglFramebuffer[Gt]);rt.__webglDepthbuffer&&r.deleteRenderbuffer(rt.__webglDepthbuffer[Gt])}else{if(Array.isArray(rt.__webglFramebuffer))for(let Gt=0;Gt<rt.__webglFramebuffer.length;Gt++)r.deleteFramebuffer(rt.__webglFramebuffer[Gt]);else r.deleteFramebuffer(rt.__webglFramebuffer);if(rt.__webglDepthbuffer&&r.deleteRenderbuffer(rt.__webglDepthbuffer),rt.__webglMultisampledFramebuffer&&r.deleteFramebuffer(rt.__webglMultisampledFramebuffer),rt.__webglColorRenderbuffer)for(let Gt=0;Gt<rt.__webglColorRenderbuffer.length;Gt++)rt.__webglColorRenderbuffer[Gt]&&r.deleteRenderbuffer(rt.__webglColorRenderbuffer[Gt]);rt.__webglDepthRenderbuffer&&r.deleteRenderbuffer(rt.__webglDepthRenderbuffer)}if(j.isWebGLMultipleRenderTargets)for(let Gt=0,Ct=H.length;Gt<Ct;Gt++){let he=o.get(H[Gt]);he.__webglTexture&&(r.deleteTexture(he.__webglTexture),p.memory.textures--),o.remove(H[Gt])}o.remove(H),o.remove(j)}let It=0;function Pt(){It=0}function Et(){let j=It;return j>=g&&console.warn("THREE.WebGLTextures: Trying to use "+j+" texture units while this GPU supports only "+g),It+=1,j}function yt(j){let H=[];return H.push(j.wrapS),H.push(j.wrapT),H.push(j.wrapR||0),H.push(j.magFilter),H.push(j.minFilter),H.push(j.anisotropy),H.push(j.internalFormat),H.push(j.format),H.push(j.type),H.push(j.generateMipmaps),H.push(j.premultiplyAlpha),H.push(j.flipY),H.push(j.unpackAlignment),H.push(j.colorSpace),H.join()}function Y(j,H){let rt=o.get(j);if(j.isVideoTexture&&Vn(j),j.isRenderTargetTexture===!1&&j.version>0&&rt.__version!==j.version){let Wt=j.image;if(Wt===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Wt.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{me(rt,j,H);return}}e.bindTexture(r.TEXTURE_2D,rt.__webglTexture,r.TEXTURE0+H)}function ht(j,H){let rt=o.get(j);if(j.version>0&&rt.__version!==j.version){me(rt,j,H);return}e.bindTexture(r.TEXTURE_2D_ARRAY,rt.__webglTexture,r.TEXTURE0+H)}function Mt(j,H){let rt=o.get(j);if(j.version>0&&rt.__version!==j.version){me(rt,j,H);return}e.bindTexture(r.TEXTURE_3D,rt.__webglTexture,r.TEXTURE0+H)}function zt(j,H){let rt=o.get(j);if(j.version>0&&rt.__version!==j.version){Xt(rt,j,H);return}e.bindTexture(r.TEXTURE_CUBE_MAP,rt.__webglTexture,r.TEXTURE0+H)}let At={[Lg]:r.REPEAT,[Hs]:r.CLAMP_TO_EDGE,[Ng]:r.MIRRORED_REPEAT},$t={[_o]:r.NEAREST,[g_]:r.NEAREST_MIPMAP_NEAREST,[jd]:r.NEAREST_MIPMAP_LINEAR,[As]:r.LINEAR,[LI]:r.LINEAR_MIPMAP_NEAREST,[tf]:r.LINEAR_MIPMAP_LINEAR},ue={[YI]:r.NEVER,[tR]:r.ALWAYS,[$I]:r.LESS,[JI]:r.LEQUAL,[ZI]:r.EQUAL,[jI]:r.GEQUAL,[KI]:r.GREATER,[QI]:r.NOTEQUAL};function le(j,H,rt){if(rt?(r.texParameteri(j,r.TEXTURE_WRAP_S,At[H.wrapS]),r.texParameteri(j,r.TEXTURE_WRAP_T,At[H.wrapT]),(j===r.TEXTURE_3D||j===r.TEXTURE_2D_ARRAY)&&r.texParameteri(j,r.TEXTURE_WRAP_R,At[H.wrapR]),r.texParameteri(j,r.TEXTURE_MAG_FILTER,$t[H.magFilter]),r.texParameteri(j,r.TEXTURE_MIN_FILTER,$t[H.minFilter])):(r.texParameteri(j,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(j,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(j===r.TEXTURE_3D||j===r.TEXTURE_2D_ARRAY)&&r.texParameteri(j,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(H.wrapS!==Hs||H.wrapT!==Hs)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(j,r.TEXTURE_MAG_FILTER,Q(H.magFilter)),r.texParameteri(j,r.TEXTURE_MIN_FILTER,Q(H.minFilter)),H.minFilter!==_o&&H.minFilter!==As&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),H.compareFunction&&(r.texParameteri(j,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(j,r.TEXTURE_COMPARE_FUNC,ue[H.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){let Wt=t.get("EXT_texture_filter_anisotropic");if(H.magFilter===_o||H.minFilter!==jd&&H.minFilter!==tf||H.type===_u&&t.has("OES_texture_float_linear")===!1||d===!1&&H.type===ef&&t.has("OES_texture_half_float_linear")===!1)return;(H.anisotropy>1||o.get(H).__currentAnisotropy)&&(r.texParameterf(j,Wt.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(H.anisotropy,a.getMaxAnisotropy())),o.get(H).__currentAnisotropy=H.anisotropy)}}function Qt(j,H){let rt=!1;j.__webglInit===void 0&&(j.__webglInit=!0,H.addEventListener("dispose",_t));let Wt=H.source,Gt=M.get(Wt);Gt===void 0&&(Gt={},M.set(Wt,Gt));let Ct=yt(H);if(Ct!==j.__cacheKey){Gt[Ct]===void 0&&(Gt[Ct]={texture:r.createTexture(),usedTimes:0},p.memory.textures++,rt=!0),Gt[Ct].usedTimes++;let he=Gt[j.__cacheKey];he!==void 0&&(Gt[j.__cacheKey].usedTimes--,he.usedTimes===0&&et(H)),j.__cacheKey=Ct,j.__webglTexture=Gt[Ct].texture}return rt}function me(j,H,rt){let Wt=r.TEXTURE_2D;(H.isDataArrayTexture||H.isCompressedArrayTexture)&&(Wt=r.TEXTURE_2D_ARRAY),H.isData3DTexture&&(Wt=r.TEXTURE_3D);let Gt=Qt(j,H),Ct=H.source;e.bindTexture(Wt,j.__webglTexture,r.TEXTURE0+rt);let he=o.get(Ct);if(Ct.version!==he.__version||Gt===!0){e.activeTexture(r.TEXTURE0+rt);let Kt=yr.getPrimaries(yr.workingColorSpace),tt=H.colorSpace===Cs?null:yr.getPrimaries(H.colorSpace),C=H.colorSpace===Cs||Kt===tt?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,H.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,H.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,C);let L=z(H)&&U(H.image)===!1,F=A(H.image,L,!1,_);F=$n(H,F);let J=U(F)||d,X=c.convert(H.format,H.colorSpace),pt=c.convert(H.type),st=D(H.internalFormat,X,pt,H.colorSpace,H.isVideoTexture);le(Wt,H,J);let k,ut=H.mipmaps,nt=d&&H.isVideoTexture!==!0,lt=he.__version===void 0||Gt===!0,dt=G(H,F,J);if(H.isDepthTexture)st=r.DEPTH_COMPONENT,d?H.type===_u?st=r.DEPTH_COMPONENT32F:H.type===vu?st=r.DEPTH_COMPONENT24:H.type===tl?st=r.DEPTH24_STENCIL8:st=r.DEPTH_COMPONENT16:H.type===_u&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),H.format===el&&st===r.DEPTH_COMPONENT&&H.type!==dm&&H.type!==vu&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),H.type=vu,pt=c.convert(H.type)),H.format===jl&&st===r.DEPTH_COMPONENT&&(st=r.DEPTH_STENCIL,H.type!==tl&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),H.type=tl,pt=c.convert(H.type))),lt&&(nt?e.texStorage2D(r.TEXTURE_2D,1,st,F.width,F.height):e.texImage2D(r.TEXTURE_2D,0,st,F.width,F.height,0,X,pt,null));else if(H.isDataTexture)if(ut.length>0&&J){nt&<&&e.texStorage2D(r.TEXTURE_2D,dt,st,ut[0].width,ut[0].height);for(let at=0,Bt=ut.length;at<Bt;at++)k=ut[at],nt?e.texSubImage2D(r.TEXTURE_2D,at,0,0,k.width,k.height,X,pt,k.data):e.texImage2D(r.TEXTURE_2D,at,st,k.width,k.height,0,X,pt,k.data);H.generateMipmaps=!1}else nt?(lt&&e.texStorage2D(r.TEXTURE_2D,dt,st,F.width,F.height),e.texSubImage2D(r.TEXTURE_2D,0,0,0,F.width,F.height,X,pt,F.data)):e.texImage2D(r.TEXTURE_2D,0,st,F.width,F.height,0,X,pt,F.data);else if(H.isCompressedTexture)if(H.isCompressedArrayTexture){nt&<&&e.texStorage3D(r.TEXTURE_2D_ARRAY,dt,st,ut[0].width,ut[0].height,F.depth);for(let at=0,Bt=ut.length;at<Bt;at++)k=ut[at],H.format!==Vs?X!==null?nt?e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,at,0,0,0,k.width,k.height,F.depth,X,k.data,0,0):e.compressedTexImage3D(r.TEXTURE_2D_ARRAY,at,st,k.width,k.height,F.depth,0,k.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):nt?e.texSubImage3D(r.TEXTURE_2D_ARRAY,at,0,0,0,k.width,k.height,F.depth,X,pt,k.data):e.texImage3D(r.TEXTURE_2D_ARRAY,at,st,k.width,k.height,F.depth,0,X,pt,k.data)}else{nt&<&&e.texStorage2D(r.TEXTURE_2D,dt,st,ut[0].width,ut[0].height);for(let at=0,Bt=ut.length;at<Bt;at++)k=ut[at],H.format!==Vs?X!==null?nt?e.compressedTexSubImage2D(r.TEXTURE_2D,at,0,0,k.width,k.height,X,k.data):e.compressedTexImage2D(r.TEXTURE_2D,at,st,k.width,k.height,0,k.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):nt?e.texSubImage2D(r.TEXTURE_2D,at,0,0,k.width,k.height,X,pt,k.data):e.texImage2D(r.TEXTURE_2D,at,st,k.width,k.height,0,X,pt,k.data)}else if(H.isDataArrayTexture)nt?(lt&&e.texStorage3D(r.TEXTURE_2D_ARRAY,dt,st,F.width,F.height,F.depth),e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,F.width,F.height,F.depth,X,pt,F.data)):e.texImage3D(r.TEXTURE_2D_ARRAY,0,st,F.width,F.height,F.depth,0,X,pt,F.data);else if(H.isData3DTexture)nt?(lt&&e.texStorage3D(r.TEXTURE_3D,dt,st,F.width,F.height,F.depth),e.texSubImage3D(r.TEXTURE_3D,0,0,0,0,F.width,F.height,F.depth,X,pt,F.data)):e.texImage3D(r.TEXTURE_3D,0,st,F.width,F.height,F.depth,0,X,pt,F.data);else if(H.isFramebufferTexture){if(lt)if(nt)e.texStorage2D(r.TEXTURE_2D,dt,st,F.width,F.height);else{let at=F.width,Bt=F.height;for(let qt=0;qt<dt;qt++)e.texImage2D(r.TEXTURE_2D,qt,st,at,Bt,0,X,pt,null),at>>=1,Bt>>=1}}else if(ut.length>0&&J){nt&<&&e.texStorage2D(r.TEXTURE_2D,dt,st,ut[0].width,ut[0].height);for(let at=0,Bt=ut.length;at<Bt;at++)k=ut[at],nt?e.texSubImage2D(r.TEXTURE_2D,at,0,0,X,pt,k):e.texImage2D(r.TEXTURE_2D,at,st,X,pt,k);H.generateMipmaps=!1}else nt?(lt&&e.texStorage2D(r.TEXTURE_2D,dt,st,F.width,F.height),e.texSubImage2D(r.TEXTURE_2D,0,0,0,X,pt,F)):e.texImage2D(r.TEXTURE_2D,0,st,X,pt,F);$(H,J)&&q(Wt),he.__version=Ct.version,H.onUpdate&&H.onUpdate(H)}j.__version=H.version}function Xt(j,H,rt){if(H.image.length!==6)return;let Wt=Qt(j,H),Gt=H.source;e.bindTexture(r.TEXTURE_CUBE_MAP,j.__webglTexture,r.TEXTURE0+rt);let Ct=o.get(Gt);if(Gt.version!==Ct.__version||Wt===!0){e.activeTexture(r.TEXTURE0+rt);let he=yr.getPrimaries(yr.workingColorSpace),Kt=H.colorSpace===Cs?null:yr.getPrimaries(H.colorSpace),tt=H.colorSpace===Cs||he===Kt?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,H.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,H.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,tt);let C=H.isCompressedTexture||H.image[0].isCompressedTexture,L=H.image[0]&&H.image[0].isDataTexture,F=[];for(let at=0;at<6;at++)!C&&!L?F[at]=A(H.image[at],!1,!0,y):F[at]=L?H.image[at].image:H.image[at],F[at]=$n(H,F[at]);let J=F[0],X=U(J)||d,pt=c.convert(H.format,H.colorSpace),st=c.convert(H.type),k=D(H.internalFormat,pt,st,H.colorSpace),ut=d&&H.isVideoTexture!==!0,nt=Ct.__version===void 0||Wt===!0,lt=G(H,J,X);le(r.TEXTURE_CUBE_MAP,H,X);let dt;if(C){ut&&nt&&e.texStorage2D(r.TEXTURE_CUBE_MAP,lt,k,J.width,J.height);for(let at=0;at<6;at++){dt=F[at].mipmaps;for(let Bt=0;Bt<dt.length;Bt++){let qt=dt[Bt];H.format!==Vs?pt!==null?ut?e.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+at,Bt,0,0,qt.width,qt.height,pt,qt.data):e.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+at,Bt,k,qt.width,qt.height,0,qt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ut?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+at,Bt,0,0,qt.width,qt.height,pt,st,qt.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+at,Bt,k,qt.width,qt.height,0,pt,st,qt.data)}}}else{dt=H.mipmaps,ut&&nt&&(dt.length>0&<++,e.texStorage2D(r.TEXTURE_CUBE_MAP,lt,k,F[0].width,F[0].height));for(let at=0;at<6;at++)if(L){ut?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+at,0,0,0,F[at].width,F[at].height,pt,st,F[at].data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+at,0,k,F[at].width,F[at].height,0,pt,st,F[at].data);for(let Bt=0;Bt<dt.length;Bt++){let we=dt[Bt].image[at].image;ut?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+at,Bt+1,0,0,we.width,we.height,pt,st,we.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+at,Bt+1,k,we.width,we.height,0,pt,st,we.data)}}else{ut?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+at,0,0,0,pt,st,F[at]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+at,0,k,pt,st,F[at]);for(let Bt=0;Bt<dt.length;Bt++){let qt=dt[Bt];ut?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+at,Bt+1,0,0,pt,st,qt.image[at]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+at,Bt+1,k,pt,st,qt.image[at])}}}$(H,X)&&q(r.TEXTURE_CUBE_MAP),Ct.__version=Gt.version,H.onUpdate&&H.onUpdate(H)}j.__version=H.version}function Ee(j,H,rt,Wt,Gt,Ct){let he=c.convert(rt.format,rt.colorSpace),Kt=c.convert(rt.type),tt=D(rt.internalFormat,he,Kt,rt.colorSpace);if(!o.get(H).__hasExternalTextures){let L=Math.max(1,H.width>>Ct),F=Math.max(1,H.height>>Ct);Gt===r.TEXTURE_3D||Gt===r.TEXTURE_2D_ARRAY?e.texImage3D(Gt,Ct,tt,L,F,H.depth,0,he,Kt,null):e.texImage2D(Gt,Ct,tt,L,F,0,he,Kt,null)}e.bindFramebuffer(r.FRAMEBUFFER,j),ye(H)?x.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Wt,Gt,o.get(rt).__webglTexture,0,kt(H)):(Gt===r.TEXTURE_2D||Gt>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&Gt<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,Wt,Gt,o.get(rt).__webglTexture,Ct),e.bindFramebuffer(r.FRAMEBUFFER,null)}function ft(j,H,rt){if(r.bindRenderbuffer(r.RENDERBUFFER,j),H.depthBuffer&&!H.stencilBuffer){let Wt=d===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(rt||ye(H)){let Gt=H.depthTexture;Gt&&Gt.isDepthTexture&&(Gt.type===_u?Wt=r.DEPTH_COMPONENT32F:Gt.type===vu&&(Wt=r.DEPTH_COMPONENT24));let Ct=kt(H);ye(H)?x.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Ct,Wt,H.width,H.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,Ct,Wt,H.width,H.height)}else r.renderbufferStorage(r.RENDERBUFFER,Wt,H.width,H.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,j)}else if(H.depthBuffer&&H.stencilBuffer){let Wt=kt(H);rt&&ye(H)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Wt,r.DEPTH24_STENCIL8,H.width,H.height):ye(H)?x.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Wt,r.DEPTH24_STENCIL8,H.width,H.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,H.width,H.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,j)}else{let Wt=H.isWebGLMultipleRenderTargets===!0?H.texture:[H.texture];for(let Gt=0;Gt<Wt.length;Gt++){let Ct=Wt[Gt],he=c.convert(Ct.format,Ct.colorSpace),Kt=c.convert(Ct.type),tt=D(Ct.internalFormat,he,Kt,Ct.colorSpace),C=kt(H);rt&&ye(H)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,C,tt,H.width,H.height):ye(H)?x.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,C,tt,H.width,H.height):r.renderbufferStorage(r.RENDERBUFFER,tt,H.width,H.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function He(j,H){if(H&&H.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(r.FRAMEBUFFER,j),!(H.depthTexture&&H.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!o.get(H.depthTexture).__webglTexture||H.depthTexture.image.width!==H.width||H.depthTexture.image.height!==H.height)&&(H.depthTexture.image.width=H.width,H.depthTexture.image.height=H.height,H.depthTexture.needsUpdate=!0),Y(H.depthTexture,0);let Wt=o.get(H.depthTexture).__webglTexture,Gt=kt(H);if(H.depthTexture.format===el)ye(H)?x.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,Wt,0,Gt):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,Wt,0);else if(H.depthTexture.format===jl)ye(H)?x.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,Wt,0,Gt):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,Wt,0);else throw new Error("Unknown depthTexture format")}function te(j){let H=o.get(j),rt=j.isWebGLCubeRenderTarget===!0;if(j.depthTexture&&!H.__autoAllocateDepthBuffer){if(rt)throw new Error("target.depthTexture not supported in Cube render targets");He(H.__webglFramebuffer,j)}else if(rt){H.__webglDepthbuffer=[];for(let Wt=0;Wt<6;Wt++)e.bindFramebuffer(r.FRAMEBUFFER,H.__webglFramebuffer[Wt]),H.__webglDepthbuffer[Wt]=r.createRenderbuffer(),ft(H.__webglDepthbuffer[Wt],j,!1)}else e.bindFramebuffer(r.FRAMEBUFFER,H.__webglFramebuffer),H.__webglDepthbuffer=r.createRenderbuffer(),ft(H.__webglDepthbuffer,j,!1);e.bindFramebuffer(r.FRAMEBUFFER,null)}function fe(j,H,rt){let Wt=o.get(j);H!==void 0&&Ee(Wt.__webglFramebuffer,j,j.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),rt!==void 0&&te(j)}function de(j){let H=j.texture,rt=o.get(j),Wt=o.get(H);j.addEventListener("dispose",Z),j.isWebGLMultipleRenderTargets!==!0&&(Wt.__webglTexture===void 0&&(Wt.__webglTexture=r.createTexture()),Wt.__version=H.version,p.memory.textures++);let Gt=j.isWebGLCubeRenderTarget===!0,Ct=j.isWebGLMultipleRenderTargets===!0,he=U(j)||d;if(Gt){rt.__webglFramebuffer=[];for(let Kt=0;Kt<6;Kt++)if(d&&H.mipmaps&&H.mipmaps.length>0){rt.__webglFramebuffer[Kt]=[];for(let tt=0;tt<H.mipmaps.length;tt++)rt.__webglFramebuffer[Kt][tt]=r.createFramebuffer()}else rt.__webglFramebuffer[Kt]=r.createFramebuffer()}else{if(d&&H.mipmaps&&H.mipmaps.length>0){rt.__webglFramebuffer=[];for(let Kt=0;Kt<H.mipmaps.length;Kt++)rt.__webglFramebuffer[Kt]=r.createFramebuffer()}else rt.__webglFramebuffer=r.createFramebuffer();if(Ct)if(a.drawBuffers){let Kt=j.texture;for(let tt=0,C=Kt.length;tt<C;tt++){let L=o.get(Kt[tt]);L.__webglTexture===void 0&&(L.__webglTexture=r.createTexture(),p.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(d&&j.samples>0&&ye(j)===!1){let Kt=Ct?H:[H];rt.__webglMultisampledFramebuffer=r.createFramebuffer(),rt.__webglColorRenderbuffer=[],e.bindFramebuffer(r.FRAMEBUFFER,rt.__webglMultisampledFramebuffer);for(let tt=0;tt<Kt.length;tt++){let C=Kt[tt];rt.__webglColorRenderbuffer[tt]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,rt.__webglColorRenderbuffer[tt]);let L=c.convert(C.format,C.colorSpace),F=c.convert(C.type),J=D(C.internalFormat,L,F,C.colorSpace,j.isXRRenderTarget===!0),X=kt(j);r.renderbufferStorageMultisample(r.RENDERBUFFER,X,J,j.width,j.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+tt,r.RENDERBUFFER,rt.__webglColorRenderbuffer[tt])}r.bindRenderbuffer(r.RENDERBUFFER,null),j.depthBuffer&&(rt.__webglDepthRenderbuffer=r.createRenderbuffer(),ft(rt.__webglDepthRenderbuffer,j,!0)),e.bindFramebuffer(r.FRAMEBUFFER,null)}}if(Gt){e.bindTexture(r.TEXTURE_CUBE_MAP,Wt.__webglTexture),le(r.TEXTURE_CUBE_MAP,H,he);for(let Kt=0;Kt<6;Kt++)if(d&&H.mipmaps&&H.mipmaps.length>0)for(let tt=0;tt<H.mipmaps.length;tt++)Ee(rt.__webglFramebuffer[Kt][tt],j,H,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Kt,tt);else Ee(rt.__webglFramebuffer[Kt],j,H,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Kt,0);$(H,he)&&q(r.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(Ct){let Kt=j.texture;for(let tt=0,C=Kt.length;tt<C;tt++){let L=Kt[tt],F=o.get(L);e.bindTexture(r.TEXTURE_2D,F.__webglTexture),le(r.TEXTURE_2D,L,he),Ee(rt.__webglFramebuffer,j,L,r.COLOR_ATTACHMENT0+tt,r.TEXTURE_2D,0),$(L,he)&&q(r.TEXTURE_2D)}e.unbindTexture()}else{let Kt=r.TEXTURE_2D;if((j.isWebGL3DRenderTarget||j.isWebGLArrayRenderTarget)&&(d?Kt=j.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),e.bindTexture(Kt,Wt.__webglTexture),le(Kt,H,he),d&&H.mipmaps&&H.mipmaps.length>0)for(let tt=0;tt<H.mipmaps.length;tt++)Ee(rt.__webglFramebuffer[tt],j,H,r.COLOR_ATTACHMENT0,Kt,tt);else Ee(rt.__webglFramebuffer,j,H,r.COLOR_ATTACHMENT0,Kt,0);$(H,he)&&q(Kt),e.unbindTexture()}j.depthBuffer&&te(j)}function Ue(j){let H=U(j)||d,rt=j.isWebGLMultipleRenderTargets===!0?j.texture:[j.texture];for(let Wt=0,Gt=rt.length;Wt<Gt;Wt++){let Ct=rt[Wt];if($(Ct,H)){let he=j.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,Kt=o.get(Ct).__webglTexture;e.bindTexture(he,Kt),q(he),e.unbindTexture()}}}function be(j){if(d&&j.samples>0&&ye(j)===!1){let H=j.isWebGLMultipleRenderTargets?j.texture:[j.texture],rt=j.width,Wt=j.height,Gt=r.COLOR_BUFFER_BIT,Ct=[],he=j.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Kt=o.get(j),tt=j.isWebGLMultipleRenderTargets===!0;if(tt)for(let C=0;C<H.length;C++)e.bindFramebuffer(r.FRAMEBUFFER,Kt.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+C,r.RENDERBUFFER,null),e.bindFramebuffer(r.FRAMEBUFFER,Kt.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+C,r.TEXTURE_2D,null,0);e.bindFramebuffer(r.READ_FRAMEBUFFER,Kt.__webglMultisampledFramebuffer),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Kt.__webglFramebuffer);for(let C=0;C<H.length;C++){Ct.push(r.COLOR_ATTACHMENT0+C),j.depthBuffer&&Ct.push(he);let L=Kt.__ignoreDepthValues!==void 0?Kt.__ignoreDepthValues:!1;if(L===!1&&(j.depthBuffer&&(Gt|=r.DEPTH_BUFFER_BIT),j.stencilBuffer&&(Gt|=r.STENCIL_BUFFER_BIT)),tt&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Kt.__webglColorRenderbuffer[C]),L===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[he]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[he])),tt){let F=o.get(H[C]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,F,0)}r.blitFramebuffer(0,0,rt,Wt,0,0,rt,Wt,Gt,r.NEAREST),b&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,Ct)}if(e.bindFramebuffer(r.READ_FRAMEBUFFER,null),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),tt)for(let C=0;C<H.length;C++){e.bindFramebuffer(r.FRAMEBUFFER,Kt.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+C,r.RENDERBUFFER,Kt.__webglColorRenderbuffer[C]);let L=o.get(H[C]).__webglTexture;e.bindFramebuffer(r.FRAMEBUFFER,Kt.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+C,r.TEXTURE_2D,L,0)}e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Kt.__webglMultisampledFramebuffer)}}function kt(j){return Math.min(w,j.samples)}function ye(j){let H=o.get(j);return d&&j.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&H.__useRenderToTexture!==!1}function Vn(j){let H=p.render.frame;P.get(j)!==H&&(P.set(j,H),j.update())}function $n(j,H){let rt=j.colorSpace,Wt=j.format,Gt=j.type;return j.isCompressedTexture===!0||j.isVideoTexture===!0||j.format===Og||rt!==Ya&&rt!==Cs&&(yr.getTransfer(rt)===Pr?d===!1?t.has("EXT_sRGB")===!0&&Wt===Vs?(j.format=Og,j.minFilter=As,j.generateMipmaps=!1):H=Uh.sRGBToLinear(H):(Wt!==Vs||Gt!==wu)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",rt)),H}this.allocateTextureUnit=Et,this.resetTextureUnits=Pt,this.setTexture2D=Y,this.setTexture2DArray=ht,this.setTexture3D=Mt,this.setTextureCube=zt,this.rebindTextures=fe,this.setupRenderTarget=de,this.updateRenderTargetMipmap=Ue,this.updateMultisampleRenderTarget=be,this.setupDepthRenderbuffer=te,this.setupFrameBufferTexture=Ee,this.useMultisampledRTT=ye}function GO(r,t,e){let o=e.isWebGL2;function a(c,p=Cs){let d,g=yr.getTransfer(p);if(c===wu)return r.UNSIGNED_BYTE;if(c===F1)return r.UNSIGNED_SHORT_4_4_4_4;if(c===U1)return r.UNSIGNED_SHORT_5_5_5_1;if(c===NI)return r.BYTE;if(c===OI)return r.SHORT;if(c===dm)return r.UNSIGNED_SHORT;if(c===D1)return r.INT;if(c===vu)return r.UNSIGNED_INT;if(c===_u)return r.FLOAT;if(c===ef)return o?r.HALF_FLOAT:(d=t.get("OES_texture_half_float"),d!==null?d.HALF_FLOAT_OES:null);if(c===DI)return r.ALPHA;if(c===Vs)return r.RGBA;if(c===FI)return r.LUMINANCE;if(c===UI)return r.LUMINANCE_ALPHA;if(c===el)return r.DEPTH_COMPONENT;if(c===jl)return r.DEPTH_STENCIL;if(c===Og)return d=t.get("EXT_sRGB"),d!==null?d.SRGB_ALPHA_EXT:null;if(c===BI)return r.RED;if(c===B1)return r.RED_INTEGER;if(c===zI)return r.RG;if(c===z1)return r.RG_INTEGER;if(c===G1)return r.RGBA_INTEGER;if(c===tg||c===eg||c===ng||c===rg)if(g===Pr)if(d=t.get("WEBGL_compressed_texture_s3tc_srgb"),d!==null){if(c===tg)return d.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(c===eg)return d.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(c===ng)return d.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(c===rg)return d.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(d=t.get("WEBGL_compressed_texture_s3tc"),d!==null){if(c===tg)return d.COMPRESSED_RGB_S3TC_DXT1_EXT;if(c===eg)return d.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(c===ng)return d.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(c===rg)return d.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(c===m_||c===y_||c===v_||c===__)if(d=t.get("WEBGL_compressed_texture_pvrtc"),d!==null){if(c===m_)return d.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(c===y_)return d.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(c===v_)return d.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(c===__)return d.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(c===GI)return d=t.get("WEBGL_compressed_texture_etc1"),d!==null?d.COMPRESSED_RGB_ETC1_WEBGL:null;if(c===x_||c===E_)if(d=t.get("WEBGL_compressed_texture_etc"),d!==null){if(c===x_)return g===Pr?d.COMPRESSED_SRGB8_ETC2:d.COMPRESSED_RGB8_ETC2;if(c===E_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:d.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(c===w_||c===M_||c===S_||c===b_||c===T_||c===A_||c===C_||c===P_||c===I_||c===R_||c===L_||c===N_||c===O_||c===D_)if(d=t.get("WEBGL_compressed_texture_astc"),d!==null){if(c===w_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:d.COMPRESSED_RGBA_ASTC_4x4_KHR;if(c===M_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:d.COMPRESSED_RGBA_ASTC_5x4_KHR;if(c===S_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:d.COMPRESSED_RGBA_ASTC_5x5_KHR;if(c===b_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:d.COMPRESSED_RGBA_ASTC_6x5_KHR;if(c===T_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:d.COMPRESSED_RGBA_ASTC_6x6_KHR;if(c===A_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:d.COMPRESSED_RGBA_ASTC_8x5_KHR;if(c===C_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:d.COMPRESSED_RGBA_ASTC_8x6_KHR;if(c===P_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:d.COMPRESSED_RGBA_ASTC_8x8_KHR;if(c===I_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:d.COMPRESSED_RGBA_ASTC_10x5_KHR;if(c===R_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:d.COMPRESSED_RGBA_ASTC_10x6_KHR;if(c===L_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:d.COMPRESSED_RGBA_ASTC_10x8_KHR;if(c===N_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:d.COMPRESSED_RGBA_ASTC_10x10_KHR;if(c===O_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:d.COMPRESSED_RGBA_ASTC_12x10_KHR;if(c===D_)return g===Pr?d.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:d.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(c===ig||c===F_||c===U_)if(d=t.get("EXT_texture_compression_bptc"),d!==null){if(c===ig)return g===Pr?d.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:d.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(c===F_)return d.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(c===U_)return d.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(c===kI||c===B_||c===z_||c===G_)if(d=t.get("EXT_texture_compression_rgtc"),d!==null){if(c===ig)return d.COMPRESSED_RED_RGTC1_EXT;if(c===B_)return d.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(c===z_)return d.COMPRESSED_RED_GREEN_RGTC2_EXT;if(c===G_)return d.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return c===tl?o?r.UNSIGNED_INT_24_8:(d=t.get("WEBGL_depth_texture"),d!==null?d.UNSIGNED_INT_24_8_WEBGL:null):r[c]!==void 0?r[c]:null}return{convert:a}}var Qg=class extends cs{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},Yl=class extends ha{constructor(){super(),this.isGroup=!0,this.type="Group"}},kO={type:"move"},jc=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Yl,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Yl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Rt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Rt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Yl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Rt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Rt),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let o of t.hand.values())this._getHandJoint(e,o)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,o){let a=null,c=null,p=null,d=this._targetRay,g=this._grip,y=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(y&&t.hand){p=!0;for(let I of t.hand.values()){let M=e.getJointPose(I,o),E=this._getHandJoint(y,I);M!==null&&(E.matrix.fromArray(M.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.matrixWorldNeedsUpdate=!0,E.jointRadius=M.radius),E.visible=M!==null}let _=y.joints["index-finger-tip"],w=y.joints["thumb-tip"],x=_.position.distanceTo(w.position),b=.02,P=.005;y.inputState.pinching&&x>b+P?(y.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!y.inputState.pinching&&x<=b-P&&(y.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else g!==null&&t.gripSpace&&(c=e.getPose(t.gripSpace,o),c!==null&&(g.matrix.fromArray(c.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,c.linearVelocity?(g.hasLinearVelocity=!0,g.linearVelocity.copy(c.linearVelocity)):g.hasLinearVelocity=!1,c.angularVelocity?(g.hasAngularVelocity=!0,g.angularVelocity.copy(c.angularVelocity)):g.hasAngularVelocity=!1));d!==null&&(a=e.getPose(t.targetRaySpace,o),a===null&&c!==null&&(a=c),a!==null&&(d.matrix.fromArray(a.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,a.linearVelocity?(d.hasLinearVelocity=!0,d.linearVelocity.copy(a.linearVelocity)):d.hasLinearVelocity=!1,a.angularVelocity?(d.hasAngularVelocity=!0,d.angularVelocity.copy(a.angularVelocity)):d.hasAngularVelocity=!1,this.dispatchEvent(kO)))}return d!==null&&(d.visible=a!==null),g!==null&&(g.visible=c!==null),y!==null&&(y.visible=p!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let o=new Yl;o.matrixAutoUpdate=!1,o.visible=!1,t.joints[e.jointName]=o,t.add(o)}return t.joints[e.jointName]}},jg=class extends Ws{constructor(t,e,o,a,c,p,d,g,y,_){if(_=_!==void 0?_:el,_!==el&&_!==jl)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");o===void 0&&_===el&&(o=vu),o===void 0&&_===jl&&(o=tl),super(null,a,c,p,d,g,_,o,y),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=d!==void 0?d:_o,this.minFilter=g!==void 0?g:_o,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}},tm=class extends Su{constructor(t,e){super();let o=this,a=null,c=1,p=null,d="local-floor",g=1,y=null,_=null,w=null,x=null,b=null,P=null,I=e.getContextAttributes(),M=null,E=null,N=[],A=[],U=new cs;U.layers.enable(1),U.viewport=new Xi;let z=new cs;z.layers.enable(2),z.viewport=new Xi;let $=[U,z],q=new Qg;q.layers.enable(1),q.layers.enable(2);let D=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ht){let Mt=N[ht];return Mt===void 0&&(Mt=new jc,N[ht]=Mt),Mt.getTargetRaySpace()},this.getControllerGrip=function(ht){let Mt=N[ht];return Mt===void 0&&(Mt=new jc,N[ht]=Mt),Mt.getGripSpace()},this.getHand=function(ht){let Mt=N[ht];return Mt===void 0&&(Mt=new jc,N[ht]=Mt),Mt.getHandSpace()};function Q(ht){let Mt=A.indexOf(ht.inputSource);if(Mt===-1)return;let zt=N[Mt];zt!==void 0&&(zt.update(ht.inputSource,ht.frame,y||p),zt.dispatchEvent({type:ht.type,data:ht.inputSource}))}function _t(){a.removeEventListener("select",Q),a.removeEventListener("selectstart",Q),a.removeEventListener("selectend",Q),a.removeEventListener("squeeze",Q),a.removeEventListener("squeezestart",Q),a.removeEventListener("squeezeend",Q),a.removeEventListener("end",_t),a.removeEventListener("inputsourceschange",Z);for(let ht=0;ht<N.length;ht++){let Mt=A[ht];Mt!==null&&(A[ht]=null,N[ht].disconnect(Mt))}D=null,G=null,t.setRenderTarget(M),b=null,x=null,w=null,a=null,E=null,Y.stop(),o.isPresenting=!1,o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ht){c=ht,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ht){d=ht,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return y||p},this.setReferenceSpace=function(ht){y=ht},this.getBaseLayer=function(){return x!==null?x:b},this.getBinding=function(){return w},this.getFrame=function(){return P},this.getSession=function(){return a},this.setSession=async function(ht){if(a=ht,a!==null){if(M=t.getRenderTarget(),a.addEventListener("select",Q),a.addEventListener("selectstart",Q),a.addEventListener("selectend",Q),a.addEventListener("squeeze",Q),a.addEventListener("squeezestart",Q),a.addEventListener("squeezeend",Q),a.addEventListener("end",_t),a.addEventListener("inputsourceschange",Z),I.xrCompatible!==!0&&await e.makeXRCompatible(),a.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let Mt={antialias:a.renderState.layers===void 0?I.antialias:!0,alpha:!0,depth:I.depth,stencil:I.stencil,framebufferScaleFactor:c};b=new XRWebGLLayer(a,e,Mt),a.updateRenderState({baseLayer:b}),E=new $a(b.framebufferWidth,b.framebufferHeight,{format:Vs,type:wu,colorSpace:t.outputColorSpace,stencilBuffer:I.stencil})}else{let Mt=null,zt=null,At=null;I.depth&&(At=I.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,Mt=I.stencil?jl:el,zt=I.stencil?tl:vu);let $t={colorFormat:e.RGBA8,depthFormat:At,scaleFactor:c};w=new XRWebGLBinding(a,e),x=w.createProjectionLayer($t),a.updateRenderState({layers:[x]}),E=new $a(x.textureWidth,x.textureHeight,{format:Vs,type:wu,depthTexture:new jg(x.textureWidth,x.textureHeight,zt,void 0,void 0,void 0,void 0,void 0,void 0,Mt),stencilBuffer:I.stencil,colorSpace:t.outputColorSpace,samples:I.antialias?4:0});let ue=t.properties.get(E);ue.__ignoreDepthValues=x.ignoreDepthValues}E.isXRRenderTarget=!0,this.setFoveation(g),y=null,p=await a.requestReferenceSpace(d),Y.setContext(a),Y.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode};function Z(ht){for(let Mt=0;Mt<ht.removed.length;Mt++){let zt=ht.removed[Mt],At=A.indexOf(zt);At>=0&&(A[At]=null,N[At].disconnect(zt))}for(let Mt=0;Mt<ht.added.length;Mt++){let zt=ht.added[Mt],At=A.indexOf(zt);if(At===-1){for(let ue=0;ue<N.length;ue++)if(ue>=A.length){A.push(zt),At=ue;break}else if(A[ue]===null){A[ue]=zt,At=ue;break}if(At===-1)break}let $t=N[At];$t&&$t.connect(zt)}}let Dt=new Rt,et=new Rt;function vt(ht,Mt,zt){Dt.setFromMatrixPosition(Mt.matrixWorld),et.setFromMatrixPosition(zt.matrixWorld);let At=Dt.distanceTo(et),$t=Mt.projectionMatrix.elements,ue=zt.projectionMatrix.elements,le=$t[14]/($t[10]-1),Qt=$t[14]/($t[10]+1),me=($t[9]+1)/$t[5],Xt=($t[9]-1)/$t[5],Ee=($t[8]-1)/$t[0],ft=(ue[8]+1)/ue[0],He=le*Ee,te=le*ft,fe=At/(-Ee+ft),de=fe*-Ee;Mt.matrixWorld.decompose(ht.position,ht.quaternion,ht.scale),ht.translateX(de),ht.translateZ(fe),ht.matrixWorld.compose(ht.position,ht.quaternion,ht.scale),ht.matrixWorldInverse.copy(ht.matrixWorld).invert();let Ue=le+fe,be=Qt+fe,kt=He-de,ye=te+(At-de),Vn=me*Qt/be*Ue,$n=Xt*Qt/be*Ue;ht.projectionMatrix.makePerspective(kt,ye,Vn,$n,Ue,be),ht.projectionMatrixInverse.copy(ht.projectionMatrix).invert()}function It(ht,Mt){Mt===null?ht.matrixWorld.copy(ht.matrix):ht.matrixWorld.multiplyMatrices(Mt.matrixWorld,ht.matrix),ht.matrixWorldInverse.copy(ht.matrixWorld).invert()}this.updateCamera=function(ht){if(a===null)return;q.near=z.near=U.near=ht.near,q.far=z.far=U.far=ht.far,(D!==q.near||G!==q.far)&&(a.updateRenderState({depthNear:q.near,depthFar:q.far}),D=q.near,G=q.far);let Mt=ht.parent,zt=q.cameras;It(q,Mt);for(let At=0;At<zt.length;At++)It(zt[At],Mt);zt.length===2?vt(q,U,z):q.projectionMatrix.copy(U.projectionMatrix),Pt(ht,q,Mt)};function Pt(ht,Mt,zt){zt===null?ht.matrix.copy(Mt.matrixWorld):(ht.matrix.copy(zt.matrixWorld),ht.matrix.invert(),ht.matrix.multiply(Mt.matrixWorld)),ht.matrix.decompose(ht.position,ht.quaternion,ht.scale),ht.updateMatrixWorld(!0),ht.projectionMatrix.copy(Mt.projectionMatrix),ht.projectionMatrixInverse.copy(Mt.projectionMatrixInverse),ht.isPerspectiveCamera&&(ht.fov=Dg*2*Math.atan(1/ht.projectionMatrix.elements[5]),ht.zoom=1)}this.getCamera=function(){return q},this.getFoveation=function(){if(!(x===null&&b===null))return g},this.setFoveation=function(ht){g=ht,x!==null&&(x.fixedFoveation=ht),b!==null&&b.fixedFoveation!==void 0&&(b.fixedFoveation=ht)};let Et=null;function yt(ht,Mt){if(_=Mt.getViewerPose(y||p),P=Mt,_!==null){let zt=_.views;b!==null&&(t.setRenderTargetFramebuffer(E,b.framebuffer),t.setRenderTarget(E));let At=!1;zt.length!==q.cameras.length&&(q.cameras.length=0,At=!0);for(let $t=0;$t<zt.length;$t++){let ue=zt[$t],le=null;if(b!==null)le=b.getViewport(ue);else{let me=w.getViewSubImage(x,ue);le=me.viewport,$t===0&&(t.setRenderTargetTextures(E,me.colorTexture,x.ignoreDepthValues?void 0:me.depthStencilTexture),t.setRenderTarget(E))}let Qt=$[$t];Qt===void 0&&(Qt=new cs,Qt.layers.enable($t),Qt.viewport=new Xi,$[$t]=Qt),Qt.matrix.fromArray(ue.transform.matrix),Qt.matrix.decompose(Qt.position,Qt.quaternion,Qt.scale),Qt.projectionMatrix.fromArray(ue.projectionMatrix),Qt.projectionMatrixInverse.copy(Qt.projectionMatrix).invert(),Qt.viewport.set(le.x,le.y,le.width,le.height),$t===0&&(q.matrix.copy(Qt.matrix),q.matrix.decompose(q.position,q.quaternion,q.scale)),At===!0&&q.cameras.push(Qt)}}for(let zt=0;zt<N.length;zt++){let At=A[zt],$t=N[zt];At!==null&&$t!==void 0&&$t.update(At,Mt,y||p)}Et&&Et(ht,Mt),Mt.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:Mt}),P=null}let Y=new q1;Y.setAnimationLoop(yt),this.setAnimationLoop=function(ht){Et=ht},this.dispose=function(){}}};function HO(r,t){function e(M,E){M.matrixAutoUpdate===!0&&M.updateMatrix(),E.value.copy(M.matrix)}function o(M,E){E.color.getRGB(M.fogColor.value,W1(r)),E.isFog?(M.fogNear.value=E.near,M.fogFar.value=E.far):E.isFogExp2&&(M.fogDensity.value=E.density)}function a(M,E,N,A,U){E.isMeshBasicMaterial||E.isMeshLambertMaterial?c(M,E):E.isMeshToonMaterial?(c(M,E),w(M,E)):E.isMeshPhongMaterial?(c(M,E),_(M,E)):E.isMeshStandardMaterial?(c(M,E),x(M,E),E.isMeshPhysicalMaterial&&b(M,E,U)):E.isMeshMatcapMaterial?(c(M,E),P(M,E)):E.isMeshDepthMaterial?c(M,E):E.isMeshDistanceMaterial?(c(M,E),I(M,E)):E.isMeshNormalMaterial?c(M,E):E.isLineBasicMaterial?(p(M,E),E.isLineDashedMaterial&&d(M,E)):E.isPointsMaterial?g(M,E,N,A):E.isSpriteMaterial?y(M,E):E.isShadowMaterial?(M.color.value.copy(E.color),M.opacity.value=E.opacity):E.isShaderMaterial&&(E.uniformsNeedUpdate=!1)}function c(M,E){M.opacity.value=E.opacity,E.color&&M.diffuse.value.copy(E.color),E.emissive&&M.emissive.value.copy(E.emissive).multiplyScalar(E.emissiveIntensity),E.map&&(M.map.value=E.map,e(E.map,M.mapTransform)),E.alphaMap&&(M.alphaMap.value=E.alphaMap,e(E.alphaMap,M.alphaMapTransform)),E.bumpMap&&(M.bumpMap.value=E.bumpMap,e(E.bumpMap,M.bumpMapTransform),M.bumpScale.value=E.bumpScale,E.side===Vo&&(M.bumpScale.value*=-1)),E.normalMap&&(M.normalMap.value=E.normalMap,e(E.normalMap,M.normalMapTransform),M.normalScale.value.copy(E.normalScale),E.side===Vo&&M.normalScale.value.negate()),E.displacementMap&&(M.displacementMap.value=E.displacementMap,e(E.displacementMap,M.displacementMapTransform),M.displacementScale.value=E.displacementScale,M.displacementBias.value=E.displacementBias),E.emissiveMap&&(M.emissiveMap.value=E.emissiveMap,e(E.emissiveMap,M.emissiveMapTransform)),E.specularMap&&(M.specularMap.value=E.specularMap,e(E.specularMap,M.specularMapTransform)),E.alphaTest>0&&(M.alphaTest.value=E.alphaTest);let N=t.get(E).envMap;if(N&&(M.envMap.value=N,M.flipEnvMap.value=N.isCubeTexture&&N.isRenderTargetTexture===!1?-1:1,M.reflectivity.value=E.reflectivity,M.ior.value=E.ior,M.refractionRatio.value=E.refractionRatio),E.lightMap){M.lightMap.value=E.lightMap;let A=r._useLegacyLights===!0?Math.PI:1;M.lightMapIntensity.value=E.lightMapIntensity*A,e(E.lightMap,M.lightMapTransform)}E.aoMap&&(M.aoMap.value=E.aoMap,M.aoMapIntensity.value=E.aoMapIntensity,e(E.aoMap,M.aoMapTransform))}function p(M,E){M.diffuse.value.copy(E.color),M.opacity.value=E.opacity,E.map&&(M.map.value=E.map,e(E.map,M.mapTransform))}function d(M,E){M.dashSize.value=E.dashSize,M.totalSize.value=E.dashSize+E.gapSize,M.scale.value=E.scale}function g(M,E,N,A){M.diffuse.value.copy(E.color),M.opacity.value=E.opacity,M.size.value=E.size*N,M.scale.value=A*.5,E.map&&(M.map.value=E.map,e(E.map,M.uvTransform)),E.alphaMap&&(M.alphaMap.value=E.alphaMap,e(E.alphaMap,M.alphaMapTransform)),E.alphaTest>0&&(M.alphaTest.value=E.alphaTest)}function y(M,E){M.diffuse.value.copy(E.color),M.opacity.value=E.opacity,M.rotation.value=E.rotation,E.map&&(M.map.value=E.map,e(E.map,M.mapTransform)),E.alphaMap&&(M.alphaMap.value=E.alphaMap,e(E.alphaMap,M.alphaMapTransform)),E.alphaTest>0&&(M.alphaTest.value=E.alphaTest)}function _(M,E){M.specular.value.copy(E.specular),M.shininess.value=Math.max(E.shininess,1e-4)}function w(M,E){E.gradientMap&&(M.gradientMap.value=E.gradientMap)}function x(M,E){M.metalness.value=E.metalness,E.metalnessMap&&(M.metalnessMap.value=E.metalnessMap,e(E.metalnessMap,M.metalnessMapTransform)),M.roughness.value=E.roughness,E.roughnessMap&&(M.roughnessMap.value=E.roughnessMap,e(E.roughnessMap,M.roughnessMapTransform)),t.get(E).envMap&&(M.envMapIntensity.value=E.envMapIntensity)}function b(M,E,N){M.ior.value=E.ior,E.sheen>0&&(M.sheenColor.value.copy(E.sheenColor).multiplyScalar(E.sheen),M.sheenRoughness.value=E.sheenRoughness,E.sheenColorMap&&(M.sheenColorMap.value=E.sheenColorMap,e(E.sheenColorMap,M.sheenColorMapTransform)),E.sheenRoughnessMap&&(M.sheenRoughnessMap.value=E.sheenRoughnessMap,e(E.sheenRoughnessMap,M.sheenRoughnessMapTransform))),E.clearcoat>0&&(M.clearcoat.value=E.clearcoat,M.clearcoatRoughness.value=E.clearcoatRoughness,E.clearcoatMap&&(M.clearcoatMap.value=E.clearcoatMap,e(E.clearcoatMap,M.clearcoatMapTransform)),E.clearcoatRoughnessMap&&(M.clearcoatRoughnessMap.value=E.clearcoatRoughnessMap,e(E.clearcoatRoughnessMap,M.clearcoatRoughnessMapTransform)),E.clearcoatNormalMap&&(M.clearcoatNormalMap.value=E.clearcoatNormalMap,e(E.clearcoatNormalMap,M.clearcoatNormalMapTransform),M.clearcoatNormalScale.value.copy(E.clearcoatNormalScale),E.side===Vo&&M.clearcoatNormalScale.value.negate())),E.iridescence>0&&(M.iridescence.value=E.iridescence,M.iridescenceIOR.value=E.iridescenceIOR,M.iridescenceThicknessMinimum.value=E.iridescenceThicknessRange[0],M.iridescenceThicknessMaximum.value=E.iridescenceThicknessRange[1],E.iridescenceMap&&(M.iridescenceMap.value=E.iridescenceMap,e(E.iridescenceMap,M.iridescenceMapTransform)),E.iridescenceThicknessMap&&(M.iridescenceThicknessMap.value=E.iridescenceThicknessMap,e(E.iridescenceThicknessMap,M.iridescenceThicknessMapTransform))),E.transmission>0&&(M.transmission.value=E.transmission,M.transmissionSamplerMap.value=N.texture,M.transmissionSamplerSize.value.set(N.width,N.height),E.transmissionMap&&(M.transmissionMap.value=E.transmissionMap,e(E.transmissionMap,M.transmissionMapTransform)),M.thickness.value=E.thickness,E.thicknessMap&&(M.thicknessMap.value=E.thicknessMap,e(E.thicknessMap,M.thicknessMapTransform)),M.attenuationDistance.value=E.attenuationDistance,M.attenuationColor.value.copy(E.attenuationColor)),E.anisotropy>0&&(M.anisotropyVector.value.set(E.anisotropy*Math.cos(E.anisotropyRotation),E.anisotropy*Math.sin(E.anisotropyRotation)),E.anisotropyMap&&(M.anisotropyMap.value=E.anisotropyMap,e(E.anisotropyMap,M.anisotropyMapTransform))),M.specularIntensity.value=E.specularIntensity,M.specularColor.value.copy(E.specularColor),E.specularColorMap&&(M.specularColorMap.value=E.specularColorMap,e(E.specularColorMap,M.specularColorMapTransform)),E.specularIntensityMap&&(M.specularIntensityMap.value=E.specularIntensityMap,e(E.specularIntensityMap,M.specularIntensityMapTransform))}function P(M,E){E.matcap&&(M.matcap.value=E.matcap)}function I(M,E){let N=t.get(E).light;M.referencePosition.value.setFromMatrixPosition(N.matrixWorld),M.nearDistance.value=N.shadow.camera.near,M.farDistance.value=N.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:a}}function VO(r,t,e,o){let a={},c={},p=[],d=e.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function g(N,A){let U=A.program;o.uniformBlockBinding(N,U)}function y(N,A){let U=a[N.id];U===void 0&&(P(N),U=_(N),a[N.id]=U,N.addEventListener("dispose",M));let z=A.program;o.updateUBOMapping(N,z);let $=t.render.frame;c[N.id]!==$&&(x(N),c[N.id]=$)}function _(N){let A=w();N.__bindingPointIndex=A;let U=r.createBuffer(),z=N.__size,$=N.usage;return r.bindBuffer(r.UNIFORM_BUFFER,U),r.bufferData(r.UNIFORM_BUFFER,z,$),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,A,U),U}function w(){for(let N=0;N<d;N++)if(p.indexOf(N)===-1)return p.push(N),N;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function x(N){let A=a[N.id],U=N.uniforms,z=N.__cache;r.bindBuffer(r.UNIFORM_BUFFER,A);for(let $=0,q=U.length;$<q;$++){let D=U[$];if(b(D,$,z)===!0){let G=D.__offset,Q=Array.isArray(D.value)?D.value:[D.value],_t=0;for(let Z=0;Z<Q.length;Z++){let Dt=Q[Z],et=I(Dt);typeof Dt=="number"?(D.__data[0]=Dt,r.bufferSubData(r.UNIFORM_BUFFER,G+_t,D.__data)):Dt.isMatrix3?(D.__data[0]=Dt.elements[0],D.__data[1]=Dt.elements[1],D.__data[2]=Dt.elements[2],D.__data[3]=Dt.elements[0],D.__data[4]=Dt.elements[3],D.__data[5]=Dt.elements[4],D.__data[6]=Dt.elements[5],D.__data[7]=Dt.elements[0],D.__data[8]=Dt.elements[6],D.__data[9]=Dt.elements[7],D.__data[10]=Dt.elements[8],D.__data[11]=Dt.elements[0]):(Dt.toArray(D.__data,_t),_t+=et.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,G,D.__data)}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function b(N,A,U){let z=N.value;if(U[A]===void 0){if(typeof z=="number")U[A]=z;else{let $=Array.isArray(z)?z:[z],q=[];for(let D=0;D<$.length;D++)q.push($[D].clone());U[A]=q}return!0}else if(typeof z=="number"){if(U[A]!==z)return U[A]=z,!0}else{let $=Array.isArray(U[A])?U[A]:[U[A]],q=Array.isArray(z)?z:[z];for(let D=0;D<$.length;D++){let G=$[D];if(G.equals(q[D])===!1)return G.copy(q[D]),!0}}return!1}function P(N){let A=N.uniforms,U=0,z=16,$=0;for(let q=0,D=A.length;q<D;q++){let G=A[q],Q={boundary:0,storage:0},_t=Array.isArray(G.value)?G.value:[G.value];for(let Z=0,Dt=_t.length;Z<Dt;Z++){let et=_t[Z],vt=I(et);Q.boundary+=vt.boundary,Q.storage+=vt.storage}if(G.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),G.__offset=U,q>0){$=U%z;let Z=z-$;$!==0&&Z-Q.boundary<0&&(U+=z-$,G.__offset=U)}U+=Q.storage}return $=U%z,$>0&&(U+=z-$),N.__size=U,N.__cache={},this}function I(N){let A={boundary:0,storage:0};return typeof N=="number"?(A.boundary=4,A.storage=4):N.isVector2?(A.boundary=8,A.storage=8):N.isVector3||N.isColor?(A.boundary=16,A.storage=12):N.isVector4?(A.boundary=16,A.storage=16):N.isMatrix3?(A.boundary=48,A.storage=48):N.isMatrix4?(A.boundary=64,A.storage=64):N.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",N),A}function M(N){let A=N.target;A.removeEventListener("dispose",M);let U=p.indexOf(A.__bindingPointIndex);p.splice(U,1),r.deleteBuffer(a[A.id]),delete a[A.id],delete c[A.id]}function E(){for(let N in a)r.deleteBuffer(a[N]);p=[],a={},c={}}return{bind:g,update:y,dispose:E}}var em=class{constructor(t={}){let{canvas:e=nR(),context:o=null,depth:a=!0,stencil:c=!0,alpha:p=!1,antialias:d=!1,premultipliedAlpha:g=!0,preserveDrawingBuffer:y=!1,powerPreference:_="default",failIfMajorPerformanceCaveat:w=!1}=t;this.isWebGLRenderer=!0;let x;o!==null?x=o.getContextAttributes().alpha:x=p;let b=new Uint32Array(4),P=new Int32Array(4),I=null,M=null,E=[],N=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=qi,this._useLegacyLights=!1,this.toneMapping=Eu,this.toneMappingExposure=1;let A=this,U=!1,z=0,$=0,q=null,D=-1,G=null,Q=new Xi,_t=new Xi,Z=null,Dt=new Er(0),et=0,vt=e.width,It=e.height,Pt=1,Et=null,yt=null,Y=new Xi(0,0,vt,It),ht=new Xi(0,0,vt,It),Mt=!1,zt=new Yh,At=!1,$t=!1,ue=null,le=new ro,Qt=new tr,me=new Rt,Xt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ee(){return q===null?Pt:1}let ft=o;function He(K,xt){for(let Lt=0;Lt<K.length;Lt++){let wt=K[Lt],Ot=e.getContext(wt,xt);if(Ot!==null)return Ot}return null}try{let K={alpha:!0,depth:a,stencil:c,antialias:d,premultipliedAlpha:g,preserveDrawingBuffer:y,powerPreference:_,failIfMajorPerformanceCaveat:w};if("setAttribute"in e&&e.setAttribute("data-engine",\`three.js r\${pm}\`),e.addEventListener("webglcontextlost",ut,!1),e.addEventListener("webglcontextrestored",nt,!1),e.addEventListener("webglcontextcreationerror",lt,!1),ft===null){let xt=["webgl2","webgl","experimental-webgl"];if(A.isWebGL1Renderer===!0&&xt.shift(),ft=He(xt,K),ft===null)throw He(xt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&ft instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),ft.getShaderPrecisionFormat===void 0&&(ft.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(K){throw console.error("THREE.WebGLRenderer: "+K.message),K}let te,fe,de,Ue,be,kt,ye,Vn,$n,j,H,rt,Wt,Gt,Ct,he,Kt,tt,C,L,F,J,X,pt;function st(){te=new cN(ft),fe=new iN(ft,te,t),te.init(fe),J=new GO(ft,te,fe),de=new BO(ft,te,fe),Ue=new pN(ft),be=new TO,kt=new zO(ft,te,de,be,fe,J,Ue),ye=new sN(A),Vn=new lN(A),$n=new MR(ft,fe),X=new nN(ft,te,$n,fe),j=new fN(ft,$n,Ue,X),H=new yN(ft,j,$n,Ue),C=new mN(ft,fe,kt),he=new oN(be),rt=new bO(A,ye,Vn,te,fe,X,he),Wt=new HO(A,be),Gt=new CO,Ct=new OO(te,fe),tt=new eN(A,ye,Vn,de,H,x,g),Kt=new UO(A,H,fe),pt=new VO(ft,Ue,fe,de),L=new rN(ft,te,Ue,fe),F=new hN(ft,te,Ue,fe),Ue.programs=rt.programs,A.capabilities=fe,A.extensions=te,A.properties=be,A.renderLists=Gt,A.shadowMap=Kt,A.state=de,A.info=Ue}st();let k=new tm(A,ft);this.xr=k,this.getContext=function(){return ft},this.getContextAttributes=function(){return ft.getContextAttributes()},this.forceContextLoss=function(){let K=te.get("WEBGL_lose_context");K&&K.loseContext()},this.forceContextRestore=function(){let K=te.get("WEBGL_lose_context");K&&K.restoreContext()},this.getPixelRatio=function(){return Pt},this.setPixelRatio=function(K){K!==void 0&&(Pt=K,this.setSize(vt,It,!1))},this.getSize=function(K){return K.set(vt,It)},this.setSize=function(K,xt,Lt=!0){if(k.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}vt=K,It=xt,e.width=Math.floor(K*Pt),e.height=Math.floor(xt*Pt),Lt===!0&&(e.style.width=K+"px",e.style.height=xt+"px"),this.setViewport(0,0,K,xt)},this.getDrawingBufferSize=function(K){return K.set(vt*Pt,It*Pt).floor()},this.setDrawingBufferSize=function(K,xt,Lt){vt=K,It=xt,Pt=Lt,e.width=Math.floor(K*Lt),e.height=Math.floor(xt*Lt),this.setViewport(0,0,K,xt)},this.getCurrentViewport=function(K){return K.copy(Q)},this.getViewport=function(K){return K.copy(Y)},this.setViewport=function(K,xt,Lt,wt){K.isVector4?Y.set(K.x,K.y,K.z,K.w):Y.set(K,xt,Lt,wt),de.viewport(Q.copy(Y).multiplyScalar(Pt).floor())},this.getScissor=function(K){return K.copy(ht)},this.setScissor=function(K,xt,Lt,wt){K.isVector4?ht.set(K.x,K.y,K.z,K.w):ht.set(K,xt,Lt,wt),de.scissor(_t.copy(ht).multiplyScalar(Pt).floor())},this.getScissorTest=function(){return Mt},this.setScissorTest=function(K){de.setScissorTest(Mt=K)},this.setOpaqueSort=function(K){Et=K},this.setTransparentSort=function(K){yt=K},this.getClearColor=function(K){return K.copy(tt.getClearColor())},this.setClearColor=function(){tt.setClearColor.apply(tt,arguments)},this.getClearAlpha=function(){return tt.getClearAlpha()},this.setClearAlpha=function(){tt.setClearAlpha.apply(tt,arguments)},this.clear=function(K=!0,xt=!0,Lt=!0){let wt=0;if(K){let Ot=!1;if(q!==null){let Zt=q.texture.format;Ot=Zt===G1||Zt===z1||Zt===B1}if(Ot){let Zt=q.texture.type,jt=Zt===wu||Zt===vu||Zt===dm||Zt===tl||Zt===F1||Zt===U1,Te=tt.getClearColor(),ge=tt.getClearAlpha(),Ne=Te.r,pe=Te.g,Oe=Te.b;jt?(b[0]=Ne,b[1]=pe,b[2]=Oe,b[3]=ge,ft.clearBufferuiv(ft.COLOR,0,b)):(P[0]=Ne,P[1]=pe,P[2]=Oe,P[3]=ge,ft.clearBufferiv(ft.COLOR,0,P))}else wt|=ft.COLOR_BUFFER_BIT}xt&&(wt|=ft.DEPTH_BUFFER_BIT),Lt&&(wt|=ft.STENCIL_BUFFER_BIT),ft.clear(wt)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",ut,!1),e.removeEventListener("webglcontextrestored",nt,!1),e.removeEventListener("webglcontextcreationerror",lt,!1),Gt.dispose(),Ct.dispose(),be.dispose(),ye.dispose(),Vn.dispose(),H.dispose(),X.dispose(),pt.dispose(),rt.dispose(),k.dispose(),k.removeEventListener("sessionstart",oe),k.removeEventListener("sessionend",Ve),ue&&(ue.dispose(),ue=null),je.stop()};function ut(K){K.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),U=!0}function nt(){console.log("THREE.WebGLRenderer: Context Restored."),U=!1;let K=Ue.autoReset,xt=Kt.enabled,Lt=Kt.autoUpdate,wt=Kt.needsUpdate,Ot=Kt.type;st(),Ue.autoReset=K,Kt.enabled=xt,Kt.autoUpdate=Lt,Kt.needsUpdate=wt,Kt.type=Ot}function lt(K){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",K.statusMessage)}function dt(K){let xt=K.target;xt.removeEventListener("dispose",dt),at(xt)}function at(K){Bt(K),be.remove(K)}function Bt(K){let xt=be.get(K).programs;xt!==void 0&&(xt.forEach(function(Lt){rt.releaseProgram(Lt)}),K.isShaderMaterial&&rt.releaseShaderCache(K))}this.renderBufferDirect=function(K,xt,Lt,wt,Ot,Zt){xt===null&&(xt=Xt);let jt=Ot.isMesh&&Ot.matrixWorld.determinant()<0,Te=hr(K,xt,Lt,wt,Ot);de.setMaterial(wt,jt);let ge=Lt.index,Ne=1;if(wt.wireframe===!0){if(ge=j.getWireframeAttribute(Lt),ge===void 0)return;Ne=2}let pe=Lt.drawRange,Oe=Lt.attributes.position,Tn=pe.start*Ne,Bn=(pe.start+pe.count)*Ne;Zt!==null&&(Tn=Math.max(Tn,Zt.start*Ne),Bn=Math.min(Bn,(Zt.start+Zt.count)*Ne)),ge!==null?(Tn=Math.max(Tn,0),Bn=Math.min(Bn,ge.count)):Oe!=null&&(Tn=Math.max(Tn,0),Bn=Math.min(Bn,Oe.count));let rr=Bn-Tn;if(rr<0||rr===1/0)return;X.setup(Ot,wt,Te,Lt,ge);let Ki,pr=L;if(ge!==null&&(Ki=$n.get(ge),pr=F,pr.setIndex(Ki)),Ot.isMesh)wt.wireframe===!0?(de.setLineWidth(wt.wireframeLinewidth*Ee()),pr.setMode(ft.LINES)):pr.setMode(ft.TRIANGLES);else if(Ot.isLine){let ze=wt.linewidth;ze===void 0&&(ze=1),de.setLineWidth(ze*Ee()),Ot.isLineSegments?pr.setMode(ft.LINES):Ot.isLineLoop?pr.setMode(ft.LINE_LOOP):pr.setMode(ft.LINE_STRIP)}else Ot.isPoints?pr.setMode(ft.POINTS):Ot.isSprite&&pr.setMode(ft.TRIANGLES);if(Ot.isInstancedMesh)pr.renderInstances(Tn,rr,Ot.count);else if(Lt.isInstancedBufferGeometry){let ze=Lt._maxInstanceCount!==void 0?Lt._maxInstanceCount:1/0,Is=Math.min(Lt.instanceCount,ze);pr.renderInstances(Tn,rr,Is)}else pr.render(Tn,rr)},this.compile=function(K,xt){function Lt(wt,Ot,Zt){wt.transparent===!0&&wt.side===Wa&&wt.forceSinglePass===!1?(wt.side=Vo,wt.needsUpdate=!0,Me(wt,Ot,Zt),wt.side=Mu,wt.needsUpdate=!0,Me(wt,Ot,Zt),wt.side=Wa):Me(wt,Ot,Zt)}M=Ct.get(K),M.init(),N.push(M),K.traverseVisible(function(wt){wt.isLight&&wt.layers.test(xt.layers)&&(M.pushLight(wt),wt.castShadow&&M.pushShadow(wt))}),M.setupLights(A._useLegacyLights),K.traverse(function(wt){let Ot=wt.material;if(Ot)if(Array.isArray(Ot))for(let Zt=0;Zt<Ot.length;Zt++){let jt=Ot[Zt];Lt(jt,K,wt)}else Lt(Ot,K,wt)}),N.pop(),M=null};let qt=null;function we(K){qt&&qt(K)}function oe(){je.stop()}function Ve(){je.start()}let je=new q1;je.setAnimationLoop(we),typeof self!="undefined"&&je.setContext(self),this.setAnimationLoop=function(K){qt=K,k.setAnimationLoop(K),K===null?je.stop():je.start()},k.addEventListener("sessionstart",oe),k.addEventListener("sessionend",Ve),this.render=function(K,xt){if(xt!==void 0&&xt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(U===!0)return;K.matrixWorldAutoUpdate===!0&&K.updateMatrixWorld(),xt.parent===null&&xt.matrixWorldAutoUpdate===!0&&xt.updateMatrixWorld(),k.enabled===!0&&k.isPresenting===!0&&(k.cameraAutoUpdate===!0&&k.updateCamera(xt),xt=k.getCamera()),K.isScene===!0&&K.onBeforeRender(A,K,xt,q),M=Ct.get(K,N.length),M.init(),N.push(M),le.multiplyMatrices(xt.projectionMatrix,xt.matrixWorldInverse),zt.setFromProjectionMatrix(le),$t=this.localClippingEnabled,At=he.init(this.clippingPlanes,$t),I=Gt.get(K,E.length),I.init(),E.push(I),ur(K,xt,0,A.sortObjects),I.finish(),A.sortObjects===!0&&I.sort(Et,yt),this.info.render.frame++,At===!0&&he.beginShadows();let Lt=M.state.shadowsArray;if(Kt.render(Lt,K,xt),At===!0&&he.endShadows(),this.info.autoReset===!0&&this.info.reset(),tt.render(I,K),M.setupLights(A._useLegacyLights),xt.isArrayCamera){let wt=xt.cameras;for(let Ot=0,Zt=wt.length;Ot<Zt;Ot++){let jt=wt[Ot];Qn(I,K,jt,jt.viewport)}}else Qn(I,K,xt);q!==null&&(kt.updateMultisampleRenderTarget(q),kt.updateRenderTargetMipmap(q)),K.isScene===!0&&K.onAfterRender(A,K,xt),X.resetDefaultState(),D=-1,G=null,N.pop(),N.length>0?M=N[N.length-1]:M=null,E.pop(),E.length>0?I=E[E.length-1]:I=null};function ur(K,xt,Lt,wt){if(K.visible===!1)return;if(K.layers.test(xt.layers)){if(K.isGroup)Lt=K.renderOrder;else if(K.isLOD)K.autoUpdate===!0&&K.update(xt);else if(K.isLight)M.pushLight(K),K.castShadow&&M.pushShadow(K);else if(K.isSprite){if(!K.frustumCulled||zt.intersectsSprite(K)){wt&&me.setFromMatrixPosition(K.matrixWorld).applyMatrix4(le);let jt=H.update(K),Te=K.material;Te.visible&&I.push(K,jt,Te,Lt,me.z,null)}}else if((K.isMesh||K.isLine||K.isPoints)&&(!K.frustumCulled||zt.intersectsObject(K))){let jt=H.update(K),Te=K.material;if(wt&&(K.boundingSphere!==void 0?(K.boundingSphere===null&&K.computeBoundingSphere(),me.copy(K.boundingSphere.center)):(jt.boundingSphere===null&&jt.computeBoundingSphere(),me.copy(jt.boundingSphere.center)),me.applyMatrix4(K.matrixWorld).applyMatrix4(le)),Array.isArray(Te)){let ge=jt.groups;for(let Ne=0,pe=ge.length;Ne<pe;Ne++){let Oe=ge[Ne],Tn=Te[Oe.materialIndex];Tn&&Tn.visible&&I.push(K,jt,Tn,Lt,me.z,Oe)}}else Te.visible&&I.push(K,jt,Te,Lt,me.z,null)}}let Zt=K.children;for(let jt=0,Te=Zt.length;jt<Te;jt++)ur(Zt[jt],xt,Lt,wt)}function Qn(K,xt,Lt,wt){let Ot=K.opaque,Zt=K.transmissive,jt=K.transparent;M.setupLightsView(Lt),At===!0&&he.setGlobalState(A.clippingPlanes,Lt),Zt.length>0&&wr(Ot,Zt,xt,Lt),wt&&de.viewport(Q.copy(wt)),Ot.length>0&&Rr(Ot,xt,Lt),Zt.length>0&&Rr(Zt,xt,Lt),jt.length>0&&Rr(jt,xt,Lt),de.buffers.depth.setTest(!0),de.buffers.depth.setMask(!0),de.buffers.color.setMask(!0),de.setPolygonOffset(!1)}function wr(K,xt,Lt,wt){let Ot=fe.isWebGL2;ue===null&&(ue=new $a(1,1,{generateMipmaps:!0,type:te.has("EXT_color_buffer_half_float")?ef:wu,minFilter:tf,samples:Ot?4:0})),A.getDrawingBufferSize(Qt),Ot?ue.setSize(Qt.x,Qt.y):ue.setSize(Fg(Qt.x),Fg(Qt.y));let Zt=A.getRenderTarget();A.setRenderTarget(ue),A.getClearColor(Dt),et=A.getClearAlpha(),et<1&&A.setClearColor(16777215,.5),A.clear();let jt=A.toneMapping;A.toneMapping=Eu,Rr(K,Lt,wt),kt.updateMultisampleRenderTarget(ue),kt.updateRenderTargetMipmap(ue);let Te=!1;for(let ge=0,Ne=xt.length;ge<Ne;ge++){let pe=xt[ge],Oe=pe.object,Tn=pe.geometry,Bn=pe.material,rr=pe.group;if(Bn.side===Wa&&Oe.layers.test(wt.layers)){let Ki=Bn.side;Bn.side=Vo,Bn.needsUpdate=!0,er(Oe,Lt,wt,Tn,Bn,rr),Bn.side=Ki,Bn.needsUpdate=!0,Te=!0}}Te===!0&&(kt.updateMultisampleRenderTarget(ue),kt.updateRenderTargetMipmap(ue)),A.setRenderTarget(Zt),A.setClearColor(Dt,et),A.toneMapping=jt}function Rr(K,xt,Lt){let wt=xt.isScene===!0?xt.overrideMaterial:null;for(let Ot=0,Zt=K.length;Ot<Zt;Ot++){let jt=K[Ot],Te=jt.object,ge=jt.geometry,Ne=wt===null?jt.material:wt,pe=jt.group;Te.layers.test(Lt.layers)&&er(Te,xt,Lt,ge,Ne,pe)}}function er(K,xt,Lt,wt,Ot,Zt){K.onBeforeRender(A,xt,Lt,wt,Ot,Zt),K.modelViewMatrix.multiplyMatrices(Lt.matrixWorldInverse,K.matrixWorld),K.normalMatrix.getNormalMatrix(K.modelViewMatrix),Ot.onBeforeRender(A,xt,Lt,wt,K,Zt),Ot.transparent===!0&&Ot.side===Wa&&Ot.forceSinglePass===!1?(Ot.side=Vo,Ot.needsUpdate=!0,A.renderBufferDirect(Lt,xt,wt,Ot,K,Zt),Ot.side=Mu,Ot.needsUpdate=!0,A.renderBufferDirect(Lt,xt,wt,Ot,K,Zt),Ot.side=Wa):A.renderBufferDirect(Lt,xt,wt,Ot,K,Zt),K.onAfterRender(A,xt,Lt,wt,Ot,Zt)}function Me(K,xt,Lt){xt.isScene!==!0&&(xt=Xt);let wt=be.get(K),Ot=M.state.lights,Zt=M.state.shadowsArray,jt=Ot.state.version,Te=rt.getParameters(K,Ot.state,Zt,xt,Lt),ge=rt.getProgramCacheKey(Te),Ne=wt.programs;wt.environment=K.isMeshStandardMaterial?xt.environment:null,wt.fog=xt.fog,wt.envMap=(K.isMeshStandardMaterial?Vn:ye).get(K.envMap||wt.environment),Ne===void 0&&(K.addEventListener("dispose",dt),Ne=new Map,wt.programs=Ne);let pe=Ne.get(ge);if(pe!==void 0){if(wt.currentProgram===pe&&wt.lightsStateVersion===jt)return nr(K,Te),pe}else Te.uniforms=rt.getUniforms(K),K.onBuild(Lt,Te,A),K.onBeforeCompile(Te,A),pe=rt.acquireProgram(Te,ge),Ne.set(ge,pe),wt.uniforms=Te.uniforms;let Oe=wt.uniforms;(!K.isShaderMaterial&&!K.isRawShaderMaterial||K.clipping===!0)&&(Oe.clippingPlanes=he.uniform),nr(K,Te),wt.needsLights=Zn(K),wt.lightsStateVersion=jt,wt.needsLights&&(Oe.ambientLightColor.value=Ot.state.ambient,Oe.lightProbe.value=Ot.state.probe,Oe.directionalLights.value=Ot.state.directional,Oe.directionalLightShadows.value=Ot.state.directionalShadow,Oe.spotLights.value=Ot.state.spot,Oe.spotLightShadows.value=Ot.state.spotShadow,Oe.rectAreaLights.value=Ot.state.rectArea,Oe.ltc_1.value=Ot.state.rectAreaLTC1,Oe.ltc_2.value=Ot.state.rectAreaLTC2,Oe.pointLights.value=Ot.state.point,Oe.pointLightShadows.value=Ot.state.pointShadow,Oe.hemisphereLights.value=Ot.state.hemi,Oe.directionalShadowMap.value=Ot.state.directionalShadowMap,Oe.directionalShadowMatrix.value=Ot.state.directionalShadowMatrix,Oe.spotShadowMap.value=Ot.state.spotShadowMap,Oe.spotLightMatrix.value=Ot.state.spotLightMatrix,Oe.spotLightMap.value=Ot.state.spotLightMap,Oe.pointShadowMap.value=Ot.state.pointShadowMap,Oe.pointShadowMatrix.value=Ot.state.pointShadowMatrix);let Tn=pe.getUniforms(),Bn=Jl.seqWithValue(Tn.seq,Oe);return wt.currentProgram=pe,wt.uniformsList=Bn,pe}function nr(K,xt){let Lt=be.get(K);Lt.outputColorSpace=xt.outputColorSpace,Lt.instancing=xt.instancing,Lt.instancingColor=xt.instancingColor,Lt.skinning=xt.skinning,Lt.morphTargets=xt.morphTargets,Lt.morphNormals=xt.morphNormals,Lt.morphColors=xt.morphColors,Lt.morphTargetsCount=xt.morphTargetsCount,Lt.numClippingPlanes=xt.numClippingPlanes,Lt.numIntersection=xt.numClipIntersection,Lt.vertexAlphas=xt.vertexAlphas,Lt.vertexTangents=xt.vertexTangents,Lt.toneMapping=xt.toneMapping}function hr(K,xt,Lt,wt,Ot){xt.isScene!==!0&&(xt=Xt),kt.resetTextureUnits();let Zt=xt.fog,jt=wt.isMeshStandardMaterial?xt.environment:null,Te=q===null?A.outputColorSpace:q.isXRRenderTarget===!0?q.texture.colorSpace:Ya,ge=(wt.isMeshStandardMaterial?Vn:ye).get(wt.envMap||jt),Ne=wt.vertexColors===!0&&!!Lt.attributes.color&&Lt.attributes.color.itemSize===4,pe=!!Lt.attributes.tangent&&(!!wt.normalMap||wt.anisotropy>0),Oe=!!Lt.morphAttributes.position,Tn=!!Lt.morphAttributes.normal,Bn=!!Lt.morphAttributes.color,rr=Eu;wt.toneMapped&&(q===null||q.isXRRenderTarget===!0)&&(rr=A.toneMapping);let Ki=Lt.morphAttributes.position||Lt.morphAttributes.normal||Lt.morphAttributes.color,pr=Ki!==void 0?Ki.length:0,ze=be.get(wt),Is=M.state.lights;if(At===!0&&($t===!0||K!==G)){let fi=K===G&&wt.id===D;he.setState(wt,K,fi)}let De=!1;wt.version===ze.__version?(ze.needsLights&&ze.lightsStateVersion!==Is.state.version||ze.outputColorSpace!==Te||Ot.isInstancedMesh&&ze.instancing===!1||!Ot.isInstancedMesh&&ze.instancing===!0||Ot.isSkinnedMesh&&ze.skinning===!1||!Ot.isSkinnedMesh&&ze.skinning===!0||Ot.isInstancedMesh&&ze.instancingColor===!0&&Ot.instanceColor===null||Ot.isInstancedMesh&&ze.instancingColor===!1&&Ot.instanceColor!==null||ze.envMap!==ge||wt.fog===!0&&ze.fog!==Zt||ze.numClippingPlanes!==void 0&&(ze.numClippingPlanes!==he.numPlanes||ze.numIntersection!==he.numIntersection)||ze.vertexAlphas!==Ne||ze.vertexTangents!==pe||ze.morphTargets!==Oe||ze.morphNormals!==Tn||ze.morphColors!==Bn||ze.toneMapping!==rr||fe.isWebGL2===!0&&ze.morphTargetsCount!==pr)&&(De=!0):(De=!0,ze.__version=wt.version);let Yo=ze.currentProgram;De===!0&&(Yo=Me(wt,xt,Ot));let Ui=!1,$o=!1,Ka=!1,Se=Yo.getUniforms(),Qi=ze.uniforms;if(de.useProgram(Yo.program)&&(Ui=!0,$o=!0,Ka=!0),wt.id!==D&&(D=wt.id,$o=!0),Ui||G!==K){Se.setValue(ft,"projectionMatrix",K.projectionMatrix),Se.setValue(ft,"viewMatrix",K.matrixWorldInverse);let fi=Se.map.cameraPosition;fi!==void 0&&fi.setValue(ft,me.setFromMatrixPosition(K.matrixWorld)),fe.logarithmicDepthBuffer&&Se.setValue(ft,"logDepthBufFC",2/(Math.log(K.far+1)/Math.LN2)),(wt.isMeshPhongMaterial||wt.isMeshToonMaterial||wt.isMeshLambertMaterial||wt.isMeshBasicMaterial||wt.isMeshStandardMaterial||wt.isShaderMaterial)&&Se.setValue(ft,"isOrthographic",K.isOrthographicCamera===!0),G!==K&&(G=K,$o=!0,Ka=!0)}if(Ot.isSkinnedMesh){Se.setOptional(ft,Ot,"bindMatrix"),Se.setOptional(ft,Ot,"bindMatrixInverse");let fi=Ot.skeleton;fi&&(fe.floatVertexTextures?(fi.boneTexture===null&&fi.computeBoneTexture(),Se.setValue(ft,"boneTexture",fi.boneTexture,kt),Se.setValue(ft,"boneTextureSize",fi.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}let ci=Lt.morphAttributes;if((ci.position!==void 0||ci.normal!==void 0||ci.color!==void 0&&fe.isWebGL2===!0)&&C.update(Ot,Lt,Yo),($o||ze.receiveShadow!==Ot.receiveShadow)&&(ze.receiveShadow=Ot.receiveShadow,Se.setValue(ft,"receiveShadow",Ot.receiveShadow)),wt.isMeshGouraudMaterial&&wt.envMap!==null&&(Qi.envMap.value=ge,Qi.flipEnvMap.value=ge.isCubeTexture&&ge.isRenderTargetTexture===!1?-1:1),$o&&(Se.setValue(ft,"toneMappingExposure",A.toneMappingExposure),ze.needsLights&&lr(Qi,Ka),Zt&&wt.fog===!0&&Wt.refreshFogUniforms(Qi,Zt),Wt.refreshMaterialUniforms(Qi,wt,Pt,It,ue),Jl.upload(ft,ze.uniformsList,Qi,kt)),wt.isShaderMaterial&&wt.uniformsNeedUpdate===!0&&(Jl.upload(ft,ze.uniformsList,Qi,kt),wt.uniformsNeedUpdate=!1),wt.isSpriteMaterial&&Se.setValue(ft,"center",Ot.center),Se.setValue(ft,"modelViewMatrix",Ot.modelViewMatrix),Se.setValue(ft,"normalMatrix",Ot.normalMatrix),Se.setValue(ft,"modelMatrix",Ot.matrixWorld),wt.isShaderMaterial||wt.isRawShaderMaterial){let fi=wt.uniformsGroups;for(let Ce=0,Du=fi.length;Ce<Du;Ce++)if(fe.isWebGL2){let Qa=fi[Ce];pt.update(Qa,Yo),pt.bind(Qa,Yo)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Yo}function lr(K,xt){K.ambientLightColor.needsUpdate=xt,K.lightProbe.needsUpdate=xt,K.directionalLights.needsUpdate=xt,K.directionalLightShadows.needsUpdate=xt,K.pointLights.needsUpdate=xt,K.pointLightShadows.needsUpdate=xt,K.spotLights.needsUpdate=xt,K.spotLightShadows.needsUpdate=xt,K.rectAreaLights.needsUpdate=xt,K.hemisphereLights.needsUpdate=xt}function Zn(K){return K.isMeshLambertMaterial||K.isMeshToonMaterial||K.isMeshPhongMaterial||K.isMeshStandardMaterial||K.isShadowMaterial||K.isShaderMaterial&&K.lights===!0}this.getActiveCubeFace=function(){return z},this.getActiveMipmapLevel=function(){return $},this.getRenderTarget=function(){return q},this.setRenderTargetTextures=function(K,xt,Lt){be.get(K.texture).__webglTexture=xt,be.get(K.depthTexture).__webglTexture=Lt;let wt=be.get(K);wt.__hasExternalTextures=!0,wt.__hasExternalTextures&&(wt.__autoAllocateDepthBuffer=Lt===void 0,wt.__autoAllocateDepthBuffer||te.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),wt.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(K,xt){let Lt=be.get(K);Lt.__webglFramebuffer=xt,Lt.__useDefaultFramebuffer=xt===void 0},this.setRenderTarget=function(K,xt=0,Lt=0){q=K,z=xt,$=Lt;let wt=!0,Ot=null,Zt=!1,jt=!1;if(K){let ge=be.get(K);ge.__useDefaultFramebuffer!==void 0?(de.bindFramebuffer(ft.FRAMEBUFFER,null),wt=!1):ge.__webglFramebuffer===void 0?kt.setupRenderTarget(K):ge.__hasExternalTextures&&kt.rebindTextures(K,be.get(K.texture).__webglTexture,be.get(K.depthTexture).__webglTexture);let Ne=K.texture;(Ne.isData3DTexture||Ne.isDataArrayTexture||Ne.isCompressedArrayTexture)&&(jt=!0);let pe=be.get(K).__webglFramebuffer;K.isWebGLCubeRenderTarget?(Array.isArray(pe[xt])?Ot=pe[xt][Lt]:Ot=pe[xt],Zt=!0):fe.isWebGL2&&K.samples>0&&kt.useMultisampledRTT(K)===!1?Ot=be.get(K).__webglMultisampledFramebuffer:Array.isArray(pe)?Ot=pe[Lt]:Ot=pe,Q.copy(K.viewport),_t.copy(K.scissor),Z=K.scissorTest}else Q.copy(Y).multiplyScalar(Pt).floor(),_t.copy(ht).multiplyScalar(Pt).floor(),Z=Mt;if(de.bindFramebuffer(ft.FRAMEBUFFER,Ot)&&fe.drawBuffers&&wt&&de.drawBuffers(K,Ot),de.viewport(Q),de.scissor(_t),de.setScissorTest(Z),Zt){let ge=be.get(K.texture);ft.framebufferTexture2D(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,ft.TEXTURE_CUBE_MAP_POSITIVE_X+xt,ge.__webglTexture,Lt)}else if(jt){let ge=be.get(K.texture),Ne=xt||0;ft.framebufferTextureLayer(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,ge.__webglTexture,Lt||0,Ne)}D=-1},this.readRenderTargetPixels=function(K,xt,Lt,wt,Ot,Zt,jt){if(!(K&&K.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Te=be.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&jt!==void 0&&(Te=Te[jt]),Te){de.bindFramebuffer(ft.FRAMEBUFFER,Te);try{let ge=K.texture,Ne=ge.format,pe=ge.type;if(Ne!==Vs&&J.convert(Ne)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Oe=pe===ef&&(te.has("EXT_color_buffer_half_float")||fe.isWebGL2&&te.has("EXT_color_buffer_float"));if(pe!==wu&&J.convert(pe)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_TYPE)&&!(pe===_u&&(fe.isWebGL2||te.has("OES_texture_float")||te.has("WEBGL_color_buffer_float")))&&!Oe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}xt>=0&&xt<=K.width-wt&&Lt>=0&&Lt<=K.height-Ot&&ft.readPixels(xt,Lt,wt,Ot,J.convert(Ne),J.convert(pe),Zt)}finally{let ge=q!==null?be.get(q).__webglFramebuffer:null;de.bindFramebuffer(ft.FRAMEBUFFER,ge)}}},this.copyFramebufferToTexture=function(K,xt,Lt=0){let wt=Math.pow(2,-Lt),Ot=Math.floor(xt.image.width*wt),Zt=Math.floor(xt.image.height*wt);kt.setTexture2D(xt,0),ft.copyTexSubImage2D(ft.TEXTURE_2D,Lt,0,0,K.x,K.y,Ot,Zt),de.unbindTexture()},this.copyTextureToTexture=function(K,xt,Lt,wt=0){let Ot=xt.image.width,Zt=xt.image.height,jt=J.convert(Lt.format),Te=J.convert(Lt.type);kt.setTexture2D(Lt,0),ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,Lt.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Lt.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,Lt.unpackAlignment),xt.isDataTexture?ft.texSubImage2D(ft.TEXTURE_2D,wt,K.x,K.y,Ot,Zt,jt,Te,xt.image.data):xt.isCompressedTexture?ft.compressedTexSubImage2D(ft.TEXTURE_2D,wt,K.x,K.y,xt.mipmaps[0].width,xt.mipmaps[0].height,jt,xt.mipmaps[0].data):ft.texSubImage2D(ft.TEXTURE_2D,wt,K.x,K.y,jt,Te,xt.image),wt===0&&Lt.generateMipmaps&&ft.generateMipmap(ft.TEXTURE_2D),de.unbindTexture()},this.copyTextureToTexture3D=function(K,xt,Lt,wt,Ot=0){if(A.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Zt=K.max.x-K.min.x+1,jt=K.max.y-K.min.y+1,Te=K.max.z-K.min.z+1,ge=J.convert(wt.format),Ne=J.convert(wt.type),pe;if(wt.isData3DTexture)kt.setTexture3D(wt,0),pe=ft.TEXTURE_3D;else if(wt.isDataArrayTexture)kt.setTexture2DArray(wt,0),pe=ft.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,wt.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,wt.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,wt.unpackAlignment);let Oe=ft.getParameter(ft.UNPACK_ROW_LENGTH),Tn=ft.getParameter(ft.UNPACK_IMAGE_HEIGHT),Bn=ft.getParameter(ft.UNPACK_SKIP_PIXELS),rr=ft.getParameter(ft.UNPACK_SKIP_ROWS),Ki=ft.getParameter(ft.UNPACK_SKIP_IMAGES),pr=Lt.isCompressedTexture?Lt.mipmaps[0]:Lt.image;ft.pixelStorei(ft.UNPACK_ROW_LENGTH,pr.width),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,pr.height),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,K.min.x),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,K.min.y),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,K.min.z),Lt.isDataTexture||Lt.isData3DTexture?ft.texSubImage3D(pe,Ot,xt.x,xt.y,xt.z,Zt,jt,Te,ge,Ne,pr.data):Lt.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ft.compressedTexSubImage3D(pe,Ot,xt.x,xt.y,xt.z,Zt,jt,Te,ge,pr.data)):ft.texSubImage3D(pe,Ot,xt.x,xt.y,xt.z,Zt,jt,Te,ge,Ne,pr),ft.pixelStorei(ft.UNPACK_ROW_LENGTH,Oe),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,Tn),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,Bn),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,rr),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Ki),Ot===0&&wt.generateMipmaps&&ft.generateMipmap(pe),de.unbindTexture()},this.initTexture=function(K){K.isCubeTexture?kt.setTextureCube(K,0):K.isData3DTexture?kt.setTexture3D(K,0):K.isDataArrayTexture||K.isCompressedArrayTexture?kt.setTexture2DArray(K,0):kt.setTexture2D(K,0),de.unbindTexture()},this.resetState=function(){z=0,$=0,q=null,de.reset(),X.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return qa}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===gm?"display-p3":"srgb",e.unpackColorSpace=yr.workingColorSpace===Jh?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(t){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!t}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===qi?nl:k1}set outputEncoding(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===nl?qi:Ya}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}},nm=class extends em{};nm.prototype.isWebGL1Renderer=!0;function Ph(r,t,e){return!r||!e&&r.constructor===t?r:typeof t.BYTES_PER_ELEMENT=="number"?new t(r):Array.prototype.slice.call(r)}function WO(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var nc=class{constructor(t,e,o,a){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=a!==void 0?a:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,a=e[o],c=e[o-1];t:{e:{let p;n:{r:if(!(t<a)){for(let d=o+2;;){if(a===void 0){if(t<c)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===d)break;if(c=a,a=e[++o],t<a)break e}p=e.length;break n}if(!(t>=c)){let d=e[1];t<d&&(o=2,c=d);for(let g=o-2;;){if(c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===g)break;if(a=c,c=e[--o-1],t>=c)break e}p=o,o=0;break n}break t}for(;o<p;){let d=o+p>>>1;t<e[d]?p=d:o=d+1}if(a=e[o],c=e[o-1],c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(a===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,c,a)}return this.interpolate_(o,c,t,a)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=t*a;for(let p=0;p!==a;++p)e[p]=o[c+p];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},rm=class extends nc{constructor(t,e,o,a){super(t,e,o,a),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:k_,endingEnd:k_}}intervalChanged_(t,e,o){let a=this.parameterPositions,c=t-2,p=t+1,d=a[c],g=a[p];if(d===void 0)switch(this.getSettings_().endingStart){case H_:c=t,d=2*e-o;break;case V_:c=a.length-2,d=e+a[c]-a[c+1];break;default:c=t,d=o}if(g===void 0)switch(this.getSettings_().endingEnd){case H_:p=t,g=2*o-e;break;case V_:p=1,g=o+a[1]-a[0];break;default:p=t-1,g=e}let y=(o-e)*.5,_=this.valueSize;this._weightPrev=y/(e-d),this._weightNext=y/(g-o),this._offsetPrev=c*_,this._offsetNext=p*_}interpolate_(t,e,o,a){let c=this.resultBuffer,p=this.sampleValues,d=this.valueSize,g=t*d,y=g-d,_=this._offsetPrev,w=this._offsetNext,x=this._weightPrev,b=this._weightNext,P=(o-e)/(a-e),I=P*P,M=I*P,E=-x*M+2*x*I-x*P,N=(1+x)*M+(-1.5-2*x)*I+(-.5+x)*P+1,A=(-1-b)*M+(1.5+b)*I+.5*P,U=b*M-b*I;for(let z=0;z!==d;++z)c[z]=E*p[_+z]+N*p[y+z]+A*p[g+z]+U*p[w+z];return c}},im=class extends nc{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let c=this.resultBuffer,p=this.sampleValues,d=this.valueSize,g=t*d,y=g-d,_=(o-e)/(a-e),w=1-_;for(let x=0;x!==d;++x)c[x]=p[y+x]*w+p[g+x]*_;return c}},om=class extends nc{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t){return this.copySampleValue_(t-1)}},qs=class{constructor(t,e,o,a){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ph(e,this.TimeBufferType),this.values=Ph(o,this.ValueBufferType),this.setInterpolation(a||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,o;if(e.toJSON!==this.toJSON)o=e.toJSON(t);else{o={name:t.name,times:Ph(t.times,Array),values:Ph(t.values,Array)};let a=t.getInterpolation();a!==t.DefaultInterpolation&&(o.interpolation=a)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new om(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new im(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new rm(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Ih:e=this.InterpolantFactoryMethodDiscrete;break;case Rh:e=this.InterpolantFactoryMethodLinear;break;case og:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let o="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(o);return console.warn("THREE.KeyframeTrack:",o),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ih;case this.InterpolantFactoryMethodLinear:return Rh;case this.InterpolantFactoryMethodSmooth:return og}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]*=t}return this}trim(t,e){let o=this.times,a=o.length,c=0,p=a-1;for(;c!==a&&o[c]<t;)++c;for(;p!==-1&&o[p]>e;)--p;if(++p,c!==0||p!==a){c>=p&&(p=Math.max(p,1),c=p-1);let d=this.getValueSize();this.times=o.slice(c,p),this.values=this.values.slice(c*d,p*d)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let o=this.times,a=this.values,c=o.length;c===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let p=null;for(let d=0;d!==c;d++){let g=o[d];if(typeof g=="number"&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,d,g),t=!1;break}if(p!==null&&p>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,d,g,p),t=!1;break}p=g}if(a!==void 0&&WO(a))for(let d=0,g=a.length;d!==g;++d){let y=a[d];if(isNaN(y)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,d,y),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),a=this.getInterpolation()===og,c=t.length-1,p=1;for(let d=1;d<c;++d){let g=!1,y=t[d],_=t[d+1];if(y!==_&&(d!==1||y!==t[0]))if(a)g=!0;else{let w=d*o,x=w-o,b=w+o;for(let P=0;P!==o;++P){let I=e[w+P];if(I!==e[x+P]||I!==e[b+P]){g=!0;break}}}if(g){if(d!==p){t[p]=t[d];let w=d*o,x=p*o;for(let b=0;b!==o;++b)e[x+b]=e[w+b]}++p}}if(c>0){t[p]=t[c];for(let d=c*o,g=p*o,y=0;y!==o;++y)e[g+y]=e[d+y];++p}return p!==t.length?(this.times=t.slice(0,p),this.values=e.slice(0,p*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,a=new o(this.name,t,e);return a.createInterpolant=this.createInterpolant,a}};qs.prototype.TimeBufferType=Float32Array;qs.prototype.ValueBufferType=Float32Array;qs.prototype.DefaultInterpolation=Rh;var ol=class extends qs{};ol.prototype.ValueTypeName="bool";ol.prototype.ValueBufferType=Array;ol.prototype.DefaultInterpolation=Ih;ol.prototype.InterpolantFactoryMethodLinear=void 0;ol.prototype.InterpolantFactoryMethodSmooth=void 0;var sm=class extends qs{};sm.prototype.ValueTypeName="color";var am=class extends qs{};am.prototype.ValueTypeName="number";var um=class extends nc{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let c=this.resultBuffer,p=this.sampleValues,d=this.valueSize,g=(o-e)/(a-e),y=t*d;for(let _=y+d;y!==_;y+=4)bu.slerpFlat(c,0,p,y-d,p,y,g);return c}},of=class extends qs{InterpolantFactoryMethodLinear(t){return new um(this.times,this.values,this.getValueSize(),t)}};of.prototype.ValueTypeName="quaternion";of.prototype.DefaultInterpolation=Rh;of.prototype.InterpolantFactoryMethodSmooth=void 0;var sl=class extends qs{};sl.prototype.ValueTypeName="string";sl.prototype.ValueBufferType=Array;sl.prototype.DefaultInterpolation=Ih;sl.prototype.InterpolantFactoryMethodLinear=void 0;sl.prototype.InterpolantFactoryMethodSmooth=void 0;var lm=class extends qs{};lm.prototype.ValueTypeName="vector";var cm=class{constructor(t,e,o){let a=this,c=!1,p=0,d=0,g,y=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(_){d++,c===!1&&a.onStart!==void 0&&a.onStart(_,p,d),c=!0},this.itemEnd=function(_){p++,a.onProgress!==void 0&&a.onProgress(_,p,d),p===d&&(c=!1,a.onLoad!==void 0&&a.onLoad())},this.itemError=function(_){a.onError!==void 0&&a.onError(_)},this.resolveURL=function(_){return g?g(_):_},this.setURLModifier=function(_){return g=_,this},this.addHandler=function(_,w){return y.push(_,w),this},this.removeHandler=function(_){let w=y.indexOf(_);return w!==-1&&y.splice(w,2),this},this.getHandler=function(_){for(let w=0,x=y.length;w<x;w+=2){let b=y[w],P=y[w+1];if(b.global&&(b.lastIndex=0),b.test(_))return P}return null}}},qO=new cm,fm=class{constructor(t){this.manager=t!==void 0?t:qO,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(a,c){o.load(t,a,e,c)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};fm.DEFAULT_MATERIAL_NAME="__DEFAULT";var ym="\\\\[\\\\]\\\\.:\\\\/",XO=new RegExp("["+ym+"]","g"),vm="[^"+ym+"]",YO="[^"+ym.replace("\\\\.","")+"]",$O=/((?:WC+[\\/:])*)/.source.replace("WC",vm),ZO=/(WCOD+)?/.source.replace("WCOD",YO),JO=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",vm),KO=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",vm),QO=new RegExp("^"+$O+ZO+JO+KO+"$"),jO=["material","materials","bones","map"],hm=class{constructor(t,e,o){let a=o||Or.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,a)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,a=this._bindings[o];a!==void 0&&a.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let a=this._targetGroup.nCachedObjects_,c=o.length;a!==c;++a)o[a].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].unbind()}},Or=class r{constructor(t,e,o){this.path=e,this.parsedPath=o||r.parseTrackName(e),this.node=r.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,o){return t&&t.isAnimationObjectGroup?new r.Composite(t,e,o):new r(t,e,o)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(XO,"")}static parseTrackName(t){let e=QO.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let o={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},a=o.nodeName&&o.nodeName.lastIndexOf(".");if(a!==void 0&&a!==-1){let c=o.nodeName.substring(a+1);jO.indexOf(c)!==-1&&(o.nodeName=o.nodeName.substring(0,a),o.objectName=c)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return o}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let o=t.skeleton.getBoneByName(e);if(o!==void 0)return o}if(t.children){let o=function(c){for(let p=0;p<c.length;p++){let d=c[p];if(d.name===e||d.uuid===e)return d;let g=o(d.children);if(g)return g}return null},a=o(t.children);if(a)return a}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let o=this.resolvedProperty;for(let a=0,c=o.length;a!==c;++a)t[e++]=o[a]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let o=this.resolvedProperty;for(let a=0,c=o.length;a!==c;++a)o[a]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,c=o.length;a!==c;++a)o[a]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,c=o.length;a!==c;++a)o[a]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,o=e.objectName,a=e.propertyName,c=e.propertyIndex;if(t||(t=r.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(o){let y=e.objectIndex;switch(o){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let _=0;_<t.length;_++)if(t[_].name===y){y=_;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(y!==void 0){if(t[y]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[y]}}let p=t[a];if(p===void 0){let y=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+y+"."+a+" but it wasn't found.",t);return}let d=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?d=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(d=this.Versioning.MatrixWorldNeedsUpdate);let g=this.BindingType.Direct;if(c!==void 0){if(a==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[c]!==void 0&&(c=t.morphTargetDictionary[c])}g=this.BindingType.ArrayElement,this.resolvedProperty=p,this.propertyIndex=c}else p.fromArray!==void 0&&p.toArray!==void 0?(g=this.BindingType.HasFromToArray,this.resolvedProperty=p):Array.isArray(p)?(g=this.BindingType.EntireArray,this.resolvedProperty=p):this.propertyName=a;this.getValue=this.GetterByBindingType[g],this.setValue=this.SetterByBindingTypeAndVersioning[g][d]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Or.Composite=hm;Or.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Or.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Or.prototype.GetterByBindingType=[Or.prototype._getValue_direct,Or.prototype._getValue_array,Or.prototype._getValue_arrayElement,Or.prototype._getValue_toArray];Or.prototype.SetterByBindingTypeAndVersioning=[[Or.prototype._setValue_direct,Or.prototype._setValue_direct_setNeedsUpdate,Or.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Or.prototype._setValue_array,Or.prototype._setValue_array_setNeedsUpdate,Or.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Or.prototype._setValue_arrayElement,Or.prototype._setValue_arrayElement_setNeedsUpdate,Or.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Or.prototype._setValue_fromArray,Or.prototype._setValue_fromArray_setNeedsUpdate,Or.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Oz=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:pm}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=pm);var Li=63710088e-1,Fz={centimeters:Li*100,centimetres:Li*100,degrees:Li/111325,feet:Li*3.28084,inches:Li*39.37,kilometers:Li/1e3,kilometres:Li/1e3,meters:Li,metres:Li,miles:Li/1609.344,millimeters:Li*1e3,millimetres:Li*1e3,nauticalmiles:Li/1852,radians:1,yards:Li*1.0936},Uz={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/Li,yards:1.0936133};function xo(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}function Tr(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(!pa(r[0])||!pa(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return xo(o,t,e)}function Dr(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var c=a[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<c[c.length-1].length;p++)if(c[c.length-1][p]!==c[0][p])throw new Error("First and last Position are not equivalent.")}var d={type:"Polygon",coordinates:r};return xo(d,t,e)}function Ni(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 xo(o,t,e)}function _m(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return xo(o,t,e)}function pa(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function yi(r,t,e){if(r!==null)for(var o,a,c,p,d,g,y,_=0,w=0,x,b=r.type,P=b==="FeatureCollection",I=b==="Feature",M=P?r.features.length:1,E=0;E<M;E++){y=P?r.features[E].geometry:I?r.geometry:r,x=y?y.type==="GeometryCollection":!1,d=x?y.geometries.length:1;for(var N=0;N<d;N++){var A=0,U=0;if(p=x?y.geometries[N]:y,p!==null){g=p.coordinates;var z=p.type;switch(_=e&&(z==="Polygon"||z==="MultiPolygon")?1:0,z){case null:break;case"Point":if(t(g,w,E,A,U)===!1)return!1;w++,A++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],w,E,A,U)===!1)return!1;w++,z==="MultiPoint"&&A++}z==="LineString"&&A++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(a=0;a<g[o].length-_;a++){if(t(g[o][a],w,E,A,U)===!1)return!1;w++}z==="MultiLineString"&&A++,z==="Polygon"&&U++}z==="Polygon"&&A++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(U=0,a=0;a<g[o].length;a++){for(c=0;c<g[o][a].length-_;c++){if(t(g[o][a][c],w,E,A,U)===!1)return!1;w++}U++}A++}break;case"GeometryCollection":for(o=0;o<p.geometries.length;o++)if(yi(p.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function J1(r,t,e,o){var a=e;return yi(r,function(c,p,d,g,y){p===0&&e===void 0?a=c:a=t(a,c,p,d,g,y)},o),a}function Tu(r,t){var e,o,a,c,p,d,g,y,_,w,x=0,b=r.type==="FeatureCollection",P=r.type==="Feature",I=b?r.features.length:1;for(e=0;e<I;e++){for(d=b?r.features[e].geometry:P?r.geometry:r,y=b?r.features[e].properties:P?r.properties:{},_=b?r.features[e].bbox:P?r.bbox:void 0,w=b?r.features[e].id:P?r.id:void 0,g=d?d.type==="GeometryCollection":!1,p=g?d.geometries.length:1,a=0;a<p;a++){if(c=g?d.geometries[a]:d,c===null){if(t(null,x,y,_,w)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,y,_,w)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,y,_,w)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function fs(r,t){Tu(r,function(e,o,a,c,p){var d=e===null?null:e.type;switch(d){case null:case"Point":case"LineString":case"Polygon":return t(xo(e,a,{bbox:c,id:p}),o,0)===!1?!1:void 0}var g;switch(d){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var y=0;y<e.coordinates.length;y++){var _=e.coordinates[y],w={type:g,coordinates:_};if(t(xo(w,a),o,y)===!1)return!1}})}function xm(r){var t=[1/0,1/0,-1/0,-1/0];return yi(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}xm.default=xm;var Eo=xm;function Yi(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Em(r,t,e){if(!r)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!r.geometry||r.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+r.geometry.type)}function $i(r){return r.type==="Feature"?r.geometry:r}var aD=Nr(Qh(),1);var yD=Nr(dx(),1);function Oi(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=Yi(r),a=$i(t),c=a.type,p=t.bbox,d=a.coordinates;if(p&&vD(o,p)===!1)return!1;c==="Polygon"&&(d=[d]);for(var g=!1,y=0;y<d.length&&!g;y++)if(gx(o,d[y][0],e.ignoreBoundary)){for(var _=!1,w=1;w<d[y].length&&!_;)gx(o,d[y][w],!e.ignoreBoundary)&&(_=!0),w++;_||(g=!0)}return g}function gx(r,t,e){var o=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var a=0,c=t.length-1;a<t.length;c=a++){var p=t[a][0],d=t[a][1],g=t[c][0],y=t[c][1],_=r[1]*(p-g)+d*(g-r[0])+y*(r[0]-p)===0&&(p-r[0])*(g-r[0])<=0&&(d-r[1])*(y-r[1])<=0;if(_)return!e;var w=d>r[1]!=y>r[1]&&r[0]<(g-p)*(r[1]-d)/(y-d)+p;w&&(o=!o)}return o}function vD(r,t){return t[0]<=r[0]&&t[1]<=r[1]&&t[2]>=r[0]&&t[3]>=r[1]}var vx=new ArrayBuffer(16),hG=new Float64Array(vx),pG=new Uint32Array(vx);var ND=Nr(Um(),1);var zk=function(){function r(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var o=this.points[e],a=this.points[e+1];this.centers.push({x:(o.x+a.x)/2,y:(o.y+a.y)/2,z:(o.z+a.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var c=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,p=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,d=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+c),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+p),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+d)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+c),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+p),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+d)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return r.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var a=0;a<this.duration;a+=10){var c=this.pos(a),p=Math.sqrt((c.x-o.x)*(c.x-o.x)+(c.y-o.y)*(c.y-o.y)+(c.z-o.z)*(c.z-o.z));p>t&&(e.push(a),o=c)}return e},r.prototype.vector=function(t){var e=this.pos(t+10),o=this.pos(t-10);return{angle:180*Math.atan2(e.y-o.y,e.x-o.x)/3.14,speed:Math.sqrt((o.x-e.x)*(o.x-e.x)+(o.y-e.y)*(o.y-e.y)+(o.z-e.z)*(o.z-e.z))}},r.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var o=e/this.duration;if(o>=1)return this.points[this.length-1];var a=Math.floor((this.points.length-1)*o),c=(this.length-1)*o-a;return OD(c,this.points[a],this.controls[a][1],this.controls[a+1][0],this.points[a+1])},r}();function OD(r,t,e,o,a){var c=DD(r),p={x:a.x*c[0]+o.x*c[1]+e.x*c[2]+t.x*c[3],y:a.y*c[0]+o.y*c[1]+e.y*c[2]+t.y*c[3],z:a.z*c[0]+o.z*c[1]+e.z*c[2]+t.z*c[3]};return p}function DD(r){var t=r*r,e=t*r;return[e,3*t*(1-r),3*r*(1-r)*(1-r),(1-r)*(1-r)*(1-r)]}function cf(r,t){t===void 0&&(t={});var e=Number(r[0]),o=Number(r[1]),a=Number(r[2]),c=Number(r[3]);if(r.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var p=[e,o],d=[e,c],g=[a,c],y=[a,o];return Dr([[p,y,g,d,p]],t.properties,{bbox:r,id:t.id})}function FD(r){return cf(Eo(r))}var Bm=FD;var jD=Nr(Px(),1);var T3=Nr(gp(),1);var C3=Nr(Qh(),1);var R3=Nr(Um(),1);var Yx=Math.PI/180,$x=180/Math.PI,yf=function(r,t){this.lon=r,this.lat=t,this.x=Yx*r,this.y=Yx*t};yf.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};yf.prototype.antipode=function(){var r=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new yf(t,r)};var Zx=function(){this.coords=[],this.length=0};Zx.prototype.move_to=function(r){this.length++,this.coords.push(r)};var i0=function(r){this.properties=r||{},this.geometries=[]};i0.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var r=[],t=0;t<this.geometries.length;t++)r.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:r},type:"Feature",properties:this.properties}};i0.prototype.wkt=function(){for(var r="",t="LINESTRING(",e=function(c){t+=c[0]+" "+c[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var a=this.geometries[o].coords;a.forEach(e),r+=t.substring(0,t.length-1)+")"}return r};var Jx=function(r,t,e){if(!r||r.x===void 0||r.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new yf(r.x,r.y),this.end=new yf(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,a=this.start.y-this.end.y,c=Math.pow(Math.sin(a/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(c)),this.g===Math.PI)throw new Error("it appears "+r.view()+" and "+t.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+r+" and "+t)};Jx.prototype.interpolate=function(r){var t=Math.sin((1-r)*this.g)/Math.sin(this.g),e=Math.sin(r*this.g)/Math.sin(this.g),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),a=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),c=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),p=$x*Math.atan2(c,Math.sqrt(Math.pow(o,2)+Math.pow(a,2))),d=$x*Math.atan2(a,o);return[d,p]};Jx.prototype.Arc=function(r,t){var e=[];if(!r||r<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(r-1),a=0;a<r;++a){var c=o*a,p=this.interpolate(c);e.push(p)}for(var d=!1,g=0,y=t&&t.offset?t.offset:10,_=180-y,w=-180+y,x=360-y,b=1;b<e.length;++b){var P=e[b-1][0],I=e[b][0],M=Math.abs(I-P);M>x&&(I>_&&P<w||P>_&&I<w)?d=!0:M>g&&(g=M)}var E=[];if(d&&g<y){var N=[];E.push(N);for(var A=0;A<e.length;++A){var U=parseFloat(e[A][0]);if(A>0&&Math.abs(U-e[A-1][0])>x){var z=parseFloat(e[A-1][0]),$=parseFloat(e[A-1][1]),q=parseFloat(e[A][0]),D=parseFloat(e[A][1]);if(z>-180&&z<w&&q===180&&A+1<e.length&&e[A-1][0]>-180&&e[A-1][0]<w){N.push([-180,e[A][1]]),A++,N.push([e[A][0],e[A][1]]);continue}else if(z>_&&z<180&&q===-180&&A+1<e.length&&e[A-1][0]>_&&e[A-1][0]<180){N.push([180,e[A][1]]),A++,N.push([e[A][0],e[A][1]]);continue}if(z<w&&q>_){var G=z;z=q,q=G;var Q=$;$=D,D=Q}if(z>_&&q<w&&(q+=360),z<=180&&q>=180&&z<q){var _t=(180-z)/(q-z),Z=_t*D+(1-_t)*$;N.push([e[A-1][0]>_?180:-180,Z]),N=[],N.push([e[A-1][0]>_?-180:180,Z]),E.push(N)}else N=[],E.push(N);N.push([U,e[A][1]])}else N.push([e[A][0],e[A][1]])}}else{var Dt=[];E.push(Dt);for(var et=0;et<e.length;++et)Dt.push([e[et][0],e[et][1]])}for(var vt=new i0(this.properties),It=0;It<E.length;++It){var Pt=new Zx;vt.geometries.push(Pt);for(var Et=E[It],yt=0;yt<Et.length;++yt)Pt.move_to(Et[yt])}return vt};var O3=Nr(gp(),1);var pU=Nr(gp(),1);var dU=Nr(T0(),1);var yU=Nr(Qh(),1);var en=[],nn=[],rn=[],on=[],sn=[],an=[],un=[],ln=[],cn=[],fn=[],hn=[],pn=[],dn=[],gn=[],mn=[],yn=[],vn=[],_n=[],xn=[],En=[],wn=[],Mn=[],Sn=[],bn=[];un[85]=fn[85]=-1;ln[85]=hn[85]=0;cn[85]=pn[85]=1;xn[85]=Mn[85]=1;En[85]=Sn[85]=0;wn[85]=bn[85]=1;en[85]=on[85]=0;nn[85]=sn[85]=-1;rn[85]=mn[85]=0;yn[85]=dn[85]=0;vn[85]=gn[85]=1;an[85]=_n[85]=1;Mn[1]=Mn[169]=0;Sn[1]=Sn[169]=-1;bn[1]=bn[169]=0;dn[1]=dn[169]=-1;gn[1]=gn[169]=0;mn[1]=mn[169]=0;fn[4]=fn[166]=0;hn[4]=hn[166]=-1;pn[4]=pn[166]=1;yn[4]=yn[166]=1;vn[4]=vn[166]=0;_n[4]=_n[166]=0;un[16]=un[154]=0;ln[16]=ln[154]=1;cn[16]=cn[154]=1;on[16]=on[154]=1;sn[16]=sn[154]=0;an[16]=an[154]=1;xn[64]=xn[106]=0;En[64]=En[106]=1;wn[64]=wn[106]=0;en[64]=en[106]=-1;nn[64]=nn[106]=0;rn[64]=rn[106]=1;xn[2]=xn[168]=0;En[2]=En[168]=-1;wn[2]=wn[168]=1;Mn[2]=Mn[168]=0;Sn[2]=Sn[168]=-1;bn[2]=bn[168]=0;dn[2]=dn[168]=-1;gn[2]=gn[168]=0;mn[2]=mn[168]=0;yn[2]=yn[168]=-1;vn[2]=vn[168]=0;_n[2]=_n[168]=1;un[8]=un[162]=0;ln[8]=ln[162]=-1;cn[8]=cn[162]=0;fn[8]=fn[162]=0;hn[8]=hn[162]=-1;pn[8]=pn[162]=1;dn[8]=dn[162]=1;gn[8]=gn[162]=0;mn[8]=mn[162]=1;yn[8]=yn[162]=1;vn[8]=vn[162]=0;_n[8]=_n[162]=0;un[32]=un[138]=0;ln[32]=ln[138]=1;cn[32]=cn[138]=1;fn[32]=fn[138]=0;hn[32]=hn[138]=1;pn[32]=pn[138]=0;en[32]=en[138]=1;nn[32]=nn[138]=0;rn[32]=rn[138]=0;on[32]=on[138]=1;sn[32]=sn[138]=0;an[32]=an[138]=1;Mn[128]=Mn[42]=0;Sn[128]=Sn[42]=1;bn[128]=bn[42]=1;xn[128]=xn[42]=0;En[128]=En[42]=1;wn[128]=wn[42]=0;en[128]=en[42]=-1;nn[128]=nn[42]=0;rn[128]=rn[42]=1;on[128]=on[42]=-1;sn[128]=sn[42]=0;an[128]=an[42]=0;fn[5]=fn[165]=-1;hn[5]=hn[165]=0;pn[5]=pn[165]=0;Mn[5]=Mn[165]=1;Sn[5]=Sn[165]=0;bn[5]=bn[165]=0;yn[20]=yn[150]=0;vn[20]=vn[150]=1;_n[20]=_n[150]=1;on[20]=on[150]=0;sn[20]=sn[150]=-1;an[20]=an[150]=1;un[80]=un[90]=-1;ln[80]=ln[90]=0;cn[80]=cn[90]=1;xn[80]=xn[90]=1;En[80]=En[90]=0;wn[80]=wn[90]=1;dn[65]=dn[105]=0;gn[65]=gn[105]=1;mn[65]=mn[105]=0;en[65]=en[105]=0;nn[65]=nn[105]=-1;rn[65]=rn[105]=0;un[160]=un[10]=-1;ln[160]=ln[10]=0;cn[160]=cn[10]=1;fn[160]=fn[10]=-1;hn[160]=hn[10]=0;pn[160]=pn[10]=0;Mn[160]=Mn[10]=1;Sn[160]=Sn[10]=0;bn[160]=bn[10]=0;xn[160]=xn[10]=1;En[160]=En[10]=0;wn[160]=wn[10]=1;yn[130]=yn[40]=0;vn[130]=vn[40]=1;_n[130]=_n[40]=1;dn[130]=dn[40]=0;gn[130]=gn[40]=1;mn[130]=mn[40]=0;en[130]=en[40]=0;nn[130]=nn[40]=-1;rn[130]=rn[40]=0;on[130]=on[40]=0;sn[130]=sn[40]=-1;an[130]=an[40]=1;fn[37]=fn[133]=0;hn[37]=hn[133]=1;pn[37]=pn[133]=1;Mn[37]=Mn[133]=0;Sn[37]=Sn[133]=1;bn[37]=bn[133]=0;en[37]=en[133]=-1;nn[37]=nn[133]=0;rn[37]=rn[133]=0;on[37]=on[133]=1;sn[37]=sn[133]=0;an[37]=an[133]=0;yn[148]=yn[22]=-1;vn[148]=vn[22]=0;_n[148]=_n[22]=0;Mn[148]=Mn[22]=0;Sn[148]=Sn[22]=-1;bn[148]=bn[22]=1;xn[148]=xn[22]=0;En[148]=En[22]=1;wn[148]=wn[22]=1;on[148]=on[22]=-1;sn[148]=sn[22]=0;an[148]=an[22]=1;un[82]=un[88]=0;ln[82]=ln[88]=-1;cn[82]=cn[88]=1;yn[82]=yn[88]=1;vn[82]=vn[88]=0;_n[82]=_n[88]=1;dn[82]=dn[88]=-1;gn[82]=gn[88]=0;mn[82]=mn[88]=1;xn[82]=xn[88]=0;En[82]=En[88]=-1;wn[82]=wn[88]=0;un[73]=un[97]=0;ln[73]=ln[97]=1;cn[73]=cn[97]=0;fn[73]=fn[97]=0;hn[73]=hn[97]=-1;pn[73]=pn[97]=0;dn[73]=dn[97]=1;gn[73]=gn[97]=0;mn[73]=mn[97]=0;en[73]=en[97]=1;nn[73]=nn[97]=0;rn[73]=rn[97]=1;un[145]=un[25]=0;ln[145]=ln[25]=-1;cn[145]=cn[25]=0;dn[145]=dn[25]=1;gn[145]=gn[25]=0;mn[145]=mn[25]=1;Mn[145]=Mn[25]=0;Sn[145]=Sn[25]=1;bn[145]=bn[25]=1;on[145]=on[25]=-1;sn[145]=sn[25]=0;an[145]=an[25]=0;fn[70]=fn[100]=0;hn[70]=hn[100]=1;pn[70]=pn[100]=0;yn[70]=yn[100]=-1;vn[70]=vn[100]=0;_n[70]=_n[100]=1;xn[70]=xn[100]=0;En[70]=En[100]=-1;wn[70]=wn[100]=1;en[70]=en[100]=1;nn[70]=nn[100]=0;rn[70]=rn[100]=0;fn[101]=fn[69]=0;hn[101]=hn[69]=1;pn[101]=pn[69]=0;en[101]=en[69]=1;nn[101]=nn[69]=0;rn[101]=rn[69]=0;Mn[149]=Mn[21]=0;Sn[149]=Sn[21]=1;bn[149]=bn[21]=1;on[149]=on[21]=-1;sn[149]=sn[21]=0;an[149]=an[21]=0;yn[86]=yn[84]=-1;vn[86]=vn[84]=0;_n[86]=_n[84]=1;xn[86]=xn[84]=0;En[86]=En[84]=-1;wn[86]=wn[84]=1;un[89]=un[81]=0;ln[89]=ln[81]=-1;cn[89]=cn[81]=0;dn[89]=dn[81]=1;gn[89]=gn[81]=0;mn[89]=mn[81]=1;un[96]=un[74]=0;ln[96]=ln[74]=1;cn[96]=cn[74]=0;fn[96]=fn[74]=-1;hn[96]=hn[74]=0;pn[96]=pn[74]=1;xn[96]=xn[74]=1;En[96]=En[74]=0;wn[96]=wn[74]=0;en[96]=en[74]=1;nn[96]=nn[74]=0;rn[96]=rn[74]=1;un[24]=un[146]=0;ln[24]=ln[146]=-1;cn[24]=cn[146]=1;yn[24]=yn[146]=1;vn[24]=vn[146]=0;_n[24]=_n[146]=1;dn[24]=dn[146]=0;gn[24]=gn[146]=1;mn[24]=mn[146]=1;on[24]=on[146]=0;sn[24]=sn[146]=-1;an[24]=an[146]=0;fn[6]=fn[164]=-1;hn[6]=hn[164]=0;pn[6]=pn[164]=1;yn[6]=yn[164]=-1;vn[6]=vn[164]=0;_n[6]=_n[164]=0;Mn[6]=Mn[164]=0;Sn[6]=Sn[164]=-1;bn[6]=bn[164]=1;xn[6]=xn[164]=1;En[6]=En[164]=0;wn[6]=wn[164]=0;dn[129]=dn[41]=0;gn[129]=gn[41]=1;mn[129]=mn[41]=1;Mn[129]=Mn[41]=0;Sn[129]=Sn[41]=1;bn[129]=bn[41]=0;en[129]=en[41]=-1;nn[129]=nn[41]=0;rn[129]=rn[41]=0;on[129]=on[41]=0;sn[129]=sn[41]=-1;an[129]=an[41]=0;yn[66]=yn[104]=0;vn[66]=vn[104]=1;_n[66]=_n[104]=0;dn[66]=dn[104]=-1;gn[66]=gn[104]=0;mn[66]=mn[104]=1;xn[66]=xn[104]=0;En[66]=En[104]=-1;wn[66]=wn[104]=0;en[66]=en[104]=0;nn[66]=nn[104]=-1;rn[66]=rn[104]=1;un[144]=un[26]=-1;ln[144]=ln[26]=0;cn[144]=cn[26]=0;Mn[144]=Mn[26]=1;Sn[144]=Sn[26]=0;bn[144]=bn[26]=1;xn[144]=xn[26]=0;En[144]=En[26]=1;wn[144]=wn[26]=1;on[144]=on[26]=-1;sn[144]=sn[26]=0;an[144]=an[26]=1;fn[36]=fn[134]=0;hn[36]=hn[134]=1;pn[36]=pn[134]=1;yn[36]=yn[134]=0;vn[36]=vn[134]=1;_n[36]=_n[134]=0;en[36]=en[134]=0;nn[36]=nn[134]=-1;rn[36]=rn[134]=1;on[36]=on[134]=1;sn[36]=sn[134]=0;an[36]=an[134]=0;un[9]=un[161]=-1;ln[9]=ln[161]=0;cn[9]=cn[161]=0;fn[9]=fn[161]=0;hn[9]=hn[161]=-1;pn[9]=pn[161]=0;dn[9]=dn[161]=1;gn[9]=gn[161]=0;mn[9]=mn[161]=0;Mn[9]=Mn[161]=1;Sn[9]=Sn[161]=0;bn[9]=bn[161]=1;un[136]=0;ln[136]=1;cn[136]=1;fn[136]=0;hn[136]=1;pn[136]=0;yn[136]=-1;vn[136]=0;_n[136]=1;dn[136]=-1;gn[136]=0;mn[136]=0;Mn[136]=0;Sn[136]=-1;bn[136]=0;xn[136]=0;En[136]=-1;wn[136]=1;en[136]=1;nn[136]=0;rn[136]=0;on[136]=1;sn[136]=0;an[136]=1;un[34]=0;ln[34]=-1;cn[34]=0;fn[34]=0;hn[34]=-1;pn[34]=1;yn[34]=1;vn[34]=0;_n[34]=0;dn[34]=1;gn[34]=0;mn[34]=1;Mn[34]=0;Sn[34]=1;bn[34]=1;xn[34]=0;En[34]=1;wn[34]=0;en[34]=-1;nn[34]=0;rn[34]=1;on[34]=-1;sn[34]=0;an[34]=0;un[35]=0;ln[35]=1;cn[35]=1;fn[35]=0;hn[35]=-1;pn[35]=1;yn[35]=1;vn[35]=0;_n[35]=0;dn[35]=-1;gn[35]=0;mn[35]=0;Mn[35]=0;Sn[35]=-1;bn[35]=0;xn[35]=0;En[35]=1;wn[35]=0;en[35]=-1;nn[35]=0;rn[35]=1;on[35]=1;sn[35]=0;an[35]=1;un[153]=0;ln[153]=1;cn[153]=1;dn[153]=-1;gn[153]=0;mn[153]=0;Mn[153]=0;Sn[153]=-1;bn[153]=0;on[153]=1;sn[153]=0;an[153]=1;fn[102]=0;hn[102]=-1;pn[102]=1;yn[102]=1;vn[102]=0;_n[102]=0;xn[102]=0;En[102]=1;wn[102]=0;en[102]=-1;nn[102]=0;rn[102]=1;un[155]=0;ln[155]=-1;cn[155]=0;dn[155]=1;gn[155]=0;mn[155]=1;Mn[155]=0;Sn[155]=1;bn[155]=1;on[155]=-1;sn[155]=0;an[155]=0;fn[103]=0;hn[103]=1;pn[103]=0;yn[103]=-1;vn[103]=0;_n[103]=1;xn[103]=0;En[103]=-1;wn[103]=1;en[103]=1;nn[103]=0;rn[103]=0;un[152]=0;ln[152]=1;cn[152]=1;yn[152]=-1;vn[152]=0;_n[152]=1;dn[152]=-1;gn[152]=0;mn[152]=0;Mn[152]=0;Sn[152]=-1;bn[152]=0;xn[152]=0;En[152]=-1;wn[152]=1;on[152]=1;sn[152]=0;an[152]=1;un[156]=0;ln[156]=-1;cn[156]=1;yn[156]=1;vn[156]=0;_n[156]=1;dn[156]=-1;gn[156]=0;mn[156]=0;Mn[156]=0;Sn[156]=-1;bn[156]=0;xn[156]=0;En[156]=1;wn[156]=1;on[156]=-1;sn[156]=0;an[156]=1;un[137]=0;ln[137]=1;cn[137]=1;fn[137]=0;hn[137]=1;pn[137]=0;dn[137]=-1;gn[137]=0;mn[137]=0;Mn[137]=0;Sn[137]=-1;bn[137]=0;en[137]=1;nn[137]=0;rn[137]=0;on[137]=1;sn[137]=0;an[137]=1;un[139]=0;ln[139]=1;cn[139]=1;fn[139]=0;hn[139]=-1;pn[139]=0;dn[139]=1;gn[139]=0;mn[139]=0;Mn[139]=0;Sn[139]=1;bn[139]=0;en[139]=-1;nn[139]=0;rn[139]=0;on[139]=1;sn[139]=0;an[139]=1;un[98]=0;ln[98]=-1;cn[98]=0;fn[98]=0;hn[98]=-1;pn[98]=1;yn[98]=1;vn[98]=0;_n[98]=0;dn[98]=1;gn[98]=0;mn[98]=1;xn[98]=0;En[98]=1;wn[98]=0;en[98]=-1;nn[98]=0;rn[98]=1;un[99]=0;ln[99]=1;cn[99]=0;fn[99]=0;hn[99]=-1;pn[99]=1;yn[99]=1;vn[99]=0;_n[99]=0;dn[99]=-1;gn[99]=0;mn[99]=1;xn[99]=0;En[99]=-1;wn[99]=0;en[99]=1;nn[99]=0;rn[99]=1;fn[38]=0;hn[38]=-1;pn[38]=1;yn[38]=1;vn[38]=0;_n[38]=0;Mn[38]=0;Sn[38]=1;bn[38]=1;xn[38]=0;En[38]=1;wn[38]=0;en[38]=-1;nn[38]=0;rn[38]=1;on[38]=-1;sn[38]=0;an[38]=0;fn[39]=0;hn[39]=1;pn[39]=1;yn[39]=-1;vn[39]=0;_n[39]=0;Mn[39]=0;Sn[39]=-1;bn[39]=1;xn[39]=0;En[39]=1;wn[39]=0;en[39]=-1;nn[39]=0;rn[39]=1;on[39]=1;sn[39]=0;an[39]=0;var A0=function(r){return[[r.bottomleft,0],[0,0],[0,r.leftbottom]]},C0=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0]]},P0=function(r){return[[r.topright,1],[1,1],[1,r.righttop]]},I0=function(r){return[[0,r.lefttop],[0,1],[r.topleft,1]]},R0=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop]]},L0=function(r){return[[r.bottomright,0],[r.bottomleft,0],[1,r.righttop],[1,r.rightbottom]]},N0=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.topleft,1],[r.topright,1]]},O0=function(r){return[[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},vU=function(r){return[[0,0],[0,r.leftbottom],[1,r.rightbottom],[1,0]]},_U=function(r){return[[1,0],[r.bottomright,0],[r.topright,1],[1,1]]},xU=function(r){return[[1,1],[1,r.righttop],[0,r.lefttop],[0,1]]},EU=function(r){return[[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},wU=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.leftbottom],[0,r.lefttop]]},MU=function(r){return[[r.topleft,1],[r.topright,1],[r.bottomright,0],[r.bottomleft,0]]},SU=function(){return[[0,0],[0,1],[1,1],[1,0]]},bU=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,1],[r.topleft,1]]},TU=function(r){return[[r.topright,1],[1,1],[1,0],[0,0],[0,r.leftbottom]]},AU=function(r){return[[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[1,1]]},CU=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,1]]},PU=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.lefttop],[0,1],[r.topleft,1]]},IU=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[r.topright,1]]},RU=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop]]},LU=function(r){return[[r.topright,1],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1]]},NU=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},OU=function(r){return[[1,1],[1,r.righttop],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},DU=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[r.topleft,1],[r.topright,1]]},FU=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom]]},UU=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},BU=function(r){return[[1,1],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},zU=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1]]},GU=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},kU=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},HU=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},VU=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},WU=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},qU=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},XU=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},YU=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},$U=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},ZU=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},In=[],Rn=[],Ln=[],Nn=[],On=[],Dn=[],Fn=[],Un=[];Nn[1]=On[1]=18;Nn[169]=On[169]=18;Ln[4]=Rn[4]=12;Ln[166]=Rn[166]=12;In[16]=Un[16]=4;In[154]=Un[154]=4;Dn[64]=Fn[64]=22;Dn[106]=Fn[106]=22;Ln[2]=Dn[2]=17;Nn[2]=On[2]=18;Ln[168]=Dn[168]=17;Nn[168]=On[168]=18;In[8]=Nn[8]=9;Rn[8]=Ln[8]=12;In[162]=Nn[162]=9;Rn[162]=Ln[162]=12;In[32]=Un[32]=4;Rn[32]=Fn[32]=1;In[138]=Un[138]=4;Rn[138]=Fn[138]=1;On[128]=Un[128]=21;Dn[128]=Fn[128]=22;On[42]=Un[42]=21;Dn[42]=Fn[42]=22;Rn[5]=On[5]=14;Rn[165]=On[165]=14;Ln[20]=Un[20]=6;Ln[150]=Un[150]=6;In[80]=Dn[80]=11;In[90]=Dn[90]=11;Nn[65]=Fn[65]=3;Nn[105]=Fn[105]=3;In[160]=Dn[160]=11;Rn[160]=On[160]=14;In[10]=Dn[10]=11;Rn[10]=On[10]=14;Ln[130]=Un[130]=6;Nn[130]=Fn[130]=3;Ln[40]=Un[40]=6;Nn[40]=Fn[40]=3;Rn[101]=Fn[101]=1;Rn[69]=Fn[69]=1;On[149]=Un[149]=21;On[21]=Un[21]=21;Ln[86]=Dn[86]=17;Ln[84]=Dn[84]=17;In[89]=Nn[89]=9;In[81]=Nn[81]=9;In[96]=Fn[96]=0;Rn[96]=Dn[96]=15;In[74]=Fn[74]=0;Rn[74]=Dn[74]=15;In[24]=Ln[24]=8;Nn[24]=Un[24]=7;In[146]=Ln[146]=8;Nn[146]=Un[146]=7;Rn[6]=Dn[6]=15;Ln[6]=On[6]=16;Rn[164]=Dn[164]=15;Ln[164]=On[164]=16;Nn[129]=Un[129]=7;On[129]=Fn[129]=20;Nn[41]=Un[41]=7;On[41]=Fn[41]=20;Ln[66]=Fn[66]=2;Nn[66]=Dn[66]=19;Ln[104]=Fn[104]=2;Nn[104]=Dn[104]=19;In[144]=On[144]=10;Dn[144]=Un[144]=23;In[26]=On[26]=10;Dn[26]=Un[26]=23;Rn[36]=Un[36]=5;Ln[36]=Fn[36]=2;Rn[134]=Un[134]=5;Ln[134]=Fn[134]=2;In[9]=On[9]=10;Rn[9]=Nn[9]=13;In[161]=On[161]=10;Rn[161]=Nn[161]=13;Rn[37]=Un[37]=5;On[37]=Fn[37]=20;Rn[133]=Un[133]=5;On[133]=Fn[133]=20;Ln[148]=On[148]=16;Dn[148]=Un[148]=23;Ln[22]=On[22]=16;Dn[22]=Un[22]=23;In[82]=Ln[82]=8;Nn[82]=Dn[82]=19;In[88]=Ln[88]=8;Nn[88]=Dn[88]=19;In[73]=Fn[73]=0;Rn[73]=Nn[73]=13;In[97]=Fn[97]=0;Rn[97]=Nn[97]=13;In[145]=Nn[145]=9;On[145]=Un[145]=21;In[25]=Nn[25]=9;On[25]=Un[25]=21;Rn[70]=Fn[70]=1;Ln[70]=Dn[70]=17;Rn[100]=Fn[100]=1;Ln[100]=Dn[100]=17;In[34]=Nn[34]=9;Rn[34]=Ln[34]=12;On[34]=Un[34]=21;Dn[34]=Fn[34]=22;In[136]=Un[136]=4;Rn[136]=Fn[136]=1;Ln[136]=Dn[136]=17;Nn[136]=On[136]=18;In[35]=Un[35]=4;Rn[35]=Ln[35]=12;Nn[35]=On[35]=18;Dn[35]=Fn[35]=22;In[153]=Un[153]=4;Nn[153]=On[153]=18;Rn[102]=Ln[102]=12;Dn[102]=Fn[102]=22;In[155]=Nn[155]=9;On[155]=Un[155]=23;Rn[103]=Fn[103]=1;Ln[103]=Dn[103]=17;In[152]=Un[152]=4;Ln[152]=Dn[152]=17;Nn[152]=On[152]=18;In[156]=Ln[156]=8;Nn[156]=On[156]=18;Dn[156]=Un[156]=23;In[137]=Un[137]=4;Rn[137]=Fn[137]=1;Nn[137]=On[137]=18;In[139]=Un[139]=4;Rn[139]=Nn[139]=13;On[139]=Fn[139]=20;In[98]=Nn[98]=9;Rn[98]=Ln[98]=12;Dn[98]=Fn[98]=22;In[99]=Fn[99]=0;Rn[99]=Ln[99]=12;Nn[99]=Dn[99]=19;Rn[38]=Ln[38]=12;On[38]=Un[38]=21;Dn[38]=Fn[38]=22;Rn[39]=Un[39]=5;Ln[39]=On[39]=16;Dn[39]=Fn[39]=22;var ee=[];ee[1]=ee[169]=A0;ee[4]=ee[166]=C0;ee[16]=ee[154]=P0;ee[64]=ee[106]=I0;ee[168]=ee[2]=R0;ee[162]=ee[8]=L0;ee[138]=ee[32]=N0;ee[42]=ee[128]=O0;ee[5]=ee[165]=vU;ee[20]=ee[150]=_U;ee[80]=ee[90]=xU;ee[65]=ee[105]=EU;ee[160]=ee[10]=wU;ee[130]=ee[40]=MU;ee[85]=SU;ee[101]=ee[69]=bU;ee[149]=ee[21]=TU;ee[86]=ee[84]=AU;ee[89]=ee[81]=CU;ee[96]=ee[74]=PU;ee[24]=ee[146]=IU;ee[6]=ee[164]=RU;ee[129]=ee[41]=LU;ee[66]=ee[104]=NU;ee[144]=ee[26]=OU;ee[36]=ee[134]=DU;ee[9]=ee[161]=FU;ee[37]=ee[133]=UU;ee[148]=ee[22]=BU;ee[82]=ee[88]=zU;ee[73]=ee[97]=GU;ee[145]=ee[25]=kU;ee[70]=ee[100]=HU;ee[34]=function(r){return[O0(r),L0(r)]};ee[35]=VU;ee[136]=function(r){return[N0(r),R0(r)]};ee[153]=function(r){return[P0(r),A0(r)]};ee[102]=function(r){return[C0(r),I0(r)]};ee[155]=WU;ee[103]=qU;ee[152]=function(r){return[P0(r),R0(r)]};ee[156]=XU;ee[137]=function(r){return[N0(r),A0(r)]};ee[139]=YU;ee[98]=function(r){return[L0(r),I0(r)]};ee[99]=$U;ee[38]=function(r){return[C0(r),O0(r)]};ee[39]=ZU;function KU(r){return(r>0)-(r<0)||+r}function _c(r,t,e){var o=t[0]-r[0],a=t[1]-r[1],c=e[0]-t[0],p=e[1]-t[1];return KU(o*p-c*a)}function nM(r,t){var e=r.geometry.coordinates[0].map(function(p){return p[0]}),o=r.geometry.coordinates[0].map(function(p){return p[1]}),a=t.geometry.coordinates[0].map(function(p){return p[0]}),c=t.geometry.coordinates[0].map(function(p){return p[1]});return Math.max.apply(null,e)===Math.max.apply(null,a)&&Math.max.apply(null,o)===Math.max.apply(null,c)&&Math.min.apply(null,e)===Math.min.apply(null,a)&&Math.min.apply(null,o)===Math.min.apply(null,c)}function D0(r,t){return t.geometry.coordinates[0].every(function(e){return Oi(Tr(e),r)})}function rM(r,t){return r[0]===t[0]&&r[1]===t[1]}var QU=function(){function r(t){this.id=r.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return r.buildId=function(t){return t.join(",")},r.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},r.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},r.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},r.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var a=e.to,c=o.to;if(a.coordinates[0]-t.coordinates[0]>=0&&c.coordinates[0]-t.coordinates[0]<0)return 1;if(a.coordinates[0]-t.coordinates[0]<0&&c.coordinates[0]-t.coordinates[0]>=0)return-1;if(a.coordinates[0]-t.coordinates[0]===0&&c.coordinates[0]-t.coordinates[0]===0)return a.coordinates[1]-t.coordinates[1]>=0||c.coordinates[1]-t.coordinates[1]>=0?a.coordinates[1]-c.coordinates[1]:c.coordinates[1]-a.coordinates[1];var p=_c(t.coordinates,a.coordinates,c.coordinates);if(p<0)return 1;if(p>0)return-1;var d=Math.pow(a.coordinates[0]-t.coordinates[0],2)+Math.pow(a.coordinates[1]-t.coordinates[1],2),g=Math.pow(c.coordinates[0]-t.coordinates[0],2)+Math.pow(c.coordinates[1]-t.coordinates[1],2);return d-g}),this.outerEdgesSorted=!0)},r.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},r.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},r.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},r}(),F0=QU;var jU=function(){function r(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return r.prototype.getSymetric=function(){return this.symetric||(this.symetric=new r(this.to,this.from),this.symetric.symetric=this),this.symetric},r.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},r.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},r.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},r.prototype.toLineString=function(){return Ni([this.from.coordinates,this.to.coordinates])},r.prototype.compareTo=function(t){return _c(t.from.coordinates,t.to.coordinates,this.to.coordinates)},r}(),iM=jU;var tB=function(){function r(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return r.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},r.prototype.get=function(t){return this.edges[t]},Object.defineProperty(r.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),r.prototype.forEach=function(t){this.edges.forEach(t)},r.prototype.map=function(t){return this.edges.map(t)},r.prototype.some=function(t){return this.edges.some(t)},r.prototype.isValid=function(){return!0},r.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(p,d,g){return d.from.coordinates[1]>t.edges[p].from.coordinates[1]&&(p=g),p},0),o=(e===0?this.length:e)-1,a=(e+1)%this.length,c=_c(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[a].from.coordinates);return c===0?this.edges[o].from.coordinates[0]>this.edges[a].from.coordinates[0]:c>0},r.prototype.toMultiPoint=function(){return _m(this.edges.map(function(t){return t.from.coordinates}))},r.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=Dr([t])},r.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Bm(this.toPolygon())},r.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),a,c;return e.forEach(function(p){var d=p.getEnvelope();if(c&&(a=c.getEnvelope()),!nM(d,o)&&D0(d,o)){for(var g=t.map(function(P){return P.from.coordinates}),y=void 0,_=function(P){p.some(function(I){return rM(P,I.from.coordinates)})||(y=P)},w=0,x=g;w<x.length;w++){var b=x[w];_(b)}y&&p.inside(Tr(y))&&(!c||D0(a,d))&&(c=p)}}),c},r.prototype.inside=function(t){return Oi(t,this.toPolygon())},r}(),U0=tB;function eB(r){if(!r)throw new Error("No geojson passed");if(r.type!=="FeatureCollection"&&r.type!=="GeometryCollection"&&r.type!=="MultiLineString"&&r.type!=="LineString"&&r.type!=="Feature")throw new Error("Invalid input type '"+r.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var CW=function(){function r(){this.edges=[],this.nodes={}}return r.fromGeoJson=function(t){eB(t);var e=new r;return fs(t,function(o){Em(o,"LineString","Graph::fromGeoJson"),J1(o,function(a,c){if(a){var p=e.getNode(a),d=e.getNode(c);e.addEdge(p,d)}return c})}),e},r.prototype.getNode=function(t){var e=F0.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new F0(t)),o},r.prototype.addEdge=function(t,e){var o=new iM(t,e),a=o.getSymetric();this.edges.push(o),this.edges.push(a)},r.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},r.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(a){return a.to});this.removeNode(t),o.forEach(function(a){return e._removeIfDangle(a)})}},r.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},r.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,a){t.getOuterEdge((a===0?t.getOuterEdges().length:a)-1).symetric.next=o})},r.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),a,c,p=o.length-1;p>=0;--p){var d=o[p],g=d.symetric,y=void 0,_=void 0;d.label===e&&(y=d),g.label===e&&(_=g),!(!y||!_)&&(_&&(c=_),y&&(c&&(c.next=y,c=void 0),a||(a=y)))}c&&(c.next=a)},r.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var a=o;do a.label=e,a=a.next;while(!o.isEqual(a));e++}}),t},r.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(o){o.label=void 0}),this._findLabeledEdgeRings().forEach(function(o){t._findIntersectionNodes(o).forEach(function(a){t._computeNextCCWEdges(a,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},r.prototype._findIntersectionNodes=function(t){var e=[],o=t,a=function(){var c=0;o.from.getOuterEdges().forEach(function(p){p.label===t.label&&++c}),c>1&&e.push(o.from),o=o.next};do a();while(!t.isEqual(o));return e},r.prototype._findEdgeRing=function(t){var e=t,o=new U0;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},r.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(o){return e.removeEdge(o)}),t.innerEdges.forEach(function(o){return e.removeEdge(o)}),delete this.nodes[t.id]},r.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},r}();var oB=Nr(B0(),1);var sB=Nr(B0(),1);var uB=Nr(pM(),1);var gB=Nr(MM(),1);function bM(r){for(var t=r,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function yB(){return new TM(function(r){return r.f})}var H0={search:function(r,t,e,o){r.cleanDirty(),o=o||{};var a=o.heuristic||H0.heuristics.manhattan,c=o.closest||!1,p=yB(),d=t;for(t.h=a(t,e),p.push(t);p.size()>0;){var g=p.pop();if(g===e)return bM(g);g.closed=!0;for(var y=r.neighbors(g),_=0,w=y.length;_<w;++_){var x=y[_];if(!(x.closed||x.isWall())){var b=g.g+x.getCost(g),P=x.visited;(!P||b<x.g)&&(x.visited=!0,x.parent=g,x.h=x.h||a(x,e),x.g=b,x.f=x.g+x.h,r.markDirty(x),c&&(x.h<d.h||x.h===d.h&&x.g<d.g)&&(d=x),P?p.rescoreElement(x):p.push(x))}}}return c?bM(d):[]},heuristics:{manhattan:function(r,t){var e=Math.abs(t.x-r.x),o=Math.abs(t.y-r.y);return e+o},diagonal:function(r,t){var e=1,o=Math.sqrt(2),a=Math.abs(t.x-r.x),c=Math.abs(t.y-r.y);return e*(a+c)+(o-2*e)*Math.min(a,c)}},cleanNode:function(r){r.f=0,r.g=0,r.h=0,r.visited=!1,r.closed=!1,r.parent=null}};function Mf(r,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<r.length;e++){this.grid[e]=[];for(var o=0,a=r[e];o<a.length;o++){var c=new Hp(e,o,a[o]);this.grid[e][o]=c,this.nodes.push(c)}}this.init()}Mf.prototype.init=function(){this.dirtyNodes=[];for(var r=0;r<this.nodes.length;r++)H0.cleanNode(this.nodes[r])};Mf.prototype.cleanDirty=function(){for(var r=0;r<this.dirtyNodes.length;r++)H0.cleanNode(this.dirtyNodes[r]);this.dirtyNodes=[]};Mf.prototype.markDirty=function(r){this.dirtyNodes.push(r)};Mf.prototype.neighbors=function(r){var t=[],e=r.x,o=r.y,a=this.grid;return a[e-1]&&a[e-1][o]&&t.push(a[e-1][o]),a[e+1]&&a[e+1][o]&&t.push(a[e+1][o]),a[e]&&a[e][o-1]&&t.push(a[e][o-1]),a[e]&&a[e][o+1]&&t.push(a[e][o+1]),this.diagonal&&(a[e-1]&&a[e-1][o-1]&&t.push(a[e-1][o-1]),a[e+1]&&a[e+1][o-1]&&t.push(a[e+1][o-1]),a[e-1]&&a[e-1][o+1]&&t.push(a[e-1][o+1]),a[e+1]&&a[e+1][o+1]&&t.push(a[e+1][o+1])),t};Mf.prototype.toString=function(){for(var r=[],t=this.grid,e,o,a,c,p=0,d=t.length;p<d;p++){for(e=[],o=t[p],a=0,c=o.length;a<c;a++)e.push(o[a].weight);r.push(e.join(" "))}return r.join(\`
|
|
3705
|
-
\`)};function Hp(r,t,e){this.x=r,this.y=t,this.weight=e}Hp.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Hp.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};Hp.prototype.isWall=function(){return this.weight===0};function TM(r){this.content=[],this.scoreFunction=r}TM.prototype={push:function(r){this.content.push(r),this.sinkDown(this.content.length-1)},pop:function(){var r=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),r},remove:function(r){var t=this.content.indexOf(r),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(r)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(r){this.sinkDown(this.content.indexOf(r))},sinkDown:function(r){for(var t=this.content[r];r>0;){var e=(r+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[r]=o,r=e;else break}},bubbleUp:function(r){for(var t=this.content.length,e=this.content[r],o=this.scoreFunction(e);;){var a=r+1<<1,c=a-1,p=null,d;if(c<t){var g=this.content[c];d=this.scoreFunction(g),d<o&&(p=c)}if(a<t){var y=this.content[a],_=this.scoreFunction(y);_<(p===null?o:d)&&(p=a)}if(p!==null)this.content[r]=this.content[p],this.content[p]=e,r=p;else break}}};function V0(){this._=null}function Ec(r){r.U=r.C=r.L=r.R=r.P=r.N=null}V0.prototype={constructor:V0,insert:function(r,t){var e,o,a;if(r){if(t.P=r,t.N=r.N,r.N&&(r.N.P=t),r.N=t,r.R){for(r=r.R;r.L;)r=r.L;r.L=t}else r.R=t;e=r}else this._?(r=AM(this._),t.P=null,t.N=r,r.P=r.L=t,e=r):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,r=t;e&&e.C;)o=e.U,e===o.L?(a=o.R,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.R&&(Sf(this,e),r=e,e=r.U),e.C=!1,o.C=!0,bf(this,o))):(a=o.L,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.L&&(bf(this,e),r=e,e=r.U),e.C=!1,o.C=!0,Sf(this,o))),e=r.U;this._.C=!1},remove:function(r){r.N&&(r.N.P=r.P),r.P&&(r.P.N=r.N),r.N=r.P=null;var t=r.U,e,o=r.L,a=r.R,c,p;if(o?a?c=AM(a):c=o:c=a,t?t.L===r?t.L=c:t.R=c:this._=c,o&&a?(p=c.C,c.C=r.C,c.L=o,o.U=c,c!==a?(t=c.U,c.U=r.U,r=c.R,t.L=r,c.R=a,a.U=c):(c.U=t,t=c,r=c.R)):(p=r.C,r=c),r&&(r.U=t),!p){if(r&&r.C){r.C=!1;return}do{if(r===this._)break;if(r===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Sf(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,bf(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Sf(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,bf(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Sf(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,bf(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function Sf(r,t){var e=t,o=t.R,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function bf(r,t){var e=t,o=t.L,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function AM(r){for(;r.L;)r=r.L;return r}var W0=V0;function wc(r,t,e,o){var a=[null,null],c=Fi.push(a)-1;return a.left=r,a.right=t,e&&Tf(a,r,t,e),o&&Tf(a,t,r,o),wo[r.index].halfedges.push(c),wo[t.index].halfedges.push(c),a}function Mc(r,t,e){var o=[t,e];return o.left=r,o}function Tf(r,t,e,o){!r[0]&&!r[1]?(r[0]=o,r.left=t,r.right=e):r.left===e?r[1]=o:r[0]=o}function vB(r,t,e,o,a){var c=r[0],p=r[1],d=c[0],g=c[1],y=p[0],_=p[1],w=0,x=1,b=y-d,P=_-g,I;if(I=t-d,!(!b&&I>0)){if(I/=b,b<0){if(I<w)return;I<x&&(x=I)}else if(b>0){if(I>x)return;I>w&&(w=I)}if(I=o-d,!(!b&&I<0)){if(I/=b,b<0){if(I>x)return;I>w&&(w=I)}else if(b>0){if(I<w)return;I<x&&(x=I)}if(I=e-g,!(!P&&I>0)){if(I/=P,P<0){if(I<w)return;I<x&&(x=I)}else if(P>0){if(I>x)return;I>w&&(w=I)}if(I=a-g,!(!P&&I<0)){if(I/=P,P<0){if(I>x)return;I>w&&(w=I)}else if(P>0){if(I<w)return;I<x&&(x=I)}return!(w>0)&&!(x<1)||(w>0&&(r[0]=[d+w*b,g+w*P]),x<1&&(r[1]=[d+x*b,g+x*P])),!0}}}}}function _B(r,t,e,o,a){var c=r[1];if(c)return!0;var p=r[0],d=r.left,g=r.right,y=d[0],_=d[1],w=g[0],x=g[1],b=(y+w)/2,P=(_+x)/2,I,M;if(x===_){if(b<t||b>=o)return;if(y>w){if(!p)p=[b,e];else if(p[1]>=a)return;c=[b,a]}else{if(!p)p=[b,a];else if(p[1]<e)return;c=[b,e]}}else if(I=(y-w)/(x-_),M=P-I*b,I<-1||I>1)if(y>w){if(!p)p=[(e-M)/I,e];else if(p[1]>=a)return;c=[(a-M)/I,a]}else{if(!p)p=[(a-M)/I,a];else if(p[1]<e)return;c=[(e-M)/I,e]}else if(_<x){if(!p)p=[t,I*t+M];else if(p[0]>=o)return;c=[o,I*o+M]}else{if(!p)p=[o,I*o+M];else if(p[0]<t)return;c=[t,I*t+M]}return r[0]=p,r[1]=c,!0}function CM(r,t,e,o){for(var a=Fi.length,c;a--;)(!_B(c=Fi[a],r,t,e,o)||!vB(c,r,t,e,o)||!(Math.abs(c[0][0]-c[1][0])>vr||Math.abs(c[0][1]-c[1][1])>vr))&&delete Fi[a]}function PM(r){return wo[r.index]={site:r,halfedges:[]}}function xB(r,t){var e=r.site,o=t.left,a=t.right;return e===a&&(a=o,o=e),a?Math.atan2(a[1]-o[1],a[0]-o[0]):(e===o?(o=t[1],a=t[0]):(o=t[0],a=t[1]),Math.atan2(o[0]-a[0],a[1]-o[1]))}function q0(r,t){return t[+(t.left!==r.site)]}function EB(r,t){return t[+(t.left===r.site)]}function IM(){for(var r=0,t=wo.length,e,o,a,c;r<t;++r)if((e=wo[r])&&(c=(o=e.halfedges).length)){var p=new Array(c),d=new Array(c);for(a=0;a<c;++a)p[a]=a,d[a]=xB(e,Fi[o[a]]);for(p.sort(function(g,y){return d[y]-d[g]}),a=0;a<c;++a)d[a]=o[p[a]];for(a=0;a<c;++a)o[a]=d[a]}}function RM(r,t,e,o){var a=wo.length,c,p,d,g,y,_,w,x,b,P,I,M,E=!0;for(c=0;c<a;++c)if(p=wo[c]){for(d=p.site,y=p.halfedges,g=y.length;g--;)Fi[y[g]]||y.splice(g,1);for(g=0,_=y.length;g<_;)P=EB(p,Fi[y[g]]),I=P[0],M=P[1],w=q0(p,Fi[y[++g%_]]),x=w[0],b=w[1],(Math.abs(I-x)>vr||Math.abs(M-b)>vr)&&(y.splice(g,0,Fi.push(Mc(d,P,Math.abs(I-r)<vr&&o-M>vr?[r,Math.abs(x-r)<vr?b:o]:Math.abs(M-o)<vr&&e-I>vr?[Math.abs(b-o)<vr?x:e,o]:Math.abs(I-e)<vr&&M-t>vr?[e,Math.abs(x-e)<vr?b:t]:Math.abs(M-t)<vr&&I-r>vr?[Math.abs(b-t)<vr?x:r,t]:null))-1),++_);_&&(E=!1)}if(E){var N,A,U,z=1/0;for(c=0,E=null;c<a;++c)(p=wo[c])&&(d=p.site,N=d[0]-r,A=d[1]-t,U=N*N+A*A,U<z&&(z=U,E=p));if(E){var $=[r,t],q=[r,o],D=[e,o],G=[e,t];E.halfedges.push(Fi.push(Mc(d=E.site,$,q))-1,Fi.push(Mc(d,q,D))-1,Fi.push(Mc(d,D,G))-1,Fi.push(Mc(d,G,$))-1)}}for(c=0;c<a;++c)(p=wo[c])&&(p.halfedges.length||delete wo[c])}var LM=[],Vp;function wB(){Ec(this),this.x=this.y=this.arc=this.site=this.cy=null}function fl(r){var t=r.P,e=r.N;if(!(!t||!e)){var o=t.site,a=r.site,c=e.site;if(o!==c){var p=a[0],d=a[1],g=o[0]-p,y=o[1]-d,_=c[0]-p,w=c[1]-d,x=2*(g*w-y*_);if(!(x>=-NM)){var b=g*g+y*y,P=_*_+w*w,I=(w*b-y*P)/x,M=(g*P-_*b)/x,E=LM.pop()||new wB;E.arc=r,E.site=a,E.x=I+p,E.y=(E.cy=M+d)+Math.sqrt(I*I+M*M),r.circle=E;for(var N=null,A=Sc._;A;)if(E.y<A.y||E.y===A.y&&E.x<=A.x)if(A.L)A=A.L;else{N=A.P;break}else if(A.R)A=A.R;else{N=A;break}Sc.insert(N,E),N||(Vp=E)}}}}function hl(r){var t=r.circle;t&&(t.P||(Vp=t.N),Sc.remove(t),LM.push(t),Ec(t),r.circle=null)}var DM=[];function MB(){Ec(this),this.edge=this.site=this.circle=null}function OM(r){var t=DM.pop()||new MB;return t.site=r,t}function X0(r){hl(r),pl.remove(r),DM.push(r),Ec(r)}function FM(r){var t=r.circle,e=t.x,o=t.cy,a=[e,o],c=r.P,p=r.N,d=[r];X0(r);for(var g=c;g.circle&&Math.abs(e-g.circle.x)<vr&&Math.abs(o-g.circle.cy)<vr;)c=g.P,d.unshift(g),X0(g),g=c;d.unshift(g),hl(g);for(var y=p;y.circle&&Math.abs(e-y.circle.x)<vr&&Math.abs(o-y.circle.cy)<vr;)p=y.N,d.push(y),X0(y),y=p;d.push(y),hl(y);var _=d.length,w;for(w=1;w<_;++w)y=d[w],g=d[w-1],Tf(y.edge,g.site,y.site,a);g=d[0],y=d[_-1],y.edge=wc(g.site,y.site,null,a),fl(g),fl(y)}function UM(r){for(var t=r[0],e=r[1],o,a,c,p,d=pl._;d;)if(c=BM(d,e)-t,c>vr)d=d.L;else if(p=t-SB(d,e),p>vr){if(!d.R){o=d;break}d=d.R}else{c>-vr?(o=d.P,a=d):p>-vr?(o=d,a=d.N):o=a=d;break}PM(r);var g=OM(r);if(pl.insert(o,g),!(!o&&!a)){if(o===a){hl(o),a=OM(o.site),pl.insert(g,a),g.edge=a.edge=wc(o.site,g.site),fl(o),fl(a);return}if(!a){g.edge=wc(o.site,g.site);return}hl(o),hl(a);var y=o.site,_=y[0],w=y[1],x=r[0]-_,b=r[1]-w,P=a.site,I=P[0]-_,M=P[1]-w,E=2*(x*M-b*I),N=x*x+b*b,A=I*I+M*M,U=[(M*N-b*A)/E+_,(x*A-I*N)/E+w];Tf(a.edge,y,P,U),g.edge=wc(y,r,null,U),a.edge=wc(r,P,null,U),fl(o),fl(a)}}function BM(r,t){var e=r.site,o=e[0],a=e[1],c=a-t;if(!c)return o;var p=r.P;if(!p)return-1/0;e=p.site;var d=e[0],g=e[1],y=g-t;if(!y)return d;var _=d-o,w=1/c-1/y,x=_/y;return w?(-x+Math.sqrt(x*x-2*w*(_*_/(-2*y)-g+y/2+a-c/2)))/w+o:(o+d)/2}function SB(r,t){var e=r.N;if(e)return BM(e,t);var o=r.site;return o[1]===t?o[0]:1/0}var vr=1e-6,NM=1e-12,pl,wo,Sc,Fi;function bB(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function TB(r,t){return t[1]-r[1]||t[0]-r[0]}function Wp(r,t){var e=r.sort(TB).pop(),o,a,c;for(Fi=[],wo=new Array(r.length),pl=new W0,Sc=new W0;;)if(c=Vp,e&&(!c||e[1]<c.y||e[1]===c.y&&e[0]<c.x))(e[0]!==o||e[1]!==a)&&(UM(e),o=e[0],a=e[1]),e=r.pop();else if(c)FM(c.arc);else break;if(IM(),t){var p=+t[0][0],d=+t[0][1],g=+t[1][0],y=+t[1][1];CM(p,d,g,y),RM(p,d,g,y)}this.edges=Fi,this.cells=wo,pl=Sc=Fi=wo=null}Wp.prototype={constructor:Wp,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return q0(t,r[o])});return e.data=t.site.data,e})},triangles:function(){var r=[],t=this.edges;return this.cells.forEach(function(e,o){if(d=(c=e.halfedges).length)for(var a=e.site,c,p=-1,d,g,y=t[c[d-1]],_=y.left===a?y.right:y.left;++p<d;)g=_,y=t[c[p]],_=y.left===a?y.right:y.left,g&&_&&o<g.index&&o<_.index&&bB(a,g,_)<0&&r.push([a.data,g.data,_.data])}),r},links:function(){return this.edges.filter(function(r){return r.right}).map(function(r){return{source:r.left.data,target:r.right.data}})},find:function(r,t,e){for(var o=this,a,c=o._found||0,p=o.cells.length,d;!(d=o.cells[c]);)if(++c>=p)return null;var g=r-d.site[0],y=t-d.site[1],_=g*g+y*y;do d=o.cells[a=c],c=null,d.halfedges.forEach(function(w){var x=o.edges[w],b=x.left;if(!((b===d.site||!b)&&!(b=x.right))){var P=r-b[0],I=t-b[1],M=P*P+I*I;M<_&&(_=M,c=b.index)}});while(c!==null);return o._found=a,e==null||_<=e*e?d.site:null}};var OB=Nr(bc(),1);var ay=Nr(HM(),1);function Wo(){return new Yp}function Yp(){this.reset()}Yp.prototype={constructor:Yp,reset:function(){this.s=this.t=0},add:function(r){VM(Xp,r,this.t),VM(this,Xp.s,this.s),this.s?this.t+=Xp.t:this.s=Xp.t},valueOf:function(){return this.s}};var Xp=new Yp;function VM(r,t,e){var o=r.s=t+e,a=o-t,c=o-a;r.t=t-c+(e-a)}var Kn=1e-6;var fr=Math.PI,xi=fr/2,$p=fr/4,ya=fr*2,dl=180/fr,qo=fr/180,Zr=Math.abs,Ys=Math.atan,Xo=Math.atan2,Gn=Math.cos;var Zp=Math.exp;var Af=Math.log;var Qe=Math.sin;var Ji=Math.sqrt,Cf=Math.tan;function Z0(r){return r>1?0:r<-1?fr:Math.acos(r)}function Mo(r){return r>1?xi:r<-1?-xi:Math.asin(r)}function $s(){}var DB=Wo(),wX=Wo();function gl(r){var t=r[0],e=r[1],o=Gn(e);return[o*Gn(t),o*Qe(t),Qe(e)]}function Pf(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function If(r){var t=Ji(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var LX=Wo();function qM(r,t){return[r>fr?r-ya:r<-fr?r+ya:r,t]}qM.invert=qM;function J0(){var r=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){r.push(t=[])},lineEnd:$s,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function K0(r,t){return Zr(r[0]-t[0])<Kn&&Zr(r[1]-t[1])<Kn}function Jp(r,t,e,o){this.x=r,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function Q0(r,t,e,o,a){var c=[],p=[],d,g;if(r.forEach(function(P){if(!((I=P.length-1)<=0)){var I,M=P[0],E=P[I],N;if(K0(M,E)){for(a.lineStart(),d=0;d<I;++d)a.point((M=P[d])[0],M[1]);a.lineEnd();return}c.push(N=new Jp(M,P,null,!0)),p.push(N.o=new Jp(M,null,N,!1)),c.push(N=new Jp(E,P,null,!1)),p.push(N.o=new Jp(E,null,N,!0))}}),!!c.length){for(p.sort(t),XM(c),XM(p),d=0,g=p.length;d<g;++d)p[d].e=e=!e;for(var y=c[0],_,w;;){for(var x=y,b=!0;x.v;)if((x=x.n)===y)return;_=x.z,a.lineStart();do{if(x.v=x.o.v=!0,x.e){if(b)for(d=0,g=_.length;d<g;++d)a.point((w=_[d])[0],w[1]);else o(x.x,x.n.x,1,a);x=x.n}else{if(b)for(_=x.p.z,d=_.length-1;d>=0;--d)a.point((w=_[d])[0],w[1]);else o(x.x,x.p.x,-1,a);x=x.p}x=x.o,_=x.z,b=!b}while(!x.v);a.lineEnd()}}}function XM(r){if(t=r.length){for(var t,e=0,o=r[0],a;++e<t;)o.n=a=r[e],a.p=o,o=a;o.n=a=r[0],a.p=o}}function Ru(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function j0(r){return r.length===1&&(r=BB(r)),{left:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var c=o+a>>>1;r(t[c],e)<0?o=c+1:a=c}return o},right:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var c=o+a>>>1;r(t[c],e)>0?a=c:o=c+1}return o}}}function BB(r){return function(t,e){return Ru(r(t),e)}}var YM=j0(Ru),zB=YM.right,GB=YM.left;var $M=Array.prototype,HB=$M.slice,VB=$M.map;var S7=Math.sqrt(50),b7=Math.sqrt(10),T7=Math.sqrt(2);function Qp(r){for(var t=r.length,e,o=-1,a=0,c,p;++o<t;)a+=r[o].length;for(c=new Array(a);--t>=0;)for(p=r[t],e=p.length;--e>=0;)c[--a]=p[e];return c}var KB=1e9,l$=-KB;var ty=Wo();function ey(r,t){var e=t[0],o=t[1],a=[Qe(e),-Gn(e),0],c=0,p=0;ty.reset();for(var d=0,g=r.length;d<g;++d)if(_=(y=r[d]).length)for(var y,_,w=y[_-1],x=w[0],b=w[1]/2+$p,P=Qe(b),I=Gn(b),M=0;M<_;++M,x=N,P=U,I=z,w=E){var E=y[M],N=E[0],A=E[1]/2+$p,U=Qe(A),z=Gn(A),$=N-x,q=$>=0?1:-1,D=q*$,G=D>fr,Q=P*U;if(ty.add(Xo(Q*q*Qe(D),I*z+Q*Gn(D))),c+=G?$+q*ya:$,G^x>=e^N>=e){var _t=Pf(gl(w),gl(E));If(_t);var Z=Pf(a,_t);If(Z);var Dt=(G^$>=0?-1:1)*Mo(Z[2]);(o>Dt||o===Dt&&(_t[0]||_t[1]))&&(p+=G^$>=0?1:-1)}}return(c<-Kn||c<Kn&&ty<-Kn)^p&1}var _$=Wo();var B$=Wo(),z$=Wo();var tz=1/0;var H$=-tz;function ny(r){this._context=r}ny.prototype={_radius:4.5,pointRadius:function(r){return this._radius=r,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._context.moveTo(r,t),this._point=1;break}case 1:{this._context.lineTo(r,t);break}default:{this._context.moveTo(r+this._radius,t),this._context.arc(r,t,this._radius,0,ya);break}}},result:$s};var Q$=Wo();function ry(){this._string=[]}ry.prototype={_radius:4.5,_circle:KM(4.5),pointRadius:function(r){return(r=+r)!==this._radius&&(this._radius=r,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._string.push("M",r,",",t),this._point=1;break}case 1:{this._string.push("L",r,",",t);break}default:{this._circle==null&&(this._circle=KM(this._radius)),this._string.push("M",r,",",t,this._circle);break}}},result:function(){if(this._string.length){var r=this._string.join("");return this._string=[],r}else return null}};function KM(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function iy(r,t,e,o){return function(a,c){var p=t(c),d=a.invert(o[0],o[1]),g=J0(),y=t(g),_=!1,w,x,b,P={point:I,lineStart:E,lineEnd:N,polygonStart:function(){P.point=A,P.lineStart=U,P.lineEnd=z,x=[],w=[]},polygonEnd:function(){P.point=I,P.lineStart=E,P.lineEnd=N,x=Qp(x);var $=ey(w,d);x.length?(_||(c.polygonStart(),_=!0),Q0(x,rz,$,e,c)):$&&(_||(c.polygonStart(),_=!0),c.lineStart(),e(null,null,1,c),c.lineEnd()),_&&(c.polygonEnd(),_=!1),x=w=null},sphere:function(){c.polygonStart(),c.lineStart(),e(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function I($,q){var D=a($,q);r($=D[0],q=D[1])&&c.point($,q)}function M($,q){var D=a($,q);p.point(D[0],D[1])}function E(){P.point=M,p.lineStart()}function N(){P.point=I,p.lineEnd()}function A($,q){b.push([$,q]);var D=a($,q);y.point(D[0],D[1])}function U(){y.lineStart(),b=[]}function z(){A(b[0][0],b[0][1]),y.lineEnd();var $=y.clean(),q=g.result(),D,G=q.length,Q,_t,Z;if(b.pop(),w.push(b),b=null,!!G){if($&1){if(_t=q[0],(Q=_t.length-1)>0){for(_||(c.polygonStart(),_=!0),c.lineStart(),D=0;D<Q;++D)c.point((Z=_t[D])[0],Z[1]);c.lineEnd()}return}G>1&&$&2&&q.push(q.pop().concat(q.shift())),x.push(q.filter(nz))}}return P}}function nz(r){return r.length>1}function rz(r,t){return((r=r.x)[0]<0?r[1]-xi-Kn:xi-r[1])-((t=t.x)[0]<0?t[1]-xi-Kn:xi-t[1])}var iz=iy(function(){return!0},oz,az,[-fr,-xi]);function oz(r){var t=NaN,e=NaN,o=NaN,a;return{lineStart:function(){r.lineStart(),a=1},point:function(c,p){var d=c>0?fr:-fr,g=Zr(c-t);Zr(g-fr)<Kn?(r.point(t,e=(e+p)/2>0?xi:-xi),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(d,e),r.point(c,e),a=0):o!==d&&g>=fr&&(Zr(t-o)<Kn&&(t-=o*Kn),Zr(c-d)<Kn&&(c-=d*Kn),e=sz(t,e,c,p),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(d,e),a=0),r.point(t=c,e=p),o=d},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-a}}}function sz(r,t,e,o){var a,c,p=Qe(r-e);return Zr(p)>Kn?Ys((Qe(t)*(c=Gn(o))*Qe(e)-Qe(o)*(a=Gn(t))*Qe(r))/(a*c*p)):(t+o)/2}function az(r,t,e,o){var a;if(r==null)a=e*xi,o.point(-fr,a),o.point(0,a),o.point(fr,a),o.point(fr,0),o.point(fr,-a),o.point(0,-a),o.point(-fr,-a),o.point(-fr,0),o.point(-fr,a);else if(Zr(r[0]-t[0])>Kn){var c=r[0]<t[0]?fr:-fr;a=e*c/2,o.point(-c,a),o.point(0,a),o.point(c,a)}else o.point(t[0],t[1])}function jp(r){return function(t){var e=new oy;for(var o in r)e[o]=r[o];return e.stream=t,e}}function oy(){}oy.prototype={constructor:oy,point:function(r,t){this.stream.point(r,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var zZ=Gn(30*qo);var jZ=jp({point:function(r,t){this.stream.point(r*qo,t*qo)}});function td(r){return function(t,e){var o=Gn(t),a=Gn(e),c=r(o*a);return[c*a*Qe(t),c*Qe(e)]}}function va(r){return function(t,e){var o=Ji(t*t+e*e),a=r(o),c=Qe(a),p=Gn(a);return[Xo(t*c,o*p),Mo(o&&e*c/o)]}}var iS=td(function(r){return Ji(2/(1+r))});iS.invert=va(function(r){return 2*Mo(r/2)});var oS=td(function(r){return(r=Z0(r))&&r/Qe(r)});oS.invert=va(function(r){return r});function sy(r,t){return[r,Af(Cf((xi+t)/2))]}sy.invert=function(r,t){return[r,2*Ys(Zp(t))-xi]};function ed(r,t){return[r,t]}ed.invert=ed;function sS(r,t){var e=Gn(t),o=Gn(r)*e;return[e*Qe(r)/o,Qe(t)/o]}sS.invert=va(Ys);function aS(r,t){var e=t*t,o=e*e;return[r*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}aS.invert=function(r,t){var e=t,o=25,a;do{var c=e*e,p=c*c;e-=a=(e*(1.007226+c*(.015085+p*(-.044475+.028874*c-.005916*p)))-t)/(1.007226+c*(.015085*3+p*(-.044475*7+.028874*9*c-.005916*11*p)))}while(Zr(a)>Kn&&--o>0);return[r/(.8707+(c=e*e)*(-.131979+c*(-.013791+c*c*c*(.003971-.001529*c)))),e]};function uS(r,t){return[Gn(t)*Qe(r),Qe(t)]}uS.invert=va(Mo);function lS(r,t){var e=Gn(t),o=1+Gn(r)*e;return[e*Qe(r)/o,Qe(t)/o]}lS.invert=va(function(r){return 2*Ys(r)});function cS(r,t){return[Af(Cf((xi+t)/2)),-r]}cS.invert=function(r,t){return[-t,2*Ys(Zp(r))-xi]};var pz=Nr(bc(),1);var dz=Nr(bc(),1);var mz=Nr(bc(),1);var yz=Nr(bc(),1);function Nu(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function uy(r){let t=0;for(let e=0;e<r.length-1;e++)t+=Nu(r[e],r[e+1]);return t}function hS(r,t,e){let o=new tr(t[0]-r[0],t[1]-r[1]),a=new tr(t[0]-e[0],t[1]-e[1]),p=o.angleTo(a)*180/Math.PI,d=new tr(t[0]-r[0],t[1]-r[1]);return new tr(e[0]-r[0],e[1]-r[1]).cross(d)>0?p:-p}var Ou=Nr(pS(),1);var Ir="___",nd=class{constructor(t=3){this.lift_priority=t;Ii(this,"roadInfo",[]);Ii(this,"facilities",[]);Ii(this,"pointMap",new Map);Ii(this,"nodeMap",new Map);Ii(this,"facilityMap",new Map);Ii(this,"straightLadderMap",new Map);Ii(this,"escalatorMap",new Map);Ii(this,"rampMap",new Map);Ii(this,"staircaseMap",new Map);Ii(this,"parkingMap",new Map);Ii(this,"lineMap",new Map);Ii(this,"baseRoute",new so.default);Ii(this,"escalatorRoute",new so.default);Ii(this,"straightLadderRoute",new so.default);Ii(this,"forwardLineMap",new Map);Ii(this,"forwardRoute",new so.default)}isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let o=[];try{o=JSON.parse(e.entry_end_floor)}catch(c){o=[]}let a=[];try{a=JSON.parse(e.entry_start_floor)}catch(c){a=[]}return Yv(qc({},e),{entry_start_floor:a,entry_end_floor:o})})}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let o=new Date,a=o.getHours()*60+o.getMinutes();t.length&&(t.forEach(c=>{(c.points||[]).filter(p=>p.openStatus!==!1).filter(p=>{if(!p.startTime||!p.endTime)return!0;let[d,g]=p.startTime.split(":").map(b=>+b),[y,_]=p.endTime.split(":").map(b=>+b),w=d*60+g,x=y*60+_;return a>=w&&a<=x}).forEach(p=>{p.floor=c.floor;let d=\`\${c.floor}\${Ir}\${p.id}\`;if(this.nodeMap.set(\`\${c.floor}\${Ir}\${p.nodeId}\`,\`\${c.floor}\${Ir}\${p.relatedId||p.id}\`),this.pointMap.set(d,p),this.isFacilityByType(p.type)){let g=this.facilities.find(y=>y.id===+p.targetId);if(g){switch(g.entry_infra_type){case"straightLadder":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.straightLadderMap.get(p.targetId)||[];x.push(qc({},p)),this.straightLadderMap.set(p.targetId,x)}break;case"staircase":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.staircaseMap.get(p.targetId)||[];x.push(qc({},p)),this.staircaseMap.set(p.targetId,x)}break;case"escalator":let _=this.escalatorMap.get(p.targetId)||[];if(g.entry_start_floor.find(x=>x.floor===c.floor)){let x=_.find(b=>{var P;return((P=b.end)==null?void 0:P.floor)!==c.floor&&!b.start});x?x.start=p:_.push({start:p})}if(g.entry_end_floor.find(x=>x.floor===c.floor)){let x=_.find(b=>{var P;return((P=b.start)==null?void 0:P.floor)!==c.floor&&!b.end});x?x.end=p:_.push({end:p})}this.escalatorMap.set(p.targetId,_);break;case"ramp":let w=this.rampMap.get(p.targetId)||[];if(g.entry_start_floor.find(x=>x.floor===c.floor)){let x=w.find(b=>{var P;return((P=b.end)==null?void 0:P.floor)!==c.floor&&!b.start});x?x.start=p:w.push({start:p})}if(g.entry_end_floor.find(x=>x.floor===c.floor)){let x=w.find(b=>{var P;return((P=b.start)==null?void 0:P.floor)!==c.floor&&!b.end});x?x.end=p:w.push({end:p})}this.rampMap.set(p.targetId,w);break}let y=this.facilityMap.get(p.targetId)||[];y.push(qc({},p)),this.facilityMap.set(p.targetId,y)}}p.type==="parkingSpace"&&this.parkingMap.set(\`\${c.floor}\${Ir}\${p.name}\`,p)}),(c.lines||[]).filter(p=>p.direction!=="no").forEach(p=>{let d=\`\${c.floor}\${Ir}\${p.from}\`,g=\`\${c.floor}\${Ir}\${p.to}\`,y=this.pointMap.get(d),_=this.pointMap.get(g);if(!y||!_)return;let w=y.cds,x=_.cds,b=Nu(w,x);if(!y.permission&&!_.permission)switch(this.addLineItem(d,g,b),this.addLineItem(g,d,b),p.direction){case"double":this.addLineItem(d,g,b,this.forwardLineMap),this.addLineItem(g,d,b,this.forwardLineMap);break;case"single":this.addLineItem(d,g,b,this.forwardLineMap);break;case"back":this.addLineItem(g,d,b,this.forwardLineMap);break}else y.permission&&(this.setPermissionLine(d,g,y.permission,b,""),this.setPermissionLine(g,d,y.permission,b,"")),_.permission&&_.permission!==y.permission&&(this.setPermissionLine(d,g,_.permission,b,""),this.setPermissionLine(g,d,_.permission,b,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this[\`permission_\${t}\`]||(this[\`permission_\${t}\`]=new Set),this[\`permission_\${t}\`]}setPermissionLine(t,e,o,a,c){this.getPermissionMap(o).add({fromKey:t,toKey:e,distance:a,type:c})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let o=0;o<t.length;o++){let a=\`\${t[o].floor}\${Ir}\${t[o].id}\`,c=this.pointMap.get(a);if(c){for(let p=0;p<t.length;p++)if(o!==p){let d=\`\${t[p].floor}\${Ir}\${t[p].id}\`,g=this.pointMap.get(d);if(!g)continue;c.permission&&this.setPermissionLine(a,d,c.permission,1,"straightLadder"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(a,d,g.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let o=0;o<t.length;o++){let a=\`\${t[o].floor}\${Ir}\${t[o].id}\`,c=this.pointMap.get(a);if(c){for(let p=0;p<t.length;p++)if(o!==p){let d=\`\${t[p].floor}\${Ir}\${t[p].id}\`,g=this.pointMap.get(d);if(!g)continue;c.permission&&this.setPermissionLine(a,d,c.permission,1,"staircase"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(a,d,g.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let a=\`\${o.start.floor}\${Ir}\${o.start.id}\`,c=\`\${o.end.floor}\${Ir}\${o.end.id}\`,p=this.pointMap.get(a),d=this.pointMap.get(c);p&&d&&(p.permission&&this.setPermissionLine(a,c,p.permission,1,"escalator"),d.permission&&d.permission!==p.permission&&this.setPermissionLine(a,c,d.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let a=\`\${o.start.floor}\${Ir}\${o.start.id}\`,c=\`\${o.end.floor}\${Ir}\${o.end.id}\`,p=this.pointMap.get(a),d=this.pointMap.get(c);p&&d&&(p.permission&&this.setPermissionLine(a,c,p.permission,10,"ramp"),d.permission&&d.permission!==p.permission&&this.setPermissionLine(a,c,d.permission,10,"ramp"))}})})}addPermissionLineToMap(t,e,o,a){let c=this.getPermissionMap(t);console.log(c),c.forEach(p=>{e.includes(p.type)&&(p.type===""?this.addLineItem(p.fromKey,p.toKey,p.distance,o):this.addLineItem(p.fromKey,p.toKey,a.get(p.type),o))})}addLineItem(t,e,o,a=this.lineMap){let c=a.get(t)||new Map;c.set(e,o),a.set(t,c)}addFacilityToLineMap(t,e,o,a){[...this.straightLadderMap,...this.staircaseMap].forEach(([c,p])=>{if(!(p.length<2))for(let d=0;d<p.length;d++){let g=\`\${p[d].floor}\${Ir}\${p[d].id}\`,y=this.pointMap.get(g);if(!(!y||y.permission)){for(let _=0;_<p.length;_++)if(d!==_){let w=\`\${p[_].floor}\${Ir}\${p[_].id}\`,x=this.pointMap.get(w);if(!x||x.permission)continue;if(p[d].type==="straightLadder"){let b=e;this.addLineItem(g,w,b,a)}else{let b=o;this.addLineItem(g,w,b,a)}}}}}),this.escalatorMap.forEach((c,p)=>{c.forEach(d=>{if(d.start&&d.end){let g=\`\${d.start.floor}\${Ir}\${d.start.id}\`,y=\`\${d.end.floor}\${Ir}\${d.end.id}\`,_=this.pointMap.get(g),w=this.pointMap.get(y);if(_&&w&&!_.permission&&!w.permission){let x=t;this.addLineItem(g,y,x,a)}}})})}initBaseRoute(){let t=new Map((0,Ou.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,t),this.baseRoute=new so.default(t)}initEscalatorRoute(){let t=new Map((0,Ou.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new so.default(t)}initStraightLadderRoute(){let t=new Map((0,Ou.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new so.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let a=\`\${o.start.floor}\${Ir}\${o.start.id}\`,c=\`\${o.end.floor}\${Ir}\${o.end.id}\`,p=this.pointMap.get(a),d=this.pointMap.get(c);p&&d&&!p.permission&&!d.permission&&this.addLineItem(a,c,10,this.forwardLineMap)}})}),this.forwardRoute=new so.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let o=this.nodeMap.get(\`\${t.floor}\${Ir}\${t.nodeId}\`);if(o){let[a,c]=o.split(Ir);return{floor:a,id:c}}}if((e=t.coord)!=null&&e.length){let o=this.roadInfo.find(c=>c.floor===t.floor);if(!o)return null;let a=o.points.reduce((c,p)=>{let d=Nu(t.coord,p.cds);return d<c.min&&(c.min=d,c.point=p),c},{min:1/0,point:o.points[0]});return{floor:o.floor,id:a.point.id}}return null}transformEnd(t){if(t.floor){if(t.parkingSpace){let o=this.parkingMap.get(\`\${t.floor}\${Ir}\${t.parkingSpace}\`);if(o)return{floor:t.floor,id:o.id}}let e=this.transformStart(t);if(e)return e}if(t.facility){let o=this.facilities.filter(a=>+a.type_id==+t.facility).map(a=>a.id).map(a=>this.facilityMap.get(\`\${a}\`)).flat(2);if(o!=null&&o.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o="",a){if(!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let c=this.transformStart(t);if(!c)return"no-start";let p=this.transformEnd(e);if(!p)return"no-end";let d=this.getBasePath.bind(this);switch(o){case"escalator":d=this.getEscalatorPath.bind(this);break;case"straightLadder":d=this.getStraightLadderPath.bind(this);break;case"forward":d=this.getForwardPath.bind(this);break;default:d=this.getBasePath.bind(this);break}if(p.id)return d(c,p,a);if(p.facility){let y=this.facilities.filter(w=>+w.type_id==+e.facility).map(w=>w.id).map(w=>this.facilityMap.get(\`\${w}\`)).flat(2).filter(w=>w).filter(w=>p.floor?w.floor===p.floor:!0);if(!y.length)return null;let _=y.map(w=>d(c,{floor:w.floor,id:w.id},a)).filter(w=>!!w);return _.reduce((w,x)=>{let b=x.reduce((P,I)=>P+uy(I.points),0);return b<w.distance&&(w.distance=b,w.path=x),w},{distance:1/0,path:_[0]}).path}}getRoutePath(t,e,o){let a=\`\${t.floor}\${Ir}\${t.id}\`,c=\`\${e.floor}\${Ir}\${e.id}\`,p=o.path(a,c);if(!p)return null;let d=[];return p.map(g=>{var _;let y=this.pointMap.get(g);if(y){let{floor:w}=y,x=y.type;if(this.isFacilityByType(y.type)){let b=this.facilities.find(P=>P.id===+y.targetId);b&&(x=b.entry_infra_type)}if(((_=d[d.length-1])==null?void 0:_.floor)===w){let b=d[d.length-1];b.points.push(y.cds),b.endType=x,b.destId=y.nodeId,b.distance=uy(b.points)}else d.push({floor:w,points:[y.cds],endType:x,destId:y.nodeId,distance:0})}}),d}getBasePath(t,e,o){if(!o)return this.getRoutePath(t,e,this.baseRoute);let a=(0,Ou.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder"],a,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let c=new so.default(a);return this.getRoutePath(t,e,c)}getEscalatorPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.escalatorRoute);let a=(0,Ou.cloneDeep)(this.escalatorRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder"],a,new Map([["escalator",1*c],["straightLadder",this.lift_priority*c],["staircase",3e4*c]]));let p=new so.default(a);return this.getRoutePath(t,e,p)}getStraightLadderPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.straightLadderRoute);let a=(0,Ou.cloneDeep)(this.straightLadderRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder"],a,new Map([["escalator",3*c],["straightLadder",1*c],["staircase",3e4*c]]));let p=new so.default(a);return this.getRoutePath(t,e,p)}getForwardPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.forwardRoute);let a=(0,Ou.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],a,new Map([["ramp",10]]));let c=new so.default(a);return this.getRoutePath(t,e,c)}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 so.default,this.escalatorRoute=new so.default,this.straightLadderRoute=new so.default}};var Tz=Nr(vS(),1);function Az(r,t,e){let o=hS(r,t,e);return 180-Math.abs(o)<15?"front":o>135?"right_front":o<-135?"left_front":o<=135&&o>=60?"right":o>=-135&&o<=-60?"left":o<60&&o>0?"right_back":o>-60&&o<0?"left_back":"front"}function _S(r){if(!r.length)return[];let t=[{direction:"start",distance:Nu(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let o=Az(r[e-2],r[e-1],r[e]);if(o==="front"){let a=t[t.length-1],c=Nu(r[e-1],r[e]);a.distance+=c,e!==2&&a.points.push(r[e-1])}else t.push({direction:o,distance:Nu(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}function xS(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function ES(r){let t={};for(let o in r)o.startsWith("on")&&(t[xS(o.slice(2))]=r[o]);let e=async({data:o})=>{if(t[o.type])try{let a=await t[o.type](o.data);self.postMessage({type:\`\${o.type}_result\`,key:o.key,data:a})}catch(a){self.postMessage({type:\`\${o.type}_result\`,key:o.key,error:a})}else self.postMessage({type:\`\${o.type}_result\`,key:o.key,error:"no_event"})};return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var ly=new nd;ES({onSetRoadInfo({roadData:r,facilities:t}){ly.initRoute(r,t)},onGetPath({start:r,end:t,type:e,permission:o}){return ly.getPath(r,t,e,o)},onGetDirectionPath(r){return _S(r)},onClear(){ly.clear()}});
|
|
3706
|
-
/*! Bundled license information:
|
|
3707
|
-
|
|
3708
|
-
object-assign/index.js:
|
|
3709
|
-
(*
|
|
3710
|
-
object-assign
|
|
3711
|
-
(c) Sindre Sorhus
|
|
3712
|
-
@license MIT
|
|
3713
|
-
*)
|
|
3714
|
-
|
|
3715
|
-
polygon-clipping/dist/polygon-clipping.umd.js:
|
|
3716
|
-
(**
|
|
3717
|
-
* splaytree v3.1.2
|
|
3718
|
-
* Fast Splay tree for Node and browser
|
|
3719
|
-
*
|
|
3720
|
-
* @author Alexander Milevski <info@w8r.name>
|
|
3721
|
-
* @license MIT
|
|
3722
|
-
* @preserve
|
|
3723
|
-
*)
|
|
3724
|
-
(*! *****************************************************************************
|
|
3725
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3726
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
3727
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
3728
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
3729
|
-
|
|
3730
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
3731
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
3732
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
3733
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
3734
|
-
|
|
3735
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
3736
|
-
and limitations under the License.
|
|
3737
|
-
***************************************************************************** *)
|
|
3738
|
-
|
|
3739
|
-
lodash/lodash.js:
|
|
3740
|
-
(**
|
|
3741
|
-
* @license
|
|
3742
|
-
* Lodash <https://lodash.com/>
|
|
3743
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
3744
|
-
* Released under MIT license <https://lodash.com/license>
|
|
3745
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
3746
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
3747
|
-
*)
|
|
3748
|
-
|
|
3749
|
-
three/build/three.module.js:
|
|
3750
|
-
(**
|
|
3751
|
-
* @license
|
|
3752
|
-
* Copyright 2010-2023 Three.js Authors
|
|
3753
|
-
* SPDX-License-Identifier: MIT
|
|
3754
|
-
*)
|
|
3755
|
-
|
|
3756
|
-
@turf/isolines/dist/es/index.js:
|
|
3757
|
-
(**
|
|
3758
|
-
* @license GNU Affero General Public License.
|
|
3759
|
-
* Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>
|
|
3760
|
-
* v. 1.2.0
|
|
3761
|
-
* https://github.com/RaumZeit/MarchingSquares.js
|
|
3762
|
-
*
|
|
3763
|
-
* MarchingSquaresJS is free software: you can redistribute it and/or modify
|
|
3764
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
3765
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
3766
|
-
* (at your option) any later version.
|
|
3767
|
-
*
|
|
3768
|
-
* MarchingSquaresJS is distributed in the hope that it will be useful,
|
|
3769
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
3770
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
3771
|
-
* GNU Affero General Public License for more details.
|
|
3772
|
-
*
|
|
3773
|
-
* As additional permission under GNU Affero General Public License version 3
|
|
3774
|
-
* section 7, third-party projects (personal or commercial) may distribute,
|
|
3775
|
-
* include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the
|
|
3776
|
-
* requirement that said third-party project for that reason alone becomes
|
|
3777
|
-
* subject to any requirement of the GNU Affero General Public License version 3.
|
|
3778
|
-
* Any modifications to MarchingSquaresJS, however, must be shared with the public
|
|
3779
|
-
* and made available.
|
|
3780
|
-
*
|
|
3781
|
-
* In summary this:
|
|
3782
|
-
* - allows you to use MarchingSquaresJS at no cost
|
|
3783
|
-
* - allows you to use MarchingSquaresJS for both personal and commercial purposes
|
|
3784
|
-
* - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any
|
|
3785
|
-
* license as long as this license notice is included
|
|
3786
|
-
* - enables you to keep the source code of your program that uses MarchingSquaresJS
|
|
3787
|
-
* undisclosed
|
|
3788
|
-
* - forces you to share any modifications you have made to MarchingSquaresJS,
|
|
3789
|
-
* e.g. bug-fixes
|
|
3790
|
-
*
|
|
3791
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
3792
|
-
* along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.
|
|
3793
|
-
*)
|
|
3794
|
-
|
|
3795
|
-
@turf/isobands/dist/es/index.js:
|
|
3796
|
-
(*!
|
|
3797
|
-
* @license GNU Affero General Public License.
|
|
3798
|
-
* Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>
|
|
3799
|
-
* v. 1.2.0
|
|
3800
|
-
* https://github.com/RaumZeit/MarchingSquares.js
|
|
3801
|
-
*
|
|
3802
|
-
* MarchingSquaresJS is free software: you can redistribute it and/or modify
|
|
3803
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
3804
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
3805
|
-
* (at your option) any later version.
|
|
3806
|
-
*
|
|
3807
|
-
* MarchingSquaresJS is distributed in the hope that it will be useful,
|
|
3808
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
3809
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
3810
|
-
* GNU Affero General Public License for more details.
|
|
3811
|
-
*
|
|
3812
|
-
* As additional permission under GNU Affero General Public License version 3
|
|
3813
|
-
* section 7, third-party projects (personal or commercial) may distribute,
|
|
3814
|
-
* include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the
|
|
3815
|
-
* requirement that said third-party project for that reason alone becomes
|
|
3816
|
-
* subject to any requirement of the GNU Affero General Public License version 3.
|
|
3817
|
-
* Any modifications to MarchingSquaresJS, however, must be shared with the public
|
|
3818
|
-
* and made available.
|
|
3819
|
-
*
|
|
3820
|
-
* In summary this:
|
|
3821
|
-
* - allows you to use MarchingSquaresJS at no cost
|
|
3822
|
-
* - allows you to use MarchingSquaresJS for both personal and commercial purposes
|
|
3823
|
-
* - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any
|
|
3824
|
-
* license as long as this license notice is included
|
|
3825
|
-
* - enables you to keep the source code of your program that uses MarchingSquaresJS
|
|
3826
|
-
* undisclosed
|
|
3827
|
-
* - forces you to share any modifications you have made to MarchingSquaresJS,
|
|
3828
|
-
* e.g. bug-fixes
|
|
3829
|
-
*
|
|
3830
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
3831
|
-
* along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.
|
|
3832
|
-
*)
|
|
3833
|
-
*/
|
|
3834
|
-
`)}var Ln=class extends Zr.EventDispatcher{worker=Rn();initRoadStatus=!1;constructor(){super()}async setRoadData(e,t){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),await lt(this.worker,"set_road_info",{roadData:e,facilities:t}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})}async getPath(e,t,n="",r){return new Promise((i,o)=>{let a=()=>{console.log("initRoadStatus",this.initRoadStatus),lt(this.worker,"get_path",{start:e,end:t,type:n,permission:r}).then(l=>{l?typeof l=="string"?o(l):i(l):o("no-path")})};if(this.initRoadStatus)a();else{let l=({status:u})=>{u&&(this.removeEventListener("init-road-status",l),a())};this.addEventListener("init-road-status",l)}})}getDirectionPath(e){return lt(this.worker,"get_direction_path",e)}async dispose(){lt(this.worker,"clear",""),this.worker.terminate()}};var Jr=require("three");function Nn(){return xe(`var $1=Object.create;var Rh=Object.defineProperty;var Z1=Object.getOwnPropertyDescriptor;var J1=Object.getOwnPropertyNames,fm=Object.getOwnPropertySymbols,K1=Object.getPrototypeOf,pm=Object.prototype.hasOwnProperty,j1=Object.prototype.propertyIsEnumerable;var Ih=(r,t,e)=>t in r?Rh(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Sl=(r,t)=>{for(var e in t||(t={}))pm.call(t,e)&&Ih(r,e,t[e]);if(fm)for(var e of fm(t))j1.call(t,e)&&Ih(r,e,t[e]);return r};var Ht=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var Q1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of J1(t))!pm.call(r,a)&&a!==e&&Rh(r,a,{get:()=>t[a],enumerable:!(o=Z1(t,a))||o.enumerable});return r};var Wn=(r,t,e)=>(e=r!=null?$1(K1(r)):{},Q1(t||!r||!r.__esModule?Rh(e,"default",{value:r,enumerable:!0}):e,r));var Si=(r,t,e)=>Ih(r,typeof t!="symbol"?t+"":t,e);var mm=Ht((PR,dm)=>{var Lh=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)}};dm.exports=Lh});var vm=Ht((IR,ym)=>{function gm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,gm(a,t)):o!==t&&e.set(o,a);return e}ym.exports=gm});var Em=Ht((RR,xm)=>{function tx(r){let t=Number(r);return!(isNaN(t)||t<=0)}function _m(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,_m(a));if(!tx(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}xm.exports=_m});var wm=Ht((LR,Sm)=>{function Mm(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){Mm(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}Sm.exports=Mm});var Cm=Ht((NR,Am)=>{var ex=mm(),nx=vm(),bm=Em(),Tm=wm(),Nh=class{constructor(t){t instanceof Map?(Tm(t),this.graph=t):t?this.graph=bm(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(Tm(e),o=e):o=bm(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=nx(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 ex,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 b=l.get(M).priority,T=g.priority+y;return T<b?(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)}};Am.exports=Nh});var dc=Ht((VR,v0)=>{"use strict";var y0=Object.getOwnPropertySymbols,rT=Object.prototype.hasOwnProperty,iT=Object.prototype.propertyIsEnumerable;function oT(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function sT(){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}}v0.exports=sT()?Object.assign:function(r,t){for(var e,o=oT(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var h in e)rT.call(e,h)&&(o[h]=e[h]);if(y0){a=y0(e);for(var f=0;f<a.length;f++)iT.call(e,a[f])&&(o[a[f]]=e[a[f]])}}return o}});var sp=Ht((ip,op)=>{(function(r,t){typeof ip=="object"&&typeof op!="undefined"?op.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(ip,function(){"use strict";function r(x,v,P,S,L){(function N(G,B,I,O,q){for(;O>I;){if(O-I>600){var st=O-I+1,V=B-I+1,Mt=Math.log(st),$=.5*Math.exp(2*Mt/3),ut=.5*Math.sqrt(Mt*$*(st-$)/st)*(V-st/2<0?-1:1),xt=Math.max(I,Math.floor(B-V*$/st+ut)),mt=Math.min(O,Math.floor(B+(st-V)*$/st+ut));N(G,B,xt,mt,q)}var lt=G[B],ht=I,k=O;for(t(G,I,B),q(G[O],lt)>0&&t(G,I,O);ht<k;){for(t(G,ht,k),ht++,k--;q(G[ht],lt)<0;)ht++;for(;q(G[k],lt)>0;)k--}q(G[I],lt)===0?t(G,I,k):t(G,++k,O),k<=B&&(I=k+1),B<=k&&(O=k-1)}})(x,v,P||0,S||x.length-1,L||e)}function t(x,v,P){var S=x[v];x[v]=x[P],x[P]=S}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,P){if(!P)return v.indexOf(x);for(var S=0;S<v.length;S++)if(P(x,v[S]))return S;return-1}function l(x,v){h(x,0,x.children.length,v,x)}function h(x,v,P,S,L){L||(L=b(null)),L.minX=1/0,L.minY=1/0,L.maxX=-1/0,L.maxY=-1/0;for(var N=v;N<P;N++){var G=x.children[N];f(L,x.leaf?S(G):G)}return L}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 b(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(x,v,P,S,L){for(var N=[v,P];N.length;)if(!((P=N.pop())-(v=N.pop())<=S)){var G=v+Math.ceil((P-v)/S/2)*S;r(x,G,v,P,L),N.push(v,G,G,P)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(x){var v=this.data,P=[];if(!M(x,v))return P;for(var S=this.toBBox,L=[];v;){for(var N=0;N<v.children.length;N++){var G=v.children[N],B=v.leaf?S(G):G;M(x,B)&&(v.leaf?P.push(G):y(x,B)?this._all(G,P):L.push(G))}v=L.pop()}return P},o.prototype.collides=function(x){var v=this.data;if(!M(x,v))return!1;for(var P=[];v;){for(var S=0;S<v.children.length;S++){var L=v.children[S],N=v.leaf?this.toBBox(L):L;if(M(x,N)){if(v.leaf||y(x,N))return!0;P.push(L)}}v=P.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 P=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===P.height)this._splitRoot(this.data,P);else{if(this.data.height<P.height){var S=this.data;this.data=P,P=S}this._insert(P,this.data.height-P.height-1,!0)}else this.data=P;return this},o.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},o.prototype.clear=function(){return this.data=b([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var P,S,L,N=this.data,G=this.toBBox(x),B=[],I=[];N||B.length;){if(N||(N=B.pop(),S=B[B.length-1],P=I.pop(),L=!0),N.leaf){var O=a(x,N.children,v);if(O!==-1)return N.children.splice(O,1),B.push(N),this._condense(B),this}L||N.leaf||!y(N,G)?S?(P++,N=S.children[P],L=!1):N=null:(B.push(N),I.push(P),P=0,S=N,N=N.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 P=[];x;)x.leaf?v.push.apply(v,x.children):P.push.apply(P,x.children),x=P.pop();return v},o.prototype._build=function(x,v,P,S){var L,N=P-v+1,G=this._maxEntries;if(N<=G)return l(L=b(x.slice(v,P+1)),this.toBBox),L;S||(S=Math.ceil(Math.log(N)/Math.log(G)),G=Math.ceil(N/Math.pow(G,S-1))),(L=b([])).leaf=!1,L.height=S;var B=Math.ceil(N/G),I=B*Math.ceil(Math.sqrt(G));T(x,v,P,I,this.compareMinX);for(var O=v;O<=P;O+=I){var q=Math.min(O+I-1,P);T(x,O,q,B,this.compareMinY);for(var st=O;st<=q;st+=B){var V=Math.min(st+B-1,q);L.children.push(this._build(x,st,V,S-1))}}return l(L,this.toBBox),L},o.prototype._chooseSubtree=function(x,v,P,S){for(;S.push(v),!v.leaf&&S.length-1!==P;){for(var L=1/0,N=1/0,G=void 0,B=0;B<v.children.length;B++){var I=v.children[B],O=g(I),q=(st=x,V=I,(Math.max(V.maxX,st.maxX)-Math.min(V.minX,st.minX))*(Math.max(V.maxY,st.maxY)-Math.min(V.minY,st.minY))-O);q<N?(N=q,L=O<L?O:L,G=I):q===N&&O<L&&(L=O,G=I)}v=G||v.children[0]}var st,V;return v},o.prototype._insert=function(x,v,P){var S=P?x:this.toBBox(x),L=[],N=this._chooseSubtree(S,this.data,v,L);for(N.children.push(x),f(N,S);v>=0&&L[v].children.length>this._maxEntries;)this._split(L,v),v--;this._adjustParentBBoxes(S,L,v)},o.prototype._split=function(x,v){var P=x[v],S=P.children.length,L=this._minEntries;this._chooseSplitAxis(P,L,S);var N=this._chooseSplitIndex(P,L,S),G=b(P.children.splice(N,P.children.length-N));G.height=P.height,G.leaf=P.leaf,l(P,this.toBBox),l(G,this.toBBox),v?x[v-1].children.push(G):this._splitRoot(P,G)},o.prototype._splitRoot=function(x,v){this.data=b([x,v]),this.data.height=x.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(x,v,P){for(var S,L,N,G,B,I,O,q=1/0,st=1/0,V=v;V<=P-v;V++){var Mt=h(x,0,V,this.toBBox),$=h(x,V,P,this.toBBox),ut=(L=Mt,N=$,G=void 0,B=void 0,I=void 0,O=void 0,G=Math.max(L.minX,N.minX),B=Math.max(L.minY,N.minY),I=Math.min(L.maxX,N.maxX),O=Math.min(L.maxY,N.maxY),Math.max(0,I-G)*Math.max(0,O-B)),xt=g(Mt)+g($);ut<q?(q=ut,S=V,st=xt<st?xt:st):ut===q&&xt<st&&(st=xt,S=V)}return S||P-v},o.prototype._chooseSplitAxis=function(x,v,P){var S=x.leaf?this.compareMinX:p,L=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,P,S)<this._allDistMargin(x,v,P,L)&&x.children.sort(S)},o.prototype._allDistMargin=function(x,v,P,S){x.children.sort(S);for(var L=this.toBBox,N=h(x,0,v,L),G=h(x,P-v,P,L),B=_(N)+_(G),I=v;I<P-v;I++){var O=x.children[I];f(N,x.leaf?L(O):O),B+=_(N)}for(var q=P-v-1;q>=v;q--){var st=x.children[q];f(G,x.leaf?L(st):st),B+=_(G)}return B},o.prototype._adjustParentBBoxes=function(x,v,P){for(var S=P;S>=0;S--)f(v[S],x)},o.prototype._condense=function(x){for(var v=x.length-1,P=void 0;v>=0;v--)x[v].children.length===0?v>0?(P=x[v-1].children).splice(P.indexOf(x[v]),1):this.clear():l(x[v],this.toBBox)},o})});var _0=Ht((ap,up)=>{(function(r,t){typeof ap=="object"&&typeof up!="undefined"?up.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(ap,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 E0=Ht(($R,x0)=>{x0.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],b=e[o+g*2+1],T=y>h!=b>h&&l<(M-_)*(h-y)/(b-y)+_;T&&(f=!f)}return f}});var S0=Ht((ZR,M0)=>{M0.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],b=e[g+o][1],T=y>h!=b>h&&l<(M-_)*(h-y)/(b-y)+_;T&&(f=!f)}return f}});var T0=Ht((JR,yc)=>{var w0=E0(),b0=S0();yc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?b0(t,e,o,a):w0(t,e,o,a)};yc.exports.nested=b0;yc.exports.flat=w0});var C0=Ht((vc,A0)=>{(function(r,t){typeof vc=="object"&&typeof A0!="undefined"?t(vc):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(vc,function(r){"use strict";let e=33306690738754706e-32;function o(M,b,T,x,v){let P,S,L,N,G=b[0],B=x[0],I=0,O=0;B>G==B>-G?(P=G,G=b[++I]):(P=B,B=x[++O]);let q=0;if(I<M&&O<T)for(B>G==B>-G?(L=P-((S=G+P)-G),G=b[++I]):(L=P-((S=B+P)-B),B=x[++O]),P=S,L!==0&&(v[q++]=L);I<M&&O<T;)B>G==B>-G?(L=P-((S=P+G)-(N=S-P))+(G-N),G=b[++I]):(L=P-((S=P+B)-(N=S-P))+(B-N),B=x[++O]),P=S,L!==0&&(v[q++]=L);for(;I<M;)L=P-((S=P+G)-(N=S-P))+(G-N),G=b[++I],P=S,L!==0&&(v[q++]=L);for(;O<T;)L=P-((S=P+B)-(N=S-P))+(B-N),B=x[++O],P=S,L!==0&&(v[q++]=L);return P===0&&q!==0||(v[q++]=P),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,b,T,x,v,P){let S=(b-P)*(T-v),L=(M-v)*(x-P),N=S-L;if(S===0||L===0||S>0!=L>0)return N;let G=Math.abs(S+L);return Math.abs(N)>=l*G?N:-function(B,I,O,q,st,V,Mt){let $,ut,xt,mt,lt,ht,k,nt,ft,Tt,gt,Lt,qt,Xt,Ft,Qt,Ct,ee,it=B-st,rn=O-st,Bt=I-V,Jt=q-V;lt=(Ft=(nt=it-(k=(ht=134217729*it)-(ht-it)))*(Tt=Jt-(ft=(ht=134217729*Jt)-(ht-Jt)))-((Xt=it*Jt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=Bt-(k=(ht=134217729*Bt)-(ht-Bt)))*(Tt=rn-(ft=(ht=134217729*rn)-(ht-rn)))-((Qt=Bt*rn)-k*ft-nt*ft-k*Tt))),p[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),p[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,p[2]=Lt-(ee-lt)+(gt-lt),p[3]=ee;let Yt=function(yn,pn){let X=pn[0];for(let F=1;F<yn;F++)X+=pn[F];return X}(4,p),pe=h*Mt;if(Yt>=pe||-Yt>=pe||($=B-(it+(lt=B-it))+(lt-st),xt=O-(rn+(lt=O-rn))+(lt-st),ut=I-(Bt+(lt=I-Bt))+(lt-V),mt=q-(Jt+(lt=q-Jt))+(lt-V),$===0&&ut===0&&xt===0&&mt===0)||(pe=f*Mt+e*Math.abs(Yt),(Yt+=it*mt+Jt*$-(Bt*xt+rn*ut))>=pe||-Yt>=pe))return Yt;lt=(Ft=(nt=$-(k=(ht=134217729*$)-(ht-$)))*(Tt=Jt-(ft=(ht=134217729*Jt)-(ht-Jt)))-((Xt=$*Jt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=ut-(k=(ht=134217729*ut)-(ht-ut)))*(Tt=rn-(ft=(ht=134217729*rn)-(ht-rn)))-((Qt=ut*rn)-k*ft-nt*ft-k*Tt))),y[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),y[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,y[2]=Lt-(ee-lt)+(gt-lt),y[3]=ee;let le=o(4,p,4,y,d);lt=(Ft=(nt=it-(k=(ht=134217729*it)-(ht-it)))*(Tt=mt-(ft=(ht=134217729*mt)-(ht-mt)))-((Xt=it*mt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=Bt-(k=(ht=134217729*Bt)-(ht-Bt)))*(Tt=xt-(ft=(ht=134217729*xt)-(ht-xt)))-((Qt=Bt*xt)-k*ft-nt*ft-k*Tt))),y[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),y[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,y[2]=Lt-(ee-lt)+(gt-lt),y[3]=ee;let Pt=o(le,d,4,y,g);lt=(Ft=(nt=$-(k=(ht=134217729*$)-(ht-$)))*(Tt=mt-(ft=(ht=134217729*mt)-(ht-mt)))-((Xt=$*mt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=ut-(k=(ht=134217729*ut)-(ht-ut)))*(Tt=xt-(ft=(ht=134217729*xt)-(ht-xt)))-((Qt=ut*xt)-k*ft-nt*ft-k*Tt))),y[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),y[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,y[2]=Lt-(ee-lt)+(gt-lt),y[3]=ee;let te=o(Pt,g,4,y,_);return _[te-1]}(M,b,T,x,v,P,G)},r.orient2dfast=function(M,b,T,x,v,P){return(b-P)*(T-v)-(M-v)*(x-P)},Object.defineProperty(r,"__esModule",{value:!0})})});var O0=Ht((KR,fp)=>{"use strict";var P0=sp(),xc=_0(),uT=T0(),lT=C0().orient2d;xc.default&&(xc=xc.default);fp.exports=N0;fp.exports.default=N0;function N0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=dT(r),a=new P0(16);a.toBBox=function(P){return{minX:P[0],minY:P[1],maxX:P[0],maxY:P[1]}},a.compareMinX=function(P,S){return P[0]-S[0]},a.compareMinY=function(P,S){return P[1]-S[1]},a.load(r);for(var l=[],h=0,f;h<o.length;h++){var p=o[h];a.remove(p),f=L0(p,f),l.push(f)}var d=new P0(16);for(h=0;h<l.length;h++)d.insert(lp(l[h]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,b=y.next.p,T=cp(M,b);if(!(T<_)){var x=T/g;p=cT(a,y.prev.p,M,b,y.next.next.p,x,d),p&&Math.min(cp(p,M),cp(p,b))<=x&&(l.push(y),l.push(L0(p,y)),a.remove(p),d.remove(y),d.insert(lp(y)),d.insert(lp(y.next)))}}y=f;var v=[];do v.push(y.p),y=y.next;while(y!==f);return v.push(y.p),v}function cT(r,t,e,o,a,l,h){for(var f=new xc([],hT),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?hp(g,e,o):fT(e,o,g);_>l||f.push({node:g,dist:_})}for(;f.length&&!f.peek().node.children;){var y=f.pop(),M=y.node,b=hp(M,t,e),T=hp(M,o,a);if(y.dist<b&&y.dist<T&&R0(e,M,h)&&R0(o,M,h))return M}p=f.pop(),p&&(p=p.node)}return null}function hT(r,t){return r.dist-t.dist}function fT(r,t,e){if(I0(r,e)||I0(t,e))return 0;var o=_c(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=_c(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=_c(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var h=_c(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 I0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function R0(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(pT(f[p].p,f[p].next.p,r,t))return!1;return!0}function Ja(r,t,e){return lT(r[0],r[1],t[0],t[1],e[0],e[1])}function pT(r,t,e,o){return r!==o&&t!==e&&Ja(r,t,e)>0!=Ja(r,t,o)>0&&Ja(e,o,r)>0!=Ja(e,o,t)>0}function lp(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 dT(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++)uT(r[l],f)||p.push(r[l]);return gT(p)}function L0(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 cp(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function hp(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 _c(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,b=p*p+d*d,T=p*g+d*_,x=g*g+_*_,v=p*y+d*M,P=g*y+_*M,S=b*x-T*T,L,N,G,B,I=S,O=S;S===0?(N=0,I=1,B=P,O=x):(N=T*P-x*v,B=b*P-T*v,N<0?(N=0,B=P,O=x):N>I&&(N=I,B=P+T,O=x)),B<0?(B=0,-v<0?N=0:-v>b?N=I:(N=-v,I=b)):B>O&&(B=O,-v+T<0?N=0:-v+T>b?N=I:(N=-v+T,I=b)),L=N===0?0:N/I,G=B===0?0:B/O;var q=(1-L)*r+L*e,st=(1-L)*t+L*o,V=(1-G)*a+G*h,Mt=(1-G)*l+G*f,$=V-q,ut=Mt-st;return $*$+ut*ut}function mT(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function gT(r){r.sort(mT);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Ja(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&&Ja(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 k0=Ht((dp,mp)=>{(function(r,t){typeof dp=="object"&&typeof mp!="undefined"?mp.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(dp,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),b=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,b,T,p)}var x=a[l],v=h,P=f;for(e(a,h,l),p(a[f],x)>0&&e(a,h,f);v<P;){for(e(a,v,P),v++,P--;p(a[v],x)<0;)v++;for(;p(a[P],x)>0;)P--}p(a[h],x)===0?e(a,h,P):(P++,e(a,P,f)),P<=l&&(h=P+1),l<=P&&(f=P-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 _p=Ht((S2,vp)=>{"use strict";vp.exports=Xu;vp.exports.default=Xu;var PT=k0();function Xu(r,t){if(!(this instanceof Xu))return new Xu(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()}Xu.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Mc(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,Mc(r,p)&&(t.leaf?e.push(f):yp(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(!Mc(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,Mc(r,f)){if(t.leaf||yp(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=Qa([]),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=IT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&yp(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:G0,compareMinY:V0,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=Qa(r.slice(t,e+1)),ja(h,this.toBBox),h;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),h=Qa([]),h.leaf=!1,h.height=o;var f=Math.ceil(a/l),p=f*Math.ceil(Math.sqrt(l)),d,g,_,y;for(H0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),H0(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 ja(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=gp(h),d=RT(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),qu(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=Qa(e.children.splice(l,e.children.length-l));h.height=e.height,h.leaf=e.leaf,ja(e,this.toBBox),ja(h,this.toBBox),t?r[t-1].children.push(h):this._splitRoot(e,h)},_splitRoot:function(r,t){this.data=Qa([r,t]),this.data.height=r.height+1,this.data.leaf=!1,ja(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=Wu(r,0,o,this.toBBox),l=Wu(r,o,e,this.toBBox),h=LT(a,l),f=gp(a)+gp(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:G0,a=r.leaf?this.compareMinY:V0,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=Wu(r,0,t,a),h=Wu(r,e-t,e,a),f=Ec(l)+Ec(h),p,d;for(p=t;p<e-t;p++)d=r.children[p],qu(l,r.leaf?a(d):d),f+=Ec(l);for(p=e-t-1;p>=t;p--)d=r.children[p],qu(h,r.leaf?a(d):d),f+=Ec(h);return f},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)qu(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():ja(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 IT(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 ja(r,t){Wu(r,0,r.children.length,t,r)}function Wu(r,t,e,o,a){a||(a=Qa(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],qu(a,r.leaf?o(h):h);return a}function qu(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 G0(r,t){return r.minX-t.minX}function V0(r,t){return r.minY-t.minY}function gp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Ec(r){return r.maxX-r.minX+(r.maxY-r.minY)}function RT(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 LT(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 yp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Mc(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function Qa(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function H0(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,PT(r,h,t,e,a),l.push(t,h,h,e))}});var Z0=Ht((FO,bp)=>{"use strict";bp.exports=Tc;bp.exports.default=Tc;function Tc(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=X0(r,0,a,e,!0),h=[];if(!l||l.next===l.prev)return h;var f,p,d,g,_,y,M;if(o&&(l=VT(r,t,l,e)),r.length>80*e){f=d=r[0],p=g=r[1];for(var b=e;b<a;b+=e)_=r[b],y=r[b+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 Zu(l,h,e,f,p,M,0),h}function X0(r,t,e,o,a){var l,h;if(a===wp(r,t,e,o)>0)for(l=t;l<e;l+=o)h=q0(l,r[l],r[l+1],h);else for(l=e-o;l>=t;l-=o)h=q0(l,r[l],r[l+1],h);return h&&Ac(h,h.next)&&(Ku(h),h=h.next),h}function Qs(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Ac(e,e.next)||Yn(e.prev,e,e.next)===0)){if(Ku(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function Zu(r,t,e,o,a,l,h){if(r){!h&&l&&YT(r,o,a,l);for(var f=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?zT(r,o,a,l):BT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),Ku(r),r=d.next,f=d.next;continue}if(r=d,r===f){h?h===1?(r=kT(Qs(r),t,e),Zu(r,t,e,o,a,l,2)):h===2&>(r,t,e,o,a,l):Zu(Qs(r),t,e,o,a,l,1);break}}}}function BT(r){var t=r.prev,e=r,o=r.next;if(Yn(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,b=o.next;b!==t;){if(b.x>=g&&b.x<=y&&b.y>=_&&b.y<=M&&nu(a,f,l,p,h,d,b.x,b.y)&&Yn(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function zT(r,t,e,o){var a=r.prev,l=r,h=r.next;if(Yn(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,b=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=Mp(M,b,t,e,o),P=Mp(T,x,t,e,o),S=r.prevZ,L=r.nextZ;S&&S.z>=v&&L&&L.z<=P;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=x&&S!==a&&S!==h&&nu(f,g,p,_,d,y,S.x,S.y)&&Yn(S.prev,S,S.next)>=0||(S=S.prevZ,L.x>=M&&L.x<=T&&L.y>=b&&L.y<=x&&L!==a&&L!==h&&nu(f,g,p,_,d,y,L.x,L.y)&&Yn(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;S&&S.z>=v;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=x&&S!==a&&S!==h&&nu(f,g,p,_,d,y,S.x,S.y)&&Yn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;L&&L.z<=P;){if(L.x>=M&&L.x<=T&&L.y>=b&&L.y<=x&&L!==a&&L!==h&&nu(f,g,p,_,d,y,L.x,L.y)&&Yn(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function kT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Ac(a,l)&&Y0(a,o,o.next,l)&&Ju(a,l)&&Ju(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),Ku(o),Ku(o.next),o=r=l),o=o.next}while(o!==r);return Qs(o)}function GT(r,t,e,o,a,l){var h=r;do{for(var f=h.next.next;f!==h.prev;){if(h.i!==f.i&&JT(h,f)){var p=$0(h,f);h=Qs(h,h.next),p=Qs(p,p.next),Zu(h,t,e,o,a,l,0),Zu(p,t,e,o,a,l,0);return}f=f.next}h=h.next}while(h!==r)}function VT(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=X0(r,f,p,o,!1),d===d.next&&(d.steiner=!0),a.push(ZT(d));for(a.sort(HT),l=0;l<a.length;l++)e=WT(a[l],e);return e}function HT(r,t){return r.x-t.x}function WT(r,t){var e=qT(r,t);if(!e)return t;var o=$0(e,r);return Qs(o,o.next),Qs(e,e.next)}function qT(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&&nu(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),Ju(e,r)&&(y<_||y===_&&(e.x>h.x||e.x===h.x&&XT(h,e)))&&(h=e,_=y)),e=e.next;while(e!==p);return h}function XT(r,t){return Yn(r.prev,r,t.prev)<0&&Yn(t.next,r,r.next)<0}function YT(r,t,e,o){var a=r;do a.z===0&&(a.z=Mp(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,$T(a)}function $T(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 Mp(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 nu(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 JT(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!KT(r,t)&&(Ju(r,t)&&Ju(t,r)&&jT(r,t)&&(Yn(r.prev,r,t.prev)||Yn(r,t.prev,t))||Ac(r,t)&&Yn(r.prev,r,r.next)>0&&Yn(t.prev,t,t.next)>0)}function Yn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Ac(r,t){return r.x===t.x&&r.y===t.y}function Y0(r,t,e,o){var a=bc(Yn(r,t,e)),l=bc(Yn(r,t,o)),h=bc(Yn(e,o,r)),f=bc(Yn(e,o,t));return!!(a!==l&&h!==f||a===0&&wc(r,e,t)||l===0&&wc(r,o,t)||h===0&&wc(e,r,o)||f===0&&wc(e,t,o))}function wc(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 bc(r){return r>0?1:r<0?-1:0}function KT(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&&Y0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Ju(r,t){return Yn(r.prev,r,r.next)<0?Yn(r,t,r.next)>=0&&Yn(r,r.prev,t)>=0:Yn(r,t,r.prev)<0||Yn(r,r.next,t)<0}function jT(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 $0(r,t){var e=new Sp(r.i,r.x,r.y),o=new Sp(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 q0(r,t,e,o){var a=new Sp(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 Ku(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 Sp(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}Tc.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,h=Math.abs(wp(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(wp(r,d,g,e))}var _=0;for(f=0;f<o.length;f+=3){var y=o[f]*e,M=o[f+1]*e,b=o[f+2]*e;_+=Math.abs((r[y]-r[b])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[b+1]-r[y+1]))}return h===0&&_===0?0:Math.abs((_-h)/h)};function wp(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}Tc.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 Ip=Ht(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.earthRadius=63710088e-1;ae.factors={centimeters:ae.earthRadius*100,centimetres:ae.earthRadius*100,degrees:ae.earthRadius/111325,feet:ae.earthRadius*3.28084,inches:ae.earthRadius*39.37,kilometers:ae.earthRadius/1e3,kilometres:ae.earthRadius/1e3,meters:ae.earthRadius,metres:ae.earthRadius,miles:ae.earthRadius/1609.344,millimeters:ae.earthRadius*1e3,millimetres:ae.earthRadius*1e3,nauticalmiles:ae.earthRadius/1852,radians:1,yards:ae.earthRadius*1.0936};ae.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/ae.earthRadius,yards:1.0936133};ae.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 Ms(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}ae.feature=Ms;function tA(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Tp(t).geometry;case"LineString":return Cp(t).geometry;case"Polygon":return Ap(t).geometry;case"MultiPoint":return K0(t).geometry;case"MultiLineString":return J0(t).geometry;case"MultiPolygon":return j0(t).geometry;default:throw new Error(r+" is invalid")}}ae.geometry=tA;function Tp(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(!Cc(r[0])||!Cc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Ms(o,t,e)}ae.point=Tp;function eA(r,t,e){return e===void 0&&(e={}),Pc(r.map(function(o){return Tp(o,t)}),e)}ae.points=eA;function Ap(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 Ms(f,t,e)}ae.polygon=Ap;function nA(r,t,e){return e===void 0&&(e={}),Pc(r.map(function(o){return Ap(o,t)}),e)}ae.polygons=nA;function Cp(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 Ms(o,t,e)}ae.lineString=Cp;function rA(r,t,e){return e===void 0&&(e={}),Pc(r.map(function(o){return Cp(o,t)}),e)}ae.lineStrings=rA;function Pc(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}ae.featureCollection=Pc;function J0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Ms(o,t,e)}ae.multiLineString=J0;function K0(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Ms(o,t,e)}ae.multiPoint=K0;function j0(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Ms(o,t,e)}ae.multiPolygon=j0;function iA(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Ms(o,t,e)}ae.geometryCollection=iA;function oA(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}ae.round=oA;function Q0(r,t){t===void 0&&(t="kilometers");var e=ae.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}ae.radiansToLength=Q0;function Pp(r,t){t===void 0&&(t="kilometers");var e=ae.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}ae.lengthToRadians=Pp;function sA(r,t){return ty(Pp(r,t))}ae.lengthToDegrees=sA;function aA(r){var t=r%360;return t<0&&(t+=360),t}ae.bearingToAzimuth=aA;function ty(r){var t=r%(2*Math.PI);return t*180/Math.PI}ae.radiansToDegrees=ty;function uA(r){var t=r%360;return t*Math.PI/180}ae.degreesToRadians=uA;function lA(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 Q0(Pp(r,t),e)}ae.convertLength=lA;function cA(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=ae.areaFactors[t];if(!o)throw new Error("invalid original units");var a=ae.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}ae.convertArea=cA;function Cc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ae.isNumber=Cc;function hA(r){return!!r&&r.constructor===Object}ae.isObject=hA;function fA(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(!Cc(t))throw new Error("bbox must only contain numbers")})}ae.validateBBox=fA;function pA(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")}ae.validateId=pA});var Lp=Ht(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});var Zr=Ip();function ju(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,_=0,y,M=r.type,b=M==="FeatureCollection",T=M==="Feature",x=b?r.features.length:1,v=0;v<x;v++){d=b?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,f=y?d.geometries.length:1;for(var P=0;P<f;P++){var S=0,L=0;if(h=y?d.geometries[P]:d,h!==null){p=h.coordinates;var N=h.type;switch(g=e&&(N==="Polygon"||N==="MultiPolygon")?1:0,N){case null:break;case"Point":if(t(p,_,v,S,L)===!1)return!1;_++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,S,L)===!1)return!1;_++,N==="MultiPoint"&&S++}N==="LineString"&&S++;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,S,L)===!1)return!1;_++}N==="MultiLineString"&&S++,N==="Polygon"&&L++}N==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(L=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,S,L)===!1)return!1;_++}L++}S++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(ju(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function dA(r,t,e,o){var a=e;return ju(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 ey(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 mA(r,t,e){var o=e;return ey(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function ny(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 gA(r,t,e){var o=e;return ny(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function yA(r){var t=[];return ju(r,function(e){t.push(e)}),t}function Rp(r,t){var e,o,a,l,h,f,p,d,g,_,y=0,M=r.type==="FeatureCollection",b=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(f=M?r.features[e].geometry:b?r.geometry:r,d=M?r.features[e].properties:b?r.properties:{},g=M?r.features[e].bbox:b?r.bbox:void 0,_=M?r.features[e].id:b?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 vA(r,t,e){var o=e;return Rp(r,function(a,l,h,f,p){l===0&&e===void 0?o=a:o=t(o,a,l,h,f,p)}),o}function Ic(r,t){Rp(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(Zr.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(Zr.feature(_,a),o,d)===!1)return!1}})}function _A(r,t,e){var o=e;return Ic(r,function(a,l,h){l===0&&h===0&&e===void 0?o=a:o=t(o,a,l,h)}),o}function ry(r,t){Ic(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(ju(e,function(_,y,M,b,T){if(f===void 0||o>p||b>d||T>g){f=_,p=o,d=b,g=T,l=0;return}var x=Zr.lineString([f,_],e.properties);if(t(x,o,a,T,l)===!1)return!1;l++,f=_})===!1)return!1}}})}function xA(r,t,e){var o=e,a=!1;return ry(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 iy(r,t){if(!r)throw new Error("geojson is required");Ic(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(Zr.lineString(h[f],e.properties),o,a,f)===!1)return!1;break}}})}function EA(r,t,e){var o=e;return iy(r,function(a,l,h,f){l===0&&e===void 0?o=a:o=t(o,a,l,h,f)}),o}function MA(r,t){if(t=t||{},!Zr.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),Zr.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),Zr.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),Zr.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),Zr.lineString([p[o][a][l],p[o][a][l+1]],h,t)}throw new Error("geojson is invalid")}function SA(r,t){if(t=t||{},!Zr.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 Zr.point(p,h,t);case"MultiPoint":return o<0&&(o=p.length+o),Zr.point(p[o],h,t);case"LineString":return l<0&&(l=p.length+l),Zr.point(p[l],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Zr.point(p[a][l],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Zr.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),Zr.point(p[o][a][l],h,t)}throw new Error("geojson is invalid")}pr.coordAll=yA;pr.coordEach=ju;pr.coordReduce=dA;pr.featureEach=ny;pr.featureReduce=gA;pr.findPoint=SA;pr.findSegment=MA;pr.flattenEach=Ic;pr.flattenReduce=_A;pr.geomEach=Rp;pr.geomReduce=vA;pr.lineEach=iy;pr.lineReduce=EA;pr.propEach=ey;pr.propReduce=mA;pr.segmentEach=ry;pr.segmentReduce=xA});var oy=Ht(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});var wA=Lp();function Np(r){var t=[1/0,1/0,-1/0,-1/0];return wA.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}Np.default=Np;Op.default=Np});var Rc=Ht((jO,Dp)=>{var _o=sp(),ay=Ip(),uy=Lp(),ru=oy().default,bA=uy.featureEach,JO=uy.coordEach,KO=ay.polygon,sy=ay.featureCollection;function ly(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:ru(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:ru(a),o.push(a)}):bA(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ru(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:ru(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 sy(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 sy(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=ru(e);else if(e.type==="FeatureCollection")o=ru(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Dp.exports=ly;Dp.exports.default=ly});var Gp=Ht((aF,_y)=>{"use strict";var vy=Object.prototype.toString;_y.exports=function(t){var e=vy.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&vy.call(t.callee)==="[object Function]"),o}});var Cy=Ht((uF,Ay)=>{"use strict";var Ty;Object.keys||(el=Object.prototype.hasOwnProperty,Vp=Object.prototype.toString,xy=Gp(),Hp=Object.prototype.propertyIsEnumerable,Ey=!Hp.call({toString:null},"toString"),My=Hp.call(function(){},"prototype"),nl=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Fc=function(r){var t=r.constructor;return t&&t.prototype===r},Sy={$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},wy=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!Sy["$"+r]&&el.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Fc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),by=function(r){if(typeof window=="undefined"||!wy)return Fc(r);try{return Fc(r)}catch(t){return!1}},Ty=function(t){var e=t!==null&&typeof t=="object",o=Vp.call(t)==="[object Function]",a=xy(t),l=e&&Vp.call(t)==="[object String]",h=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var f=My&&o;if(l&&t.length>0&&!el.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")&&el.call(t,g)&&h.push(String(g));if(Ey)for(var _=by(t),y=0;y<nl.length;++y)!(_&&nl[y]==="constructor")&&el.call(t,nl[y])&&h.push(nl[y]);return h});var el,Vp,xy,Hp,Ey,My,nl,Fc,Sy,wy,by;Ay.exports=Ty});var Wp=Ht((lF,Ry)=>{"use strict";var DA=Array.prototype.slice,FA=Gp(),Py=Object.keys,Uc=Py?function(t){return Py(t)}:Cy(),Iy=Object.keys;Uc.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 FA(o)?Iy(DA.call(o)):Iy(o)})}else Object.keys=Uc;return Object.keys||Uc};Ry.exports=Uc});var qp=Ht((cF,Ly)=>{"use strict";Ly.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 Bc=Ht((hF,Ny)=>{"use strict";var UA=qp();Ny.exports=function(){return UA()&&!!Symbol.toStringTag}});var Dy=Ht((fF,Oy)=>{"use strict";Oy.exports=Error});var Uy=Ht((pF,Fy)=>{"use strict";Fy.exports=EvalError});var zy=Ht((dF,By)=>{"use strict";By.exports=RangeError});var Gy=Ht((mF,ky)=>{"use strict";ky.exports=ReferenceError});var Xp=Ht((gF,Vy)=>{"use strict";Vy.exports=SyntaxError});var ta=Ht((yF,Hy)=>{"use strict";Hy.exports=TypeError});var qy=Ht((vF,Wy)=>{"use strict";Wy.exports=URIError});var $y=Ht((_F,Yy)=>{"use strict";var Xy=typeof Symbol!="undefined"&&Symbol,BA=qp();Yy.exports=function(){return typeof Xy!="function"||typeof Symbol!="function"||typeof Xy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:BA()}});var Jy=Ht((xF,Zy)=>{"use strict";var Yp={__proto__:null,foo:{}},zA=Object;Zy.exports=function(){return{__proto__:Yp}.foo===Yp.foo&&!(Yp instanceof zA)}});var Qy=Ht((EF,jy)=>{"use strict";var kA="Function.prototype.bind called on incompatible ",GA=Object.prototype.toString,VA=Math.max,HA="[object Function]",Ky=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},WA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},qA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};jy.exports=function(t){var e=this;if(typeof e!="function"||GA.apply(e)!==HA)throw new TypeError(kA+e);for(var o=WA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,Ky(o,arguments));return Object(g)===g?g:this}return e.apply(t,Ky(o,arguments))},h=VA(0,e.length-o.length),f=[],p=0;p<h;p++)f[p]="$"+p;if(a=Function("binder","return function ("+qA(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 zc=Ht((MF,tv)=>{"use strict";var XA=Qy();tv.exports=Function.prototype.bind||XA});var nv=Ht((SF,ev)=>{"use strict";var YA=Function.prototype.call,$A=Object.prototype.hasOwnProperty,ZA=zc();ev.exports=ZA.call(YA,$A)});var uu=Ht((wF,av)=>{"use strict";var en,JA=Dy(),KA=Uy(),jA=zy(),QA=Gy(),au=Xp(),su=ta(),tC=qy(),sv=Function,$p=function(r){try{return sv('"use strict"; return ('+r+").constructor;")()}catch(t){}},ea=Object.getOwnPropertyDescriptor;if(ea)try{ea({},"")}catch(r){ea=null}var Zp=function(){throw new su},eC=ea?function(){try{return arguments.callee,Zp}catch(r){try{return ea(arguments,"callee").get}catch(t){return Zp}}}():Zp,iu=$y()(),nC=Jy()(),Ar=Object.getPrototypeOf||(nC?function(r){return r.__proto__}:null),ou={},rC=typeof Uint8Array=="undefined"||!Ar?en:Ar(Uint8Array),na={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?en:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?en:ArrayBuffer,"%ArrayIteratorPrototype%":iu&&Ar?Ar([][Symbol.iterator]()):en,"%AsyncFromSyncIteratorPrototype%":en,"%AsyncFunction%":ou,"%AsyncGenerator%":ou,"%AsyncGeneratorFunction%":ou,"%AsyncIteratorPrototype%":ou,"%Atomics%":typeof Atomics=="undefined"?en:Atomics,"%BigInt%":typeof BigInt=="undefined"?en:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?en:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?en:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?en:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":JA,"%eval%":eval,"%EvalError%":KA,"%Float32Array%":typeof Float32Array=="undefined"?en:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?en:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?en:FinalizationRegistry,"%Function%":sv,"%GeneratorFunction%":ou,"%Int8Array%":typeof Int8Array=="undefined"?en:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?en:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?en:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":iu&&Ar?Ar(Ar([][Symbol.iterator]())):en,"%JSON%":typeof JSON=="object"?JSON:en,"%Map%":typeof Map=="undefined"?en:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!iu||!Ar?en:Ar(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?en:Promise,"%Proxy%":typeof Proxy=="undefined"?en:Proxy,"%RangeError%":jA,"%ReferenceError%":QA,"%Reflect%":typeof Reflect=="undefined"?en:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?en:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!iu||!Ar?en:Ar(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?en:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":iu&&Ar?Ar(""[Symbol.iterator]()):en,"%Symbol%":iu?Symbol:en,"%SyntaxError%":au,"%ThrowTypeError%":eC,"%TypedArray%":rC,"%TypeError%":su,"%Uint8Array%":typeof Uint8Array=="undefined"?en:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?en:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?en:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?en:Uint32Array,"%URIError%":tC,"%WeakMap%":typeof WeakMap=="undefined"?en:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?en:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?en:WeakSet};if(Ar)try{null.error}catch(r){rv=Ar(Ar(r)),na["%Error.prototype%"]=rv}var rv,iC=function r(t){var e;if(t==="%AsyncFunction%")e=$p("async function () {}");else if(t==="%GeneratorFunction%")e=$p("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=$p("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&Ar&&(e=Ar(a.prototype))}return na[t]=e,e},iv={__proto__:null,"%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"]},rl=zc(),kc=nv(),oC=rl.call(Function.call,Array.prototype.concat),sC=rl.call(Function.apply,Array.prototype.splice),ov=rl.call(Function.call,String.prototype.replace),Gc=rl.call(Function.call,String.prototype.slice),aC=rl.call(Function.call,RegExp.prototype.exec),uC=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,lC=/\\\\(\\\\)?/g,cC=function(t){var e=Gc(t,0,1),o=Gc(t,-1);if(e==="%"&&o!=="%")throw new au("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new au("invalid intrinsic syntax, expected opening \`%\`");var a=[];return ov(t,uC,function(l,h,f,p){a[a.length]=f?ov(p,lC,"$1"):h||l}),a},hC=function(t,e){var o=t,a;if(kc(iv,o)&&(a=iv[o],o="%"+a[0]+"%"),kc(na,o)){var l=na[o];if(l===ou&&(l=iC(o)),typeof l=="undefined"&&!e)throw new su("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new au("intrinsic "+t+" does not exist!")};av.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new su("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new su('"allowMissing" argument must be a boolean');if(aC(/^%?[^%]*%?$/,t)===null)throw new au("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=cC(t),a=o.length>0?o[0]:"",l=hC("%"+a+"%",e),h=l.name,f=l.value,p=!1,d=l.alias;d&&(a=d[0],sC(o,oC([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Gc(y,0,1),b=Gc(y,-1);if((M==='"'||M==="'"||M==="\`"||b==='"'||b==="'"||b==="\`")&&M!==b)throw new au("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,h="%"+a+"%",kc(na,h))f=na[h];else if(f!=null){if(!(y in f)){if(!e)throw new su("base intrinsic for "+t+" exists, but the property is not available.");return}if(ea&&g+1>=o.length){var T=ea(f,y);_=!!T,_&&"get"in T&&!("originalValue"in T.get)?f=T.get:f=f[y]}else _=kc(f,y),f=f[y];_&&!p&&(na[h]=f)}}return f}});var Hc=Ht((bF,uv)=>{"use strict";var fC=uu(),Vc=fC("%Object.defineProperty%",!0)||!1;if(Vc)try{Vc({},"a",{value:1})}catch(r){Vc=!1}uv.exports=Vc});var Jp=Ht((TF,lv)=>{"use strict";var pC=uu(),Wc=pC("%Object.getOwnPropertyDescriptor%",!0);if(Wc)try{Wc([],"length")}catch(r){Wc=null}lv.exports=Wc});var qc=Ht((AF,fv)=>{"use strict";var cv=Hc(),dC=Xp(),lu=ta(),hv=Jp();fv.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new lu("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new lu("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new lu("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new lu("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new lu("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new lu("\`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=!!hv&&hv(t,e);if(cv)cv(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 dC("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Xc=Ht((CF,dv)=>{"use strict";var Kp=Hc(),pv=function(){return!!Kp};pv.hasArrayLengthDefineBug=function(){if(!Kp)return null;try{return Kp([],"length",{value:1}).length!==1}catch(t){return!0}};dv.exports=pv});var _v=Ht((PF,vv)=>{"use strict";var mC=uu(),mv=qc(),gC=Xc()(),gv=Jp(),yv=ta(),yC=mC("%Math.floor%");vv.exports=function(t,e){if(typeof t!="function")throw new yv("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||yC(e)!==e)throw new yv("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&gv){var h=gv(t,"length");h&&!h.configurable&&(a=!1),h&&!h.writable&&(l=!1)}return(a||l||!o)&&(gC?mv(t,"length",e,!0,!0):mv(t,"length",e)),t}});var Zc=Ht((IF,Yc)=>{"use strict";var jp=zc(),$c=uu(),vC=_v(),_C=ta(),Mv=$c("%Function.prototype.apply%"),Sv=$c("%Function.prototype.call%"),wv=$c("%Reflect.apply%",!0)||jp.call(Sv,Mv),xv=Hc(),xC=$c("%Math.max%");Yc.exports=function(t){if(typeof t!="function")throw new _C("a function is required");var e=wv(jp,Sv,arguments);return vC(e,1+xC(0,t.length-(arguments.length-1)),!0)};var Ev=function(){return wv(jp,Mv,arguments)};xv?xv(Yc.exports,"apply",{value:Ev}):Yc.exports.apply=Ev});var Qp=Ht((RF,Av)=>{"use strict";var bv=uu(),Tv=Zc(),EC=Tv(bv("String.prototype.indexOf"));Av.exports=function(t,e){var o=bv(t,!!e);return typeof o=="function"&&EC(t,".prototype.")>-1?Tv(o):o}});var Iv=Ht((LF,Pv)=>{"use strict";var MC=Bc()(),SC=Qp(),td=SC("Object.prototype.toString"),Jc=function(t){return MC&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:td(t)==="[object Arguments]"},Cv=function(t){return Jc(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&td(t)!=="[object Array]"&&td(t.callee)==="[object Function]"},wC=function(){return Jc(arguments)}();Jc.isLegacyArguments=Cv;Pv.exports=wC?Jc:Cv});var cu=Ht((NF,Ov)=>{"use strict";var bC=Wp(),TC=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",AC=Object.prototype.toString,CC=Array.prototype.concat,Rv=qc(),PC=function(r){return typeof r=="function"&&AC.call(r)==="[object Function]"},Lv=Xc()(),IC=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!PC(o)||!o())return}Lv?Rv(r,t,e,!0):Rv(r,t,e)},Nv=function(r,t){var e=arguments.length>2?arguments[2]:{},o=bC(t);TC&&(o=CC.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)IC(r,o[a],t[o[a]],e[o[a]])};Nv.supportsDescriptors=!!Lv;Ov.exports=Nv});var ed=Ht((OF,Fv)=>{"use strict";var Dv=function(r){return r!==r};Fv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Dv(t)&&Dv(e))}});var nd=Ht((DF,Uv)=>{"use strict";var RC=ed();Uv.exports=function(){return typeof Object.is=="function"?Object.is:RC}});var zv=Ht((FF,Bv)=>{"use strict";var LC=nd(),NC=cu();Bv.exports=function(){var t=LC();return NC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Hv=Ht((UF,Vv)=>{"use strict";var OC=cu(),DC=Zc(),FC=ed(),kv=nd(),UC=zv(),Gv=DC(kv(),Object);OC(Gv,{getPolyfill:kv,implementation:FC,shim:UC});Vv.exports=Gv});var $v=Ht((BF,Yv)=>{"use strict";var rd=Qp(),Wv=Bc()(),qv,Xv,id,od;Wv&&(qv=rd("Object.prototype.hasOwnProperty"),Xv=rd("RegExp.prototype.exec"),id={},Kc=function(){throw id},od={toString:Kc,valueOf:Kc},typeof Symbol.toPrimitive=="symbol"&&(od[Symbol.toPrimitive]=Kc));var Kc,BC=rd("Object.prototype.toString"),zC=Object.getOwnPropertyDescriptor,kC="[object RegExp]";Yv.exports=Wv?function(t){if(!t||typeof t!="object")return!1;var e=zC(t,"lastIndex"),o=e&&qv(e,"value");if(!o)return!1;try{Xv(t,od)}catch(a){return a===id}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:BC(t)===kC}});var Jv=Ht((zF,Zv)=>{"use strict";var ol=function(){return typeof function(){}.name=="string"},il=Object.getOwnPropertyDescriptor;if(il)try{il([],"length")}catch(r){il=null}ol.functionsHaveConfigurableNames=function(){if(!ol()||!il)return!1;var t=il(function(){},"name");return!!t&&!!t.configurable};var GC=Function.prototype.bind;ol.boundFunctionsHaveNames=function(){return ol()&&typeof GC=="function"&&function(){}.bind().name!==""};Zv.exports=ol});var Qv=Ht((kF,jv)=>{"use strict";var Kv=qc(),VC=Xc()(),HC=Jv().functionsHaveConfigurableNames(),WC=ta();jv.exports=function(t,e){if(typeof t!="function")throw new WC("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||HC)&&(VC?Kv(t,"name",e,!0,!0):Kv(t,"name",e)),t}});var sd=Ht((GF,t_)=>{"use strict";var qC=Qv(),XC=ta(),YC=Object;t_.exports=qC(function(){if(this==null||this!==YC(this))throw new XC("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 ad=Ht((VF,e_)=>{"use strict";var $C=sd(),ZC=cu().supportsDescriptors,JC=Object.getOwnPropertyDescriptor;e_.exports=function(){if(ZC&&/a/mig.flags==="gim"){var t=JC(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),t.get.call(o),e==="dy")return t.get}}return $C}});var i_=Ht((HF,r_)=>{"use strict";var KC=cu().supportsDescriptors,jC=ad(),QC=Object.getOwnPropertyDescriptor,tP=Object.defineProperty,eP=TypeError,n_=Object.getPrototypeOf,nP=/a/;r_.exports=function(){if(!KC||!n_)throw new eP("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=jC(),e=n_(nP),o=QC(e,"flags");return(!o||o.get!==t)&&tP(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var u_=Ht((WF,a_)=>{"use strict";var rP=cu(),iP=Zc(),oP=sd(),o_=ad(),sP=i_(),s_=iP(o_());rP(s_,{getPolyfill:o_,implementation:oP,shim:sP});a_.exports=s_});var c_=Ht((qF,l_)=>{"use strict";var aP=Date.prototype.getDay,uP=function(t){try{return aP.call(t),!0}catch(e){return!1}},lP=Object.prototype.toString,cP="[object Date]",hP=Bc()();l_.exports=function(t){return typeof t!="object"||t===null?!1:hP?uP(t):lP.call(t)===cP}});var ud=Ht((XF,E_)=>{var h_=Wp(),f_=Iv(),p_=Hv(),d_=$v(),m_=u_(),g_=c_(),y_=Date.prototype.getTime;function x_(r,t,e){var o=e||{};return(o.strict?p_(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?p_(r,t):r==t:fP(r,t,o)}function v_(r){return r==null}function __(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 fP(r,t,e){var o,a;if(typeof r!=typeof t||v_(r)||v_(t)||r.prototype!==t.prototype||f_(r)!==f_(t))return!1;var l=d_(r),h=d_(t);if(l!==h)return!1;if(l||h)return r.source===t.source&&m_(r)===m_(t);if(g_(r)&&g_(t))return y_.call(r)===y_.call(t);var f=__(r),p=__(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=h_(r),g=h_(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],!x_(r[a],t[a],e))return!1;return!0}E_.exports=x_});var xd=Ht((jB,C_)=>{var nI=ud(),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:rI};xo.prototype.compare=function(r,t){if(r.type!==t.type||!A_(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=T_(r),a=T_(t);return o.every(function(l){return this.some(function(h){return e.compare(l,h)})},a)}}return!1};function T_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function A_(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(!A_(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 rI(r,t){return nI(r,t,{strict:!0})}C_.exports=xo});var P_=Ht((cz,th)=>{function ws(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)}ws.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};ws.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)};ws.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)}};ws.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};ws.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};ws.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};ws.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 th!="undefined"&&th.exports&&(th.exports=ws)});var I_=Ht((hz,eh)=>{function bs(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}bs.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)};bs.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()};bs.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};bs.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};bs.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};bs.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};bs.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 eh!="undefined"&&eh.exports&&(eh.exports=bs)});var Ed=Ht((fz,nh)=>{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 nh!="undefined"&&nh.exports&&(nh.exports=Eo)});var L_=Ht((pz,fu)=>{typeof fu!="undefined"&&fu.exports&&(R_=Ed());var R_;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 R_(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 fu!="undefined"&&fu.exports&&(fu.exports=jo)});var N_=Ht((dz,rh)=>{typeof rh!="undefined"&&rh.exports&&(rh.exports={DBSCAN:P_(),KMEANS:I_(),OPTICS:L_(),PriorityQueue:Ed()})});var Md=Ht((xz,D_)=>{"use strict";D_.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 B_=Ht((Ez,U_)=>{"use strict";var F_=Md(),lI=F_.eudist,cI=F_.dist;U_.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?lI:cI,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=[],b=0;b<l;b++){for(var T=1/0,x=0;x<_;x++){var v=o(t[b],a[x]);v<=T&&(T=v)}g[b]=T}for(var P=0;P<l;P++)y+=g[P];for(var S=0;S<l;S++)M[S]={i:S,v:t[S],pr:g[S]/y,cs:0};M.sort(function(B,I){return B.pr-I.pr}),M[0].cs=M[0].pr;for(var L=1;L<l;L++)M[L].cs=M[L-1].cs+M[L].pr;for(var N=Math.random(),G=0;G<l-1&&M[G++].cs<N;);a.push(M[G-1].v)}return a}}});var H_=Ht((wz,V_)=>{"use strict";var Sd=Md(),G_=B_(),hI=Sd.eudist,Mz=Sd.mandist,Sz=Sd.dist,fI=G_.kmrand,pI=G_.kmpp,z_=1e4;function k_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function dI(r,t,e,o){var a=[],l=[],h=[],f=[],p=!1,d=o||z_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=fI(r,t):e=="kmpp"?a=pI(r,t):a=e;else for(var b={};a.length<t;){var T=Math.floor(Math.random()*g);b[T]||(b[T]=!0,a.push(r[T]))}do{k_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,P=0,S=0;S<t;S++){var f=y?hI(r[x],a[S]):Math.abs(r[x]-a[S]);f<=v&&(v=f,P=S)}h[x]=P,M[P]++}for(var L=[],l=[],N=0,G=0;G<t;G++)L[G]=y?k_(_,0,L[G]):0,l[G]=a[G];if(y){for(var B=0;B<t;B++)a[B]=[];for(var I=0;I<g;I++)for(var O=h[I],q=L[O],st=r[I],V=0;V<_;V++)q[V]+=st[V];p=!0;for(var Mt=0;Mt<t;Mt++){for(var $=a[Mt],ut=L[Mt],xt=l[Mt],mt=M[Mt],lt=0;lt<_;lt++)$[lt]=ut[lt]/mt||0;if(p){for(var ht=0;ht<_;ht++)if(xt[ht]!=$[ht]){p=!1;break}}}}else{for(var k=0;k<g;k++){var nt=h[k];L[nt]+=r[k]}for(var ft=0;ft<t;ft++)a[ft]=L[ft]/M[ft]||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:z_-d,k:t,idxs:h,centroids:a}}V_.exports=dI});var yu=Ht((Pd,Id)=>{(function(r,t){typeof Pd=="object"&&typeof Id!="undefined"?Id.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Pd,function(){"use strict";function r(Y,w){var C={label:0,sent:function(){if(z[0]&1)throw z[1];return z[1]},trys:[],ops:[]},R,H,z,rt;return rt={next:j(0),throw:j(1),return:j(2)},typeof Symbol=="function"&&(rt[Symbol.iterator]=function(){return this}),rt;function j(tt){return function(Z){return D([tt,Z])}}function D(tt){if(R)throw new TypeError("Generator is already executing.");for(;C;)try{if(R=1,H&&(z=tt[0]&2?H.return:tt[0]?H.throw||((z=H.return)&&z.call(H),0):H.next)&&!(z=z.call(H,tt[1])).done)return z;switch(H=0,z&&(tt=[tt[0]&2,z.value]),tt[0]){case 0:case 1:z=tt;break;case 4:return C.label++,{value:tt[1],done:!1};case 5:C.label++,H=tt[1],tt=[0];continue;case 7:tt=C.ops.pop(),C.trys.pop();continue;default:if(z=C.trys,!(z=z.length>0&&z[z.length-1])&&(tt[0]===6||tt[0]===2)){C=0;continue}if(tt[0]===3&&(!z||tt[1]>z[0]&&tt[1]<z[3])){C.label=tt[1];break}if(tt[0]===6&&C.label<z[1]){C.label=z[1],z=tt;break}if(z&&C.label<z[2]){C.label=z[2],C.ops.push(tt);break}z[2]&&C.ops.pop(),C.trys.pop();continue}tt=w.call(Y,C)}catch(Z){tt=[6,Z],H=0}finally{R=z=0}if(tt[0]&5)throw tt[1];return{value:tt[0]?tt[1]:void 0,done:!0}}}var t=function(){function Y(w,C){this.next=null,this.key=w,this.data=C,this.left=null,this.right=null}return Y}();function e(Y,w){return Y>w?1:Y<w?-1:0}function o(Y,w,C){for(var R=new t(null,null),H=R,z=R;;){var rt=C(Y,w.key);if(rt<0){if(w.left===null)break;if(C(Y,w.left.key)<0){var j=w.left;if(w.left=j.right,j.right=w,w=j,w.left===null)break}z.left=w,z=w,w=w.left}else if(rt>0){if(w.right===null)break;if(C(Y,w.right.key)>0){var j=w.right;if(w.right=j.left,j.left=w,w=j,w.right===null)break}H.right=w,H=w,w=w.right}else break}return H.right=w.left,z.left=w.right,w.left=R.right,w.right=R.left,w}function a(Y,w,C,R){var H=new t(Y,w);if(C===null)return H.left=H.right=null,H;C=o(Y,C,R);var z=R(Y,C.key);return z<0?(H.left=C.left,H.right=C,C.left=null):z>=0&&(H.right=C.right,H.left=C,C.right=null),H}function l(Y,w,C){var R=null,H=null;if(w){w=o(Y,w,C);var z=C(w.key,Y);z===0?(R=w.left,H=w.right):z<0?(H=w.right,w.right=null,R=w):(R=w.left,w.left=null,H=w)}return{left:R,right:H}}function h(Y,w,C){return w===null?Y:(Y===null||(w=o(Y.key,w,C),w.left=Y),w)}function f(Y,w,C,R,H){if(Y){R(""+w+(C?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+H(Y)+\`
|
|
3705
|
+
\`)};function Hp(r,t,e){this.x=r,this.y=t,this.weight=e}Hp.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Hp.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};Hp.prototype.isWall=function(){return this.weight===0};function TM(r){this.content=[],this.scoreFunction=r}TM.prototype={push:function(r){this.content.push(r),this.sinkDown(this.content.length-1)},pop:function(){var r=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),r},remove:function(r){var t=this.content.indexOf(r),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(r)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(r){this.sinkDown(this.content.indexOf(r))},sinkDown:function(r){for(var t=this.content[r];r>0;){var e=(r+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[r]=o,r=e;else break}},bubbleUp:function(r){for(var t=this.content.length,e=this.content[r],o=this.scoreFunction(e);;){var a=r+1<<1,c=a-1,p=null,d;if(c<t){var g=this.content[c];d=this.scoreFunction(g),d<o&&(p=c)}if(a<t){var y=this.content[a],_=this.scoreFunction(y);_<(p===null?o:d)&&(p=a)}if(p!==null)this.content[r]=this.content[p],this.content[p]=e,r=p;else break}}};function V0(){this._=null}function Ec(r){r.U=r.C=r.L=r.R=r.P=r.N=null}V0.prototype={constructor:V0,insert:function(r,t){var e,o,a;if(r){if(t.P=r,t.N=r.N,r.N&&(r.N.P=t),r.N=t,r.R){for(r=r.R;r.L;)r=r.L;r.L=t}else r.R=t;e=r}else this._?(r=AM(this._),t.P=null,t.N=r,r.P=r.L=t,e=r):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,r=t;e&&e.C;)o=e.U,e===o.L?(a=o.R,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.R&&(Sf(this,e),r=e,e=r.U),e.C=!1,o.C=!0,bf(this,o))):(a=o.L,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.L&&(bf(this,e),r=e,e=r.U),e.C=!1,o.C=!0,Sf(this,o))),e=r.U;this._.C=!1},remove:function(r){r.N&&(r.N.P=r.P),r.P&&(r.P.N=r.N),r.N=r.P=null;var t=r.U,e,o=r.L,a=r.R,c,p;if(o?a?c=AM(a):c=o:c=a,t?t.L===r?t.L=c:t.R=c:this._=c,o&&a?(p=c.C,c.C=r.C,c.L=o,o.U=c,c!==a?(t=c.U,c.U=r.U,r=c.R,t.L=r,c.R=a,a.U=c):(c.U=t,t=c,r=c.R)):(p=r.C,r=c),r&&(r.U=t),!p){if(r&&r.C){r.C=!1;return}do{if(r===this._)break;if(r===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Sf(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,bf(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Sf(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,bf(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Sf(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,bf(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function Sf(r,t){var e=t,o=t.R,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function bf(r,t){var e=t,o=t.L,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function AM(r){for(;r.L;)r=r.L;return r}var W0=V0;function wc(r,t,e,o){var a=[null,null],c=Fi.push(a)-1;return a.left=r,a.right=t,e&&Tf(a,r,t,e),o&&Tf(a,t,r,o),wo[r.index].halfedges.push(c),wo[t.index].halfedges.push(c),a}function Mc(r,t,e){var o=[t,e];return o.left=r,o}function Tf(r,t,e,o){!r[0]&&!r[1]?(r[0]=o,r.left=t,r.right=e):r.left===e?r[1]=o:r[0]=o}function vB(r,t,e,o,a){var c=r[0],p=r[1],d=c[0],g=c[1],y=p[0],_=p[1],w=0,x=1,b=y-d,P=_-g,I;if(I=t-d,!(!b&&I>0)){if(I/=b,b<0){if(I<w)return;I<x&&(x=I)}else if(b>0){if(I>x)return;I>w&&(w=I)}if(I=o-d,!(!b&&I<0)){if(I/=b,b<0){if(I>x)return;I>w&&(w=I)}else if(b>0){if(I<w)return;I<x&&(x=I)}if(I=e-g,!(!P&&I>0)){if(I/=P,P<0){if(I<w)return;I<x&&(x=I)}else if(P>0){if(I>x)return;I>w&&(w=I)}if(I=a-g,!(!P&&I<0)){if(I/=P,P<0){if(I>x)return;I>w&&(w=I)}else if(P>0){if(I<w)return;I<x&&(x=I)}return!(w>0)&&!(x<1)||(w>0&&(r[0]=[d+w*b,g+w*P]),x<1&&(r[1]=[d+x*b,g+x*P])),!0}}}}}function _B(r,t,e,o,a){var c=r[1];if(c)return!0;var p=r[0],d=r.left,g=r.right,y=d[0],_=d[1],w=g[0],x=g[1],b=(y+w)/2,P=(_+x)/2,I,M;if(x===_){if(b<t||b>=o)return;if(y>w){if(!p)p=[b,e];else if(p[1]>=a)return;c=[b,a]}else{if(!p)p=[b,a];else if(p[1]<e)return;c=[b,e]}}else if(I=(y-w)/(x-_),M=P-I*b,I<-1||I>1)if(y>w){if(!p)p=[(e-M)/I,e];else if(p[1]>=a)return;c=[(a-M)/I,a]}else{if(!p)p=[(a-M)/I,a];else if(p[1]<e)return;c=[(e-M)/I,e]}else if(_<x){if(!p)p=[t,I*t+M];else if(p[0]>=o)return;c=[o,I*o+M]}else{if(!p)p=[o,I*o+M];else if(p[0]<t)return;c=[t,I*t+M]}return r[0]=p,r[1]=c,!0}function CM(r,t,e,o){for(var a=Fi.length,c;a--;)(!_B(c=Fi[a],r,t,e,o)||!vB(c,r,t,e,o)||!(Math.abs(c[0][0]-c[1][0])>vr||Math.abs(c[0][1]-c[1][1])>vr))&&delete Fi[a]}function PM(r){return wo[r.index]={site:r,halfedges:[]}}function xB(r,t){var e=r.site,o=t.left,a=t.right;return e===a&&(a=o,o=e),a?Math.atan2(a[1]-o[1],a[0]-o[0]):(e===o?(o=t[1],a=t[0]):(o=t[0],a=t[1]),Math.atan2(o[0]-a[0],a[1]-o[1]))}function q0(r,t){return t[+(t.left!==r.site)]}function EB(r,t){return t[+(t.left===r.site)]}function IM(){for(var r=0,t=wo.length,e,o,a,c;r<t;++r)if((e=wo[r])&&(c=(o=e.halfedges).length)){var p=new Array(c),d=new Array(c);for(a=0;a<c;++a)p[a]=a,d[a]=xB(e,Fi[o[a]]);for(p.sort(function(g,y){return d[y]-d[g]}),a=0;a<c;++a)d[a]=o[p[a]];for(a=0;a<c;++a)o[a]=d[a]}}function RM(r,t,e,o){var a=wo.length,c,p,d,g,y,_,w,x,b,P,I,M,E=!0;for(c=0;c<a;++c)if(p=wo[c]){for(d=p.site,y=p.halfedges,g=y.length;g--;)Fi[y[g]]||y.splice(g,1);for(g=0,_=y.length;g<_;)P=EB(p,Fi[y[g]]),I=P[0],M=P[1],w=q0(p,Fi[y[++g%_]]),x=w[0],b=w[1],(Math.abs(I-x)>vr||Math.abs(M-b)>vr)&&(y.splice(g,0,Fi.push(Mc(d,P,Math.abs(I-r)<vr&&o-M>vr?[r,Math.abs(x-r)<vr?b:o]:Math.abs(M-o)<vr&&e-I>vr?[Math.abs(b-o)<vr?x:e,o]:Math.abs(I-e)<vr&&M-t>vr?[e,Math.abs(x-e)<vr?b:t]:Math.abs(M-t)<vr&&I-r>vr?[Math.abs(b-t)<vr?x:r,t]:null))-1),++_);_&&(E=!1)}if(E){var N,A,U,z=1/0;for(c=0,E=null;c<a;++c)(p=wo[c])&&(d=p.site,N=d[0]-r,A=d[1]-t,U=N*N+A*A,U<z&&(z=U,E=p));if(E){var $=[r,t],q=[r,o],D=[e,o],G=[e,t];E.halfedges.push(Fi.push(Mc(d=E.site,$,q))-1,Fi.push(Mc(d,q,D))-1,Fi.push(Mc(d,D,G))-1,Fi.push(Mc(d,G,$))-1)}}for(c=0;c<a;++c)(p=wo[c])&&(p.halfedges.length||delete wo[c])}var LM=[],Vp;function wB(){Ec(this),this.x=this.y=this.arc=this.site=this.cy=null}function fl(r){var t=r.P,e=r.N;if(!(!t||!e)){var o=t.site,a=r.site,c=e.site;if(o!==c){var p=a[0],d=a[1],g=o[0]-p,y=o[1]-d,_=c[0]-p,w=c[1]-d,x=2*(g*w-y*_);if(!(x>=-NM)){var b=g*g+y*y,P=_*_+w*w,I=(w*b-y*P)/x,M=(g*P-_*b)/x,E=LM.pop()||new wB;E.arc=r,E.site=a,E.x=I+p,E.y=(E.cy=M+d)+Math.sqrt(I*I+M*M),r.circle=E;for(var N=null,A=Sc._;A;)if(E.y<A.y||E.y===A.y&&E.x<=A.x)if(A.L)A=A.L;else{N=A.P;break}else if(A.R)A=A.R;else{N=A;break}Sc.insert(N,E),N||(Vp=E)}}}}function hl(r){var t=r.circle;t&&(t.P||(Vp=t.N),Sc.remove(t),LM.push(t),Ec(t),r.circle=null)}var DM=[];function MB(){Ec(this),this.edge=this.site=this.circle=null}function OM(r){var t=DM.pop()||new MB;return t.site=r,t}function X0(r){hl(r),pl.remove(r),DM.push(r),Ec(r)}function FM(r){var t=r.circle,e=t.x,o=t.cy,a=[e,o],c=r.P,p=r.N,d=[r];X0(r);for(var g=c;g.circle&&Math.abs(e-g.circle.x)<vr&&Math.abs(o-g.circle.cy)<vr;)c=g.P,d.unshift(g),X0(g),g=c;d.unshift(g),hl(g);for(var y=p;y.circle&&Math.abs(e-y.circle.x)<vr&&Math.abs(o-y.circle.cy)<vr;)p=y.N,d.push(y),X0(y),y=p;d.push(y),hl(y);var _=d.length,w;for(w=1;w<_;++w)y=d[w],g=d[w-1],Tf(y.edge,g.site,y.site,a);g=d[0],y=d[_-1],y.edge=wc(g.site,y.site,null,a),fl(g),fl(y)}function UM(r){for(var t=r[0],e=r[1],o,a,c,p,d=pl._;d;)if(c=BM(d,e)-t,c>vr)d=d.L;else if(p=t-SB(d,e),p>vr){if(!d.R){o=d;break}d=d.R}else{c>-vr?(o=d.P,a=d):p>-vr?(o=d,a=d.N):o=a=d;break}PM(r);var g=OM(r);if(pl.insert(o,g),!(!o&&!a)){if(o===a){hl(o),a=OM(o.site),pl.insert(g,a),g.edge=a.edge=wc(o.site,g.site),fl(o),fl(a);return}if(!a){g.edge=wc(o.site,g.site);return}hl(o),hl(a);var y=o.site,_=y[0],w=y[1],x=r[0]-_,b=r[1]-w,P=a.site,I=P[0]-_,M=P[1]-w,E=2*(x*M-b*I),N=x*x+b*b,A=I*I+M*M,U=[(M*N-b*A)/E+_,(x*A-I*N)/E+w];Tf(a.edge,y,P,U),g.edge=wc(y,r,null,U),a.edge=wc(r,P,null,U),fl(o),fl(a)}}function BM(r,t){var e=r.site,o=e[0],a=e[1],c=a-t;if(!c)return o;var p=r.P;if(!p)return-1/0;e=p.site;var d=e[0],g=e[1],y=g-t;if(!y)return d;var _=d-o,w=1/c-1/y,x=_/y;return w?(-x+Math.sqrt(x*x-2*w*(_*_/(-2*y)-g+y/2+a-c/2)))/w+o:(o+d)/2}function SB(r,t){var e=r.N;if(e)return BM(e,t);var o=r.site;return o[1]===t?o[0]:1/0}var vr=1e-6,NM=1e-12,pl,wo,Sc,Fi;function bB(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function TB(r,t){return t[1]-r[1]||t[0]-r[0]}function Wp(r,t){var e=r.sort(TB).pop(),o,a,c;for(Fi=[],wo=new Array(r.length),pl=new W0,Sc=new W0;;)if(c=Vp,e&&(!c||e[1]<c.y||e[1]===c.y&&e[0]<c.x))(e[0]!==o||e[1]!==a)&&(UM(e),o=e[0],a=e[1]),e=r.pop();else if(c)FM(c.arc);else break;if(IM(),t){var p=+t[0][0],d=+t[0][1],g=+t[1][0],y=+t[1][1];CM(p,d,g,y),RM(p,d,g,y)}this.edges=Fi,this.cells=wo,pl=Sc=Fi=wo=null}Wp.prototype={constructor:Wp,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return q0(t,r[o])});return e.data=t.site.data,e})},triangles:function(){var r=[],t=this.edges;return this.cells.forEach(function(e,o){if(d=(c=e.halfedges).length)for(var a=e.site,c,p=-1,d,g,y=t[c[d-1]],_=y.left===a?y.right:y.left;++p<d;)g=_,y=t[c[p]],_=y.left===a?y.right:y.left,g&&_&&o<g.index&&o<_.index&&bB(a,g,_)<0&&r.push([a.data,g.data,_.data])}),r},links:function(){return this.edges.filter(function(r){return r.right}).map(function(r){return{source:r.left.data,target:r.right.data}})},find:function(r,t,e){for(var o=this,a,c=o._found||0,p=o.cells.length,d;!(d=o.cells[c]);)if(++c>=p)return null;var g=r-d.site[0],y=t-d.site[1],_=g*g+y*y;do d=o.cells[a=c],c=null,d.halfedges.forEach(function(w){var x=o.edges[w],b=x.left;if(!((b===d.site||!b)&&!(b=x.right))){var P=r-b[0],I=t-b[1],M=P*P+I*I;M<_&&(_=M,c=b.index)}});while(c!==null);return o._found=a,e==null||_<=e*e?d.site:null}};var OB=Nr(bc(),1);var ay=Nr(HM(),1);function Wo(){return new Yp}function Yp(){this.reset()}Yp.prototype={constructor:Yp,reset:function(){this.s=this.t=0},add:function(r){VM(Xp,r,this.t),VM(this,Xp.s,this.s),this.s?this.t+=Xp.t:this.s=Xp.t},valueOf:function(){return this.s}};var Xp=new Yp;function VM(r,t,e){var o=r.s=t+e,a=o-t,c=o-a;r.t=t-c+(e-a)}var Kn=1e-6;var fr=Math.PI,xi=fr/2,$p=fr/4,ya=fr*2,dl=180/fr,qo=fr/180,Zr=Math.abs,Ys=Math.atan,Xo=Math.atan2,Gn=Math.cos;var Zp=Math.exp;var Af=Math.log;var Qe=Math.sin;var Ji=Math.sqrt,Cf=Math.tan;function Z0(r){return r>1?0:r<-1?fr:Math.acos(r)}function Mo(r){return r>1?xi:r<-1?-xi:Math.asin(r)}function $s(){}var DB=Wo(),wX=Wo();function gl(r){var t=r[0],e=r[1],o=Gn(e);return[o*Gn(t),o*Qe(t),Qe(e)]}function Pf(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function If(r){var t=Ji(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var LX=Wo();function qM(r,t){return[r>fr?r-ya:r<-fr?r+ya:r,t]}qM.invert=qM;function J0(){var r=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){r.push(t=[])},lineEnd:$s,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function K0(r,t){return Zr(r[0]-t[0])<Kn&&Zr(r[1]-t[1])<Kn}function Jp(r,t,e,o){this.x=r,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function Q0(r,t,e,o,a){var c=[],p=[],d,g;if(r.forEach(function(P){if(!((I=P.length-1)<=0)){var I,M=P[0],E=P[I],N;if(K0(M,E)){for(a.lineStart(),d=0;d<I;++d)a.point((M=P[d])[0],M[1]);a.lineEnd();return}c.push(N=new Jp(M,P,null,!0)),p.push(N.o=new Jp(M,null,N,!1)),c.push(N=new Jp(E,P,null,!1)),p.push(N.o=new Jp(E,null,N,!0))}}),!!c.length){for(p.sort(t),XM(c),XM(p),d=0,g=p.length;d<g;++d)p[d].e=e=!e;for(var y=c[0],_,w;;){for(var x=y,b=!0;x.v;)if((x=x.n)===y)return;_=x.z,a.lineStart();do{if(x.v=x.o.v=!0,x.e){if(b)for(d=0,g=_.length;d<g;++d)a.point((w=_[d])[0],w[1]);else o(x.x,x.n.x,1,a);x=x.n}else{if(b)for(_=x.p.z,d=_.length-1;d>=0;--d)a.point((w=_[d])[0],w[1]);else o(x.x,x.p.x,-1,a);x=x.p}x=x.o,_=x.z,b=!b}while(!x.v);a.lineEnd()}}}function XM(r){if(t=r.length){for(var t,e=0,o=r[0],a;++e<t;)o.n=a=r[e],a.p=o,o=a;o.n=a=r[0],a.p=o}}function Ru(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function j0(r){return r.length===1&&(r=BB(r)),{left:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var c=o+a>>>1;r(t[c],e)<0?o=c+1:a=c}return o},right:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var c=o+a>>>1;r(t[c],e)>0?a=c:o=c+1}return o}}}function BB(r){return function(t,e){return Ru(r(t),e)}}var YM=j0(Ru),zB=YM.right,GB=YM.left;var $M=Array.prototype,HB=$M.slice,VB=$M.map;var S7=Math.sqrt(50),b7=Math.sqrt(10),T7=Math.sqrt(2);function Qp(r){for(var t=r.length,e,o=-1,a=0,c,p;++o<t;)a+=r[o].length;for(c=new Array(a);--t>=0;)for(p=r[t],e=p.length;--e>=0;)c[--a]=p[e];return c}var KB=1e9,l$=-KB;var ty=Wo();function ey(r,t){var e=t[0],o=t[1],a=[Qe(e),-Gn(e),0],c=0,p=0;ty.reset();for(var d=0,g=r.length;d<g;++d)if(_=(y=r[d]).length)for(var y,_,w=y[_-1],x=w[0],b=w[1]/2+$p,P=Qe(b),I=Gn(b),M=0;M<_;++M,x=N,P=U,I=z,w=E){var E=y[M],N=E[0],A=E[1]/2+$p,U=Qe(A),z=Gn(A),$=N-x,q=$>=0?1:-1,D=q*$,G=D>fr,Q=P*U;if(ty.add(Xo(Q*q*Qe(D),I*z+Q*Gn(D))),c+=G?$+q*ya:$,G^x>=e^N>=e){var _t=Pf(gl(w),gl(E));If(_t);var Z=Pf(a,_t);If(Z);var Dt=(G^$>=0?-1:1)*Mo(Z[2]);(o>Dt||o===Dt&&(_t[0]||_t[1]))&&(p+=G^$>=0?1:-1)}}return(c<-Kn||c<Kn&&ty<-Kn)^p&1}var _$=Wo();var B$=Wo(),z$=Wo();var tz=1/0;var H$=-tz;function ny(r){this._context=r}ny.prototype={_radius:4.5,pointRadius:function(r){return this._radius=r,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._context.moveTo(r,t),this._point=1;break}case 1:{this._context.lineTo(r,t);break}default:{this._context.moveTo(r+this._radius,t),this._context.arc(r,t,this._radius,0,ya);break}}},result:$s};var Q$=Wo();function ry(){this._string=[]}ry.prototype={_radius:4.5,_circle:KM(4.5),pointRadius:function(r){return(r=+r)!==this._radius&&(this._radius=r,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._string.push("M",r,",",t),this._point=1;break}case 1:{this._string.push("L",r,",",t);break}default:{this._circle==null&&(this._circle=KM(this._radius)),this._string.push("M",r,",",t,this._circle);break}}},result:function(){if(this._string.length){var r=this._string.join("");return this._string=[],r}else return null}};function KM(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function iy(r,t,e,o){return function(a,c){var p=t(c),d=a.invert(o[0],o[1]),g=J0(),y=t(g),_=!1,w,x,b,P={point:I,lineStart:E,lineEnd:N,polygonStart:function(){P.point=A,P.lineStart=U,P.lineEnd=z,x=[],w=[]},polygonEnd:function(){P.point=I,P.lineStart=E,P.lineEnd=N,x=Qp(x);var $=ey(w,d);x.length?(_||(c.polygonStart(),_=!0),Q0(x,rz,$,e,c)):$&&(_||(c.polygonStart(),_=!0),c.lineStart(),e(null,null,1,c),c.lineEnd()),_&&(c.polygonEnd(),_=!1),x=w=null},sphere:function(){c.polygonStart(),c.lineStart(),e(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function I($,q){var D=a($,q);r($=D[0],q=D[1])&&c.point($,q)}function M($,q){var D=a($,q);p.point(D[0],D[1])}function E(){P.point=M,p.lineStart()}function N(){P.point=I,p.lineEnd()}function A($,q){b.push([$,q]);var D=a($,q);y.point(D[0],D[1])}function U(){y.lineStart(),b=[]}function z(){A(b[0][0],b[0][1]),y.lineEnd();var $=y.clean(),q=g.result(),D,G=q.length,Q,_t,Z;if(b.pop(),w.push(b),b=null,!!G){if($&1){if(_t=q[0],(Q=_t.length-1)>0){for(_||(c.polygonStart(),_=!0),c.lineStart(),D=0;D<Q;++D)c.point((Z=_t[D])[0],Z[1]);c.lineEnd()}return}G>1&&$&2&&q.push(q.pop().concat(q.shift())),x.push(q.filter(nz))}}return P}}function nz(r){return r.length>1}function rz(r,t){return((r=r.x)[0]<0?r[1]-xi-Kn:xi-r[1])-((t=t.x)[0]<0?t[1]-xi-Kn:xi-t[1])}var iz=iy(function(){return!0},oz,az,[-fr,-xi]);function oz(r){var t=NaN,e=NaN,o=NaN,a;return{lineStart:function(){r.lineStart(),a=1},point:function(c,p){var d=c>0?fr:-fr,g=Zr(c-t);Zr(g-fr)<Kn?(r.point(t,e=(e+p)/2>0?xi:-xi),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(d,e),r.point(c,e),a=0):o!==d&&g>=fr&&(Zr(t-o)<Kn&&(t-=o*Kn),Zr(c-d)<Kn&&(c-=d*Kn),e=sz(t,e,c,p),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(d,e),a=0),r.point(t=c,e=p),o=d},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-a}}}function sz(r,t,e,o){var a,c,p=Qe(r-e);return Zr(p)>Kn?Ys((Qe(t)*(c=Gn(o))*Qe(e)-Qe(o)*(a=Gn(t))*Qe(r))/(a*c*p)):(t+o)/2}function az(r,t,e,o){var a;if(r==null)a=e*xi,o.point(-fr,a),o.point(0,a),o.point(fr,a),o.point(fr,0),o.point(fr,-a),o.point(0,-a),o.point(-fr,-a),o.point(-fr,0),o.point(-fr,a);else if(Zr(r[0]-t[0])>Kn){var c=r[0]<t[0]?fr:-fr;a=e*c/2,o.point(-c,a),o.point(0,a),o.point(c,a)}else o.point(t[0],t[1])}function jp(r){return function(t){var e=new oy;for(var o in r)e[o]=r[o];return e.stream=t,e}}function oy(){}oy.prototype={constructor:oy,point:function(r,t){this.stream.point(r,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var zZ=Gn(30*qo);var jZ=jp({point:function(r,t){this.stream.point(r*qo,t*qo)}});function td(r){return function(t,e){var o=Gn(t),a=Gn(e),c=r(o*a);return[c*a*Qe(t),c*Qe(e)]}}function va(r){return function(t,e){var o=Ji(t*t+e*e),a=r(o),c=Qe(a),p=Gn(a);return[Xo(t*c,o*p),Mo(o&&e*c/o)]}}var iS=td(function(r){return Ji(2/(1+r))});iS.invert=va(function(r){return 2*Mo(r/2)});var oS=td(function(r){return(r=Z0(r))&&r/Qe(r)});oS.invert=va(function(r){return r});function sy(r,t){return[r,Af(Cf((xi+t)/2))]}sy.invert=function(r,t){return[r,2*Ys(Zp(t))-xi]};function ed(r,t){return[r,t]}ed.invert=ed;function sS(r,t){var e=Gn(t),o=Gn(r)*e;return[e*Qe(r)/o,Qe(t)/o]}sS.invert=va(Ys);function aS(r,t){var e=t*t,o=e*e;return[r*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}aS.invert=function(r,t){var e=t,o=25,a;do{var c=e*e,p=c*c;e-=a=(e*(1.007226+c*(.015085+p*(-.044475+.028874*c-.005916*p)))-t)/(1.007226+c*(.015085*3+p*(-.044475*7+.028874*9*c-.005916*11*p)))}while(Zr(a)>Kn&&--o>0);return[r/(.8707+(c=e*e)*(-.131979+c*(-.013791+c*c*c*(.003971-.001529*c)))),e]};function uS(r,t){return[Gn(t)*Qe(r),Qe(t)]}uS.invert=va(Mo);function lS(r,t){var e=Gn(t),o=1+Gn(r)*e;return[e*Qe(r)/o,Qe(t)/o]}lS.invert=va(function(r){return 2*Ys(r)});function cS(r,t){return[Af(Cf((xi+t)/2)),-r]}cS.invert=function(r,t){return[-t,2*Ys(Zp(r))-xi]};var pz=Nr(bc(),1);var dz=Nr(bc(),1);var mz=Nr(bc(),1);var yz=Nr(bc(),1);function Nu(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function uy(r){let t=0;for(let e=0;e<r.length-1;e++)t+=Nu(r[e],r[e+1]);return t}function hS(r,t,e){let o=new tr(t[0]-r[0],t[1]-r[1]),a=new tr(t[0]-e[0],t[1]-e[1]),p=o.angleTo(a)*180/Math.PI,d=new tr(t[0]-r[0],t[1]-r[1]);return new tr(e[0]-r[0],e[1]-r[1]).cross(d)>0?p:-p}var Ou=Nr(pS(),1);var Ir="___",nd=class{constructor(t=3){this.lift_priority=t;Ii(this,"roadInfo",[]);Ii(this,"facilities",[]);Ii(this,"pointMap",new Map);Ii(this,"nodeMap",new Map);Ii(this,"facilityMap",new Map);Ii(this,"straightLadderMap",new Map);Ii(this,"escalatorMap",new Map);Ii(this,"rampMap",new Map);Ii(this,"staircaseMap",new Map);Ii(this,"parkingMap",new Map);Ii(this,"lineMap",new Map);Ii(this,"baseRoute",new so.default);Ii(this,"escalatorRoute",new so.default);Ii(this,"straightLadderRoute",new so.default);Ii(this,"forwardLineMap",new Map);Ii(this,"forwardRoute",new so.default)}isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let o=[];try{o=JSON.parse(e.entry_end_floor)}catch(c){o=[]}let a=[];try{a=JSON.parse(e.entry_start_floor)}catch(c){a=[]}return Yv(qc({},e),{entry_start_floor:a,entry_end_floor:o})})}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let o=new Date,a=o.getHours()*60+o.getMinutes();t.length&&(t.forEach(c=>{(c.points||[]).filter(p=>p.openStatus!==!1).filter(p=>{if(!p.startTime||!p.endTime)return!0;let[d,g]=p.startTime.split(":").map(b=>+b),[y,_]=p.endTime.split(":").map(b=>+b),w=d*60+g,x=y*60+_;return a>=w&&a<=x}).forEach(p=>{p.floor=c.floor;let d=\`\${c.floor}\${Ir}\${p.id}\`;if(this.nodeMap.set(\`\${c.floor}\${Ir}\${p.nodeId}\`,\`\${c.floor}\${Ir}\${p.relatedId||p.id}\`),this.pointMap.set(d,p),this.isFacilityByType(p.type)){let g=this.facilities.find(y=>y.id===+p.targetId);if(g){switch(g.entry_infra_type){case"straightLadder":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.straightLadderMap.get(p.targetId)||[];x.push(qc({},p)),this.straightLadderMap.set(p.targetId,x)}break;case"staircase":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.staircaseMap.get(p.targetId)||[];x.push(qc({},p)),this.staircaseMap.set(p.targetId,x)}break;case"escalator":let _=this.escalatorMap.get(p.targetId)||[];if(g.entry_start_floor.find(x=>x.floor===c.floor)){let x=_.find(b=>{var P;return((P=b.end)==null?void 0:P.floor)!==c.floor&&!b.start});x?x.start=p:_.push({start:p})}if(g.entry_end_floor.find(x=>x.floor===c.floor)){let x=_.find(b=>{var P;return((P=b.start)==null?void 0:P.floor)!==c.floor&&!b.end});x?x.end=p:_.push({end:p})}this.escalatorMap.set(p.targetId,_);break;case"ramp":let w=this.rampMap.get(p.targetId)||[];if(g.entry_start_floor.find(x=>x.floor===c.floor)){let x=w.find(b=>{var P;return((P=b.end)==null?void 0:P.floor)!==c.floor&&!b.start});x?x.start=p:w.push({start:p})}if(g.entry_end_floor.find(x=>x.floor===c.floor)){let x=w.find(b=>{var P;return((P=b.start)==null?void 0:P.floor)!==c.floor&&!b.end});x?x.end=p:w.push({end:p})}this.rampMap.set(p.targetId,w);break}let y=this.facilityMap.get(p.targetId)||[];y.push(qc({},p)),this.facilityMap.set(p.targetId,y)}}p.type==="parkingSpace"&&this.parkingMap.set(\`\${c.floor}\${Ir}\${p.name}\`,p)}),(c.lines||[]).filter(p=>p.direction!=="no").forEach(p=>{let d=\`\${c.floor}\${Ir}\${p.from}\`,g=\`\${c.floor}\${Ir}\${p.to}\`,y=this.pointMap.get(d),_=this.pointMap.get(g);if(!y||!_)return;let w=y.cds,x=_.cds,b=Nu(w,x);if(!y.permission&&!_.permission)switch(this.addLineItem(d,g,b),this.addLineItem(g,d,b),p.direction){case"double":this.addLineItem(d,g,b,this.forwardLineMap),this.addLineItem(g,d,b,this.forwardLineMap);break;case"single":this.addLineItem(d,g,b,this.forwardLineMap);break;case"back":this.addLineItem(g,d,b,this.forwardLineMap);break}else y.permission&&(this.setPermissionLine(d,g,y.permission,b,""),this.setPermissionLine(g,d,y.permission,b,"")),_.permission&&_.permission!==y.permission&&(this.setPermissionLine(d,g,_.permission,b,""),this.setPermissionLine(g,d,_.permission,b,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this[\`permission_\${t}\`]||(this[\`permission_\${t}\`]=new Set),this[\`permission_\${t}\`]}setPermissionLine(t,e,o,a,c){this.getPermissionMap(o).add({fromKey:t,toKey:e,distance:a,type:c})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let o=0;o<t.length;o++){let a=\`\${t[o].floor}\${Ir}\${t[o].id}\`,c=this.pointMap.get(a);if(c){for(let p=0;p<t.length;p++)if(o!==p){let d=\`\${t[p].floor}\${Ir}\${t[p].id}\`,g=this.pointMap.get(d);if(!g)continue;c.permission&&this.setPermissionLine(a,d,c.permission,1,"straightLadder"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(a,d,g.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let o=0;o<t.length;o++){let a=\`\${t[o].floor}\${Ir}\${t[o].id}\`,c=this.pointMap.get(a);if(c){for(let p=0;p<t.length;p++)if(o!==p){let d=\`\${t[p].floor}\${Ir}\${t[p].id}\`,g=this.pointMap.get(d);if(!g)continue;c.permission&&this.setPermissionLine(a,d,c.permission,1,"staircase"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(a,d,g.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let a=\`\${o.start.floor}\${Ir}\${o.start.id}\`,c=\`\${o.end.floor}\${Ir}\${o.end.id}\`,p=this.pointMap.get(a),d=this.pointMap.get(c);p&&d&&(p.permission&&this.setPermissionLine(a,c,p.permission,1,"escalator"),d.permission&&d.permission!==p.permission&&this.setPermissionLine(a,c,d.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let a=\`\${o.start.floor}\${Ir}\${o.start.id}\`,c=\`\${o.end.floor}\${Ir}\${o.end.id}\`,p=this.pointMap.get(a),d=this.pointMap.get(c);p&&d&&(p.permission&&this.setPermissionLine(a,c,p.permission,10,"ramp"),d.permission&&d.permission!==p.permission&&this.setPermissionLine(a,c,d.permission,10,"ramp"))}})})}addPermissionLineToMap(t,e,o,a){let c=this.getPermissionMap(t);console.log(c),c.forEach(p=>{e.includes(p.type)&&(p.type===""?this.addLineItem(p.fromKey,p.toKey,p.distance,o):this.addLineItem(p.fromKey,p.toKey,a.get(p.type),o))})}addLineItem(t,e,o,a=this.lineMap){let c=a.get(t)||new Map;c.set(e,o),a.set(t,c)}addFacilityToLineMap(t,e,o,a){[...this.straightLadderMap,...this.staircaseMap].forEach(([c,p])=>{if(!(p.length<2))for(let d=0;d<p.length;d++){let g=\`\${p[d].floor}\${Ir}\${p[d].id}\`,y=this.pointMap.get(g);if(!(!y||y.permission)){for(let _=0;_<p.length;_++)if(d!==_){let w=\`\${p[_].floor}\${Ir}\${p[_].id}\`,x=this.pointMap.get(w);if(!x||x.permission)continue;if(p[d].type==="straightLadder"){let b=e;this.addLineItem(g,w,b,a)}else{let b=o;this.addLineItem(g,w,b,a)}}}}}),this.escalatorMap.forEach((c,p)=>{c.forEach(d=>{if(d.start&&d.end){let g=\`\${d.start.floor}\${Ir}\${d.start.id}\`,y=\`\${d.end.floor}\${Ir}\${d.end.id}\`,_=this.pointMap.get(g),w=this.pointMap.get(y);if(_&&w&&!_.permission&&!w.permission){let x=t;this.addLineItem(g,y,x,a)}}})})}initBaseRoute(){let t=new Map((0,Ou.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,t),this.baseRoute=new so.default(t)}initEscalatorRoute(){let t=new Map((0,Ou.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new so.default(t)}initStraightLadderRoute(){let t=new Map((0,Ou.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new so.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let a=\`\${o.start.floor}\${Ir}\${o.start.id}\`,c=\`\${o.end.floor}\${Ir}\${o.end.id}\`,p=this.pointMap.get(a),d=this.pointMap.get(c);p&&d&&!p.permission&&!d.permission&&this.addLineItem(a,c,10,this.forwardLineMap)}})}),this.forwardRoute=new so.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let o=this.nodeMap.get(\`\${t.floor}\${Ir}\${t.nodeId}\`);if(o){let[a,c]=o.split(Ir);return{floor:a,id:c}}}if((e=t.coord)!=null&&e.length){let o=this.roadInfo.find(c=>c.floor===t.floor);if(!o)return null;let a=o.points.reduce((c,p)=>{let d=Nu(t.coord,p.cds);return d<c.min&&(c.min=d,c.point=p),c},{min:1/0,point:o.points[0]});return{floor:o.floor,id:a.point.id}}return null}transformEnd(t){if(t.floor){if(t.parkingSpace){let o=this.parkingMap.get(\`\${t.floor}\${Ir}\${t.parkingSpace}\`);if(o)return{floor:t.floor,id:o.id}}let e=this.transformStart(t);if(e)return e}if(t.facility){let o=this.facilities.filter(a=>+a.type_id==+t.facility).map(a=>a.id).map(a=>this.facilityMap.get(\`\${a}\`)).flat(2);if(o!=null&&o.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o="",a){if(!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let c=this.transformStart(t);if(!c)return"no-start";let p=this.transformEnd(e);if(!p)return"no-end";let d=this.getBasePath.bind(this);switch(o){case"escalator":d=this.getEscalatorPath.bind(this);break;case"straightLadder":d=this.getStraightLadderPath.bind(this);break;case"forward":d=this.getForwardPath.bind(this);break;default:d=this.getBasePath.bind(this);break}if(p.id)return d(c,p,a);if(p.facility){let y=this.facilities.filter(w=>+w.type_id==+e.facility).map(w=>w.id).map(w=>this.facilityMap.get(\`\${w}\`)).flat(2).filter(w=>w).filter(w=>p.floor?w.floor===p.floor:!0);if(!y.length)return null;let _=y.map(w=>d(c,{floor:w.floor,id:w.id},a)).filter(w=>!!w);return _.reduce((w,x)=>{let b=x.reduce((P,I)=>P+uy(I.points),0);return b<w.distance&&(w.distance=b,w.path=x),w},{distance:1/0,path:_[0]}).path}}getRoutePath(t,e,o){let a=\`\${t.floor}\${Ir}\${t.id}\`,c=\`\${e.floor}\${Ir}\${e.id}\`,p=o.path(a,c);if(!p)return null;let d=[];return p.map(g=>{var _;let y=this.pointMap.get(g);if(y){let{floor:w}=y,x=y.type;if(this.isFacilityByType(y.type)){let b=this.facilities.find(P=>P.id===+y.targetId);b&&(x=b.entry_infra_type)}if(((_=d[d.length-1])==null?void 0:_.floor)===w){let b=d[d.length-1];b.points.push(y.cds),b.endType=x,b.destId=y.nodeId,b.distance=uy(b.points)}else d.push({floor:w,points:[y.cds],endType:x,destId:y.nodeId,distance:0})}}),d}getBasePath(t,e,o){if(!o)return this.getRoutePath(t,e,this.baseRoute);let a=(0,Ou.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder"],a,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let c=new so.default(a);return this.getRoutePath(t,e,c)}getEscalatorPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.escalatorRoute);let a=(0,Ou.cloneDeep)(this.escalatorRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder"],a,new Map([["escalator",1*c],["straightLadder",this.lift_priority*c],["staircase",3e4*c]]));let p=new so.default(a);return this.getRoutePath(t,e,p)}getStraightLadderPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.straightLadderRoute);let a=(0,Ou.cloneDeep)(this.straightLadderRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder"],a,new Map([["escalator",3*c],["straightLadder",1*c],["staircase",3e4*c]]));let p=new so.default(a);return this.getRoutePath(t,e,p)}getForwardPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.forwardRoute);let a=(0,Ou.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],a,new Map([["ramp",10]]));let c=new so.default(a);return this.getRoutePath(t,e,c)}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 so.default,this.escalatorRoute=new so.default,this.straightLadderRoute=new so.default}};var Tz=Nr(vS(),1);function Az(r,t,e){let o=hS(r,t,e);return 180-Math.abs(o)<15?"front":o>135?"right_front":o<-135?"left_front":o<=135&&o>=60?"right":o>=-135&&o<=-60?"left":o<60&&o>0?"right_back":o>-60&&o<0?"left_back":"front"}function _S(r){if(!r.length)return[];let t=[{direction:"start",distance:Nu(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let o=Az(r[e-2],r[e-1],r[e]);if(o==="front"){let a=t[t.length-1],c=Nu(r[e-1],r[e]);a.distance+=c,e!==2&&a.points.push(r[e-1])}else t.push({direction:o,distance:Nu(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}function xS(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function ES(r){let t={};for(let o in r)o.startsWith("on")&&(t[xS(o.slice(2))]=r[o]);let e=async({data:o})=>{if(t[o.type])try{let a=await t[o.type](o.data);self.postMessage({type:\`\${o.type}_result\`,key:o.key,data:a})}catch(a){self.postMessage({type:\`\${o.type}_result\`,key:o.key,error:a})}else self.postMess`)}var Ln=class extends Zr.EventDispatcher{worker=Rn();initRoadStatus=!1;constructor(){super()}async setRoadData(e,t){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),await lt(this.worker,"set_road_info",{roadData:e,facilities:t}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})}async getPath(e,t,n="",r){return new Promise((i,o)=>{let a=()=>{console.log("initRoadStatus",this.initRoadStatus),lt(this.worker,"get_path",{start:e,end:t,type:n,permission:r}).then(l=>{l?typeof l=="string"?o(l):i(l):o("no-path")})};if(this.initRoadStatus)a();else{let l=({status:u})=>{u&&(this.removeEventListener("init-road-status",l),a())};this.addEventListener("init-road-status",l)}})}getDirectionPath(e){return lt(this.worker,"get_direction_path",e)}async dispose(){lt(this.worker,"clear",""),this.worker.terminate()}};var Jr=require("three");function Nn(){return xe(`var $1=Object.create;var Rh=Object.defineProperty;var Z1=Object.getOwnPropertyDescriptor;var J1=Object.getOwnPropertyNames,fm=Object.getOwnPropertySymbols,K1=Object.getPrototypeOf,pm=Object.prototype.hasOwnProperty,j1=Object.prototype.propertyIsEnumerable;var Ih=(r,t,e)=>t in r?Rh(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Sl=(r,t)=>{for(var e in t||(t={}))pm.call(t,e)&&Ih(r,e,t[e]);if(fm)for(var e of fm(t))j1.call(t,e)&&Ih(r,e,t[e]);return r};var Ht=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var Q1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of J1(t))!pm.call(r,a)&&a!==e&&Rh(r,a,{get:()=>t[a],enumerable:!(o=Z1(t,a))||o.enumerable});return r};var Wn=(r,t,e)=>(e=r!=null?$1(K1(r)):{},Q1(t||!r||!r.__esModule?Rh(e,"default",{value:r,enumerable:!0}):e,r));var Si=(r,t,e)=>Ih(r,typeof t!="symbol"?t+"":t,e);var mm=Ht((PR,dm)=>{var Lh=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)}};dm.exports=Lh});var vm=Ht((IR,ym)=>{function gm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,gm(a,t)):o!==t&&e.set(o,a);return e}ym.exports=gm});var Em=Ht((RR,xm)=>{function tx(r){let t=Number(r);return!(isNaN(t)||t<=0)}function _m(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,_m(a));if(!tx(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}xm.exports=_m});var wm=Ht((LR,Sm)=>{function Mm(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){Mm(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}Sm.exports=Mm});var Cm=Ht((NR,Am)=>{var ex=mm(),nx=vm(),bm=Em(),Tm=wm(),Nh=class{constructor(t){t instanceof Map?(Tm(t),this.graph=t):t?this.graph=bm(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(Tm(e),o=e):o=bm(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=nx(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 ex,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 b=l.get(M).priority,T=g.priority+y;return T<b?(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)}};Am.exports=Nh});var dc=Ht((VR,v0)=>{"use strict";var y0=Object.getOwnPropertySymbols,rT=Object.prototype.hasOwnProperty,iT=Object.prototype.propertyIsEnumerable;function oT(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function sT(){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}}v0.exports=sT()?Object.assign:function(r,t){for(var e,o=oT(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var h in e)rT.call(e,h)&&(o[h]=e[h]);if(y0){a=y0(e);for(var f=0;f<a.length;f++)iT.call(e,a[f])&&(o[a[f]]=e[a[f]])}}return o}});var sp=Ht((ip,op)=>{(function(r,t){typeof ip=="object"&&typeof op!="undefined"?op.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(ip,function(){"use strict";function r(x,v,P,S,L){(function N(G,B,I,O,q){for(;O>I;){if(O-I>600){var st=O-I+1,V=B-I+1,Mt=Math.log(st),$=.5*Math.exp(2*Mt/3),ut=.5*Math.sqrt(Mt*$*(st-$)/st)*(V-st/2<0?-1:1),xt=Math.max(I,Math.floor(B-V*$/st+ut)),mt=Math.min(O,Math.floor(B+(st-V)*$/st+ut));N(G,B,xt,mt,q)}var lt=G[B],ht=I,k=O;for(t(G,I,B),q(G[O],lt)>0&&t(G,I,O);ht<k;){for(t(G,ht,k),ht++,k--;q(G[ht],lt)<0;)ht++;for(;q(G[k],lt)>0;)k--}q(G[I],lt)===0?t(G,I,k):t(G,++k,O),k<=B&&(I=k+1),B<=k&&(O=k-1)}})(x,v,P||0,S||x.length-1,L||e)}function t(x,v,P){var S=x[v];x[v]=x[P],x[P]=S}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,P){if(!P)return v.indexOf(x);for(var S=0;S<v.length;S++)if(P(x,v[S]))return S;return-1}function l(x,v){h(x,0,x.children.length,v,x)}function h(x,v,P,S,L){L||(L=b(null)),L.minX=1/0,L.minY=1/0,L.maxX=-1/0,L.maxY=-1/0;for(var N=v;N<P;N++){var G=x.children[N];f(L,x.leaf?S(G):G)}return L}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 b(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(x,v,P,S,L){for(var N=[v,P];N.length;)if(!((P=N.pop())-(v=N.pop())<=S)){var G=v+Math.ceil((P-v)/S/2)*S;r(x,G,v,P,L),N.push(v,G,G,P)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(x){var v=this.data,P=[];if(!M(x,v))return P;for(var S=this.toBBox,L=[];v;){for(var N=0;N<v.children.length;N++){var G=v.children[N],B=v.leaf?S(G):G;M(x,B)&&(v.leaf?P.push(G):y(x,B)?this._all(G,P):L.push(G))}v=L.pop()}return P},o.prototype.collides=function(x){var v=this.data;if(!M(x,v))return!1;for(var P=[];v;){for(var S=0;S<v.children.length;S++){var L=v.children[S],N=v.leaf?this.toBBox(L):L;if(M(x,N)){if(v.leaf||y(x,N))return!0;P.push(L)}}v=P.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 P=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===P.height)this._splitRoot(this.data,P);else{if(this.data.height<P.height){var S=this.data;this.data=P,P=S}this._insert(P,this.data.height-P.height-1,!0)}else this.data=P;return this},o.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},o.prototype.clear=function(){return this.data=b([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var P,S,L,N=this.data,G=this.toBBox(x),B=[],I=[];N||B.length;){if(N||(N=B.pop(),S=B[B.length-1],P=I.pop(),L=!0),N.leaf){var O=a(x,N.children,v);if(O!==-1)return N.children.splice(O,1),B.push(N),this._condense(B),this}L||N.leaf||!y(N,G)?S?(P++,N=S.children[P],L=!1):N=null:(B.push(N),I.push(P),P=0,S=N,N=N.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 P=[];x;)x.leaf?v.push.apply(v,x.children):P.push.apply(P,x.children),x=P.pop();return v},o.prototype._build=function(x,v,P,S){var L,N=P-v+1,G=this._maxEntries;if(N<=G)return l(L=b(x.slice(v,P+1)),this.toBBox),L;S||(S=Math.ceil(Math.log(N)/Math.log(G)),G=Math.ceil(N/Math.pow(G,S-1))),(L=b([])).leaf=!1,L.height=S;var B=Math.ceil(N/G),I=B*Math.ceil(Math.sqrt(G));T(x,v,P,I,this.compareMinX);for(var O=v;O<=P;O+=I){var q=Math.min(O+I-1,P);T(x,O,q,B,this.compareMinY);for(var st=O;st<=q;st+=B){var V=Math.min(st+B-1,q);L.children.push(this._build(x,st,V,S-1))}}return l(L,this.toBBox),L},o.prototype._chooseSubtree=function(x,v,P,S){for(;S.push(v),!v.leaf&&S.length-1!==P;){for(var L=1/0,N=1/0,G=void 0,B=0;B<v.children.length;B++){var I=v.children[B],O=g(I),q=(st=x,V=I,(Math.max(V.maxX,st.maxX)-Math.min(V.minX,st.minX))*(Math.max(V.maxY,st.maxY)-Math.min(V.minY,st.minY))-O);q<N?(N=q,L=O<L?O:L,G=I):q===N&&O<L&&(L=O,G=I)}v=G||v.children[0]}var st,V;return v},o.prototype._insert=function(x,v,P){var S=P?x:this.toBBox(x),L=[],N=this._chooseSubtree(S,this.data,v,L);for(N.children.push(x),f(N,S);v>=0&&L[v].children.length>this._maxEntries;)this._split(L,v),v--;this._adjustParentBBoxes(S,L,v)},o.prototype._split=function(x,v){var P=x[v],S=P.children.length,L=this._minEntries;this._chooseSplitAxis(P,L,S);var N=this._chooseSplitIndex(P,L,S),G=b(P.children.splice(N,P.children.length-N));G.height=P.height,G.leaf=P.leaf,l(P,this.toBBox),l(G,this.toBBox),v?x[v-1].children.push(G):this._splitRoot(P,G)},o.prototype._splitRoot=function(x,v){this.data=b([x,v]),this.data.height=x.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(x,v,P){for(var S,L,N,G,B,I,O,q=1/0,st=1/0,V=v;V<=P-v;V++){var Mt=h(x,0,V,this.toBBox),$=h(x,V,P,this.toBBox),ut=(L=Mt,N=$,G=void 0,B=void 0,I=void 0,O=void 0,G=Math.max(L.minX,N.minX),B=Math.max(L.minY,N.minY),I=Math.min(L.maxX,N.maxX),O=Math.min(L.maxY,N.maxY),Math.max(0,I-G)*Math.max(0,O-B)),xt=g(Mt)+g($);ut<q?(q=ut,S=V,st=xt<st?xt:st):ut===q&&xt<st&&(st=xt,S=V)}return S||P-v},o.prototype._chooseSplitAxis=function(x,v,P){var S=x.leaf?this.compareMinX:p,L=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,P,S)<this._allDistMargin(x,v,P,L)&&x.children.sort(S)},o.prototype._allDistMargin=function(x,v,P,S){x.children.sort(S);for(var L=this.toBBox,N=h(x,0,v,L),G=h(x,P-v,P,L),B=_(N)+_(G),I=v;I<P-v;I++){var O=x.children[I];f(N,x.leaf?L(O):O),B+=_(N)}for(var q=P-v-1;q>=v;q--){var st=x.children[q];f(G,x.leaf?L(st):st),B+=_(G)}return B},o.prototype._adjustParentBBoxes=function(x,v,P){for(var S=P;S>=0;S--)f(v[S],x)},o.prototype._condense=function(x){for(var v=x.length-1,P=void 0;v>=0;v--)x[v].children.length===0?v>0?(P=x[v-1].children).splice(P.indexOf(x[v]),1):this.clear():l(x[v],this.toBBox)},o})});var _0=Ht((ap,up)=>{(function(r,t){typeof ap=="object"&&typeof up!="undefined"?up.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(ap,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 E0=Ht(($R,x0)=>{x0.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],b=e[o+g*2+1],T=y>h!=b>h&&l<(M-_)*(h-y)/(b-y)+_;T&&(f=!f)}return f}});var S0=Ht((ZR,M0)=>{M0.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],b=e[g+o][1],T=y>h!=b>h&&l<(M-_)*(h-y)/(b-y)+_;T&&(f=!f)}return f}});var T0=Ht((JR,yc)=>{var w0=E0(),b0=S0();yc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?b0(t,e,o,a):w0(t,e,o,a)};yc.exports.nested=b0;yc.exports.flat=w0});var C0=Ht((vc,A0)=>{(function(r,t){typeof vc=="object"&&typeof A0!="undefined"?t(vc):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(vc,function(r){"use strict";let e=33306690738754706e-32;function o(M,b,T,x,v){let P,S,L,N,G=b[0],B=x[0],I=0,O=0;B>G==B>-G?(P=G,G=b[++I]):(P=B,B=x[++O]);let q=0;if(I<M&&O<T)for(B>G==B>-G?(L=P-((S=G+P)-G),G=b[++I]):(L=P-((S=B+P)-B),B=x[++O]),P=S,L!==0&&(v[q++]=L);I<M&&O<T;)B>G==B>-G?(L=P-((S=P+G)-(N=S-P))+(G-N),G=b[++I]):(L=P-((S=P+B)-(N=S-P))+(B-N),B=x[++O]),P=S,L!==0&&(v[q++]=L);for(;I<M;)L=P-((S=P+G)-(N=S-P))+(G-N),G=b[++I],P=S,L!==0&&(v[q++]=L);for(;O<T;)L=P-((S=P+B)-(N=S-P))+(B-N),B=x[++O],P=S,L!==0&&(v[q++]=L);return P===0&&q!==0||(v[q++]=P),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,b,T,x,v,P){let S=(b-P)*(T-v),L=(M-v)*(x-P),N=S-L;if(S===0||L===0||S>0!=L>0)return N;let G=Math.abs(S+L);return Math.abs(N)>=l*G?N:-function(B,I,O,q,st,V,Mt){let $,ut,xt,mt,lt,ht,k,nt,ft,Tt,gt,Lt,qt,Xt,Ft,Qt,Ct,ee,it=B-st,rn=O-st,Bt=I-V,Jt=q-V;lt=(Ft=(nt=it-(k=(ht=134217729*it)-(ht-it)))*(Tt=Jt-(ft=(ht=134217729*Jt)-(ht-Jt)))-((Xt=it*Jt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=Bt-(k=(ht=134217729*Bt)-(ht-Bt)))*(Tt=rn-(ft=(ht=134217729*rn)-(ht-rn)))-((Qt=Bt*rn)-k*ft-nt*ft-k*Tt))),p[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),p[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,p[2]=Lt-(ee-lt)+(gt-lt),p[3]=ee;let Yt=function(yn,pn){let X=pn[0];for(let F=1;F<yn;F++)X+=pn[F];return X}(4,p),pe=h*Mt;if(Yt>=pe||-Yt>=pe||($=B-(it+(lt=B-it))+(lt-st),xt=O-(rn+(lt=O-rn))+(lt-st),ut=I-(Bt+(lt=I-Bt))+(lt-V),mt=q-(Jt+(lt=q-Jt))+(lt-V),$===0&&ut===0&&xt===0&&mt===0)||(pe=f*Mt+e*Math.abs(Yt),(Yt+=it*mt+Jt*$-(Bt*xt+rn*ut))>=pe||-Yt>=pe))return Yt;lt=(Ft=(nt=$-(k=(ht=134217729*$)-(ht-$)))*(Tt=Jt-(ft=(ht=134217729*Jt)-(ht-Jt)))-((Xt=$*Jt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=ut-(k=(ht=134217729*ut)-(ht-ut)))*(Tt=rn-(ft=(ht=134217729*rn)-(ht-rn)))-((Qt=ut*rn)-k*ft-nt*ft-k*Tt))),y[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),y[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,y[2]=Lt-(ee-lt)+(gt-lt),y[3]=ee;let le=o(4,p,4,y,d);lt=(Ft=(nt=it-(k=(ht=134217729*it)-(ht-it)))*(Tt=mt-(ft=(ht=134217729*mt)-(ht-mt)))-((Xt=it*mt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=Bt-(k=(ht=134217729*Bt)-(ht-Bt)))*(Tt=xt-(ft=(ht=134217729*xt)-(ht-xt)))-((Qt=Bt*xt)-k*ft-nt*ft-k*Tt))),y[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),y[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,y[2]=Lt-(ee-lt)+(gt-lt),y[3]=ee;let Pt=o(le,d,4,y,g);lt=(Ft=(nt=$-(k=(ht=134217729*$)-(ht-$)))*(Tt=mt-(ft=(ht=134217729*mt)-(ht-mt)))-((Xt=$*mt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=ut-(k=(ht=134217729*ut)-(ht-ut)))*(Tt=xt-(ft=(ht=134217729*xt)-(ht-xt)))-((Qt=ut*xt)-k*ft-nt*ft-k*Tt))),y[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),y[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,y[2]=Lt-(ee-lt)+(gt-lt),y[3]=ee;let te=o(Pt,g,4,y,_);return _[te-1]}(M,b,T,x,v,P,G)},r.orient2dfast=function(M,b,T,x,v,P){return(b-P)*(T-v)-(M-v)*(x-P)},Object.defineProperty(r,"__esModule",{value:!0})})});var O0=Ht((KR,fp)=>{"use strict";var P0=sp(),xc=_0(),uT=T0(),lT=C0().orient2d;xc.default&&(xc=xc.default);fp.exports=N0;fp.exports.default=N0;function N0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=dT(r),a=new P0(16);a.toBBox=function(P){return{minX:P[0],minY:P[1],maxX:P[0],maxY:P[1]}},a.compareMinX=function(P,S){return P[0]-S[0]},a.compareMinY=function(P,S){return P[1]-S[1]},a.load(r);for(var l=[],h=0,f;h<o.length;h++){var p=o[h];a.remove(p),f=L0(p,f),l.push(f)}var d=new P0(16);for(h=0;h<l.length;h++)d.insert(lp(l[h]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,b=y.next.p,T=cp(M,b);if(!(T<_)){var x=T/g;p=cT(a,y.prev.p,M,b,y.next.next.p,x,d),p&&Math.min(cp(p,M),cp(p,b))<=x&&(l.push(y),l.push(L0(p,y)),a.remove(p),d.remove(y),d.insert(lp(y)),d.insert(lp(y.next)))}}y=f;var v=[];do v.push(y.p),y=y.next;while(y!==f);return v.push(y.p),v}function cT(r,t,e,o,a,l,h){for(var f=new xc([],hT),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?hp(g,e,o):fT(e,o,g);_>l||f.push({node:g,dist:_})}for(;f.length&&!f.peek().node.children;){var y=f.pop(),M=y.node,b=hp(M,t,e),T=hp(M,o,a);if(y.dist<b&&y.dist<T&&R0(e,M,h)&&R0(o,M,h))return M}p=f.pop(),p&&(p=p.node)}return null}function hT(r,t){return r.dist-t.dist}function fT(r,t,e){if(I0(r,e)||I0(t,e))return 0;var o=_c(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=_c(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=_c(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var h=_c(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 I0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function R0(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(pT(f[p].p,f[p].next.p,r,t))return!1;return!0}function Ja(r,t,e){return lT(r[0],r[1],t[0],t[1],e[0],e[1])}function pT(r,t,e,o){return r!==o&&t!==e&&Ja(r,t,e)>0!=Ja(r,t,o)>0&&Ja(e,o,r)>0!=Ja(e,o,t)>0}function lp(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 dT(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++)uT(r[l],f)||p.push(r[l]);return gT(p)}function L0(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 cp(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function hp(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 _c(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,b=p*p+d*d,T=p*g+d*_,x=g*g+_*_,v=p*y+d*M,P=g*y+_*M,S=b*x-T*T,L,N,G,B,I=S,O=S;S===0?(N=0,I=1,B=P,O=x):(N=T*P-x*v,B=b*P-T*v,N<0?(N=0,B=P,O=x):N>I&&(N=I,B=P+T,O=x)),B<0?(B=0,-v<0?N=0:-v>b?N=I:(N=-v,I=b)):B>O&&(B=O,-v+T<0?N=0:-v+T>b?N=I:(N=-v+T,I=b)),L=N===0?0:N/I,G=B===0?0:B/O;var q=(1-L)*r+L*e,st=(1-L)*t+L*o,V=(1-G)*a+G*h,Mt=(1-G)*l+G*f,$=V-q,ut=Mt-st;return $*$+ut*ut}function mT(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function gT(r){r.sort(mT);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Ja(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&&Ja(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 k0=Ht((dp,mp)=>{(function(r,t){typeof dp=="object"&&typeof mp!="undefined"?mp.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(dp,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),b=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,b,T,p)}var x=a[l],v=h,P=f;for(e(a,h,l),p(a[f],x)>0&&e(a,h,f);v<P;){for(e(a,v,P),v++,P--;p(a[v],x)<0;)v++;for(;p(a[P],x)>0;)P--}p(a[h],x)===0?e(a,h,P):(P++,e(a,P,f)),P<=l&&(h=P+1),l<=P&&(f=P-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 _p=Ht((S2,vp)=>{"use strict";vp.exports=Xu;vp.exports.default=Xu;var PT=k0();function Xu(r,t){if(!(this instanceof Xu))return new Xu(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()}Xu.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Mc(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,Mc(r,p)&&(t.leaf?e.push(f):yp(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(!Mc(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,Mc(r,f)){if(t.leaf||yp(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=Qa([]),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=IT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&yp(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:G0,compareMinY:V0,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=Qa(r.slice(t,e+1)),ja(h,this.toBBox),h;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),h=Qa([]),h.leaf=!1,h.height=o;var f=Math.ceil(a/l),p=f*Math.ceil(Math.sqrt(l)),d,g,_,y;for(H0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),H0(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 ja(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=gp(h),d=RT(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),qu(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=Qa(e.children.splice(l,e.children.length-l));h.height=e.height,h.leaf=e.leaf,ja(e,this.toBBox),ja(h,this.toBBox),t?r[t-1].children.push(h):this._splitRoot(e,h)},_splitRoot:function(r,t){this.data=Qa([r,t]),this.data.height=r.height+1,this.data.leaf=!1,ja(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=Wu(r,0,o,this.toBBox),l=Wu(r,o,e,this.toBBox),h=LT(a,l),f=gp(a)+gp(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:G0,a=r.leaf?this.compareMinY:V0,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=Wu(r,0,t,a),h=Wu(r,e-t,e,a),f=Ec(l)+Ec(h),p,d;for(p=t;p<e-t;p++)d=r.children[p],qu(l,r.leaf?a(d):d),f+=Ec(l);for(p=e-t-1;p>=t;p--)d=r.children[p],qu(h,r.leaf?a(d):d),f+=Ec(h);return f},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)qu(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():ja(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 IT(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 ja(r,t){Wu(r,0,r.children.length,t,r)}function Wu(r,t,e,o,a){a||(a=Qa(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],qu(a,r.leaf?o(h):h);return a}function qu(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 G0(r,t){return r.minX-t.minX}function V0(r,t){return r.minY-t.minY}function gp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Ec(r){return r.maxX-r.minX+(r.maxY-r.minY)}function RT(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 LT(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 yp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Mc(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function Qa(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function H0(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,PT(r,h,t,e,a),l.push(t,h,h,e))}});var Z0=Ht((FO,bp)=>{"use strict";bp.exports=Tc;bp.exports.default=Tc;function Tc(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=X0(r,0,a,e,!0),h=[];if(!l||l.next===l.prev)return h;var f,p,d,g,_,y,M;if(o&&(l=VT(r,t,l,e)),r.length>80*e){f=d=r[0],p=g=r[1];for(var b=e;b<a;b+=e)_=r[b],y=r[b+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 Zu(l,h,e,f,p,M,0),h}function X0(r,t,e,o,a){var l,h;if(a===wp(r,t,e,o)>0)for(l=t;l<e;l+=o)h=q0(l,r[l],r[l+1],h);else for(l=e-o;l>=t;l-=o)h=q0(l,r[l],r[l+1],h);return h&&Ac(h,h.next)&&(Ku(h),h=h.next),h}function Qs(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Ac(e,e.next)||Yn(e.prev,e,e.next)===0)){if(Ku(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function Zu(r,t,e,o,a,l,h){if(r){!h&&l&&YT(r,o,a,l);for(var f=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?zT(r,o,a,l):BT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),Ku(r),r=d.next,f=d.next;continue}if(r=d,r===f){h?h===1?(r=kT(Qs(r),t,e),Zu(r,t,e,o,a,l,2)):h===2&>(r,t,e,o,a,l):Zu(Qs(r),t,e,o,a,l,1);break}}}}function BT(r){var t=r.prev,e=r,o=r.next;if(Yn(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,b=o.next;b!==t;){if(b.x>=g&&b.x<=y&&b.y>=_&&b.y<=M&&nu(a,f,l,p,h,d,b.x,b.y)&&Yn(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function zT(r,t,e,o){var a=r.prev,l=r,h=r.next;if(Yn(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,b=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=Mp(M,b,t,e,o),P=Mp(T,x,t,e,o),S=r.prevZ,L=r.nextZ;S&&S.z>=v&&L&&L.z<=P;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=x&&S!==a&&S!==h&&nu(f,g,p,_,d,y,S.x,S.y)&&Yn(S.prev,S,S.next)>=0||(S=S.prevZ,L.x>=M&&L.x<=T&&L.y>=b&&L.y<=x&&L!==a&&L!==h&&nu(f,g,p,_,d,y,L.x,L.y)&&Yn(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;S&&S.z>=v;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=x&&S!==a&&S!==h&&nu(f,g,p,_,d,y,S.x,S.y)&&Yn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;L&&L.z<=P;){if(L.x>=M&&L.x<=T&&L.y>=b&&L.y<=x&&L!==a&&L!==h&&nu(f,g,p,_,d,y,L.x,L.y)&&Yn(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function kT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Ac(a,l)&&Y0(a,o,o.next,l)&&Ju(a,l)&&Ju(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),Ku(o),Ku(o.next),o=r=l),o=o.next}while(o!==r);return Qs(o)}function GT(r,t,e,o,a,l){var h=r;do{for(var f=h.next.next;f!==h.prev;){if(h.i!==f.i&&JT(h,f)){var p=$0(h,f);h=Qs(h,h.next),p=Qs(p,p.next),Zu(h,t,e,o,a,l,0),Zu(p,t,e,o,a,l,0);return}f=f.next}h=h.next}while(h!==r)}function VT(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=X0(r,f,p,o,!1),d===d.next&&(d.steiner=!0),a.push(ZT(d));for(a.sort(HT),l=0;l<a.length;l++)e=WT(a[l],e);return e}function HT(r,t){return r.x-t.x}function WT(r,t){var e=qT(r,t);if(!e)return t;var o=$0(e,r);return Qs(o,o.next),Qs(e,e.next)}function qT(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&&nu(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),Ju(e,r)&&(y<_||y===_&&(e.x>h.x||e.x===h.x&&XT(h,e)))&&(h=e,_=y)),e=e.next;while(e!==p);return h}function XT(r,t){return Yn(r.prev,r,t.prev)<0&&Yn(t.next,r,r.next)<0}function YT(r,t,e,o){var a=r;do a.z===0&&(a.z=Mp(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,$T(a)}function $T(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 Mp(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 nu(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 JT(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!KT(r,t)&&(Ju(r,t)&&Ju(t,r)&&jT(r,t)&&(Yn(r.prev,r,t.prev)||Yn(r,t.prev,t))||Ac(r,t)&&Yn(r.prev,r,r.next)>0&&Yn(t.prev,t,t.next)>0)}function Yn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Ac(r,t){return r.x===t.x&&r.y===t.y}function Y0(r,t,e,o){var a=bc(Yn(r,t,e)),l=bc(Yn(r,t,o)),h=bc(Yn(e,o,r)),f=bc(Yn(e,o,t));return!!(a!==l&&h!==f||a===0&&wc(r,e,t)||l===0&&wc(r,o,t)||h===0&&wc(e,r,o)||f===0&&wc(e,t,o))}function wc(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 bc(r){return r>0?1:r<0?-1:0}function KT(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&&Y0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Ju(r,t){return Yn(r.prev,r,r.next)<0?Yn(r,t,r.next)>=0&&Yn(r,r.prev,t)>=0:Yn(r,t,r.prev)<0||Yn(r,r.next,t)<0}function jT(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 $0(r,t){var e=new Sp(r.i,r.x,r.y),o=new Sp(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 q0(r,t,e,o){var a=new Sp(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 Ku(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 Sp(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}Tc.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,h=Math.abs(wp(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(wp(r,d,g,e))}var _=0;for(f=0;f<o.length;f+=3){var y=o[f]*e,M=o[f+1]*e,b=o[f+2]*e;_+=Math.abs((r[y]-r[b])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[b+1]-r[y+1]))}return h===0&&_===0?0:Math.abs((_-h)/h)};function wp(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}Tc.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 Ip=Ht(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.earthRadius=63710088e-1;ae.factors={centimeters:ae.earthRadius*100,centimetres:ae.earthRadius*100,degrees:ae.earthRadius/111325,feet:ae.earthRadius*3.28084,inches:ae.earthRadius*39.37,kilometers:ae.earthRadius/1e3,kilometres:ae.earthRadius/1e3,meters:ae.earthRadius,metres:ae.earthRadius,miles:ae.earthRadius/1609.344,millimeters:ae.earthRadius*1e3,millimetres:ae.earthRadius*1e3,nauticalmiles:ae.earthRadius/1852,radians:1,yards:ae.earthRadius*1.0936};ae.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/ae.earthRadius,yards:1.0936133};ae.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 Ms(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}ae.feature=Ms;function tA(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Tp(t).geometry;case"LineString":return Cp(t).geometry;case"Polygon":return Ap(t).geometry;case"MultiPoint":return K0(t).geometry;case"MultiLineString":return J0(t).geometry;case"MultiPolygon":return j0(t).geometry;default:throw new Error(r+" is invalid")}}ae.geometry=tA;function Tp(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(!Cc(r[0])||!Cc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Ms(o,t,e)}ae.point=Tp;function eA(r,t,e){return e===void 0&&(e={}),Pc(r.map(function(o){return Tp(o,t)}),e)}ae.points=eA;function Ap(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 Ms(f,t,e)}ae.polygon=Ap;function nA(r,t,e){return e===void 0&&(e={}),Pc(r.map(function(o){return Ap(o,t)}),e)}ae.polygons=nA;function Cp(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 Ms(o,t,e)}ae.lineString=Cp;function rA(r,t,e){return e===void 0&&(e={}),Pc(r.map(function(o){return Cp(o,t)}),e)}ae.lineStrings=rA;function Pc(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}ae.featureCollection=Pc;function J0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Ms(o,t,e)}ae.multiLineString=J0;function K0(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Ms(o,t,e)}ae.multiPoint=K0;function j0(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Ms(o,t,e)}ae.multiPolygon=j0;function iA(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Ms(o,t,e)}ae.geometryCollection=iA;function oA(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}ae.round=oA;function Q0(r,t){t===void 0&&(t="kilometers");var e=ae.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}ae.radiansToLength=Q0;function Pp(r,t){t===void 0&&(t="kilometers");var e=ae.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}ae.lengthToRadians=Pp;function sA(r,t){return ty(Pp(r,t))}ae.lengthToDegrees=sA;function aA(r){var t=r%360;return t<0&&(t+=360),t}ae.bearingToAzimuth=aA;function ty(r){var t=r%(2*Math.PI);return t*180/Math.PI}ae.radiansToDegrees=ty;function uA(r){var t=r%360;return t*Math.PI/180}ae.degreesToRadians=uA;function lA(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 Q0(Pp(r,t),e)}ae.convertLength=lA;function cA(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=ae.areaFactors[t];if(!o)throw new Error("invalid original units");var a=ae.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}ae.convertArea=cA;function Cc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ae.isNumber=Cc;function hA(r){return!!r&&r.constructor===Object}ae.isObject=hA;function fA(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(!Cc(t))throw new Error("bbox must only contain numbers")})}ae.validateBBox=fA;function pA(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")}ae.validateId=pA});var Lp=Ht(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});var Zr=Ip();function ju(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,_=0,y,M=r.type,b=M==="FeatureCollection",T=M==="Feature",x=b?r.features.length:1,v=0;v<x;v++){d=b?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,f=y?d.geometries.length:1;for(var P=0;P<f;P++){var S=0,L=0;if(h=y?d.geometries[P]:d,h!==null){p=h.coordinates;var N=h.type;switch(g=e&&(N==="Polygon"||N==="MultiPolygon")?1:0,N){case null:break;case"Point":if(t(p,_,v,S,L)===!1)return!1;_++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,S,L)===!1)return!1;_++,N==="MultiPoint"&&S++}N==="LineString"&&S++;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,S,L)===!1)return!1;_++}N==="MultiLineString"&&S++,N==="Polygon"&&L++}N==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(L=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,S,L)===!1)return!1;_++}L++}S++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(ju(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function dA(r,t,e,o){var a=e;return ju(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 ey(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 mA(r,t,e){var o=e;return ey(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function ny(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 gA(r,t,e){var o=e;return ny(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function yA(r){var t=[];return ju(r,function(e){t.push(e)}),t}function Rp(r,t){var e,o,a,l,h,f,p,d,g,_,y=0,M=r.type==="FeatureCollection",b=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(f=M?r.features[e].geometry:b?r.geometry:r,d=M?r.features[e].properties:b?r.properties:{},g=M?r.features[e].bbox:b?r.bbox:void 0,_=M?r.features[e].id:b?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 vA(r,t,e){var o=e;return Rp(r,function(a,l,h,f,p){l===0&&e===void 0?o=a:o=t(o,a,l,h,f,p)}),o}function Ic(r,t){Rp(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(Zr.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(Zr.feature(_,a),o,d)===!1)return!1}})}function _A(r,t,e){var o=e;return Ic(r,function(a,l,h){l===0&&h===0&&e===void 0?o=a:o=t(o,a,l,h)}),o}function ry(r,t){Ic(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(ju(e,function(_,y,M,b,T){if(f===void 0||o>p||b>d||T>g){f=_,p=o,d=b,g=T,l=0;return}var x=Zr.lineString([f,_],e.properties);if(t(x,o,a,T,l)===!1)return!1;l++,f=_})===!1)return!1}}})}function xA(r,t,e){var o=e,a=!1;return ry(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 iy(r,t){if(!r)throw new Error("geojson is required");Ic(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(Zr.lineString(h[f],e.properties),o,a,f)===!1)return!1;break}}})}function EA(r,t,e){var o=e;return iy(r,function(a,l,h,f){l===0&&e===void 0?o=a:o=t(o,a,l,h,f)}),o}function MA(r,t){if(t=t||{},!Zr.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),Zr.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),Zr.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),Zr.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),Zr.lineString([p[o][a][l],p[o][a][l+1]],h,t)}throw new Error("geojson is invalid")}function SA(r,t){if(t=t||{},!Zr.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 Zr.point(p,h,t);case"MultiPoint":return o<0&&(o=p.length+o),Zr.point(p[o],h,t);case"LineString":return l<0&&(l=p.length+l),Zr.point(p[l],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Zr.point(p[a][l],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Zr.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),Zr.point(p[o][a][l],h,t)}throw new Error("geojson is invalid")}pr.coordAll=yA;pr.coordEach=ju;pr.coordReduce=dA;pr.featureEach=ny;pr.featureReduce=gA;pr.findPoint=SA;pr.findSegment=MA;pr.flattenEach=Ic;pr.flattenReduce=_A;pr.geomEach=Rp;pr.geomReduce=vA;pr.lineEach=iy;pr.lineReduce=EA;pr.propEach=ey;pr.propReduce=mA;pr.segmentEach=ry;pr.segmentReduce=xA});var oy=Ht(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});var wA=Lp();function Np(r){var t=[1/0,1/0,-1/0,-1/0];return wA.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}Np.default=Np;Op.default=Np});var Rc=Ht((jO,Dp)=>{var _o=sp(),ay=Ip(),uy=Lp(),ru=oy().default,bA=uy.featureEach,JO=uy.coordEach,KO=ay.polygon,sy=ay.featureCollection;function ly(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:ru(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:ru(a),o.push(a)}):bA(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ru(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:ru(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 sy(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 sy(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=ru(e);else if(e.type==="FeatureCollection")o=ru(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Dp.exports=ly;Dp.exports.default=ly});var Gp=Ht((aF,_y)=>{"use strict";var vy=Object.prototype.toString;_y.exports=function(t){var e=vy.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&vy.call(t.callee)==="[object Function]"),o}});var Cy=Ht((uF,Ay)=>{"use strict";var Ty;Object.keys||(el=Object.prototype.hasOwnProperty,Vp=Object.prototype.toString,xy=Gp(),Hp=Object.prototype.propertyIsEnumerable,Ey=!Hp.call({toString:null},"toString"),My=Hp.call(function(){},"prototype"),nl=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Fc=function(r){var t=r.constructor;return t&&t.prototype===r},Sy={$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},wy=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!Sy["$"+r]&&el.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Fc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),by=function(r){if(typeof window=="undefined"||!wy)return Fc(r);try{return Fc(r)}catch(t){return!1}},Ty=function(t){var e=t!==null&&typeof t=="object",o=Vp.call(t)==="[object Function]",a=xy(t),l=e&&Vp.call(t)==="[object String]",h=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var f=My&&o;if(l&&t.length>0&&!el.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")&&el.call(t,g)&&h.push(String(g));if(Ey)for(var _=by(t),y=0;y<nl.length;++y)!(_&&nl[y]==="constructor")&&el.call(t,nl[y])&&h.push(nl[y]);return h});var el,Vp,xy,Hp,Ey,My,nl,Fc,Sy,wy,by;Ay.exports=Ty});var Wp=Ht((lF,Ry)=>{"use strict";var DA=Array.prototype.slice,FA=Gp(),Py=Object.keys,Uc=Py?function(t){return Py(t)}:Cy(),Iy=Object.keys;Uc.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 FA(o)?Iy(DA.call(o)):Iy(o)})}else Object.keys=Uc;return Object.keys||Uc};Ry.exports=Uc});var qp=Ht((cF,Ly)=>{"use strict";Ly.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 Bc=Ht((hF,Ny)=>{"use strict";var UA=qp();Ny.exports=function(){return UA()&&!!Symbol.toStringTag}});var Dy=Ht((fF,Oy)=>{"use strict";Oy.exports=Error});var Uy=Ht((pF,Fy)=>{"use strict";Fy.exports=EvalError});var zy=Ht((dF,By)=>{"use strict";By.exports=RangeError});var Gy=Ht((mF,ky)=>{"use strict";ky.exports=ReferenceError});var Xp=Ht((gF,Vy)=>{"use strict";Vy.exports=SyntaxError});var ta=Ht((yF,Hy)=>{"use strict";Hy.exports=TypeError});var qy=Ht((vF,Wy)=>{"use strict";Wy.exports=URIError});var $y=Ht((_F,Yy)=>{"use strict";var Xy=typeof Symbol!="undefined"&&Symbol,BA=qp();Yy.exports=function(){return typeof Xy!="function"||typeof Symbol!="function"||typeof Xy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:BA()}});var Jy=Ht((xF,Zy)=>{"use strict";var Yp={__proto__:null,foo:{}},zA=Object;Zy.exports=function(){return{__proto__:Yp}.foo===Yp.foo&&!(Yp instanceof zA)}});var Qy=Ht((EF,jy)=>{"use strict";var kA="Function.prototype.bind called on incompatible ",GA=Object.prototype.toString,VA=Math.max,HA="[object Function]",Ky=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},WA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},qA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};jy.exports=function(t){var e=this;if(typeof e!="function"||GA.apply(e)!==HA)throw new TypeError(kA+e);for(var o=WA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,Ky(o,arguments));return Object(g)===g?g:this}return e.apply(t,Ky(o,arguments))},h=VA(0,e.length-o.length),f=[],p=0;p<h;p++)f[p]="$"+p;if(a=Function("binder","return function ("+qA(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 zc=Ht((MF,tv)=>{"use strict";var XA=Qy();tv.exports=Function.prototype.bind||XA});var nv=Ht((SF,ev)=>{"use strict";var YA=Function.prototype.call,$A=Object.prototype.hasOwnProperty,ZA=zc();ev.exports=ZA.call(YA,$A)});var uu=Ht((wF,av)=>{"use strict";var en,JA=Dy(),KA=Uy(),jA=zy(),QA=Gy(),au=Xp(),su=ta(),tC=qy(),sv=Function,$p=function(r){try{return sv('"use strict"; return ('+r+").constructor;")()}catch(t){}},ea=Object.getOwnPropertyDescriptor;if(ea)try{ea({},"")}catch(r){ea=null}var Zp=function(){throw new su},eC=ea?function(){try{return arguments.callee,Zp}catch(r){try{return ea(arguments,"callee").get}catch(t){return Zp}}}():Zp,iu=$y()(),nC=Jy()(),Ar=Object.getPrototypeOf||(nC?function(r){return r.__proto__}:null),ou={},rC=typeof Uint8Array=="undefined"||!Ar?en:Ar(Uint8Array),na={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?en:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?en:ArrayBuffer,"%ArrayIteratorPrototype%":iu&&Ar?Ar([][Symbol.iterator]()):en,"%AsyncFromSyncIteratorPrototype%":en,"%AsyncFunction%":ou,"%AsyncGenerator%":ou,"%AsyncGeneratorFunction%":ou,"%AsyncIteratorPrototype%":ou,"%Atomics%":typeof Atomics=="undefined"?en:Atomics,"%BigInt%":typeof BigInt=="undefined"?en:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?en:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?en:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?en:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":JA,"%eval%":eval,"%EvalError%":KA,"%Float32Array%":typeof Float32Array=="undefined"?en:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?en:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?en:FinalizationRegistry,"%Function%":sv,"%GeneratorFunction%":ou,"%Int8Array%":typeof Int8Array=="undefined"?en:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?en:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?en:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":iu&&Ar?Ar(Ar([][Symbol.iterator]())):en,"%JSON%":typeof JSON=="object"?JSON:en,"%Map%":typeof Map=="undefined"?en:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!iu||!Ar?en:Ar(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?en:Promise,"%Proxy%":typeof Proxy=="undefined"?en:Proxy,"%RangeError%":jA,"%ReferenceError%":QA,"%Reflect%":typeof Reflect=="undefined"?en:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?en:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!iu||!Ar?en:Ar(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?en:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":iu&&Ar?Ar(""[Symbol.iterator]()):en,"%Symbol%":iu?Symbol:en,"%SyntaxError%":au,"%ThrowTypeError%":eC,"%TypedArray%":rC,"%TypeError%":su,"%Uint8Array%":typeof Uint8Array=="undefined"?en:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?en:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?en:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?en:Uint32Array,"%URIError%":tC,"%WeakMap%":typeof WeakMap=="undefined"?en:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?en:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?en:WeakSet};if(Ar)try{null.error}catch(r){rv=Ar(Ar(r)),na["%Error.prototype%"]=rv}var rv,iC=function r(t){var e;if(t==="%AsyncFunction%")e=$p("async function () {}");else if(t==="%GeneratorFunction%")e=$p("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=$p("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&Ar&&(e=Ar(a.prototype))}return na[t]=e,e},iv={__proto__:null,"%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"]},rl=zc(),kc=nv(),oC=rl.call(Function.call,Array.prototype.concat),sC=rl.call(Function.apply,Array.prototype.splice),ov=rl.call(Function.call,String.prototype.replace),Gc=rl.call(Function.call,String.prototype.slice),aC=rl.call(Function.call,RegExp.prototype.exec),uC=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,lC=/\\\\(\\\\)?/g,cC=function(t){var e=Gc(t,0,1),o=Gc(t,-1);if(e==="%"&&o!=="%")throw new au("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new au("invalid intrinsic syntax, expected opening \`%\`");var a=[];return ov(t,uC,function(l,h,f,p){a[a.length]=f?ov(p,lC,"$1"):h||l}),a},hC=function(t,e){var o=t,a;if(kc(iv,o)&&(a=iv[o],o="%"+a[0]+"%"),kc(na,o)){var l=na[o];if(l===ou&&(l=iC(o)),typeof l=="undefined"&&!e)throw new su("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new au("intrinsic "+t+" does not exist!")};av.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new su("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new su('"allowMissing" argument must be a boolean');if(aC(/^%?[^%]*%?$/,t)===null)throw new au("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=cC(t),a=o.length>0?o[0]:"",l=hC("%"+a+"%",e),h=l.name,f=l.value,p=!1,d=l.alias;d&&(a=d[0],sC(o,oC([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Gc(y,0,1),b=Gc(y,-1);if((M==='"'||M==="'"||M==="\`"||b==='"'||b==="'"||b==="\`")&&M!==b)throw new au("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,h="%"+a+"%",kc(na,h))f=na[h];else if(f!=null){if(!(y in f)){if(!e)throw new su("base intrinsic for "+t+" exists, but the property is not available.");return}if(ea&&g+1>=o.length){var T=ea(f,y);_=!!T,_&&"get"in T&&!("originalValue"in T.get)?f=T.get:f=f[y]}else _=kc(f,y),f=f[y];_&&!p&&(na[h]=f)}}return f}});var Hc=Ht((bF,uv)=>{"use strict";var fC=uu(),Vc=fC("%Object.defineProperty%",!0)||!1;if(Vc)try{Vc({},"a",{value:1})}catch(r){Vc=!1}uv.exports=Vc});var Jp=Ht((TF,lv)=>{"use strict";var pC=uu(),Wc=pC("%Object.getOwnPropertyDescriptor%",!0);if(Wc)try{Wc([],"length")}catch(r){Wc=null}lv.exports=Wc});var qc=Ht((AF,fv)=>{"use strict";var cv=Hc(),dC=Xp(),lu=ta(),hv=Jp();fv.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new lu("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new lu("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new lu("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new lu("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new lu("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new lu("\`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=!!hv&&hv(t,e);if(cv)cv(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 dC("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Xc=Ht((CF,dv)=>{"use strict";var Kp=Hc(),pv=function(){return!!Kp};pv.hasArrayLengthDefineBug=function(){if(!Kp)return null;try{return Kp([],"length",{value:1}).length!==1}catch(t){return!0}};dv.exports=pv});var _v=Ht((PF,vv)=>{"use strict";var mC=uu(),mv=qc(),gC=Xc()(),gv=Jp(),yv=ta(),yC=mC("%Math.floor%");vv.exports=function(t,e){if(typeof t!="function")throw new yv("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||yC(e)!==e)throw new yv("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&gv){var h=gv(t,"length");h&&!h.configurable&&(a=!1),h&&!h.writable&&(l=!1)}return(a||l||!o)&&(gC?mv(t,"length",e,!0,!0):mv(t,"length",e)),t}});var Zc=Ht((IF,Yc)=>{"use strict";var jp=zc(),$c=uu(),vC=_v(),_C=ta(),Mv=$c("%Function.prototype.apply%"),Sv=$c("%Function.prototype.call%"),wv=$c("%Reflect.apply%",!0)||jp.call(Sv,Mv),xv=Hc(),xC=$c("%Math.max%");Yc.exports=function(t){if(typeof t!="function")throw new _C("a function is required");var e=wv(jp,Sv,arguments);return vC(e,1+xC(0,t.length-(arguments.length-1)),!0)};var Ev=function(){return wv(jp,Mv,arguments)};xv?xv(Yc.exports,"apply",{value:Ev}):Yc.exports.apply=Ev});var Qp=Ht((RF,Av)=>{"use strict";var bv=uu(),Tv=Zc(),EC=Tv(bv("String.prototype.indexOf"));Av.exports=function(t,e){var o=bv(t,!!e);return typeof o=="function"&&EC(t,".prototype.")>-1?Tv(o):o}});var Iv=Ht((LF,Pv)=>{"use strict";var MC=Bc()(),SC=Qp(),td=SC("Object.prototype.toString"),Jc=function(t){return MC&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:td(t)==="[object Arguments]"},Cv=function(t){return Jc(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&td(t)!=="[object Array]"&&td(t.callee)==="[object Function]"},wC=function(){return Jc(arguments)}();Jc.isLegacyArguments=Cv;Pv.exports=wC?Jc:Cv});var cu=Ht((NF,Ov)=>{"use strict";var bC=Wp(),TC=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",AC=Object.prototype.toString,CC=Array.prototype.concat,Rv=qc(),PC=function(r){return typeof r=="function"&&AC.call(r)==="[object Function]"},Lv=Xc()(),IC=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!PC(o)||!o())return}Lv?Rv(r,t,e,!0):Rv(r,t,e)},Nv=function(r,t){var e=arguments.length>2?arguments[2]:{},o=bC(t);TC&&(o=CC.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)IC(r,o[a],t[o[a]],e[o[a]])};Nv.supportsDescriptors=!!Lv;Ov.exports=Nv});var ed=Ht((OF,Fv)=>{"use strict";var Dv=function(r){return r!==r};Fv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Dv(t)&&Dv(e))}});var nd=Ht((DF,Uv)=>{"use strict";var RC=ed();Uv.exports=function(){return typeof Object.is=="function"?Object.is:RC}});var zv=Ht((FF,Bv)=>{"use strict";var LC=nd(),NC=cu();Bv.exports=function(){var t=LC();return NC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Hv=Ht((UF,Vv)=>{"use strict";var OC=cu(),DC=Zc(),FC=ed(),kv=nd(),UC=zv(),Gv=DC(kv(),Object);OC(Gv,{getPolyfill:kv,implementation:FC,shim:UC});Vv.exports=Gv});var $v=Ht((BF,Yv)=>{"use strict";var rd=Qp(),Wv=Bc()(),qv,Xv,id,od;Wv&&(qv=rd("Object.prototype.hasOwnProperty"),Xv=rd("RegExp.prototype.exec"),id={},Kc=function(){throw id},od={toString:Kc,valueOf:Kc},typeof Symbol.toPrimitive=="symbol"&&(od[Symbol.toPrimitive]=Kc));var Kc,BC=rd("Object.prototype.toString"),zC=Object.getOwnPropertyDescriptor,kC="[object RegExp]";Yv.exports=Wv?function(t){if(!t||typeof t!="object")return!1;var e=zC(t,"lastIndex"),o=e&&qv(e,"value");if(!o)return!1;try{Xv(t,od)}catch(a){return a===id}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:BC(t)===kC}});var Jv=Ht((zF,Zv)=>{"use strict";var ol=function(){return typeof function(){}.name=="string"},il=Object.getOwnPropertyDescriptor;if(il)try{il([],"length")}catch(r){il=null}ol.functionsHaveConfigurableNames=function(){if(!ol()||!il)return!1;var t=il(function(){},"name");return!!t&&!!t.configurable};var GC=Function.prototype.bind;ol.boundFunctionsHaveNames=function(){return ol()&&typeof GC=="function"&&function(){}.bind().name!==""};Zv.exports=ol});var Qv=Ht((kF,jv)=>{"use strict";var Kv=qc(),VC=Xc()(),HC=Jv().functionsHaveConfigurableNames(),WC=ta();jv.exports=function(t,e){if(typeof t!="function")throw new WC("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||HC)&&(VC?Kv(t,"name",e,!0,!0):Kv(t,"name",e)),t}});var sd=Ht((GF,t_)=>{"use strict";var qC=Qv(),XC=ta(),YC=Object;t_.exports=qC(function(){if(this==null||this!==YC(this))throw new XC("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 ad=Ht((VF,e_)=>{"use strict";var $C=sd(),ZC=cu().supportsDescriptors,JC=Object.getOwnPropertyDescriptor;e_.exports=function(){if(ZC&&/a/mig.flags==="gim"){var t=JC(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),t.get.call(o),e==="dy")return t.get}}return $C}});var i_=Ht((HF,r_)=>{"use strict";var KC=cu().supportsDescriptors,jC=ad(),QC=Object.getOwnPropertyDescriptor,tP=Object.defineProperty,eP=TypeError,n_=Object.getPrototypeOf,nP=/a/;r_.exports=function(){if(!KC||!n_)throw new eP("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=jC(),e=n_(nP),o=QC(e,"flags");return(!o||o.get!==t)&&tP(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var u_=Ht((WF,a_)=>{"use strict";var rP=cu(),iP=Zc(),oP=sd(),o_=ad(),sP=i_(),s_=iP(o_());rP(s_,{getPolyfill:o_,implementation:oP,shim:sP});a_.exports=s_});var c_=Ht((qF,l_)=>{"use strict";var aP=Date.prototype.getDay,uP=function(t){try{return aP.call(t),!0}catch(e){return!1}},lP=Object.prototype.toString,cP="[object Date]",hP=Bc()();l_.exports=function(t){return typeof t!="object"||t===null?!1:hP?uP(t):lP.call(t)===cP}});var ud=Ht((XF,E_)=>{var h_=Wp(),f_=Iv(),p_=Hv(),d_=$v(),m_=u_(),g_=c_(),y_=Date.prototype.getTime;function x_(r,t,e){var o=e||{};return(o.strict?p_(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?p_(r,t):r==t:fP(r,t,o)}function v_(r){return r==null}function __(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 fP(r,t,e){var o,a;if(typeof r!=typeof t||v_(r)||v_(t)||r.prototype!==t.prototype||f_(r)!==f_(t))return!1;var l=d_(r),h=d_(t);if(l!==h)return!1;if(l||h)return r.source===t.source&&m_(r)===m_(t);if(g_(r)&&g_(t))return y_.call(r)===y_.call(t);var f=__(r),p=__(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=h_(r),g=h_(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],!x_(r[a],t[a],e))return!1;return!0}E_.exports=x_});var xd=Ht((jB,C_)=>{var nI=ud(),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:rI};xo.prototype.compare=function(r,t){if(r.type!==t.type||!A_(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=T_(r),a=T_(t);return o.every(function(l){return this.some(function(h){return e.compare(l,h)})},a)}}return!1};function T_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function A_(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(!A_(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 rI(r,t){return nI(r,t,{strict:!0})}C_.exports=xo});var P_=Ht((cz,th)=>{function ws(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)}ws.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};ws.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)};ws.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)}};ws.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};ws.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};ws.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};ws.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 th!="undefined"&&th.exports&&(th.exports=ws)});var I_=Ht((hz,eh)=>{function bs(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}bs.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)};bs.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()};bs.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};bs.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};bs.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};bs.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};bs.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 eh!="undefined"&&eh.exports&&(eh.exports=bs)});var Ed=Ht((fz,nh)=>{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 nh!="undefined"&&nh.exports&&(nh.exports=Eo)});var L_=Ht((pz,fu)=>{typeof fu!="undefined"&&fu.exports&&(R_=Ed());var R_;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 R_(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 fu!="undefined"&&fu.exports&&(fu.exports=jo)});var N_=Ht((dz,rh)=>{typeof rh!="undefined"&&rh.exports&&(rh.exports={DBSCAN:P_(),KMEANS:I_(),OPTICS:L_(),PriorityQueue:Ed()})});var Md=Ht((xz,D_)=>{"use strict";D_.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 B_=Ht((Ez,U_)=>{"use strict";var F_=Md(),lI=F_.eudist,cI=F_.dist;U_.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?lI:cI,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=[],b=0;b<l;b++){for(var T=1/0,x=0;x<_;x++){var v=o(t[b],a[x]);v<=T&&(T=v)}g[b]=T}for(var P=0;P<l;P++)y+=g[P];for(var S=0;S<l;S++)M[S]={i:S,v:t[S],pr:g[S]/y,cs:0};M.sort(function(B,I){return B.pr-I.pr}),M[0].cs=M[0].pr;for(var L=1;L<l;L++)M[L].cs=M[L-1].cs+M[L].pr;for(var N=Math.random(),G=0;G<l-1&&M[G++].cs<N;);a.push(M[G-1].v)}return a}}});var H_=Ht((wz,V_)=>{"use strict";var Sd=Md(),G_=B_(),hI=Sd.eudist,Mz=Sd.mandist,Sz=Sd.dist,fI=G_.kmrand,pI=G_.kmpp,z_=1e4;function k_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function dI(r,t,e,o){var a=[],l=[],h=[],f=[],p=!1,d=o||z_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=fI(r,t):e=="kmpp"?a=pI(r,t):a=e;else for(var b={};a.length<t;){var T=Math.floor(Math.random()*g);b[T]||(b[T]=!0,a.push(r[T]))}do{k_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,P=0,S=0;S<t;S++){var f=y?hI(r[x],a[S]):Math.abs(r[x]-a[S]);f<=v&&(v=f,P=S)}h[x]=P,M[P]++}for(var L=[],l=[],N=0,G=0;G<t;G++)L[G]=y?k_(_,0,L[G]):0,l[G]=a[G];if(y){for(var B=0;B<t;B++)a[B]=[];for(var I=0;I<g;I++)for(var O=h[I],q=L[O],st=r[I],V=0;V<_;V++)q[V]+=st[V];p=!0;for(var Mt=0;Mt<t;Mt++){for(var $=a[Mt],ut=L[Mt],xt=l[Mt],mt=M[Mt],lt=0;lt<_;lt++)$[lt]=ut[lt]/mt||0;if(p){for(var ht=0;ht<_;ht++)if(xt[ht]!=$[ht]){p=!1;break}}}}else{for(var k=0;k<g;k++){var nt=h[k];L[nt]+=r[k]}for(var ft=0;ft<t;ft++)a[ft]=L[ft]/M[ft]||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:z_-d,k:t,idxs:h,centroids:a}}V_.exports=dI});var yu=Ht((Pd,Id)=>{(function(r,t){typeof Pd=="object"&&typeof Id!="undefined"?Id.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Pd,function(){"use strict";function r(Y,w){var C={label:0,sent:function(){if(z[0]&1)throw z[1];return z[1]},trys:[],ops:[]},R,H,z,rt;return rt={next:j(0),throw:j(1),return:j(2)},typeof Symbol=="function"&&(rt[Symbol.iterator]=function(){return this}),rt;function j(tt){return function(Z){return D([tt,Z])}}function D(tt){if(R)throw new TypeError("Generator is already executing.");for(;C;)try{if(R=1,H&&(z=tt[0]&2?H.return:tt[0]?H.throw||((z=H.return)&&z.call(H),0):H.next)&&!(z=z.call(H,tt[1])).done)return z;switch(H=0,z&&(tt=[tt[0]&2,z.value]),tt[0]){case 0:case 1:z=tt;break;case 4:return C.label++,{value:tt[1],done:!1};case 5:C.label++,H=tt[1],tt=[0];continue;case 7:tt=C.ops.pop(),C.trys.pop();continue;default:if(z=C.trys,!(z=z.length>0&&z[z.length-1])&&(tt[0]===6||tt[0]===2)){C=0;continue}if(tt[0]===3&&(!z||tt[1]>z[0]&&tt[1]<z[3])){C.label=tt[1];break}if(tt[0]===6&&C.label<z[1]){C.label=z[1],z=tt;break}if(z&&C.label<z[2]){C.label=z[2],C.ops.push(tt);break}z[2]&&C.ops.pop(),C.trys.pop();continue}tt=w.call(Y,C)}catch(Z){tt=[6,Z],H=0}finally{R=z=0}if(tt[0]&5)throw tt[1];return{value:tt[0]?tt[1]:void 0,done:!0}}}var t=function(){function Y(w,C){this.next=null,this.key=w,this.data=C,this.left=null,this.right=null}return Y}();function e(Y,w){return Y>w?1:Y<w?-1:0}function o(Y,w,C){for(var R=new t(null,null),H=R,z=R;;){var rt=C(Y,w.key);if(rt<0){if(w.left===null)break;if(C(Y,w.left.key)<0){var j=w.left;if(w.left=j.right,j.right=w,w=j,w.left===null)break}z.left=w,z=w,w=w.left}else if(rt>0){if(w.right===null)break;if(C(Y,w.right.key)>0){var j=w.right;if(w.right=j.left,j.left=w,w=j,w.right===null)break}H.right=w,H=w,w=w.right}else break}return H.right=w.left,z.left=w.right,w.left=R.right,w.right=R.left,w}function a(Y,w,C,R){var H=new t(Y,w);if(C===null)return H.left=H.right=null,H;C=o(Y,C,R);var z=R(Y,C.key);return z<0?(H.left=C.left,H.right=C,C.left=null):z>=0&&(H.right=C.right,H.left=C,C.right=null),H}function l(Y,w,C){var R=null,H=null;if(w){w=o(Y,w,C);var z=C(w.key,Y);z===0?(R=w.left,H=w.right):z<0?(H=w.right,w.right=null,R=w):(R=w.left,w.left=null,H=w)}return{left:R,right:H}}function h(Y,w,C){return w===null?Y:(Y===null||(w=o(Y.key,w,C),w.left=Y),w)}function f(Y,w,C,R,H){if(Y){R(""+w+(C?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+H(Y)+\`
|
|
3835
3706
|
\`);var z=w+(C?" ":"\\u2502 ");Y.left&&f(Y.left,z,!1,R,H),Y.right&&f(Y.right,z,!0,R,H)}}var p=function(){function Y(w){w===void 0&&(w=e),this._root=null,this._size=0,this._comparator=w}return Y.prototype.insert=function(w,C){return this._size++,this._root=a(w,C,this._root,this._comparator)},Y.prototype.add=function(w,C){var R=new t(w,C);this._root===null&&(R.left=R.right=null,this._size++,this._root=R);var H=this._comparator,z=o(w,this._root,H),rt=H(w,z.key);return rt===0?this._root=z:(rt<0?(R.left=z.left,R.right=z,z.left=null):rt>0&&(R.right=z.right,R.left=z,z.right=null),this._size++,this._root=R),this._root},Y.prototype.remove=function(w){this._root=this._remove(w,this._root,this._comparator)},Y.prototype._remove=function(w,C,R){var H;if(C===null)return null;C=o(w,C,R);var z=R(w,C.key);return z===0?(C.left===null?H=C.right:(H=o(w,C.left,R),H.right=C.right),this._size--,H):C},Y.prototype.pop=function(){var w=this._root;if(w){for(;w.left;)w=w.left;return this._root=o(w.key,this._root,this._comparator),this._root=this._remove(w.key,this._root,this._comparator),{key:w.key,data:w.data}}return null},Y.prototype.findStatic=function(w){for(var C=this._root,R=this._comparator;C;){var H=R(w,C.key);if(H===0)return C;H<0?C=C.left:C=C.right}return null},Y.prototype.find=function(w){return this._root&&(this._root=o(w,this._root,this._comparator),this._comparator(w,this._root.key)!==0)?null:this._root},Y.prototype.contains=function(w){for(var C=this._root,R=this._comparator;C;){var H=R(w,C.key);if(H===0)return!0;H<0?C=C.left:C=C.right}return!1},Y.prototype.forEach=function(w,C){for(var R=this._root,H=[],z=!1;!z;)R!==null?(H.push(R),R=R.left):H.length!==0?(R=H.pop(),w.call(C,R),R=R.right):z=!0;return this},Y.prototype.range=function(w,C,R,H){for(var z=[],rt=this._comparator,j=this._root,D;z.length!==0||j;)if(j)z.push(j),j=j.left;else{if(j=z.pop(),D=rt(j.key,C),D>0)break;if(rt(j.key,w)>=0&&R.call(H,j))return this;j=j.right}return this},Y.prototype.keys=function(){var w=[];return this.forEach(function(C){var R=C.key;return w.push(R)}),w},Y.prototype.values=function(){var w=[];return this.forEach(function(C){var R=C.data;return w.push(R)}),w},Y.prototype.min=function(){return this._root?this.minNode(this._root).key:null},Y.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},Y.prototype.minNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.left;)w=w.left;return w},Y.prototype.maxNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.right;)w=w.right;return w},Y.prototype.at=function(w){for(var C=this._root,R=!1,H=0,z=[];!R;)if(C)z.push(C),C=C.left;else if(z.length>0){if(C=z.pop(),H===w)return C;H++,C=C.right}else R=!0;return null},Y.prototype.next=function(w){var C=this._root,R=null;if(w.right){for(R=w.right;R.left;)R=R.left;return R}for(var H=this._comparator;C;){var z=H(w.key,C.key);if(z===0)break;z<0?(R=C,C=C.left):C=C.right}return R},Y.prototype.prev=function(w){var C=this._root,R=null;if(w.left!==null){for(R=w.left;R.right;)R=R.right;return R}for(var H=this._comparator;C;){var z=H(w.key,C.key);if(z===0)break;z<0?C=C.left:(R=C,C=C.right)}return R},Y.prototype.clear=function(){return this._root=null,this._size=0,this},Y.prototype.toList=function(){return _(this._root)},Y.prototype.load=function(w,C,R){C===void 0&&(C=[]),R===void 0&&(R=!1);var H=w.length,z=this._comparator;if(R&&b(w,C,0,H-1,z),this._root===null)this._root=d(w,C,0,H),this._size=H;else{var rt=M(this.toList(),g(w,C),z);H=this._size+H,this._root=y({head:rt},0,H)}return this},Y.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(Y.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(Y.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Y.prototype.toString=function(w){w===void 0&&(w=function(R){return String(R.key)});var C=[];return f(this._root,"",!0,function(R){return C.push(R)},w),C.join("")},Y.prototype.update=function(w,C,R){var H=this._comparator,z=l(w,this._root,H),rt=z.left,j=z.right;H(w,C)<0?j=a(C,R,j,H):rt=a(C,R,rt,H),this._root=h(rt,j,H)},Y.prototype.split=function(w){return l(w,this._root,this._comparator)},Y.prototype[Symbol.iterator]=function(){var w,C,R;return r(this,function(H){switch(H.label){case 0:w=this._root,C=[],R=!1,H.label=1;case 1:return R?[3,6]:w===null?[3,2]:(C.push(w),w=w.left,[3,5]);case 2:return C.length===0?[3,4]:(w=C.pop(),[4,w]);case 3:return H.sent(),w=w.right,[3,5];case 4:R=!0,H.label=5;case 5:return[3,1];case 6:return[2]}})},Y}();function d(Y,w,C,R){var H=R-C;if(H>0){var z=C+Math.floor(H/2),rt=Y[z],j=w[z],D=new t(rt,j);return D.left=d(Y,w,C,z),D.right=d(Y,w,z+1,R),D}return null}function g(Y,w){for(var C=new t(null,null),R=C,H=0;H<Y.length;H++)R=R.next=new t(Y[H],w[H]);return R.next=null,C.next}function _(Y){for(var w=Y,C=[],R=!1,H=new t(null,null),z=H;!R;)w?(C.push(w),w=w.left):C.length>0?(w=z=z.next=C.pop(),w=w.right):R=!0;return z.next=null,H.next}function y(Y,w,C){var R=C-w;if(R>0){var H=w+Math.floor(R/2),z=y(Y,w,H),rt=Y.head;return rt.left=z,Y.head=Y.head.next,rt.right=y(Y,H+1,C),rt}return null}function M(Y,w,C){for(var R=new t(null,null),H=R,z=Y,rt=w;z!==null&&rt!==null;)C(z.key,rt.key)<0?(H.next=z,z=z.next):(H.next=rt,rt=rt.next),H=H.next;return z!==null?H.next=z:rt!==null&&(H.next=rt),R.next}function b(Y,w,C,R,H){if(!(C>=R)){for(var z=Y[C+R>>1],rt=C-1,j=R+1;;){do rt++;while(H(Y[rt],z)<0);do j--;while(H(Y[j],z)>0);if(rt>=j)break;var D=Y[rt];Y[rt]=Y[j],Y[j]=D,D=w[rt],w[rt]=w[j],w[j]=D}b(Y,w,C,j,H),b(Y,w,j+1,R,H)}}let T=(Y,w)=>Y.ll.x<=w.x&&w.x<=Y.ur.x&&Y.ll.y<=w.y&&w.y<=Y.ur.y,x=(Y,w)=>{if(w.ur.x<Y.ll.x||Y.ur.x<w.ll.x||w.ur.y<Y.ll.y||Y.ur.y<w.ll.y)return null;let C=Y.ll.x<w.ll.x?w.ll.x:Y.ll.x,R=Y.ur.x<w.ur.x?Y.ur.x:w.ur.x,H=Y.ll.y<w.ll.y?w.ll.y:Y.ll.y,z=Y.ur.y<w.ur.y?Y.ur.y:w.ur.y;return{ll:{x:C,y:H},ur:{x:R,y:z}}},v=Number.EPSILON;v===void 0&&(v=Math.pow(2,-52));let P=v*v,S=(Y,w)=>{if(-v<Y&&Y<v&&-v<w&&w<v)return 0;let C=Y-w;return C*C<P*Y*w?0:Y<w?-1:1};class L{constructor(){this.reset()}reset(){this.xRounder=new N,this.yRounder=new N}round(w,C){return{x:this.xRounder.round(w),y:this.yRounder.round(C)}}}class N{constructor(){this.tree=new p,this.round(0)}round(w){let C=this.tree.add(w),R=this.tree.prev(C);if(R!==null&&S(C.key,R.key)===0)return this.tree.remove(w),R.key;let H=this.tree.next(C);return H!==null&&S(C.key,H.key)===0?(this.tree.remove(w),H.key):w}}let G=new L,B=11102230246251565e-32,I=134217729,O=(3+8*B)*B;function q(Y,w,C,R,H){let z,rt,j,D,tt=w[0],Z=R[0],et=0,ot=0;Z>tt==Z>-tt?(z=tt,tt=w[++et]):(z=Z,Z=R[++ot]);let Q=0;if(et<Y&&ot<C)for(Z>tt==Z>-tt?(rt=tt+z,j=z-(rt-tt),tt=w[++et]):(rt=Z+z,j=z-(rt-Z),Z=R[++ot]),z=rt,j!==0&&(H[Q++]=j);et<Y&&ot<C;)Z>tt==Z>-tt?(rt=z+tt,D=rt-z,j=z-(rt-D)+(tt-D),tt=w[++et]):(rt=z+Z,D=rt-z,j=z-(rt-D)+(Z-D),Z=R[++ot]),z=rt,j!==0&&(H[Q++]=j);for(;et<Y;)rt=z+tt,D=rt-z,j=z-(rt-D)+(tt-D),tt=w[++et],z=rt,j!==0&&(H[Q++]=j);for(;ot<C;)rt=z+Z,D=rt-z,j=z-(rt-D)+(Z-D),Z=R[++ot],z=rt,j!==0&&(H[Q++]=j);return(z!==0||Q===0)&&(H[Q++]=z),Q}function st(Y,w){let C=w[0];for(let R=1;R<Y;R++)C+=w[R];return C}function V(Y){return new Float64Array(Y)}let Mt=(3+16*B)*B,$=(2+12*B)*B,ut=(9+64*B)*B*B,xt=V(4),mt=V(8),lt=V(12),ht=V(16),k=V(4);function nt(Y,w,C,R,H,z,rt){let j,D,tt,Z,et,ot,Q,St,At,ne,Gt,He,tn,Ln,mn,Fn,$n,xn,re=Y-H,En=C-H,Cn=w-z,wn=R-z;Ln=re*wn,ot=I*re,Q=ot-(ot-re),St=re-Q,ot=I*wn,At=ot-(ot-wn),ne=wn-At,mn=St*ne-(Ln-Q*At-St*At-Q*ne),Fn=Cn*En,ot=I*Cn,Q=ot-(ot-Cn),St=Cn-Q,ot=I*En,At=ot-(ot-En),ne=En-At,$n=St*ne-(Fn-Q*At-St*At-Q*ne),Gt=mn-$n,et=mn-Gt,xt[0]=mn-(Gt+et)+(et-$n),He=Ln+Gt,et=He-Ln,tn=Ln-(He-et)+(Gt-et),Gt=tn-Fn,et=tn-Gt,xt[1]=tn-(Gt+et)+(et-Fn),xn=He+Gt,et=xn-He,xt[2]=He-(xn-et)+(Gt-et),xt[3]=xn;let gn=st(4,xt),W=$*rt;if(gn>=W||-gn>=W||(et=Y-re,j=Y-(re+et)+(et-H),et=C-En,tt=C-(En+et)+(et-H),et=w-Cn,D=w-(Cn+et)+(et-z),et=R-wn,Z=R-(wn+et)+(et-z),j===0&&D===0&&tt===0&&Z===0)||(W=ut*rt+O*Math.abs(gn),gn+=re*Z+wn*j-(Cn*tt+En*D),gn>=W||-gn>=W))return gn;Ln=j*wn,ot=I*j,Q=ot-(ot-j),St=j-Q,ot=I*wn,At=ot-(ot-wn),ne=wn-At,mn=St*ne-(Ln-Q*At-St*At-Q*ne),Fn=D*En,ot=I*D,Q=ot-(ot-D),St=D-Q,ot=I*En,At=ot-(ot-En),ne=En-At,$n=St*ne-(Fn-Q*At-St*At-Q*ne),Gt=mn-$n,et=mn-Gt,k[0]=mn-(Gt+et)+(et-$n),He=Ln+Gt,et=He-Ln,tn=Ln-(He-et)+(Gt-et),Gt=tn-Fn,et=tn-Gt,k[1]=tn-(Gt+et)+(et-Fn),xn=He+Gt,et=xn-He,k[2]=He-(xn-et)+(Gt-et),k[3]=xn;let at=q(4,xt,4,k,mt);Ln=re*Z,ot=I*re,Q=ot-(ot-re),St=re-Q,ot=I*Z,At=ot-(ot-Z),ne=Z-At,mn=St*ne-(Ln-Q*At-St*At-Q*ne),Fn=Cn*tt,ot=I*Cn,Q=ot-(ot-Cn),St=Cn-Q,ot=I*tt,At=ot-(ot-tt),ne=tt-At,$n=St*ne-(Fn-Q*At-St*At-Q*ne),Gt=mn-$n,et=mn-Gt,k[0]=mn-(Gt+et)+(et-$n),He=Ln+Gt,et=He-Ln,tn=Ln-(He-et)+(Gt-et),Gt=tn-Fn,et=tn-Gt,k[1]=tn-(Gt+et)+(et-Fn),xn=He+Gt,et=xn-He,k[2]=He-(xn-et)+(Gt-et),k[3]=xn;let _t=q(at,mt,4,k,lt);Ln=j*Z,ot=I*j,Q=ot-(ot-j),St=j-Q,ot=I*Z,At=ot-(ot-Z),ne=Z-At,mn=St*ne-(Ln-Q*At-St*At-Q*ne),Fn=D*tt,ot=I*D,Q=ot-(ot-D),St=D-Q,ot=I*tt,At=ot-(ot-tt),ne=tt-At,$n=St*ne-(Fn-Q*At-St*At-Q*ne),Gt=mn-$n,et=mn-Gt,k[0]=mn-(Gt+et)+(et-$n),He=Ln+Gt,et=He-Ln,tn=Ln-(He-et)+(Gt-et),Gt=tn-Fn,et=tn-Gt,k[1]=tn-(Gt+et)+(et-Fn),xn=He+Gt,et=xn-He,k[2]=He-(xn-et)+(Gt-et),k[3]=xn;let ct=q(_t,lt,4,k,ht);return ht[ct-1]}function ft(Y,w,C,R,H,z){let rt=(w-z)*(C-H),j=(Y-H)*(R-z),D=rt-j,tt=Math.abs(rt+j);return Math.abs(D)>=Mt*tt?D:-nt(Y,w,C,R,H,z,tt)}let Tt=(Y,w)=>Y.x*w.y-Y.y*w.x,gt=(Y,w)=>Y.x*w.x+Y.y*w.y,Lt=(Y,w,C)=>{let R=ft(Y.x,Y.y,w.x,w.y,C.x,C.y);return R>0?-1:R<0?1:0},qt=Y=>Math.sqrt(gt(Y,Y)),Xt=(Y,w,C)=>{let R={x:w.x-Y.x,y:w.y-Y.y},H={x:C.x-Y.x,y:C.y-Y.y};return Tt(H,R)/qt(H)/qt(R)},Ft=(Y,w,C)=>{let R={x:w.x-Y.x,y:w.y-Y.y},H={x:C.x-Y.x,y:C.y-Y.y};return gt(H,R)/qt(H)/qt(R)},Qt=(Y,w,C)=>w.y===0?null:{x:Y.x+w.x/w.y*(C-Y.y),y:C},Ct=(Y,w,C)=>w.x===0?null:{x:C,y:Y.y+w.y/w.x*(C-Y.x)},ee=(Y,w,C,R)=>{if(w.x===0)return Ct(C,R,Y.x);if(R.x===0)return Ct(Y,w,C.x);if(w.y===0)return Qt(C,R,Y.y);if(R.y===0)return Qt(Y,w,C.y);let H=Tt(w,R);if(H==0)return null;let z={x:C.x-Y.x,y:C.y-Y.y},rt=Tt(z,w)/H,j=Tt(z,R)/H,D=Y.x+j*w.x,tt=C.x+rt*R.x,Z=Y.y+j*w.y,et=C.y+rt*R.y,ot=(D+tt)/2,Q=(Z+et)/2;return{x:ot,y:Q}};class it{static compare(w,C){let R=it.comparePoints(w.point,C.point);return R!==0?R:(w.point!==C.point&&w.link(C),w.isLeft!==C.isLeft?w.isLeft?1:-1:Bt.compare(w.segment,C.segment))}static comparePoints(w,C){return w.x<C.x?-1:w.x>C.x?1:w.y<C.y?-1:w.y>C.y?1:0}constructor(w,C){w.events===void 0?w.events=[this]:w.events.push(this),this.point=w,this.isLeft=C}link(w){if(w.point===this.point)throw new Error("Tried to link already linked events");let C=w.point.events;for(let R=0,H=C.length;R<H;R++){let z=C[R];this.point.events.push(z),z.point=this.point}this.checkForConsuming()}checkForConsuming(){let w=this.point.events.length;for(let C=0;C<w;C++){let R=this.point.events[C];if(R.segment.consumedBy===void 0)for(let H=C+1;H<w;H++){let z=this.point.events[H];z.consumedBy===void 0&&R.otherSE.point.events===z.otherSE.point.events&&R.segment.consume(z.segment)}}}getAvailableLinkedEvents(){let w=[];for(let C=0,R=this.point.events.length;C<R;C++){let H=this.point.events[C];H!==this&&!H.segment.ringOut&&H.segment.isInResult()&&w.push(H)}return w}getLeftmostComparator(w){let C=new Map,R=H=>{let z=H.otherSE;C.set(H,{sine:Xt(this.point,w.point,z.point),cosine:Ft(this.point,w.point,z.point)})};return(H,z)=>{C.has(H)||R(H),C.has(z)||R(z);let{sine:rt,cosine:j}=C.get(H),{sine:D,cosine:tt}=C.get(z);return rt>=0&&D>=0?j<tt?1:j>tt?-1:0:rt<0&&D<0?j<tt?-1:j>tt?1:0:D<rt?-1:D>rt?1:0}}}let rn=0;class Bt{static compare(w,C){let R=w.leftSE.point.x,H=C.leftSE.point.x,z=w.rightSE.point.x,rt=C.rightSE.point.x;if(rt<R)return 1;if(z<H)return-1;let j=w.leftSE.point.y,D=C.leftSE.point.y,tt=w.rightSE.point.y,Z=C.rightSE.point.y;if(R<H){if(D<j&&D<tt)return 1;if(D>j&&D>tt)return-1;let et=w.comparePoint(C.leftSE.point);if(et<0)return 1;if(et>0)return-1;let ot=C.comparePoint(w.rightSE.point);return ot!==0?ot:-1}if(R>H){if(j<D&&j<Z)return-1;if(j>D&&j>Z)return 1;let et=C.comparePoint(w.leftSE.point);if(et!==0)return et;let ot=w.comparePoint(C.rightSE.point);return ot<0?1:ot>0?-1:1}if(j<D)return-1;if(j>D)return 1;if(z<rt){let et=C.comparePoint(w.rightSE.point);if(et!==0)return et}if(z>rt){let et=w.comparePoint(C.rightSE.point);if(et<0)return 1;if(et>0)return-1}if(z!==rt){let et=tt-j,ot=z-R,Q=Z-D,St=rt-H;if(et>ot&&Q<St)return 1;if(et<ot&&Q>St)return-1}return z>rt?1:z<rt||tt<Z?-1:tt>Z?1:w.id<C.id?-1:w.id>C.id?1:0}constructor(w,C,R,H){this.id=++rn,this.leftSE=w,w.segment=this,w.otherSE=C,this.rightSE=C,C.segment=this,C.otherSE=w,this.rings=R,this.windings=H}static fromRing(w,C,R){let H,z,rt,j=it.comparePoints(w,C);if(j<0)H=w,z=C,rt=1;else if(j>0)H=C,z=w,rt=-1;else throw new Error(\`Tried to create degenerate segment at [\${w.x}, \${w.y}]\`);let D=new it(H,!0),tt=new it(z,!1);return new Bt(D,tt,[R],[rt])}replaceRightSE(w){this.rightSE=w,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let w=this.leftSE.point.y,C=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:w<C?w:C},ur:{x:this.rightSE.point.x,y:w>C?w:C}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(w){return w.x===this.leftSE.point.x&&w.y===this.leftSE.point.y||w.x===this.rightSE.point.x&&w.y===this.rightSE.point.y}comparePoint(w){if(this.isAnEndpoint(w))return 0;let C=this.leftSE.point,R=this.rightSE.point,H=this.vector();if(C.x===R.x)return w.x===C.x?0:w.x<C.x?1:-1;let z=(w.y-C.y)/H.y,rt=C.x+z*H.x;if(w.x===rt)return 0;let j=(w.x-C.x)/H.x,D=C.y+j*H.y;return w.y===D?0:w.y<D?-1:1}getIntersection(w){let C=this.bbox(),R=w.bbox(),H=x(C,R);if(H===null)return null;let z=this.leftSE.point,rt=this.rightSE.point,j=w.leftSE.point,D=w.rightSE.point,tt=T(C,j)&&this.comparePoint(j)===0,Z=T(R,z)&&w.comparePoint(z)===0,et=T(C,D)&&this.comparePoint(D)===0,ot=T(R,rt)&&w.comparePoint(rt)===0;if(Z&&tt)return ot&&!et?rt:!ot&&et?D:null;if(Z)return et&&z.x===D.x&&z.y===D.y?null:z;if(tt)return ot&&rt.x===j.x&&rt.y===j.y?null:j;if(ot&&et)return null;if(ot)return rt;if(et)return D;let Q=ee(z,this.vector(),j,w.vector());return Q===null||!T(H,Q)?null:G.round(Q.x,Q.y)}split(w){let C=[],R=w.events!==void 0,H=new it(w,!0),z=new it(w,!1),rt=this.rightSE;this.replaceRightSE(z),C.push(z),C.push(H);let j=new Bt(H,rt,this.rings.slice(),this.windings.slice());return it.comparePoints(j.leftSE.point,j.rightSE.point)>0&&j.swapEvents(),it.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),R&&(H.checkForConsuming(),z.checkForConsuming()),C}swapEvents(){let w=this.rightSE;this.rightSE=this.leftSE,this.leftSE=w,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let C=0,R=this.windings.length;C<R;C++)this.windings[C]*=-1}consume(w){let C=this,R=w;for(;C.consumedBy;)C=C.consumedBy;for(;R.consumedBy;)R=R.consumedBy;let H=Bt.compare(C,R);if(H!==0){if(H>0){let z=C;C=R,R=z}if(C.prev===R){let z=C;C=R,R=z}for(let z=0,rt=R.rings.length;z<rt;z++){let j=R.rings[z],D=R.windings[z],tt=C.rings.indexOf(j);tt===-1?(C.rings.push(j),C.windings.push(D)):C.windings[tt]+=D}R.rings=null,R.windings=null,R.consumedBy=C,R.leftSE.consumedBy=C.leftSE,R.rightSE.consumedBy=C.rightSE}}prevInResult(){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)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let w=this.prev.consumedBy||this.prev;this._beforeState=w.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let w=this.beforeState();this._afterState={rings:w.rings.slice(0),windings:w.windings.slice(0),multiPolys:[]};let C=this._afterState.rings,R=this._afterState.windings,H=this._afterState.multiPolys;for(let j=0,D=this.rings.length;j<D;j++){let tt=this.rings[j],Z=this.windings[j],et=C.indexOf(tt);et===-1?(C.push(tt),R.push(Z)):R[et]+=Z}let z=[],rt=[];for(let j=0,D=C.length;j<D;j++){if(R[j]===0)continue;let tt=C[j],Z=tt.poly;if(rt.indexOf(Z)===-1)if(tt.isExterior)z.push(Z);else{rt.indexOf(Z)===-1&&rt.push(Z);let et=z.indexOf(tt.poly);et!==-1&&z.splice(et,1)}}for(let j=0,D=z.length;j<D;j++){let tt=z[j].multiPoly;H.indexOf(tt)===-1&&H.push(tt)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let w=this.beforeState().multiPolys,C=this.afterState().multiPolys;switch(J.type){case"union":{let R=w.length===0,H=C.length===0;this._isInResult=R!==H;break}case"intersection":{let R,H;w.length<C.length?(R=w.length,H=C.length):(R=C.length,H=w.length),this._isInResult=H===J.numMultiPolys&&R<H;break}case"xor":{let R=Math.abs(w.length-C.length);this._isInResult=R%2===1;break}case"difference":{let R=H=>H.length===1&&H[0].isSubject;this._isInResult=R(w)!==R(C);break}default:throw new Error(\`Unrecognized operation type found \${J.type}\`)}return this._isInResult}}class Jt{constructor(w,C,R){if(!Array.isArray(w)||w.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=C,this.isExterior=R,this.segments=[],typeof w[0][0]!="number"||typeof w[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let H=G.round(w[0][0],w[0][1]);this.bbox={ll:{x:H.x,y:H.y},ur:{x:H.x,y:H.y}};let z=H;for(let rt=1,j=w.length;rt<j;rt++){if(typeof w[rt][0]!="number"||typeof w[rt][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let D=G.round(w[rt][0],w[rt][1]);D.x===z.x&&D.y===z.y||(this.segments.push(Bt.fromRing(z,D,this)),D.x<this.bbox.ll.x&&(this.bbox.ll.x=D.x),D.y<this.bbox.ll.y&&(this.bbox.ll.y=D.y),D.x>this.bbox.ur.x&&(this.bbox.ur.x=D.x),D.y>this.bbox.ur.y&&(this.bbox.ur.y=D.y),z=D)}(H.x!==z.x||H.y!==z.y)&&this.segments.push(Bt.fromRing(z,H,this))}getSweepEvents(){let w=[];for(let C=0,R=this.segments.length;C<R;C++){let H=this.segments[C];w.push(H.leftSE),w.push(H.rightSE)}return w}}class Yt{constructor(w,C){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Jt(w[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(let R=1,H=w.length;R<H;R++){let z=new Jt(w[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=C}getSweepEvents(){let w=this.exteriorRing.getSweepEvents();for(let C=0,R=this.interiorRings.length;C<R;C++){let H=this.interiorRings[C].getSweepEvents();for(let z=0,rt=H.length;z<rt;z++)w.push(H[z])}return w}}class pe{constructor(w,C){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof w[0][0][0]=="number"&&(w=[w])}catch(R){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let R=0,H=w.length;R<H;R++){let z=new Yt(w[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=C}getSweepEvents(){let w=[];for(let C=0,R=this.polys.length;C<R;C++){let H=this.polys[C].getSweepEvents();for(let z=0,rt=H.length;z<rt;z++)w.push(H[z])}return w}}class le{static factory(w){let C=[];for(let R=0,H=w.length;R<H;R++){let z=w[R];if(!z.isInResult()||z.ringOut)continue;let rt=null,j=z.leftSE,D=z.rightSE,tt=[j],Z=j.point,et=[];for(;rt=j,j=D,tt.push(j),j.point!==Z;)for(;;){let ot=j.getAvailableLinkedEvents();if(ot.length===0){let At=tt[0].point,ne=tt[tt.length-1].point;throw new Error(\`Unable to complete output ring starting at [\${At.x}, \${At.y}]. Last matching segment found ends at [\${ne.x}, \${ne.y}].\`)}if(ot.length===1){D=ot[0].otherSE;break}let Q=null;for(let At=0,ne=et.length;At<ne;At++)if(et[At].point===j.point){Q=At;break}if(Q!==null){let At=et.splice(Q)[0],ne=tt.splice(At.index);ne.unshift(ne[0].otherSE),C.push(new le(ne.reverse()));continue}et.push({index:tt.length,point:j.point});let St=j.getLeftmostComparator(rt);D=ot.sort(St)[0].otherSE;break}C.push(new le(tt))}return C}constructor(w){this.events=w;for(let C=0,R=w.length;C<R;C++)w[C].segment.ringOut=this;this.poly=null}getGeom(){let w=this.events[0].point,C=[w];for(let tt=1,Z=this.events.length-1;tt<Z;tt++){let et=this.events[tt].point,ot=this.events[tt+1].point;Lt(et,w,ot)!==0&&(C.push(et),w=et)}if(C.length===1)return null;let R=C[0],H=C[1];Lt(R,w,H)===0&&C.shift(),C.push(C[0]);let z=this.isExteriorRing()?1:-1,rt=this.isExteriorRing()?0:C.length-1,j=this.isExteriorRing()?C.length:-1,D=[];for(let tt=rt;tt!=j;tt+=z)D.push([C[tt].x,C[tt].y]);return D}isExteriorRing(){if(this._isExteriorRing===void 0){let w=this.enclosingRing();this._isExteriorRing=w?!w.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let w=this.events[0];for(let H=1,z=this.events.length;H<z;H++){let rt=this.events[H];it.compare(w,rt)>0&&(w=rt)}let C=w.segment.prevInResult(),R=C?C.prevInResult():null;for(;;){if(!C)return null;if(!R)return C.ringOut;if(R.ringOut!==C.ringOut)return R.ringOut.enclosingRing()!==C.ringOut?C.ringOut:C.ringOut.enclosingRing();C=R.prevInResult(),R=C?C.prevInResult():null}}}class Pt{constructor(w){this.exteriorRing=w,w.poly=this,this.interiorRings=[]}addInterior(w){this.interiorRings.push(w),w.poly=this}getGeom(){let w=[this.exteriorRing.getGeom()];if(w[0]===null)return null;for(let C=0,R=this.interiorRings.length;C<R;C++){let H=this.interiorRings[C].getGeom();H!==null&&w.push(H)}return w}}class te{constructor(w){this.rings=w,this.polys=this._composePolys(w)}getGeom(){let w=[];for(let C=0,R=this.polys.length;C<R;C++){let H=this.polys[C].getGeom();H!==null&&w.push(H)}return w}_composePolys(w){let C=[];for(let R=0,H=w.length;R<H;R++){let z=w[R];if(!z.poly)if(z.isExteriorRing())C.push(new Pt(z));else{let rt=z.enclosingRing();rt.poly||C.push(new Pt(rt)),rt.poly.addInterior(z)}}return C}}class yn{constructor(w){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Bt.compare;this.queue=w,this.tree=new p(C),this.segments=[]}process(w){let C=w.segment,R=[];if(w.consumedBy)return w.isLeft?this.queue.remove(w.otherSE):this.tree.remove(C),R;let H=w.isLeft?this.tree.add(C):this.tree.find(C);if(!H)throw new Error(\`Unable to find segment #\${C.id} [\${C.leftSE.point.x}, \${C.leftSE.point.y}] -> [\${C.rightSE.point.x}, \${C.rightSE.point.y}] in SweepLine tree.\`);let z=H,rt=H,j,D;for(;j===void 0;)z=this.tree.prev(z),z===null?j=null:z.key.consumedBy===void 0&&(j=z.key);for(;D===void 0;)rt=this.tree.next(rt),rt===null?D=null:rt.key.consumedBy===void 0&&(D=rt.key);if(w.isLeft){let tt=null;if(j){let et=j.getIntersection(C);if(et!==null&&(C.isAnEndpoint(et)||(tt=et),!j.isAnEndpoint(et))){let ot=this._splitSafely(j,et);for(let Q=0,St=ot.length;Q<St;Q++)R.push(ot[Q])}}let Z=null;if(D){let et=D.getIntersection(C);if(et!==null&&(C.isAnEndpoint(et)||(Z=et),!D.isAnEndpoint(et))){let ot=this._splitSafely(D,et);for(let Q=0,St=ot.length;Q<St;Q++)R.push(ot[Q])}}if(tt!==null||Z!==null){let et=null;tt===null?et=Z:Z===null?et=tt:et=it.comparePoints(tt,Z)<=0?tt:Z,this.queue.remove(C.rightSE),R.push(C.rightSE);let ot=C.split(et);for(let Q=0,St=ot.length;Q<St;Q++)R.push(ot[Q])}R.length>0?(this.tree.remove(C),R.push(w)):(this.segments.push(C),C.prev=j)}else{if(j&&D){let tt=j.getIntersection(D);if(tt!==null){if(!j.isAnEndpoint(tt)){let Z=this._splitSafely(j,tt);for(let et=0,ot=Z.length;et<ot;et++)R.push(Z[et])}if(!D.isAnEndpoint(tt)){let Z=this._splitSafely(D,tt);for(let et=0,ot=Z.length;et<ot;et++)R.push(Z[et])}}}this.tree.remove(C)}return R}_splitSafely(w,C){this.tree.remove(w);let R=w.rightSE;this.queue.remove(R);let H=w.split(C);return H.push(R),w.consumedBy===void 0&&this.tree.add(w),H}}let pn=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,X=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class F{run(w,C,R){J.type=w,G.reset();let H=[new pe(C,!0)];for(let et=0,ot=R.length;et<ot;et++)H.push(new pe(R[et],!1));if(J.numMultiPolys=H.length,J.type==="difference"){let et=H[0],ot=1;for(;ot<H.length;)x(H[ot].bbox,et.bbox)!==null?ot++:H.splice(ot,1)}if(J.type==="intersection")for(let et=0,ot=H.length;et<ot;et++){let Q=H[et];for(let St=et+1,At=H.length;St<At;St++)if(x(Q.bbox,H[St].bbox)===null)return[]}let z=new p(it.compare);for(let et=0,ot=H.length;et<ot;et++){let Q=H[et].getSweepEvents();for(let St=0,At=Q.length;St<At;St++)if(z.insert(Q[St]),z.size>pn)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let rt=new yn(z),j=z.size,D=z.pop();for(;D;){let et=D.key;if(z.size===j){let Q=et.segment;throw new Error(\`Unable to pop() \${et.isLeft?"left":"right"} SweepEvent [\${et.point.x}, \${et.point.y}] from segment #\${Q.id} [\${Q.leftSE.point.x}, \${Q.leftSE.point.y}] -> [\${Q.rightSE.point.x}, \${Q.rightSE.point.y}] from queue.\`)}if(z.size>pn)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(rt.segments.length>X)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let ot=rt.process(et);for(let Q=0,St=ot.length;Q<St;Q++){let At=ot[Q];At.consumedBy===void 0&&z.insert(At)}j=z.size,D=z.pop()}G.reset();let tt=le.factory(rt.segments);return new te(tt).getGeom()}}let J=new F;var Dt={union:function(Y){for(var w=arguments.length,C=new Array(w>1?w-1:0),R=1;R<w;R++)C[R-1]=arguments[R];return J.run("union",Y,C)},intersection:function(Y){for(var w=arguments.length,C=new Array(w>1?w-1:0),R=1;R<w;R++)C[R-1]=arguments[R];return J.run("intersection",Y,C)},xor:function(Y){for(var w=arguments.length,C=new Array(w>1?w-1:0),R=1;R<w;R++)C[R-1]=arguments[R];return J.run("xor",Y,C)},difference:function(Y){for(var w=arguments.length,C=new Array(w>1?w-1:0),R=1;R<w;R++)C[R-1]=arguments[R];return J.run("difference",Y,C)}};return Dt})});var u1=Ht((ah,a1)=>{(function(r,t){typeof ah=="object"&&typeof a1!="undefined"?t(ah):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(ah,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?mn: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 j&&this.addAll(arguments[0])}function b(){}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 P=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),S=function(){},L={MAX_VALUE:{configurable:!0}};S.isNaN=function(n){return Number.isNaN(n)},S.doubleToLongBits=function(n){return n},S.longBitsToDouble=function(n){return n},S.isInfinite=function(n){return!Number.isFinite(n)},L.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(S,L);var N=function(){},G=function(){},B=function(){},I=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])},O={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};I.prototype.setOrdinate=function(n,i){switch(n){case I.X:this.x=i;break;case I.Y:this.y=i;break;case I.Z:this.z=i;break;default:throw new P("Invalid ordinate index: "+n)}},I.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)}},I.prototype.getOrdinate=function(n){switch(n){case I.X:return this.x;case I.Y:return this.y;case I.Z:return this.z}throw new P("Invalid ordinate index: "+n)},I.prototype.equals3D=function(n){return this.x===n.x&&this.y===n.y&&(this.z===n.z||S.isNaN(this.z))&&S.isNaN(n.z)},I.prototype.equals=function(n){return n instanceof I&&this.equals2D(n)},I.prototype.equalInZ=function(n,i){return v.equalsWithTolerance(this.z,n.z,i)},I.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},I.prototype.clone=function(){},I.prototype.copy=function(){return new I(this)},I.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},I.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)},I.prototype.distance=function(n){var i=this.x-n.x,s=this.y-n.y;return Math.sqrt(i*i+s*s)},I.prototype.hashCode=function(){var n=17;return n=37*n+I.hashCode(this.x),n=37*n+I.hashCode(this.y)},I.prototype.setCoordinate=function(n){this.x=n.x,this.y=n.y,this.z=n.z},I.prototype.interfaces_=function(){return[N,G,t]},I.prototype.getClass=function(){return I},I.hashCode=function(){if(arguments.length===1){var n=arguments[0],i=S.doubleToLongBits(n);return Math.trunc((i^i)>>>32)}},O.DimensionalComparator.get=function(){return q},O.serialVersionUID.get=function(){return 6683108902428367e3},O.NULL_ORDINATE.get=function(){return S.NaN},O.X.get=function(){return 0},O.Y.get=function(){return 1},O.Z.get=function(){return 2},Object.defineProperties(I,O);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 P("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[B]},q.prototype.getClass=function(){return q},q.compare=function(n,i){return n<i?-1:n>i?1:S.isNaN(n)?S.isNaN(i)?0:-1:S.isNaN(i)?1:0};var st=function(){};st.prototype.create=function(){},st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st};var V=function(){},Mt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};V.prototype.interfaces_=function(){return[]},V.prototype.getClass=function(){return V},V.toLocationSymbol=function(n){switch(n){case V.EXTERIOR:return"e";case V.BOUNDARY:return"b";case V.INTERIOR:return"i";case V.NONE:return"-"}throw new P("Unknown location value: "+n)},Mt.INTERIOR.get=function(){return 0},Mt.BOUNDARY.get=function(){return 1},Mt.EXTERIOR.get=function(){return 2},Mt.NONE.get=function(){return-1},Object.defineProperties(V,Mt);var $=function(n,i){return n.interfaces_&&n.interfaces_().indexOf(i)>-1},ut=function(){},xt={LOG_10:{configurable:!0}};ut.prototype.interfaces_=function(){return[]},ut.prototype.getClass=function(){return ut},ut.log10=function(n){var i=Math.log(n);return S.isInfinite(i)||S.isNaN(i)?i:i/ut.LOG_10},ut.min=function(n,i,s,u){var c=n;return i<c&&(c=i),s<c&&(c=s),u<c&&(c=u),c},ut.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}},ut.wrap=function(n,i){return n<0?i- -n%i:n%i},ut.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}},ut.average=function(n,i){return(n+i)/2},xt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(ut,xt);var mt=function(n){this.str=n};mt.prototype.append=function(n){this.str+=n},mt.prototype.setCharAt=function(n,i){this.str=this.str.substr(0,n)+i+this.str.substr(n+1)},mt.prototype.toString=function(n){return this.str};var lt=function(n){this.value=n};lt.prototype.intValue=function(){return this.value},lt.prototype.compareTo=function(n){return this.value<n?-1:this.value>n?1:0},lt.isNaN=function(n){return Number.isNaN(n)};var ht=function(){};ht.isWhitespace=function(n){return n<=32&&n>=0||n===127},ht.toUpperCase=function(n){return n.toUpperCase()};var k=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)}},nt={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}};k.prototype.le=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<=n._lo},k.prototype.extractSignificantDigits=function(n,i){var s=this.abs(),u=k.magnitude(s._hi),c=k.TEN.pow(u);(s=s.divide(c)).gt(k.TEN)?(s=s.divide(k.TEN),u+=1):s.lt(k.ONE)&&(s=s.multiply(k.TEN),u-=1);for(var m=u+1,E=new mt,A=k.MAX_PRINT_DIGITS-1,U=0;U<=A;U++){n&&U===m&&E.append(".");var K=Math.trunc(s._hi);if(K<0)break;var pt=!1,dt=0;K>9?(pt=!0,dt="9"):dt="0"+K,E.append(dt),s=s.subtract(k.valueOf(K)).multiply(k.TEN),pt&&s.selfAdd(k.TEN);var Rt=!0,Ot=k.magnitude(s._hi);if(Ot<0&&Math.abs(Ot)>=A-U&&(Rt=!1),!Rt)break}return i[0]=u,E.toString()},k.prototype.sqr=function(){return this.multiply(this)},k.prototype.doubleValue=function(){return this._hi+this._lo},k.prototype.subtract=function(){if(arguments[0]instanceof k){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},k.prototype.equals=function(){if(arguments.length===1){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}},k.prototype.isZero=function(){return this._hi===0&&this._lo===0},k.prototype.selfSubtract=function(){if(arguments[0]instanceof k){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)}},k.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},k.prototype.min=function(n){return this.le(n)?this:n},k.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof k){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,K=null,pt=null,dt=null;return U=this._hi/s,K=k.SPLIT*U,c=K-U,dt=k.SPLIT*s,c=K-c,m=U-c,E=dt-s,pt=U*s,E=dt-E,A=s-E,dt=c*E-pt+c*A+m*E+m*A,K=(this._hi-pt-dt+this._lo-U*u)/s,dt=U+K,this._hi=dt,this._lo=U-dt+K,this}},k.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},k.prototype.divide=function(){if(arguments[0]instanceof k){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=k.SPLIT*m)-(i=E-m)),U=i*(u=(U=k.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 k(U=m+E,m-U+E)}if(typeof arguments[0]=="number"){var K=arguments[0];return S.isNaN(K)?k.createNaN():k.copy(this).selfDivide(K,0)}},k.prototype.ge=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>=n._lo},k.prototype.pow=function(n){if(n===0)return k.valueOf(1);var i=new k(this),s=k.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},k.prototype.ceil=function(){if(this.isNaN())return k.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new k(n,i)},k.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},k.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},k.prototype.setValue=function(){if(arguments[0]instanceof k){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},k.prototype.max=function(n){return this.ge(n)?this:n},k.prototype.sqrt=function(){if(this.isZero())return k.valueOf(0);if(this.isNegative())return k.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,s=k.valueOf(i),u=this.subtract(s.sqr())._hi*(.5*n);return s.add(u)},k.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof k){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],K=arguments[1],pt=null,dt=null,Rt=null,Ot=null,Vt=null,jt=null,sn=null;Ot=this._hi+U,dt=this._lo+K,Vt=Ot-(jt=Ot-this._hi),Rt=dt-(sn=dt-this._lo);var kn=(pt=Ot+(jt=(Vt=U-jt+(this._hi-Vt))+dt))+(jt=(Rt=K-sn+(this._lo-Rt))+(jt+(Ot-pt))),Mr=jt+(pt-kn);return this._hi=kn,this._lo=Mr,this}},k.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof k){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,K=null;c=(U=k.SPLIT*this._hi)-this._hi,K=k.SPLIT*s,c=U-c,m=this._hi-c,E=K-s;var pt=(U=this._hi*s)+(K=c*(E=K-E)-U+c*(A=s-E)+m*E+m*A+(this._hi*u+this._lo*s)),dt=K+(c=U-pt);return this._hi=pt,this._lo=dt,this}},k.prototype.selfSqr=function(){return this.selfMultiply(this)},k.prototype.floor=function(){if(this.isNaN())return k.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new k(n,i)},k.prototype.negate=function(){return this.isNaN()?this:new k(-this._hi,-this._lo)},k.prototype.clone=function(){},k.prototype.multiply=function(){if(arguments[0]instanceof k){var n=arguments[0];return n.isNaN()?k.createNaN():k.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return S.isNaN(i)?k.createNaN():k.copy(this).selfMultiply(i,0)}},k.prototype.isNaN=function(){return S.isNaN(this._hi)},k.prototype.intValue=function(){return Math.trunc(this._hi)},k.prototype.toString=function(){var n=k.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()},k.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."+k.stringOfChar("0",-u)+s;else if(s.indexOf(".")===-1){var m=u-s.length;c=s+k.stringOfChar("0",m)+".0"}return this.isNegative()?"-"+c:c},k.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=k.SPLIT*c)-(n=m-c)),s=(A=k.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 k(U,c-U+m)},k.prototype.toSciNotation=function(){if(this.isZero())return k.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=k.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},k.prototype.abs=function(){return this.isNaN()?k.NaN:this.isNegative()?this.negate():new k(this)},k.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},k.prototype.lt=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<n._lo},k.prototype.add=function(){if(arguments[0]instanceof k){var n=arguments[0];return k.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return k.copy(this).selfAdd(i)}},k.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 k){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}},k.prototype.gt=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>n._lo},k.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},k.prototype.trunc=function(){return this.isNaN()?k.NaN:this.isPositive()?this.floor():this.ceil()},k.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},k.prototype.interfaces_=function(){return[t,N,G]},k.prototype.getClass=function(){return k},k.sqr=function(n){return k.valueOf(n).selfMultiply(n)},k.valueOf=function(){if(typeof arguments[0]=="string"){var n=arguments[0];return k.parse(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return new k(i)}},k.sqrt=function(n){return k.valueOf(n).sqrt()},k.parse=function(n){for(var i=0,s=n.length;ht.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 k,E=0,A=0,U=0;!(i>=s);){var K=n.charAt(i);if(i++,ht.isDigit(K)){var pt=K-"0";m.selfMultiply(k.TEN),m.selfAdd(pt),E++}else{if(K!=="."){if(K==="e"||K==="E"){var dt=n.substring(i);try{U=lt.parseInt(dt)}catch(sn){throw sn instanceof Error?new Error("Invalid exponent "+dt+" in string "+n):sn}break}throw new Error("Unexpected character '"+K+"' at position "+i+" in string "+n)}A=E}}var Rt=m,Ot=E-A-U;if(Ot===0)Rt=m;else if(Ot>0){var Vt=k.TEN.pow(Ot);Rt=m.divide(Vt)}else if(Ot<0){var jt=k.TEN.pow(-Ot);Rt=m.multiply(jt)}return u?Rt.negate():Rt},k.createNaN=function(){return new k(S.NaN,S.NaN)},k.copy=function(n){return new k(n)},k.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},k.stringOfChar=function(n,i){for(var s=new mt,u=0;u<i;u++)s.append(n);return s.toString()},nt.PI.get=function(){return new k(3.141592653589793,12246467991473532e-32)},nt.TWO_PI.get=function(){return new k(6.283185307179586,24492935982947064e-32)},nt.PI_2.get=function(){return new k(1.5707963267948966,6123233995736766e-32)},nt.E.get=function(){return new k(2.718281828459045,14456468917292502e-32)},nt.NaN.get=function(){return new k(S.NaN,S.NaN)},nt.EPS.get=function(){return 123259516440783e-46},nt.SPLIT.get=function(){return 134217729},nt.MAX_PRINT_DIGITS.get=function(){return 32},nt.TEN.get=function(){return k.valueOf(10)},nt.ONE.get=function(){return k.valueOf(1)},nt.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},nt.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(k,nt);var ft=function(){},Tt={DP_SAFE_EPSILON:{configurable:!0}};ft.prototype.interfaces_=function(){return[]},ft.prototype.getClass=function(){return ft},ft.orientationIndex=function(n,i,s){var u=ft.orientationIndexFilter(n,i,s);if(u<=1)return u;var c=k.valueOf(i.x).selfAdd(-n.x),m=k.valueOf(i.y).selfAdd(-n.y),E=k.valueOf(s.x).selfAdd(-i.x),A=k.valueOf(s.y).selfAdd(-i.y);return c.selfMultiply(A).selfSubtract(m.selfMultiply(E)).signum()},ft.signOfDet2x2=function(n,i,s,u){return n.multiply(u).selfSubtract(i.multiply(s)).signum()},ft.intersection=function(n,i,s,u){var c=k.valueOf(u.y).selfSubtract(s.y).selfMultiply(k.valueOf(i.x).selfSubtract(n.x)),m=k.valueOf(u.x).selfSubtract(s.x).selfMultiply(k.valueOf(i.y).selfSubtract(n.y)),E=c.subtract(m),A=k.valueOf(u.x).selfSubtract(s.x).selfMultiply(k.valueOf(n.y).selfSubtract(s.y)),U=k.valueOf(u.y).selfSubtract(s.y).selfMultiply(k.valueOf(n.x).selfSubtract(s.x)),K=A.subtract(U).selfDivide(E).doubleValue(),pt=k.valueOf(n.x).selfAdd(k.valueOf(i.x).selfSubtract(n.x).selfMultiply(K)).doubleValue(),dt=k.valueOf(i.x).selfSubtract(n.x).selfMultiply(k.valueOf(n.y).selfSubtract(s.y)),Rt=k.valueOf(i.y).selfSubtract(n.y).selfMultiply(k.valueOf(n.x).selfSubtract(s.x)),Ot=dt.subtract(Rt).selfDivide(E).doubleValue(),Vt=k.valueOf(s.y).selfAdd(k.valueOf(u.y).selfSubtract(s.y).selfMultiply(Ot)).doubleValue();return new I(pt,Vt)},ft.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 ft.signum(E);u=c+m}else{if(!(c<0)||m>=0)return ft.signum(E);u=-c-m}var A=ft.DP_SAFE_EPSILON*u;return E>=A||-E>=A?ft.signum(E):2},ft.signum=function(n){return n>0?1:n<0?-1:0},Tt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(ft,Tt);var gt=function(){},Lt={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Lt.X.get=function(){return 0},Lt.Y.get=function(){return 1},Lt.Z.get=function(){return 2},Lt.M.get=function(){return 3},gt.prototype.setOrdinate=function(n,i,s){},gt.prototype.size=function(){},gt.prototype.getOrdinate=function(n,i){},gt.prototype.getCoordinate=function(){},gt.prototype.getCoordinateCopy=function(n){},gt.prototype.getDimension=function(){},gt.prototype.getX=function(n){},gt.prototype.clone=function(){},gt.prototype.expandEnvelope=function(n){},gt.prototype.copy=function(){},gt.prototype.getY=function(n){},gt.prototype.toCoordinateArray=function(){},gt.prototype.interfaces_=function(){return[G]},gt.prototype.getClass=function(){return gt},Object.defineProperties(gt,Lt);var qt=function(){},Xt=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}(qt),Ft=function(){};Ft.arraycopy=function(n,i,s,u,c){for(var m=0,E=i;E<i+c;E++)s[u+m]=n[E],m++},Ft.getProperty=function(n){return{"line.separator":\`
|
|
3836
3707
|
\`}[n]};var Qt=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 I&&arguments[1]instanceof I){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],K=arguments[1],pt=arguments[2];this.x=U,this.y=K,this.w=pt}else if(arguments.length===4){var dt=arguments[0],Rt=arguments[1],Ot=arguments[2],Vt=arguments[3],jt=dt.y-Rt.y,sn=Rt.x-dt.x,kn=dt.x*Rt.y-Rt.x*dt.y,Mr=Ot.y-Vt.y,Ki=Vt.x-Ot.x,Uo=Ot.x*Vt.y-Vt.x*Ot.y;this.x=sn*Uo-Ki*kn,this.y=Mr*kn-jt*Uo,this.w=jt*Ki-Mr*sn}};Qt.prototype.getY=function(){var n=this.y/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new Xt;return n},Qt.prototype.getX=function(){var n=this.x/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new Xt;return n},Qt.prototype.getCoordinate=function(){var n=new I;return n.x=this.getX(),n.y=this.getY(),n},Qt.prototype.interfaces_=function(){return[]},Qt.prototype.getClass=function(){return Qt},Qt.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,K=s.x*u.y-u.x*s.y,pt=c*U-A*m,dt=(m*K-U*E)/pt,Rt=(A*E-c*K)/pt;if(S.isNaN(dt)||S.isInfinite(dt)||S.isNaN(Rt)||S.isInfinite(Rt))throw new Xt;return new I(dt,Rt)};var Ct=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 I){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)}},ee={serialVersionUID:{configurable:!0}};Ct.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Ct.prototype.equals=function(n){if(!(n instanceof Ct))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()},Ct.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new Ct;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 Ct(i,u,s,c)},Ct.prototype.isNull=function(){return this._maxx<this._minx},Ct.prototype.getMaxX=function(){return this._maxx},Ct.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof Ct){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}},Ct.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Ct){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 I){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)}},Ct.prototype.getMinY=function(){return this._miny},Ct.prototype.getMinX=function(){return this._minx},Ct.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof Ct){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))}},Ct.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},Ct.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Ct.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},Ct.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},Ct.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Ct.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Ct.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Ct.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},Ct.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()}},Ct.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Ct){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof I){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)}},Ct.prototype.centre=function(){return this.isNull()?null:new I((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Ct.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof Ct){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)}},Ct.prototype.getMaxY=function(){return this._maxy},Ct.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)},Ct.prototype.hashCode=function(){var n=17;return n=37*n+I.hashCode(this._minx),n=37*n+I.hashCode(this._maxx),n=37*n+I.hashCode(this._miny),n=37*n+I.hashCode(this._maxy)},Ct.prototype.interfaces_=function(){return[N,t]},Ct.prototype.getClass=function(){return Ct},Ct.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),K=Math.min(u.x,c.x),pt=Math.max(u.x,c.x);return!(K>U)&&!(pt<A)&&(A=Math.min(m.y,E.y),U=Math.max(m.y,E.y),K=Math.min(u.y,c.y),pt=Math.max(u.y,c.y),!(K>U)&&!(pt<A))}},ee.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Ct,ee);var it={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*$/},rn=function(n){this.geometryFactory=n||new ue};rn.prototype.read=function(n){var i,s,u;n=n.replace(/[\\n\\r]/g," ");var c=it.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((c=it.emptyTypeStr.exec(n))[2]=void 0),c&&(s=c[1].toLowerCase(),u=c[2],Jt[s]&&(i=Jt[s].apply(this,[u]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},rn.prototype.write=function(n){return this.extractGeometry(n)},rn.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!Bt[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+Bt[i].apply(this,[n])+")"};var Bt={coordinate:function(n){return n.x+" "+n.y},point:function(n){return Bt.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Bt.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(Bt.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(Bt.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("("+Bt.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+Bt.linestring.apply(this,[n._shell])+")");for(var s=0,u=n._holes.length;s<u;++s)i.push("("+Bt.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("("+Bt.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(",")}},Jt={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(it.spaces);return this.geometryFactory.createPoint(new I(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(it.trimParens,"$1"),u.push(Jt.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(it.spaces),u.push(new I(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(it.spaces),u.push(new I(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(it.parenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(it.trimParens,"$1"),u.push(Jt.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(it.parenComma),E=[],A=0,U=m.length;A<U;++A)i=m[A].replace(it.trimParens,"$1"),s=Jt.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(it.doubleParenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(it.trimParens,"$1"),u.push(Jt.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)}},Yt=function(n){this.parser=new rn(n)};Yt.prototype.write=function(n){return this.parser.write(n)},Yt.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var pe=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),le=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}(pe),Pt=function(){};Pt.prototype.interfaces_=function(){return[]},Pt.prototype.getClass=function(){return Pt},Pt.shouldNeverReachHere=function(){if(arguments.length===0)Pt.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new le("Should never reach here"+(n!==null?": "+n:""))}},Pt.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],Pt.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new le:new le(i)},Pt.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],Pt.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new le("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var te=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 I,this._intPt[1]=new I,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},yn={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};te.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},te.prototype.getTopologySummary=function(){var n=new mt;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},te.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)},te.prototype.getIntersectionNum=function(){return this._result},te.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)}},te.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},te.prototype.setPrecisionModel=function(n){this._precisionModel=n},te.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}},te.prototype.getIntersection=function(n){return this._intPt[n]},te.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},te.prototype.hasIntersection=function(){return this._result!==te.NO_INTERSECTION},te.prototype.getEdgeDistance=function(n,i){return te.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},te.prototype.isCollinear=function(){return this._result===te.COLLINEAR_INTERSECTION},te.prototype.toString=function(){return Yt.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Yt.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},te.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},te.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},te.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},te.prototype.interfaces_=function(){return[]},te.prototype.getClass=function(){return te},te.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 Pt.isTrue(!(m===0&&!n.equals(i)),"Bad distance calculation"),m},te.nonRobustComputeEdgeDistance=function(n,i,s){var u=n.x-i.x,c=n.y-i.y,m=Math.sqrt(u*u+c*c);return Pt.isTrue(!(m===0&&!n.equals(i)),"Invalid distance calculation"),m},yn.DONT_INTERSECT.get=function(){return 0},yn.DO_INTERSECT.get=function(){return 1},yn.COLLINEAR.get=function(){return 2},yn.NO_INTERSECTION.get=function(){return 0},yn.POINT_INTERSECTION.get=function(){return 1},yn.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(te,yn);var pn=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 Ct(this._inputLines[0][0],this._inputLines[0][1]),c=new Ct(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,Ct.intersects(u,c,s)&&J.orientationIndex(u,c,s)===0&&J.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=Qt.intersection(s,u,c,m)}catch(A){if(!(A instanceof Xt))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 I(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=ft.intersection(s,u,c,m),U=this.isInSegmentEnvelopes(A);Ft.out.println("DD in env = "+U+" --------------------- "+A),E.distance(A)>1e-4&&Ft.out.println("Distance = "+E.distance(A))},i.prototype.intersectionWithNormalization=function(s,u,c,m){var E=new I(s),A=new I(u),U=new I(c),K=new I(m),pt=new I;this.normalizeToEnvCentre(E,A,U,K,pt);var dt=this.safeHCoordinateIntersection(E,A,U,K);return dt.x+=pt.x,dt.y+=pt.y,dt},i.prototype.computeCollinearIntersection=function(s,u,c,m){var E=Ct.intersects(s,u,c),A=Ct.intersects(s,u,m),U=Ct.intersects(c,m,s),K=Ct.intersects(c,m,u);return E&&A?(this._intPt[0]=c,this._intPt[1]=m,n.COLLINEAR_INTERSECTION):U&&K?(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||K?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):E&&K?(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||K?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&K?(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,K=s.x>u.x?s.x:u.x,pt=s.y>u.y?s.y:u.y,dt=c.x<m.x?c.x:m.x,Rt=c.y<m.y?c.y:m.y,Ot=c.x>m.x?c.x:m.x,Vt=c.y>m.y?c.y:m.y,jt=((A>dt?A:dt)+(K<Ot?K:Ot))/2,sn=((U>Rt?U:Rt)+(pt<Vt?pt:Vt))/2;E.x=jt,E.y=sn,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,!Ct.intersects(s,u,c,m))return n.NO_INTERSECTION;var E=J.orientationIndex(s,u,c),A=J.orientationIndex(s,u,m);if(E>0&&A>0||E<0&&A<0)return n.NO_INTERSECTION;var U=J.orientationIndex(c,m,s),K=J.orientationIndex(c,m,u);return U>0&&K>0||U<0&&K<0?n.NO_INTERSECTION:E===0&&A===0&&U===0&&K===0?this.computeCollinearIntersection(s,u,c,m):(E===0||A===0||U===0||K===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 I(c):A===0?this._intPt[0]=new I(m):U===0?this._intPt[0]=new I(s):K===0&&(this._intPt[0]=new I(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=J.distancePointLine(s,c,m),U=J.distancePointLine(u,c,m);return U<A&&(A=U,E=u),(U=J.distancePointLine(c,s,u))<A&&(A=U,E=c),(U=J.distancePointLine(m,s,u))<A&&(A=U,E=m),E},i}(te),X=function(){};X.prototype.interfaces_=function(){return[]},X.prototype.getClass=function(){return X},X.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 X.signOfDet2x2(u,c,m,E)},X.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 F=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};F.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=X.signOfDet2x2(c,m,E,A);if(U===0)return this._isPointOnSegment=!0,null;A<m&&(U=-U),U>0&&this._crossingCount++}},F.prototype.isPointInPolygon=function(){return this.getLocation()!==V.EXTERIOR},F.prototype.getLocation=function(){return this._isPointOnSegment?V.BOUNDARY:this._crossingCount%2==1?V.INTERIOR:V.EXTERIOR},F.prototype.isOnSegment=function(){return this._isPointOnSegment},F.prototype.interfaces_=function(){return[]},F.prototype.getClass=function(){return F},F.locatePointInRing=function(){if(arguments[0]instanceof I&&$(arguments[1],gt)){for(var n=arguments[0],i=arguments[1],s=new F(n),u=new I,c=new I,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 I&&arguments[1]instanceof Array){for(var E=arguments[0],A=arguments[1],U=new F(E),K=1;K<A.length;K++){var pt=A[K],dt=A[K-1];if(U.countSegment(pt,dt),U.isOnSegment())return U.getLocation()}return U.getLocation()}};var J=function(){},It={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};J.prototype.interfaces_=function(){return[]},J.prototype.getClass=function(){return J},J.orientationIndex=function(n,i,s){return ft.orientationIndex(n,i,s)},J.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($(arguments[0],gt)){var E=arguments[0],A=E.size();if(A<3)return 0;var U=new I,K=new I,pt=new I;E.getCoordinate(0,K),E.getCoordinate(1,pt);var dt=K.x;pt.x-=dt;for(var Rt=0,Ot=1;Ot<A-1;Ot++)U.y=K.y,K.x=pt.x,K.y=pt.y,E.getCoordinate(Ot+1,pt),pt.x-=dt,Rt+=K.x*(U.y-pt.y);return Rt/2}},J.distanceLineLine=function(n,i,s,u){if(n.equals(i))return J.distancePointLine(n,s,u);if(s.equals(u))return J.distancePointLine(u,n,i);var c=!1;if(Ct.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?ut.min(J.distancePointLine(n,s,u),J.distancePointLine(i,s,u),J.distancePointLine(s,n,i),J.distancePointLine(u,n,i)):0},J.isPointInRing=function(n,i){return J.locatePointInRing(n,i)!==V.EXTERIOR},J.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,u=new I;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,K=A-c,pt=U-m;s+=Math.sqrt(K*K+pt*pt),c=A,m=U}return s},J.isCCW=function(n){var i=n.length-1;if(i<3)throw new P("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],K=n[A];if(U.equals2D(s)||K.equals2D(s)||U.equals2D(K))return!1;var pt=J.computeOrientation(U,s,K),dt=!1;return dt=pt===0?U.x>K.x:pt>0,dt},J.locatePointInRing=function(n,i){return F.locatePointInRing(n,i)},J.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)},J.computeOrientation=function(n,i,s){return J.orientationIndex(n,i,s)},J.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new P("Line array must contain at least one vertex");for(var s=n.distance(i[0]),u=0;u<i.length-1;u++){var c=J.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),K=((m.x-E.x)*(A.x-E.x)+(m.y-E.y)*(A.y-E.y))/U;if(K<=0)return m.distance(E);if(K>=1)return m.distance(A);var pt=((E.y-m.y)*(A.x-E.x)-(E.x-m.x)*(A.y-E.y))/U;return Math.abs(pt)*Math.sqrt(U)}},J.isOnLine=function(n,i){for(var s=new pn,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},It.CLOCKWISE.get=function(){return-1},It.RIGHT.get=function(){return J.CLOCKWISE},It.COUNTERCLOCKWISE.get=function(){return 1},It.LEFT.get=function(){return J.COUNTERCLOCKWISE},It.COLLINEAR.get=function(){return 0},It.STRAIGHT.get=function(){return J.COLLINEAR},Object.defineProperties(J,It);var wt=function(){};wt.prototype.filter=function(n){},wt.prototype.interfaces_=function(){return[]},wt.prototype.getClass=function(){return wt};var yt=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},$t={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}};yt.prototype.isGeometryCollection=function(){return this.getSortIndex()===yt.SORTINDEX_GEOMETRYCOLLECTION},yt.prototype.getFactory=function(){return this._factory},yt.prototype.getGeometryN=function(n){return this},yt.prototype.getArea=function(){return 0},yt.prototype.isRectangle=function(){return!1},yt.prototype.equals=function(){if(arguments[0]instanceof yt){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof yt))return!1;var s=i;return this.equalsExact(s)}},yt.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},yt.prototype.geometryChanged=function(){this.apply(yt.geometryChangedFilter)},yt.prototype.geometryChangedAction=function(){this._envelope=null},yt.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},yt.prototype.getLength=function(){return 0},yt.prototype.getNumGeometries=function(){return 1},yt.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)}},yt.prototype.getUserData=function(){return this._userData},yt.prototype.getSRID=function(){return this._SRID},yt.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},yt.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===yt.SORTINDEX_GEOMETRYCOLLECTION)throw new P("This method does not support GeometryCollection arguments")},yt.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},yt.prototype.norm=function(){var n=this.copy();return n.normalize(),n},yt.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},yt.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Ct(this._envelope)},yt.prototype.setSRID=function(n){this._SRID=n},yt.prototype.setUserData=function(n){this._userData=n},yt.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},yt.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},yt.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===yt.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===yt.SORTINDEX_MULTIPOINT||this.getSortIndex()===yt.SORTINDEX_MULTILINESTRING||this.getSortIndex()===yt.SORTINDEX_MULTIPOLYGON},yt.prototype.interfaces_=function(){return[G,N,t]},yt.prototype.getClass=function(){return yt},yt.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},yt.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},$t.serialVersionUID.get=function(){return 8763622679187377e3},$t.SORTINDEX_POINT.get=function(){return 0},$t.SORTINDEX_MULTIPOINT.get=function(){return 1},$t.SORTINDEX_LINESTRING.get=function(){return 2},$t.SORTINDEX_LINEARRING.get=function(){return 3},$t.SORTINDEX_MULTILINESTRING.get=function(){return 4},$t.SORTINDEX_POLYGON.get=function(){return 5},$t.SORTINDEX_MULTIPOLYGON.get=function(){return 6},$t.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},$t.geometryChangedFilter.get=function(){return Dt},Object.defineProperties(yt,$t);var Dt=function(){};Dt.interfaces_=function(){return[wt]},Dt.filter=function(n){n.geometryChangedAction()};var Y=function(){};Y.prototype.filter=function(n){},Y.prototype.interfaces_=function(){return[]},Y.prototype.getClass=function(){return Y};var w=function(){},C={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}};w.prototype.isInBoundary=function(n){},w.prototype.interfaces_=function(){return[]},w.prototype.getClass=function(){return w},C.Mod2BoundaryNodeRule.get=function(){return R},C.EndPointBoundaryNodeRule.get=function(){return H},C.MultiValentEndPointBoundaryNodeRule.get=function(){return z},C.MonoValentEndPointBoundaryNodeRule.get=function(){return rt},C.MOD2_BOUNDARY_RULE.get=function(){return new R},C.ENDPOINT_BOUNDARY_RULE.get=function(){return new H},C.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new z},C.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new rt},C.OGC_SFS_BOUNDARY_RULE.get=function(){return w.MOD2_BOUNDARY_RULE},Object.defineProperties(w,C);var R=function(){};R.prototype.isInBoundary=function(n){return n%2==1},R.prototype.interfaces_=function(){return[w]},R.prototype.getClass=function(){return R};var H=function(){};H.prototype.isInBoundary=function(n){return n>0},H.prototype.interfaces_=function(){return[w]},H.prototype.getClass=function(){return H};var z=function(){};z.prototype.isInBoundary=function(n){return n>1},z.prototype.interfaces_=function(){return[w]},z.prototype.getClass=function(){return z};var rt=function(){};rt.prototype.isInBoundary=function(n){return n===1},rt.prototype.interfaces_=function(){return[w]},rt.prototype.getClass=function(){return rt};var j=function(){};j.prototype.add=function(){},j.prototype.addAll=function(){},j.prototype.isEmpty=function(){},j.prototype.iterator=function(){},j.prototype.size=function(){},j.prototype.toArray=function(){},j.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var D=function(){};D.prototype.hasNext=function(){},D.prototype.next=function(){},D.prototype.remove=function(){};var tt=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}(j);(o.prototype=new Error).name="NoSuchElementException";var Z=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof j&&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,j]},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 et(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}(tt),et=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}(D),ot=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 I&&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 K=arguments[0],pt=arguments[1];if(arguments[2])for(var dt=0;dt<K.length;dt++)this.add(K[dt],pt);else for(var Rt=K.length-1;Rt>=0;Rt--)this.add(K[Rt],pt);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof I){var Ot=arguments[0],Vt=arguments[1];if(!arguments[2]){var jt=this.size();if(jt>0&&(Ot>0&&this.get(Ot-1).equals2D(Vt)||Ot<jt&&this.get(Ot).equals2D(Vt)))return null}n.prototype.add.call(this,Ot,Vt)}}else if(arguments.length===4){var sn=arguments[0],kn=arguments[1],Mr=arguments[2],Ki=arguments[3],Uo=1;Mr>Ki&&(Uo=-1);for(var Ph=Mr;Ph!==Ki;Ph+=Uo)this.add(sn[Ph],kn);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new I(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(Z),Q=function(){},St={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};St.ForwardComparator.get=function(){return At},St.BidirectionalComparator.get=function(){return ne},St.coordArrayType.get=function(){return new Array(0).fill(null)},Q.prototype.interfaces_=function(){return[]},Q.prototype.getClass=function(){return Q},Q.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},Q.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var u=n[s];if(Q.indexOf(u,i)<0)return u}return null},Q.scroll=function(n,i){var s=Q.indexOf(i,n);if(s<0)return null;var u=new Array(n.length).fill(null);Ft.arraycopy(n,s,u,0,n.length-s),Ft.arraycopy(n,0,u,n.length-s,s),Ft.arraycopy(u,0,n,0,n.length)},Q.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}},Q.intersection=function(n,i){for(var s=new ot,u=0;u<n.length;u++)i.intersects(n[u])&&s.add(n[u],!0);return s.toCoordinateArray()},Q.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},Q.removeRepeatedPoints=function(n){return Q.hasRepeatedPoints(n)?new ot(n,!1).toCoordinateArray():n},Q.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}},Q.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},Q.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 I(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 I(u[c+U])},Q.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},Q.envelope=function(n){for(var i=new Ct,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},Q.toCoordinateArray=function(n){return n.toArray(Q.coordArrayType)},Q.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},Q.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},Q.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},Q.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},Q.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},Q.extract=function(n,i,s){i=ut.clamp(i,0,n.length);var u=(s=ut.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(Q,St);var At=function(){};At.prototype.compare=function(n,i){return Q.compare(n,i)},At.prototype.interfaces_=function(){return[B]},At.prototype.getClass=function(){return At};var ne=function(){};ne.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=Q.compare(s,u);return Q.isEqualReversed(s,u)?0:c},ne.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=Q.increasingDirection(s),m=Q.increasingDirection(u),E=c>0?0:s.length-1,A=m>0?0:s.length-1,U=0;U<s.length;U++){var K=s[E].compareTo(u[A]);if(K!==0)return K;E+=c,A+=m}return 0},ne.prototype.interfaces_=function(){return[B]},ne.prototype.getClass=function(){return ne};var Gt=function(){};Gt.prototype.get=function(){},Gt.prototype.put=function(){},Gt.prototype.size=function(){},Gt.prototype.values=function(){},Gt.prototype.entrySet=function(){};var He=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}(Gt);(a.prototype=new Error).name="OperationNotSupported",(l.prototype=new j).contains=function(){};var tn=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof j&&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 Ln(this)},i}(l),Ln=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}(D),mn=0;(_.prototype=new He).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:mn,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:mn,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),mn),p(i,mn),p(f(f(n)),1),n=f(f(n))):(n===g(f(n))&&(n=f(n),this.rotateLeft(n)),p(f(n),mn),p(f(f(n)),1),this.rotateRight(f(f(n))))}else{var s=d(f(f(n)));h(s)===1?(p(f(n),mn),p(s,mn),p(f(f(n)),1),n=f(f(n))):(n===d(f(n))&&(n=f(n),this.rotateRight(n)),p(f(n),mn),p(f(f(n)),1),this.rotateLeft(f(f(n))))}this.root_.color=mn},_.prototype.values=function(){var n=new Z,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 tn,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 Fn=function(){};Fn.prototype.interfaces_=function(){return[]},Fn.prototype.getClass=function(){return Fn},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 $n(this)};var $n=function(n){this.treeSet_=n,this.position_=0};$n.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},$n.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},$n.prototype.remove=function(){throw new a};var xn=function(){};xn.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])},xn.asList=function(n){for(var i=new Z,s=0,u=n.length;s<u;s++)i.add(n[s]);return i};var re=function(){},En={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}};En.P.get=function(){return 0},En.L.get=function(){return 1},En.A.get=function(){return 2},En.FALSE.get=function(){return-1},En.TRUE.get=function(){return-2},En.DONTCARE.get=function(){return-3},En.SYM_FALSE.get=function(){return"F"},En.SYM_TRUE.get=function(){return"T"},En.SYM_DONTCARE.get=function(){return"*"},En.SYM_P.get=function(){return"0"},En.SYM_L.get=function(){return"1"},En.SYM_A.get=function(){return"2"},re.prototype.interfaces_=function(){return[]},re.prototype.getClass=function(){return re},re.toDimensionSymbol=function(n){switch(n){case re.FALSE:return re.SYM_FALSE;case re.TRUE:return re.SYM_TRUE;case re.DONTCARE:return re.SYM_DONTCARE;case re.P:return re.SYM_P;case re.L:return re.SYM_L;case re.A:return re.SYM_A}throw new P("Unknown dimension value: "+n)},re.toDimensionValue=function(n){switch(ht.toUpperCase(n)){case re.SYM_FALSE:return re.FALSE;case re.SYM_TRUE:return re.TRUE;case re.SYM_DONTCARE:return re.DONTCARE;case re.SYM_P:return re.P;case re.SYM_L:return re.L;case re.SYM_A:return re.A}throw new P("Unknown dimension symbol: "+n)},Object.defineProperties(re,En);var Cn=function(){};Cn.prototype.filter=function(n){},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn};var wn=function(){};wn.prototype.filter=function(n,i){},wn.prototype.isDone=function(){},wn.prototype.isGeometryChanged=function(){},wn.prototype.interfaces_=function(){return[]},wn.prototype.getClass=function(){return wn};var gn=function(n){function i(u,c){if(n.call(this,c),this._geometries=u||[],n.hasNullElements(this._geometries))throw new P("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 Ct,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();xn.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var u=re.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=re.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(xn.asList(this._geometries)),m=new M(xn.asList(u._geometries));return this.compare(c,m)}if(arguments.length===2){for(var E=arguments[0],A=arguments[1],U=E,K=this.getNumGeometries(),pt=U.getNumGeometries(),dt=0;dt<K&&dt<pt;){var Rt=this.getGeometryN(dt),Ot=U.getGeometryN(dt),Vt=Rt.compareToSameClass(Ot,A);if(Vt!==0)return Vt;dt++}return dt<K?1:dt<pt?-1:0}},i.prototype.apply=function(){if($(arguments[0],Y))for(var u=arguments[0],c=0;c<this._geometries.length;c++)this._geometries[c].apply(u);else if($(arguments[0],wn)){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($(arguments[0],Cn)){var A=arguments[0];A.filter(this);for(var U=0;U<this._geometries.length;U++)this._geometries[U].apply(A)}else if($(arguments[0],wt)){var K=arguments[0];K.filter(this);for(var pt=0;pt<this._geometries.length;pt++)this._geometries[pt].apply(K)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Pt.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}(yt),W=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 yt.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()?re.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 at(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[Fn]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(gn),at=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=w.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}};at.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)},at.prototype.getBoundary=function(){return this._geom instanceof zt?this.boundaryLineString(this._geom):this._geom instanceof W?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},at.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()])},at.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},at.prototype.computeBoundaryCoordinates=function(n){var i=new Z;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 Q.toCoordinateArray(i)},at.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new _t,this._endpointMap.put(n,i)),i.count++},at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new at(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new at(i,s).getBoundary()}};var _t=function(){this.count=null};_t.prototype.interfaces_=function(){return[]},_t.prototype.getClass=function(){return _t};var ct=function(){},Et={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};ct.prototype.interfaces_=function(){return[]},ct.prototype.getClass=function(){return ct},ct.chars=function(n,i){for(var s=new Array(i).fill(null),u=0;u<i;u++)s[u]=n;return String(s)},ct.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(){}(ct.getStackTrace(u))),A=0;A<c;A++)try{m+=E.readLine()+ct.NEWLINE}catch(U){if(!(U instanceof b))throw U;Pt.shouldNeverReachHere()}return m}},ct.split=function(n,i){for(var s=i.length,u=new Z,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},ct.toString=function(){if(arguments.length===1){var n=arguments[0];return ct.SIMPLE_ORDINATE_FORMAT.format(n)}},ct.spaces=function(n){return ct.chars(" ",n)},Et.NEWLINE.get=function(){return Ft.getProperty("line.separator")},Et.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(ct,Et);var Nt=function(){};Nt.prototype.interfaces_=function(){return[]},Nt.prototype.getClass=function(){return Nt},Nt.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))},Nt.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,gt.X)===n.getOrdinate(i-1,gt.X)&&n.getOrdinate(0,gt.Y)===n.getOrdinate(i-1,gt.Y)},Nt.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)&&(!S.isNaN(E)||!S.isNaN(A)))return!1}return!0},Nt.extend=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();if(Nt.copy(i,0,u,0,c),c>0)for(var m=c;m<s;m++)Nt.copy(i,c-1,u,m,1);return u},Nt.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),u=0;u<=s;u++)Nt.swap(n,u,i-u)},Nt.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)}},Nt.copy=function(n,i,s,u,c){for(var m=0;m<c;m++)Nt.copyCoord(n,i+m,s,u+m)},Nt.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),u=new mt;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(ct.toString(n.getOrdinate(c,m)))}return u.append(")"),u.toString()}},Nt.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?Nt.createClosedRing(n,i,4):i.getOrdinate(0,gt.X)===i.getOrdinate(s-1,gt.X)&&i.getOrdinate(0,gt.Y)===i.getOrdinate(s-1,gt.Y)?i:Nt.createClosedRing(n,i,s+1)},Nt.createClosedRing=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();Nt.copy(i,0,u,0,c);for(var m=c;m<s;m++)Nt.copy(i,0,u,m,1);return u};var zt=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 Ct:this._points.expandEnvelope(new Ct)},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&&Nt.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?re.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 J.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var u=this._points.copy();return Nt.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($(arguments[0],Y))for(var u=arguments[0],c=0;c<this._points.size();c++)u.filter(this._points.getCoordinate(c));else if($(arguments[0],wn)){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 $(arguments[0],Cn)?arguments[0].filter(this):$(arguments[0],wt)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new at(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 P("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[Fn]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(yt),oe=function(){};oe.prototype.interfaces_=function(){return[]},oe.prototype.getClass=function(){return oe};var Kt=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 Ct;var u=new Ct;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 re.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($(arguments[0],Y)){var u=arguments[0];if(this.isEmpty())return null;u.filter(this.getCoordinate())}else if($(arguments[0],wn)){var c=arguments[0];if(this.isEmpty())return null;c.filter(this._coordinates,0),c.isGeometryChanged()&&this.geometryChanged()}else $(arguments[0],Cn)?arguments[0].filter(this):$(arguments[0],wt)&&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([])),Pt.isTrue(u.size()<=1),this._coordinates=u},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[oe]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(yt),ce=function(){};ce.prototype.interfaces_=function(){return[]},ce.prototype.getClass=function(){return ce};var Wt=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 P("holes must not contain null elements");if(u.isEmpty()&&n.hasNonEmptyElements(c))throw new P("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(),K=0;K<U.length;K++)u[++c]=U[K];return u},i.prototype.getArea=function(){var u=0;u+=Math.abs(J.signedArea(this._shell.getCoordinateSequence()));for(var c=0;c<this._holes.length;c++)u-=Math.abs(J.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),K=u.getY(0),pt=1;pt<=4;pt++){var dt=u.getX(pt),Rt=u.getY(pt);if(dt!==U==(Rt!==K))return!1;U=dt,K=Rt}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);xn.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);Ft.arraycopy(c.getCoordinates(),0,E,0,E.length);var A=Q.minCoordinate(c.getCoordinates());Q.scroll(E,A),Ft.arraycopy(E,0,c.getCoordinates(),0,E.length),c.getCoordinates()[E.length]=E[0],J.isCCW(c.getCoordinates())===m&&Q.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,K=this._shell,pt=U._shell,dt=K.compareToSameClass(pt,A);if(dt!==0)return dt;for(var Rt=this.getNumInteriorRing(),Ot=U.getNumInteriorRing(),Vt=0;Vt<Rt&&Vt<Ot;){var jt=this.getInteriorRingN(Vt),sn=U.getInteriorRingN(Vt),kn=jt.compareToSameClass(sn,A);if(kn!==0)return kn;Vt++}return Vt<Rt?1:Vt<Ot?-1:0}},i.prototype.apply=function(u){if($(u,Y)){this._shell.apply(u);for(var c=0;c<this._holes.length;c++)this._holes[c].apply(u)}else if($(u,wn)){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($(u,Cn))u.filter(this);else if($(u,wt)){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}(yt),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 yt.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 re.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[oe]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(gn),an=function(n){function i(u,c){u instanceof I&&c instanceof ue&&(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 yt.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return re.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var u=this._points.copy();return Nt.reverse(u),this.getFactory().createLinearRing(u)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new P("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new P("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}(zt),ln=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 yt.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 Z,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}(gn),bn=function(n){this._factory=n||null,this._isUserDataCopied=!1},ui={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};bn.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},bn.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},bn.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof gn?this.editGeometryCollection(n,i):n instanceof Wt?this.editPolygon(n,i):n instanceof Kt?i.edit(n,this._factory):n instanceof zt?i.edit(n,this._factory):(Pt.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},bn.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),u=new Z,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()===W?this._factory.createMultiLineString(u.toArray([])):s.getClass()===ln?this._factory.createMultiPolygon(u.toArray([])):this._factory.createGeometryCollection(u.toArray([]))},bn.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 Z,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([]))},bn.prototype.interfaces_=function(){return[]},bn.prototype.getClass=function(){return bn},bn.GeometryEditorOperation=function(){},ui.NoOpGeometryOperation.get=function(){return Pn},ui.CoordinateOperation.get=function(){return de},ui.CoordinateSequenceOperation.get=function(){return bo},Object.defineProperties(bn,ui);var Pn=function(){};Pn.prototype.edit=function(n,i){return n},Pn.prototype.interfaces_=function(){return[bn.GeometryEditorOperation]},Pn.prototype.getClass=function(){return Pn};var de=function(){};de.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof an?i.createLinearRing(s):n instanceof zt?i.createLineString(s):n instanceof Kt?s.length>0?i.createPoint(s[0]):i.createPoint():n},de.prototype.interfaces_=function(){return[bn.GeometryEditorOperation]},de.prototype.getClass=function(){return de};var bo=function(){};bo.prototype.edit=function(n,i){return n instanceof an?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof zt?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof Kt?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},bo.prototype.interfaces_=function(){return[bn.GeometryEditorOperation]},bo.prototype.getClass=function(){return bo};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 I}else if($(arguments[0],gt)){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 I}}},ao={serialVersionUID:{configurable:!0}};fe.prototype.setOrdinate=function(n,i,s){switch(i){case gt.X:this._coordinates[n].x=s;break;case gt.Y:this._coordinates[n].y=s;break;case gt.Z:this._coordinates[n].z=s;break;default:throw new P("invalid ordinateIndex")}},fe.prototype.size=function(){return this._coordinates.length},fe.prototype.getOrdinate=function(n,i){switch(i){case gt.X:return this._coordinates[n].x;case gt.Y:return this._coordinates[n].y;case gt.Z:return this._coordinates[n].z}return S.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 I(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 mt(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[gt,t]},fe.prototype.getClass=function(){return fe},ao.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(fe,ao);var li=function(){},To={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};li.prototype.readResolve=function(){return li.instance()},li.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new fe(n)}if($(arguments[0],gt)){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)}},li.prototype.interfaces_=function(){return[st,t]},li.prototype.getClass=function(){return li},li.instance=function(){return li.instanceObject},To.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},To.instanceObject.get=function(){return new li},Object.defineProperties(li,To);var ua=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 Z,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 tn;return this.map_.entries().forEach(function(u){return s.add(u)}),s},i.prototype.size=function(){return this.map_.size()},i}(Gt),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 kr){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}}},Vi={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 lt(s).compareTo(new lt(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 S.isNaN(n)||this._modelType===ie.FLOATING_SINGLE?n:this._modelType===ie.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof I){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,N]},ie.prototype.getClass=function(){return ie},ie.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Vi.serialVersionUID.get=function(){return 7777263578777804e3},Vi.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ie,Vi);var kr=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},Pr={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};kr.prototype.readResolve=function(){return kr.nameToTypeMap.get(this._name)},kr.prototype.toString=function(){return this._name},kr.prototype.interfaces_=function(){return[t]},kr.prototype.getClass=function(){return kr},Pr.serialVersionUID.get=function(){return-552860263173159e4},Pr.nameToTypeMap.get=function(){return new ua},Object.defineProperties(kr,Pr),ie.Type=kr,ie.FIXED=new kr("FIXED"),ie.FLOATING=new kr("FLOATING"),ie.FLOATING_SINGLE=new kr("FLOATING SINGLE");var ue=function n(){this._precisionModel=new ie,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?$(arguments[0],st)?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]))},dl={serialVersionUID:{configurable:!0}};ue.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new I(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new I(n.getMinX(),n.getMinY()),new I(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new I(n.getMinX(),n.getMinY()),new I(n.getMinX(),n.getMaxY()),new I(n.getMaxX(),n.getMaxY()),new I(n.getMaxX(),n.getMinY()),new I(n.getMinX(),n.getMinY())]),null)},ue.prototype.createLineString=function(n){return n?n instanceof Array?new zt(this.getCoordinateSequenceFactory().create(n),this):$(n,gt)?new zt(n,this):void 0:new zt(this.getCoordinateSequenceFactory().create([]),this)},ue.prototype.createMultiLineString=function(){if(arguments.length===0)return new W(null,this);if(arguments.length===1){var n=arguments[0];return new W(n,this)}},ue.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(ue.toGeometryArray(n));var A=n.iterator().next();if(n.size()>1){if(A instanceof Wt)return this.createMultiPolygon(ue.toPolygonArray(n));if(A instanceof zt)return this.createMultiLineString(ue.toLineStringArray(n));if(A instanceof Kt)return this.createMultiPoint(ue.toPointArray(n));Pt.shouldNeverReachHere("Unhandled class: "+A.getClass().getName())}return A},ue.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},ue.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if($(arguments[0],gt)){var i=arguments[0];return new Kt(i,this)}}},ue.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},ue.prototype.createPolygon=function(){if(arguments.length===0)return new Wt(null,null,this);if(arguments.length===1){if($(arguments[0],gt)){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 an){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];return new Wt(u,c,this)}},ue.prototype.getSRID=function(){return this._SRID},ue.prototype.createGeometryCollection=function(){if(arguments.length===0)return new gn(null,this);if(arguments.length===1){var n=arguments[0];return new gn(n,this)}},ue.prototype.createGeometry=function(n){return new bn(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},ue.prototype.getPrecisionModel=function(){return this._precisionModel},ue.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($(arguments[0],gt)){var i=arguments[0];return new an(i,this)}}},ue.prototype.createMultiPolygon=function(){if(arguments.length===0)return new ln(null,this);if(arguments.length===1){var n=arguments[0];return new ln(n,this)}},ue.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($(arguments[0],gt)){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());Nt.copy(s,c,m,0,1),u[c]=this.createPoint(m)}return this.createMultiPoint(u)}}},ue.prototype.interfaces_=function(){return[t]},ue.prototype.getClass=function(){return ue},ue.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.getDefaultCoordinateSequenceFactory=function(){return li.instance()},ue.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},dl.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(ue,dl);var ml=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],gl=function(n){this.geometryFactory=n||new ue};gl.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!Ci[s])throw new Error("Unknown GeoJSON type: "+i.type);return ml.indexOf(s)!==-1?Ci[s].apply(this,[i.coordinates]):s==="GeometryCollection"?Ci[s].apply(this,[i.geometries]):Ci[s].apply(this,[i])},gl.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 Ci={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var u=n.geometry.type;if(!Ci[u])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=Ci.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 I(u[0],u[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new I(n[0],n[1]),new I(n[2],n[1]),new I(n[2],n[3]),new I(n[0],n[3]),new I(n[0],n[1])])},Point:function(n){var i=new I(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(Ci.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=Ci.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(Ci.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=Ci.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),u=[],c=1;c<n.length;++c){var m=n[c],E=Ci.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(Ci.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}}},_h=function(n){this.geometryFactory=n||new ue,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new gl(this.geometryFactory)};_h.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===ie.FIXED&&this.reducePrecision(i),i},_h.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 Xd=function(){this.parser=new gl(this.geometryFactory)};Xd.prototype.write=function(n){return this.parser.write(n)};var bt=function(){},yl={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},yl.ON.get=function(){return 0},yl.LEFT.get=function(){return 1},yl.RIGHT.get=function(){return 2},Object.defineProperties(bt,yl),(T.prototype=new Error).name="EmptyStackException",(x.prototype=new tt).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 Pi=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Pi.prototype.getCoordinate=function(){return this._minCoord},Pi.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},Pi.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();Pt.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=J.computeOrientation(this._minCoord,s,i),c=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&u===J.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&u===J.CLOCKWISE)&&(c=!0),c&&(this._minIndex=this._minIndex-1)},Pi.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},Pi.prototype.getEdge=function(){return this._orientedDe},Pi.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])},Pi.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)},Pi.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}Pt.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())},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi};var lo=function(n){function i(s,u){n.call(this,i.msgWithCoord(s,u)),this.pt=u?new I(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}(pe),vl=function(){this.array_=[]};vl.prototype.addLast=function(n){this.array_.push(n)},vl.prototype.removeFirst=function(){return this.array_.shift()},vl.prototype.isEmpty=function(){return this.array_.length===0};var mr=function(){this._finder=null,this._dirEdgeList=new Z,this._nodes=new Z,this._rightMostCoord=null,this._env=null,this._finder=new Pi};mr.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},mr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},mr.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)}},mr.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(bt.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},mr.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},mr.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)}},mr.prototype.computeDepths=function(n){var i=new tn,s=new vl,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))}}}},mr.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},mr.prototype.getEnvelope=function(){if(this._env===null){for(var n=new Ct,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},mr.prototype.addReachable=function(n){var i=new x;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},mr.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(bt.LEFT,n.getDepth(bt.RIGHT)),i.setDepth(bt.RIGHT,n.getDepth(bt.LEFT))},mr.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)}},mr.prototype.getNodes=function(){return this._nodes},mr.prototype.getDirectedEdges=function(){return this._dirEdgeList},mr.prototype.interfaces_=function(){return[N]},mr.prototype.getClass=function(){return mr};var dn=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}};dn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},dn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==V.NONE)return!1;return!0},dn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===V.NONE&&(this.location[i]=n)},dn.prototype.isLine=function(){return this.location.length===1},dn.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]=V.NONE,i[bt.RIGHT]=V.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===V.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},dn.prototype.getLocations=function(){return this.location},dn.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},dn.prototype.toString=function(){var n=new mt;return this.location.length>1&&n.append(V.toLocationSymbol(this.location[bt.LEFT])),n.append(V.toLocationSymbol(this.location[bt.ON])),this.location.length>1&&n.append(V.toLocationSymbol(this.location[bt.RIGHT])),n.toString()},dn.prototype.setLocations=function(n,i,s){this.location[bt.ON]=n,this.location[bt.LEFT]=i,this.location[bt.RIGHT]=s},dn.prototype.get=function(n){return n<this.location.length?this.location[n]:V.NONE},dn.prototype.isArea=function(){return this.location.length>1},dn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===V.NONE)return!0;return!1},dn.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}},dn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations(V.NONE)},dn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},dn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},dn.prototype.interfaces_=function(){return[]},dn.prototype.getClass=function(){return dn};var on=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 dn(i),this.elt[1]=new dn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new dn(s.elt[0]),this.elt[1]=new dn(s.elt[1])}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.elt[0]=new dn(V.NONE),this.elt[1]=new dn(V.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 dn(m,E,A),this.elt[1]=new dn(m,E,A)}else if(arguments.length===4){var U=arguments[0],K=arguments[1],pt=arguments[2],dt=arguments[3];this.elt[0]=new dn(V.NONE,V.NONE,V.NONE),this.elt[1]=new dn(V.NONE,V.NONE,V.NONE),this.elt[U].setLocations(K,pt,dt)}};on.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},on.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},on.prototype.isNull=function(n){return this.elt[n].isNull()},on.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)}},on.prototype.isLine=function(n){return this.elt[n].isLine()},on.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new dn(n.elt[i]):this.elt[i].merge(n.elt[i])},on.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},on.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)}},on.prototype.toString=function(){var n=new mt;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()},on.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()}},on.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},on.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)}},on.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},on.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},on.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new dn(this.elt[n].location[0]))},on.prototype.interfaces_=function(){return[]},on.prototype.getClass=function(){return on},on.toLineLabel=function(n){for(var i=new on(V.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var Un=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new Z,this._pts=new Z,this._label=new on(V.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new Z,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};Un.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=J.isCCW(this._ring.getCoordinates())},Un.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Un.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();Pt.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)},Un.prototype.getLinearRing=function(){return this._ring},Un.prototype.getCoordinate=function(n){return this._pts.get(n)},Un.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},Un.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])}},Un.prototype.isHole=function(){return this._isHole},Un.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},Un.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!J.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},Un.prototype.addHole=function(n){this._holes.add(n)},Un.prototype.isShell=function(){return this._shell===null},Un.prototype.getLabel=function(){return this._label},Un.prototype.getEdges=function(){return this._edges},Un.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Un.prototype.getShell=function(){return this._shell},Un.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===V.NONE)return null;if(this._label.getLocation(s)===V.NONE)return this._label.setLocation(s,u),null}},Un.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},Un.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)},Un.prototype.interfaces_=function(){return[]},Un.prototype.getClass=function(){return Un};var G1=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}(Un),V1=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 Z,u=this._startDe;do{if(u.getMinEdgeRing()===null){var c=new G1(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}(Un),Jr=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}}};Jr.prototype.setVisited=function(n){this._isVisited=n},Jr.prototype.setInResult=function(n){this._isInResult=n},Jr.prototype.isCovered=function(){return this._isCovered},Jr.prototype.isCoveredSet=function(){return this._isCoveredSet},Jr.prototype.setLabel=function(n){this._label=n},Jr.prototype.getLabel=function(){return this._label},Jr.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},Jr.prototype.updateIM=function(n){Pt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},Jr.prototype.isInResult=function(){return this._isInResult},Jr.prototype.isVisited=function(){return this._isVisited},Jr.prototype.interfaces_=function(){return[]},Jr.prototype.getClass=function(){return Jr};var _l=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 on(0,V.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=V.NONE;if(c=this._label.getLocation(u),!s.isNull(u)){var m=s.getLocation(u);c!==V.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 on(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 on)for(var u=arguments[0],c=0;c<2;c++){var m=this.computeMergedLocation(u,c);this._label.getLocation(c)===V.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=V.NONE;this._label!==null&&(u=this._label.getLocation(s));var c=null;switch(u){case V.BOUNDARY:c=V.INTERIOR;break;case V.INTERIOR:default:c=V.BOUNDARY}this._label.setLocation(s,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Jr),Ii=function(){this.nodeMap=new _,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};Ii.prototype.find=function(n){return this.nodeMap.get(n)},Ii.prototype.addNode=function(){if(arguments[0]instanceof I){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 _l){var s=arguments[0],u=this.nodeMap.get(s.getCoordinate());return u===null?(this.nodeMap.put(s.getCoordinate(),s),s):(u.mergeLabel(s),u)}},Ii.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},Ii.prototype.iterator=function(){return this.nodeMap.values().iterator()},Ii.prototype.values=function(){return this.nodeMap.values()},Ii.prototype.getBoundaryNodes=function(n){for(var i=new Z,s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().getLocation(n)===V.BOUNDARY&&i.add(u)}return i},Ii.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii};var cn=function(){},_u={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};cn.prototype.interfaces_=function(){return[]},cn.prototype.getClass=function(){return cn},cn.isNorthern=function(n){return n===cn.NE||n===cn.NW},cn.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},cn.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},cn.isInHalfPlane=function(n,i){return i===cn.SE?n===cn.SE||n===cn.SW:n===i||n===i+1},cn.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 P("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?cn.NE:cn.SE:i>=0?cn.NW:cn.SW}if(arguments[0]instanceof I&&arguments[1]instanceof I){var s=arguments[0],u=arguments[1];if(u.x===s.x&&u.y===s.y)throw new P("Cannot compute the quadrant for two identical points "+s);return u.x>=s.x?u.y>=s.y?cn.NE:cn.SE:u.y>=s.y?cn.NW:cn.SW}},_u.NE.get=function(){return 0},_u.NW.get=function(){return 1},_u.SW.get=function(){return 2},_u.SE.get=function(){return 3},Object.defineProperties(cn,_u);var sr=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}};sr.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:J.computeOrientation(n._p0,n._p1,this._p1)},sr.prototype.getDy=function(){return this._dy},sr.prototype.getCoordinate=function(){return this._p0},sr.prototype.setNode=function(n){this._node=n},sr.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)},sr.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},sr.prototype.getDirectedCoordinate=function(){return this._p1},sr.prototype.getDx=function(){return this._dx},sr.prototype.getLabel=function(){return this._label},sr.prototype.getEdge=function(){return this._edge},sr.prototype.getQuadrant=function(){return this._quadrant},sr.prototype.getNode=function(){return this._node},sr.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},sr.prototype.computeLabel=function(n){},sr.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=cn.quadrant(this._dx,this._dy),Pt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},sr.prototype.interfaces_=function(){return[N]},sr.prototype.getClass=function(){return sr};var xh=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 on(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)===V.INTERIOR&&this._label.getLocation(u,bt.RIGHT)===V.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,V.EXTERIOR),c=!this._label.isArea(1)||this._label.allPositionsEqual(1,V.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===V.EXTERIOR&&u===V.INTERIOR?1:s===V.INTERIOR&&u===V.EXTERIOR?-1:0},i}(sr),la=function(){};la.prototype.createNode=function(n){return new _l(n,null)},la.prototype.interfaces_=function(){return[]},la.prototype.getClass=function(){return la};var Tn=function(){if(this._edges=new Z,this._nodes=null,this._edgeEndList=new Z,arguments.length===0)this._nodes=new Ii(new la);else if(arguments.length===1){var n=arguments[0];this._nodes=new Ii(n)}};Tn.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)}},Tn.prototype.find=function(n){return this._nodes.find(n)},Tn.prototype.addNode=function(){if(arguments[0]instanceof _l){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof I){var i=arguments[0];return this._nodes.addNode(i)}},Tn.prototype.getNodeIterator=function(){return this._nodes.iterator()},Tn.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},Tn.prototype.debugPrintln=function(n){Ft.out.println(n)},Tn.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)===V.BOUNDARY},Tn.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},Tn.prototype.matchInSameDirection=function(n,i,s,u){return!!n.equals(s)&&J.computeOrientation(n,i,u)===J.COLLINEAR&&cn.quadrant(n,i)===cn.quadrant(s,u)},Tn.prototype.getEdgeEnds=function(){return this._edgeEndList},Tn.prototype.debugPrint=function(n){Ft.out.print(n)},Tn.prototype.getEdgeIterator=function(){return this._edges.iterator()},Tn.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},Tn.prototype.insertEdge=function(n){this._edges.add(n)},Tn.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},Tn.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var u=new xh(s,!0),c=new xh(s,!1);u.setSym(c),c.setSym(u),this.add(u),this.add(c)}},Tn.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},Tn.prototype.getNodes=function(){return this._nodes.values()},Tn.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},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn},Tn.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Gr=function(){this._geometryFactory=null,this._shellList=new Z;var n=arguments[0];this._geometryFactory=n};Gr.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)}},Gr.prototype.computePolygons=function(n){for(var i=new Z,s=n.iterator();s.hasNext();){var u=s.next().toPolygon(this._geometryFactory);i.add(u)}return i},Gr.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)}}},Gr.prototype.buildMinimalEdgeRings=function(n,i,s){for(var u=new Z,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},Gr.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},Gr.prototype.buildMaximalEdgeRings=function(n){for(var i=new Z,s=n.iterator();s.hasNext();){var u=s.next();if(u.isInResult()&&u.getLabel().isArea()&&u.getEdgeRing()===null){var c=new V1(u,this._geometryFactory);i.add(c),c.setInResult()}}return i},Gr.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();u.isHole()&&u.setShell(n)}},Gr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Gr.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(),K=U.getLinearRing(),pt=K.getEnvelopeInternal();m!==null&&(E=m.getLinearRing().getEnvelopeInternal());var dt=!1;pt.contains(u)&&J.isPointInRing(c,K.getCoordinates())&&(dt=!0),dt&&(m===null||E.contains(pt))&&(m=U)}return m},Gr.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 Pt.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},Gr.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];Tn.linkResultDirectedEdges(s);var u=this.buildMaximalEdgeRings(i),c=new Z,m=this.buildMinimalEdgeRings(u,this._shellList,c);this.sortShellsAndHoles(m,this._shellList,c),this.placeFreeHoles(this._shellList,c)}},Gr.prototype.interfaces_=function(){return[]},Gr.prototype.getClass=function(){return Gr};var ca=function(){};ca.prototype.getBounds=function(){},ca.prototype.interfaces_=function(){return[]},ca.prototype.getClass=function(){return ca};var vi=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};vi.prototype.getItem=function(){return this._item},vi.prototype.getBounds=function(){return this._bounds},vi.prototype.interfaces_=function(){return[ca,t]},vi.prototype.getClass=function(){return vi};var co=function(){this._size=null,this._items=null,this._size=0,this._items=new Z,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 Ao=function(){};Ao.prototype.visitItem=function(n){},Ao.prototype.interfaces_=function(){return[]},Ao.prototype.getClass=function(){return Ao};var Ps=function(){};Ps.prototype.insert=function(n,i){},Ps.prototype.remove=function(n,i){},Ps.prototype.query=function(){},Ps.prototype.interfaces_=function(){return[]},Ps.prototype.getClass=function(){return Ps};var Hn=function(){if(this._childBoundables=new Z,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},Yd={serialVersionUID:{configurable:!0}};Hn.prototype.getLevel=function(){return this._level},Hn.prototype.size=function(){return this._childBoundables.size()},Hn.prototype.getChildBoundables=function(){return this._childBoundables},Hn.prototype.addChildBoundable=function(n){Pt.isTrue(this._bounds===null),this._childBoundables.add(n)},Hn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Hn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Hn.prototype.interfaces_=function(){return[ca,t]},Hn.prototype.getClass=function(){return Hn},Yd.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Hn,Yd);var _i=function(){};_i.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},_i.min=function(n){return _i.sort(n),n.get(0)},_i.sort=function(n,i){var s=n.toArray();i?xn.sort(s,i):xn.sort(s);for(var u=n.iterator(),c=0,m=s.length;c<m;c++)u.next(),u.set(s[c])},_i.singletonList=function(n){var i=new Z;return i.add(n),i};var Bn=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()};Bn.prototype.expandToQueue=function(n,i){var s=Bn.isComposite(this._boundable1),u=Bn.isComposite(this._boundable2);if(s&&u)return Bn.area(this._boundable1)>Bn.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 P("neither boundable is composite")},Bn.prototype.isLeaves=function(){return!(Bn.isComposite(this._boundable1)||Bn.isComposite(this._boundable2))},Bn.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},Bn.prototype.expand=function(n,i,s,u){for(var c=n.getChildBoundables().iterator();c.hasNext();){var m=c.next(),E=new Bn(m,i,this._itemDistance);E.getDistance()<u&&s.add(E)}},Bn.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},Bn.prototype.getDistance=function(){return this._distance},Bn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Bn.prototype.interfaces_=function(){return[N]},Bn.prototype.getClass=function(){return Bn},Bn.area=function(n){return n.getBounds().getArea()},Bn.isComposite=function(n){return n instanceof Hn};var Jn=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new Z,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];Pt.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},xl={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Jn.prototype.getNodeCapacity=function(){return this._nodeCapacity},Jn.prototype.lastNode=function(n){return n.get(n.size()-1)},Jn.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 Hn?n+=this.size(s):s instanceof vi&&(n+=1)}return n}},Jn.prototype.removeItem=function(n,i){for(var s=null,u=n.getChildBoundables().iterator();u.hasNext();){var c=u.next();c instanceof vi&&c.getItem()===i&&(s=c)}return s!==null&&(n.getChildBoundables().remove(s),!0)},Jn.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new Z:n}if(arguments.length===1){for(var i=arguments[0],s=new Z,u=i.getChildBoundables().iterator();u.hasNext();){var c=u.next();if(c instanceof Hn){var m=this.itemsTree(c);m!==null&&s.add(m)}else c instanceof vi?s.add(c.getItem()):Pt.shouldNeverReachHere()}return s.size()<=0?null:s}},Jn.prototype.insert=function(n,i){Pt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new vi(n,i))},Jn.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new Z;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];if(Pt.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 Hn?this.boundablesAtLevel(s,E,c):(Pt.isTrue(E instanceof vi),s===-1&&c.add(E))}return null}},Jn.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new Z;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($(arguments[2],Ao)&&arguments[0]instanceof Object&&arguments[1]instanceof Hn)for(var c=arguments[0],m=arguments[1],E=arguments[2],A=m.getChildBoundables(),U=0;U<A.size();U++){var K=A.get(U);this.getIntersectsOp().intersects(K.getBounds(),c)&&(K instanceof Hn?this.query(c,K,E):K instanceof vi?E.visitItem(K.getItem()):Pt.shouldNeverReachHere())}else if($(arguments[2],tt)&&arguments[0]instanceof Object&&arguments[1]instanceof Hn)for(var pt=arguments[0],dt=arguments[1],Rt=arguments[2],Ot=dt.getChildBoundables(),Vt=0;Vt<Ot.size();Vt++){var jt=Ot.get(Vt);this.getIntersectsOp().intersects(jt.getBounds(),pt)&&(jt instanceof Hn?this.query(pt,jt,Rt):jt instanceof vi?Rt.add(jt.getItem()):Pt.shouldNeverReachHere())}}},Jn.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},Jn.prototype.getRoot=function(){return this.build(),this._root},Jn.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 Hn&&(m=this.remove(s,U,c))){E=U;break}}return E!==null&&E.getChildBoundables().isEmpty()&&u.getChildBoundables().remove(E),m}},Jn.prototype.createHigherLevels=function(n,i){Pt.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},Jn.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 Hn){var u=this.depth(s);u>n&&(n=u)}}return n+1}},Jn.prototype.createParentBoundables=function(n,i){Pt.isTrue(!n.isEmpty());var s=new Z;s.add(this.createNode(i));var u=new Z(n);_i.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},Jn.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Jn.prototype.interfaces_=function(){return[t]},Jn.prototype.getClass=function(){return Jn},Jn.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},xl.IntersectsOp.get=function(){return H1},xl.serialVersionUID.get=function(){return-3886435814360241e3},xl.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Jn,xl);var H1=function(){},ha=function(){};ha.prototype.distance=function(n,i){},ha.prototype.interfaces_=function(){return[]},ha.prototype.getClass=function(){return ha};var $d=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){Pt.isTrue(u.length>0);for(var m=new Z,E=0;E<u.length;E++)m.addAll(this.createParentBoundablesFromVerticalSlice(u[E],c));return m},i.prototype.createNode=function(u){return new Zd(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 Z;for(var K=0;A.hasNext()&&K<m;){var pt=A.next();E[U].add(pt),K++}}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($(arguments[2],Ao)&&arguments[0]instanceof Object&&arguments[1]instanceof Hn){var E=arguments[0],A=arguments[1],U=arguments[2];n.prototype.query.call(this,E,A,U)}else if($(arguments[2],tt)&&arguments[0]instanceof Object&&arguments[1]instanceof Hn){var K=arguments[0],pt=arguments[1],dt=arguments[2];n.prototype.query.call(this,K,pt,dt)}}},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){Pt.isTrue(!u.isEmpty());var m=Math.trunc(Math.ceil(u.size()/this.getNodeCapacity())),E=new Z(u);_i.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($(arguments[0],ha)){var u=arguments[0],c=new Bn(this.getRoot(),this.getRoot(),u);return this.nearestNeighbour(c)}if(arguments[0]instanceof Bn){var m=arguments[0];return this.nearestNeighbour(m,S.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&$(arguments[1],ha)){var E=arguments[0],A=arguments[1],U=new Bn(this.getRoot(),E.getRoot(),A);return this.nearestNeighbour(U)}if(arguments[0]instanceof Bn&&typeof arguments[1]=="number"){var K=arguments[0],pt=arguments[1],dt=null,Rt=new co;for(Rt.add(K);!Rt.isEmpty()&&pt>0;){var Ot=Rt.poll(),Vt=Ot.getDistance();if(Vt>=pt)break;Ot.isLeaves()?(pt=Vt,dt=Ot):Ot.expandToQueue(Rt,pt)}return[dt.getBoundable(0).getItem(),dt.getBoundable(1).getItem()]}}else if(arguments.length===3){var jt=arguments[0],sn=arguments[1],kn=arguments[2],Mr=new vi(jt,sn),Ki=new Bn(this.getRoot(),Mr,kn);return this.nearestNeighbour(Ki)[0]}},i.prototype.interfaces_=function(){return[Ps,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 Zd},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[B]},compare:function(u,c){return n.compareDoubles(i.centreX(u.getBounds()),i.centreX(c.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[B]},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}(Jn),Zd=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 Ct(c.getBounds()):s.expandToInclude(c.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Hn),Ir=function(){};Ir.prototype.interfaces_=function(){return[]},Ir.prototype.getClass=function(){return Ir},Ir.relativeSign=function(n,i){return n<i?-1:n>i?1:0},Ir.compare=function(n,i,s){if(i.equals2D(s))return 0;var u=Ir.relativeSign(i.x,s.x),c=Ir.relativeSign(i.y,s.y);switch(n){case 0:return Ir.compareValue(u,c);case 1:return Ir.compareValue(c,u);case 2:return Ir.compareValue(c,-u);case 3:return Ir.compareValue(-u,c);case 4:return Ir.compareValue(-u,-c);case 5:return Ir.compareValue(-c,-u);case 6:return Ir.compareValue(-c,u);case 7:return Ir.compareValue(u,-c)}return Pt.shouldNeverReachHere("invalid octant value"),0},Ir.compareValue=function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0};var Co=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 I(i),this.segmentIndex=s,this._segmentOctant=u,this._isInterior=!i.equals2D(n.getCoordinate(s))};Co.prototype.getCoordinate=function(){return this.coord},Co.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},Co.prototype.compareTo=function(n){var i=n;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:Ir.compare(this._segmentOctant,this.coord,i.coord)},Co.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},Co.prototype.isInterior=function(){return this._isInterior},Co.prototype.interfaces_=function(){return[N]},Co.prototype.getClass=function(){return Co};var gr=function(){this._nodeMap=new _,this._edge=null;var n=arguments[0];this._edge=n};gr.prototype.getSplitCoordinates=function(){var n=new ot;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()},gr.prototype.addCollapsedNodes=function(){var n=new Z;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)}},gr.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},gr.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 lt(i+1))}},gr.prototype.addEdgeCoordinates=function(n,i,s){var u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);s.add(new I(n.coord),!1);for(var m=n.segmentIndex+1;m<=i.segmentIndex;m++)s.add(this._edge.getCoordinate(m));c&&s.add(new I(i.coord))},gr.prototype.iterator=function(){return this._nodeMap.values().iterator()},gr.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}},gr.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)},gr.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 lt(i[0])),u=c}},gr.prototype.getEdge=function(){return this._edge},gr.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},gr.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 I(n.coord);for(var A=n.segmentIndex+1;A<=i.segmentIndex;A++)m[E++]=this._edge.getCoordinate(A);return c&&(m[E]=new I(i.coord)),new Nn(m,this._edge.getData())},gr.prototype.add=function(n,i){var s=new Co(this._edge,n,i,this._edge.getSegmentOctant(i)),u=this._nodeMap.get(s);return u!==null?(Pt.isTrue(u.coord.equals2D(n),"Found equal nodes with different coordinates"),u):(this._nodeMap.put(s,s),s)},gr.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new pe("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 pe("bad split edge end point at "+c)},gr.prototype.interfaces_=function(){return[]},gr.prototype.getClass=function(){return gr};var Is=function(){};Is.prototype.interfaces_=function(){return[]},Is.prototype.getClass=function(){return Is},Is.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 P("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 I&&arguments[1]instanceof I){var c=arguments[0],m=arguments[1],E=m.x-c.x,A=m.y-c.y;if(E===0&&A===0)throw new P("Cannot compute the octant for two identical points "+c);return Is.octant(E,A)}};var Hi=function(){};Hi.prototype.getCoordinates=function(){},Hi.prototype.size=function(){},Hi.prototype.getCoordinate=function(n){},Hi.prototype.isClosed=function(){},Hi.prototype.setData=function(n){},Hi.prototype.getData=function(){},Hi.prototype.interfaces_=function(){return[]},Hi.prototype.getClass=function(){return Hi};var xu=function(){};xu.prototype.addIntersection=function(n,i){},xu.prototype.interfaces_=function(){return[Hi]},xu.prototype.getClass=function(){return xu};var Nn=function(){this._nodeList=new gr(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};Nn.prototype.getCoordinates=function(){return this._pts},Nn.prototype.size=function(){return this._pts.length},Nn.prototype.getCoordinate=function(n){return this._pts[n]},Nn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Nn.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},Nn.prototype.setData=function(n){this._data=n},Nn.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:Is.octant(n,i)},Nn.prototype.getData=function(){return this._data},Nn.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 I(s.getIntersection(c));this.addIntersection(m,u)}},Nn.prototype.toString=function(){return Yt.toLineString(new fe(this._pts))},Nn.prototype.getNodeList=function(){return this._nodeList},Nn.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)},Nn.prototype.addIntersections=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++)this.addIntersection(n,i,s,u)},Nn.prototype.interfaces_=function(){return[xu]},Nn.prototype.getClass=function(){return Nn},Nn.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new Z;return Nn.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 Zt=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new I,this.p1=new I;else if(arguments.length===1){var n=arguments[0];this.p0=new I(n.p0),this.p1=new I(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 I(i,s),this.p1=new I(u,c)}},Jd={serialVersionUID:{configurable:!0}};Zt.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Zt.prototype.orientationIndex=function(){if(arguments[0]instanceof Zt){var n=arguments[0],i=J.orientationIndex(this.p0,this.p1,n.p0),s=J.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 I){var u=arguments[0];return J.orientationIndex(this.p0,this.p1,u)}},Zt.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},Zt.prototype.isVertical=function(){return this.p0.x===this.p1.x},Zt.prototype.equals=function(n){if(!(n instanceof Zt))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},Zt.prototype.intersection=function(n){var i=new pn;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},Zt.prototype.project=function(){if(arguments[0]instanceof I){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new I(n);var i=this.projectionFactor(n),s=new I;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 Zt){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 Zt(E,A)}},Zt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Zt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Zt.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},Zt.prototype.distancePerpendicular=function(n){return J.distancePointLinePerpendicular(n,this.p0,this.p1)},Zt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Zt.prototype.midPoint=function(){return Zt.midPoint(this.p0,this.p1)},Zt.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?S.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/u},Zt.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),u=S.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},Zt.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},Zt.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Zt.prototype.getLength=function(){return this.p0.distance(this.p1)},Zt.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},Zt.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},Zt.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)},Zt.prototype.lineIntersection=function(n){try{return Qt.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof Xt))throw i}return null},Zt.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Zt.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 I(s-U,u+A)},Zt.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}},Zt.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||S.isNaN(i))&&(i=1),i},Zt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Zt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Zt.prototype.distance=function(){if(arguments[0]instanceof Zt){var n=arguments[0];return J.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof I){var i=arguments[0];return J.distancePointLine(i,this.p0,this.p1)}},Zt.prototype.pointAlong=function(n){var i=new I;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},Zt.prototype.hashCode=function(){var n=S.doubleToLongBits(this.p0.x);n^=31*S.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=S.doubleToLongBits(this.p1.x);return s^=31*S.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},Zt.prototype.interfaces_=function(){return[N,t]},Zt.prototype.getClass=function(){return Zt},Zt.midPoint=function(n,i){return new I((n.x+i.x)/2,(n.y+i.y)/2)},Jd.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Zt,Jd);var Eu=function(){this.tempEnv1=new Ct,this.tempEnv2=new Ct,this._overlapSeg1=new Zt,this._overlapSeg2=new Zt};Eu.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)}}},Eu.prototype.interfaces_=function(){return[]},Eu.prototype.getClass=function(){return Eu};var Vr=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};Vr.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},Vr.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)},Vr.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},Vr.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},Vr.prototype.setId=function(n){this._id=n},Vr.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},Vr.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new Ct(n,i)}return this._env},Vr.prototype.getEndIndex=function(){return this._end},Vr.prototype.getStartIndex=function(){return this._start},Vr.prototype.getContext=function(){return this._context},Vr.prototype.getId=function(){return this._id},Vr.prototype.computeOverlapsInternal=function(n,i,s,u,c,m){var E=this._pts[n],A=this._pts[i],U=s._pts[u],K=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,K),!m.tempEnv1.intersects(m.tempEnv2))return null;var pt=Math.trunc((n+i)/2),dt=Math.trunc((u+c)/2);n<pt&&(u<dt&&this.computeOverlapsInternal(n,pt,s,u,dt,m),dt<c&&this.computeOverlapsInternal(n,pt,s,dt,c,m)),pt<i&&(u<dt&&this.computeOverlapsInternal(pt,i,s,u,dt,m),dt<c&&this.computeOverlapsInternal(pt,i,s,dt,c,m))},Vr.prototype.interfaces_=function(){return[]},Vr.prototype.getClass=function(){return Vr};var Ri=function(){};Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri},Ri.getChainStartIndices=function(n){var i=0,s=new Z;s.add(new lt(i));do{var u=Ri.findChainEnd(n,i);s.add(new lt(u)),i=u}while(i<n.length-1);return Ri.toIntArray(s)},Ri.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=cn.quadrant(n[s],n[s+1]),c=i+1;c<n.length&&!(!n[c-1].equals2D(n[c])&&cn.quadrant(n[c-1],n[c])!==u);)c++;return c-1},Ri.getChains=function(){if(arguments.length===1){var n=arguments[0];return Ri.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],u=new Z,c=Ri.getChainStartIndices(i),m=0;m<c.length-1;m++){var E=new Vr(i,c[m],c[m+1],s);u.add(E)}return u}},Ri.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 Qo=function(){};Qo.prototype.computeNodes=function(n){},Qo.prototype.getNodedSubstrings=function(){},Qo.prototype.interfaces_=function(){return[]},Qo.prototype.getClass=function(){return Qo};var Mu=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};Mu.prototype.setSegmentIntersector=function(n){this._segInt=n},Mu.prototype.interfaces_=function(){return[Qo]},Mu.prototype.getClass=function(){return Mu};var Eh=function(n){function i(u){u?n.call(this,u):n.call(this),this._monoChains=new Z,this._index=new $d,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 Nn.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(u){for(var c=Ri.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 Kd(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 Kd},Object.defineProperties(i,s),i}(Mu),Kd=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}(Eu),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 In=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=J.COUNTERCLOCKWISE,this._inputLine=n||null},Su={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};In.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)},In.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]=In.DELETE,c=!0,u=!0),n=c?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return u},In.prototype.isShallowConcavity=function(n,i,s,u){return J.computeOrientation(n,i,s)!==this._angleOrientation?!1:J.distancePointLine(i,n,s)<u},In.prototype.isShallowSampled=function(n,i,s,u,c){var m=Math.trunc((u-s)/In.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},In.prototype.isConcave=function(n,i,s){var u=J.computeOrientation(n,i,s)===this._angleOrientation;return u},In.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=J.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},In.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===In.DELETE;)i++;return i},In.prototype.isShallow=function(n,i,s,u){return J.distancePointLine(i,n,s)<u},In.prototype.collapseLine=function(){for(var n=new ot,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==In.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In},In.simplify=function(n,i){return new In(n).simplify(i)},Su.INIT.get=function(){return 0},Su.DELETE.get=function(){return 1},Su.KEEP.get=function(){return 1},Su.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(In,Su);var Kr=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new Z},jd={COORDINATE_ARRAY_TYPE:{configurable:!0}};Kr.prototype.getCoordinates=function(){return this._ptList.toArray(Kr.COORDINATE_ARRAY_TYPE)},Kr.prototype.setPrecisionModel=function(n){this._precisionModel=n},Kr.prototype.addPt=function(n){var i=new I(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},Kr.prototype.revere=function(){},Kr.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])},Kr.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},Kr.prototype.toString=function(){return new ue().createLineString(this.getCoordinates()).toString()},Kr.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new I(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},Kr.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},Kr.prototype.interfaces_=function(){return[]},Kr.prototype.getClass=function(){return Kr},jd.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Kr,jd);var me=function(){},Rs={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},Rs.PI_TIMES_2.get=function(){return 2*Math.PI},Rs.PI_OVER_2.get=function(){return Math.PI/2},Rs.PI_OVER_4.get=function(){return Math.PI/4},Rs.COUNTERCLOCKWISE.get=function(){return J.COUNTERCLOCKWISE},Rs.CLOCKWISE.get=function(){return J.CLOCKWISE},Rs.NONE.get=function(){return J.COLLINEAR},Object.defineProperties(me,Rs);var vn=function n(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Zt,this._seg1=new Zt,this._offset0=new Zt,this._offset1=new Zt,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 pn,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)},wu={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};vn.prototype.addNextSegment=function(n,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var s=J.computeOrientation(this._s0,this._s1,this._s2),u=s===J.CLOCKWISE&&this._side===bt.LEFT||s===J.COUNTERCLOCKWISE&&this._side===bt.RIGHT;s===0?this.addCollinear(i):u?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},vn.prototype.addLineEndCap=function(n,i){var s=new Zt(n,i),u=new Zt;this.computeOffsetSegment(s,bt.LEFT,this._distance,u);var c=new Zt;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,J.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 I;U.x=Math.abs(this._distance)*Math.cos(A),U.y=Math.abs(this._distance)*Math.sin(A);var K=new I(u.p1.x+U.x,u.p1.y+U.y),pt=new I(c.p1.x+U.x,c.p1.y+U.y);this._segList.addPt(K),this._segList.addPt(pt)}},vn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},vn.prototype.addMitreJoin=function(n,i,s,u){var c=!0,m=null;try{m=Qt.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 Xt))throw E;m=new I(0,0),c=!1}c?this._segList.addPt(m):this.addLimitedMitreJoin(i,s,u,this._bufParams.getMitreLimit())},vn.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,K=s.y-n.y,pt=Math.atan2(K,U);u===J.CLOCKWISE?A<=pt&&(A+=2*Math.PI):A>=pt&&(A-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,A,pt,u,c),this._segList.addPt(s)},vn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*vn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===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))},vn.prototype.createSquare=function(n){this._segList.addPt(new I(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new I(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new I(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new I(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},vn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},vn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},vn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},vn.prototype.initSideSegments=function(n,i,s){this._s1=n,this._s2=i,this._side=s,this._seg1.setCoordinates(n,i),this.computeOffsetSegment(this._seg1,s,this._distance,this._offset1)},vn.prototype.addLimitedMitreJoin=function(n,i,s,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),K=u*s,pt=s-K*Math.abs(Math.sin(E)),dt=c.x+K*Math.cos(U),Rt=c.y+K*Math.sin(U),Ot=new I(dt,Rt),Vt=new Zt(c,Ot),jt=Vt.pointAlongOffset(1,pt),sn=Vt.pointAlongOffset(1,-pt);this._side===bt.LEFT?(this._segList.addPt(jt),this._segList.addPt(sn)):(this._segList.addPt(sn),this._segList.addPt(jt))},vn.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,K=c*s*E/A;u.p0.x=n.p0.x-K,u.p0.y=n.p0.y+U,u.p1.x=n.p1.x-K,u.p1.y=n.p1.y+U},vn.prototype.addFilletArc=function(n,i,s,u,c){var m=u===J.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,K=0,pt=new I;K<E;){var dt=i+m*K;pt.x=n.x+c*Math.cos(dt),pt.y=n.y+c*Math.sin(dt),this._segList.addPt(pt),K+=U}},vn.prototype.addInsideTurn=function(n,i){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*vn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var s=new I((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 I((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)}},vn.prototype.createCircle=function(n){var i=new I(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},vn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},vn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Kr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*vn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},vn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===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,J.CLOCKWISE,this._distance))},vn.prototype.closeRing=function(){this._segList.closeRing()},vn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},vn.prototype.interfaces_=function(){return[]},vn.prototype.getClass=function(){return vn},wu.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},wu.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},wu.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},wu.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(vn,wu);var Rr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};Rr.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&&Q.reverse(m),m},Rr.prototype.computeSingleSidedBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var c=In.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=In.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var K=2;K<=U;K++)s.addNextSegment(A[K],!0)}s.addLastSegment(),s.closeRing()},Rr.prototype.computeRingBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);i===bt.RIGHT&&(u=-u);var c=In.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()},Rr.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),u=In.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=In.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()},Rr.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:i.createCircle(n);break;case We.CAP_SQUARE:i.createSquare(n)}},Rr.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()},Rr.prototype.getBufferParameters=function(){return this._bufParams},Rr.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},Rr.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return Rr.copyCoordinates(n);var u=this.getSegGen(s);return this.computeRingBufferCurve(n,i,u),u.getCoordinates()},Rr.prototype.computeOffsetCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){var c=In.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=In.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var K=2;K<=U;K++)s.addNextSegment(A[K],!0)}s.addLastSegment()},Rr.prototype.getSegGen=function(n){return new vn(this._precisionModel,this._bufParams,n)},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr},Rr.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new I(n[s]);return i};var Ls=function(){this._subgraphs=null,this._seg=new Zt,this._cga=new J;var n=arguments[0];this._subgraphs=n},Qd={DepthSegment:{configurable:!0}};Ls.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new Z,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($(arguments[2],tt)&&arguments[0]instanceof I&&arguments[1]instanceof xh){for(var m=arguments[0],E=arguments[1],A=arguments[2],U=E.getEdge().getCoordinates(),K=0;K<U.length-1;K++)if(this._seg.p0=U[K],this._seg.p1=U[K+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||J.computeOrientation(this._seg.p0,this._seg.p1,m)===J.RIGHT)){var pt=E.getDepth(bt.LEFT);this._seg.p0.equals(U[K])||(pt=E.getDepth(bt.RIGHT));var dt=new ts(this._seg,pt);A.add(dt)}}else if($(arguments[2],tt)&&arguments[0]instanceof I&&$(arguments[1],tt))for(var Rt=arguments[0],Ot=arguments[1],Vt=arguments[2],jt=Ot.iterator();jt.hasNext();){var sn=jt.next();sn.isForward()&&this.findStabbedSegments(Rt,sn,Vt)}}},Ls.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:_i.min(i)._leftDepth},Ls.prototype.interfaces_=function(){return[]},Ls.prototype.getClass=function(){return Ls},Qd.DepthSegment.get=function(){return ts},Object.defineProperties(Ls,Qd);var ts=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new Zt(n),this._leftDepth=i};ts.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)},ts.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},ts.prototype.toString=function(){return this._upwardSeg.toString()},ts.prototype.interfaces_=function(){return[N]},ts.prototype.getClass=function(){return ts};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 P("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,K=u.y-m,pt=E*K-A*U,dt=n.x-c,Rt=n.y-m,Ot=(K*dt-A*Rt)/pt,Vt=(-U*dt+E*Rt)/pt;return i.z+Ot*(s.z-i.z)+Vt*(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,K=2*qe.det(m,E,A,U),pt=qe.det(E,m*m+E*E,U,A*A+U*U),dt=qe.det(m,m*m+E*E,A,A*A+U*U);return new I(u-pt/K,c+dt/K)},qe.perpendicularBisector=function(n,i){var s=i.x-n.x,u=i.y-n.y,c=new Qt(n.x+s/2,n.y+u/2,1),m=new Qt(n.x-u+s/2,n.y+s+u/2,1);return new Qt(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 I(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,K=c*U-m*A,pt=m*E-u*U,dt=u*A-c*E,Rt=K*K+pt*pt+dt*dt,Ot=Math.sqrt(Rt)/2;return Ot},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 I(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 I(A,U)};var ci=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Z;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};ci.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,V.EXTERIOR,V.INTERIOR)},ci.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=Q.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,V.EXTERIOR,V.INTERIOR);for(var m=0;m<n.getNumInteriorRing();m++){var E=n.getInteriorRingN(m),A=Q.removeRepeatedPoints(E.getCoordinates());this._distance>0&&this.isErodedCompletely(E,-this._distance)||this.addPolygonRing(A,i,bt.opposite(s),V.INTERIOR,V.EXTERIOR)}},ci.prototype.isTriangleErodedCompletely=function(n,i){var s=new qe(n[0],n[1],n[2]),u=s.inCentre();return J.distancePointLine(u,s.p0,s.p1)<Math.abs(i)},ci.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=Q.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,V.EXTERIOR,V.INTERIOR)},ci.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var u=new Nn(n,new on(0,V.BOUNDARY,i,s));this._curveList.add(u)},ci.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},ci.prototype.addPolygonRing=function(n,i,s,u,c){if(i===0&&n.length<an.MINIMUM_VALID_SIZE)return null;var m=u,E=c;n.length>=an.MINIMUM_VALID_SIZE&&J.isCCW(n)&&(m=c,E=u,s=bt.opposite(s));var A=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(A,m,E)},ci.prototype.add=function(n){if(n.isEmpty())return null;n instanceof Wt?this.addPolygon(n):n instanceof zt?this.addLineString(n):n instanceof Kt?this.addPoint(n):n instanceof he?this.addCollection(n):n instanceof W?this.addCollection(n):n instanceof ln?this.addCollection(n):n instanceof gn&&this.addCollection(n)},ci.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},ci.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},ci.prototype.interfaces_=function(){return[]},ci.prototype.getClass=function(){return ci};var fa=function(){};fa.prototype.locate=function(n){},fa.prototype.interfaces_=function(){return[]},fa.prototype.getClass=function(){return fa};var Wi=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()};Wi.prototype.next=function(){if(this._atStart)return this._atStart=!1,Wi.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 gn?(this._subcollectionIterator=new Wi(n),this._subcollectionIterator.next()):n},Wi.prototype.remove=function(){throw new Error(this.getClass().getName())},Wi.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)},Wi.prototype.interfaces_=function(){return[D]},Wi.prototype.getClass=function(){return Wi},Wi.isAtomic=function(n){return!(n instanceof gn)};var jr=function(){this._geom=null;var n=arguments[0];this._geom=n};jr.prototype.locate=function(n){return jr.locate(n,this._geom)},jr.prototype.interfaces_=function(){return[fa]},jr.prototype.getClass=function(){return jr},jr.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&J.isPointInRing(n,i.getCoordinates())},jr.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!jr.isPointInRing(n,s))return!1;for(var u=0;u<i.getNumInteriorRing();u++){var c=i.getInteriorRingN(u);if(jr.isPointInRing(n,c))return!1}return!0},jr.containsPoint=function(n,i){if(i instanceof Wt)return jr.containsPointInPolygon(n,i);if(i instanceof gn)for(var s=new Wi(i);s.hasNext();){var u=s.next();if(u!==i&&jr.containsPoint(n,u))return!0}return!1},jr.locate=function(n,i){return i.isEmpty()?V.EXTERIOR:jr.containsPoint(n,i)?V.INTERIOR:V.EXTERIOR};var ar=function(){this._edgeMap=new _,this._edgeList=null,this._ptInAreaLocation=[V.NONE,V.NONE]};ar.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)},ar.prototype.propagateSideLabels=function(n){for(var i=V.NONE,s=this.iterator();s.hasNext();){var u=s.next().getLabel();u.isArea(n)&&u.getLocation(n,bt.LEFT)!==V.NONE&&(i=u.getLocation(n,bt.LEFT))}if(i===V.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)===V.NONE&&A.setLocation(n,bt.ON,c),A.isArea(n)){var U=A.getLocation(n,bt.LEFT),K=A.getLocation(n,bt.RIGHT);if(K!==V.NONE){if(K!==c)throw new lo("side location conflict",E.getCoordinate());U===V.NONE&&Pt.shouldNeverReachHere("found single null side (at "+E.getCoordinate()+")"),c=U}else Pt.isTrue(A.getLocation(n,bt.LEFT)===V.NONE,"found single null side"),A.setLocation(n,bt.RIGHT,c),A.setLocation(n,bt.LEFT,c)}}},ar.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},ar.prototype.print=function(n){Ft.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},ar.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},ar.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);Pt.isTrue(u!==V.NONE,"Found unlabelled area edge");for(var c=u,m=this.iterator();m.hasNext();){var E=m.next().getLabel();Pt.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},ar.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},ar.prototype.iterator=function(){return this.getEdges().iterator()},ar.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new Z(this._edgeMap.values())),this._edgeList},ar.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===V.NONE&&(this._ptInAreaLocation[n]=jr.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},ar.prototype.toString=function(){var n=new mt;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(\`
|
|
3837
3708
|
\`);for(var i=this.iterator();i.hasNext();){var s=i.next();n.append(s),n.append(\`
|