@aibee/crc-bmap 0.5.8 → 0.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var pi=Object.create;var be=Object.defineProperty;var fi=Object.getOwnPropertyDescriptor;var di=Object.getOwnPropertyNames;var gi=Object.getPrototypeOf,mi=Object.prototype.hasOwnProperty;var Ct=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),_i=(s,e)=>{for(var t in e)be(s,t,{get:e[t],enumerable:!0})},qn=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of di(e))!mi.call(s,r)&&r!==t&&be(s,r,{get:()=>e[r],enumerable:!(n=fi(e,r))||n.enumerable});return s};var Zt=(s,e,t)=>(t=s!=null?pi(gi(s)):{},qn(e||!s||!s.__esModule?be(t,"default",{value:s,enumerable:!0}):t,s)),yi=s=>qn(be({},"__esModule",{value:!0}),s);var Yn=Ct((yo,jn)=>{jn.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var Zn=Ct((vo,Kn)=>{var $n=Yn();Kn.exports=function(s,e){Array.isArray(e)||(e=[]),s.length>0&&e.push($n([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($n([0,0],s[s.length-1])),e}});var nr=Ct((bo,er)=>{var fn=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)}};er.exports=fn});var or=Ct((So,ir)=>{function rr(s,e){let t=new Map;for(let[n,r]of s)n!==e&&r instanceof Map?t.set(n,rr(r,e)):n!==e&&t.set(n,r);return t}ir.exports=rr});var lr=Ct((Mo,ar)=>{function Ai(s){let e=Number(s);return!(isNaN(e)||e<=0)}function sr(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,sr(r));if(!Ai(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}ar.exports=sr});var hr=Ct((wo,cr)=>{function ur(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){ur(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}cr.exports=ur});var gn=Ct((To,dr)=>{var Ii=nr(),Ri=or(),pr=lr(),fr=hr(),dn=class{constructor(e){e instanceof Map?(fr(e),this.graph=e):e?this.graph=pr(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(fr(t),n=t):n=pr(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=Ri(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 Ii,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)}};dr.exports=dn});var Zi={};_i(Zi,{AibeeLoader:()=>Wn,BMap:()=>wn,BMapSelect:()=>Dn,BaseSvg:()=>Z,Context:()=>_e,CrLoader:()=>Xn,CrNavPath:()=>Nn,Equipment:()=>Tn,Events:()=>an,Floor:()=>ut,GlbModel:()=>he,Graphic:()=>I,GraphicLayer:()=>se,GroundTexture:()=>qt,HeatmapElement:()=>ie,HooksName:()=>Wt,HoverHelper:()=>me,Lane:()=>pe,Layer:()=>F,MapTypePolar:()=>kr,MergeGraphic:()=>fe,Model:()=>oe,MulFloors:()=>An,NavPath:()=>Rn,Navigation:()=>Pn,Overlay:()=>re,PathDirection:()=>hn,PdrPosition:()=>On,Poi:()=>bt,Poi2:()=>q,PoiLayer:()=>ae,PoiLayer2:()=>Ut,RoadNetwork:()=>mn,RoadNetwork2:()=>_n,SelectBox:()=>xn,Selection:()=>ge,Sensor:()=>xe,Shadow:()=>ne,SvgLine:()=>le,SvgPolygon:()=>ue,TextTexture:()=>de,Timer:()=>N,TweenUtil:()=>Dt,UA:()=>on,Wall:()=>ce,addAlphaToHexColor:()=>Si,calc_angle:()=>Qe,calc_direction:()=>Me,convertToSnakeCase:()=>yn,createCircle:()=>Vt,createLine:()=>te,createRect:()=>mt,createSvg:()=>nn,createSvgElement:()=>Qt,createThreeBox:()=>Di,createThreeLine:()=>Ni,darkenColor:()=>pt,defaultAibeeLoaderOption:()=>Ki,defaultConfig:()=>Gr,defaultGraphicOptions:()=>we,defaultOptions:()=>Tr,defaultTextTextureOptions:()=>Lr,dispose:()=>k,distancePointToSegment:()=>cn,generatorKeyByObj:()=>Lt,getAngle:()=>Qn,getCenter:()=>Jt,getConfig:()=>Mn,getDirectPath:()=>Pi,getDistanceByPathPos:()=>pn,getLength:()=>D,getLongestSideDir:()=>vi,getMinEdgeSquare:()=>tn,getPathLength:()=>st,getPointEdgeIndex:()=>Pt,getPosByPathDistance:()=>ee,hasChinese:()=>Je,hexToRgb:()=>Se,initDirectionalLight:()=>Ze,initLight:()=>Ke,initShape:()=>ot,isAndroid:()=>Mi,isContain:()=>gt,isControl:()=>Rt,isIphone:()=>Ht,isMac:()=>It,isPointInPolygon:()=>en,loadBuildingGround:()=>Fn,loadExternalStreet:()=>Xi,loadGraphics:()=>Un,moveOnRoute:()=>Ci,proxyOptions:()=>At,removeWeightPath:()=>tr,setCirclePosition:()=>_t,setLineStartEnd:()=>tt,setRectPosition:()=>B,simplifyPath:()=>un,sleepOnePromise:()=>rn,sleepOneRf:()=>Ei,smoothPath:()=>ln,strToNumber:()=>bi,timeoutPromise:()=>ht,toWebWorker:()=>Li,transformGraphicData:()=>X,translatePosToCenter:()=>nt,triggerWorker:()=>at,vector3ToDevice:()=>y,xhrGet:()=>wi});module.exports=yi(Zi);var Be=require("three");var N=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 Ke(){let s=new K.Group,e=new K.AmbientLight(16777215,2.6);return s.add(e),s}function ot(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 Ze(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 k(s,e){if(e&&s.children&&s.children.length&&s.children.forEach(t=>{k(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 Je(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 vi(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 D(s,e){return Math.sqrt((e[0]-s[0])**2+(e[1]-s[1])**2)}function st(s){let e=0;for(let t=0;t<s.length-1;t++)e+=D(s[t],s[t+1]);return e}function Qe(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 tn(s,e){let t=Math.min(D(s[0][0],s[0][1]),D(s[0][2],s[0][1]))-1;e||(e=Jt(s[0]));let n=xi(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 xi(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 en(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 ht(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 nn(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 tt(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 rn(){return Promise.resolve()}function Ei(){return new Promise(s=>{requestAnimationFrame(s)})}function bi(s){return parseInt(s.replace("#","0x"),16)}function Si(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,on=(window.navigator.userAgent||"").toLocaleLowerCase(),Ht=/ios|iphone/i.test(on),Mi=/android|adr|linux/gi.test(on);function Rt(s){return It?s==="Meta":s==="Control"}var sn="__once__",an=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=`${sn}${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(`${sn}${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(`${sn}${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 wi(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"),Jn=Zt(Zn(),1);function Qn(s,e){let t=s.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function Ti(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 ln(s,e=.25){if(Ti(s)<e)return s;let t=(0,Jn.default)(s);return ln(t,e)}function un(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=Qn(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(...ln(E,i/25))}return l.push(o[o.length-1]),tr(l)}function tr(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 cn(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 Ci(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 hn=(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))(hn||{});function Me(s,e,t){let n=Qe(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 Pi(s){if(!s.length)return[];let e=[{direction:"start",distance:D(s[0],s[1]),points:[s[0],s[1]]}];for(let t=2;t<s.length;t++){let n=Me(s[t-2],s[t-1],s[t]);if(n==="front"){let r=e[e.length-1],i=D(s[t-1],s[t]);r.distance+=i,t!==2&&r.points.push(s[t-1])}else e.push({direction:n,distance:D(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 pn(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(gn(),1);var et="___",mn=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}${et}${n.id}`;if(this.pointMap.set(r,n),this.nodeMap.set(`${n.floor}${et}${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}${et}${n.from}`,i=`${t.floor}${et}${n.to}`,o=this.pointMap.get(r)?.cds,a=this.pointMap.get(i)?.cds;if(o?.length&&a?.length){let l=D(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}${et}${o[a].id}`;for(let u=0;u<o.length;u++)if(a!==u){let c=`${o[u].floor}${et}${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}${et}${i.start.id}`,l=`${i.end.floor}${et}${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}${et}${e.nodeId}`);if(t){let[n,r]=t.split(et);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=D(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+st(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}${et}${e.id}`,i=`${t.floor}${et}${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=st(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(gn(),1);var yt=require("lodash"),w="___",_n=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.relatedId||o.id}`;if(this.nodeMap.set(`${i.floor}${w}${o.nodeId}`,a),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=D(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=D(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+st(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=st(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 yn(s){return s.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function at(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 Li(s){let e={};for(let n in s)n.startsWith("on")&&(e[yn(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 lt=require("three");function Ni(s,e=16711680){let t=new lt.LineBasicMaterial({color:e}),n=new lt.BufferGeometry().setFromPoints(s);return new lt.Line(n,t)}function Di(s,e=16711680){let t=new lt.LineBasicMaterial({color:e}),n=new lt.BoxGeometry(1,1,1),r=new lt.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=>nt(i,e)))),n.doors?.length&&n.doors.map(r=>{r.coord=nt(r.coordinate,e)}),n.center&&(n.center=nt(n.center,e))):n.geometry.coords=nt(n.geometry.cds,e)});for(let n=0;n<s.length;n++){let r=s[n];r.deltaHeight=1e-5*(t+n+1)}}function nt(s,e){return[s[0]-e[0],s[1]-e[1]]}var gr=require("@tweenjs/tween.js"),Dt=class{pauseTween=!1;tweenStore=new Set;group=new gr.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 Dr=require("three");var v=require("three");var _r=require("three/examples/jsm/lines/LineMaterial"),V=require("three");function mr(s){return`${s.x}-${s.y}-${s.z}`}var A=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 V.LineBasicMaterial({color:new V.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 V.MeshStandardMaterial({color:new V.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 V.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()}-${mr(t)}-${n}-${r}-${mr(i)}`;if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let u=`
1
+ "use strict";var pi=Object.create;var be=Object.defineProperty;var fi=Object.getOwnPropertyDescriptor;var di=Object.getOwnPropertyNames;var gi=Object.getPrototypeOf,mi=Object.prototype.hasOwnProperty;var Ct=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),_i=(s,e)=>{for(var t in e)be(s,t,{get:e[t],enumerable:!0})},qn=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of di(e))!mi.call(s,r)&&r!==t&&be(s,r,{get:()=>e[r],enumerable:!(n=fi(e,r))||n.enumerable});return s};var Zt=(s,e,t)=>(t=s!=null?pi(gi(s)):{},qn(e||!s||!s.__esModule?be(t,"default",{value:s,enumerable:!0}):t,s)),yi=s=>qn(be({},"__esModule",{value:!0}),s);var Yn=Ct((yo,jn)=>{jn.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var Zn=Ct((vo,Kn)=>{var $n=Yn();Kn.exports=function(s,e){Array.isArray(e)||(e=[]),s.length>0&&e.push($n([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($n([0,0],s[s.length-1])),e}});var nr=Ct((bo,er)=>{var fn=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)}};er.exports=fn});var or=Ct((So,ir)=>{function rr(s,e){let t=new Map;for(let[n,r]of s)n!==e&&r instanceof Map?t.set(n,rr(r,e)):n!==e&&t.set(n,r);return t}ir.exports=rr});var lr=Ct((Mo,ar)=>{function Ai(s){let e=Number(s);return!(isNaN(e)||e<=0)}function sr(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,sr(r));if(!Ai(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}ar.exports=sr});var hr=Ct((wo,cr)=>{function ur(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){ur(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}cr.exports=ur});var gn=Ct((To,dr)=>{var Ii=nr(),Ri=or(),pr=lr(),fr=hr(),dn=class{constructor(e){e instanceof Map?(fr(e),this.graph=e):e?this.graph=pr(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(fr(t),n=t):n=pr(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=Ri(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 Ii,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)}};dr.exports=dn});var Zi={};_i(Zi,{AibeeLoader:()=>Wn,BMap:()=>wn,BMapSelect:()=>Dn,BaseSvg:()=>Z,Context:()=>_e,CrLoader:()=>Xn,CrNavPath:()=>Nn,Equipment:()=>Tn,Events:()=>an,Floor:()=>ut,GlbModel:()=>he,Graphic:()=>I,GraphicLayer:()=>se,GroundTexture:()=>qt,HeatmapElement:()=>ie,HooksName:()=>Wt,HoverHelper:()=>me,Lane:()=>pe,Layer:()=>F,MapTypePolar:()=>kr,MergeGraphic:()=>fe,Model:()=>oe,MulFloors:()=>An,NavPath:()=>Rn,Navigation:()=>Pn,Overlay:()=>re,PathDirection:()=>hn,PdrPosition:()=>On,Poi:()=>bt,Poi2:()=>q,PoiLayer:()=>ae,PoiLayer2:()=>Ut,RoadNetwork:()=>mn,RoadNetwork2:()=>_n,SelectBox:()=>xn,Selection:()=>ge,Sensor:()=>xe,Shadow:()=>ne,SvgLine:()=>le,SvgPolygon:()=>ue,TextTexture:()=>de,Timer:()=>N,TweenUtil:()=>Dt,UA:()=>on,Wall:()=>ce,addAlphaToHexColor:()=>Si,calc_angle:()=>Qe,calc_direction:()=>Me,convertToSnakeCase:()=>yn,createCircle:()=>Vt,createLine:()=>te,createRect:()=>mt,createSvg:()=>nn,createSvgElement:()=>Qt,createThreeBox:()=>Di,createThreeLine:()=>Ni,darkenColor:()=>pt,defaultAibeeLoaderOption:()=>Ki,defaultConfig:()=>Gr,defaultGraphicOptions:()=>we,defaultOptions:()=>Tr,defaultTextTextureOptions:()=>Lr,dispose:()=>k,distancePointToSegment:()=>cn,generatorKeyByObj:()=>Lt,getAngle:()=>Qn,getCenter:()=>Jt,getConfig:()=>Mn,getDirectPath:()=>Pi,getDistanceByPathPos:()=>pn,getLength:()=>D,getLongestSideDir:()=>vi,getMinEdgeSquare:()=>tn,getPathLength:()=>st,getPointEdgeIndex:()=>Pt,getPosByPathDistance:()=>ee,hasChinese:()=>Je,hexToRgb:()=>Se,initDirectionalLight:()=>Ze,initLight:()=>Ke,initShape:()=>ot,isAndroid:()=>Mi,isContain:()=>gt,isControl:()=>Rt,isIphone:()=>Ht,isMac:()=>It,isPointInPolygon:()=>en,loadBuildingGround:()=>Fn,loadExternalStreet:()=>Xi,loadGraphics:()=>Un,moveOnRoute:()=>Ci,proxyOptions:()=>At,removeWeightPath:()=>tr,setCirclePosition:()=>_t,setLineStartEnd:()=>tt,setRectPosition:()=>B,simplifyPath:()=>un,sleepOnePromise:()=>rn,sleepOneRf:()=>Ei,smoothPath:()=>ln,strToNumber:()=>bi,timeoutPromise:()=>ht,toWebWorker:()=>Li,transformGraphicData:()=>X,translatePosToCenter:()=>nt,triggerWorker:()=>at,vector3ToDevice:()=>y,xhrGet:()=>wi});module.exports=yi(Zi);var Be=require("three");var N=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 Ke(){let s=new K.Group,e=new K.AmbientLight(16777215,2.6);return s.add(e),s}function ot(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 Ze(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 k(s,e){if(e&&s.children&&s.children.length&&s.children.forEach(t=>{k(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 Je(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 vi(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 D(s,e){return Math.sqrt((e[0]-s[0])**2+(e[1]-s[1])**2)}function st(s){let e=0;for(let t=0;t<s.length-1;t++)e+=D(s[t],s[t+1]);return e}function Qe(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 tn(s,e){let t=Math.min(D(s[0][0],s[0][1]),D(s[0][2],s[0][1]))-1;e||(e=Jt(s[0]));let n=xi(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 xi(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 en(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 ht(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 nn(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 tt(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 rn(){return Promise.resolve()}function Ei(){return new Promise(s=>{requestAnimationFrame(s)})}function bi(s){return parseInt(s.replace("#","0x"),16)}function Si(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,on=(window.navigator.userAgent||"").toLocaleLowerCase(),Ht=/ios|iphone/i.test(on),Mi=/android|adr|linux/gi.test(on);function Rt(s){return It?s==="Meta":s==="Control"}var sn="__once__",an=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=`${sn}${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(`${sn}${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(`${sn}${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 wi(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"),Jn=Zt(Zn(),1);function Qn(s,e){let t=s.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function Ti(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 ln(s,e=.25){if(Ti(s)<e)return s;let t=(0,Jn.default)(s);return ln(t,e)}function un(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=Qn(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(...ln(E,i/25))}return l.push(o[o.length-1]),tr(l)}function tr(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 cn(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 Ci(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 hn=(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))(hn||{});function Me(s,e,t){let n=Qe(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 Pi(s){if(!s.length)return[];let e=[{direction:"start",distance:D(s[0],s[1]),points:[s[0],s[1]]}];for(let t=2;t<s.length;t++){let n=Me(s[t-2],s[t-1],s[t]);if(n==="front"){let r=e[e.length-1],i=D(s[t-1],s[t]);r.distance+=i,t!==2&&r.points.push(s[t-1])}else e.push({direction:n,distance:D(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 pn(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(gn(),1);var et="___",mn=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}${et}${n.id}`;if(this.pointMap.set(r,n),this.nodeMap.set(`${n.floor}${et}${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}${et}${n.from}`,i=`${t.floor}${et}${n.to}`,o=this.pointMap.get(r)?.cds,a=this.pointMap.get(i)?.cds;if(o?.length&&a?.length){let l=D(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}${et}${o[a].id}`;for(let u=0;u<o.length;u++)if(a!==u){let c=`${o[u].floor}${et}${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}${et}${i.start.id}`,l=`${i.end.floor}${et}${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}${et}${e.nodeId}`);if(t){let[n,r]=t.split(et);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=D(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+st(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}${et}${e.id}`,i=`${t.floor}${et}${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=st(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(gn(),1);var yt=require("lodash"),w="___",_n=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=D(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=D(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+st(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=st(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 yn(s){return s.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function at(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 Li(s){let e={};for(let n in s)n.startsWith("on")&&(e[yn(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 lt=require("three");function Ni(s,e=16711680){let t=new lt.LineBasicMaterial({color:e}),n=new lt.BufferGeometry().setFromPoints(s);return new lt.Line(n,t)}function Di(s,e=16711680){let t=new lt.LineBasicMaterial({color:e}),n=new lt.BoxGeometry(1,1,1),r=new lt.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=>nt(i,e)))),n.doors?.length&&n.doors.map(r=>{r.coord=nt(r.coordinate,e)}),n.center&&(n.center=nt(n.center,e))):n.geometry.coords=nt(n.geometry.cds,e)});for(let n=0;n<s.length;n++){let r=s[n];r.deltaHeight=1e-5*(t+n+1)}}function nt(s,e){return[s[0]-e[0],s[1]-e[1]]}var gr=require("@tweenjs/tween.js"),Dt=class{pauseTween=!1;tweenStore=new Set;group=new gr.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 Dr=require("three");var v=require("three");var _r=require("three/examples/jsm/lines/LineMaterial"),V=require("three");function mr(s){return`${s.x}-${s.y}-${s.z}`}var A=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 V.LineBasicMaterial({color:new V.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 V.MeshStandardMaterial({color:new V.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 V.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()}-${mr(t)}-${n}-${r}-${mr(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;
@@ -102,11 +102,11 @@
102
102
  }
103
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 R.ShaderMaterial({uniforms:{maxZ:{value:r},uColor:{value:new R.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new R.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=A.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 R.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 R.Vector3(u[0],u[1],n)),t.push(new R.Vector3(c[0],c[1],n))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),n=new R.BufferGeometry().setFromPoints(t);this.lineGeometry=n}createBorder(){this.line&&this.remove(this.line);let t=new R.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 Ir=require("lodash"),Bi={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,Ir.cloneDeep)({...Bi,...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 J=require("three"),Rr=require("three/examples/jsm/utils/BufferGeometryUtils");var Lr={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 J.Object3D{constructor(t,n){super();this.context=t;this.options=n.map(r=>({...Lr,...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 J.PlaneGeometry(d,u.secondHeight),f=new J.Matrix4().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new J.Matrix4().makeRotationZ(u.secondRotate));return m.applyMatrix4(f),m}),r=(0,Rr.mergeGeometries)(n,!0);n.forEach(a=>a.dispose());let i=t.map(a=>{let l=new J.MeshBasicMaterial({map:a,alphaTest:1,side:J.DoubleSide});return a.needsUpdate=!0,l}),o=new J.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 Nr=require("three"),Re=class extends Z{startPoint;endPoint;rect;frustum=new Nr.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 I&&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 Dr.EventDispatcher{constructor(t){super();this.context=t;this.boxSelection=new Re(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 Le=require("three");var me=class extends Le.EventDispatcher{constructor(t){super();this.context=t;this.registryEvent()}curGraphics=new Set;timer=new N;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 Le.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 Ne=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 ut).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"),Or=require("three/examples/jsm/controls/MapControls"),Gt=require("@tweenjs/tween.js");var De=class extends Or.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):ht(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):ht(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 ht(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())}setZoomByDuration(t,n,r=!1,i=500){let o=this.getCameraLookAt(),a={zoom:this.camera.zoom,target:this.target.clone()};return i?ht(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 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 Oe=class extends jt.WebGLRenderer{event=new jt.EventDispatcher;scene;camera;enable=!0;timer=new N;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 Fr=require("three"),Fe=class extends Fr.Scene{constructor(){super()}};var Ur=require("three"),Ue=class extends Ur.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 Fe;renderer=new Oe;camera;control;lights=Ke();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 Ue(t,n),this.renderer.setSize(t,n),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new De(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 Ne(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),W=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(W.x,W.y),new S.Vector2($.x,$.y)]).getSize(new S.Vector2),$e=(c-a-u)/Kt.x,ui=(h-o-l)/Kt.y,ci=Math.min($e,ui),hi=new S.Vector3((m.x+f.x)/2,(m.y+f.y)/2,(m.z+f.z)/2);return{zoom:ci*this.camera.zoom,center:hi}}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()),k(this.scene)}};var Br=require("lodash"),Gr={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 Mn(s){return(0,Br.merge)({},Gr,s)}var zr=require("lodash");var kr=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(kr||{}),wn=class extends Be.EventDispatcher{constructor(t,n={}){super();this.container=t;this.config=Mn(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 N;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 I)||[]}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 ht(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 Be.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,zr.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(),A.dispose()}};var Vr=require("three"),dt=class extends Vr.EventDispatcher{bmap;constructor(e){super(),this.bmap=e,this.bmap.use(this)}dispose(){}};var Tn=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 L=require("three");var _=require("three"),Q=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)}}})}};Q.prototype.setMatrixWorld=function(s){this.matrixWorld=s};Q.prototype.setGeometry=function(s,e){this._geometry=s,this.setPoints(s.getAttribute("position").array,e)};Q.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 Gi(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,W=T*T,$=n.distanceSqToSegment(a,l,i,u);if(!($>W)){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)}}}}Q.prototype.raycast=Gi;Q.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]};Q.prototype.copyV3=function(s){var e=s*6;return[this.positions[e],this.positions[e+1],this.positions[e+2]]};Q.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};Q.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 Cn(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}Q.prototype.advance=function(s){var e=this._attributes.position.array,t=this._attributes.previous.array,n=this._attributes.next.array,r=e.length;Cn(e,0,t,0,r),Cn(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,Cn(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
- `);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 Hr="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 Wr={texture_url:Hr,lineWidth:8,color:16777215},Ge=class extends L.Object3D{constructor(t,n){super();this.navigation=t;this.config=Object.assign({},Wr,n),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom,this.setDepthTest(this.getDepthTestByControl())}mesh=null;geometry=null;material=null;texture=null;config=Wr;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 L.Vector3(l,u,0),n,r,i)).map(({x:l,y:u})=>[l,u]);return st(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new L.Vector2(t,1)}loadTexture(t){return new Promise((n,r)=>{new L.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 Q;if(this.updatePoints(t),!this.texture){let o=this.texture=await this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=L.RepeatWrapping}let r=this.material=new ye({useMap:!0,color:new L.Color(this.config.color),transparent:!0,resolution:new L.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:L.NormalBlending,repeat:new L.Vector2(this.getRepeat(),1)}),i=this.mesh=new L.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 Xr=require("three");var qr=require("@tweenjs/tween.js"),ki={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},ze=class extends Xr.EventDispatcher{constructor(t,n){super();this.navigation=t;this.options=Object.assign({},ki,n),this.registryEvent()}offset=!1;reset=!1;position=[0,0];routeIndex=0;pointIndex=0;paths=[];options;timer=new N;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),this.emitNavigationStatus()};onUpdate=()=>{this.tweenUtil.update()};resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,n){let{curRoutePathPoints: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,W,$,Tt)=>{if(!Tt[$+1])return T;let{distance:Kt,closestPoint:$e}=cn(n,W,Tt[$+1]);return Kt<T.distance?{distance:Kt,closestPoint:$e,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(!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.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=this.simulationTween=new qr.Tween({distance:0},this.tweenUtil.group).to({distance:o},a*1e3).onUpdate(u=>{let c=ee(i,u.distance);c&&(n.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))}).onComplete(()=>{this.tweenUtil.remove(l),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))}).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 st(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 null;let l=D(r,o);return t===0&&D(i,r)<5?{dir:"start",distance:l}:a?{dir:Me(i,o,a),distance:l}:{dir:"end",distance:l}}getNavigationInfo(){let{total:t,curRoute:n}=this.getRemainDistance(),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<=5&&(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 Vi={path:{},cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},positionNavigation:{},offsetY:150,directionEmitThreshold:5,disablePathAnimation:!1,speed:1},Pn=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;animationPathOptions={cPathIndex:0};cPath=[];positionNavigation;pathMoving=!1;nextPoint=null;constructor(e,t={},n){super(e),!n&&typeof t=="object"&&(n=t),this.options=Object.assign({},Vi,n);let{apiDomain:r,apiPath:{roadNetwork:i},apiInfo:o}=this.bmap.config;this.positionNavigation=new ze(this,{simulationSpeed:this.options.speed,...this.options.positionNavigation}),this.registryEvent()}get curFloorPathLength(){return this.curFloorPath?.distance??0}get curFloorPathPoints(){return this.curFloorPath?.points??[]}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor),this.positionNavigation.addEventListener("navigation-info",this.onNavigationInfo)}onNavigationInfo=({info:e})=>{if(this.dispatchEvent({type:"navigation-info",info:e}),!e.offset){if(e.routeIndex!==this.curPathIndex)return;this.pathMoving?this.nextPoint=e.pos:(this.toPositionBySpeed(e.pos,this.options.speed).then(()=>{this.pathMoving=!1}),this.nextPoint=null)}};pauseAnimation(){this.tweenUtil.pause(),this.positionNavigation.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue(),this.positionNavigation.tweenUtil.continue()}clearTween(){this.tweenUtil.clear(),this.pathMoving=!1}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.pathMoving=!1}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.nextPoint=null,this.pathMoving=!1,this.paths[this.curPathIndex]){let t=this.paths[this.curPathIndex];this.setCurFloorPath(t??null),t?this.renderPath(this.translatePoints(t.points)):this.clearPath()}else this.clearPath()};addPath(e,t=0){this.paths=e,this.curPathIndex=t,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 Ge(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 un(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 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()=>{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()})}async initNavigationCamera(e=1e3){this.clearTween(),this.bmap.context.control.clearTween(),await this.initCameraZoom(e/2),await this.changeCameraToPathUp(e/4),await this.translateCameraToStartPoi(e/4),this.nextPoint&&this.toPositionBySpeed(this.nextPoint,this.options.speed)}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(!(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,0,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(0,p.y,0))}return ht(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)}}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)}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=pn(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(),this.pathMoving=!0,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(()=>{if(this.tweenUtil.remove(h),this.nextPoint){let p=this.nextPoint;this.nextPoint=null,c(this.toPositionBySpeed(p,this.options.speed))}else c(!0)}).start()})}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 jr=require("three"),An=class extends dt{poiLayer;floors=[];group=new jr.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 Yr=require("three");function ve(s){let e=new Blob([s],{type:"text/javascript"}),t=URL.createObjectURL(e),n=new Worker(t);return URL.revokeObjectURL(t),n}function In(){return ve(`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 Lr=(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
- \`);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,Ir,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,Ir=Bt*we-(wr-at*qt-Bt*qt-at*we),oe=Qn-Ir,lt=Qn-oe,It[0]=Qn-(oe+lt)+(lt-Ir),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,Ir=Bt*we-(wr-at*qt-Bt*qt-at*we),oe=Qn-Ir,lt=Qn-oe,Y[0]=Qn-(oe+lt)+(lt-Ir),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,Ir=Bt*we-(wr-at*qt-Bt*qt-at*we),oe=Qn-Ir,lt=Qn-oe,Y[0]=Qn-(oe+lt)+(lt-Ir),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,Ir=Bt*we-(wr-at*qt-Bt*qt-at*we),oe=Qn-Ir,lt=Qn-oe,Y[0]=Qn-(oe+lt)+(lt-Ir),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&&lt?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&&lt)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":\`
107
- \`}[n]};var me=function n(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],l=arguments[1];this.x=s,this.y=l,this.w=1}else if(arguments[0]instanceof n&&arguments[1]instanceof n){var h=arguments[0],v=arguments[1];this.x=h.y*v.w-v.y*h.w,this.y=v.x*h.w-h.x*v.w,this.w=h.x*v.y-v.x*h.y}else if(arguments[0]instanceof D&&arguments[1]instanceof D){var S=arguments[0],R=arguments[1];this.x=S.y-R.y,this.y=R.x-S.x,this.w=S.x*R.y-R.x*S.y}}else if(arguments.length===3){var V=arguments[0],ot=arguments[1],St=arguments[2];this.x=V,this.y=ot,this.w=St}else if(arguments.length===4){var bt=arguments[0],Yt=arguments[1],Jt=arguments[2],se=arguments[3],_e=bt.y-Yt.y,Cn=Yt.x-bt.x,Xn=bt.x*Yt.y-Yt.x*bt.y,ui=Jt.y-se.y,rs=se.x-Jt.x,Fs=Jt.x*se.y-se.x*Jt.y;this.x=Cn*Fs-rs*Xn,this.y=ui*Xn-_e*Fs,this.w=_e*rs-ui*Cn}};me.prototype.getY=function(){var n=this.y/this.w;if(A.isNaN(n)||A.isInfinite(n))throw new le;return n},me.prototype.getX=function(){var n=this.x/this.w;if(A.isNaN(n)||A.isInfinite(n))throw new le;return n},me.prototype.getCoordinate=function(){var n=new D;return n.x=this.getX(),n.y=this.getY(),n},me.prototype.interfaces_=function(){return[]},me.prototype.getClass=function(){return me},me.intersection=function(n,i,s,l){var h=n.y-i.y,v=i.x-n.x,S=n.x*i.y-i.x*n.y,R=s.y-l.y,V=l.x-s.x,ot=s.x*l.y-l.x*s.y,St=h*V-R*v,bt=(v*ot-V*S)/St,Yt=(R*S-h*ot)/St;if(A.isNaN(bt)||A.isInfinite(bt)||A.isNaN(Yt)||A.isInfinite(Yt))throw new le;return new D(bt,Yt)};var Xt=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 D){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.init(l.x,h.x,l.y,h.y)}else if(arguments.length===4){var v=arguments[0],S=arguments[1],R=arguments[2],V=arguments[3];this.init(v,S,R,V)}},Ee={serialVersionUID:{configurable:!0}};Xt.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Xt.prototype.equals=function(n){if(!(n instanceof Xt))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()},Xt.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new Xt;var i=this._minx>n._minx?this._minx:n._minx,s=this._miny>n._miny?this._miny:n._miny,l=this._maxx<n._maxx?this._maxx:n._maxx,h=this._maxy<n._maxy?this._maxy:n._maxy;return new Xt(i,l,s,h)},Xt.prototype.isNull=function(){return this._maxx<this._minx},Xt.prototype.getMaxX=function(){return this._maxx},Xt.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof D){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof Xt){var i=arguments[0];return!this.isNull()&&!i.isNull()&&i.getMinX()>=this._minx&&i.getMaxX()<=this._maxx&&i.getMinY()>=this._miny&&i.getMaxY()<=this._maxy}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return!this.isNull()&&s>=this._minx&&s<=this._maxx&&l>=this._miny&&l<=this._maxy}},Xt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Xt){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 D){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||l>this._maxy||l<this._miny)}},Xt.prototype.getMinY=function(){return this._miny},Xt.prototype.getMinX=function(){return this._minx},Xt.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof D){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof Xt){var i=arguments[0];if(i.isNull())return null;this.isNull()?(this._minx=i.getMinX(),this._maxx=i.getMaxX(),this._miny=i.getMinY(),this._maxy=i.getMaxY()):(i._minx<this._minx&&(this._minx=i._minx),i._maxx>this._maxx&&(this._maxx=i._maxx),i._miny<this._miny&&(this._miny=i._miny),i._maxy>this._maxy&&(this._maxy=i._maxy))}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.isNull()?(this._minx=s,this._maxx=s,this._miny=l,this._maxy=l):(s<this._minx&&(this._minx=s),s>this._maxx&&(this._maxx=s),l<this._miny&&(this._miny=l),l>this._maxy&&(this._maxy=l))}},Xt.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},Xt.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Xt.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},Xt.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},Xt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Xt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Xt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Xt.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},Xt.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()}},Xt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Xt){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof D){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return this.covers(s,l)}},Xt.prototype.centre=function(){return this.isNull()?null:new D((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Xt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof D){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof Xt){var i=arguments[0];this._minx=i._minx,this._maxx=i._maxx,this._miny=i._miny,this._maxy=i._maxy}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.init(s.x,l.x,s.y,l.y)}else if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3];h<v?(this._minx=h,this._maxx=v):(this._minx=v,this._maxx=h),S<R?(this._miny=S,this._maxy=R):(this._miny=R,this._maxy=S)}},Xt.prototype.getMaxY=function(){return this._maxy},Xt.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)},Xt.prototype.hashCode=function(){var n=17;return n=37*n+D.hashCode(this._minx),n=37*n+D.hashCode(this._maxx),n=37*n+D.hashCode(this._miny),n=37*n+D.hashCode(this._maxy)},Xt.prototype.interfaces_=function(){return[z,t]},Xt.prototype.getClass=function(){return Xt},Xt.intersects=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];return s.x>=(n.x<i.x?n.x:i.x)&&s.x<=(n.x>i.x?n.x:i.x)&&s.y>=(n.y<i.y?n.y:i.y)&&s.y<=(n.y>i.y?n.y:i.y)}if(arguments.length===4){var l=arguments[0],h=arguments[1],v=arguments[2],S=arguments[3],R=Math.min(v.x,S.x),V=Math.max(v.x,S.x),ot=Math.min(l.x,h.x),St=Math.max(l.x,h.x);return!(ot>V)&&!(St<R)&&(R=Math.min(v.y,S.y),V=Math.max(v.y,S.y),ot=Math.min(l.y,h.y),St=Math.max(l.y,h.y),!(ot>V)&&!(St<R))}},Ee.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Xt,Ee);var ft={typeStr:/^\\s*(\\w+)\\s*\\(\\s*(.*)\\s*\\)\\s*$/,emptyTypeStr:/^\\s*(\\w+)\\s*EMPTY\\s*$/,spaces:/\\s+/,parenComma:/\\)\\s*,\\s*\\(/,doubleParenComma:/\\)\\s*\\)\\s*,\\s*\\(\\s*\\(/,trimParens:/^\\s*\\(?(.*?)\\)?\\s*$/},He=function(n){this.geometryFactory=n||new Ce};He.prototype.read=function(n){var i,s,l;n=n.replace(/[\\n\\r]/g," ");var h=ft.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((h=ft.emptyTypeStr.exec(n))[2]=void 0),h&&(s=h[1].toLowerCase(),l=h[2],fe[s]&&(i=fe[s].apply(this,[l]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},He.prototype.write=function(n){return this.extractGeometry(n)},He.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!te[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+te[i].apply(this,[n])+")"};var te={coordinate:function(n){return n.x+" "+n.y},point:function(n){return te.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push("("+te.point.apply(this,[n._geometries[s]])+")");return i.join(",")},linestring:function(n){for(var i=[],s=0,l=n._points._coordinates.length;s<l;++s)i.push(te.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},linearring:function(n){for(var i=[],s=0,l=n._points._coordinates.length;s<l;++s)i.push(te.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},multilinestring:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push("("+te.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+te.linestring.apply(this,[n._shell])+")");for(var s=0,l=n._holes.length;s<l;++s)i.push("("+te.linestring.apply(this,[n._holes[s]])+")");return i.join(",")},multipolygon:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push("("+te.polygon.apply(this,[n._geometries[s]])+")");return i.join(",")},geometrycollection:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push(this.extractGeometry(n._geometries[s]));return i.join(",")}},fe={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(ft.spaces);return this.geometryFactory.createPoint(new D(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(n){if(n===void 0)return this.geometryFactory.createMultiPoint();for(var i,s=n.trim().split(","),l=[],h=0,v=s.length;h<v;++h)i=s[h].replace(ft.trimParens,"$1"),l.push(fe.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(l)},linestring:function(n){if(n===void 0)return this.geometryFactory.createLineString();for(var i,s=n.trim().split(","),l=[],h=0,v=s.length;h<v;++h)i=s[h].trim().split(ft.spaces),l.push(new D(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(l)},linearring:function(n){if(n===void 0)return this.geometryFactory.createLinearRing();for(var i,s=n.trim().split(","),l=[],h=0,v=s.length;h<v;++h)i=s[h].trim().split(ft.spaces),l.push(new D(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(l)},multilinestring:function(n){if(n===void 0)return this.geometryFactory.createMultiLineString();for(var i,s=n.trim().split(ft.parenComma),l=[],h=0,v=s.length;h<v;++h)i=s[h].replace(ft.trimParens,"$1"),l.push(fe.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(l)},polygon:function(n){if(n===void 0)return this.geometryFactory.createPolygon();for(var i,s,l,h,v=n.trim().split(ft.parenComma),S=[],R=0,V=v.length;R<V;++R)i=v[R].replace(ft.trimParens,"$1"),s=fe.linestring.apply(this,[i]),l=this.geometryFactory.createLinearRing(s._points),R===0?h=l:S.push(l);return this.geometryFactory.createPolygon(h,S)},multipolygon:function(n){if(n===void 0)return this.geometryFactory.createMultiPolygon();for(var i,s=n.trim().split(ft.doubleParenComma),l=[],h=0,v=s.length;h<v;++h)i=s[h].replace(ft.trimParens,"$1"),l.push(fe.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(l)},geometrycollection:function(n){if(n===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(n=n.replace(/,\\s*([A-Za-z])/g,"|$1")).trim().split("|"),s=[],l=0,h=i.length;l<h;++l)s.push(this.read(i[l]));return this.geometryFactory.createGeometryCollection(s)}},de=function(n){this.parser=new He(n)};de.prototype.write=function(n){return this.parser.write(n)},de.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var Ue=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),be=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}(Ue),kt=function(){};kt.prototype.interfaces_=function(){return[]},kt.prototype.getClass=function(){return kt},kt.shouldNeverReachHere=function(){if(arguments.length===0)kt.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new be("Should never reach here"+(n!==null?": "+n:""))}},kt.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],kt.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new be:new be(i)},kt.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],kt.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new be("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var ye=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 D,this._intPt[1]=new D,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},Vn={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};ye.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},ye.prototype.getTopologySummary=function(){var n=new Pt;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},ye.prototype.computeIntersection=function(n,i,s,l){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=s,this._inputLines[1][1]=l,this._result=this.computeIntersect(n,i,s,l)},ye.prototype.getIntersectionNum=function(){return this._result},ye.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)}},ye.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},ye.prototype.setPrecisionModel=function(n){this._precisionModel=n},ye.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}},ye.prototype.getIntersection=function(n){return this._intPt[n]},ye.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},ye.prototype.hasIntersection=function(){return this._result!==ye.NO_INTERSECTION},ye.prototype.getEdgeDistance=function(n,i){return ye.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},ye.prototype.isCollinear=function(){return this._result===ye.COLLINEAR_INTERSECTION},ye.prototype.toString=function(){return de.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+de.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},ye.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},ye.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},ye.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},ye.prototype.interfaces_=function(){return[]},ye.prototype.getClass=function(){return ye},ye.computeEdgeDistance=function(n,i,s){var l=Math.abs(s.x-i.x),h=Math.abs(s.y-i.y),v=-1;if(n.equals(i))v=0;else if(n.equals(s))v=l>h?l:h;else{var S=Math.abs(n.x-i.x),R=Math.abs(n.y-i.y);(v=l>h?S:R)!==0||n.equals(i)||(v=Math.max(S,R))}return kt.isTrue(!(v===0&&!n.equals(i)),"Bad distance calculation"),v},ye.nonRobustComputeEdgeDistance=function(n,i,s){var l=n.x-i.x,h=n.y-i.y,v=Math.sqrt(l*l+h*h);return kt.isTrue(!(v===0&&!n.equals(i)),"Invalid distance calculation"),v},Vn.DONT_INTERSECT.get=function(){return 0},Vn.DO_INTERSECT.get=function(){return 1},Vn.COLLINEAR.get=function(){return 2},Vn.NO_INTERSECTION.get=function(){return 0},Vn.POINT_INTERSECTION.get=function(){return 1},Vn.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(ye,Vn);var $n=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(s){var l=new Xt(this._inputLines[0][0],this._inputLines[0][1]),h=new Xt(this._inputLines[1][0],this._inputLines[1][1]);return l.contains(s)&&h.contains(s)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return n.prototype.computeIntersection.apply(this,arguments);var s=arguments[0],l=arguments[1],h=arguments[2];if(this._isProper=!1,Xt.intersects(l,h,s)&&rt.orientationIndex(l,h,s)===0&&rt.orientationIndex(h,l,s)===0)return this._isProper=!0,(s.equals(l)||s.equals(h))&&(this._isProper=!1),this._result=n.POINT_INTERSECTION,null;this._result=n.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(s,l,h,v,S){S.x=this.smallestInAbsValue(s.x,l.x,h.x,v.x),S.y=this.smallestInAbsValue(s.y,l.y,h.y,v.y),s.x-=S.x,s.y-=S.y,l.x-=S.x,l.y-=S.y,h.x-=S.x,h.y-=S.y,v.x-=S.x,v.y-=S.y},i.prototype.safeHCoordinateIntersection=function(s,l,h,v){var S=null;try{S=me.intersection(s,l,h,v)}catch(R){if(!(R instanceof le))throw R;S=i.nearestEndpoint(s,l,h,v)}return S},i.prototype.intersection=function(s,l,h,v){var S=this.intersectionWithNormalization(s,l,h,v);return this.isInSegmentEnvelopes(S)||(S=new D(i.nearestEndpoint(s,l,h,v))),this._precisionModel!==null&&this._precisionModel.makePrecise(S),S},i.prototype.smallestInAbsValue=function(s,l,h,v){var S=s,R=Math.abs(S);return Math.abs(l)<R&&(S=l,R=Math.abs(l)),Math.abs(h)<R&&(S=h,R=Math.abs(h)),Math.abs(v)<R&&(S=v),S},i.prototype.checkDD=function(s,l,h,v,S){var R=Mt.intersection(s,l,h,v),V=this.isInSegmentEnvelopes(R);Qt.out.println("DD in env = "+V+" --------------------- "+R),S.distance(R)>1e-4&&Qt.out.println("Distance = "+S.distance(R))},i.prototype.intersectionWithNormalization=function(s,l,h,v){var S=new D(s),R=new D(l),V=new D(h),ot=new D(v),St=new D;this.normalizeToEnvCentre(S,R,V,ot,St);var bt=this.safeHCoordinateIntersection(S,R,V,ot);return bt.x+=St.x,bt.y+=St.y,bt},i.prototype.computeCollinearIntersection=function(s,l,h,v){var S=Xt.intersects(s,l,h),R=Xt.intersects(s,l,v),V=Xt.intersects(h,v,s),ot=Xt.intersects(h,v,l);return S&&R?(this._intPt[0]=h,this._intPt[1]=v,n.COLLINEAR_INTERSECTION):V&&ot?(this._intPt[0]=s,this._intPt[1]=l,n.COLLINEAR_INTERSECTION):S&&V?(this._intPt[0]=h,this._intPt[1]=s,!h.equals(s)||R||ot?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):S&&ot?(this._intPt[0]=h,this._intPt[1]=l,!h.equals(l)||R||V?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):R&&V?(this._intPt[0]=v,this._intPt[1]=s,!v.equals(s)||S||ot?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):R&&ot?(this._intPt[0]=v,this._intPt[1]=l,!v.equals(l)||S||V?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):n.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(s,l,h,v,S){var R=s.x<l.x?s.x:l.x,V=s.y<l.y?s.y:l.y,ot=s.x>l.x?s.x:l.x,St=s.y>l.y?s.y:l.y,bt=h.x<v.x?h.x:v.x,Yt=h.y<v.y?h.y:v.y,Jt=h.x>v.x?h.x:v.x,se=h.y>v.y?h.y:v.y,_e=((R>bt?R:bt)+(ot<Jt?ot:Jt))/2,Cn=((V>Yt?V:Yt)+(St<se?St:se))/2;S.x=_e,S.y=Cn,s.x-=S.x,s.y-=S.y,l.x-=S.x,l.y-=S.y,h.x-=S.x,h.y-=S.y,v.x-=S.x,v.y-=S.y},i.prototype.computeIntersect=function(s,l,h,v){if(this._isProper=!1,!Xt.intersects(s,l,h,v))return n.NO_INTERSECTION;var S=rt.orientationIndex(s,l,h),R=rt.orientationIndex(s,l,v);if(S>0&&R>0||S<0&&R<0)return n.NO_INTERSECTION;var V=rt.orientationIndex(h,v,s),ot=rt.orientationIndex(h,v,l);return V>0&&ot>0||V<0&&ot<0?n.NO_INTERSECTION:S===0&&R===0&&V===0&&ot===0?this.computeCollinearIntersection(s,l,h,v):(S===0||R===0||V===0||ot===0?(this._isProper=!1,s.equals2D(h)||s.equals2D(v)?this._intPt[0]=s:l.equals2D(h)||l.equals2D(v)?this._intPt[0]=l:S===0?this._intPt[0]=new D(h):R===0?this._intPt[0]=new D(v):V===0?this._intPt[0]=new D(s):ot===0&&(this._intPt[0]=new D(l))):(this._isProper=!0,this._intPt[0]=this.intersection(s,l,h,v)),n.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(s,l,h,v){var S=s,R=rt.distancePointLine(s,h,v),V=rt.distancePointLine(l,h,v);return V<R&&(R=V,S=l),(V=rt.distancePointLine(h,s,l))<R&&(R=V,S=h),(V=rt.distancePointLine(v,s,l))<R&&(R=V,S=v),S},i}(ye),j=function(){};j.prototype.interfaces_=function(){return[]},j.prototype.getClass=function(){return j},j.orientationIndex=function(n,i,s){var l=i.x-n.x,h=i.y-n.y,v=s.x-i.x,S=s.y-i.y;return j.signOfDet2x2(l,h,v,S)},j.signOfDet2x2=function(n,i,s,l){var h=null,v=null,S=null;if(h=1,n===0||l===0)return i===0||s===0?0:i>0?s>0?-h:h:s>0?h:-h;if(i===0||s===0)return l>0?n>0?h:-h:n>0?-h:h;if(i>0?l>0?i<=l||(h=-h,v=n,n=s,s=v,v=i,i=l,l=v):i<=-l?(h=-h,s=-s,l=-l):(v=n,n=-s,s=v,v=i,i=-l,l=v):l>0?-i<=l?(h=-h,n=-n,i=-i):(v=-n,n=s,s=v,v=-i,i=l,l=v):i>=l?(n=-n,i=-i,s=-s,l=-l):(h=-h,v=-n,n=-s,s=v,v=-i,i=-l,l=v),n>0){if(!(s>0)||!(n<=s))return h}else{if(s>0||!(n>=s))return-h;h=-h,n=-n,s=-s}for(;;){if(S=Math.floor(s/n),s-=S*n,(l-=S*i)<0)return-h;if(l>i)return h;if(n>s+s){if(i<l+l)return h}else{if(i>l+l)return-h;s=n-s,l=i-l,h=-h}if(l===0)return s===0?0:-h;if(s===0||(S=Math.floor(n/s),n-=S*s,(i-=S*l)<0))return h;if(i>l)return-h;if(s>n+n){if(l<i+i)return-h}else{if(l>i+i)return h;n=s-n,i=l-i,h=-h}if(i===0)return n===0?0:h;if(n===0)return-h}};var H=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};H.prototype.countSegment=function(n,i){if(n.x<this._p.x&&i.x<this._p.x)return null;if(this._p.x===i.x&&this._p.y===i.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&i.y===this._p.y){var s=n.x,l=i.x;return s>l&&(s=i.x,l=n.x),this._p.x>=s&&this._p.x<=l&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&n.y<=this._p.y){var h=n.x-this._p.x,v=n.y-this._p.y,S=i.x-this._p.x,R=i.y-this._p.y,V=j.signOfDet2x2(h,v,S,R);if(V===0)return this._isPointOnSegment=!0,null;R<v&&(V=-V),V>0&&this._crossingCount++}},H.prototype.isPointInPolygon=function(){return this.getLocation()!==Z.EXTERIOR},H.prototype.getLocation=function(){return this._isPointOnSegment?Z.BOUNDARY:this._crossingCount%2==1?Z.INTERIOR:Z.EXTERIOR},H.prototype.isOnSegment=function(){return this._isPointOnSegment},H.prototype.interfaces_=function(){return[]},H.prototype.getClass=function(){return H},H.locatePointInRing=function(){if(arguments[0]instanceof D&&et(arguments[1],At)){for(var n=arguments[0],i=arguments[1],s=new H(n),l=new D,h=new D,v=1;v<i.size();v++)if(i.getCoordinate(v,l),i.getCoordinate(v-1,h),s.countSegment(l,h),s.isOnSegment())return s.getLocation();return s.getLocation()}if(arguments[0]instanceof D&&arguments[1]instanceof Array){for(var S=arguments[0],R=arguments[1],V=new H(S),ot=1;ot<R.length;ot++){var St=R[ot],bt=R[ot-1];if(V.countSegment(St,bt),V.isOnSegment())return V.getLocation()}return V.getLocation()}};var rt=function(){},Wt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};rt.prototype.interfaces_=function(){return[]},rt.prototype.getClass=function(){return rt},rt.orientationIndex=function(n,i,s){return Mt.orientationIndex(n,i,s)},rt.signedArea=function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var i=0,s=n[0].x,l=1;l<n.length-1;l++){var h=n[l].x-s,v=n[l+1].y;i+=h*(n[l-1].y-v)}return i/2}if(et(arguments[0],At)){var S=arguments[0],R=S.size();if(R<3)return 0;var V=new D,ot=new D,St=new D;S.getCoordinate(0,ot),S.getCoordinate(1,St);var bt=ot.x;St.x-=bt;for(var Yt=0,Jt=1;Jt<R-1;Jt++)V.y=ot.y,ot.x=St.x,ot.y=St.y,S.getCoordinate(Jt+1,St),St.x-=bt,Yt+=ot.x*(V.y-St.y);return Yt/2}},rt.distanceLineLine=function(n,i,s,l){if(n.equals(i))return rt.distancePointLine(n,s,l);if(s.equals(l))return rt.distancePointLine(l,n,i);var h=!1;if(Xt.intersects(n,i,s,l)){var v=(i.x-n.x)*(l.y-s.y)-(i.y-n.y)*(l.x-s.x);if(v===0)h=!0;else{var S=(n.y-s.y)*(l.x-s.x)-(n.x-s.x)*(l.y-s.y),R=((n.y-s.y)*(i.x-n.x)-(n.x-s.x)*(i.y-n.y))/v,V=S/v;(V<0||V>1||R<0||R>1)&&(h=!0)}}else h=!0;return h?vt.min(rt.distancePointLine(n,s,l),rt.distancePointLine(i,s,l),rt.distancePointLine(s,n,i),rt.distancePointLine(l,n,i)):0},rt.isPointInRing=function(n,i){return rt.locatePointInRing(n,i)!==Z.EXTERIOR},rt.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,l=new D;n.getCoordinate(0,l);for(var h=l.x,v=l.y,S=1;S<i;S++){n.getCoordinate(S,l);var R=l.x,V=l.y,ot=R-h,St=V-v;s+=Math.sqrt(ot*ot+St*St),h=R,v=V}return s},rt.isCCW=function(n){var i=n.length-1;if(i<3)throw new N("Ring has fewer than 4 points, so orientation cannot be determined");for(var s=n[0],l=0,h=1;h<=i;h++){var v=n[h];v.y>s.y&&(s=v,l=h)}var S=l;do(S-=1)<0&&(S=i);while(n[S].equals2D(s)&&S!==l);var R=l;do R=(R+1)%i;while(n[R].equals2D(s)&&R!==l);var V=n[S],ot=n[R];if(V.equals2D(s)||ot.equals2D(s)||V.equals2D(ot))return!1;var St=rt.computeOrientation(V,s,ot),bt=!1;return bt=St===0?V.x>ot.x:St>0,bt},rt.locatePointInRing=function(n,i){return H.locatePointInRing(n,i)},rt.distancePointLinePerpendicular=function(n,i,s){var l=(s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.y-i.y),h=((i.y-n.y)*(s.x-i.x)-(i.x-n.x)*(s.y-i.y))/l;return Math.abs(h)*Math.sqrt(l)},rt.computeOrientation=function(n,i,s){return rt.orientationIndex(n,i,s)},rt.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new N("Line array must contain at least one vertex");for(var s=n.distance(i[0]),l=0;l<i.length-1;l++){var h=rt.distancePointLine(n,i[l],i[l+1]);h<s&&(s=h)}return s}if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];if(S.x===R.x&&S.y===R.y)return v.distance(S);var V=(R.x-S.x)*(R.x-S.x)+(R.y-S.y)*(R.y-S.y),ot=((v.x-S.x)*(R.x-S.x)+(v.y-S.y)*(R.y-S.y))/V;if(ot<=0)return v.distance(S);if(ot>=1)return v.distance(R);var St=((S.y-v.y)*(R.x-S.x)-(S.x-v.x)*(R.y-S.y))/V;return Math.abs(St)*Math.sqrt(V)}},rt.isOnLine=function(n,i){for(var s=new $n,l=1;l<i.length;l++){var h=i[l-1],v=i[l];if(s.computeIntersection(n,h,v),s.hasIntersection())return!0}return!1},Wt.CLOCKWISE.get=function(){return-1},Wt.RIGHT.get=function(){return rt.CLOCKWISE},Wt.COUNTERCLOCKWISE.get=function(){return 1},Wt.LEFT.get=function(){return rt.COUNTERCLOCKWISE},Wt.COLLINEAR.get=function(){return 0},Wt.STRAIGHT.get=function(){return rt.COLLINEAR},Object.defineProperties(rt,Wt);var Gt=function(){};Gt.prototype.filter=function(n){},Gt.prototype.interfaces_=function(){return[]},Gt.prototype.getClass=function(){return Gt};var Ct=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},he={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}};Ct.prototype.isGeometryCollection=function(){return this.getSortIndex()===Ct.SORTINDEX_GEOMETRYCOLLECTION},Ct.prototype.getFactory=function(){return this._factory},Ct.prototype.getGeometryN=function(n){return this},Ct.prototype.getArea=function(){return 0},Ct.prototype.isRectangle=function(){return!1},Ct.prototype.equals=function(){if(arguments[0]instanceof Ct){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof Ct))return!1;var s=i;return this.equalsExact(s)}},Ct.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},Ct.prototype.geometryChanged=function(){this.apply(Ct.geometryChangedFilter)},Ct.prototype.geometryChangedAction=function(){this._envelope=null},Ct.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},Ct.prototype.getLength=function(){return 0},Ct.prototype.getNumGeometries=function(){return 1},Ct.prototype.compareTo=function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(n)}if(arguments.length===2){var s=arguments[0],l=arguments[1];return this.getSortIndex()!==s.getSortIndex()?this.getSortIndex()-s.getSortIndex():this.isEmpty()&&s.isEmpty()?0:this.isEmpty()?-1:s.isEmpty()?1:this.compareToSameClass(s,l)}},Ct.prototype.getUserData=function(){return this._userData},Ct.prototype.getSRID=function(){return this._SRID},Ct.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Ct.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===Ct.SORTINDEX_GEOMETRYCOLLECTION)throw new N("This method does not support GeometryCollection arguments")},Ct.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},Ct.prototype.norm=function(){var n=this.copy();return n.normalize(),n},Ct.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Ct.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Xt(this._envelope)},Ct.prototype.setSRID=function(n){this._SRID=n},Ct.prototype.setUserData=function(n){this._userData=n},Ct.prototype.compare=function(n,i){for(var s=n.iterator(),l=i.iterator();s.hasNext()&&l.hasNext();){var h=s.next(),v=l.next(),S=h.compareTo(v);if(S!==0)return S}return s.hasNext()?1:l.hasNext()?-1:0},Ct.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Ct.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Ct.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Ct.SORTINDEX_MULTIPOINT||this.getSortIndex()===Ct.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Ct.SORTINDEX_MULTIPOLYGON},Ct.prototype.interfaces_=function(){return[$,z,t]},Ct.prototype.getClass=function(){return Ct},Ct.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},Ct.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},he.serialVersionUID.get=function(){return 8763622679187377e3},he.SORTINDEX_POINT.get=function(){return 0},he.SORTINDEX_MULTIPOINT.get=function(){return 1},he.SORTINDEX_LINESTRING.get=function(){return 2},he.SORTINDEX_LINEARRING.get=function(){return 3},he.SORTINDEX_MULTILINESTRING.get=function(){return 4},he.SORTINDEX_POLYGON.get=function(){return 5},he.SORTINDEX_MULTIPOLYGON.get=function(){return 6},he.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},he.geometryChangedFilter.get=function(){return Kt},Object.defineProperties(Ct,he);var Kt=function(){};Kt.interfaces_=function(){return[Gt]},Kt.filter=function(n){n.geometryChangedAction()};var tt=function(){};tt.prototype.filter=function(n){},tt.prototype.interfaces_=function(){return[]},tt.prototype.getClass=function(){return tt};var C=function(){},L={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}};C.prototype.isInBoundary=function(n){},C.prototype.interfaces_=function(){return[]},C.prototype.getClass=function(){return C},L.Mod2BoundaryNodeRule.get=function(){return F},L.EndPointBoundaryNodeRule.get=function(){return J},L.MultiValentEndPointBoundaryNodeRule.get=function(){return X},L.MonoValentEndPointBoundaryNodeRule.get=function(){return pt},L.MOD2_BOUNDARY_RULE.get=function(){return new F},L.ENDPOINT_BOUNDARY_RULE.get=function(){return new J},L.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new X},L.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new pt},L.OGC_SFS_BOUNDARY_RULE.get=function(){return C.MOD2_BOUNDARY_RULE},Object.defineProperties(C,L);var F=function(){};F.prototype.isInBoundary=function(n){return n%2==1},F.prototype.interfaces_=function(){return[C]},F.prototype.getClass=function(){return F};var J=function(){};J.prototype.isInBoundary=function(n){return n>0},J.prototype.interfaces_=function(){return[C]},J.prototype.getClass=function(){return J};var X=function(){};X.prototype.isInBoundary=function(n){return n>1},X.prototype.interfaces_=function(){return[C]},X.prototype.getClass=function(){return X};var pt=function(){};pt.prototype.isInBoundary=function(n){return n===1},pt.prototype.interfaces_=function(){return[C]},pt.prototype.getClass=function(){return pt};var st=function(){};st.prototype.add=function(){},st.prototype.addAll=function(){},st.prototype.isEmpty=function(){},st.prototype.iterator=function(){},st.prototype.size=function(){},st.prototype.toArray=function(){},st.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var k=function(){};k.prototype.hasNext=function(){},k.prototype.next=function(){},k.prototype.remove=function(){};var ut=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}(st);(o.prototype=new Error).name="NoSuchElementException";var nt=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof st&&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,st]},i.prototype.add=function(s){return arguments.length===1?this.array_.push(s):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(s){for(var l=s.iterator();l.hasNext();)this.add(l.next());return!0},i.prototype.set=function(s,l){var h=this.array_[s];return this.array_[s]=l,h},i.prototype.iterator=function(){return new lt(this)},i.prototype.get=function(s){if(s<0||s>=this.size())throw new e;return this.array_[s]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var s=[],l=0,h=this.array_.length;l<h;l++)s.push(this.array_[l]);return s},i.prototype.remove=function(s){for(var l=!1,h=0,v=this.array_.length;h<v;h++)if(this.array_[h]===s){this.array_.splice(h,1),l=!0;break}return l},i}(ut),lt=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}(k),dt=function(n){function i(){if(n.call(this),arguments.length!==0){if(arguments.length===1){var l=arguments[0];this.ensureCapacity(l.length),this.add(l,!0)}else if(arguments.length===2){var h=arguments[0],v=arguments[1];this.ensureCapacity(h.length),this.add(h,v)}}}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={coordArrayType:{configurable:!0}};return s.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(l){return this.get(l)},i.prototype.addAll=function(){if(arguments.length===2){for(var l=arguments[0],h=arguments[1],v=!1,S=l.iterator();S.hasNext();)this.add(S.next(),h),v=!0;return v}return n.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var l=n.prototype.clone.call(this),h=0;h<this.size();h++)l.add(h,this.get(h).copy());return l},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var l=arguments[0];n.prototype.add.call(this,l)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var h=arguments[0],v=arguments[1];return this.add(h,v,!0),!0}if(arguments[0]instanceof D&&typeof arguments[1]=="boolean"){var S=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(S))return null;n.prototype.add.call(this,S)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var R=arguments[0],V=arguments[1];return this.add(R,V),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var ot=arguments[0],St=arguments[1];if(arguments[2])for(var bt=0;bt<ot.length;bt++)this.add(ot[bt],St);else for(var Yt=ot.length-1;Yt>=0;Yt--)this.add(ot[Yt],St);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof D){var Jt=arguments[0],se=arguments[1];if(!arguments[2]){var _e=this.size();if(_e>0&&(Jt>0&&this.get(Jt-1).equals2D(se)||Jt<_e&&this.get(Jt).equals2D(se)))return null}n.prototype.add.call(this,Jt,se)}}else if(arguments.length===4){var Cn=arguments[0],Xn=arguments[1],ui=arguments[2],rs=arguments[3],Fs=1;ui>rs&&(Fs=-1);for(var Dc=ui;Dc!==rs;Dc+=Fs)this.add(Cn[Dc],Xn);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new D(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(nt),at=function(){},Bt={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Bt.ForwardComparator.get=function(){return qt},Bt.BidirectionalComparator.get=function(){return we},Bt.coordArrayType.get=function(){return new Array(0).fill(null)},at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},at.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var l=n[s];if(at.indexOf(l,i)<0)return l}return null},at.scroll=function(n,i){var s=at.indexOf(i,n);if(s<0)return null;var l=new Array(n.length).fill(null);Qt.arraycopy(n,s,l,0,n.length-s),Qt.arraycopy(n,0,l,n.length-s,s),Qt.arraycopy(l,0,n,0,n.length)},at.equals=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(n===i)return!0;if(n===null||i===null||n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(!n[s].equals(i[s]))return!1;return!0}if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2];if(l===h)return!0;if(l===null||h===null||l.length!==h.length)return!1;for(var S=0;S<l.length;S++)if(v.compare(l[S],h[S])!==0)return!1;return!0}},at.intersection=function(n,i){for(var s=new dt,l=0;l<n.length;l++)i.intersects(n[l])&&s.add(n[l],!0);return s.toCoordinateArray()},at.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},at.removeRepeatedPoints=function(n){return at.hasRepeatedPoints(n)?new dt(n,!1).toCoordinateArray():n},at.reverse=function(n){for(var i=n.length-1,s=Math.trunc(i/2),l=0;l<=s;l++){var h=n[l];n[l]=n[i-l],n[i-l]=h}},at.removeNull=function(n){for(var i=0,s=0;s<n.length;s++)n[s]!==null&&i++;var l=new Array(i).fill(null);if(i===0)return l;for(var h=0,v=0;v<n.length;v++)n[v]!==null&&(l[h++]=n[v]);return l},at.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 D(n[s]);return i}if(arguments.length===5)for(var l=arguments[0],h=arguments[1],v=arguments[2],S=arguments[3],R=arguments[4],V=0;V<R;V++)v[S+V]=new D(l[h+V])},at.isEqualReversed=function(n,i){for(var s=0;s<n.length;s++){var l=n[s],h=i[n.length-s-1];if(l.compareTo(h)!==0)return!1}return!0},at.envelope=function(n){for(var i=new Xt,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},at.toCoordinateArray=function(n){return n.toArray(at.coordArrayType)},at.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},at.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},at.increasingDirection=function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var s=n.length-1-i,l=n[i].compareTo(n[s]);if(l!==0)return l}return 1},at.compare=function(n,i){for(var s=0;s<n.length&&s<i.length;){var l=n[s].compareTo(i[s]);if(l!==0)return l;s++}return s<i.length?-1:s<n.length?1:0},at.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},at.extract=function(n,i,s){i=vt.clamp(i,0,n.length);var l=(s=vt.clamp(s,-1,n.length))-i+1;s<0&&(l=0),i>=n.length&&(l=0),s<i&&(l=0);var h=new Array(l).fill(null);if(l===0)return h;for(var v=0,S=i;S<=s;S++)h[v++]=n[S];return h},Object.defineProperties(at,Bt);var qt=function(){};qt.prototype.compare=function(n,i){return at.compare(n,i)},qt.prototype.interfaces_=function(){return[q]},qt.prototype.getClass=function(){return qt};var we=function(){};we.prototype.compare=function(n,i){var s=n,l=i;if(s.length<l.length)return-1;if(s.length>l.length)return 1;if(s.length===0)return 0;var h=at.compare(s,l);return at.isEqualReversed(s,l)?0:h},we.prototype.OLDcompare=function(n,i){var s=n,l=i;if(s.length<l.length)return-1;if(s.length>l.length)return 1;if(s.length===0)return 0;for(var h=at.increasingDirection(s),v=at.increasingDirection(l),S=h>0?0:s.length-1,R=v>0?0:s.length-1,V=0;V<s.length;V++){var ot=s[S].compareTo(l[R]);if(ot!==0)return ot;S+=h,R+=v}return 0},we.prototype.interfaces_=function(){return[q]},we.prototype.getClass=function(){return we};var oe=function(){};oe.prototype.get=function(){},oe.prototype.put=function(){},oe.prototype.size=function(){},oe.prototype.values=function(){},oe.prototype.entrySet=function(){};var Ve=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}(oe);(a.prototype=new Error).name="OperationNotSupported",(c.prototype=new st).contains=function(){};var je=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof st&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.contains=function(s){for(var l=0,h=this.array_.length;l<h;l++)if(this.array_[l]===s)return!0;return!1},i.prototype.add=function(s){return!this.contains(s)&&(this.array_.push(s),!0)},i.prototype.addAll=function(s){for(var l=s.iterator();l.hasNext();)this.add(l.next());return!0},i.prototype.remove=function(s){throw new Error},i.prototype.size=function(){return this.array_.length},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.toArray=function(){for(var s=[],l=0,h=this.array_.length;l<h;l++)s.push(this.array_[l]);return s},i.prototype.iterator=function(){return new ur(this)},i}(c),ur=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}(k),Qn=0;(w.prototype=new Ve).get=function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return i.value;i=i.right}}return null},w.prototype.put=function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:Qn,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,l,h=this.root_;do if(s=h,(l=n.compareTo(h.key))<0)h=h.left;else{if(!(l>0)){var v=h.value;return h.value=i,v}h=h.right}while(h!==null);var S={key:n,left:null,right:null,value:i,parent:s,color:Qn,getValue:function(){return this.value},getKey:function(){return this.key}};return l<0?s.left=S:s.right=S,this.fixAfterInsertion(S),this.size_++,null},w.prototype.fixAfterInsertion=function(n){for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)if(d(n)===y(d(d(n)))){var i=_(d(d(n)));p(i)===1?(g(d(n),Qn),g(i,Qn),g(d(d(n)),1),n=d(d(n))):(n===_(d(n))&&(n=d(n),this.rotateLeft(n)),g(d(n),Qn),g(d(d(n)),1),this.rotateRight(d(d(n))))}else{var s=y(d(d(n)));p(s)===1?(g(d(n),Qn),g(s,Qn),g(d(d(n)),1),n=d(d(n))):(n===y(d(n))&&(n=d(n),this.rotateRight(n)),g(d(n),Qn),g(d(d(n)),1),this.rotateLeft(d(d(n))))}this.root_.color=Qn},w.prototype.values=function(){var n=new nt,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=w.successor(i))!==null;)n.add(i.value);return n},w.prototype.entrySet=function(){var n=new je,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=w.successor(i))!==null;)n.add(i);return n},w.prototype.rotateLeft=function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}},w.prototype.rotateRight=function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}},w.prototype.getFirstEntry=function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n},w.successor=function(n){if(n===null)return null;if(n.right!==null){for(var i=n.right;i.left!==null;)i=i.left;return i}for(var s=n.parent,l=n;s!==null&&l===s.right;)l=s,s=s.parent;return s},w.prototype.size=function(){return this.size_};var wr=function(){};wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr},x.prototype=new c,(b.prototype=new x).contains=function(n){for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===0)return!0;return!1},b.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},b.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next());return!0},b.prototype.remove=function(n){throw new a},b.prototype.size=function(){return this.array_.length},b.prototype.isEmpty=function(){return this.array_.length===0},b.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n},b.prototype.iterator=function(){return new Ir(this)};var Ir=function(n){this.treeSet_=n,this.position_=0};Ir.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},Ir.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Ir.prototype.remove=function(){throw new a};var er=function(){};er.sort=function(){var n,i,s,l,h=arguments[0];if(arguments.length===1)l=function(S,R){return S.compareTo(R)},h.sort(l);else if(arguments.length===2)s=arguments[1],l=function(S,R){return s.compare(S,R)},h.sort(l);else if(arguments.length===3){(i=h.slice(arguments[1],arguments[2])).sort();var v=h.slice(0,arguments[1]).concat(i,h.slice(arguments[2],h.length));for(h.splice(0,h.length),n=0;n<v.length;n++)h.push(v[n])}else if(arguments.length===4)for(i=h.slice(arguments[1],arguments[2]),s=arguments[3],l=function(S,R){return s.compare(S,R)},i.sort(l),v=h.slice(0,arguments[1]).concat(i,h.slice(arguments[2],h.length)),h.splice(0,h.length),n=0;n<v.length;n++)h.push(v[n])},er.asList=function(n){for(var i=new nt,s=0,l=n.length;s<l;s++)i.add(n[s]);return i};var Me=function(){},nr={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}};nr.P.get=function(){return 0},nr.L.get=function(){return 1},nr.A.get=function(){return 2},nr.FALSE.get=function(){return-1},nr.TRUE.get=function(){return-2},nr.DONTCARE.get=function(){return-3},nr.SYM_FALSE.get=function(){return"F"},nr.SYM_TRUE.get=function(){return"T"},nr.SYM_DONTCARE.get=function(){return"*"},nr.SYM_P.get=function(){return"0"},nr.SYM_L.get=function(){return"1"},nr.SYM_A.get=function(){return"2"},Me.prototype.interfaces_=function(){return[]},Me.prototype.getClass=function(){return Me},Me.toDimensionSymbol=function(n){switch(n){case Me.FALSE:return Me.SYM_FALSE;case Me.TRUE:return Me.SYM_TRUE;case Me.DONTCARE:return Me.SYM_DONTCARE;case Me.P:return Me.SYM_P;case Me.L:return Me.SYM_L;case Me.A:return Me.SYM_A}throw new N("Unknown dimension value: "+n)},Me.toDimensionValue=function(n){switch(yt.toUpperCase(n)){case Me.SYM_FALSE:return Me.FALSE;case Me.SYM_TRUE:return Me.TRUE;case Me.SYM_DONTCARE:return Me.DONTCARE;case Me.SYM_P:return Me.P;case Me.SYM_L:return Me.L;case Me.SYM_A:return Me.A}throw new N("Unknown dimension symbol: "+n)},Object.defineProperties(Me,nr);var hr=function(){};hr.prototype.filter=function(n){},hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr};var lr=function(){};lr.prototype.filter=function(n,i){},lr.prototype.isDone=function(){},lr.prototype.isGeometryChanged=function(){},lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr};var Zn=function(n){function i(l,h){if(n.call(this,h),this._geometries=l||[],n.hasNullElements(this._geometries))throw new N("geometries must not contain null elements")}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var l=new Xt,h=0;h<this._geometries.length;h++)l.expandToInclude(this._geometries[h].getEnvelopeInternal());return l},i.prototype.getGeometryN=function(l){return this._geometries[l]},i.prototype.getSortIndex=function(){return n.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var l=new Array(this.getNumPoints()).fill(null),h=-1,v=0;v<this._geometries.length;v++)for(var S=this._geometries[v].getCoordinates(),R=0;R<S.length;R++)l[++h]=S[R];return l},i.prototype.getArea=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getArea();return l},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var v=l;if(this._geometries.length!==v._geometries.length)return!1;for(var S=0;S<this._geometries.length;S++)if(!this._geometries[S].equalsExact(v._geometries[S],h))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var l=0;l<this._geometries.length;l++)this._geometries[l].normalize();er.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var l=Me.FALSE,h=0;h<this._geometries.length;h++)l=Math.max(l,this._geometries[h].getBoundaryDimension());return l},i.prototype.getDimension=function(){for(var l=Me.FALSE,h=0;h<this._geometries.length;h++)l=Math.max(l,this._geometries[h].getDimension());return l},i.prototype.getLength=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getLength();return l},i.prototype.getNumPoints=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getNumPoints();return l},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),v=0;v<this._geometries.length;v++)h[v]=this._geometries[v].reverse();return this.getFactory().createGeometryCollection(h)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0],h=new b(er.asList(this._geometries)),v=new b(er.asList(l._geometries));return this.compare(h,v)}if(arguments.length===2){for(var S=arguments[0],R=arguments[1],V=S,ot=this.getNumGeometries(),St=V.getNumGeometries(),bt=0;bt<ot&&bt<St;){var Yt=this.getGeometryN(bt),Jt=V.getGeometryN(bt),se=Yt.compareToSameClass(Jt,R);if(se!==0)return se;bt++}return bt<ot?1:bt<St?-1:0}},i.prototype.apply=function(){if(et(arguments[0],tt))for(var l=arguments[0],h=0;h<this._geometries.length;h++)this._geometries[h].apply(l);else if(et(arguments[0],lr)){var v=arguments[0];if(this._geometries.length===0)return null;for(var S=0;S<this._geometries.length&&(this._geometries[S].apply(v),!v.isDone());S++);v.isGeometryChanged()&&this.geometryChanged()}else if(et(arguments[0],hr)){var R=arguments[0];R.filter(this);for(var V=0;V<this._geometries.length;V++)this._geometries[V].apply(R)}else if(et(arguments[0],Gt)){var ot=arguments[0];ot.filter(this);for(var St=0;St<this._geometries.length;St++)this._geometries[St].apply(ot)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),kt.shouldNeverReachHere(),null},i.prototype.clone=function(){var l=n.prototype.clone.call(this);l._geometries=new Array(this._geometries.length).fill(null);for(var h=0;h<this._geometries.length;h++)l._geometries[h]=this._geometries[h].clone();return l},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.isEmpty=function(){for(var l=0;l<this._geometries.length;l++)if(!this._geometries[l].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,s),i}(Ct),K=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&n.prototype.equalsExact.call(this,l,h)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?Me.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var l=0;l<this._geometries.length;l++)if(!this._geometries[l].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),v=0;v<this._geometries.length;v++)h[l-1-v]=this._geometries[v].reverse();return this.getFactory().createMultiLineString(h)},i.prototype.getBoundary=function(){return new xt(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.interfaces_=function(){return[wr]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(Zn),xt=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=C.MOD2_BOUNDARY_RULE;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this._geom=s,this._geomFact=s.getFactory(),this._bnRule=l}};xt.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)},xt.prototype.getBoundary=function(){return this._geom instanceof jt?this.boundaryLineString(this._geom):this._geom instanceof K?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},xt.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()])},xt.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},xt.prototype.computeBoundaryCoordinates=function(n){var i=new nt;this._endpointMap=new w;for(var s=0;s<n.getNumGeometries();s++){var l=n.getGeometryN(s);l.getNumPoints()!==0&&(this.addEndpoint(l.getCoordinateN(0)),this.addEndpoint(l.getCoordinateN(l.getNumPoints()-1)))}for(var h=this._endpointMap.entrySet().iterator();h.hasNext();){var v=h.next(),S=v.getValue().count;this._bnRule.isInBoundary(S)&&i.add(v.getKey())}return at.toCoordinateArray(i)},xt.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new Lt,this._endpointMap.put(n,i)),i.count++},xt.prototype.interfaces_=function(){return[]},xt.prototype.getClass=function(){return xt},xt.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new xt(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new xt(i,s).getBoundary()}};var Lt=function(){this.count=null};Lt.prototype.interfaces_=function(){return[]},Lt.prototype.getClass=function(){return Lt};var wt=function(){},Ot={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};wt.prototype.interfaces_=function(){return[]},wt.prototype.getClass=function(){return wt},wt.chars=function(n,i){for(var s=new Array(i).fill(null),l=0;l<i;l++)s[l]=n;return String(s)},wt.getStackTrace=function(){if(arguments.length===1){var n=arguments[0],i=new function(){},s=new function(){}(i);return n.printStackTrace(s),i.toString()}if(arguments.length===2){for(var l=arguments[0],h=arguments[1],v="",S=new function(){}(new function(){}(wt.getStackTrace(l))),R=0;R<h;R++)try{v+=S.readLine()+wt.NEWLINE}catch(V){if(!(V instanceof P))throw V;kt.shouldNeverReachHere()}return v}},wt.split=function(n,i){for(var s=i.length,l=new nt,h=""+n,v=h.indexOf(i);v>=0;){var S=h.substring(0,v);l.add(S),v=(h=h.substring(v+s)).indexOf(i)}h.length>0&&l.add(h);for(var R=new Array(l.size()).fill(null),V=0;V<R.length;V++)R[V]=l.get(V);return R},wt.toString=function(){if(arguments.length===1){var n=arguments[0];return wt.SIMPLE_ORDINATE_FORMAT.format(n)}},wt.spaces=function(n){return wt.chars(" ",n)},Ot.NEWLINE.get=function(){return Qt.getProperty("line.separator")},Ot.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(wt,Ot);var Zt=function(){};Zt.prototype.interfaces_=function(){return[]},Zt.prototype.getClass=function(){return Zt},Zt.copyCoord=function(n,i,s,l){for(var h=Math.min(n.getDimension(),s.getDimension()),v=0;v<h;v++)s.setOrdinate(l,v,n.getOrdinate(i,v))},Zt.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,At.X)===n.getOrdinate(i-1,At.X)&&n.getOrdinate(0,At.Y)===n.getOrdinate(i-1,At.Y)},Zt.isEqual=function(n,i){var s=n.size();if(s!==i.size())return!1;for(var l=Math.min(n.getDimension(),i.getDimension()),h=0;h<s;h++)for(var v=0;v<l;v++){var S=n.getOrdinate(h,v),R=i.getOrdinate(h,v);if(n.getOrdinate(h,v)!==i.getOrdinate(h,v)&&(!A.isNaN(S)||!A.isNaN(R)))return!1}return!0},Zt.extend=function(n,i,s){var l=n.create(s,i.getDimension()),h=i.size();if(Zt.copy(i,0,l,0,h),h>0)for(var v=h;v<s;v++)Zt.copy(i,h-1,l,v,1);return l},Zt.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),l=0;l<=s;l++)Zt.swap(n,l,i-l)},Zt.swap=function(n,i,s){if(i===s)return null;for(var l=0;l<n.getDimension();l++){var h=n.getOrdinate(i,l);n.setOrdinate(i,l,n.getOrdinate(s,l)),n.setOrdinate(s,l,h)}},Zt.copy=function(n,i,s,l,h){for(var v=0;v<h;v++)Zt.copyCoord(n,i+v,s,l+v)},Zt.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),l=new Pt;l.append("(");for(var h=0;h<i;h++){h>0&&l.append(" ");for(var v=0;v<s;v++)v>0&&l.append(","),l.append(wt.toString(n.getOrdinate(h,v)))}return l.append(")"),l.toString()}},Zt.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?Zt.createClosedRing(n,i,4):i.getOrdinate(0,At.X)===i.getOrdinate(s-1,At.X)&&i.getOrdinate(0,At.Y)===i.getOrdinate(s-1,At.Y)?i:Zt.createClosedRing(n,i,s+1)},Zt.createClosedRing=function(n,i,s){var l=n.create(s,i.getDimension()),h=i.size();Zt.copy(i,0,l,0,h);for(var v=h;v<s;v++)Zt.copy(i,0,l,v,1);return l};var jt=function(n){function i(l,h){n.call(this,h),this._points=null,this.init(l)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Xt:this._points.expandEnvelope(new Xt)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return n.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var v=l;if(this._points.size()!==v._points.size())return!1;for(var S=0;S<this._points.size();S++)if(!this.equal(this._points.getCoordinate(S),v._points.getCoordinate(S),h))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var l=0;l<Math.trunc(this._points.size()/2);l++){var h=this._points.size()-1-l;if(!this._points.getCoordinate(l).equals(this._points.getCoordinate(h)))return this._points.getCoordinate(l).compareTo(this._points.getCoordinate(h))>0&&Zt.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?Me.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 rt.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var l=this._points.copy();return Zt.reverse(l),this.getFactory().createLineString(l)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var l=arguments[0],h=0,v=0;h<this._points.size()&&v<l._points.size();){var S=this._points.getCoordinate(h).compareTo(l._points.getCoordinate(v));if(S!==0)return S;h++,v++}return h<this._points.size()?1:v<l._points.size()?-1:0}if(arguments.length===2){var R=arguments[0];return arguments[1].compare(this._points,R._points)}},i.prototype.apply=function(){if(et(arguments[0],tt))for(var l=arguments[0],h=0;h<this._points.size();h++)l.filter(this._points.getCoordinate(h));else if(et(arguments[0],lr)){var v=arguments[0];if(this._points.size()===0)return null;for(var S=0;S<this._points.size()&&(v.filter(this._points,S),!v.isDone());S++);v.isGeometryChanged()&&this.geometryChanged()}else et(arguments[0],hr)?arguments[0].filter(this):et(arguments[0],Gt)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new xt(this).getBoundary()},i.prototype.isEquivalentClass=function(l){return l instanceof i},i.prototype.clone=function(){var l=n.prototype.clone.call(this);return l._points=this._points.clone(),l},i.prototype.getCoordinateN=function(l){return this._points.getCoordinate(l)},i.prototype.getGeometryType=function(){return"LineString"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._points},i.prototype.isEmpty=function(){return this._points.size()===0},i.prototype.init=function(l){if(l===null&&(l=this.getFactory().getCoordinateSequenceFactory().create([])),l.size()===1)throw new N("Invalid number of points in LineString (found "+l.size()+" - must be 0 or >= 2)");this._points=l},i.prototype.isCoordinate=function(l){for(var h=0;h<this._points.size();h++)if(this._points.getCoordinate(h).equals(l))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(l){return this.getFactory().createPoint(this._points.getCoordinate(l))},i.prototype.interfaces_=function(){return[wr]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(Ct),Te=function(){};Te.prototype.interfaces_=function(){return[]},Te.prototype.getClass=function(){return Te};var ge=function(n){function i(l,h){n.call(this,h),this._coordinates=l||null,this.init(this._coordinates)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Xt;var l=new Xt;return l.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),l},i.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&(!(!this.isEmpty()||!l.isEmpty())||this.isEmpty()===l.isEmpty()&&this.equal(l.getCoordinate(),this.getCoordinate(),h))}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){},i.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},i.prototype.getBoundaryDimension=function(){return Me.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getNumPoints=function(){return this.isEmpty()?0:1},i.prototype.reverse=function(){return this.copy()},i.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},i.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0];return this.getCoordinate().compareTo(l.getCoordinate())}if(arguments.length===2){var h=arguments[0];return arguments[1].compare(this._coordinates,h._coordinates)}},i.prototype.apply=function(){if(et(arguments[0],tt)){var l=arguments[0];if(this.isEmpty())return null;l.filter(this.getCoordinate())}else if(et(arguments[0],lr)){var h=arguments[0];if(this.isEmpty())return null;h.filter(this._coordinates,0),h.isGeometryChanged()&&this.geometryChanged()}else et(arguments[0],hr)?arguments[0].filter(this):et(arguments[0],Gt)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var l=n.prototype.clone.call(this);return l._coordinates=this._coordinates.clone(),l},i.prototype.getGeometryType=function(){return"Point"},i.prototype.copy=function(){return new i(this._coordinates.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._coordinates},i.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},i.prototype.isEmpty=function(){return this._coordinates.size()===0},i.prototype.init=function(l){l===null&&(l=this.getFactory().getCoordinateSequenceFactory().create([])),kt.isTrue(l.size()<=1),this._coordinates=l},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[Te]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(Ct),Ne=function(){};Ne.prototype.interfaces_=function(){return[]},Ne.prototype.getClass=function(){return Ne};var pe=function(n){function i(l,h,v){if(n.call(this,v),this._shell=null,this._holes=null,l===null&&(l=this.getFactory().createLinearRing()),h===null&&(h=[]),n.hasNullElements(h))throw new N("holes must not contain null elements");if(l.isEmpty()&&n.hasNonEmptyElements(h))throw new N("shell is empty but holes are not");this._shell=l,this._holes=h}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return n.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var l=new Array(this.getNumPoints()).fill(null),h=-1,v=this._shell.getCoordinates(),S=0;S<v.length;S++)l[++h]=v[S];for(var R=0;R<this._holes.length;R++)for(var V=this._holes[R].getCoordinates(),ot=0;ot<V.length;ot++)l[++h]=V[ot];return l},i.prototype.getArea=function(){var l=0;l+=Math.abs(rt.signedArea(this._shell.getCoordinateSequence()));for(var h=0;h<this._holes.length;h++)l-=Math.abs(rt.signedArea(this._holes[h].getCoordinateSequence()));return l},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var l=this._shell.getCoordinateSequence(),h=this.getEnvelopeInternal(),v=0;v<5;v++){var S=l.getX(v);if(S!==h.getMinX()&&S!==h.getMaxX())return!1;var R=l.getY(v);if(R!==h.getMinY()&&R!==h.getMaxY())return!1}for(var V=l.getX(0),ot=l.getY(0),St=1;St<=4;St++){var bt=l.getX(St),Yt=l.getY(St);if(bt!==V==(Yt!==ot))return!1;V=bt,ot=Yt}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var v=l,S=this._shell,R=v._shell;if(!S.equalsExact(R,h)||this._holes.length!==v._holes.length)return!1;for(var V=0;V<this._holes.length;V++)if(!this._holes[V].equalsExact(v._holes[V],h))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var l=0;l<this._holes.length;l++)this.normalize(this._holes[l],!1);er.sort(this._holes)}else if(arguments.length===2){var h=arguments[0],v=arguments[1];if(h.isEmpty())return null;var S=new Array(h.getCoordinates().length-1).fill(null);Qt.arraycopy(h.getCoordinates(),0,S,0,S.length);var R=at.minCoordinate(h.getCoordinates());at.scroll(S,R),Qt.arraycopy(S,0,h.getCoordinates(),0,S.length),h.getCoordinates()[S.length]=S[0],rt.isCCW(h.getCoordinates())===v&&at.reverse(h.getCoordinates())}},i.prototype.getCoordinate=function(){return this._shell.getCoordinate()},i.prototype.getNumInteriorRing=function(){return this._holes.length},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.getLength=function(){var l=0;l+=this._shell.getLength();for(var h=0;h<this._holes.length;h++)l+=this._holes[h].getLength();return l},i.prototype.getNumPoints=function(){for(var l=this._shell.getNumPoints(),h=0;h<this._holes.length;h++)l+=this._holes[h].getNumPoints();return l},i.prototype.reverse=function(){var l=this.copy();l._shell=this._shell.copy().reverse(),l._holes=new Array(this._holes.length).fill(null);for(var h=0;h<this._holes.length;h++)l._holes[h]=this._holes[h].copy().reverse();return l},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0],h=this._shell,v=l._shell;return h.compareToSameClass(v)}if(arguments.length===2){var S=arguments[0],R=arguments[1],V=S,ot=this._shell,St=V._shell,bt=ot.compareToSameClass(St,R);if(bt!==0)return bt;for(var Yt=this.getNumInteriorRing(),Jt=V.getNumInteriorRing(),se=0;se<Yt&&se<Jt;){var _e=this.getInteriorRingN(se),Cn=V.getInteriorRingN(se),Xn=_e.compareToSameClass(Cn,R);if(Xn!==0)return Xn;se++}return se<Yt?1:se<Jt?-1:0}},i.prototype.apply=function(l){if(et(l,tt)){this._shell.apply(l);for(var h=0;h<this._holes.length;h++)this._holes[h].apply(l)}else if(et(l,lr)){if(this._shell.apply(l),!l.isDone())for(var v=0;v<this._holes.length&&(this._holes[v].apply(l),!l.isDone());v++);l.isGeometryChanged()&&this.geometryChanged()}else if(et(l,hr))l.filter(this);else if(et(l,Gt)){l.filter(this),this._shell.apply(l);for(var S=0;S<this._holes.length;S++)this._holes[S].apply(l)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var l=new Array(this._holes.length+1).fill(null);l[0]=this._shell;for(var h=0;h<this._holes.length;h++)l[h+1]=this._holes[h];return l.length<=1?this.getFactory().createLinearRing(l[0].getCoordinateSequence()):this.getFactory().createMultiLineString(l)},i.prototype.clone=function(){var l=n.prototype.clone.call(this);l._shell=this._shell.clone(),l._holes=new Array(this._holes.length).fill(null);for(var h=0;h<this._holes.length;h++)l._holes[h]=this._holes[h].clone();return l},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var l=this._shell.copy(),h=new Array(this._holes.length).fill(null),v=0;v<h.length;v++)h[v]=this._holes[v].copy();return new i(l,h,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(l){return this._holes[l]},i.prototype.interfaces_=function(){return[Ne]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,s),i}(Ct),Oe=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&n.prototype.equalsExact.call(this,l,h)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var l=arguments[0];return this._geometries[l].getCoordinate()}return n.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return Me.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.getGeometryType=function(){return"MultiPoint"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.interfaces_=function(){return[Te]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(Zn),Tn=function(n){function i(l,h){l instanceof D&&h instanceof Ce&&(l=h.getCoordinateSequenceFactory().create(l)),n.call(this,l,h),this.validateConstruction()}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return Me.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var l=this._points.copy();return Zt.reverse(l),this.getFactory().createLinearRing(l)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new N("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new N("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}(jt),Bn=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 Ct.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&n.prototype.equalsExact.call(this,l,h)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),v=0;v<this._geometries.length;v++)h[v]=this._geometries[v].reverse();return this.getFactory().createMultiPolygon(h)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var l=new nt,h=0;h<this._geometries.length;h++)for(var v=this._geometries[h].getBoundary(),S=0;S<v.getNumGeometries();S++)l.add(v.getGeometryN(S));var R=new Array(l.size()).fill(null);return this.getFactory().createMultiLineString(l.toArray(R))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.interfaces_=function(){return[Ne]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,s),i}(Zn),rr=function(n){this._factory=n||null,this._isUserDataCopied=!1},Ki={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};rr.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},rr.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},rr.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof Zn?this.editGeometryCollection(n,i):n instanceof pe?this.editPolygon(n,i):n instanceof ge?i.edit(n,this._factory):n instanceof jt?i.edit(n,this._factory):(kt.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},rr.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),l=new nt,h=0;h<s.getNumGeometries();h++){var v=this.edit(s.getGeometryN(h),i);v===null||v.isEmpty()||l.add(v)}return s.getClass()===Oe?this._factory.createMultiPoint(l.toArray([])):s.getClass()===K?this._factory.createMultiLineString(l.toArray([])):s.getClass()===Bn?this._factory.createMultiPolygon(l.toArray([])):this._factory.createGeometryCollection(l.toArray([]))},rr.prototype.editPolygon=function(n,i){var s=i.edit(n,this._factory);if(s===null&&(s=this._factory.createPolygon(null)),s.isEmpty())return s;var l=this.edit(s.getExteriorRing(),i);if(l===null||l.isEmpty())return this._factory.createPolygon();for(var h=new nt,v=0;v<s.getNumInteriorRing();v++){var S=this.edit(s.getInteriorRingN(v),i);S===null||S.isEmpty()||h.add(S)}return this._factory.createPolygon(l,h.toArray([]))},rr.prototype.interfaces_=function(){return[]},rr.prototype.getClass=function(){return rr},rr.GeometryEditorOperation=function(){},Ki.NoOpGeometryOperation.get=function(){return pr},Ki.CoordinateOperation.get=function(){return ze},Ki.CoordinateSequenceOperation.get=function(){return Is},Object.defineProperties(rr,Ki);var pr=function(){};pr.prototype.edit=function(n,i){return n},pr.prototype.interfaces_=function(){return[rr.GeometryEditorOperation]},pr.prototype.getClass=function(){return pr};var ze=function(){};ze.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof Tn?i.createLinearRing(s):n instanceof jt?i.createLineString(s):n instanceof ge?s.length>0?i.createPoint(s[0]):i.createPoint():n},ze.prototype.interfaces_=function(){return[rr.GeometryEditorOperation]},ze.prototype.getClass=function(){return ze};var Is=function(){};Is.prototype.edit=function(n,i){return n instanceof Tn?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof jt?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof ge?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},Is.prototype.interfaces_=function(){return[rr.GeometryEditorOperation]},Is.prototype.getClass=function(){return Is};var De=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var i=0;i<n;i++)this._coordinates[i]=new D}else if(et(arguments[0],At)){var s=arguments[0];if(s===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=s.getDimension(),this._coordinates=new Array(s.size()).fill(null);for(var l=0;l<this._coordinates.length;l++)this._coordinates[l]=s.getCoordinateCopy(l)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var h=arguments[0],v=arguments[1];this._coordinates=h,this._dimension=v,h===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var S=arguments[0],R=arguments[1];this._coordinates=new Array(S).fill(null),this._dimension=R;for(var V=0;V<S;V++)this._coordinates[V]=new D}}},Yo={serialVersionUID:{configurable:!0}};De.prototype.setOrdinate=function(n,i,s){switch(i){case At.X:this._coordinates[n].x=s;break;case At.Y:this._coordinates[n].y=s;break;case At.Z:this._coordinates[n].z=s;break;default:throw new N("invalid ordinateIndex")}},De.prototype.size=function(){return this._coordinates.length},De.prototype.getOrdinate=function(n,i){switch(i){case At.X:return this._coordinates[n].x;case At.Y:return this._coordinates[n].y;case At.Z:return this._coordinates[n].z}return A.NaN},De.prototype.getCoordinate=function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var i=arguments[0],s=arguments[1];s.x=this._coordinates[i].x,s.y=this._coordinates[i].y,s.z=this._coordinates[i].z}},De.prototype.getCoordinateCopy=function(n){return new D(this._coordinates[n])},De.prototype.getDimension=function(){return this._dimension},De.prototype.getX=function(n){return this._coordinates[n].x},De.prototype.clone=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].clone();return new De(n,this._dimension)},De.prototype.expandEnvelope=function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n},De.prototype.copy=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].copy();return new De(n,this._dimension)},De.prototype.toString=function(){if(this._coordinates.length>0){var n=new Pt(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)n.append(", "),n.append(this._coordinates[i]);return n.append(")"),n.toString()}return"()"},De.prototype.getY=function(n){return this._coordinates[n].y},De.prototype.toCoordinateArray=function(){return this._coordinates},De.prototype.interfaces_=function(){return[At,t]},De.prototype.getClass=function(){return De},Yo.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(De,Yo);var Ui=function(){},$o={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};Ui.prototype.readResolve=function(){return Ui.instance()},Ui.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new De(n)}if(et(arguments[0],At)){var i=arguments[0];return new De(i)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return l>3&&(l=3),l<2?new De(s):new De(s,l)}},Ui.prototype.interfaces_=function(){return[_t,t]},Ui.prototype.getClass=function(){return Ui},Ui.instance=function(){return Ui.instanceObject},$o.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},$o.instanceObject.get=function(){return new Ui},Object.defineProperties(Ui,$o);var Ka=function(n){function i(){n.call(this),this.map_=new Map}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(s){return this.map_.get(s)||null},i.prototype.put=function(s,l){return this.map_.set(s,l),l},i.prototype.values=function(){for(var s=new nt,l=this.map_.values(),h=l.next();!h.done;)s.add(h.value),h=l.next();return s},i.prototype.entrySet=function(){var s=new je;return this.map_.entries().forEach(function(l){return s.add(l)}),s},i.prototype.size=function(){return this.map_.size()},i}(oe),Se=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 ci){var i=arguments[0];this._modelType=i,i===n.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var s=arguments[0];this._modelType=n.FIXED,this.setScale(s)}else if(arguments[0]instanceof n){var l=arguments[0];this._modelType=l._modelType,this._scale=l._scale}}},Qi={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Se.prototype.equals=function(n){if(!(n instanceof Se))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale},Se.prototype.compareTo=function(n){var i=n,s=this.getMaximumSignificantDigits(),l=i.getMaximumSignificantDigits();return new Et(s).compareTo(new Et(l))},Se.prototype.getScale=function(){return this._scale},Se.prototype.isFloating=function(){return this._modelType===Se.FLOATING||this._modelType===Se.FLOATING_SINGLE},Se.prototype.getType=function(){return this._modelType},Se.prototype.toString=function(){var n="UNKNOWN";return this._modelType===Se.FLOATING?n="Floating":this._modelType===Se.FLOATING_SINGLE?n="Floating-Single":this._modelType===Se.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n},Se.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var n=arguments[0];return A.isNaN(n)||this._modelType===Se.FLOATING_SINGLE?n:this._modelType===Se.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof D){var i=arguments[0];if(this._modelType===Se.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},Se.prototype.getMaximumSignificantDigits=function(){var n=16;return this._modelType===Se.FLOATING?n=16:this._modelType===Se.FLOATING_SINGLE?n=6:this._modelType===Se.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n},Se.prototype.setScale=function(n){this._scale=Math.abs(n)},Se.prototype.interfaces_=function(){return[t,z]},Se.prototype.getClass=function(){return Se},Se.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Qi.serialVersionUID.get=function(){return 7777263578777804e3},Qi.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(Se,Qi);var ci=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},fi={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ci.prototype.readResolve=function(){return ci.nameToTypeMap.get(this._name)},ci.prototype.toString=function(){return this._name},ci.prototype.interfaces_=function(){return[t]},ci.prototype.getClass=function(){return ci},fi.serialVersionUID.get=function(){return-552860263173159e4},fi.nameToTypeMap.get=function(){return new Ka},Object.defineProperties(ci,fi),Se.Type=ci,Se.FIXED=new ci("FIXED"),Se.FLOATING=new ci("FLOATING"),Se.FLOATING_SINGLE=new ci("FLOATING SINGLE");var Ce=function n(){this._precisionModel=new Se,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?et(arguments[0],_t)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Se&&(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]))},Du={serialVersionUID:{configurable:!0}};Ce.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new D(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new D(n.getMinX(),n.getMinY()),new D(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new D(n.getMinX(),n.getMinY()),new D(n.getMinX(),n.getMaxY()),new D(n.getMaxX(),n.getMaxY()),new D(n.getMaxX(),n.getMinY()),new D(n.getMinX(),n.getMinY())]),null)},Ce.prototype.createLineString=function(n){return n?n instanceof Array?new jt(this.getCoordinateSequenceFactory().create(n),this):et(n,At)?new jt(n,this):void 0:new jt(this.getCoordinateSequenceFactory().create([]),this)},Ce.prototype.createMultiLineString=function(){if(arguments.length===0)return new K(null,this);if(arguments.length===1){var n=arguments[0];return new K(n,this)}},Ce.prototype.buildGeometry=function(n){for(var i=null,s=!1,l=!1,h=n.iterator();h.hasNext();){var v=h.next(),S=v.getClass();i===null&&(i=S),S!==i&&(s=!0),v.isGeometryCollectionOrDerived()&&(l=!0)}if(i===null)return this.createGeometryCollection();if(s||l)return this.createGeometryCollection(Ce.toGeometryArray(n));var R=n.iterator().next();if(n.size()>1){if(R instanceof pe)return this.createMultiPolygon(Ce.toPolygonArray(n));if(R instanceof jt)return this.createMultiLineString(Ce.toLineStringArray(n));if(R instanceof ge)return this.createMultiPoint(Ce.toPointArray(n));kt.shouldNeverReachHere("Unhandled class: "+R.getClass().getName())}return R},Ce.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},Ce.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof D){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(et(arguments[0],At)){var i=arguments[0];return new ge(i,this)}}},Ce.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Ce.prototype.createPolygon=function(){if(arguments.length===0)return new pe(null,null,this);if(arguments.length===1){if(et(arguments[0],At)){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 Tn){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];return new pe(l,h,this)}},Ce.prototype.getSRID=function(){return this._SRID},Ce.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Zn(null,this);if(arguments.length===1){var n=arguments[0];return new Zn(n,this)}},Ce.prototype.createGeometry=function(n){return new rr(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},Ce.prototype.getPrecisionModel=function(){return this._precisionModel},Ce.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(et(arguments[0],At)){var i=arguments[0];return new Tn(i,this)}}},Ce.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Bn(null,this);if(arguments.length===1){var n=arguments[0];return new Bn(n,this)}},Ce.prototype.createMultiPoint=function(){if(arguments.length===0)return new Oe(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new Oe(n,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if(et(arguments[0],At)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var l=new Array(s.size()).fill(null),h=0;h<s.size();h++){var v=this.getCoordinateSequenceFactory().create(1,s.getDimension());Zt.copy(s,h,v,0,1),l[h]=this.createPoint(v)}return this.createMultiPoint(l)}}},Ce.prototype.interfaces_=function(){return[t]},Ce.prototype.getClass=function(){return Ce},Ce.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.getDefaultCoordinateSequenceFactory=function(){return Ui.instance()},Ce.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},Du.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(Ce,Du);var Qa=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],ml=function(n){this.geometryFactory=n||new Ce};ml.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!ao[s])throw new Error("Unknown GeoJSON type: "+i.type);return Qa.indexOf(s)!==-1?ao[s].apply(this,[i.coordinates]):s==="GeometryCollection"?ao[s].apply(this,[i.geometries]):ao[s].apply(this,[i])},ml.prototype.write=function(n){var i=n.getGeometryType();if(!So[i])throw new Error("Geometry is not supported");return So[i].apply(this,[n])};var ao={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var l=n.geometry.type;if(!ao[l])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=ao.bbox.apply(this,[n.bbox])),i},FeatureCollection:function(n){var i={};if(n.features){i.features=[];for(var s=0;s<n.features.length;++s)i.features.push(this.read(n.features[s]))}return n.bbox&&(i.bbox=this.parse.bbox.apply(this,[n.bbox])),i},coordinates:function(n){for(var i=[],s=0;s<n.length;++s){var l=n[s];i.push(new D(l[0],l[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new D(n[0],n[1]),new D(n[2],n[1]),new D(n[2],n[3]),new D(n[0],n[3]),new D(n[0],n[1])])},Point:function(n){var i=new D(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(ao.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=ao.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(ao.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=ao.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),l=[],h=1;h<n.length;++h){var v=n[h],S=ao.coordinates.apply(this,[v]),R=this.geometryFactory.createLinearRing(S);l.push(R)}return this.geometryFactory.createPolygon(s,l)},MultiPolygon:function(n){for(var i=[],s=0;s<n.length;++s){var l=n[s];i.push(ao.Polygon.apply(this,[l]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(n){for(var i=[],s=0;s<n.length;++s){var l=n[s];i.push(this.read(l))}return this.geometryFactory.createGeometryCollection(i)}},So={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:So.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=So.Point.apply(this,[l]);i.push(h.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(n){for(var i=[],s=n.getCoordinates(),l=0;l<s.length;++l){var h=s[l];i.push(So.coordinate.apply(this,[h]))}return{type:"LineString",coordinates:i}},MultiLineString:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=So.LineString.apply(this,[l]);i.push(h.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=So.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var l=0;l<n._holes.length;++l){var h=n._holes[l],v=So.LineString.apply(this,[h]);i.push(v.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=So.Polygon.apply(this,[l]);i.push(h.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=l.getGeometryType();i.push(So[h].apply(this,[l]))}return{type:"GeometryCollection",geometries:i}}},Fu=function(n){this.geometryFactory=n||new Ce,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new ml(this.geometryFactory)};Fu.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===Se.FIXED&&this.reducePrecision(i),i},Fu.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 _a=function(){this.parser=new ml(this.geometryFactory)};_a.prototype.write=function(n){return this.parser.write(n)};var Ht=function(){},Uu={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};Ht.prototype.interfaces_=function(){return[]},Ht.prototype.getClass=function(){return Ht},Ht.opposite=function(n){return n===Ht.LEFT?Ht.RIGHT:n===Ht.RIGHT?Ht.LEFT:n},Uu.ON.get=function(){return 0},Uu.LEFT.get=function(){return 1},Uu.RIGHT.get=function(){return 2},Object.defineProperties(Ht,Uu),(I.prototype=new Error).name="EmptyStackException",(M.prototype=new ut).add=function(n){return this.array_.push(n),!0},M.prototype.get=function(n){if(n<0||n>=this.size())throw new Error;return this.array_[n]},M.prototype.push=function(n){return this.array_.push(n),n},M.prototype.pop=function(n){if(this.array_.length===0)throw new I;return this.array_.pop()},M.prototype.peek=function(){if(this.array_.length===0)throw new I;return this.array_[this.array_.length-1]},M.prototype.empty=function(){return this.array_.length===0},M.prototype.isEmpty=function(){return this.empty()},M.prototype.search=function(n){return this.array_.indexOf(n)},M.prototype.size=function(){return this.array_.length},M.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n};var bo=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};bo.prototype.getCoordinate=function(){return this._minCoord},bo.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},bo.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();kt.isTrue(this._minIndex>0&&this._minIndex<n.length,"rightmost point expected to be interior vertex of edge");var i=n[this._minIndex-1],s=n[this._minIndex+1],l=rt.computeOrientation(this._minCoord,s,i),h=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&l===rt.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&l===rt.CLOCKWISE)&&(h=!0),h&&(this._minIndex=this._minIndex-1)},bo.prototype.getRightmostSideOfSegment=function(n,i){var s=n.getEdge().getCoordinates();if(i<0||i+1>=s.length||s[i].y===s[i+1].y)return-1;var l=Ht.LEFT;return s[i].y<s[i+1].y&&(l=Ht.RIGHT),l},bo.prototype.getEdge=function(){return this._orientedDe},bo.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])},bo.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)},bo.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}kt.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)===Ht.LEFT&&(this._orientedDe=this._minDe.getSym())},bo.prototype.interfaces_=function(){return[]},bo.prototype.getClass=function(){return bo};var Zo=function(n){function i(s,l){n.call(this,i.msgWithCoord(s,l)),this.pt=l?new D(l):null,this.name="TopologyException"}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getCoordinate=function(){return this.pt},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.msgWithCoord=function(s,l){return l?s:s+" [ "+l+" ]"},i}(Ue),Bu=function(){this.array_=[]};Bu.prototype.addLast=function(n){this.array_.push(n)},Bu.prototype.removeFirst=function(){return this.array_.shift()},Bu.prototype.isEmpty=function(){return this.array_.length===0};var Jr=function(){this._finder=null,this._dirEdgeList=new nt,this._nodes=new nt,this._rightMostCoord=null,this._env=null,this._finder=new bo};Jr.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},Jr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Jr.prototype.computeNodeDepth=function(n){for(var i=null,s=n.getEdges().iterator();s.hasNext();){var l=s.next();if(l.isVisited()||l.getSym().isVisited()){i=l;break}}if(i===null)throw new Zo("unable to find edge to compute depths at "+n.getCoordinate());n.getEdges().computeDepths(i);for(var h=n.getEdges().iterator();h.hasNext();){var v=h.next();v.setVisited(!0),this.copySymDepths(v)}},Jr.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(Ht.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},Jr.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Jr.prototype.findResultEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();){var i=n.next();i.getDepth(Ht.RIGHT)>=1&&i.getDepth(Ht.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},Jr.prototype.computeDepths=function(n){var i=new je,s=new Bu,l=n.getNode();for(s.addLast(l),i.add(l),n.setVisited(!0);!s.isEmpty();){var h=s.removeFirst();i.add(h),this.computeNodeDepth(h);for(var v=h.getEdges().iterator();v.hasNext();){var S=v.next().getSym();if(!S.isVisited()){var R=S.getNode();i.contains(R)||(s.addLast(R),i.add(R))}}}},Jr.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},Jr.prototype.getEnvelope=function(){if(this._env===null){for(var n=new Xt,i=this._dirEdgeList.iterator();i.hasNext();)for(var s=i.next().getEdge().getCoordinates(),l=0;l<s.length-1;l++)n.expandToInclude(s[l]);this._env=n}return this._env},Jr.prototype.addReachable=function(n){var i=new M;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},Jr.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(Ht.LEFT,n.getDepth(Ht.RIGHT)),i.setDepth(Ht.RIGHT,n.getDepth(Ht.LEFT))},Jr.prototype.add=function(n,i){n.setVisited(!0),this._nodes.add(n);for(var s=n.getEdges().iterator();s.hasNext();){var l=s.next();this._dirEdgeList.add(l);var h=l.getSym().getNode();h.isVisited()||i.push(h)}},Jr.prototype.getNodes=function(){return this._nodes},Jr.prototype.getDirectedEdges=function(){return this._dirEdgeList},Jr.prototype.interfaces_=function(){return[z]},Jr.prototype.getClass=function(){return Jr};var Wn=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[Ht.ON]=s}else if(arguments[0]instanceof n){var l=arguments[0];if(this.init(l.location.length),l!==null)for(var h=0;h<this.location.length;h++)this.location[h]=l.location[h]}}else if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];this.init(3),this.location[Ht.ON]=v,this.location[Ht.LEFT]=S,this.location[Ht.RIGHT]=R}};Wn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},Wn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==Z.NONE)return!1;return!0},Wn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===Z.NONE&&(this.location[i]=n)},Wn.prototype.isLine=function(){return this.location.length===1},Wn.prototype.merge=function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[Ht.ON]=this.location[Ht.ON],i[Ht.LEFT]=Z.NONE,i[Ht.RIGHT]=Z.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===Z.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},Wn.prototype.getLocations=function(){return this.location},Wn.prototype.flip=function(){if(this.location.length<=1)return null;var n=this.location[Ht.LEFT];this.location[Ht.LEFT]=this.location[Ht.RIGHT],this.location[Ht.RIGHT]=n},Wn.prototype.toString=function(){var n=new Pt;return this.location.length>1&&n.append(Z.toLocationSymbol(this.location[Ht.LEFT])),n.append(Z.toLocationSymbol(this.location[Ht.ON])),this.location.length>1&&n.append(Z.toLocationSymbol(this.location[Ht.RIGHT])),n.toString()},Wn.prototype.setLocations=function(n,i,s){this.location[Ht.ON]=n,this.location[Ht.LEFT]=i,this.location[Ht.RIGHT]=s},Wn.prototype.get=function(n){return n<this.location.length?this.location[n]:Z.NONE},Wn.prototype.isArea=function(){return this.location.length>1},Wn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===Z.NONE)return!0;return!1},Wn.prototype.setLocation=function(){if(arguments.length===1){var n=arguments[0];this.setLocation(Ht.ON,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.location[i]=s}},Wn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations(Z.NONE)},Wn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},Wn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},Wn.prototype.interfaces_=function(){return[]},Wn.prototype.getClass=function(){return Wn};var An=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 Wn(i),this.elt[1]=new Wn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new Wn(s.elt[0]),this.elt[1]=new Wn(s.elt[1])}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.elt[0]=new Wn(Z.NONE),this.elt[1]=new Wn(Z.NONE),this.elt[l].setLocation(h)}else if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];this.elt[0]=new Wn(v,S,R),this.elt[1]=new Wn(v,S,R)}else if(arguments.length===4){var V=arguments[0],ot=arguments[1],St=arguments[2],bt=arguments[3];this.elt[0]=new Wn(Z.NONE,Z.NONE,Z.NONE),this.elt[1]=new Wn(Z.NONE,Z.NONE,Z.NONE),this.elt[V].setLocations(ot,St,bt)}};An.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},An.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},An.prototype.isNull=function(n){return this.elt[n].isNull()},An.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)}},An.prototype.isLine=function(n){return this.elt[n].isLine()},An.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new Wn(n.elt[i]):this.elt[i].merge(n.elt[i])},An.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},An.prototype.getLocation=function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(Ht.ON)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.elt[i].get(s)}},An.prototype.toString=function(){var n=new Pt;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()},An.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()}},An.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},An.prototype.setLocation=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(Ht.ON,i)}else if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];this.elt[s].setLocation(l,h)}},An.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},An.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},An.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new Wn(this.elt[n].location[0]))},An.prototype.interfaces_=function(){return[]},An.prototype.getClass=function(){return An},An.toLineLabel=function(n){for(var i=new An(Z.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var Mr=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new nt,this._pts=new nt,this._label=new An(Z.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new nt,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};Mr.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=rt.isCCW(this._ring.getCoordinates())},Mr.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Mr.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new Zo("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new Zo("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var l=i.getLabel();kt.isTrue(l.isArea()),this.mergeLabel(l),this.addPoints(i.getEdge(),i.isForward(),s),s=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},Mr.prototype.getLinearRing=function(){return this._ring},Mr.prototype.getCoordinate=function(n){return this._pts.get(n)},Mr.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},Mr.prototype.addPoints=function(n,i,s){var l=n.getCoordinates();if(i){var h=1;s&&(h=0);for(var v=h;v<l.length;v++)this._pts.add(l[v])}else{var S=l.length-2;s&&(S=l.length-1);for(var R=S;R>=0;R--)this._pts.add(l[R])}},Mr.prototype.isHole=function(){return this._isHole},Mr.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},Mr.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!rt.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},Mr.prototype.addHole=function(n){this._holes.add(n)},Mr.prototype.isShell=function(){return this._shell===null},Mr.prototype.getLabel=function(){return this._label},Mr.prototype.getEdges=function(){return this._edges},Mr.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Mr.prototype.getShell=function(){return this._shell},Mr.prototype.mergeLabel=function(){if(arguments.length===1){var n=arguments[0];this.mergeLabel(n,0),this.mergeLabel(n,1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],l=i.getLocation(s,Ht.RIGHT);if(l===Z.NONE)return null;if(this._label.getLocation(s)===Z.NONE)return this._label.setLocation(s,l),null}},Mr.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},Mr.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)},Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr};var rd=function(n){function i(){var s=arguments[0],l=arguments[1];n.call(this,s,l)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(s,l){s.setMinEdgeRing(l)},i.prototype.getNext=function(s){return s.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Mr),Lf=function(n){function i(){var s=arguments[0],l=arguments[1];n.call(this,s,l)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var s=new nt,l=this._startDe;do{if(l.getMinEdgeRing()===null){var h=new rd(l,this._geometryFactory);s.add(h)}l=l.getNext()}while(l!==this._startDe);return s},i.prototype.setEdgeRing=function(s,l){s.setEdgeRing(l)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var s=this._startDe;do s.getNode().getEdges().linkMinimalDirectedEdges(this),s=s.getNext();while(s!==this._startDe)},i.prototype.getNext=function(s){return s.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Mr),Bi=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}}};Bi.prototype.setVisited=function(n){this._isVisited=n},Bi.prototype.setInResult=function(n){this._isInResult=n},Bi.prototype.isCovered=function(){return this._isCovered},Bi.prototype.isCoveredSet=function(){return this._isCoveredSet},Bi.prototype.setLabel=function(n){this._label=n},Bi.prototype.getLabel=function(){return this._label},Bi.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},Bi.prototype.updateIM=function(n){kt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},Bi.prototype.isInResult=function(){return this._isInResult},Bi.prototype.isVisited=function(){return this._isVisited},Bi.prototype.interfaces_=function(){return[]},Bi.prototype.getClass=function(){return Bi};var yl=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var s=arguments[0],l=arguments[1];this._coord=s,this._edges=l,this._label=new An(0,Z.NONE)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var s=this.getEdges().getEdges().iterator();s.hasNext();)if(s.next().getEdge().isInResult())return!0;return!1},i.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},i.prototype.getCoordinate=function(){return this._coord},i.prototype.print=function(s){s.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(s){},i.prototype.computeMergedLocation=function(s,l){var h=Z.NONE;if(h=this._label.getLocation(l),!s.isNull(l)){var v=s.getLocation(l);h!==Z.BOUNDARY&&(h=v)}return h},i.prototype.setLabel=function(){if(arguments.length!==2)return n.prototype.setLabel.apply(this,arguments);var s=arguments[0],l=arguments[1];this._label===null?this._label=new An(s,l):this._label.setLocation(s,l)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof An)for(var l=arguments[0],h=0;h<2;h++){var v=this.computeMergedLocation(l,h);this._label.getLocation(h)===Z.NONE&&this._label.setLocation(h,v)}},i.prototype.add=function(s){this._edges.insert(s),s.setNode(this)},i.prototype.setLabelBoundary=function(s){if(this._label===null)return null;var l=Z.NONE;this._label!==null&&(l=this._label.getLocation(s));var h=null;switch(l){case Z.BOUNDARY:h=Z.INTERIOR;break;case Z.INTERIOR:default:h=Z.BOUNDARY}this._label.setLocation(s,h)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Bi),To=function(){this.nodeMap=new w,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};To.prototype.find=function(n){return this.nodeMap.get(n)},To.prototype.addNode=function(){if(arguments[0]instanceof D){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 yl){var s=arguments[0],l=this.nodeMap.get(s.getCoordinate());return l===null?(this.nodeMap.put(s.getCoordinate(),s),s):(l.mergeLabel(s),l)}},To.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},To.prototype.iterator=function(){return this.nodeMap.values().iterator()},To.prototype.values=function(){return this.nodeMap.values()},To.prototype.getBoundaryNodes=function(n){for(var i=new nt,s=this.iterator();s.hasNext();){var l=s.next();l.getLabel().getLocation(n)===Z.BOUNDARY&&i.add(l)}return i},To.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},To.prototype.interfaces_=function(){return[]},To.prototype.getClass=function(){return To};var kn=function(){},xa={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};kn.prototype.interfaces_=function(){return[]},kn.prototype.getClass=function(){return kn},kn.isNorthern=function(n){return n===kn.NE||n===kn.NW},kn.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},kn.commonHalfPlane=function(n,i){if(n===i)return n;if((n-i+4)%4===2)return-1;var s=n<i?n:i;return s===0&&(n>i?n:i)===3?3:s},kn.isInHalfPlane=function(n,i){return i===kn.SE?n===kn.SE||n===kn.SW:n===i||n===i+1},kn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new N("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?kn.NE:kn.SE:i>=0?kn.NW:kn.SW}if(arguments[0]instanceof D&&arguments[1]instanceof D){var s=arguments[0],l=arguments[1];if(l.x===s.x&&l.y===s.y)throw new N("Cannot compute the quadrant for two identical points "+s);return l.x>=s.x?l.y>=s.y?kn.NE:kn.SE:l.y>=s.y?kn.NW:kn.SW}},xa.NE.get=function(){return 0},xa.NW.get=function(){return 1},xa.SW.get=function(){return 2},xa.SE.get=function(){return 3},Object.defineProperties(kn,xa);var Kr=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];this._edge=i,this.init(s,l),this._label=null}else if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3];this._edge=h,this.init(v,S),this._label=R}};Kr.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:rt.computeOrientation(n._p0,n._p1,this._p1)},Kr.prototype.getDy=function(){return this._dy},Kr.prototype.getCoordinate=function(){return this._p0},Kr.prototype.setNode=function(n){this._node=n},Kr.prototype.print=function(n){var i=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),l=s.lastIndexOf("."),h=s.substring(l+1);n.print(" "+h+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},Kr.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},Kr.prototype.getDirectedCoordinate=function(){return this._p1},Kr.prototype.getDx=function(){return this._dx},Kr.prototype.getLabel=function(){return this._label},Kr.prototype.getEdge=function(){return this._edge},Kr.prototype.getQuadrant=function(){return this._quadrant},Kr.prototype.getNode=function(){return this._node},Kr.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},Kr.prototype.computeLabel=function(n){},Kr.prototype.init=function(n,i){this._p0=n,this._p1=i,this._dx=i.x-n.x,this._dy=i.y-n.y,this._quadrant=kn.quadrant(this._dx,this._dy),kt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},Kr.prototype.interfaces_=function(){return[z]},Kr.prototype.getClass=function(){return Kr};var Cc=function(n){function i(){var s=arguments[0],l=arguments[1];if(n.call(this,s),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=l,l)this.init(s.getCoordinate(0),s.getCoordinate(1));else{var h=s.getNumPoints()-1;this.init(s.getCoordinate(h),s.getCoordinate(h-1))}this.computeDirectedLabel()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(s){return this._depth[s]},i.prototype.setVisited=function(s){this._isVisited=s},i.prototype.computeDirectedLabel=function(){this._label=new An(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(s,l){if(this._depth[s]!==-999&&this._depth[s]!==l)throw new Zo("assigned depths do not match",this.getCoordinate());this._depth[s]=l},i.prototype.isInteriorAreaEdge=function(){for(var s=!0,l=0;l<2;l++)this._label.isArea(l)&&this._label.getLocation(l,Ht.LEFT)===Z.INTERIOR&&this._label.getLocation(l,Ht.RIGHT)===Z.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[Ht.LEFT]+"/"+this._depth[Ht.RIGHT]),s.print(" ("+this.getDepthDelta()+")"),this._isInResult&&s.print(" inResult")},i.prototype.setMinEdgeRing=function(s){this._minEdgeRing=s},i.prototype.isLineEdge=function(){var s=this._label.isLine(0)||this._label.isLine(1),l=!this._label.isArea(0)||this._label.allPositionsEqual(0,Z.EXTERIOR),h=!this._label.isArea(1)||this._label.allPositionsEqual(1,Z.EXTERIOR);return s&&l&&h},i.prototype.setEdgeRing=function(s){this._edgeRing=s},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var s=this._edge.getDepthDelta();return this._isForward||(s=-s),s},i.prototype.setInResult=function(s){this._isInResult=s},i.prototype.getSym=function(){return this._sym},i.prototype.isForward=function(){return this._isForward},i.prototype.getEdge=function(){return this._edge},i.prototype.printEdge=function(s){this.print(s),s.print(" "),this._isForward?this._edge.print(s):this._edge.printReverse(s)},i.prototype.setSym=function(s){this._sym=s},i.prototype.setVisitedEdge=function(s){this.setVisited(s),this._sym.setVisited(s)},i.prototype.setEdgeDepths=function(s,l){var h=this.getEdge().getDepthDelta();this._isForward||(h=-h);var v=1;s===Ht.LEFT&&(v=-1);var S=Ht.opposite(s),R=l+h*v;this.setDepth(s,l),this.setDepth(S,R)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(s){this._next=s},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(s,l){return s===Z.EXTERIOR&&l===Z.INTERIOR?1:s===Z.INTERIOR&&l===Z.EXTERIOR?-1:0},i}(Kr),ja=function(){};ja.prototype.createNode=function(n){return new yl(n,null)},ja.prototype.interfaces_=function(){return[]},ja.prototype.getClass=function(){return ja};var cr=function(){if(this._edges=new nt,this._nodes=null,this._edgeEndList=new nt,arguments.length===0)this._nodes=new To(new ja);else if(arguments.length===1){var n=arguments[0];this._nodes=new To(n)}};cr.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)}},cr.prototype.find=function(n){return this._nodes.find(n)},cr.prototype.addNode=function(){if(arguments[0]instanceof yl){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof D){var i=arguments[0];return this._nodes.addNode(i)}},cr.prototype.getNodeIterator=function(){return this._nodes.iterator()},cr.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},cr.prototype.debugPrintln=function(n){Qt.out.println(n)},cr.prototype.isBoundaryNode=function(n,i){var s=this._nodes.find(i);if(s===null)return!1;var l=s.getLabel();return l!==null&&l.getLocation(n)===Z.BOUNDARY},cr.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},cr.prototype.matchInSameDirection=function(n,i,s,l){return!!n.equals(s)&&rt.computeOrientation(n,i,l)===rt.COLLINEAR&&kn.quadrant(n,i)===kn.quadrant(s,l)},cr.prototype.getEdgeEnds=function(){return this._edgeEndList},cr.prototype.debugPrint=function(n){Qt.out.print(n)},cr.prototype.getEdgeIterator=function(){return this._edges.iterator()},cr.prototype.findEdgeInSameDirection=function(n,i){for(var s=0;s<this._edges.size();s++){var l=this._edges.get(s),h=l.getCoordinates();if(this.matchInSameDirection(n,i,h[0],h[1])||this.matchInSameDirection(n,i,h[h.length-1],h[h.length-2]))return l}return null},cr.prototype.insertEdge=function(n){this._edges.add(n)},cr.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},cr.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var l=new Cc(s,!0),h=new Cc(s,!1);l.setSym(h),h.setSym(l),this.add(l),this.add(h)}},cr.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},cr.prototype.getNodes=function(){return this._nodes.values()},cr.prototype.findEdge=function(n,i){for(var s=0;s<this._edges.size();s++){var l=this._edges.get(s),h=l.getCoordinates();if(n.equals(h[0])&&i.equals(h[1]))return l}return null},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr},cr.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Ei=function(){this._geometryFactory=null,this._shellList=new nt;var n=arguments[0];this._geometryFactory=n};Ei.prototype.sortShellsAndHoles=function(n,i,s){for(var l=n.iterator();l.hasNext();){var h=l.next();h.isHole()?s.add(h):i.add(h)}},Ei.prototype.computePolygons=function(n){for(var i=new nt,s=n.iterator();s.hasNext();){var l=s.next().toPolygon(this._geometryFactory);i.add(l)}return i},Ei.prototype.placeFreeHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var l=s.next();if(l.getShell()===null){var h=this.findEdgeRingContaining(l,n);if(h===null)throw new Zo("unable to assign hole to a shell",l.getCoordinate(0));l.setShell(h)}}},Ei.prototype.buildMinimalEdgeRings=function(n,i,s){for(var l=new nt,h=n.iterator();h.hasNext();){var v=h.next();if(v.getMaxNodeDegree()>2){v.linkDirectedEdgesForMinimalEdgeRings();var S=v.buildMinimalRings(),R=this.findShell(S);R!==null?(this.placePolygonHoles(R,S),i.add(R)):s.addAll(S)}else l.add(v)}return l},Ei.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},Ei.prototype.buildMaximalEdgeRings=function(n){for(var i=new nt,s=n.iterator();s.hasNext();){var l=s.next();if(l.isInResult()&&l.getLabel().isArea()&&l.getEdgeRing()===null){var h=new Lf(l,this._geometryFactory);i.add(h),h.setInResult()}}return i},Ei.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var l=s.next();l.isHole()&&l.setShell(n)}},Ei.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Ei.prototype.findEdgeRingContaining=function(n,i){for(var s=n.getLinearRing(),l=s.getEnvelopeInternal(),h=s.getCoordinateN(0),v=null,S=null,R=i.iterator();R.hasNext();){var V=R.next(),ot=V.getLinearRing(),St=ot.getEnvelopeInternal();v!==null&&(S=v.getLinearRing().getEnvelopeInternal());var bt=!1;St.contains(l)&&rt.isPointInRing(h,ot.getCoordinates())&&(bt=!0),bt&&(v===null||S.contains(St))&&(v=V)}return v},Ei.prototype.findShell=function(n){for(var i=0,s=null,l=n.iterator();l.hasNext();){var h=l.next();h.isHole()||(s=h,i++)}return kt.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},Ei.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];cr.linkResultDirectedEdges(s);var l=this.buildMaximalEdgeRings(i),h=new nt,v=this.buildMinimalEdgeRings(l,this._shellList,h);this.sortShellsAndHoles(v,this._shellList,h),this.placeFreeHoles(this._shellList,h)}},Ei.prototype.interfaces_=function(){return[]},Ei.prototype.getClass=function(){return Ei};var jn=function(){};jn.prototype.getBounds=function(){},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn};var Xe=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};Xe.prototype.getItem=function(){return this._item},Xe.prototype.getBounds=function(){return this._bounds},Xe.prototype.interfaces_=function(){return[jn,t]},Xe.prototype.getClass=function(){return Xe};var hs=function(){this._size=null,this._items=null,this._size=0,this._items=new nt,this._items.add(null)};hs.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},hs.prototype.size=function(){return this._size},hs.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)},hs.prototype.clear=function(){this._size=0,this._items.clear()},hs.prototype.isEmpty=function(){return this._size===0},hs.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)},hs.prototype.interfaces_=function(){return[]},hs.prototype.getClass=function(){return hs};var Rs=function(){};Rs.prototype.visitItem=function(n){},Rs.prototype.interfaces_=function(){return[]},Rs.prototype.getClass=function(){return Rs};var Ea=function(){};Ea.prototype.insert=function(n,i){},Ea.prototype.remove=function(n,i){},Ea.prototype.query=function(){},Ea.prototype.interfaces_=function(){return[]},Ea.prototype.getClass=function(){return Ea};var Ar=function(){if(this._childBoundables=new nt,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},Nf={serialVersionUID:{configurable:!0}};Ar.prototype.getLevel=function(){return this._level},Ar.prototype.size=function(){return this._childBoundables.size()},Ar.prototype.getChildBoundables=function(){return this._childBoundables},Ar.prototype.addChildBoundable=function(n){kt.isTrue(this._bounds===null),this._childBoundables.add(n)},Ar.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Ar.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Ar.prototype.interfaces_=function(){return[jn,t]},Ar.prototype.getClass=function(){return Ar},Nf.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Ar,Nf);var uo=function(){};uo.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},uo.min=function(n){return uo.sort(n),n.get(0)},uo.sort=function(n,i){var s=n.toArray();i?er.sort(s,i):er.sort(s);for(var l=n.iterator(),h=0,v=s.length;h<v;h++)l.next(),l.set(s[h])},uo.singletonList=function(n){var i=new nt;return i.add(n),i};var _r=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()};_r.prototype.expandToQueue=function(n,i){var s=_r.isComposite(this._boundable1),l=_r.isComposite(this._boundable2);if(s&&l)return _r.area(this._boundable1)>_r.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,n,i),null):(this.expand(this._boundable2,this._boundable1,n,i),null);if(s)return this.expand(this._boundable1,this._boundable2,n,i),null;if(l)return this.expand(this._boundable2,this._boundable1,n,i),null;throw new N("neither boundable is composite")},_r.prototype.isLeaves=function(){return!(_r.isComposite(this._boundable1)||_r.isComposite(this._boundable2))},_r.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},_r.prototype.expand=function(n,i,s,l){for(var h=n.getChildBoundables().iterator();h.hasNext();){var v=h.next(),S=new _r(v,i,this._itemDistance);S.getDistance()<l&&s.add(S)}},_r.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},_r.prototype.getDistance=function(){return this._distance},_r.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},_r.prototype.interfaces_=function(){return[z]},_r.prototype.getClass=function(){return _r},_r.area=function(n){return n.getBounds().getArea()},_r.isComposite=function(n){return n instanceof Ar};var Fr=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new nt,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];kt.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},Ur={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Fr.prototype.getNodeCapacity=function(){return this._nodeCapacity},Fr.prototype.lastNode=function(n){return n.get(n.size()-1)},Fr.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 Ar?n+=this.size(s):s instanceof Xe&&(n+=1)}return n}},Fr.prototype.removeItem=function(n,i){for(var s=null,l=n.getChildBoundables().iterator();l.hasNext();){var h=l.next();h instanceof Xe&&h.getItem()===i&&(s=h)}return s!==null&&(n.getChildBoundables().remove(s),!0)},Fr.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new nt:n}if(arguments.length===1){for(var i=arguments[0],s=new nt,l=i.getChildBoundables().iterator();l.hasNext();){var h=l.next();if(h instanceof Ar){var v=this.itemsTree(h);v!==null&&s.add(v)}else h instanceof Xe?s.add(h.getItem()):kt.shouldNeverReachHere()}return s.size()<=0?null:s}},Fr.prototype.insert=function(n,i){kt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Xe(n,i))},Fr.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new nt;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];if(kt.isTrue(s>-2),l.getLevel()===s)return h.add(l),null;for(var v=l.getChildBoundables().iterator();v.hasNext();){var S=v.next();S instanceof Ar?this.boundablesAtLevel(s,S,h):(kt.isTrue(S instanceof Xe),s===-1&&h.add(S))}return null}},Fr.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new nt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i),i}if(arguments.length===2){var s=arguments[0],l=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,l)}else if(arguments.length===3){if(et(arguments[2],Rs)&&arguments[0]instanceof Object&&arguments[1]instanceof Ar)for(var h=arguments[0],v=arguments[1],S=arguments[2],R=v.getChildBoundables(),V=0;V<R.size();V++){var ot=R.get(V);this.getIntersectsOp().intersects(ot.getBounds(),h)&&(ot instanceof Ar?this.query(h,ot,S):ot instanceof Xe?S.visitItem(ot.getItem()):kt.shouldNeverReachHere())}else if(et(arguments[2],ut)&&arguments[0]instanceof Object&&arguments[1]instanceof Ar)for(var St=arguments[0],bt=arguments[1],Yt=arguments[2],Jt=bt.getChildBoundables(),se=0;se<Jt.size();se++){var _e=Jt.get(se);this.getIntersectsOp().intersects(_e.getBounds(),St)&&(_e instanceof Ar?this.query(St,_e,Yt):_e instanceof Xe?Yt.add(_e.getItem()):kt.shouldNeverReachHere())}}},Fr.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},Fr.prototype.getRoot=function(){return this.build(),this._root},Fr.prototype.remove=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,i)}if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2],v=this.removeItem(l,h);if(v)return!0;for(var S=null,R=l.getChildBoundables().iterator();R.hasNext();){var V=R.next();if(this.getIntersectsOp().intersects(V.getBounds(),s)&&V instanceof Ar&&(v=this.remove(s,V,h))){S=V;break}}return S!==null&&S.getChildBoundables().isEmpty()&&l.getChildBoundables().remove(S),v}},Fr.prototype.createHigherLevels=function(n,i){kt.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},Fr.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 Ar){var l=this.depth(s);l>n&&(n=l)}}return n+1}},Fr.prototype.createParentBoundables=function(n,i){kt.isTrue(!n.isEmpty());var s=new nt;s.add(this.createNode(i));var l=new nt(n);uo.sort(l,this.getComparator());for(var h=l.iterator();h.hasNext();){var v=h.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(i)),this.lastNode(s).addChildBoundable(v)}return s},Fr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Fr.prototype.interfaces_=function(){return[t]},Fr.prototype.getClass=function(){return Fr},Fr.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},Ur.IntersectsOp.get=function(){return Pc},Ur.serialVersionUID.get=function(){return-3886435814360241e3},Ur.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Fr,Ur);var Pc=function(){},Ao=function(){};Ao.prototype.distance=function(n,i){},Ao.prototype.interfaces_=function(){return[]},Ao.prototype.getClass=function(){return Ao};var Ic=function(n){function i(l){l=l||i.DEFAULT_NODE_CAPACITY,n.call(this,l)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return i.prototype.createParentBoundablesFromVerticalSlices=function(l,h){kt.isTrue(l.length>0);for(var v=new nt,S=0;S<l.length;S++)v.addAll(this.createParentBoundablesFromVerticalSlice(l[S],h));return v},i.prototype.createNode=function(l){return new vl(l)},i.prototype.size=function(){return arguments.length===0?n.prototype.size.call(this):n.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return n.prototype.insert.apply(this,arguments);var l=arguments[0],h=arguments[1];if(l.isNull())return null;n.prototype.insert.call(this,l,h)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(l,h){for(var v=Math.trunc(Math.ceil(l.size()/h)),S=new Array(h).fill(null),R=l.iterator(),V=0;V<h;V++){S[V]=new nt;for(var ot=0;R.hasNext()&&ot<v;){var St=R.next();S[V].add(St),ot++}}return S},i.prototype.query=function(){if(arguments.length===1){var l=arguments[0];return n.prototype.query.call(this,l)}if(arguments.length===2){var h=arguments[0],v=arguments[1];n.prototype.query.call(this,h,v)}else if(arguments.length===3){if(et(arguments[2],Rs)&&arguments[0]instanceof Object&&arguments[1]instanceof Ar){var S=arguments[0],R=arguments[1],V=arguments[2];n.prototype.query.call(this,S,R,V)}else if(et(arguments[2],ut)&&arguments[0]instanceof Object&&arguments[1]instanceof Ar){var ot=arguments[0],St=arguments[1],bt=arguments[2];n.prototype.query.call(this,ot,St,bt)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(l,h){return n.prototype.createParentBoundables.call(this,l,h)},i.prototype.remove=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return n.prototype.remove.call(this,l,h)}return n.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?n.prototype.depth.call(this):n.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(l,h){kt.isTrue(!l.isEmpty());var v=Math.trunc(Math.ceil(l.size()/this.getNodeCapacity())),S=new nt(l);uo.sort(S,i.xComparator);var R=this.verticalSlices(S,Math.trunc(Math.ceil(Math.sqrt(v))));return this.createParentBoundablesFromVerticalSlices(R,h)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if(et(arguments[0],Ao)){var l=arguments[0],h=new _r(this.getRoot(),this.getRoot(),l);return this.nearestNeighbour(h)}if(arguments[0]instanceof _r){var v=arguments[0];return this.nearestNeighbour(v,A.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&et(arguments[1],Ao)){var S=arguments[0],R=arguments[1],V=new _r(this.getRoot(),S.getRoot(),R);return this.nearestNeighbour(V)}if(arguments[0]instanceof _r&&typeof arguments[1]=="number"){var ot=arguments[0],St=arguments[1],bt=null,Yt=new hs;for(Yt.add(ot);!Yt.isEmpty()&&St>0;){var Jt=Yt.poll(),se=Jt.getDistance();if(se>=St)break;Jt.isLeaves()?(St=se,bt=Jt):Jt.expandToQueue(Yt,St)}return[bt.getBoundable(0).getItem(),bt.getBoundable(1).getItem()]}}else if(arguments.length===3){var _e=arguments[0],Cn=arguments[1],Xn=arguments[2],ui=new Xe(_e,Cn),rs=new _r(this.getRoot(),ui,Xn);return this.nearestNeighbour(rs)[0]}},i.prototype.interfaces_=function(){return[Ea,t]},i.prototype.getClass=function(){return i},i.centreX=function(l){return i.avg(l.getMinX(),l.getMaxX())},i.avg=function(l,h){return(l+h)/2},i.centreY=function(l){return i.avg(l.getMinY(),l.getMaxY())},s.STRtreeNode.get=function(){return vl},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[q]},compare:function(l,h){return n.compareDoubles(i.centreX(l.getBounds()),i.centreX(h.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[q]},compare:function(l,h){return n.compareDoubles(i.centreY(l.getBounds()),i.centreY(h.getBounds()))}}},s.intersectsOp.get=function(){return{interfaces_:function(){return[n.IntersectsOp]},intersects:function(l,h){return l.intersects(h)}}},s.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,s),i}(Fr),vl=function(n){function i(){var s=arguments[0];n.call(this,s)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var s=null,l=this.getChildBoundables().iterator();l.hasNext();){var h=l.next();s===null?s=new Xt(h.getBounds()):s.expandToInclude(h.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Ar),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 l=ir.relativeSign(i.x,s.x),h=ir.relativeSign(i.y,s.y);switch(n){case 0:return ir.compareValue(l,h);case 1:return ir.compareValue(h,l);case 2:return ir.compareValue(h,-l);case 3:return ir.compareValue(-l,h);case 4:return ir.compareValue(-l,-h);case 5:return ir.compareValue(-h,-l);case 6:return ir.compareValue(-h,l);case 7:return ir.compareValue(l,-h)}return kt.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 ps=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];this._segString=n,this.coord=new D(i),this.segmentIndex=s,this._segmentOctant=l,this._isInterior=!i.equals2D(n.getCoordinate(s))};ps.prototype.getCoordinate=function(){return this.coord},ps.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},ps.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)},ps.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},ps.prototype.isInterior=function(){return this._isInterior},ps.prototype.interfaces_=function(){return[z]},ps.prototype.getClass=function(){return ps};var Qr=function(){this._nodeMap=new w,this._edge=null;var n=arguments[0];this._edge=n};Qr.prototype.getSplitCoordinates=function(){var n=new dt;this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var l=i.next();this.addEdgeCoordinates(s,l,n),s=l}return n.toCoordinateArray()},Qr.prototype.addCollapsedNodes=function(){var n=new nt;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)}},Qr.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},Qr.prototype.findCollapsesFromExistingVertices=function(n){for(var i=0;i<this._edge.size()-2;i++){var s=this._edge.getCoordinate(i),l=this._edge.getCoordinate(i+2);s.equals2D(l)&&n.add(new Et(i+1))}},Qr.prototype.addEdgeCoordinates=function(n,i,s){var l=this._edge.getCoordinate(i.segmentIndex),h=i.isInterior()||!i.coord.equals2D(l);s.add(new D(n.coord),!1);for(var v=n.segmentIndex+1;v<=i.segmentIndex;v++)s.add(this._edge.getCoordinate(v));h&&s.add(new D(i.coord))},Qr.prototype.iterator=function(){return this._nodeMap.values().iterator()},Qr.prototype.addSplitEdges=function(n){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),s=i.next();i.hasNext();){var l=i.next(),h=this.createSplitEdge(s,l);n.add(h),s=l}},Qr.prototype.findCollapseIndex=function(n,i,s){if(!n.coord.equals2D(i.coord))return!1;var l=i.segmentIndex-n.segmentIndex;return i.isInterior()||l--,l===1&&(s[0]=n.segmentIndex+1,!0)},Qr.prototype.findCollapsesFromInsertedNodes=function(n){for(var i=new Array(1).fill(null),s=this.iterator(),l=s.next();s.hasNext();){var h=s.next();this.findCollapseIndex(l,h,i)&&n.add(new Et(i[0])),l=h}},Qr.prototype.getEdge=function(){return this._edge},Qr.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},Qr.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,l=this._edge.getCoordinate(i.segmentIndex),h=i.isInterior()||!i.coord.equals2D(l);h||s--;var v=new Array(s).fill(null),S=0;v[S++]=new D(n.coord);for(var R=n.segmentIndex+1;R<=i.segmentIndex;R++)v[S++]=this._edge.getCoordinate(R);return h&&(v[S]=new D(i.coord)),new dr(v,this._edge.getData())},Qr.prototype.add=function(n,i){var s=new ps(this._edge,n,i,this._edge.getSegmentOctant(i)),l=this._nodeMap.get(s);return l!==null?(kt.isTrue(l.coord.equals2D(n),"Found equal nodes with different coordinates"),l):(this._nodeMap.put(s,s),s)},Qr.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new Ue("bad split edge start point at "+s);var l=n.get(n.size()-1).getCoordinates(),h=l[l.length-1];if(!h.equals2D(i[i.length-1]))throw new Ue("bad split edge end point at "+h)},Qr.prototype.interfaces_=function(){return[]},Qr.prototype.getClass=function(){return Qr};var Zs=function(){};Zs.prototype.interfaces_=function(){return[]},Zs.prototype.getClass=function(){return Zs},Zs.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 N("Cannot compute the octant for point ( "+n+", "+i+" )");var s=Math.abs(n),l=Math.abs(i);return n>=0?i>=0?s>=l?0:1:s>=l?7:6:i>=0?s>=l?3:2:s>=l?4:5}if(arguments[0]instanceof D&&arguments[1]instanceof D){var h=arguments[0],v=arguments[1],S=v.x-h.x,R=v.y-h.y;if(S===0&&R===0)throw new N("Cannot compute the octant for two identical points "+h);return Zs.octant(S,R)}};var Co=function(){};Co.prototype.getCoordinates=function(){},Co.prototype.size=function(){},Co.prototype.getCoordinate=function(n){},Co.prototype.isClosed=function(){},Co.prototype.setData=function(n){},Co.prototype.getData=function(){},Co.prototype.interfaces_=function(){return[]},Co.prototype.getClass=function(){return Co};var tu=function(){};tu.prototype.addIntersection=function(n,i){},tu.prototype.interfaces_=function(){return[Co]},tu.prototype.getClass=function(){return tu};var dr=function(){this._nodeList=new Qr(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};dr.prototype.getCoordinates=function(){return this._pts},dr.prototype.size=function(){return this._pts.length},dr.prototype.getCoordinate=function(n){return this._pts[n]},dr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},dr.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},dr.prototype.setData=function(n){this._data=n},dr.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:Zs.octant(n,i)},dr.prototype.getData=function(){return this._data},dr.prototype.addIntersection=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.addIntersectionNode(n,i)}else if(arguments.length===4){var s=arguments[0],l=arguments[1],h=arguments[3],v=new D(s.getIntersection(h));this.addIntersection(v,l)}},dr.prototype.toString=function(){return de.toLineString(new De(this._pts))},dr.prototype.getNodeList=function(){return this._nodeList},dr.prototype.addIntersectionNode=function(n,i){var s=i,l=s+1;if(l<this._pts.length){var h=this._pts[l];n.equals2D(h)&&(s=l)}return this._nodeList.add(n,s)},dr.prototype.addIntersections=function(n,i,s){for(var l=0;l<n.getIntersectionNum();l++)this.addIntersection(n,i,s,l)},dr.prototype.interfaces_=function(){return[tu]},dr.prototype.getClass=function(){return dr},dr.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new nt;return dr.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var s=arguments[0],l=arguments[1],h=s.iterator();h.hasNext();)h.next().getNodeList().addSplitEdges(l)};var ne=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new D,this.p1=new D;else if(arguments.length===1){var n=arguments[0];this.p0=new D(n.p0),this.p1=new D(n.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],s=arguments[1],l=arguments[2],h=arguments[3];this.p0=new D(i,s),this.p1=new D(l,h)}},Of={serialVersionUID:{configurable:!0}};ne.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},ne.prototype.orientationIndex=function(){if(arguments[0]instanceof ne){var n=arguments[0],i=rt.orientationIndex(this.p0,this.p1,n.p0),s=rt.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 D){var l=arguments[0];return rt.orientationIndex(this.p0,this.p1,l)}},ne.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},ne.prototype.isVertical=function(){return this.p0.x===this.p1.x},ne.prototype.equals=function(n){if(!(n instanceof ne))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},ne.prototype.intersection=function(n){var i=new $n;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},ne.prototype.project=function(){if(arguments[0]instanceof D){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new D(n);var i=this.projectionFactor(n),s=new D;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 ne){var l=arguments[0],h=this.projectionFactor(l.p0),v=this.projectionFactor(l.p1);if(h>=1&&v>=1||h<=0&&v<=0)return null;var S=this.project(l.p0);h<0&&(S=this.p0),h>1&&(S=this.p1);var R=this.project(l.p1);return v<0&&(R=this.p0),v>1&&(R=this.p1),new ne(S,R)}},ne.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},ne.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},ne.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},ne.prototype.distancePerpendicular=function(n){return rt.distancePointLinePerpendicular(n,this.p0,this.p1)},ne.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},ne.prototype.midPoint=function(){return ne.midPoint(this.p0,this.p1)},ne.prototype.projectionFactor=function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,l=i*i+s*s;return l<=0?A.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/l},ne.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),l=A.MAX_VALUE,h=null,v=this.closestPoint(n.p0);l=v.distance(n.p0),s[0]=v,s[1]=n.p0;var S=this.closestPoint(n.p1);(h=S.distance(n.p1))<l&&(l=h,s[0]=S,s[1]=n.p1);var R=n.closestPoint(this.p0);(h=R.distance(this.p0))<l&&(l=h,s[0]=this.p0,s[1]=R);var V=n.closestPoint(this.p1);return(h=V.distance(this.p1))<l&&(l=h,s[0]=this.p1,s[1]=V),s},ne.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},ne.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},ne.prototype.getLength=function(){return this.p0.distance(this.p1)},ne.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},ne.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},ne.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)},ne.prototype.lineIntersection=function(n){try{return me.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof le))throw i}return null},ne.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},ne.prototype.pointAlongOffset=function(n,i){var s=this.p0.x+n*(this.p1.x-this.p0.x),l=this.p0.y+n*(this.p1.y-this.p0.y),h=this.p1.x-this.p0.x,v=this.p1.y-this.p0.y,S=Math.sqrt(h*h+v*v),R=0,V=0;if(i!==0){if(S<=0)throw new Error("Cannot compute offset from zero-length line segment");R=i*h/S,V=i*v/S}return new D(s-V,l+R)},ne.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}},ne.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||A.isNaN(i))&&(i=1),i},ne.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},ne.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},ne.prototype.distance=function(){if(arguments[0]instanceof ne){var n=arguments[0];return rt.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof D){var i=arguments[0];return rt.distancePointLine(i,this.p0,this.p1)}},ne.prototype.pointAlong=function(n){var i=new D;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},ne.prototype.hashCode=function(){var n=A.doubleToLongBits(this.p0.x);n^=31*A.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=A.doubleToLongBits(this.p1.x);return s^=31*A.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},ne.prototype.interfaces_=function(){return[z,t]},ne.prototype.getClass=function(){return ne},ne.midPoint=function(n,i){return new D((n.x+i.x)/2,(n.y+i.y)/2)},Of.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(ne,Of);var wi=function(){this.tempEnv1=new Xt,this.tempEnv2=new Xt,this._overlapSeg1=new ne,this._overlapSeg2=new ne};wi.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];n.getLineSegment(i,this._overlapSeg1),s.getLineSegment(l,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},wi.prototype.interfaces_=function(){return[]},wi.prototype.getClass=function(){return wi};var Mi=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];this._pts=n,this._start=i,this._end=s,this._context=l};Mi.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},Mi.prototype.computeSelect=function(n,i,s,l){var h=this._pts[i],v=this._pts[s];if(l.tempEnv1.init(h,v),s-i==1)return l.select(this,i),null;if(!n.intersects(l.tempEnv1))return null;var S=Math.trunc((i+s)/2);i<S&&this.computeSelect(n,i,S,l),S<s&&this.computeSelect(n,S,s,l)},Mi.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},Mi.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},Mi.prototype.setId=function(n){this._id=n},Mi.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},Mi.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new Xt(n,i)}return this._env},Mi.prototype.getEndIndex=function(){return this._end},Mi.prototype.getStartIndex=function(){return this._start},Mi.prototype.getContext=function(){return this._context},Mi.prototype.getId=function(){return this._id},Mi.prototype.computeOverlapsInternal=function(n,i,s,l,h,v){var S=this._pts[n],R=this._pts[i],V=s._pts[l],ot=s._pts[h];if(i-n==1&&h-l==1)return v.overlap(this,n,s,l),null;if(v.tempEnv1.init(S,R),v.tempEnv2.init(V,ot),!v.tempEnv1.intersects(v.tempEnv2))return null;var St=Math.trunc((n+i)/2),bt=Math.trunc((l+h)/2);n<St&&(l<bt&&this.computeOverlapsInternal(n,St,s,l,bt,v),bt<h&&this.computeOverlapsInternal(n,St,s,bt,h,v)),St<i&&(l<bt&&this.computeOverlapsInternal(St,i,s,l,bt,v),bt<h&&this.computeOverlapsInternal(St,i,s,bt,h,v))},Mi.prototype.interfaces_=function(){return[]},Mi.prototype.getClass=function(){return Mi};var lo=function(){};lo.prototype.interfaces_=function(){return[]},lo.prototype.getClass=function(){return lo},lo.getChainStartIndices=function(n){var i=0,s=new nt;s.add(new Et(i));do{var l=lo.findChainEnd(n,i);s.add(new Et(l)),i=l}while(i<n.length-1);return lo.toIntArray(s)},lo.findChainEnd=function(n,i){for(var s=i;s<n.length-1&&n[s].equals2D(n[s+1]);)s++;if(s>=n.length-1)return n.length-1;for(var l=kn.quadrant(n[s],n[s+1]),h=i+1;h<n.length&&!(!n[h-1].equals2D(n[h])&&kn.quadrant(n[h-1],n[h])!==l);)h++;return h-1},lo.getChains=function(){if(arguments.length===1){var n=arguments[0];return lo.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],l=new nt,h=lo.getChainStartIndices(i),v=0;v<h.length-1;v++){var S=new Mi(i,h[v],h[v+1],s);l.add(S)}return l}},lo.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 zi=function(){};zi.prototype.computeNodes=function(n){},zi.prototype.getNodedSubstrings=function(){},zi.prototype.interfaces_=function(){return[]},zi.prototype.getClass=function(){return zi};var Js=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};Js.prototype.setSegmentIntersector=function(n){this._segInt=n},Js.prototype.interfaces_=function(){return[zi]},Js.prototype.getClass=function(){return Js};var zu=function(n){function i(l){l?n.call(this,l):n.call(this),this._monoChains=new nt,this._index=new Ic,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 dr.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(l){for(var h=lo.getChains(l.getCoordinates(),l).iterator();h.hasNext();){var v=h.next();v.setId(this._idCounter++),this._index.insert(v.getEnvelope(),v),this._monoChains.add(v)}},i.prototype.computeNodes=function(l){this._nodedSegStrings=l;for(var h=l.iterator();h.hasNext();)this.add(h.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var l=new xr(this._segInt),h=this._monoChains.iterator();h.hasNext();)for(var v=h.next(),S=this._index.query(v.getEnvelope()).iterator();S.hasNext();){var R=S.next();if(R.getId()>v.getId()&&(v.computeOverlaps(R,l),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.SegmentOverlapAction.get=function(){return xr},Object.defineProperties(i,s),i}(Js),xr=function(n){function i(){n.call(this),this._si=null;var s=arguments[0];this._si=s}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return n.prototype.overlap.apply(this,arguments);var s=arguments[0],l=arguments[1],h=arguments[2],v=arguments[3],S=s.getContext(),R=h.getContext();this._si.processIntersections(S,l,R,v)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(wi),Fe=function n(){if(this._quadrantSegments=n.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=n.CAP_ROUND,this._joinStyle=n.JOIN_ROUND,this._mitreLimit=n.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=n.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.setQuadrantSegments(s),this.setEndCapStyle(l)}else if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3];this.setQuadrantSegments(h),this.setEndCapStyle(v),this.setJoinStyle(S),this.setMitreLimit(R)}}},Po={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Fe.prototype.getEndCapStyle=function(){return this._endCapStyle},Fe.prototype.isSingleSided=function(){return this._isSingleSided},Fe.prototype.setQuadrantSegments=function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=Fe.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Fe.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==Fe.JOIN_ROUND&&(this._quadrantSegments=Fe.DEFAULT_QUADRANT_SEGMENTS)},Fe.prototype.getJoinStyle=function(){return this._joinStyle},Fe.prototype.setJoinStyle=function(n){this._joinStyle=n},Fe.prototype.setSimplifyFactor=function(n){this._simplifyFactor=n<0?0:n},Fe.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Fe.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Fe.prototype.setEndCapStyle=function(n){this._endCapStyle=n},Fe.prototype.getMitreLimit=function(){return this._mitreLimit},Fe.prototype.setMitreLimit=function(n){this._mitreLimit=n},Fe.prototype.setSingleSided=function(n){this._isSingleSided=n},Fe.prototype.interfaces_=function(){return[]},Fe.prototype.getClass=function(){return Fe},Fe.bufferDistanceError=function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)},Po.CAP_ROUND.get=function(){return 1},Po.CAP_FLAT.get=function(){return 2},Po.CAP_SQUARE.get=function(){return 3},Po.JOIN_ROUND.get=function(){return 1},Po.JOIN_MITRE.get=function(){return 2},Po.JOIN_BEVEL.get=function(){return 3},Po.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Po.DEFAULT_MITRE_LIMIT.get=function(){return 5},Po.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(Fe,Po);var gr=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=rt.COUNTERCLOCKWISE,this._inputLine=n||null},wa={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};gr.prototype.isDeletable=function(n,i,s,l){var h=this._inputLine[n],v=this._inputLine[i],S=this._inputLine[s];return!!this.isConcave(h,v,S)&&!!this.isShallow(h,v,S,l)&&this.isShallowSampled(h,v,n,s,l)},gr.prototype.deleteShallowConcavities=function(){for(var n=1,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i),l=!1;s<this._inputLine.length;){var h=!1;this.isDeletable(n,i,s,this._distanceTol)&&(this._isDeleted[i]=gr.DELETE,h=!0,l=!0),n=h?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return l},gr.prototype.isShallowConcavity=function(n,i,s,l){return rt.computeOrientation(n,i,s)!==this._angleOrientation?!1:rt.distancePointLine(i,n,s)<l},gr.prototype.isShallowSampled=function(n,i,s,l,h){var v=Math.trunc((l-s)/gr.NUM_PTS_TO_CHECK);v<=0&&(v=1);for(var S=s;S<l;S+=v)if(!this.isShallow(n,i,this._inputLine[S],h))return!1;return!0},gr.prototype.isConcave=function(n,i,s){var l=rt.computeOrientation(n,i,s)===this._angleOrientation;return l},gr.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=rt.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},gr.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===gr.DELETE;)i++;return i},gr.prototype.isShallow=function(n,i,s,l){return rt.distancePointLine(i,n,s)<l},gr.prototype.collapseLine=function(){for(var n=new dt,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==gr.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},gr.prototype.interfaces_=function(){return[]},gr.prototype.getClass=function(){return gr},gr.simplify=function(n,i){return new gr(n).simplify(i)},wa.INIT.get=function(){return 0},wa.DELETE.get=function(){return 1},wa.KEEP.get=function(){return 1},wa.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(gr,wa);var Gi=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new nt},Df={COORDINATE_ARRAY_TYPE:{configurable:!0}};Gi.prototype.getCoordinates=function(){return this._ptList.toArray(Gi.COORDINATE_ARRAY_TYPE)},Gi.prototype.setPrecisionModel=function(n){this._precisionModel=n},Gi.prototype.addPt=function(n){var i=new D(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},Gi.prototype.revere=function(){},Gi.prototype.addPts=function(n,i){if(i)for(var s=0;s<n.length;s++)this.addPt(n[s]);else for(var l=n.length-1;l>=0;l--)this.addPt(n[l])},Gi.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},Gi.prototype.toString=function(){return new Ce().createLineString(this.getCoordinates()).toString()},Gi.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new D(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},Gi.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},Gi.prototype.interfaces_=function(){return[]},Gi.prototype.getClass=function(){return Gi},Df.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Gi,Df);var Ge=function(){},Ks={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};Ge.prototype.interfaces_=function(){return[]},Ge.prototype.getClass=function(){return Ge},Ge.toDegrees=function(n){return 180*n/Math.PI},Ge.normalize=function(n){for(;n>Math.PI;)n-=Ge.PI_TIMES_2;for(;n<=-Math.PI;)n+=Ge.PI_TIMES_2;return n},Ge.angle=function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var i=arguments[0],s=arguments[1],l=s.x-i.x,h=s.y-i.y;return Math.atan2(h,l)}},Ge.isAcute=function(n,i,s){var l=n.x-i.x,h=n.y-i.y;return l*(s.x-i.x)+h*(s.y-i.y)>0},Ge.isObtuse=function(n,i,s){var l=n.x-i.x,h=n.y-i.y;return l*(s.x-i.x)+h*(s.y-i.y)<0},Ge.interiorAngle=function(n,i,s){var l=Ge.angle(i,n),h=Ge.angle(i,s);return Math.abs(h-l)},Ge.normalizePositive=function(n){if(n<0){for(;n<0;)n+=Ge.PI_TIMES_2;n>=Ge.PI_TIMES_2&&(n=0)}else{for(;n>=Ge.PI_TIMES_2;)n-=Ge.PI_TIMES_2;n<0&&(n=0)}return n},Ge.angleBetween=function(n,i,s){var l=Ge.angle(i,n),h=Ge.angle(i,s);return Ge.diff(l,h)},Ge.diff=function(n,i){var s=null;return(s=n<i?i-n:n-i)>Math.PI&&(s=2*Math.PI-s),s},Ge.toRadians=function(n){return n*Math.PI/180},Ge.getTurn=function(n,i){var s=Math.sin(i-n);return s>0?Ge.COUNTERCLOCKWISE:s<0?Ge.CLOCKWISE:Ge.NONE},Ge.angleBetweenOriented=function(n,i,s){var l=Ge.angle(i,n),h=Ge.angle(i,s)-l;return h<=-Math.PI?h+Ge.PI_TIMES_2:h>Math.PI?h-Ge.PI_TIMES_2:h},Ks.PI_TIMES_2.get=function(){return 2*Math.PI},Ks.PI_OVER_2.get=function(){return Math.PI/2},Ks.PI_OVER_4.get=function(){return Math.PI/4},Ks.COUNTERCLOCKWISE.get=function(){return rt.COUNTERCLOCKWISE},Ks.CLOCKWISE.get=function(){return rt.CLOCKWISE},Ks.NONE.get=function(){return rt.COLLINEAR},Object.defineProperties(Ge,Ks);var qn=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 ne,this._seg1=new ne,this._offset0=new ne,this._offset1=new ne,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],s=arguments[1],l=arguments[2];this._precisionModel=i,this._bufParams=s,this._li=new $n,this._filletAngleQuantum=Math.PI/2/s.getQuadrantSegments(),s.getQuadrantSegments()>=8&&s.getJoinStyle()===Fe.JOIN_ROUND&&(this._closingSegLengthFactor=n.MAX_CLOSING_SEG_LEN_FACTOR),this.init(l)},ds={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}};qn.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=rt.computeOrientation(this._s0,this._s1,this._s2),l=s===rt.CLOCKWISE&&this._side===Ht.LEFT||s===rt.COUNTERCLOCKWISE&&this._side===Ht.RIGHT;s===0?this.addCollinear(i):l?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},qn.prototype.addLineEndCap=function(n,i){var s=new ne(n,i),l=new ne;this.computeOffsetSegment(s,Ht.LEFT,this._distance,l);var h=new ne;this.computeOffsetSegment(s,Ht.RIGHT,this._distance,h);var v=i.x-n.x,S=i.y-n.y,R=Math.atan2(S,v);switch(this._bufParams.getEndCapStyle()){case Fe.CAP_ROUND:this._segList.addPt(l.p1),this.addFilletArc(i,R+Math.PI/2,R-Math.PI/2,rt.CLOCKWISE,this._distance),this._segList.addPt(h.p1);break;case Fe.CAP_FLAT:this._segList.addPt(l.p1),this._segList.addPt(h.p1);break;case Fe.CAP_SQUARE:var V=new D;V.x=Math.abs(this._distance)*Math.cos(R),V.y=Math.abs(this._distance)*Math.sin(R);var ot=new D(l.p1.x+V.x,l.p1.y+V.y),St=new D(h.p1.x+V.x,h.p1.y+V.y);this._segList.addPt(ot),this._segList.addPt(St)}},qn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},qn.prototype.addMitreJoin=function(n,i,s,l){var h=!0,v=null;try{v=me.intersection(i.p0,i.p1,s.p0,s.p1),(l<=0?1:v.distance(n)/Math.abs(l))>this._bufParams.getMitreLimit()&&(h=!1)}catch(S){if(!(S instanceof le))throw S;v=new D(0,0),h=!1}h?this._segList.addPt(v):this.addLimitedMitreJoin(i,s,l,this._bufParams.getMitreLimit())},qn.prototype.addFilletCorner=function(n,i,s,l,h){var v=i.x-n.x,S=i.y-n.y,R=Math.atan2(S,v),V=s.x-n.x,ot=s.y-n.y,St=Math.atan2(ot,V);l===rt.CLOCKWISE?R<=St&&(R+=2*Math.PI):R>=St&&(R-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,R,St,l,h),this._segList.addPt(s)},qn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*qn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Fe.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Fe.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(i&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))},qn.prototype.createSquare=function(n){this._segList.addPt(new D(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new D(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new D(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new D(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},qn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},qn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},qn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},qn.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)},qn.prototype.addLimitedMitreJoin=function(n,i,s,l){var h=this._seg0.p1,v=Ge.angle(h,this._seg0.p0),S=Ge.angleBetweenOriented(this._seg0.p0,h,this._seg1.p1)/2,R=Ge.normalize(v+S),V=Ge.normalize(R+Math.PI),ot=l*s,St=s-ot*Math.abs(Math.sin(S)),bt=h.x+ot*Math.cos(V),Yt=h.y+ot*Math.sin(V),Jt=new D(bt,Yt),se=new ne(h,Jt),_e=se.pointAlongOffset(1,St),Cn=se.pointAlongOffset(1,-St);this._side===Ht.LEFT?(this._segList.addPt(_e),this._segList.addPt(Cn)):(this._segList.addPt(Cn),this._segList.addPt(_e))},qn.prototype.computeOffsetSegment=function(n,i,s,l){var h=i===Ht.LEFT?1:-1,v=n.p1.x-n.p0.x,S=n.p1.y-n.p0.y,R=Math.sqrt(v*v+S*S),V=h*s*v/R,ot=h*s*S/R;l.p0.x=n.p0.x-ot,l.p0.y=n.p0.y+V,l.p1.x=n.p1.x-ot,l.p1.y=n.p1.y+V},qn.prototype.addFilletArc=function(n,i,s,l,h){var v=l===rt.CLOCKWISE?-1:1,S=Math.abs(i-s),R=Math.trunc(S/this._filletAngleQuantum+.5);if(R<1)return null;for(var V=S/R,ot=0,St=new D;ot<S;){var bt=i+v*ot;St.x=n.x+h*Math.cos(bt),St.y=n.y+h*Math.sin(bt),this._segList.addPt(St),ot+=V}},qn.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*qn.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 D((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s);var l=new D((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(l)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},qn.prototype.createCircle=function(n){var i=new D(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},qn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},qn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Gi,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*qn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},qn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Fe.JOIN_BEVEL||this._bufParams.getJoinStyle()===Fe.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,rt.CLOCKWISE,this._distance))},qn.prototype.closeRing=function(){this._segList.closeRing()},qn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn},ds.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},ds.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},ds.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},ds.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(qn,ds);var hi=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};hi.prototype.getOffsetCurve=function(n,i){if(this._distance=i,i===0)return null;var s=i<0,l=Math.abs(i),h=this.getSegGen(l);n.length<=1?this.computePointCurve(n[0],h):this.computeOffsetCurve(n,s,h);var v=h.getCoordinates();return s&&at.reverse(v),v},hi.prototype.computeSingleSidedBufferCurve=function(n,i,s){var l=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var h=gr.simplify(n,-l),v=h.length-1;s.initSideSegments(h[v],h[v-1],Ht.LEFT),s.addFirstSegment();for(var S=v-2;S>=0;S--)s.addNextSegment(h[S],!0)}else{s.addSegments(n,!1);var R=gr.simplify(n,l),V=R.length-1;s.initSideSegments(R[0],R[1],Ht.LEFT),s.addFirstSegment();for(var ot=2;ot<=V;ot++)s.addNextSegment(R[ot],!0)}s.addLastSegment(),s.closeRing()},hi.prototype.computeRingBufferCurve=function(n,i,s){var l=this.simplifyTolerance(this._distance);i===Ht.RIGHT&&(l=-l);var h=gr.simplify(n,l),v=h.length-1;s.initSideSegments(h[v-1],h[0],i);for(var S=1;S<=v;S++){var R=S!==1;s.addNextSegment(h[S],R)}s.closeRing()},hi.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),l=gr.simplify(n,s),h=l.length-1;i.initSideSegments(l[0],l[1],Ht.LEFT);for(var v=2;v<=h;v++)i.addNextSegment(l[v],!0);i.addLastSegment(),i.addLineEndCap(l[h-1],l[h]);var S=gr.simplify(n,-s),R=S.length-1;i.initSideSegments(S[R],S[R-1],Ht.LEFT);for(var V=R-2;V>=0;V--)i.addNextSegment(S[V],!0);i.addLastSegment(),i.addLineEndCap(S[1],S[0]),i.closeRing()},hi.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case Fe.CAP_ROUND:i.createCircle(n);break;case Fe.CAP_SQUARE:i.createSquare(n)}},hi.prototype.getLineCurve=function(n,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var s=Math.abs(i),l=this.getSegGen(s);if(n.length<=1)this.computePointCurve(n[0],l);else if(this._bufParams.isSingleSided()){var h=i<0;this.computeSingleSidedBufferCurve(n,h,l)}else this.computeLineBufferCurve(n,l);return l.getCoordinates()},hi.prototype.getBufferParameters=function(){return this._bufParams},hi.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},hi.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return hi.copyCoordinates(n);var l=this.getSegGen(s);return this.computeRingBufferCurve(n,i,l),l.getCoordinates()},hi.prototype.computeOffsetCurve=function(n,i,s){var l=this.simplifyTolerance(this._distance);if(i){var h=gr.simplify(n,-l),v=h.length-1;s.initSideSegments(h[v],h[v-1],Ht.LEFT),s.addFirstSegment();for(var S=v-2;S>=0;S--)s.addNextSegment(h[S],!0)}else{var R=gr.simplify(n,l),V=R.length-1;s.initSideSegments(R[0],R[1],Ht.LEFT),s.addFirstSegment();for(var ot=2;ot<=V;ot++)s.addNextSegment(R[ot],!0)}s.addLastSegment()},hi.prototype.getSegGen=function(n){return new qn(this._precisionModel,this._bufParams,n)},hi.prototype.interfaces_=function(){return[]},hi.prototype.getClass=function(){return hi},hi.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new D(n[s]);return i};var Qs=function(){this._subgraphs=null,this._seg=new ne,this._cga=new rt;var n=arguments[0];this._subgraphs=n},Rc={DepthSegment:{configurable:!0}};Qs.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new nt,s=this._subgraphs.iterator();s.hasNext();){var l=s.next(),h=l.getEnvelope();n.y<h.getMinY()||n.y>h.getMaxY()||this.findStabbedSegments(n,l.getDirectedEdges(),i)}return i}if(arguments.length===3){if(et(arguments[2],ut)&&arguments[0]instanceof D&&arguments[1]instanceof Cc){for(var v=arguments[0],S=arguments[1],R=arguments[2],V=S.getEdge().getCoordinates(),ot=0;ot<V.length-1;ot++)if(this._seg.p0=V[ot],this._seg.p1=V[ot+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<v.x)&&!(this._seg.isHorizontal()||v.y<this._seg.p0.y||v.y>this._seg.p1.y||rt.computeOrientation(this._seg.p0,this._seg.p1,v)===rt.RIGHT)){var St=S.getDepth(Ht.LEFT);this._seg.p0.equals(V[ot])||(St=S.getDepth(Ht.RIGHT));var bt=new gs(this._seg,St);R.add(bt)}}else if(et(arguments[2],ut)&&arguments[0]instanceof D&&et(arguments[1],ut))for(var Yt=arguments[0],Jt=arguments[1],se=arguments[2],_e=Jt.iterator();_e.hasNext();){var Cn=_e.next();Cn.isForward()&&this.findStabbedSegments(Yt,Cn,se)}}},Qs.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:uo.min(i)._leftDepth},Qs.prototype.interfaces_=function(){return[]},Qs.prototype.getClass=function(){return Qs},Rc.DepthSegment.get=function(){return gs},Object.defineProperties(Qs,Rc);var gs=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new ne(n),this._leftDepth=i};gs.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)},gs.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},gs.prototype.toString=function(){return this._upwardSeg.toString()},gs.prototype.interfaces_=function(){return[z]},gs.prototype.getClass=function(){return gs};var We=function(n,i,s){this.p0=n||null,this.p1=i||null,this.p2=s||null};We.prototype.area=function(){return We.area(this.p0,this.p1,this.p2)},We.prototype.signedArea=function(){return We.signedArea(this.p0,this.p1,this.p2)},We.prototype.interpolateZ=function(n){if(n===null)throw new N("Supplied point is null.");return We.interpolateZ(n,this.p0,this.p1,this.p2)},We.prototype.longestSideLength=function(){return We.longestSideLength(this.p0,this.p1,this.p2)},We.prototype.isAcute=function(){return We.isAcute(this.p0,this.p1,this.p2)},We.prototype.circumcentre=function(){return We.circumcentre(this.p0,this.p1,this.p2)},We.prototype.area3D=function(){return We.area3D(this.p0,this.p1,this.p2)},We.prototype.centroid=function(){return We.centroid(this.p0,this.p1,this.p2)},We.prototype.inCentre=function(){return We.inCentre(this.p0,this.p1,this.p2)},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We},We.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)},We.signedArea=function(n,i,s){return((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2},We.det=function(n,i,s,l){return n*l-i*s},We.interpolateZ=function(n,i,s,l){var h=i.x,v=i.y,S=s.x-h,R=l.x-h,V=s.y-v,ot=l.y-v,St=S*ot-R*V,bt=n.x-h,Yt=n.y-v,Jt=(ot*bt-R*Yt)/St,se=(-V*bt+S*Yt)/St;return i.z+Jt*(s.z-i.z)+se*(l.z-i.z)},We.longestSideLength=function(n,i,s){var l=n.distance(i),h=i.distance(s),v=s.distance(n),S=l;return h>S&&(S=h),v>S&&(S=v),S},We.isAcute=function(n,i,s){return!!Ge.isAcute(n,i,s)&&!!Ge.isAcute(i,s,n)&&!!Ge.isAcute(s,n,i)},We.circumcentre=function(n,i,s){var l=s.x,h=s.y,v=n.x-l,S=n.y-h,R=i.x-l,V=i.y-h,ot=2*We.det(v,S,R,V),St=We.det(S,v*v+S*S,V,R*R+V*V),bt=We.det(v,v*v+S*S,R,R*R+V*V);return new D(l-St/ot,h+bt/ot)},We.perpendicularBisector=function(n,i){var s=i.x-n.x,l=i.y-n.y,h=new me(n.x+s/2,n.y+l/2,1),v=new me(n.x-l+s/2,n.y+s+l/2,1);return new me(h,v)},We.angleBisector=function(n,i,s){var l=i.distance(n),h=l/(l+i.distance(s)),v=s.x-n.x,S=s.y-n.y;return new D(n.x+h*v,n.y+h*S)},We.area3D=function(n,i,s){var l=i.x-n.x,h=i.y-n.y,v=i.z-n.z,S=s.x-n.x,R=s.y-n.y,V=s.z-n.z,ot=h*V-v*R,St=v*S-l*V,bt=l*R-h*S,Yt=ot*ot+St*St+bt*bt,Jt=Math.sqrt(Yt)/2;return Jt},We.centroid=function(n,i,s){var l=(n.x+i.x+s.x)/3,h=(n.y+i.y+s.y)/3;return new D(l,h)},We.inCentre=function(n,i,s){var l=i.distance(s),h=n.distance(s),v=n.distance(i),S=l+h+v,R=(l*n.x+h*i.x+v*s.x)/S,V=(l*n.y+h*i.y+v*s.y)/S;return new D(R,V)};var ki=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new nt;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};ki.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,Z.EXTERIOR,Z.INTERIOR)},ki.prototype.addPolygon=function(n){var i=this._distance,s=Ht.LEFT;this._distance<0&&(i=-this._distance,s=Ht.RIGHT);var l=n.getExteriorRing(),h=at.removeRepeatedPoints(l.getCoordinates());if(this._distance<0&&this.isErodedCompletely(l,this._distance)||this._distance<=0&&h.length<3)return null;this.addPolygonRing(h,i,s,Z.EXTERIOR,Z.INTERIOR);for(var v=0;v<n.getNumInteriorRing();v++){var S=n.getInteriorRingN(v),R=at.removeRepeatedPoints(S.getCoordinates());this._distance>0&&this.isErodedCompletely(S,-this._distance)||this.addPolygonRing(R,i,Ht.opposite(s),Z.INTERIOR,Z.EXTERIOR)}},ki.prototype.isTriangleErodedCompletely=function(n,i){var s=new We(n[0],n[1],n[2]),l=s.inCentre();return rt.distancePointLine(l,s.p0,s.p1)<Math.abs(i)},ki.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=at.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,Z.EXTERIOR,Z.INTERIOR)},ki.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var l=new dr(n,new An(0,Z.BOUNDARY,i,s));this._curveList.add(l)},ki.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},ki.prototype.addPolygonRing=function(n,i,s,l,h){if(i===0&&n.length<Tn.MINIMUM_VALID_SIZE)return null;var v=l,S=h;n.length>=Tn.MINIMUM_VALID_SIZE&&rt.isCCW(n)&&(v=h,S=l,s=Ht.opposite(s));var R=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(R,v,S)},ki.prototype.add=function(n){if(n.isEmpty())return null;n instanceof pe?this.addPolygon(n):n instanceof jt?this.addLineString(n):n instanceof ge?this.addPoint(n):n instanceof Oe?this.addCollection(n):n instanceof K?this.addCollection(n):n instanceof Bn?this.addCollection(n):n instanceof Zn&&this.addCollection(n)},ki.prototype.isErodedCompletely=function(n,i){var s=n.getCoordinates();if(s.length<4)return i<0;if(s.length===4)return this.isTriangleErodedCompletely(s,i);var l=n.getEnvelopeInternal(),h=Math.min(l.getHeight(),l.getWidth());return i<0&&2*Math.abs(i)>h},ki.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},ki.prototype.interfaces_=function(){return[]},ki.prototype.getClass=function(){return ki};var eu=function(){};eu.prototype.locate=function(n){},eu.prototype.interfaces_=function(){return[]},eu.prototype.getClass=function(){return eu};var co=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()};co.prototype.next=function(){if(this._atStart)return this._atStart=!1,co.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 Zn?(this._subcollectionIterator=new co(n),this._subcollectionIterator.next()):n},co.prototype.remove=function(){throw new Error(this.getClass().getName())},co.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)},co.prototype.interfaces_=function(){return[k]},co.prototype.getClass=function(){return co},co.isAtomic=function(n){return!(n instanceof Zn)};var pi=function(){this._geom=null;var n=arguments[0];this._geom=n};pi.prototype.locate=function(n){return pi.locate(n,this._geom)},pi.prototype.interfaces_=function(){return[eu]},pi.prototype.getClass=function(){return pi},pi.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&rt.isPointInRing(n,i.getCoordinates())},pi.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!pi.isPointInRing(n,s))return!1;for(var l=0;l<i.getNumInteriorRing();l++){var h=i.getInteriorRingN(l);if(pi.isPointInRing(n,h))return!1}return!0},pi.containsPoint=function(n,i){if(i instanceof pe)return pi.containsPointInPolygon(n,i);if(i instanceof Zn)for(var s=new co(i);s.hasNext();){var l=s.next();if(l!==i&&pi.containsPoint(n,l))return!0}return!1},pi.locate=function(n,i){return i.isEmpty()?Z.EXTERIOR:pi.containsPoint(n,i)?Z.INTERIOR:Z.EXTERIOR};var jr=function(){this._edgeMap=new w,this._edgeList=null,this._ptInAreaLocation=[Z.NONE,Z.NONE]};jr.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)},jr.prototype.propagateSideLabels=function(n){for(var i=Z.NONE,s=this.iterator();s.hasNext();){var l=s.next().getLabel();l.isArea(n)&&l.getLocation(n,Ht.LEFT)!==Z.NONE&&(i=l.getLocation(n,Ht.LEFT))}if(i===Z.NONE)return null;for(var h=i,v=this.iterator();v.hasNext();){var S=v.next(),R=S.getLabel();if(R.getLocation(n,Ht.ON)===Z.NONE&&R.setLocation(n,Ht.ON,h),R.isArea(n)){var V=R.getLocation(n,Ht.LEFT),ot=R.getLocation(n,Ht.RIGHT);if(ot!==Z.NONE){if(ot!==h)throw new Zo("side location conflict",S.getCoordinate());V===Z.NONE&&kt.shouldNeverReachHere("found single null side (at "+S.getCoordinate()+")"),h=V}else kt.isTrue(R.getLocation(n,Ht.LEFT)===Z.NONE,"found single null side"),R.setLocation(n,Ht.RIGHT,h),R.setLocation(n,Ht.LEFT,h)}}},jr.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},jr.prototype.print=function(n){Qt.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},jr.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},jr.prototype.checkAreaLabelsConsistent=function(n){var i=this.getEdges();if(i.size()<=0)return!0;var s=i.size()-1,l=i.get(s).getLabel().getLocation(n,Ht.LEFT);kt.isTrue(l!==Z.NONE,"Found unlabelled area edge");for(var h=l,v=this.iterator();v.hasNext();){var S=v.next().getLabel();kt.isTrue(S.isArea(n),"Found non-area edge");var R=S.getLocation(n,Ht.LEFT),V=S.getLocation(n,Ht.RIGHT);if(R===V||V!==h)return!1;h=R}return!0},jr.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},jr.prototype.iterator=function(){return this.getEdges().iterator()},jr.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new nt(this._edgeMap.values())),this._edgeList},jr.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===Z.NONE&&(this._ptInAreaLocation[n]=pi.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},jr.prototype.toString=function(){var n=new Pt;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(\`
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 Hr="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 Wr={texture_url:Hr,lineWidth:8,color:16777215},Ge=class extends L.Object3D{constructor(t,n){super();this.navigation=t;this.config=Object.assign({},Wr,n),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom,this.setDepthTest(this.getDepthTestByControl())}mesh=null;geometry=null;material=null;texture=null;config=Wr;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 L.Vector3(l,u,0),n,r,i)).map(({x:l,y:u})=>[l,u]);return st(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new L.Vector2(t,1)}loadTexture(t){return new Promise((n,r)=>{new L.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 Q;if(this.updatePoints(t),!this.texture){let o=this.texture=await this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=L.RepeatWrapping}let r=this.material=new ye({useMap:!0,color:new L.Color(this.config.color),transparent:!0,resolution:new L.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:L.NormalBlending,repeat:new L.Vector2(this.getRepeat(),1)}),i=this.mesh=new L.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 Xr=require("three");var qr=require("@tweenjs/tween.js"),ki={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},ze=class extends Xr.EventDispatcher{constructor(t,n){super();this.navigation=t;this.options=Object.assign({},ki,n),this.registryEvent()}offset=!1;reset=!1;position=[0,0];routeIndex=0;pointIndex=0;paths=[];options;timer=new N;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),this.emitNavigationStatus()};onUpdate=()=>{this.tweenUtil.update()};resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,n){let{curRoutePathPoints: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,W,$,Tt)=>{if(!Tt[$+1])return T;let{distance:Kt,closestPoint:$e}=cn(n,W,Tt[$+1]);return Kt<T.distance?{distance:Kt,closestPoint:$e,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(!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.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=this.simulationTween=new qr.Tween({distance:0},this.tweenUtil.group).to({distance:o},a*1e3).onUpdate(u=>{let c=ee(i,u.distance);c&&(n.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))}).onComplete(()=>{this.tweenUtil.remove(l),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))}).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 st(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 null;let l=D(r,o);return t===0&&D(i,r)<5?{dir:"start",distance:l}:a?{dir:Me(i,o,a),distance:l}:{dir:"end",distance:l}}getNavigationInfo(){let{total:t,curRoute:n}=this.getRemainDistance(),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 Vi={path:{},cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},positionNavigation:{},offsetY:150,directionEmitThreshold:5,disablePathAnimation:!1,speed:1},Pn=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;animationPathOptions={cPathIndex:0};cPath=[];positionNavigation;pathMoving=!1;nextPoint=null;constructor(e,t={},n){super(e),!n&&typeof t=="object"&&(n=t),this.options=Object.assign({},Vi,n);let{apiDomain:r,apiPath:{roadNetwork:i},apiInfo:o}=this.bmap.config;this.positionNavigation=new ze(this,{simulationSpeed:this.options.speed,...this.options.positionNavigation}),this.registryEvent()}get curFloorPathLength(){return this.curFloorPath?.distance??0}get curFloorPathPoints(){return this.curFloorPath?.points??[]}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor),this.positionNavigation.addEventListener("navigation-info",this.onNavigationInfo)}onNavigationInfo=({info:e})=>{if(this.dispatchEvent({type:"navigation-info",info:e}),!e.offset){if(e.routeIndex!==this.curPathIndex)return;this.pathMoving?this.nextPoint=e.pos:(this.toPositionBySpeed(e.pos,this.options.speed).then(()=>{this.pathMoving=!1}),this.nextPoint=null)}};pauseAnimation(){this.tweenUtil.pause(),this.positionNavigation.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue(),this.positionNavigation.tweenUtil.continue()}clearTween(){this.tweenUtil.clear(),this.pathMoving=!1}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.pathMoving=!1}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.nextPoint=null,this.pathMoving=!1,this.paths[this.curPathIndex]){let t=this.paths[this.curPathIndex];this.setCurFloorPath(t??null),t?this.renderPath(this.translatePoints(t.points)):this.clearPath()}else this.clearPath()};addPath(e,t=0){this.paths=e,this.curPathIndex=t,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 Ge(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 un(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 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()=>{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()})}async initNavigationCamera(e=1e3){this.clearTween(),this.bmap.context.control.clearTween(),await this.initCameraZoom(e/2),await this.changeCameraToPathUp(e/4),await this.translateCameraToStartPoi(e/4),this.nextPoint&&this.toPositionBySpeed(this.nextPoint,this.options.speed)}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(!(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,0,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(0,p.y,0))}return ht(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)}}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)}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=pn(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(),this.pathMoving=!0,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(()=>{if(this.tweenUtil.remove(h),this.nextPoint){let p=this.nextPoint;this.nextPoint=null,c(this.toPositionBySpeed(p,this.options.speed))}else c(!0)}).start()})}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 jr=require("three"),An=class extends dt{poiLayer;floors=[];group=new jr.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 Yr=require("three");function ve(s){let e=new Blob([s],{type:"text/javascript"}),t=URL.createObjectURL(e),n=new Worker(t);return URL.revokeObjectURL(t),n}function In(){return ve(`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
+ \`);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&&lt?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&&lt)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":\`
107
+ \`}[n]};var me=function n(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],l=arguments[1];this.x=s,this.y=l,this.w=1}else if(arguments[0]instanceof n&&arguments[1]instanceof n){var h=arguments[0],v=arguments[1];this.x=h.y*v.w-v.y*h.w,this.y=v.x*h.w-h.x*v.w,this.w=h.x*v.y-v.x*h.y}else if(arguments[0]instanceof D&&arguments[1]instanceof D){var S=arguments[0],R=arguments[1];this.x=S.y-R.y,this.y=R.x-S.x,this.w=S.x*R.y-R.x*S.y}}else if(arguments.length===3){var V=arguments[0],ot=arguments[1],St=arguments[2];this.x=V,this.y=ot,this.w=St}else if(arguments.length===4){var bt=arguments[0],Yt=arguments[1],Jt=arguments[2],se=arguments[3],_e=bt.y-Yt.y,Cn=Yt.x-bt.x,Xn=bt.x*Yt.y-Yt.x*bt.y,ui=Jt.y-se.y,rs=se.x-Jt.x,Fs=Jt.x*se.y-se.x*Jt.y;this.x=Cn*Fs-rs*Xn,this.y=ui*Xn-_e*Fs,this.w=_e*rs-ui*Cn}};me.prototype.getY=function(){var n=this.y/this.w;if(A.isNaN(n)||A.isInfinite(n))throw new le;return n},me.prototype.getX=function(){var n=this.x/this.w;if(A.isNaN(n)||A.isInfinite(n))throw new le;return n},me.prototype.getCoordinate=function(){var n=new D;return n.x=this.getX(),n.y=this.getY(),n},me.prototype.interfaces_=function(){return[]},me.prototype.getClass=function(){return me},me.intersection=function(n,i,s,l){var h=n.y-i.y,v=i.x-n.x,S=n.x*i.y-i.x*n.y,R=s.y-l.y,V=l.x-s.x,ot=s.x*l.y-l.x*s.y,St=h*V-R*v,bt=(v*ot-V*S)/St,Yt=(R*S-h*ot)/St;if(A.isNaN(bt)||A.isInfinite(bt)||A.isNaN(Yt)||A.isInfinite(Yt))throw new le;return new D(bt,Yt)};var Xt=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 D){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.init(l.x,h.x,l.y,h.y)}else if(arguments.length===4){var v=arguments[0],S=arguments[1],R=arguments[2],V=arguments[3];this.init(v,S,R,V)}},Ee={serialVersionUID:{configurable:!0}};Xt.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Xt.prototype.equals=function(n){if(!(n instanceof Xt))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()},Xt.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new Xt;var i=this._minx>n._minx?this._minx:n._minx,s=this._miny>n._miny?this._miny:n._miny,l=this._maxx<n._maxx?this._maxx:n._maxx,h=this._maxy<n._maxy?this._maxy:n._maxy;return new Xt(i,l,s,h)},Xt.prototype.isNull=function(){return this._maxx<this._minx},Xt.prototype.getMaxX=function(){return this._maxx},Xt.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof D){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof Xt){var i=arguments[0];return!this.isNull()&&!i.isNull()&&i.getMinX()>=this._minx&&i.getMaxX()<=this._maxx&&i.getMinY()>=this._miny&&i.getMaxY()<=this._maxy}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return!this.isNull()&&s>=this._minx&&s<=this._maxx&&l>=this._miny&&l<=this._maxy}},Xt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Xt){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 D){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||l>this._maxy||l<this._miny)}},Xt.prototype.getMinY=function(){return this._miny},Xt.prototype.getMinX=function(){return this._minx},Xt.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof D){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof Xt){var i=arguments[0];if(i.isNull())return null;this.isNull()?(this._minx=i.getMinX(),this._maxx=i.getMaxX(),this._miny=i.getMinY(),this._maxy=i.getMaxY()):(i._minx<this._minx&&(this._minx=i._minx),i._maxx>this._maxx&&(this._maxx=i._maxx),i._miny<this._miny&&(this._miny=i._miny),i._maxy>this._maxy&&(this._maxy=i._maxy))}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.isNull()?(this._minx=s,this._maxx=s,this._miny=l,this._maxy=l):(s<this._minx&&(this._minx=s),s>this._maxx&&(this._maxx=s),l<this._miny&&(this._miny=l),l>this._maxy&&(this._maxy=l))}},Xt.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},Xt.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Xt.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},Xt.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},Xt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Xt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Xt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Xt.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},Xt.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()}},Xt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Xt){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof D){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return this.covers(s,l)}},Xt.prototype.centre=function(){return this.isNull()?null:new D((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Xt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof D){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof Xt){var i=arguments[0];this._minx=i._minx,this._maxx=i._maxx,this._miny=i._miny,this._maxy=i._maxy}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.init(s.x,l.x,s.y,l.y)}else if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3];h<v?(this._minx=h,this._maxx=v):(this._minx=v,this._maxx=h),S<R?(this._miny=S,this._maxy=R):(this._miny=R,this._maxy=S)}},Xt.prototype.getMaxY=function(){return this._maxy},Xt.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)},Xt.prototype.hashCode=function(){var n=17;return n=37*n+D.hashCode(this._minx),n=37*n+D.hashCode(this._maxx),n=37*n+D.hashCode(this._miny),n=37*n+D.hashCode(this._maxy)},Xt.prototype.interfaces_=function(){return[z,t]},Xt.prototype.getClass=function(){return Xt},Xt.intersects=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];return s.x>=(n.x<i.x?n.x:i.x)&&s.x<=(n.x>i.x?n.x:i.x)&&s.y>=(n.y<i.y?n.y:i.y)&&s.y<=(n.y>i.y?n.y:i.y)}if(arguments.length===4){var l=arguments[0],h=arguments[1],v=arguments[2],S=arguments[3],R=Math.min(v.x,S.x),V=Math.max(v.x,S.x),ot=Math.min(l.x,h.x),St=Math.max(l.x,h.x);return!(ot>V)&&!(St<R)&&(R=Math.min(v.y,S.y),V=Math.max(v.y,S.y),ot=Math.min(l.y,h.y),St=Math.max(l.y,h.y),!(ot>V)&&!(St<R))}},Ee.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Xt,Ee);var ft={typeStr:/^\\s*(\\w+)\\s*\\(\\s*(.*)\\s*\\)\\s*$/,emptyTypeStr:/^\\s*(\\w+)\\s*EMPTY\\s*$/,spaces:/\\s+/,parenComma:/\\)\\s*,\\s*\\(/,doubleParenComma:/\\)\\s*\\)\\s*,\\s*\\(\\s*\\(/,trimParens:/^\\s*\\(?(.*?)\\)?\\s*$/},He=function(n){this.geometryFactory=n||new Ce};He.prototype.read=function(n){var i,s,l;n=n.replace(/[\\n\\r]/g," ");var h=ft.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((h=ft.emptyTypeStr.exec(n))[2]=void 0),h&&(s=h[1].toLowerCase(),l=h[2],fe[s]&&(i=fe[s].apply(this,[l]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},He.prototype.write=function(n){return this.extractGeometry(n)},He.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!te[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+te[i].apply(this,[n])+")"};var te={coordinate:function(n){return n.x+" "+n.y},point:function(n){return te.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push("("+te.point.apply(this,[n._geometries[s]])+")");return i.join(",")},linestring:function(n){for(var i=[],s=0,l=n._points._coordinates.length;s<l;++s)i.push(te.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},linearring:function(n){for(var i=[],s=0,l=n._points._coordinates.length;s<l;++s)i.push(te.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},multilinestring:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push("("+te.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+te.linestring.apply(this,[n._shell])+")");for(var s=0,l=n._holes.length;s<l;++s)i.push("("+te.linestring.apply(this,[n._holes[s]])+")");return i.join(",")},multipolygon:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push("("+te.polygon.apply(this,[n._geometries[s]])+")");return i.join(",")},geometrycollection:function(n){for(var i=[],s=0,l=n._geometries.length;s<l;++s)i.push(this.extractGeometry(n._geometries[s]));return i.join(",")}},fe={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(ft.spaces);return this.geometryFactory.createPoint(new D(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(n){if(n===void 0)return this.geometryFactory.createMultiPoint();for(var i,s=n.trim().split(","),l=[],h=0,v=s.length;h<v;++h)i=s[h].replace(ft.trimParens,"$1"),l.push(fe.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(l)},linestring:function(n){if(n===void 0)return this.geometryFactory.createLineString();for(var i,s=n.trim().split(","),l=[],h=0,v=s.length;h<v;++h)i=s[h].trim().split(ft.spaces),l.push(new D(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(l)},linearring:function(n){if(n===void 0)return this.geometryFactory.createLinearRing();for(var i,s=n.trim().split(","),l=[],h=0,v=s.length;h<v;++h)i=s[h].trim().split(ft.spaces),l.push(new D(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(l)},multilinestring:function(n){if(n===void 0)return this.geometryFactory.createMultiLineString();for(var i,s=n.trim().split(ft.parenComma),l=[],h=0,v=s.length;h<v;++h)i=s[h].replace(ft.trimParens,"$1"),l.push(fe.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(l)},polygon:function(n){if(n===void 0)return this.geometryFactory.createPolygon();for(var i,s,l,h,v=n.trim().split(ft.parenComma),S=[],R=0,V=v.length;R<V;++R)i=v[R].replace(ft.trimParens,"$1"),s=fe.linestring.apply(this,[i]),l=this.geometryFactory.createLinearRing(s._points),R===0?h=l:S.push(l);return this.geometryFactory.createPolygon(h,S)},multipolygon:function(n){if(n===void 0)return this.geometryFactory.createMultiPolygon();for(var i,s=n.trim().split(ft.doubleParenComma),l=[],h=0,v=s.length;h<v;++h)i=s[h].replace(ft.trimParens,"$1"),l.push(fe.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(l)},geometrycollection:function(n){if(n===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(n=n.replace(/,\\s*([A-Za-z])/g,"|$1")).trim().split("|"),s=[],l=0,h=i.length;l<h;++l)s.push(this.read(i[l]));return this.geometryFactory.createGeometryCollection(s)}},de=function(n){this.parser=new He(n)};de.prototype.write=function(n){return this.parser.write(n)},de.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var Ue=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),be=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}(Ue),kt=function(){};kt.prototype.interfaces_=function(){return[]},kt.prototype.getClass=function(){return kt},kt.shouldNeverReachHere=function(){if(arguments.length===0)kt.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new be("Should never reach here"+(n!==null?": "+n:""))}},kt.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],kt.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new be:new be(i)},kt.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],kt.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new be("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var ye=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 D,this._intPt[1]=new D,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},Vn={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};ye.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},ye.prototype.getTopologySummary=function(){var n=new Pt;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},ye.prototype.computeIntersection=function(n,i,s,l){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=s,this._inputLines[1][1]=l,this._result=this.computeIntersect(n,i,s,l)},ye.prototype.getIntersectionNum=function(){return this._result},ye.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)}},ye.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},ye.prototype.setPrecisionModel=function(n){this._precisionModel=n},ye.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}},ye.prototype.getIntersection=function(n){return this._intPt[n]},ye.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},ye.prototype.hasIntersection=function(){return this._result!==ye.NO_INTERSECTION},ye.prototype.getEdgeDistance=function(n,i){return ye.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},ye.prototype.isCollinear=function(){return this._result===ye.COLLINEAR_INTERSECTION},ye.prototype.toString=function(){return de.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+de.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},ye.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},ye.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},ye.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},ye.prototype.interfaces_=function(){return[]},ye.prototype.getClass=function(){return ye},ye.computeEdgeDistance=function(n,i,s){var l=Math.abs(s.x-i.x),h=Math.abs(s.y-i.y),v=-1;if(n.equals(i))v=0;else if(n.equals(s))v=l>h?l:h;else{var S=Math.abs(n.x-i.x),R=Math.abs(n.y-i.y);(v=l>h?S:R)!==0||n.equals(i)||(v=Math.max(S,R))}return kt.isTrue(!(v===0&&!n.equals(i)),"Bad distance calculation"),v},ye.nonRobustComputeEdgeDistance=function(n,i,s){var l=n.x-i.x,h=n.y-i.y,v=Math.sqrt(l*l+h*h);return kt.isTrue(!(v===0&&!n.equals(i)),"Invalid distance calculation"),v},Vn.DONT_INTERSECT.get=function(){return 0},Vn.DO_INTERSECT.get=function(){return 1},Vn.COLLINEAR.get=function(){return 2},Vn.NO_INTERSECTION.get=function(){return 0},Vn.POINT_INTERSECTION.get=function(){return 1},Vn.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(ye,Vn);var $n=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(s){var l=new Xt(this._inputLines[0][0],this._inputLines[0][1]),h=new Xt(this._inputLines[1][0],this._inputLines[1][1]);return l.contains(s)&&h.contains(s)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return n.prototype.computeIntersection.apply(this,arguments);var s=arguments[0],l=arguments[1],h=arguments[2];if(this._isProper=!1,Xt.intersects(l,h,s)&&rt.orientationIndex(l,h,s)===0&&rt.orientationIndex(h,l,s)===0)return this._isProper=!0,(s.equals(l)||s.equals(h))&&(this._isProper=!1),this._result=n.POINT_INTERSECTION,null;this._result=n.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(s,l,h,v,S){S.x=this.smallestInAbsValue(s.x,l.x,h.x,v.x),S.y=this.smallestInAbsValue(s.y,l.y,h.y,v.y),s.x-=S.x,s.y-=S.y,l.x-=S.x,l.y-=S.y,h.x-=S.x,h.y-=S.y,v.x-=S.x,v.y-=S.y},i.prototype.safeHCoordinateIntersection=function(s,l,h,v){var S=null;try{S=me.intersection(s,l,h,v)}catch(R){if(!(R instanceof le))throw R;S=i.nearestEndpoint(s,l,h,v)}return S},i.prototype.intersection=function(s,l,h,v){var S=this.intersectionWithNormalization(s,l,h,v);return this.isInSegmentEnvelopes(S)||(S=new D(i.nearestEndpoint(s,l,h,v))),this._precisionModel!==null&&this._precisionModel.makePrecise(S),S},i.prototype.smallestInAbsValue=function(s,l,h,v){var S=s,R=Math.abs(S);return Math.abs(l)<R&&(S=l,R=Math.abs(l)),Math.abs(h)<R&&(S=h,R=Math.abs(h)),Math.abs(v)<R&&(S=v),S},i.prototype.checkDD=function(s,l,h,v,S){var R=Mt.intersection(s,l,h,v),V=this.isInSegmentEnvelopes(R);Qt.out.println("DD in env = "+V+" --------------------- "+R),S.distance(R)>1e-4&&Qt.out.println("Distance = "+S.distance(R))},i.prototype.intersectionWithNormalization=function(s,l,h,v){var S=new D(s),R=new D(l),V=new D(h),ot=new D(v),St=new D;this.normalizeToEnvCentre(S,R,V,ot,St);var bt=this.safeHCoordinateIntersection(S,R,V,ot);return bt.x+=St.x,bt.y+=St.y,bt},i.prototype.computeCollinearIntersection=function(s,l,h,v){var S=Xt.intersects(s,l,h),R=Xt.intersects(s,l,v),V=Xt.intersects(h,v,s),ot=Xt.intersects(h,v,l);return S&&R?(this._intPt[0]=h,this._intPt[1]=v,n.COLLINEAR_INTERSECTION):V&&ot?(this._intPt[0]=s,this._intPt[1]=l,n.COLLINEAR_INTERSECTION):S&&V?(this._intPt[0]=h,this._intPt[1]=s,!h.equals(s)||R||ot?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):S&&ot?(this._intPt[0]=h,this._intPt[1]=l,!h.equals(l)||R||V?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):R&&V?(this._intPt[0]=v,this._intPt[1]=s,!v.equals(s)||S||ot?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):R&&ot?(this._intPt[0]=v,this._intPt[1]=l,!v.equals(l)||S||V?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):n.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(s,l,h,v,S){var R=s.x<l.x?s.x:l.x,V=s.y<l.y?s.y:l.y,ot=s.x>l.x?s.x:l.x,St=s.y>l.y?s.y:l.y,bt=h.x<v.x?h.x:v.x,Yt=h.y<v.y?h.y:v.y,Jt=h.x>v.x?h.x:v.x,se=h.y>v.y?h.y:v.y,_e=((R>bt?R:bt)+(ot<Jt?ot:Jt))/2,Cn=((V>Yt?V:Yt)+(St<se?St:se))/2;S.x=_e,S.y=Cn,s.x-=S.x,s.y-=S.y,l.x-=S.x,l.y-=S.y,h.x-=S.x,h.y-=S.y,v.x-=S.x,v.y-=S.y},i.prototype.computeIntersect=function(s,l,h,v){if(this._isProper=!1,!Xt.intersects(s,l,h,v))return n.NO_INTERSECTION;var S=rt.orientationIndex(s,l,h),R=rt.orientationIndex(s,l,v);if(S>0&&R>0||S<0&&R<0)return n.NO_INTERSECTION;var V=rt.orientationIndex(h,v,s),ot=rt.orientationIndex(h,v,l);return V>0&&ot>0||V<0&&ot<0?n.NO_INTERSECTION:S===0&&R===0&&V===0&&ot===0?this.computeCollinearIntersection(s,l,h,v):(S===0||R===0||V===0||ot===0?(this._isProper=!1,s.equals2D(h)||s.equals2D(v)?this._intPt[0]=s:l.equals2D(h)||l.equals2D(v)?this._intPt[0]=l:S===0?this._intPt[0]=new D(h):R===0?this._intPt[0]=new D(v):V===0?this._intPt[0]=new D(s):ot===0&&(this._intPt[0]=new D(l))):(this._isProper=!0,this._intPt[0]=this.intersection(s,l,h,v)),n.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(s,l,h,v){var S=s,R=rt.distancePointLine(s,h,v),V=rt.distancePointLine(l,h,v);return V<R&&(R=V,S=l),(V=rt.distancePointLine(h,s,l))<R&&(R=V,S=h),(V=rt.distancePointLine(v,s,l))<R&&(R=V,S=v),S},i}(ye),j=function(){};j.prototype.interfaces_=function(){return[]},j.prototype.getClass=function(){return j},j.orientationIndex=function(n,i,s){var l=i.x-n.x,h=i.y-n.y,v=s.x-i.x,S=s.y-i.y;return j.signOfDet2x2(l,h,v,S)},j.signOfDet2x2=function(n,i,s,l){var h=null,v=null,S=null;if(h=1,n===0||l===0)return i===0||s===0?0:i>0?s>0?-h:h:s>0?h:-h;if(i===0||s===0)return l>0?n>0?h:-h:n>0?-h:h;if(i>0?l>0?i<=l||(h=-h,v=n,n=s,s=v,v=i,i=l,l=v):i<=-l?(h=-h,s=-s,l=-l):(v=n,n=-s,s=v,v=i,i=-l,l=v):l>0?-i<=l?(h=-h,n=-n,i=-i):(v=-n,n=s,s=v,v=-i,i=l,l=v):i>=l?(n=-n,i=-i,s=-s,l=-l):(h=-h,v=-n,n=-s,s=v,v=-i,i=-l,l=v),n>0){if(!(s>0)||!(n<=s))return h}else{if(s>0||!(n>=s))return-h;h=-h,n=-n,s=-s}for(;;){if(S=Math.floor(s/n),s-=S*n,(l-=S*i)<0)return-h;if(l>i)return h;if(n>s+s){if(i<l+l)return h}else{if(i>l+l)return-h;s=n-s,l=i-l,h=-h}if(l===0)return s===0?0:-h;if(s===0||(S=Math.floor(n/s),n-=S*s,(i-=S*l)<0))return h;if(i>l)return-h;if(s>n+n){if(l<i+i)return-h}else{if(l>i+i)return h;n=s-n,i=l-i,h=-h}if(i===0)return n===0?0:h;if(n===0)return-h}};var H=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};H.prototype.countSegment=function(n,i){if(n.x<this._p.x&&i.x<this._p.x)return null;if(this._p.x===i.x&&this._p.y===i.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&i.y===this._p.y){var s=n.x,l=i.x;return s>l&&(s=i.x,l=n.x),this._p.x>=s&&this._p.x<=l&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&n.y<=this._p.y){var h=n.x-this._p.x,v=n.y-this._p.y,S=i.x-this._p.x,R=i.y-this._p.y,V=j.signOfDet2x2(h,v,S,R);if(V===0)return this._isPointOnSegment=!0,null;R<v&&(V=-V),V>0&&this._crossingCount++}},H.prototype.isPointInPolygon=function(){return this.getLocation()!==Z.EXTERIOR},H.prototype.getLocation=function(){return this._isPointOnSegment?Z.BOUNDARY:this._crossingCount%2==1?Z.INTERIOR:Z.EXTERIOR},H.prototype.isOnSegment=function(){return this._isPointOnSegment},H.prototype.interfaces_=function(){return[]},H.prototype.getClass=function(){return H},H.locatePointInRing=function(){if(arguments[0]instanceof D&&et(arguments[1],At)){for(var n=arguments[0],i=arguments[1],s=new H(n),l=new D,h=new D,v=1;v<i.size();v++)if(i.getCoordinate(v,l),i.getCoordinate(v-1,h),s.countSegment(l,h),s.isOnSegment())return s.getLocation();return s.getLocation()}if(arguments[0]instanceof D&&arguments[1]instanceof Array){for(var S=arguments[0],R=arguments[1],V=new H(S),ot=1;ot<R.length;ot++){var St=R[ot],bt=R[ot-1];if(V.countSegment(St,bt),V.isOnSegment())return V.getLocation()}return V.getLocation()}};var rt=function(){},Wt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};rt.prototype.interfaces_=function(){return[]},rt.prototype.getClass=function(){return rt},rt.orientationIndex=function(n,i,s){return Mt.orientationIndex(n,i,s)},rt.signedArea=function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var i=0,s=n[0].x,l=1;l<n.length-1;l++){var h=n[l].x-s,v=n[l+1].y;i+=h*(n[l-1].y-v)}return i/2}if(et(arguments[0],At)){var S=arguments[0],R=S.size();if(R<3)return 0;var V=new D,ot=new D,St=new D;S.getCoordinate(0,ot),S.getCoordinate(1,St);var bt=ot.x;St.x-=bt;for(var Yt=0,Jt=1;Jt<R-1;Jt++)V.y=ot.y,ot.x=St.x,ot.y=St.y,S.getCoordinate(Jt+1,St),St.x-=bt,Yt+=ot.x*(V.y-St.y);return Yt/2}},rt.distanceLineLine=function(n,i,s,l){if(n.equals(i))return rt.distancePointLine(n,s,l);if(s.equals(l))return rt.distancePointLine(l,n,i);var h=!1;if(Xt.intersects(n,i,s,l)){var v=(i.x-n.x)*(l.y-s.y)-(i.y-n.y)*(l.x-s.x);if(v===0)h=!0;else{var S=(n.y-s.y)*(l.x-s.x)-(n.x-s.x)*(l.y-s.y),R=((n.y-s.y)*(i.x-n.x)-(n.x-s.x)*(i.y-n.y))/v,V=S/v;(V<0||V>1||R<0||R>1)&&(h=!0)}}else h=!0;return h?vt.min(rt.distancePointLine(n,s,l),rt.distancePointLine(i,s,l),rt.distancePointLine(s,n,i),rt.distancePointLine(l,n,i)):0},rt.isPointInRing=function(n,i){return rt.locatePointInRing(n,i)!==Z.EXTERIOR},rt.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,l=new D;n.getCoordinate(0,l);for(var h=l.x,v=l.y,S=1;S<i;S++){n.getCoordinate(S,l);var R=l.x,V=l.y,ot=R-h,St=V-v;s+=Math.sqrt(ot*ot+St*St),h=R,v=V}return s},rt.isCCW=function(n){var i=n.length-1;if(i<3)throw new N("Ring has fewer than 4 points, so orientation cannot be determined");for(var s=n[0],l=0,h=1;h<=i;h++){var v=n[h];v.y>s.y&&(s=v,l=h)}var S=l;do(S-=1)<0&&(S=i);while(n[S].equals2D(s)&&S!==l);var R=l;do R=(R+1)%i;while(n[R].equals2D(s)&&R!==l);var V=n[S],ot=n[R];if(V.equals2D(s)||ot.equals2D(s)||V.equals2D(ot))return!1;var St=rt.computeOrientation(V,s,ot),bt=!1;return bt=St===0?V.x>ot.x:St>0,bt},rt.locatePointInRing=function(n,i){return H.locatePointInRing(n,i)},rt.distancePointLinePerpendicular=function(n,i,s){var l=(s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.y-i.y),h=((i.y-n.y)*(s.x-i.x)-(i.x-n.x)*(s.y-i.y))/l;return Math.abs(h)*Math.sqrt(l)},rt.computeOrientation=function(n,i,s){return rt.orientationIndex(n,i,s)},rt.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new N("Line array must contain at least one vertex");for(var s=n.distance(i[0]),l=0;l<i.length-1;l++){var h=rt.distancePointLine(n,i[l],i[l+1]);h<s&&(s=h)}return s}if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];if(S.x===R.x&&S.y===R.y)return v.distance(S);var V=(R.x-S.x)*(R.x-S.x)+(R.y-S.y)*(R.y-S.y),ot=((v.x-S.x)*(R.x-S.x)+(v.y-S.y)*(R.y-S.y))/V;if(ot<=0)return v.distance(S);if(ot>=1)return v.distance(R);var St=((S.y-v.y)*(R.x-S.x)-(S.x-v.x)*(R.y-S.y))/V;return Math.abs(St)*Math.sqrt(V)}},rt.isOnLine=function(n,i){for(var s=new $n,l=1;l<i.length;l++){var h=i[l-1],v=i[l];if(s.computeIntersection(n,h,v),s.hasIntersection())return!0}return!1},Wt.CLOCKWISE.get=function(){return-1},Wt.RIGHT.get=function(){return rt.CLOCKWISE},Wt.COUNTERCLOCKWISE.get=function(){return 1},Wt.LEFT.get=function(){return rt.COUNTERCLOCKWISE},Wt.COLLINEAR.get=function(){return 0},Wt.STRAIGHT.get=function(){return rt.COLLINEAR},Object.defineProperties(rt,Wt);var Gt=function(){};Gt.prototype.filter=function(n){},Gt.prototype.interfaces_=function(){return[]},Gt.prototype.getClass=function(){return Gt};var Ct=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},he={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}};Ct.prototype.isGeometryCollection=function(){return this.getSortIndex()===Ct.SORTINDEX_GEOMETRYCOLLECTION},Ct.prototype.getFactory=function(){return this._factory},Ct.prototype.getGeometryN=function(n){return this},Ct.prototype.getArea=function(){return 0},Ct.prototype.isRectangle=function(){return!1},Ct.prototype.equals=function(){if(arguments[0]instanceof Ct){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof Ct))return!1;var s=i;return this.equalsExact(s)}},Ct.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},Ct.prototype.geometryChanged=function(){this.apply(Ct.geometryChangedFilter)},Ct.prototype.geometryChangedAction=function(){this._envelope=null},Ct.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},Ct.prototype.getLength=function(){return 0},Ct.prototype.getNumGeometries=function(){return 1},Ct.prototype.compareTo=function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(n)}if(arguments.length===2){var s=arguments[0],l=arguments[1];return this.getSortIndex()!==s.getSortIndex()?this.getSortIndex()-s.getSortIndex():this.isEmpty()&&s.isEmpty()?0:this.isEmpty()?-1:s.isEmpty()?1:this.compareToSameClass(s,l)}},Ct.prototype.getUserData=function(){return this._userData},Ct.prototype.getSRID=function(){return this._SRID},Ct.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Ct.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===Ct.SORTINDEX_GEOMETRYCOLLECTION)throw new N("This method does not support GeometryCollection arguments")},Ct.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},Ct.prototype.norm=function(){var n=this.copy();return n.normalize(),n},Ct.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Ct.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Xt(this._envelope)},Ct.prototype.setSRID=function(n){this._SRID=n},Ct.prototype.setUserData=function(n){this._userData=n},Ct.prototype.compare=function(n,i){for(var s=n.iterator(),l=i.iterator();s.hasNext()&&l.hasNext();){var h=s.next(),v=l.next(),S=h.compareTo(v);if(S!==0)return S}return s.hasNext()?1:l.hasNext()?-1:0},Ct.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Ct.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Ct.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Ct.SORTINDEX_MULTIPOINT||this.getSortIndex()===Ct.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Ct.SORTINDEX_MULTIPOLYGON},Ct.prototype.interfaces_=function(){return[$,z,t]},Ct.prototype.getClass=function(){return Ct},Ct.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},Ct.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},he.serialVersionUID.get=function(){return 8763622679187377e3},he.SORTINDEX_POINT.get=function(){return 0},he.SORTINDEX_MULTIPOINT.get=function(){return 1},he.SORTINDEX_LINESTRING.get=function(){return 2},he.SORTINDEX_LINEARRING.get=function(){return 3},he.SORTINDEX_MULTILINESTRING.get=function(){return 4},he.SORTINDEX_POLYGON.get=function(){return 5},he.SORTINDEX_MULTIPOLYGON.get=function(){return 6},he.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},he.geometryChangedFilter.get=function(){return Kt},Object.defineProperties(Ct,he);var Kt=function(){};Kt.interfaces_=function(){return[Gt]},Kt.filter=function(n){n.geometryChangedAction()};var tt=function(){};tt.prototype.filter=function(n){},tt.prototype.interfaces_=function(){return[]},tt.prototype.getClass=function(){return tt};var C=function(){},L={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}};C.prototype.isInBoundary=function(n){},C.prototype.interfaces_=function(){return[]},C.prototype.getClass=function(){return C},L.Mod2BoundaryNodeRule.get=function(){return F},L.EndPointBoundaryNodeRule.get=function(){return J},L.MultiValentEndPointBoundaryNodeRule.get=function(){return X},L.MonoValentEndPointBoundaryNodeRule.get=function(){return pt},L.MOD2_BOUNDARY_RULE.get=function(){return new F},L.ENDPOINT_BOUNDARY_RULE.get=function(){return new J},L.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new X},L.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new pt},L.OGC_SFS_BOUNDARY_RULE.get=function(){return C.MOD2_BOUNDARY_RULE},Object.defineProperties(C,L);var F=function(){};F.prototype.isInBoundary=function(n){return n%2==1},F.prototype.interfaces_=function(){return[C]},F.prototype.getClass=function(){return F};var J=function(){};J.prototype.isInBoundary=function(n){return n>0},J.prototype.interfaces_=function(){return[C]},J.prototype.getClass=function(){return J};var X=function(){};X.prototype.isInBoundary=function(n){return n>1},X.prototype.interfaces_=function(){return[C]},X.prototype.getClass=function(){return X};var pt=function(){};pt.prototype.isInBoundary=function(n){return n===1},pt.prototype.interfaces_=function(){return[C]},pt.prototype.getClass=function(){return pt};var st=function(){};st.prototype.add=function(){},st.prototype.addAll=function(){},st.prototype.isEmpty=function(){},st.prototype.iterator=function(){},st.prototype.size=function(){},st.prototype.toArray=function(){},st.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var k=function(){};k.prototype.hasNext=function(){},k.prototype.next=function(){},k.prototype.remove=function(){};var ut=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}(st);(o.prototype=new Error).name="NoSuchElementException";var nt=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof st&&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,st]},i.prototype.add=function(s){return arguments.length===1?this.array_.push(s):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(s){for(var l=s.iterator();l.hasNext();)this.add(l.next());return!0},i.prototype.set=function(s,l){var h=this.array_[s];return this.array_[s]=l,h},i.prototype.iterator=function(){return new lt(this)},i.prototype.get=function(s){if(s<0||s>=this.size())throw new e;return this.array_[s]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var s=[],l=0,h=this.array_.length;l<h;l++)s.push(this.array_[l]);return s},i.prototype.remove=function(s){for(var l=!1,h=0,v=this.array_.length;h<v;h++)if(this.array_[h]===s){this.array_.splice(h,1),l=!0;break}return l},i}(ut),lt=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}(k),dt=function(n){function i(){if(n.call(this),arguments.length!==0){if(arguments.length===1){var l=arguments[0];this.ensureCapacity(l.length),this.add(l,!0)}else if(arguments.length===2){var h=arguments[0],v=arguments[1];this.ensureCapacity(h.length),this.add(h,v)}}}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={coordArrayType:{configurable:!0}};return s.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(l){return this.get(l)},i.prototype.addAll=function(){if(arguments.length===2){for(var l=arguments[0],h=arguments[1],v=!1,S=l.iterator();S.hasNext();)this.add(S.next(),h),v=!0;return v}return n.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var l=n.prototype.clone.call(this),h=0;h<this.size();h++)l.add(h,this.get(h).copy());return l},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var l=arguments[0];n.prototype.add.call(this,l)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var h=arguments[0],v=arguments[1];return this.add(h,v,!0),!0}if(arguments[0]instanceof D&&typeof arguments[1]=="boolean"){var S=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(S))return null;n.prototype.add.call(this,S)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var R=arguments[0],V=arguments[1];return this.add(R,V),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var ot=arguments[0],St=arguments[1];if(arguments[2])for(var bt=0;bt<ot.length;bt++)this.add(ot[bt],St);else for(var Yt=ot.length-1;Yt>=0;Yt--)this.add(ot[Yt],St);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof D){var Jt=arguments[0],se=arguments[1];if(!arguments[2]){var _e=this.size();if(_e>0&&(Jt>0&&this.get(Jt-1).equals2D(se)||Jt<_e&&this.get(Jt).equals2D(se)))return null}n.prototype.add.call(this,Jt,se)}}else if(arguments.length===4){var Cn=arguments[0],Xn=arguments[1],ui=arguments[2],rs=arguments[3],Fs=1;ui>rs&&(Fs=-1);for(var Dc=ui;Dc!==rs;Dc+=Fs)this.add(Cn[Dc],Xn);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new D(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(nt),at=function(){},Bt={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Bt.ForwardComparator.get=function(){return qt},Bt.BidirectionalComparator.get=function(){return we},Bt.coordArrayType.get=function(){return new Array(0).fill(null)},at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},at.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var l=n[s];if(at.indexOf(l,i)<0)return l}return null},at.scroll=function(n,i){var s=at.indexOf(i,n);if(s<0)return null;var l=new Array(n.length).fill(null);Qt.arraycopy(n,s,l,0,n.length-s),Qt.arraycopy(n,0,l,n.length-s,s),Qt.arraycopy(l,0,n,0,n.length)},at.equals=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(n===i)return!0;if(n===null||i===null||n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(!n[s].equals(i[s]))return!1;return!0}if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2];if(l===h)return!0;if(l===null||h===null||l.length!==h.length)return!1;for(var S=0;S<l.length;S++)if(v.compare(l[S],h[S])!==0)return!1;return!0}},at.intersection=function(n,i){for(var s=new dt,l=0;l<n.length;l++)i.intersects(n[l])&&s.add(n[l],!0);return s.toCoordinateArray()},at.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},at.removeRepeatedPoints=function(n){return at.hasRepeatedPoints(n)?new dt(n,!1).toCoordinateArray():n},at.reverse=function(n){for(var i=n.length-1,s=Math.trunc(i/2),l=0;l<=s;l++){var h=n[l];n[l]=n[i-l],n[i-l]=h}},at.removeNull=function(n){for(var i=0,s=0;s<n.length;s++)n[s]!==null&&i++;var l=new Array(i).fill(null);if(i===0)return l;for(var h=0,v=0;v<n.length;v++)n[v]!==null&&(l[h++]=n[v]);return l},at.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 D(n[s]);return i}if(arguments.length===5)for(var l=arguments[0],h=arguments[1],v=arguments[2],S=arguments[3],R=arguments[4],V=0;V<R;V++)v[S+V]=new D(l[h+V])},at.isEqualReversed=function(n,i){for(var s=0;s<n.length;s++){var l=n[s],h=i[n.length-s-1];if(l.compareTo(h)!==0)return!1}return!0},at.envelope=function(n){for(var i=new Xt,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},at.toCoordinateArray=function(n){return n.toArray(at.coordArrayType)},at.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},at.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},at.increasingDirection=function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var s=n.length-1-i,l=n[i].compareTo(n[s]);if(l!==0)return l}return 1},at.compare=function(n,i){for(var s=0;s<n.length&&s<i.length;){var l=n[s].compareTo(i[s]);if(l!==0)return l;s++}return s<i.length?-1:s<n.length?1:0},at.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},at.extract=function(n,i,s){i=vt.clamp(i,0,n.length);var l=(s=vt.clamp(s,-1,n.length))-i+1;s<0&&(l=0),i>=n.length&&(l=0),s<i&&(l=0);var h=new Array(l).fill(null);if(l===0)return h;for(var v=0,S=i;S<=s;S++)h[v++]=n[S];return h},Object.defineProperties(at,Bt);var qt=function(){};qt.prototype.compare=function(n,i){return at.compare(n,i)},qt.prototype.interfaces_=function(){return[q]},qt.prototype.getClass=function(){return qt};var we=function(){};we.prototype.compare=function(n,i){var s=n,l=i;if(s.length<l.length)return-1;if(s.length>l.length)return 1;if(s.length===0)return 0;var h=at.compare(s,l);return at.isEqualReversed(s,l)?0:h},we.prototype.OLDcompare=function(n,i){var s=n,l=i;if(s.length<l.length)return-1;if(s.length>l.length)return 1;if(s.length===0)return 0;for(var h=at.increasingDirection(s),v=at.increasingDirection(l),S=h>0?0:s.length-1,R=v>0?0:s.length-1,V=0;V<s.length;V++){var ot=s[S].compareTo(l[R]);if(ot!==0)return ot;S+=h,R+=v}return 0},we.prototype.interfaces_=function(){return[q]},we.prototype.getClass=function(){return we};var oe=function(){};oe.prototype.get=function(){},oe.prototype.put=function(){},oe.prototype.size=function(){},oe.prototype.values=function(){},oe.prototype.entrySet=function(){};var Ve=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}(oe);(a.prototype=new Error).name="OperationNotSupported",(c.prototype=new st).contains=function(){};var je=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof st&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.contains=function(s){for(var l=0,h=this.array_.length;l<h;l++)if(this.array_[l]===s)return!0;return!1},i.prototype.add=function(s){return!this.contains(s)&&(this.array_.push(s),!0)},i.prototype.addAll=function(s){for(var l=s.iterator();l.hasNext();)this.add(l.next());return!0},i.prototype.remove=function(s){throw new Error},i.prototype.size=function(){return this.array_.length},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.toArray=function(){for(var s=[],l=0,h=this.array_.length;l<h;l++)s.push(this.array_[l]);return s},i.prototype.iterator=function(){return new ur(this)},i}(c),ur=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}(k),Qn=0;(w.prototype=new Ve).get=function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return i.value;i=i.right}}return null},w.prototype.put=function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:Qn,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,l,h=this.root_;do if(s=h,(l=n.compareTo(h.key))<0)h=h.left;else{if(!(l>0)){var v=h.value;return h.value=i,v}h=h.right}while(h!==null);var S={key:n,left:null,right:null,value:i,parent:s,color:Qn,getValue:function(){return this.value},getKey:function(){return this.key}};return l<0?s.left=S:s.right=S,this.fixAfterInsertion(S),this.size_++,null},w.prototype.fixAfterInsertion=function(n){for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)if(d(n)===y(d(d(n)))){var i=_(d(d(n)));p(i)===1?(g(d(n),Qn),g(i,Qn),g(d(d(n)),1),n=d(d(n))):(n===_(d(n))&&(n=d(n),this.rotateLeft(n)),g(d(n),Qn),g(d(d(n)),1),this.rotateRight(d(d(n))))}else{var s=y(d(d(n)));p(s)===1?(g(d(n),Qn),g(s,Qn),g(d(d(n)),1),n=d(d(n))):(n===y(d(n))&&(n=d(n),this.rotateRight(n)),g(d(n),Qn),g(d(d(n)),1),this.rotateLeft(d(d(n))))}this.root_.color=Qn},w.prototype.values=function(){var n=new nt,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=w.successor(i))!==null;)n.add(i.value);return n},w.prototype.entrySet=function(){var n=new je,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=w.successor(i))!==null;)n.add(i);return n},w.prototype.rotateLeft=function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}},w.prototype.rotateRight=function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}},w.prototype.getFirstEntry=function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n},w.successor=function(n){if(n===null)return null;if(n.right!==null){for(var i=n.right;i.left!==null;)i=i.left;return i}for(var s=n.parent,l=n;s!==null&&l===s.right;)l=s,s=s.parent;return s},w.prototype.size=function(){return this.size_};var wr=function(){};wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr},x.prototype=new c,(b.prototype=new x).contains=function(n){for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===0)return!0;return!1},b.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},b.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next());return!0},b.prototype.remove=function(n){throw new a},b.prototype.size=function(){return this.array_.length},b.prototype.isEmpty=function(){return this.array_.length===0},b.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n},b.prototype.iterator=function(){return new Rr(this)};var Rr=function(n){this.treeSet_=n,this.position_=0};Rr.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},Rr.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Rr.prototype.remove=function(){throw new a};var er=function(){};er.sort=function(){var n,i,s,l,h=arguments[0];if(arguments.length===1)l=function(S,R){return S.compareTo(R)},h.sort(l);else if(arguments.length===2)s=arguments[1],l=function(S,R){return s.compare(S,R)},h.sort(l);else if(arguments.length===3){(i=h.slice(arguments[1],arguments[2])).sort();var v=h.slice(0,arguments[1]).concat(i,h.slice(arguments[2],h.length));for(h.splice(0,h.length),n=0;n<v.length;n++)h.push(v[n])}else if(arguments.length===4)for(i=h.slice(arguments[1],arguments[2]),s=arguments[3],l=function(S,R){return s.compare(S,R)},i.sort(l),v=h.slice(0,arguments[1]).concat(i,h.slice(arguments[2],h.length)),h.splice(0,h.length),n=0;n<v.length;n++)h.push(v[n])},er.asList=function(n){for(var i=new nt,s=0,l=n.length;s<l;s++)i.add(n[s]);return i};var Me=function(){},nr={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}};nr.P.get=function(){return 0},nr.L.get=function(){return 1},nr.A.get=function(){return 2},nr.FALSE.get=function(){return-1},nr.TRUE.get=function(){return-2},nr.DONTCARE.get=function(){return-3},nr.SYM_FALSE.get=function(){return"F"},nr.SYM_TRUE.get=function(){return"T"},nr.SYM_DONTCARE.get=function(){return"*"},nr.SYM_P.get=function(){return"0"},nr.SYM_L.get=function(){return"1"},nr.SYM_A.get=function(){return"2"},Me.prototype.interfaces_=function(){return[]},Me.prototype.getClass=function(){return Me},Me.toDimensionSymbol=function(n){switch(n){case Me.FALSE:return Me.SYM_FALSE;case Me.TRUE:return Me.SYM_TRUE;case Me.DONTCARE:return Me.SYM_DONTCARE;case Me.P:return Me.SYM_P;case Me.L:return Me.SYM_L;case Me.A:return Me.SYM_A}throw new N("Unknown dimension value: "+n)},Me.toDimensionValue=function(n){switch(yt.toUpperCase(n)){case Me.SYM_FALSE:return Me.FALSE;case Me.SYM_TRUE:return Me.TRUE;case Me.SYM_DONTCARE:return Me.DONTCARE;case Me.SYM_P:return Me.P;case Me.SYM_L:return Me.L;case Me.SYM_A:return Me.A}throw new N("Unknown dimension symbol: "+n)},Object.defineProperties(Me,nr);var hr=function(){};hr.prototype.filter=function(n){},hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr};var lr=function(){};lr.prototype.filter=function(n,i){},lr.prototype.isDone=function(){},lr.prototype.isGeometryChanged=function(){},lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr};var Zn=function(n){function i(l,h){if(n.call(this,h),this._geometries=l||[],n.hasNullElements(this._geometries))throw new N("geometries must not contain null elements")}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var l=new Xt,h=0;h<this._geometries.length;h++)l.expandToInclude(this._geometries[h].getEnvelopeInternal());return l},i.prototype.getGeometryN=function(l){return this._geometries[l]},i.prototype.getSortIndex=function(){return n.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var l=new Array(this.getNumPoints()).fill(null),h=-1,v=0;v<this._geometries.length;v++)for(var S=this._geometries[v].getCoordinates(),R=0;R<S.length;R++)l[++h]=S[R];return l},i.prototype.getArea=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getArea();return l},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var v=l;if(this._geometries.length!==v._geometries.length)return!1;for(var S=0;S<this._geometries.length;S++)if(!this._geometries[S].equalsExact(v._geometries[S],h))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var l=0;l<this._geometries.length;l++)this._geometries[l].normalize();er.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var l=Me.FALSE,h=0;h<this._geometries.length;h++)l=Math.max(l,this._geometries[h].getBoundaryDimension());return l},i.prototype.getDimension=function(){for(var l=Me.FALSE,h=0;h<this._geometries.length;h++)l=Math.max(l,this._geometries[h].getDimension());return l},i.prototype.getLength=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getLength();return l},i.prototype.getNumPoints=function(){for(var l=0,h=0;h<this._geometries.length;h++)l+=this._geometries[h].getNumPoints();return l},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),v=0;v<this._geometries.length;v++)h[v]=this._geometries[v].reverse();return this.getFactory().createGeometryCollection(h)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0],h=new b(er.asList(this._geometries)),v=new b(er.asList(l._geometries));return this.compare(h,v)}if(arguments.length===2){for(var S=arguments[0],R=arguments[1],V=S,ot=this.getNumGeometries(),St=V.getNumGeometries(),bt=0;bt<ot&&bt<St;){var Yt=this.getGeometryN(bt),Jt=V.getGeometryN(bt),se=Yt.compareToSameClass(Jt,R);if(se!==0)return se;bt++}return bt<ot?1:bt<St?-1:0}},i.prototype.apply=function(){if(et(arguments[0],tt))for(var l=arguments[0],h=0;h<this._geometries.length;h++)this._geometries[h].apply(l);else if(et(arguments[0],lr)){var v=arguments[0];if(this._geometries.length===0)return null;for(var S=0;S<this._geometries.length&&(this._geometries[S].apply(v),!v.isDone());S++);v.isGeometryChanged()&&this.geometryChanged()}else if(et(arguments[0],hr)){var R=arguments[0];R.filter(this);for(var V=0;V<this._geometries.length;V++)this._geometries[V].apply(R)}else if(et(arguments[0],Gt)){var ot=arguments[0];ot.filter(this);for(var St=0;St<this._geometries.length;St++)this._geometries[St].apply(ot)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),kt.shouldNeverReachHere(),null},i.prototype.clone=function(){var l=n.prototype.clone.call(this);l._geometries=new Array(this._geometries.length).fill(null);for(var h=0;h<this._geometries.length;h++)l._geometries[h]=this._geometries[h].clone();return l},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.isEmpty=function(){for(var l=0;l<this._geometries.length;l++)if(!this._geometries[l].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,s),i}(Ct),K=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&n.prototype.equalsExact.call(this,l,h)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?Me.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var l=0;l<this._geometries.length;l++)if(!this._geometries[l].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),v=0;v<this._geometries.length;v++)h[l-1-v]=this._geometries[v].reverse();return this.getFactory().createMultiLineString(h)},i.prototype.getBoundary=function(){return new xt(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.interfaces_=function(){return[wr]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(Zn),xt=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=C.MOD2_BOUNDARY_RULE;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this._geom=s,this._geomFact=s.getFactory(),this._bnRule=l}};xt.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)},xt.prototype.getBoundary=function(){return this._geom instanceof jt?this.boundaryLineString(this._geom):this._geom instanceof K?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},xt.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()])},xt.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},xt.prototype.computeBoundaryCoordinates=function(n){var i=new nt;this._endpointMap=new w;for(var s=0;s<n.getNumGeometries();s++){var l=n.getGeometryN(s);l.getNumPoints()!==0&&(this.addEndpoint(l.getCoordinateN(0)),this.addEndpoint(l.getCoordinateN(l.getNumPoints()-1)))}for(var h=this._endpointMap.entrySet().iterator();h.hasNext();){var v=h.next(),S=v.getValue().count;this._bnRule.isInBoundary(S)&&i.add(v.getKey())}return at.toCoordinateArray(i)},xt.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new Lt,this._endpointMap.put(n,i)),i.count++},xt.prototype.interfaces_=function(){return[]},xt.prototype.getClass=function(){return xt},xt.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new xt(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new xt(i,s).getBoundary()}};var Lt=function(){this.count=null};Lt.prototype.interfaces_=function(){return[]},Lt.prototype.getClass=function(){return Lt};var wt=function(){},Ot={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};wt.prototype.interfaces_=function(){return[]},wt.prototype.getClass=function(){return wt},wt.chars=function(n,i){for(var s=new Array(i).fill(null),l=0;l<i;l++)s[l]=n;return String(s)},wt.getStackTrace=function(){if(arguments.length===1){var n=arguments[0],i=new function(){},s=new function(){}(i);return n.printStackTrace(s),i.toString()}if(arguments.length===2){for(var l=arguments[0],h=arguments[1],v="",S=new function(){}(new function(){}(wt.getStackTrace(l))),R=0;R<h;R++)try{v+=S.readLine()+wt.NEWLINE}catch(V){if(!(V instanceof P))throw V;kt.shouldNeverReachHere()}return v}},wt.split=function(n,i){for(var s=i.length,l=new nt,h=""+n,v=h.indexOf(i);v>=0;){var S=h.substring(0,v);l.add(S),v=(h=h.substring(v+s)).indexOf(i)}h.length>0&&l.add(h);for(var R=new Array(l.size()).fill(null),V=0;V<R.length;V++)R[V]=l.get(V);return R},wt.toString=function(){if(arguments.length===1){var n=arguments[0];return wt.SIMPLE_ORDINATE_FORMAT.format(n)}},wt.spaces=function(n){return wt.chars(" ",n)},Ot.NEWLINE.get=function(){return Qt.getProperty("line.separator")},Ot.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(wt,Ot);var Zt=function(){};Zt.prototype.interfaces_=function(){return[]},Zt.prototype.getClass=function(){return Zt},Zt.copyCoord=function(n,i,s,l){for(var h=Math.min(n.getDimension(),s.getDimension()),v=0;v<h;v++)s.setOrdinate(l,v,n.getOrdinate(i,v))},Zt.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,At.X)===n.getOrdinate(i-1,At.X)&&n.getOrdinate(0,At.Y)===n.getOrdinate(i-1,At.Y)},Zt.isEqual=function(n,i){var s=n.size();if(s!==i.size())return!1;for(var l=Math.min(n.getDimension(),i.getDimension()),h=0;h<s;h++)for(var v=0;v<l;v++){var S=n.getOrdinate(h,v),R=i.getOrdinate(h,v);if(n.getOrdinate(h,v)!==i.getOrdinate(h,v)&&(!A.isNaN(S)||!A.isNaN(R)))return!1}return!0},Zt.extend=function(n,i,s){var l=n.create(s,i.getDimension()),h=i.size();if(Zt.copy(i,0,l,0,h),h>0)for(var v=h;v<s;v++)Zt.copy(i,h-1,l,v,1);return l},Zt.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),l=0;l<=s;l++)Zt.swap(n,l,i-l)},Zt.swap=function(n,i,s){if(i===s)return null;for(var l=0;l<n.getDimension();l++){var h=n.getOrdinate(i,l);n.setOrdinate(i,l,n.getOrdinate(s,l)),n.setOrdinate(s,l,h)}},Zt.copy=function(n,i,s,l,h){for(var v=0;v<h;v++)Zt.copyCoord(n,i+v,s,l+v)},Zt.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),l=new Pt;l.append("(");for(var h=0;h<i;h++){h>0&&l.append(" ");for(var v=0;v<s;v++)v>0&&l.append(","),l.append(wt.toString(n.getOrdinate(h,v)))}return l.append(")"),l.toString()}},Zt.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?Zt.createClosedRing(n,i,4):i.getOrdinate(0,At.X)===i.getOrdinate(s-1,At.X)&&i.getOrdinate(0,At.Y)===i.getOrdinate(s-1,At.Y)?i:Zt.createClosedRing(n,i,s+1)},Zt.createClosedRing=function(n,i,s){var l=n.create(s,i.getDimension()),h=i.size();Zt.copy(i,0,l,0,h);for(var v=h;v<s;v++)Zt.copy(i,0,l,v,1);return l};var jt=function(n){function i(l,h){n.call(this,h),this._points=null,this.init(l)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Xt:this._points.expandEnvelope(new Xt)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return n.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var v=l;if(this._points.size()!==v._points.size())return!1;for(var S=0;S<this._points.size();S++)if(!this.equal(this._points.getCoordinate(S),v._points.getCoordinate(S),h))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var l=0;l<Math.trunc(this._points.size()/2);l++){var h=this._points.size()-1-l;if(!this._points.getCoordinate(l).equals(this._points.getCoordinate(h)))return this._points.getCoordinate(l).compareTo(this._points.getCoordinate(h))>0&&Zt.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?Me.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 rt.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var l=this._points.copy();return Zt.reverse(l),this.getFactory().createLineString(l)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var l=arguments[0],h=0,v=0;h<this._points.size()&&v<l._points.size();){var S=this._points.getCoordinate(h).compareTo(l._points.getCoordinate(v));if(S!==0)return S;h++,v++}return h<this._points.size()?1:v<l._points.size()?-1:0}if(arguments.length===2){var R=arguments[0];return arguments[1].compare(this._points,R._points)}},i.prototype.apply=function(){if(et(arguments[0],tt))for(var l=arguments[0],h=0;h<this._points.size();h++)l.filter(this._points.getCoordinate(h));else if(et(arguments[0],lr)){var v=arguments[0];if(this._points.size()===0)return null;for(var S=0;S<this._points.size()&&(v.filter(this._points,S),!v.isDone());S++);v.isGeometryChanged()&&this.geometryChanged()}else et(arguments[0],hr)?arguments[0].filter(this):et(arguments[0],Gt)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new xt(this).getBoundary()},i.prototype.isEquivalentClass=function(l){return l instanceof i},i.prototype.clone=function(){var l=n.prototype.clone.call(this);return l._points=this._points.clone(),l},i.prototype.getCoordinateN=function(l){return this._points.getCoordinate(l)},i.prototype.getGeometryType=function(){return"LineString"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._points},i.prototype.isEmpty=function(){return this._points.size()===0},i.prototype.init=function(l){if(l===null&&(l=this.getFactory().getCoordinateSequenceFactory().create([])),l.size()===1)throw new N("Invalid number of points in LineString (found "+l.size()+" - must be 0 or >= 2)");this._points=l},i.prototype.isCoordinate=function(l){for(var h=0;h<this._points.size();h++)if(this._points.getCoordinate(h).equals(l))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(l){return this.getFactory().createPoint(this._points.getCoordinate(l))},i.prototype.interfaces_=function(){return[wr]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(Ct),Te=function(){};Te.prototype.interfaces_=function(){return[]},Te.prototype.getClass=function(){return Te};var ge=function(n){function i(l,h){n.call(this,h),this._coordinates=l||null,this.init(this._coordinates)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Xt;var l=new Xt;return l.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),l},i.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&(!(!this.isEmpty()||!l.isEmpty())||this.isEmpty()===l.isEmpty()&&this.equal(l.getCoordinate(),this.getCoordinate(),h))}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){},i.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},i.prototype.getBoundaryDimension=function(){return Me.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getNumPoints=function(){return this.isEmpty()?0:1},i.prototype.reverse=function(){return this.copy()},i.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},i.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0];return this.getCoordinate().compareTo(l.getCoordinate())}if(arguments.length===2){var h=arguments[0];return arguments[1].compare(this._coordinates,h._coordinates)}},i.prototype.apply=function(){if(et(arguments[0],tt)){var l=arguments[0];if(this.isEmpty())return null;l.filter(this.getCoordinate())}else if(et(arguments[0],lr)){var h=arguments[0];if(this.isEmpty())return null;h.filter(this._coordinates,0),h.isGeometryChanged()&&this.geometryChanged()}else et(arguments[0],hr)?arguments[0].filter(this):et(arguments[0],Gt)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var l=n.prototype.clone.call(this);return l._coordinates=this._coordinates.clone(),l},i.prototype.getGeometryType=function(){return"Point"},i.prototype.copy=function(){return new i(this._coordinates.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._coordinates},i.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},i.prototype.isEmpty=function(){return this._coordinates.size()===0},i.prototype.init=function(l){l===null&&(l=this.getFactory().getCoordinateSequenceFactory().create([])),kt.isTrue(l.size()<=1),this._coordinates=l},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[Te]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(Ct),Ne=function(){};Ne.prototype.interfaces_=function(){return[]},Ne.prototype.getClass=function(){return Ne};var pe=function(n){function i(l,h,v){if(n.call(this,v),this._shell=null,this._holes=null,l===null&&(l=this.getFactory().createLinearRing()),h===null&&(h=[]),n.hasNullElements(h))throw new N("holes must not contain null elements");if(l.isEmpty()&&n.hasNonEmptyElements(h))throw new N("shell is empty but holes are not");this._shell=l,this._holes=h}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return n.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var l=new Array(this.getNumPoints()).fill(null),h=-1,v=this._shell.getCoordinates(),S=0;S<v.length;S++)l[++h]=v[S];for(var R=0;R<this._holes.length;R++)for(var V=this._holes[R].getCoordinates(),ot=0;ot<V.length;ot++)l[++h]=V[ot];return l},i.prototype.getArea=function(){var l=0;l+=Math.abs(rt.signedArea(this._shell.getCoordinateSequence()));for(var h=0;h<this._holes.length;h++)l-=Math.abs(rt.signedArea(this._holes[h].getCoordinateSequence()));return l},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var l=this._shell.getCoordinateSequence(),h=this.getEnvelopeInternal(),v=0;v<5;v++){var S=l.getX(v);if(S!==h.getMinX()&&S!==h.getMaxX())return!1;var R=l.getY(v);if(R!==h.getMinY()&&R!==h.getMaxY())return!1}for(var V=l.getX(0),ot=l.getY(0),St=1;St<=4;St++){var bt=l.getX(St),Yt=l.getY(St);if(bt!==V==(Yt!==ot))return!1;V=bt,ot=Yt}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];if(!this.isEquivalentClass(l))return!1;var v=l,S=this._shell,R=v._shell;if(!S.equalsExact(R,h)||this._holes.length!==v._holes.length)return!1;for(var V=0;V<this._holes.length;V++)if(!this._holes[V].equalsExact(v._holes[V],h))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var l=0;l<this._holes.length;l++)this.normalize(this._holes[l],!1);er.sort(this._holes)}else if(arguments.length===2){var h=arguments[0],v=arguments[1];if(h.isEmpty())return null;var S=new Array(h.getCoordinates().length-1).fill(null);Qt.arraycopy(h.getCoordinates(),0,S,0,S.length);var R=at.minCoordinate(h.getCoordinates());at.scroll(S,R),Qt.arraycopy(S,0,h.getCoordinates(),0,S.length),h.getCoordinates()[S.length]=S[0],rt.isCCW(h.getCoordinates())===v&&at.reverse(h.getCoordinates())}},i.prototype.getCoordinate=function(){return this._shell.getCoordinate()},i.prototype.getNumInteriorRing=function(){return this._holes.length},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.getLength=function(){var l=0;l+=this._shell.getLength();for(var h=0;h<this._holes.length;h++)l+=this._holes[h].getLength();return l},i.prototype.getNumPoints=function(){for(var l=this._shell.getNumPoints(),h=0;h<this._holes.length;h++)l+=this._holes[h].getNumPoints();return l},i.prototype.reverse=function(){var l=this.copy();l._shell=this._shell.copy().reverse(),l._holes=new Array(this._holes.length).fill(null);for(var h=0;h<this._holes.length;h++)l._holes[h]=this._holes[h].copy().reverse();return l},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var l=arguments[0],h=this._shell,v=l._shell;return h.compareToSameClass(v)}if(arguments.length===2){var S=arguments[0],R=arguments[1],V=S,ot=this._shell,St=V._shell,bt=ot.compareToSameClass(St,R);if(bt!==0)return bt;for(var Yt=this.getNumInteriorRing(),Jt=V.getNumInteriorRing(),se=0;se<Yt&&se<Jt;){var _e=this.getInteriorRingN(se),Cn=V.getInteriorRingN(se),Xn=_e.compareToSameClass(Cn,R);if(Xn!==0)return Xn;se++}return se<Yt?1:se<Jt?-1:0}},i.prototype.apply=function(l){if(et(l,tt)){this._shell.apply(l);for(var h=0;h<this._holes.length;h++)this._holes[h].apply(l)}else if(et(l,lr)){if(this._shell.apply(l),!l.isDone())for(var v=0;v<this._holes.length&&(this._holes[v].apply(l),!l.isDone());v++);l.isGeometryChanged()&&this.geometryChanged()}else if(et(l,hr))l.filter(this);else if(et(l,Gt)){l.filter(this),this._shell.apply(l);for(var S=0;S<this._holes.length;S++)this._holes[S].apply(l)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var l=new Array(this._holes.length+1).fill(null);l[0]=this._shell;for(var h=0;h<this._holes.length;h++)l[h+1]=this._holes[h];return l.length<=1?this.getFactory().createLinearRing(l[0].getCoordinateSequence()):this.getFactory().createMultiLineString(l)},i.prototype.clone=function(){var l=n.prototype.clone.call(this);l._shell=this._shell.clone(),l._holes=new Array(this._holes.length).fill(null);for(var h=0;h<this._holes.length;h++)l._holes[h]=this._holes[h].clone();return l},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var l=this._shell.copy(),h=new Array(this._holes.length).fill(null),v=0;v<h.length;v++)h[v]=this._holes[v].copy();return new i(l,h,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(l){return this._holes[l]},i.prototype.interfaces_=function(){return[Ne]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,s),i}(Ct),Oe=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&n.prototype.equalsExact.call(this,l,h)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var l=arguments[0];return this._geometries[l].getCoordinate()}return n.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return Me.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.getGeometryType=function(){return"MultiPoint"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.interfaces_=function(){return[Te]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(Zn),Tn=function(n){function i(l,h){l instanceof D&&h instanceof Ce&&(l=h.getCoordinateSequenceFactory().create(l)),n.call(this,l,h),this.validateConstruction()}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return Me.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var l=this._points.copy();return Zt.reverse(l),this.getFactory().createLinearRing(l)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new N("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new N("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}(jt),Bn=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 Ct.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return!!this.isEquivalentClass(l)&&n.prototype.equalsExact.call(this,l,h)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var l=this._geometries.length,h=new Array(l).fill(null),v=0;v<this._geometries.length;v++)h[v]=this._geometries[v].reverse();return this.getFactory().createMultiPolygon(h)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var l=new nt,h=0;h<this._geometries.length;h++)for(var v=this._geometries[h].getBoundary(),S=0;S<v.getNumGeometries();S++)l.add(v.getGeometryN(S));var R=new Array(l.size()).fill(null);return this.getFactory().createMultiLineString(l.toArray(R))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var l=new Array(this._geometries.length).fill(null),h=0;h<l.length;h++)l[h]=this._geometries[h].copy();return new i(l,this._factory)},i.prototype.interfaces_=function(){return[Ne]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,s),i}(Zn),rr=function(n){this._factory=n||null,this._isUserDataCopied=!1},Ki={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};rr.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},rr.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},rr.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof Zn?this.editGeometryCollection(n,i):n instanceof pe?this.editPolygon(n,i):n instanceof ge?i.edit(n,this._factory):n instanceof jt?i.edit(n,this._factory):(kt.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},rr.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),l=new nt,h=0;h<s.getNumGeometries();h++){var v=this.edit(s.getGeometryN(h),i);v===null||v.isEmpty()||l.add(v)}return s.getClass()===Oe?this._factory.createMultiPoint(l.toArray([])):s.getClass()===K?this._factory.createMultiLineString(l.toArray([])):s.getClass()===Bn?this._factory.createMultiPolygon(l.toArray([])):this._factory.createGeometryCollection(l.toArray([]))},rr.prototype.editPolygon=function(n,i){var s=i.edit(n,this._factory);if(s===null&&(s=this._factory.createPolygon(null)),s.isEmpty())return s;var l=this.edit(s.getExteriorRing(),i);if(l===null||l.isEmpty())return this._factory.createPolygon();for(var h=new nt,v=0;v<s.getNumInteriorRing();v++){var S=this.edit(s.getInteriorRingN(v),i);S===null||S.isEmpty()||h.add(S)}return this._factory.createPolygon(l,h.toArray([]))},rr.prototype.interfaces_=function(){return[]},rr.prototype.getClass=function(){return rr},rr.GeometryEditorOperation=function(){},Ki.NoOpGeometryOperation.get=function(){return pr},Ki.CoordinateOperation.get=function(){return ze},Ki.CoordinateSequenceOperation.get=function(){return Is},Object.defineProperties(rr,Ki);var pr=function(){};pr.prototype.edit=function(n,i){return n},pr.prototype.interfaces_=function(){return[rr.GeometryEditorOperation]},pr.prototype.getClass=function(){return pr};var ze=function(){};ze.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof Tn?i.createLinearRing(s):n instanceof jt?i.createLineString(s):n instanceof ge?s.length>0?i.createPoint(s[0]):i.createPoint():n},ze.prototype.interfaces_=function(){return[rr.GeometryEditorOperation]},ze.prototype.getClass=function(){return ze};var Is=function(){};Is.prototype.edit=function(n,i){return n instanceof Tn?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof jt?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof ge?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},Is.prototype.interfaces_=function(){return[rr.GeometryEditorOperation]},Is.prototype.getClass=function(){return Is};var De=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var i=0;i<n;i++)this._coordinates[i]=new D}else if(et(arguments[0],At)){var s=arguments[0];if(s===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=s.getDimension(),this._coordinates=new Array(s.size()).fill(null);for(var l=0;l<this._coordinates.length;l++)this._coordinates[l]=s.getCoordinateCopy(l)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var h=arguments[0],v=arguments[1];this._coordinates=h,this._dimension=v,h===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var S=arguments[0],R=arguments[1];this._coordinates=new Array(S).fill(null),this._dimension=R;for(var V=0;V<S;V++)this._coordinates[V]=new D}}},Yo={serialVersionUID:{configurable:!0}};De.prototype.setOrdinate=function(n,i,s){switch(i){case At.X:this._coordinates[n].x=s;break;case At.Y:this._coordinates[n].y=s;break;case At.Z:this._coordinates[n].z=s;break;default:throw new N("invalid ordinateIndex")}},De.prototype.size=function(){return this._coordinates.length},De.prototype.getOrdinate=function(n,i){switch(i){case At.X:return this._coordinates[n].x;case At.Y:return this._coordinates[n].y;case At.Z:return this._coordinates[n].z}return A.NaN},De.prototype.getCoordinate=function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var i=arguments[0],s=arguments[1];s.x=this._coordinates[i].x,s.y=this._coordinates[i].y,s.z=this._coordinates[i].z}},De.prototype.getCoordinateCopy=function(n){return new D(this._coordinates[n])},De.prototype.getDimension=function(){return this._dimension},De.prototype.getX=function(n){return this._coordinates[n].x},De.prototype.clone=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].clone();return new De(n,this._dimension)},De.prototype.expandEnvelope=function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n},De.prototype.copy=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].copy();return new De(n,this._dimension)},De.prototype.toString=function(){if(this._coordinates.length>0){var n=new Pt(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)n.append(", "),n.append(this._coordinates[i]);return n.append(")"),n.toString()}return"()"},De.prototype.getY=function(n){return this._coordinates[n].y},De.prototype.toCoordinateArray=function(){return this._coordinates},De.prototype.interfaces_=function(){return[At,t]},De.prototype.getClass=function(){return De},Yo.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(De,Yo);var Ui=function(){},$o={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};Ui.prototype.readResolve=function(){return Ui.instance()},Ui.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new De(n)}if(et(arguments[0],At)){var i=arguments[0];return new De(i)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return l>3&&(l=3),l<2?new De(s):new De(s,l)}},Ui.prototype.interfaces_=function(){return[_t,t]},Ui.prototype.getClass=function(){return Ui},Ui.instance=function(){return Ui.instanceObject},$o.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},$o.instanceObject.get=function(){return new Ui},Object.defineProperties(Ui,$o);var Ka=function(n){function i(){n.call(this),this.map_=new Map}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(s){return this.map_.get(s)||null},i.prototype.put=function(s,l){return this.map_.set(s,l),l},i.prototype.values=function(){for(var s=new nt,l=this.map_.values(),h=l.next();!h.done;)s.add(h.value),h=l.next();return s},i.prototype.entrySet=function(){var s=new je;return this.map_.entries().forEach(function(l){return s.add(l)}),s},i.prototype.size=function(){return this.map_.size()},i}(oe),Se=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 ci){var i=arguments[0];this._modelType=i,i===n.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var s=arguments[0];this._modelType=n.FIXED,this.setScale(s)}else if(arguments[0]instanceof n){var l=arguments[0];this._modelType=l._modelType,this._scale=l._scale}}},Qi={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Se.prototype.equals=function(n){if(!(n instanceof Se))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale},Se.prototype.compareTo=function(n){var i=n,s=this.getMaximumSignificantDigits(),l=i.getMaximumSignificantDigits();return new Et(s).compareTo(new Et(l))},Se.prototype.getScale=function(){return this._scale},Se.prototype.isFloating=function(){return this._modelType===Se.FLOATING||this._modelType===Se.FLOATING_SINGLE},Se.prototype.getType=function(){return this._modelType},Se.prototype.toString=function(){var n="UNKNOWN";return this._modelType===Se.FLOATING?n="Floating":this._modelType===Se.FLOATING_SINGLE?n="Floating-Single":this._modelType===Se.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n},Se.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var n=arguments[0];return A.isNaN(n)||this._modelType===Se.FLOATING_SINGLE?n:this._modelType===Se.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof D){var i=arguments[0];if(this._modelType===Se.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},Se.prototype.getMaximumSignificantDigits=function(){var n=16;return this._modelType===Se.FLOATING?n=16:this._modelType===Se.FLOATING_SINGLE?n=6:this._modelType===Se.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n},Se.prototype.setScale=function(n){this._scale=Math.abs(n)},Se.prototype.interfaces_=function(){return[t,z]},Se.prototype.getClass=function(){return Se},Se.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Qi.serialVersionUID.get=function(){return 7777263578777804e3},Qi.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(Se,Qi);var ci=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},fi={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ci.prototype.readResolve=function(){return ci.nameToTypeMap.get(this._name)},ci.prototype.toString=function(){return this._name},ci.prototype.interfaces_=function(){return[t]},ci.prototype.getClass=function(){return ci},fi.serialVersionUID.get=function(){return-552860263173159e4},fi.nameToTypeMap.get=function(){return new Ka},Object.defineProperties(ci,fi),Se.Type=ci,Se.FIXED=new ci("FIXED"),Se.FLOATING=new ci("FLOATING"),Se.FLOATING_SINGLE=new ci("FLOATING SINGLE");var Ce=function n(){this._precisionModel=new Se,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?et(arguments[0],_t)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Se&&(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]))},Du={serialVersionUID:{configurable:!0}};Ce.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new D(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new D(n.getMinX(),n.getMinY()),new D(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new D(n.getMinX(),n.getMinY()),new D(n.getMinX(),n.getMaxY()),new D(n.getMaxX(),n.getMaxY()),new D(n.getMaxX(),n.getMinY()),new D(n.getMinX(),n.getMinY())]),null)},Ce.prototype.createLineString=function(n){return n?n instanceof Array?new jt(this.getCoordinateSequenceFactory().create(n),this):et(n,At)?new jt(n,this):void 0:new jt(this.getCoordinateSequenceFactory().create([]),this)},Ce.prototype.createMultiLineString=function(){if(arguments.length===0)return new K(null,this);if(arguments.length===1){var n=arguments[0];return new K(n,this)}},Ce.prototype.buildGeometry=function(n){for(var i=null,s=!1,l=!1,h=n.iterator();h.hasNext();){var v=h.next(),S=v.getClass();i===null&&(i=S),S!==i&&(s=!0),v.isGeometryCollectionOrDerived()&&(l=!0)}if(i===null)return this.createGeometryCollection();if(s||l)return this.createGeometryCollection(Ce.toGeometryArray(n));var R=n.iterator().next();if(n.size()>1){if(R instanceof pe)return this.createMultiPolygon(Ce.toPolygonArray(n));if(R instanceof jt)return this.createMultiLineString(Ce.toLineStringArray(n));if(R instanceof ge)return this.createMultiPoint(Ce.toPointArray(n));kt.shouldNeverReachHere("Unhandled class: "+R.getClass().getName())}return R},Ce.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},Ce.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof D){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(et(arguments[0],At)){var i=arguments[0];return new ge(i,this)}}},Ce.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Ce.prototype.createPolygon=function(){if(arguments.length===0)return new pe(null,null,this);if(arguments.length===1){if(et(arguments[0],At)){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 Tn){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];return new pe(l,h,this)}},Ce.prototype.getSRID=function(){return this._SRID},Ce.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Zn(null,this);if(arguments.length===1){var n=arguments[0];return new Zn(n,this)}},Ce.prototype.createGeometry=function(n){return new rr(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},Ce.prototype.getPrecisionModel=function(){return this._precisionModel},Ce.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(et(arguments[0],At)){var i=arguments[0];return new Tn(i,this)}}},Ce.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Bn(null,this);if(arguments.length===1){var n=arguments[0];return new Bn(n,this)}},Ce.prototype.createMultiPoint=function(){if(arguments.length===0)return new Oe(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new Oe(n,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if(et(arguments[0],At)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var l=new Array(s.size()).fill(null),h=0;h<s.size();h++){var v=this.getCoordinateSequenceFactory().create(1,s.getDimension());Zt.copy(s,h,v,0,1),l[h]=this.createPoint(v)}return this.createMultiPoint(l)}}},Ce.prototype.interfaces_=function(){return[t]},Ce.prototype.getClass=function(){return Ce},Ce.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.getDefaultCoordinateSequenceFactory=function(){return Ui.instance()},Ce.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},Ce.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},Du.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(Ce,Du);var Qa=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],ml=function(n){this.geometryFactory=n||new Ce};ml.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!ao[s])throw new Error("Unknown GeoJSON type: "+i.type);return Qa.indexOf(s)!==-1?ao[s].apply(this,[i.coordinates]):s==="GeometryCollection"?ao[s].apply(this,[i.geometries]):ao[s].apply(this,[i])},ml.prototype.write=function(n){var i=n.getGeometryType();if(!So[i])throw new Error("Geometry is not supported");return So[i].apply(this,[n])};var ao={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var l=n.geometry.type;if(!ao[l])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=ao.bbox.apply(this,[n.bbox])),i},FeatureCollection:function(n){var i={};if(n.features){i.features=[];for(var s=0;s<n.features.length;++s)i.features.push(this.read(n.features[s]))}return n.bbox&&(i.bbox=this.parse.bbox.apply(this,[n.bbox])),i},coordinates:function(n){for(var i=[],s=0;s<n.length;++s){var l=n[s];i.push(new D(l[0],l[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new D(n[0],n[1]),new D(n[2],n[1]),new D(n[2],n[3]),new D(n[0],n[3]),new D(n[0],n[1])])},Point:function(n){var i=new D(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(ao.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=ao.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(ao.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=ao.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),l=[],h=1;h<n.length;++h){var v=n[h],S=ao.coordinates.apply(this,[v]),R=this.geometryFactory.createLinearRing(S);l.push(R)}return this.geometryFactory.createPolygon(s,l)},MultiPolygon:function(n){for(var i=[],s=0;s<n.length;++s){var l=n[s];i.push(ao.Polygon.apply(this,[l]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(n){for(var i=[],s=0;s<n.length;++s){var l=n[s];i.push(this.read(l))}return this.geometryFactory.createGeometryCollection(i)}},So={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:So.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=So.Point.apply(this,[l]);i.push(h.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(n){for(var i=[],s=n.getCoordinates(),l=0;l<s.length;++l){var h=s[l];i.push(So.coordinate.apply(this,[h]))}return{type:"LineString",coordinates:i}},MultiLineString:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=So.LineString.apply(this,[l]);i.push(h.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=So.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var l=0;l<n._holes.length;++l){var h=n._holes[l],v=So.LineString.apply(this,[h]);i.push(v.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=So.Polygon.apply(this,[l]);i.push(h.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var l=n._geometries[s],h=l.getGeometryType();i.push(So[h].apply(this,[l]))}return{type:"GeometryCollection",geometries:i}}},Fu=function(n){this.geometryFactory=n||new Ce,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new ml(this.geometryFactory)};Fu.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===Se.FIXED&&this.reducePrecision(i),i},Fu.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 _a=function(){this.parser=new ml(this.geometryFactory)};_a.prototype.write=function(n){return this.parser.write(n)};var Ht=function(){},Uu={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};Ht.prototype.interfaces_=function(){return[]},Ht.prototype.getClass=function(){return Ht},Ht.opposite=function(n){return n===Ht.LEFT?Ht.RIGHT:n===Ht.RIGHT?Ht.LEFT:n},Uu.ON.get=function(){return 0},Uu.LEFT.get=function(){return 1},Uu.RIGHT.get=function(){return 2},Object.defineProperties(Ht,Uu),(I.prototype=new Error).name="EmptyStackException",(M.prototype=new ut).add=function(n){return this.array_.push(n),!0},M.prototype.get=function(n){if(n<0||n>=this.size())throw new Error;return this.array_[n]},M.prototype.push=function(n){return this.array_.push(n),n},M.prototype.pop=function(n){if(this.array_.length===0)throw new I;return this.array_.pop()},M.prototype.peek=function(){if(this.array_.length===0)throw new I;return this.array_[this.array_.length-1]},M.prototype.empty=function(){return this.array_.length===0},M.prototype.isEmpty=function(){return this.empty()},M.prototype.search=function(n){return this.array_.indexOf(n)},M.prototype.size=function(){return this.array_.length},M.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n};var bo=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};bo.prototype.getCoordinate=function(){return this._minCoord},bo.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},bo.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();kt.isTrue(this._minIndex>0&&this._minIndex<n.length,"rightmost point expected to be interior vertex of edge");var i=n[this._minIndex-1],s=n[this._minIndex+1],l=rt.computeOrientation(this._minCoord,s,i),h=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&l===rt.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&l===rt.CLOCKWISE)&&(h=!0),h&&(this._minIndex=this._minIndex-1)},bo.prototype.getRightmostSideOfSegment=function(n,i){var s=n.getEdge().getCoordinates();if(i<0||i+1>=s.length||s[i].y===s[i+1].y)return-1;var l=Ht.LEFT;return s[i].y<s[i+1].y&&(l=Ht.RIGHT),l},bo.prototype.getEdge=function(){return this._orientedDe},bo.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])},bo.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)},bo.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}kt.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)===Ht.LEFT&&(this._orientedDe=this._minDe.getSym())},bo.prototype.interfaces_=function(){return[]},bo.prototype.getClass=function(){return bo};var Zo=function(n){function i(s,l){n.call(this,i.msgWithCoord(s,l)),this.pt=l?new D(l):null,this.name="TopologyException"}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getCoordinate=function(){return this.pt},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.msgWithCoord=function(s,l){return l?s:s+" [ "+l+" ]"},i}(Ue),Bu=function(){this.array_=[]};Bu.prototype.addLast=function(n){this.array_.push(n)},Bu.prototype.removeFirst=function(){return this.array_.shift()},Bu.prototype.isEmpty=function(){return this.array_.length===0};var Jr=function(){this._finder=null,this._dirEdgeList=new nt,this._nodes=new nt,this._rightMostCoord=null,this._env=null,this._finder=new bo};Jr.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},Jr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Jr.prototype.computeNodeDepth=function(n){for(var i=null,s=n.getEdges().iterator();s.hasNext();){var l=s.next();if(l.isVisited()||l.getSym().isVisited()){i=l;break}}if(i===null)throw new Zo("unable to find edge to compute depths at "+n.getCoordinate());n.getEdges().computeDepths(i);for(var h=n.getEdges().iterator();h.hasNext();){var v=h.next();v.setVisited(!0),this.copySymDepths(v)}},Jr.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(Ht.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},Jr.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Jr.prototype.findResultEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();){var i=n.next();i.getDepth(Ht.RIGHT)>=1&&i.getDepth(Ht.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},Jr.prototype.computeDepths=function(n){var i=new je,s=new Bu,l=n.getNode();for(s.addLast(l),i.add(l),n.setVisited(!0);!s.isEmpty();){var h=s.removeFirst();i.add(h),this.computeNodeDepth(h);for(var v=h.getEdges().iterator();v.hasNext();){var S=v.next().getSym();if(!S.isVisited()){var R=S.getNode();i.contains(R)||(s.addLast(R),i.add(R))}}}},Jr.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},Jr.prototype.getEnvelope=function(){if(this._env===null){for(var n=new Xt,i=this._dirEdgeList.iterator();i.hasNext();)for(var s=i.next().getEdge().getCoordinates(),l=0;l<s.length-1;l++)n.expandToInclude(s[l]);this._env=n}return this._env},Jr.prototype.addReachable=function(n){var i=new M;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},Jr.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(Ht.LEFT,n.getDepth(Ht.RIGHT)),i.setDepth(Ht.RIGHT,n.getDepth(Ht.LEFT))},Jr.prototype.add=function(n,i){n.setVisited(!0),this._nodes.add(n);for(var s=n.getEdges().iterator();s.hasNext();){var l=s.next();this._dirEdgeList.add(l);var h=l.getSym().getNode();h.isVisited()||i.push(h)}},Jr.prototype.getNodes=function(){return this._nodes},Jr.prototype.getDirectedEdges=function(){return this._dirEdgeList},Jr.prototype.interfaces_=function(){return[z]},Jr.prototype.getClass=function(){return Jr};var Wn=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[Ht.ON]=s}else if(arguments[0]instanceof n){var l=arguments[0];if(this.init(l.location.length),l!==null)for(var h=0;h<this.location.length;h++)this.location[h]=l.location[h]}}else if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];this.init(3),this.location[Ht.ON]=v,this.location[Ht.LEFT]=S,this.location[Ht.RIGHT]=R}};Wn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},Wn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==Z.NONE)return!1;return!0},Wn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===Z.NONE&&(this.location[i]=n)},Wn.prototype.isLine=function(){return this.location.length===1},Wn.prototype.merge=function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[Ht.ON]=this.location[Ht.ON],i[Ht.LEFT]=Z.NONE,i[Ht.RIGHT]=Z.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===Z.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},Wn.prototype.getLocations=function(){return this.location},Wn.prototype.flip=function(){if(this.location.length<=1)return null;var n=this.location[Ht.LEFT];this.location[Ht.LEFT]=this.location[Ht.RIGHT],this.location[Ht.RIGHT]=n},Wn.prototype.toString=function(){var n=new Pt;return this.location.length>1&&n.append(Z.toLocationSymbol(this.location[Ht.LEFT])),n.append(Z.toLocationSymbol(this.location[Ht.ON])),this.location.length>1&&n.append(Z.toLocationSymbol(this.location[Ht.RIGHT])),n.toString()},Wn.prototype.setLocations=function(n,i,s){this.location[Ht.ON]=n,this.location[Ht.LEFT]=i,this.location[Ht.RIGHT]=s},Wn.prototype.get=function(n){return n<this.location.length?this.location[n]:Z.NONE},Wn.prototype.isArea=function(){return this.location.length>1},Wn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===Z.NONE)return!0;return!1},Wn.prototype.setLocation=function(){if(arguments.length===1){var n=arguments[0];this.setLocation(Ht.ON,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.location[i]=s}},Wn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations(Z.NONE)},Wn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},Wn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},Wn.prototype.interfaces_=function(){return[]},Wn.prototype.getClass=function(){return Wn};var An=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 Wn(i),this.elt[1]=new Wn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new Wn(s.elt[0]),this.elt[1]=new Wn(s.elt[1])}}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.elt[0]=new Wn(Z.NONE),this.elt[1]=new Wn(Z.NONE),this.elt[l].setLocation(h)}else if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];this.elt[0]=new Wn(v,S,R),this.elt[1]=new Wn(v,S,R)}else if(arguments.length===4){var V=arguments[0],ot=arguments[1],St=arguments[2],bt=arguments[3];this.elt[0]=new Wn(Z.NONE,Z.NONE,Z.NONE),this.elt[1]=new Wn(Z.NONE,Z.NONE,Z.NONE),this.elt[V].setLocations(ot,St,bt)}};An.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},An.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},An.prototype.isNull=function(n){return this.elt[n].isNull()},An.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)}},An.prototype.isLine=function(n){return this.elt[n].isLine()},An.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new Wn(n.elt[i]):this.elt[i].merge(n.elt[i])},An.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},An.prototype.getLocation=function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(Ht.ON)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.elt[i].get(s)}},An.prototype.toString=function(){var n=new Pt;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()},An.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()}},An.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},An.prototype.setLocation=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(Ht.ON,i)}else if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];this.elt[s].setLocation(l,h)}},An.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},An.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},An.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new Wn(this.elt[n].location[0]))},An.prototype.interfaces_=function(){return[]},An.prototype.getClass=function(){return An},An.toLineLabel=function(n){for(var i=new An(Z.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var Mr=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new nt,this._pts=new nt,this._label=new An(Z.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new nt,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};Mr.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=rt.isCCW(this._ring.getCoordinates())},Mr.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Mr.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new Zo("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new Zo("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var l=i.getLabel();kt.isTrue(l.isArea()),this.mergeLabel(l),this.addPoints(i.getEdge(),i.isForward(),s),s=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},Mr.prototype.getLinearRing=function(){return this._ring},Mr.prototype.getCoordinate=function(n){return this._pts.get(n)},Mr.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},Mr.prototype.addPoints=function(n,i,s){var l=n.getCoordinates();if(i){var h=1;s&&(h=0);for(var v=h;v<l.length;v++)this._pts.add(l[v])}else{var S=l.length-2;s&&(S=l.length-1);for(var R=S;R>=0;R--)this._pts.add(l[R])}},Mr.prototype.isHole=function(){return this._isHole},Mr.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},Mr.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!rt.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},Mr.prototype.addHole=function(n){this._holes.add(n)},Mr.prototype.isShell=function(){return this._shell===null},Mr.prototype.getLabel=function(){return this._label},Mr.prototype.getEdges=function(){return this._edges},Mr.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Mr.prototype.getShell=function(){return this._shell},Mr.prototype.mergeLabel=function(){if(arguments.length===1){var n=arguments[0];this.mergeLabel(n,0),this.mergeLabel(n,1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],l=i.getLocation(s,Ht.RIGHT);if(l===Z.NONE)return null;if(this._label.getLocation(s)===Z.NONE)return this._label.setLocation(s,l),null}},Mr.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},Mr.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)},Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr};var rd=function(n){function i(){var s=arguments[0],l=arguments[1];n.call(this,s,l)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(s,l){s.setMinEdgeRing(l)},i.prototype.getNext=function(s){return s.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Mr),Lf=function(n){function i(){var s=arguments[0],l=arguments[1];n.call(this,s,l)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var s=new nt,l=this._startDe;do{if(l.getMinEdgeRing()===null){var h=new rd(l,this._geometryFactory);s.add(h)}l=l.getNext()}while(l!==this._startDe);return s},i.prototype.setEdgeRing=function(s,l){s.setEdgeRing(l)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var s=this._startDe;do s.getNode().getEdges().linkMinimalDirectedEdges(this),s=s.getNext();while(s!==this._startDe)},i.prototype.getNext=function(s){return s.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Mr),Bi=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}}};Bi.prototype.setVisited=function(n){this._isVisited=n},Bi.prototype.setInResult=function(n){this._isInResult=n},Bi.prototype.isCovered=function(){return this._isCovered},Bi.prototype.isCoveredSet=function(){return this._isCoveredSet},Bi.prototype.setLabel=function(n){this._label=n},Bi.prototype.getLabel=function(){return this._label},Bi.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},Bi.prototype.updateIM=function(n){kt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},Bi.prototype.isInResult=function(){return this._isInResult},Bi.prototype.isVisited=function(){return this._isVisited},Bi.prototype.interfaces_=function(){return[]},Bi.prototype.getClass=function(){return Bi};var yl=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var s=arguments[0],l=arguments[1];this._coord=s,this._edges=l,this._label=new An(0,Z.NONE)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var s=this.getEdges().getEdges().iterator();s.hasNext();)if(s.next().getEdge().isInResult())return!0;return!1},i.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},i.prototype.getCoordinate=function(){return this._coord},i.prototype.print=function(s){s.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(s){},i.prototype.computeMergedLocation=function(s,l){var h=Z.NONE;if(h=this._label.getLocation(l),!s.isNull(l)){var v=s.getLocation(l);h!==Z.BOUNDARY&&(h=v)}return h},i.prototype.setLabel=function(){if(arguments.length!==2)return n.prototype.setLabel.apply(this,arguments);var s=arguments[0],l=arguments[1];this._label===null?this._label=new An(s,l):this._label.setLocation(s,l)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof An)for(var l=arguments[0],h=0;h<2;h++){var v=this.computeMergedLocation(l,h);this._label.getLocation(h)===Z.NONE&&this._label.setLocation(h,v)}},i.prototype.add=function(s){this._edges.insert(s),s.setNode(this)},i.prototype.setLabelBoundary=function(s){if(this._label===null)return null;var l=Z.NONE;this._label!==null&&(l=this._label.getLocation(s));var h=null;switch(l){case Z.BOUNDARY:h=Z.INTERIOR;break;case Z.INTERIOR:default:h=Z.BOUNDARY}this._label.setLocation(s,h)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Bi),To=function(){this.nodeMap=new w,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};To.prototype.find=function(n){return this.nodeMap.get(n)},To.prototype.addNode=function(){if(arguments[0]instanceof D){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 yl){var s=arguments[0],l=this.nodeMap.get(s.getCoordinate());return l===null?(this.nodeMap.put(s.getCoordinate(),s),s):(l.mergeLabel(s),l)}},To.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},To.prototype.iterator=function(){return this.nodeMap.values().iterator()},To.prototype.values=function(){return this.nodeMap.values()},To.prototype.getBoundaryNodes=function(n){for(var i=new nt,s=this.iterator();s.hasNext();){var l=s.next();l.getLabel().getLocation(n)===Z.BOUNDARY&&i.add(l)}return i},To.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},To.prototype.interfaces_=function(){return[]},To.prototype.getClass=function(){return To};var kn=function(){},xa={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};kn.prototype.interfaces_=function(){return[]},kn.prototype.getClass=function(){return kn},kn.isNorthern=function(n){return n===kn.NE||n===kn.NW},kn.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},kn.commonHalfPlane=function(n,i){if(n===i)return n;if((n-i+4)%4===2)return-1;var s=n<i?n:i;return s===0&&(n>i?n:i)===3?3:s},kn.isInHalfPlane=function(n,i){return i===kn.SE?n===kn.SE||n===kn.SW:n===i||n===i+1},kn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new N("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?kn.NE:kn.SE:i>=0?kn.NW:kn.SW}if(arguments[0]instanceof D&&arguments[1]instanceof D){var s=arguments[0],l=arguments[1];if(l.x===s.x&&l.y===s.y)throw new N("Cannot compute the quadrant for two identical points "+s);return l.x>=s.x?l.y>=s.y?kn.NE:kn.SE:l.y>=s.y?kn.NW:kn.SW}},xa.NE.get=function(){return 0},xa.NW.get=function(){return 1},xa.SW.get=function(){return 2},xa.SE.get=function(){return 3},Object.defineProperties(kn,xa);var Kr=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];this._edge=i,this.init(s,l),this._label=null}else if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3];this._edge=h,this.init(v,S),this._label=R}};Kr.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:rt.computeOrientation(n._p0,n._p1,this._p1)},Kr.prototype.getDy=function(){return this._dy},Kr.prototype.getCoordinate=function(){return this._p0},Kr.prototype.setNode=function(n){this._node=n},Kr.prototype.print=function(n){var i=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),l=s.lastIndexOf("."),h=s.substring(l+1);n.print(" "+h+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},Kr.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},Kr.prototype.getDirectedCoordinate=function(){return this._p1},Kr.prototype.getDx=function(){return this._dx},Kr.prototype.getLabel=function(){return this._label},Kr.prototype.getEdge=function(){return this._edge},Kr.prototype.getQuadrant=function(){return this._quadrant},Kr.prototype.getNode=function(){return this._node},Kr.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},Kr.prototype.computeLabel=function(n){},Kr.prototype.init=function(n,i){this._p0=n,this._p1=i,this._dx=i.x-n.x,this._dy=i.y-n.y,this._quadrant=kn.quadrant(this._dx,this._dy),kt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},Kr.prototype.interfaces_=function(){return[z]},Kr.prototype.getClass=function(){return Kr};var Cc=function(n){function i(){var s=arguments[0],l=arguments[1];if(n.call(this,s),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=l,l)this.init(s.getCoordinate(0),s.getCoordinate(1));else{var h=s.getNumPoints()-1;this.init(s.getCoordinate(h),s.getCoordinate(h-1))}this.computeDirectedLabel()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(s){return this._depth[s]},i.prototype.setVisited=function(s){this._isVisited=s},i.prototype.computeDirectedLabel=function(){this._label=new An(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(s,l){if(this._depth[s]!==-999&&this._depth[s]!==l)throw new Zo("assigned depths do not match",this.getCoordinate());this._depth[s]=l},i.prototype.isInteriorAreaEdge=function(){for(var s=!0,l=0;l<2;l++)this._label.isArea(l)&&this._label.getLocation(l,Ht.LEFT)===Z.INTERIOR&&this._label.getLocation(l,Ht.RIGHT)===Z.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[Ht.LEFT]+"/"+this._depth[Ht.RIGHT]),s.print(" ("+this.getDepthDelta()+")"),this._isInResult&&s.print(" inResult")},i.prototype.setMinEdgeRing=function(s){this._minEdgeRing=s},i.prototype.isLineEdge=function(){var s=this._label.isLine(0)||this._label.isLine(1),l=!this._label.isArea(0)||this._label.allPositionsEqual(0,Z.EXTERIOR),h=!this._label.isArea(1)||this._label.allPositionsEqual(1,Z.EXTERIOR);return s&&l&&h},i.prototype.setEdgeRing=function(s){this._edgeRing=s},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var s=this._edge.getDepthDelta();return this._isForward||(s=-s),s},i.prototype.setInResult=function(s){this._isInResult=s},i.prototype.getSym=function(){return this._sym},i.prototype.isForward=function(){return this._isForward},i.prototype.getEdge=function(){return this._edge},i.prototype.printEdge=function(s){this.print(s),s.print(" "),this._isForward?this._edge.print(s):this._edge.printReverse(s)},i.prototype.setSym=function(s){this._sym=s},i.prototype.setVisitedEdge=function(s){this.setVisited(s),this._sym.setVisited(s)},i.prototype.setEdgeDepths=function(s,l){var h=this.getEdge().getDepthDelta();this._isForward||(h=-h);var v=1;s===Ht.LEFT&&(v=-1);var S=Ht.opposite(s),R=l+h*v;this.setDepth(s,l),this.setDepth(S,R)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(s){this._next=s},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(s,l){return s===Z.EXTERIOR&&l===Z.INTERIOR?1:s===Z.INTERIOR&&l===Z.EXTERIOR?-1:0},i}(Kr),ja=function(){};ja.prototype.createNode=function(n){return new yl(n,null)},ja.prototype.interfaces_=function(){return[]},ja.prototype.getClass=function(){return ja};var cr=function(){if(this._edges=new nt,this._nodes=null,this._edgeEndList=new nt,arguments.length===0)this._nodes=new To(new ja);else if(arguments.length===1){var n=arguments[0];this._nodes=new To(n)}};cr.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)}},cr.prototype.find=function(n){return this._nodes.find(n)},cr.prototype.addNode=function(){if(arguments[0]instanceof yl){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof D){var i=arguments[0];return this._nodes.addNode(i)}},cr.prototype.getNodeIterator=function(){return this._nodes.iterator()},cr.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},cr.prototype.debugPrintln=function(n){Qt.out.println(n)},cr.prototype.isBoundaryNode=function(n,i){var s=this._nodes.find(i);if(s===null)return!1;var l=s.getLabel();return l!==null&&l.getLocation(n)===Z.BOUNDARY},cr.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},cr.prototype.matchInSameDirection=function(n,i,s,l){return!!n.equals(s)&&rt.computeOrientation(n,i,l)===rt.COLLINEAR&&kn.quadrant(n,i)===kn.quadrant(s,l)},cr.prototype.getEdgeEnds=function(){return this._edgeEndList},cr.prototype.debugPrint=function(n){Qt.out.print(n)},cr.prototype.getEdgeIterator=function(){return this._edges.iterator()},cr.prototype.findEdgeInSameDirection=function(n,i){for(var s=0;s<this._edges.size();s++){var l=this._edges.get(s),h=l.getCoordinates();if(this.matchInSameDirection(n,i,h[0],h[1])||this.matchInSameDirection(n,i,h[h.length-1],h[h.length-2]))return l}return null},cr.prototype.insertEdge=function(n){this._edges.add(n)},cr.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},cr.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var l=new Cc(s,!0),h=new Cc(s,!1);l.setSym(h),h.setSym(l),this.add(l),this.add(h)}},cr.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},cr.prototype.getNodes=function(){return this._nodes.values()},cr.prototype.findEdge=function(n,i){for(var s=0;s<this._edges.size();s++){var l=this._edges.get(s),h=l.getCoordinates();if(n.equals(h[0])&&i.equals(h[1]))return l}return null},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr},cr.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Ei=function(){this._geometryFactory=null,this._shellList=new nt;var n=arguments[0];this._geometryFactory=n};Ei.prototype.sortShellsAndHoles=function(n,i,s){for(var l=n.iterator();l.hasNext();){var h=l.next();h.isHole()?s.add(h):i.add(h)}},Ei.prototype.computePolygons=function(n){for(var i=new nt,s=n.iterator();s.hasNext();){var l=s.next().toPolygon(this._geometryFactory);i.add(l)}return i},Ei.prototype.placeFreeHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var l=s.next();if(l.getShell()===null){var h=this.findEdgeRingContaining(l,n);if(h===null)throw new Zo("unable to assign hole to a shell",l.getCoordinate(0));l.setShell(h)}}},Ei.prototype.buildMinimalEdgeRings=function(n,i,s){for(var l=new nt,h=n.iterator();h.hasNext();){var v=h.next();if(v.getMaxNodeDegree()>2){v.linkDirectedEdgesForMinimalEdgeRings();var S=v.buildMinimalRings(),R=this.findShell(S);R!==null?(this.placePolygonHoles(R,S),i.add(R)):s.addAll(S)}else l.add(v)}return l},Ei.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},Ei.prototype.buildMaximalEdgeRings=function(n){for(var i=new nt,s=n.iterator();s.hasNext();){var l=s.next();if(l.isInResult()&&l.getLabel().isArea()&&l.getEdgeRing()===null){var h=new Lf(l,this._geometryFactory);i.add(h),h.setInResult()}}return i},Ei.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var l=s.next();l.isHole()&&l.setShell(n)}},Ei.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Ei.prototype.findEdgeRingContaining=function(n,i){for(var s=n.getLinearRing(),l=s.getEnvelopeInternal(),h=s.getCoordinateN(0),v=null,S=null,R=i.iterator();R.hasNext();){var V=R.next(),ot=V.getLinearRing(),St=ot.getEnvelopeInternal();v!==null&&(S=v.getLinearRing().getEnvelopeInternal());var bt=!1;St.contains(l)&&rt.isPointInRing(h,ot.getCoordinates())&&(bt=!0),bt&&(v===null||S.contains(St))&&(v=V)}return v},Ei.prototype.findShell=function(n){for(var i=0,s=null,l=n.iterator();l.hasNext();){var h=l.next();h.isHole()||(s=h,i++)}return kt.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},Ei.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];cr.linkResultDirectedEdges(s);var l=this.buildMaximalEdgeRings(i),h=new nt,v=this.buildMinimalEdgeRings(l,this._shellList,h);this.sortShellsAndHoles(v,this._shellList,h),this.placeFreeHoles(this._shellList,h)}},Ei.prototype.interfaces_=function(){return[]},Ei.prototype.getClass=function(){return Ei};var jn=function(){};jn.prototype.getBounds=function(){},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn};var Xe=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};Xe.prototype.getItem=function(){return this._item},Xe.prototype.getBounds=function(){return this._bounds},Xe.prototype.interfaces_=function(){return[jn,t]},Xe.prototype.getClass=function(){return Xe};var hs=function(){this._size=null,this._items=null,this._size=0,this._items=new nt,this._items.add(null)};hs.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},hs.prototype.size=function(){return this._size},hs.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)},hs.prototype.clear=function(){this._size=0,this._items.clear()},hs.prototype.isEmpty=function(){return this._size===0},hs.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)},hs.prototype.interfaces_=function(){return[]},hs.prototype.getClass=function(){return hs};var Rs=function(){};Rs.prototype.visitItem=function(n){},Rs.prototype.interfaces_=function(){return[]},Rs.prototype.getClass=function(){return Rs};var Ea=function(){};Ea.prototype.insert=function(n,i){},Ea.prototype.remove=function(n,i){},Ea.prototype.query=function(){},Ea.prototype.interfaces_=function(){return[]},Ea.prototype.getClass=function(){return Ea};var Ar=function(){if(this._childBoundables=new nt,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},Nf={serialVersionUID:{configurable:!0}};Ar.prototype.getLevel=function(){return this._level},Ar.prototype.size=function(){return this._childBoundables.size()},Ar.prototype.getChildBoundables=function(){return this._childBoundables},Ar.prototype.addChildBoundable=function(n){kt.isTrue(this._bounds===null),this._childBoundables.add(n)},Ar.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Ar.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Ar.prototype.interfaces_=function(){return[jn,t]},Ar.prototype.getClass=function(){return Ar},Nf.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Ar,Nf);var uo=function(){};uo.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},uo.min=function(n){return uo.sort(n),n.get(0)},uo.sort=function(n,i){var s=n.toArray();i?er.sort(s,i):er.sort(s);for(var l=n.iterator(),h=0,v=s.length;h<v;h++)l.next(),l.set(s[h])},uo.singletonList=function(n){var i=new nt;return i.add(n),i};var _r=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()};_r.prototype.expandToQueue=function(n,i){var s=_r.isComposite(this._boundable1),l=_r.isComposite(this._boundable2);if(s&&l)return _r.area(this._boundable1)>_r.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,n,i),null):(this.expand(this._boundable2,this._boundable1,n,i),null);if(s)return this.expand(this._boundable1,this._boundable2,n,i),null;if(l)return this.expand(this._boundable2,this._boundable1,n,i),null;throw new N("neither boundable is composite")},_r.prototype.isLeaves=function(){return!(_r.isComposite(this._boundable1)||_r.isComposite(this._boundable2))},_r.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},_r.prototype.expand=function(n,i,s,l){for(var h=n.getChildBoundables().iterator();h.hasNext();){var v=h.next(),S=new _r(v,i,this._itemDistance);S.getDistance()<l&&s.add(S)}},_r.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},_r.prototype.getDistance=function(){return this._distance},_r.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},_r.prototype.interfaces_=function(){return[z]},_r.prototype.getClass=function(){return _r},_r.area=function(n){return n.getBounds().getArea()},_r.isComposite=function(n){return n instanceof Ar};var Fr=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new nt,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];kt.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},Ur={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Fr.prototype.getNodeCapacity=function(){return this._nodeCapacity},Fr.prototype.lastNode=function(n){return n.get(n.size()-1)},Fr.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 Ar?n+=this.size(s):s instanceof Xe&&(n+=1)}return n}},Fr.prototype.removeItem=function(n,i){for(var s=null,l=n.getChildBoundables().iterator();l.hasNext();){var h=l.next();h instanceof Xe&&h.getItem()===i&&(s=h)}return s!==null&&(n.getChildBoundables().remove(s),!0)},Fr.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new nt:n}if(arguments.length===1){for(var i=arguments[0],s=new nt,l=i.getChildBoundables().iterator();l.hasNext();){var h=l.next();if(h instanceof Ar){var v=this.itemsTree(h);v!==null&&s.add(v)}else h instanceof Xe?s.add(h.getItem()):kt.shouldNeverReachHere()}return s.size()<=0?null:s}},Fr.prototype.insert=function(n,i){kt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Xe(n,i))},Fr.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new nt;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];if(kt.isTrue(s>-2),l.getLevel()===s)return h.add(l),null;for(var v=l.getChildBoundables().iterator();v.hasNext();){var S=v.next();S instanceof Ar?this.boundablesAtLevel(s,S,h):(kt.isTrue(S instanceof Xe),s===-1&&h.add(S))}return null}},Fr.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new nt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i),i}if(arguments.length===2){var s=arguments[0],l=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,l)}else if(arguments.length===3){if(et(arguments[2],Rs)&&arguments[0]instanceof Object&&arguments[1]instanceof Ar)for(var h=arguments[0],v=arguments[1],S=arguments[2],R=v.getChildBoundables(),V=0;V<R.size();V++){var ot=R.get(V);this.getIntersectsOp().intersects(ot.getBounds(),h)&&(ot instanceof Ar?this.query(h,ot,S):ot instanceof Xe?S.visitItem(ot.getItem()):kt.shouldNeverReachHere())}else if(et(arguments[2],ut)&&arguments[0]instanceof Object&&arguments[1]instanceof Ar)for(var St=arguments[0],bt=arguments[1],Yt=arguments[2],Jt=bt.getChildBoundables(),se=0;se<Jt.size();se++){var _e=Jt.get(se);this.getIntersectsOp().intersects(_e.getBounds(),St)&&(_e instanceof Ar?this.query(St,_e,Yt):_e instanceof Xe?Yt.add(_e.getItem()):kt.shouldNeverReachHere())}}},Fr.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},Fr.prototype.getRoot=function(){return this.build(),this._root},Fr.prototype.remove=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,i)}if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2],v=this.removeItem(l,h);if(v)return!0;for(var S=null,R=l.getChildBoundables().iterator();R.hasNext();){var V=R.next();if(this.getIntersectsOp().intersects(V.getBounds(),s)&&V instanceof Ar&&(v=this.remove(s,V,h))){S=V;break}}return S!==null&&S.getChildBoundables().isEmpty()&&l.getChildBoundables().remove(S),v}},Fr.prototype.createHigherLevels=function(n,i){kt.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},Fr.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 Ar){var l=this.depth(s);l>n&&(n=l)}}return n+1}},Fr.prototype.createParentBoundables=function(n,i){kt.isTrue(!n.isEmpty());var s=new nt;s.add(this.createNode(i));var l=new nt(n);uo.sort(l,this.getComparator());for(var h=l.iterator();h.hasNext();){var v=h.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(i)),this.lastNode(s).addChildBoundable(v)}return s},Fr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Fr.prototype.interfaces_=function(){return[t]},Fr.prototype.getClass=function(){return Fr},Fr.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},Ur.IntersectsOp.get=function(){return Pc},Ur.serialVersionUID.get=function(){return-3886435814360241e3},Ur.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Fr,Ur);var Pc=function(){},Ao=function(){};Ao.prototype.distance=function(n,i){},Ao.prototype.interfaces_=function(){return[]},Ao.prototype.getClass=function(){return Ao};var Ic=function(n){function i(l){l=l||i.DEFAULT_NODE_CAPACITY,n.call(this,l)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return i.prototype.createParentBoundablesFromVerticalSlices=function(l,h){kt.isTrue(l.length>0);for(var v=new nt,S=0;S<l.length;S++)v.addAll(this.createParentBoundablesFromVerticalSlice(l[S],h));return v},i.prototype.createNode=function(l){return new vl(l)},i.prototype.size=function(){return arguments.length===0?n.prototype.size.call(this):n.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return n.prototype.insert.apply(this,arguments);var l=arguments[0],h=arguments[1];if(l.isNull())return null;n.prototype.insert.call(this,l,h)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(l,h){for(var v=Math.trunc(Math.ceil(l.size()/h)),S=new Array(h).fill(null),R=l.iterator(),V=0;V<h;V++){S[V]=new nt;for(var ot=0;R.hasNext()&&ot<v;){var St=R.next();S[V].add(St),ot++}}return S},i.prototype.query=function(){if(arguments.length===1){var l=arguments[0];return n.prototype.query.call(this,l)}if(arguments.length===2){var h=arguments[0],v=arguments[1];n.prototype.query.call(this,h,v)}else if(arguments.length===3){if(et(arguments[2],Rs)&&arguments[0]instanceof Object&&arguments[1]instanceof Ar){var S=arguments[0],R=arguments[1],V=arguments[2];n.prototype.query.call(this,S,R,V)}else if(et(arguments[2],ut)&&arguments[0]instanceof Object&&arguments[1]instanceof Ar){var ot=arguments[0],St=arguments[1],bt=arguments[2];n.prototype.query.call(this,ot,St,bt)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(l,h){return n.prototype.createParentBoundables.call(this,l,h)},i.prototype.remove=function(){if(arguments.length===2){var l=arguments[0],h=arguments[1];return n.prototype.remove.call(this,l,h)}return n.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?n.prototype.depth.call(this):n.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(l,h){kt.isTrue(!l.isEmpty());var v=Math.trunc(Math.ceil(l.size()/this.getNodeCapacity())),S=new nt(l);uo.sort(S,i.xComparator);var R=this.verticalSlices(S,Math.trunc(Math.ceil(Math.sqrt(v))));return this.createParentBoundablesFromVerticalSlices(R,h)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if(et(arguments[0],Ao)){var l=arguments[0],h=new _r(this.getRoot(),this.getRoot(),l);return this.nearestNeighbour(h)}if(arguments[0]instanceof _r){var v=arguments[0];return this.nearestNeighbour(v,A.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&et(arguments[1],Ao)){var S=arguments[0],R=arguments[1],V=new _r(this.getRoot(),S.getRoot(),R);return this.nearestNeighbour(V)}if(arguments[0]instanceof _r&&typeof arguments[1]=="number"){var ot=arguments[0],St=arguments[1],bt=null,Yt=new hs;for(Yt.add(ot);!Yt.isEmpty()&&St>0;){var Jt=Yt.poll(),se=Jt.getDistance();if(se>=St)break;Jt.isLeaves()?(St=se,bt=Jt):Jt.expandToQueue(Yt,St)}return[bt.getBoundable(0).getItem(),bt.getBoundable(1).getItem()]}}else if(arguments.length===3){var _e=arguments[0],Cn=arguments[1],Xn=arguments[2],ui=new Xe(_e,Cn),rs=new _r(this.getRoot(),ui,Xn);return this.nearestNeighbour(rs)[0]}},i.prototype.interfaces_=function(){return[Ea,t]},i.prototype.getClass=function(){return i},i.centreX=function(l){return i.avg(l.getMinX(),l.getMaxX())},i.avg=function(l,h){return(l+h)/2},i.centreY=function(l){return i.avg(l.getMinY(),l.getMaxY())},s.STRtreeNode.get=function(){return vl},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[q]},compare:function(l,h){return n.compareDoubles(i.centreX(l.getBounds()),i.centreX(h.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[q]},compare:function(l,h){return n.compareDoubles(i.centreY(l.getBounds()),i.centreY(h.getBounds()))}}},s.intersectsOp.get=function(){return{interfaces_:function(){return[n.IntersectsOp]},intersects:function(l,h){return l.intersects(h)}}},s.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,s),i}(Fr),vl=function(n){function i(){var s=arguments[0];n.call(this,s)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var s=null,l=this.getChildBoundables().iterator();l.hasNext();){var h=l.next();s===null?s=new Xt(h.getBounds()):s.expandToInclude(h.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Ar),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 l=ir.relativeSign(i.x,s.x),h=ir.relativeSign(i.y,s.y);switch(n){case 0:return ir.compareValue(l,h);case 1:return ir.compareValue(h,l);case 2:return ir.compareValue(h,-l);case 3:return ir.compareValue(-l,h);case 4:return ir.compareValue(-l,-h);case 5:return ir.compareValue(-h,-l);case 6:return ir.compareValue(-h,l);case 7:return ir.compareValue(l,-h)}return kt.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 ps=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];this._segString=n,this.coord=new D(i),this.segmentIndex=s,this._segmentOctant=l,this._isInterior=!i.equals2D(n.getCoordinate(s))};ps.prototype.getCoordinate=function(){return this.coord},ps.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},ps.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)},ps.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},ps.prototype.isInterior=function(){return this._isInterior},ps.prototype.interfaces_=function(){return[z]},ps.prototype.getClass=function(){return ps};var Qr=function(){this._nodeMap=new w,this._edge=null;var n=arguments[0];this._edge=n};Qr.prototype.getSplitCoordinates=function(){var n=new dt;this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var l=i.next();this.addEdgeCoordinates(s,l,n),s=l}return n.toCoordinateArray()},Qr.prototype.addCollapsedNodes=function(){var n=new nt;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)}},Qr.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},Qr.prototype.findCollapsesFromExistingVertices=function(n){for(var i=0;i<this._edge.size()-2;i++){var s=this._edge.getCoordinate(i),l=this._edge.getCoordinate(i+2);s.equals2D(l)&&n.add(new Et(i+1))}},Qr.prototype.addEdgeCoordinates=function(n,i,s){var l=this._edge.getCoordinate(i.segmentIndex),h=i.isInterior()||!i.coord.equals2D(l);s.add(new D(n.coord),!1);for(var v=n.segmentIndex+1;v<=i.segmentIndex;v++)s.add(this._edge.getCoordinate(v));h&&s.add(new D(i.coord))},Qr.prototype.iterator=function(){return this._nodeMap.values().iterator()},Qr.prototype.addSplitEdges=function(n){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),s=i.next();i.hasNext();){var l=i.next(),h=this.createSplitEdge(s,l);n.add(h),s=l}},Qr.prototype.findCollapseIndex=function(n,i,s){if(!n.coord.equals2D(i.coord))return!1;var l=i.segmentIndex-n.segmentIndex;return i.isInterior()||l--,l===1&&(s[0]=n.segmentIndex+1,!0)},Qr.prototype.findCollapsesFromInsertedNodes=function(n){for(var i=new Array(1).fill(null),s=this.iterator(),l=s.next();s.hasNext();){var h=s.next();this.findCollapseIndex(l,h,i)&&n.add(new Et(i[0])),l=h}},Qr.prototype.getEdge=function(){return this._edge},Qr.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},Qr.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,l=this._edge.getCoordinate(i.segmentIndex),h=i.isInterior()||!i.coord.equals2D(l);h||s--;var v=new Array(s).fill(null),S=0;v[S++]=new D(n.coord);for(var R=n.segmentIndex+1;R<=i.segmentIndex;R++)v[S++]=this._edge.getCoordinate(R);return h&&(v[S]=new D(i.coord)),new dr(v,this._edge.getData())},Qr.prototype.add=function(n,i){var s=new ps(this._edge,n,i,this._edge.getSegmentOctant(i)),l=this._nodeMap.get(s);return l!==null?(kt.isTrue(l.coord.equals2D(n),"Found equal nodes with different coordinates"),l):(this._nodeMap.put(s,s),s)},Qr.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new Ue("bad split edge start point at "+s);var l=n.get(n.size()-1).getCoordinates(),h=l[l.length-1];if(!h.equals2D(i[i.length-1]))throw new Ue("bad split edge end point at "+h)},Qr.prototype.interfaces_=function(){return[]},Qr.prototype.getClass=function(){return Qr};var Zs=function(){};Zs.prototype.interfaces_=function(){return[]},Zs.prototype.getClass=function(){return Zs},Zs.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 N("Cannot compute the octant for point ( "+n+", "+i+" )");var s=Math.abs(n),l=Math.abs(i);return n>=0?i>=0?s>=l?0:1:s>=l?7:6:i>=0?s>=l?3:2:s>=l?4:5}if(arguments[0]instanceof D&&arguments[1]instanceof D){var h=arguments[0],v=arguments[1],S=v.x-h.x,R=v.y-h.y;if(S===0&&R===0)throw new N("Cannot compute the octant for two identical points "+h);return Zs.octant(S,R)}};var Co=function(){};Co.prototype.getCoordinates=function(){},Co.prototype.size=function(){},Co.prototype.getCoordinate=function(n){},Co.prototype.isClosed=function(){},Co.prototype.setData=function(n){},Co.prototype.getData=function(){},Co.prototype.interfaces_=function(){return[]},Co.prototype.getClass=function(){return Co};var tu=function(){};tu.prototype.addIntersection=function(n,i){},tu.prototype.interfaces_=function(){return[Co]},tu.prototype.getClass=function(){return tu};var dr=function(){this._nodeList=new Qr(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};dr.prototype.getCoordinates=function(){return this._pts},dr.prototype.size=function(){return this._pts.length},dr.prototype.getCoordinate=function(n){return this._pts[n]},dr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},dr.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},dr.prototype.setData=function(n){this._data=n},dr.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:Zs.octant(n,i)},dr.prototype.getData=function(){return this._data},dr.prototype.addIntersection=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.addIntersectionNode(n,i)}else if(arguments.length===4){var s=arguments[0],l=arguments[1],h=arguments[3],v=new D(s.getIntersection(h));this.addIntersection(v,l)}},dr.prototype.toString=function(){return de.toLineString(new De(this._pts))},dr.prototype.getNodeList=function(){return this._nodeList},dr.prototype.addIntersectionNode=function(n,i){var s=i,l=s+1;if(l<this._pts.length){var h=this._pts[l];n.equals2D(h)&&(s=l)}return this._nodeList.add(n,s)},dr.prototype.addIntersections=function(n,i,s){for(var l=0;l<n.getIntersectionNum();l++)this.addIntersection(n,i,s,l)},dr.prototype.interfaces_=function(){return[tu]},dr.prototype.getClass=function(){return dr},dr.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new nt;return dr.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var s=arguments[0],l=arguments[1],h=s.iterator();h.hasNext();)h.next().getNodeList().addSplitEdges(l)};var ne=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new D,this.p1=new D;else if(arguments.length===1){var n=arguments[0];this.p0=new D(n.p0),this.p1=new D(n.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],s=arguments[1],l=arguments[2],h=arguments[3];this.p0=new D(i,s),this.p1=new D(l,h)}},Of={serialVersionUID:{configurable:!0}};ne.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},ne.prototype.orientationIndex=function(){if(arguments[0]instanceof ne){var n=arguments[0],i=rt.orientationIndex(this.p0,this.p1,n.p0),s=rt.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 D){var l=arguments[0];return rt.orientationIndex(this.p0,this.p1,l)}},ne.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},ne.prototype.isVertical=function(){return this.p0.x===this.p1.x},ne.prototype.equals=function(n){if(!(n instanceof ne))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},ne.prototype.intersection=function(n){var i=new $n;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},ne.prototype.project=function(){if(arguments[0]instanceof D){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new D(n);var i=this.projectionFactor(n),s=new D;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 ne){var l=arguments[0],h=this.projectionFactor(l.p0),v=this.projectionFactor(l.p1);if(h>=1&&v>=1||h<=0&&v<=0)return null;var S=this.project(l.p0);h<0&&(S=this.p0),h>1&&(S=this.p1);var R=this.project(l.p1);return v<0&&(R=this.p0),v>1&&(R=this.p1),new ne(S,R)}},ne.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},ne.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},ne.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},ne.prototype.distancePerpendicular=function(n){return rt.distancePointLinePerpendicular(n,this.p0,this.p1)},ne.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},ne.prototype.midPoint=function(){return ne.midPoint(this.p0,this.p1)},ne.prototype.projectionFactor=function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,l=i*i+s*s;return l<=0?A.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/l},ne.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),l=A.MAX_VALUE,h=null,v=this.closestPoint(n.p0);l=v.distance(n.p0),s[0]=v,s[1]=n.p0;var S=this.closestPoint(n.p1);(h=S.distance(n.p1))<l&&(l=h,s[0]=S,s[1]=n.p1);var R=n.closestPoint(this.p0);(h=R.distance(this.p0))<l&&(l=h,s[0]=this.p0,s[1]=R);var V=n.closestPoint(this.p1);return(h=V.distance(this.p1))<l&&(l=h,s[0]=this.p1,s[1]=V),s},ne.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},ne.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},ne.prototype.getLength=function(){return this.p0.distance(this.p1)},ne.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},ne.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},ne.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)},ne.prototype.lineIntersection=function(n){try{return me.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof le))throw i}return null},ne.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},ne.prototype.pointAlongOffset=function(n,i){var s=this.p0.x+n*(this.p1.x-this.p0.x),l=this.p0.y+n*(this.p1.y-this.p0.y),h=this.p1.x-this.p0.x,v=this.p1.y-this.p0.y,S=Math.sqrt(h*h+v*v),R=0,V=0;if(i!==0){if(S<=0)throw new Error("Cannot compute offset from zero-length line segment");R=i*h/S,V=i*v/S}return new D(s-V,l+R)},ne.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}},ne.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||A.isNaN(i))&&(i=1),i},ne.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},ne.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},ne.prototype.distance=function(){if(arguments[0]instanceof ne){var n=arguments[0];return rt.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof D){var i=arguments[0];return rt.distancePointLine(i,this.p0,this.p1)}},ne.prototype.pointAlong=function(n){var i=new D;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},ne.prototype.hashCode=function(){var n=A.doubleToLongBits(this.p0.x);n^=31*A.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=A.doubleToLongBits(this.p1.x);return s^=31*A.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},ne.prototype.interfaces_=function(){return[z,t]},ne.prototype.getClass=function(){return ne},ne.midPoint=function(n,i){return new D((n.x+i.x)/2,(n.y+i.y)/2)},Of.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(ne,Of);var wi=function(){this.tempEnv1=new Xt,this.tempEnv2=new Xt,this._overlapSeg1=new ne,this._overlapSeg2=new ne};wi.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];n.getLineSegment(i,this._overlapSeg1),s.getLineSegment(l,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},wi.prototype.interfaces_=function(){return[]},wi.prototype.getClass=function(){return wi};var Mi=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];this._pts=n,this._start=i,this._end=s,this._context=l};Mi.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},Mi.prototype.computeSelect=function(n,i,s,l){var h=this._pts[i],v=this._pts[s];if(l.tempEnv1.init(h,v),s-i==1)return l.select(this,i),null;if(!n.intersects(l.tempEnv1))return null;var S=Math.trunc((i+s)/2);i<S&&this.computeSelect(n,i,S,l),S<s&&this.computeSelect(n,S,s,l)},Mi.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},Mi.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},Mi.prototype.setId=function(n){this._id=n},Mi.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},Mi.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new Xt(n,i)}return this._env},Mi.prototype.getEndIndex=function(){return this._end},Mi.prototype.getStartIndex=function(){return this._start},Mi.prototype.getContext=function(){return this._context},Mi.prototype.getId=function(){return this._id},Mi.prototype.computeOverlapsInternal=function(n,i,s,l,h,v){var S=this._pts[n],R=this._pts[i],V=s._pts[l],ot=s._pts[h];if(i-n==1&&h-l==1)return v.overlap(this,n,s,l),null;if(v.tempEnv1.init(S,R),v.tempEnv2.init(V,ot),!v.tempEnv1.intersects(v.tempEnv2))return null;var St=Math.trunc((n+i)/2),bt=Math.trunc((l+h)/2);n<St&&(l<bt&&this.computeOverlapsInternal(n,St,s,l,bt,v),bt<h&&this.computeOverlapsInternal(n,St,s,bt,h,v)),St<i&&(l<bt&&this.computeOverlapsInternal(St,i,s,l,bt,v),bt<h&&this.computeOverlapsInternal(St,i,s,bt,h,v))},Mi.prototype.interfaces_=function(){return[]},Mi.prototype.getClass=function(){return Mi};var lo=function(){};lo.prototype.interfaces_=function(){return[]},lo.prototype.getClass=function(){return lo},lo.getChainStartIndices=function(n){var i=0,s=new nt;s.add(new Et(i));do{var l=lo.findChainEnd(n,i);s.add(new Et(l)),i=l}while(i<n.length-1);return lo.toIntArray(s)},lo.findChainEnd=function(n,i){for(var s=i;s<n.length-1&&n[s].equals2D(n[s+1]);)s++;if(s>=n.length-1)return n.length-1;for(var l=kn.quadrant(n[s],n[s+1]),h=i+1;h<n.length&&!(!n[h-1].equals2D(n[h])&&kn.quadrant(n[h-1],n[h])!==l);)h++;return h-1},lo.getChains=function(){if(arguments.length===1){var n=arguments[0];return lo.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],l=new nt,h=lo.getChainStartIndices(i),v=0;v<h.length-1;v++){var S=new Mi(i,h[v],h[v+1],s);l.add(S)}return l}},lo.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 zi=function(){};zi.prototype.computeNodes=function(n){},zi.prototype.getNodedSubstrings=function(){},zi.prototype.interfaces_=function(){return[]},zi.prototype.getClass=function(){return zi};var Js=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};Js.prototype.setSegmentIntersector=function(n){this._segInt=n},Js.prototype.interfaces_=function(){return[zi]},Js.prototype.getClass=function(){return Js};var zu=function(n){function i(l){l?n.call(this,l):n.call(this),this._monoChains=new nt,this._index=new Ic,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 dr.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(l){for(var h=lo.getChains(l.getCoordinates(),l).iterator();h.hasNext();){var v=h.next();v.setId(this._idCounter++),this._index.insert(v.getEnvelope(),v),this._monoChains.add(v)}},i.prototype.computeNodes=function(l){this._nodedSegStrings=l;for(var h=l.iterator();h.hasNext();)this.add(h.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var l=new xr(this._segInt),h=this._monoChains.iterator();h.hasNext();)for(var v=h.next(),S=this._index.query(v.getEnvelope()).iterator();S.hasNext();){var R=S.next();if(R.getId()>v.getId()&&(v.computeOverlaps(R,l),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.SegmentOverlapAction.get=function(){return xr},Object.defineProperties(i,s),i}(Js),xr=function(n){function i(){n.call(this),this._si=null;var s=arguments[0];this._si=s}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return n.prototype.overlap.apply(this,arguments);var s=arguments[0],l=arguments[1],h=arguments[2],v=arguments[3],S=s.getContext(),R=h.getContext();this._si.processIntersections(S,l,R,v)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(wi),Fe=function n(){if(this._quadrantSegments=n.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=n.CAP_ROUND,this._joinStyle=n.JOIN_ROUND,this._mitreLimit=n.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=n.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.setQuadrantSegments(s),this.setEndCapStyle(l)}else if(arguments.length===4){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3];this.setQuadrantSegments(h),this.setEndCapStyle(v),this.setJoinStyle(S),this.setMitreLimit(R)}}},Po={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Fe.prototype.getEndCapStyle=function(){return this._endCapStyle},Fe.prototype.isSingleSided=function(){return this._isSingleSided},Fe.prototype.setQuadrantSegments=function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=Fe.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Fe.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==Fe.JOIN_ROUND&&(this._quadrantSegments=Fe.DEFAULT_QUADRANT_SEGMENTS)},Fe.prototype.getJoinStyle=function(){return this._joinStyle},Fe.prototype.setJoinStyle=function(n){this._joinStyle=n},Fe.prototype.setSimplifyFactor=function(n){this._simplifyFactor=n<0?0:n},Fe.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Fe.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Fe.prototype.setEndCapStyle=function(n){this._endCapStyle=n},Fe.prototype.getMitreLimit=function(){return this._mitreLimit},Fe.prototype.setMitreLimit=function(n){this._mitreLimit=n},Fe.prototype.setSingleSided=function(n){this._isSingleSided=n},Fe.prototype.interfaces_=function(){return[]},Fe.prototype.getClass=function(){return Fe},Fe.bufferDistanceError=function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)},Po.CAP_ROUND.get=function(){return 1},Po.CAP_FLAT.get=function(){return 2},Po.CAP_SQUARE.get=function(){return 3},Po.JOIN_ROUND.get=function(){return 1},Po.JOIN_MITRE.get=function(){return 2},Po.JOIN_BEVEL.get=function(){return 3},Po.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Po.DEFAULT_MITRE_LIMIT.get=function(){return 5},Po.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(Fe,Po);var gr=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=rt.COUNTERCLOCKWISE,this._inputLine=n||null},wa={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};gr.prototype.isDeletable=function(n,i,s,l){var h=this._inputLine[n],v=this._inputLine[i],S=this._inputLine[s];return!!this.isConcave(h,v,S)&&!!this.isShallow(h,v,S,l)&&this.isShallowSampled(h,v,n,s,l)},gr.prototype.deleteShallowConcavities=function(){for(var n=1,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i),l=!1;s<this._inputLine.length;){var h=!1;this.isDeletable(n,i,s,this._distanceTol)&&(this._isDeleted[i]=gr.DELETE,h=!0,l=!0),n=h?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return l},gr.prototype.isShallowConcavity=function(n,i,s,l){return rt.computeOrientation(n,i,s)!==this._angleOrientation?!1:rt.distancePointLine(i,n,s)<l},gr.prototype.isShallowSampled=function(n,i,s,l,h){var v=Math.trunc((l-s)/gr.NUM_PTS_TO_CHECK);v<=0&&(v=1);for(var S=s;S<l;S+=v)if(!this.isShallow(n,i,this._inputLine[S],h))return!1;return!0},gr.prototype.isConcave=function(n,i,s){var l=rt.computeOrientation(n,i,s)===this._angleOrientation;return l},gr.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=rt.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},gr.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===gr.DELETE;)i++;return i},gr.prototype.isShallow=function(n,i,s,l){return rt.distancePointLine(i,n,s)<l},gr.prototype.collapseLine=function(){for(var n=new dt,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==gr.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},gr.prototype.interfaces_=function(){return[]},gr.prototype.getClass=function(){return gr},gr.simplify=function(n,i){return new gr(n).simplify(i)},wa.INIT.get=function(){return 0},wa.DELETE.get=function(){return 1},wa.KEEP.get=function(){return 1},wa.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(gr,wa);var Gi=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new nt},Df={COORDINATE_ARRAY_TYPE:{configurable:!0}};Gi.prototype.getCoordinates=function(){return this._ptList.toArray(Gi.COORDINATE_ARRAY_TYPE)},Gi.prototype.setPrecisionModel=function(n){this._precisionModel=n},Gi.prototype.addPt=function(n){var i=new D(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},Gi.prototype.revere=function(){},Gi.prototype.addPts=function(n,i){if(i)for(var s=0;s<n.length;s++)this.addPt(n[s]);else for(var l=n.length-1;l>=0;l--)this.addPt(n[l])},Gi.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},Gi.prototype.toString=function(){return new Ce().createLineString(this.getCoordinates()).toString()},Gi.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new D(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},Gi.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},Gi.prototype.interfaces_=function(){return[]},Gi.prototype.getClass=function(){return Gi},Df.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Gi,Df);var Ge=function(){},Ks={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};Ge.prototype.interfaces_=function(){return[]},Ge.prototype.getClass=function(){return Ge},Ge.toDegrees=function(n){return 180*n/Math.PI},Ge.normalize=function(n){for(;n>Math.PI;)n-=Ge.PI_TIMES_2;for(;n<=-Math.PI;)n+=Ge.PI_TIMES_2;return n},Ge.angle=function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var i=arguments[0],s=arguments[1],l=s.x-i.x,h=s.y-i.y;return Math.atan2(h,l)}},Ge.isAcute=function(n,i,s){var l=n.x-i.x,h=n.y-i.y;return l*(s.x-i.x)+h*(s.y-i.y)>0},Ge.isObtuse=function(n,i,s){var l=n.x-i.x,h=n.y-i.y;return l*(s.x-i.x)+h*(s.y-i.y)<0},Ge.interiorAngle=function(n,i,s){var l=Ge.angle(i,n),h=Ge.angle(i,s);return Math.abs(h-l)},Ge.normalizePositive=function(n){if(n<0){for(;n<0;)n+=Ge.PI_TIMES_2;n>=Ge.PI_TIMES_2&&(n=0)}else{for(;n>=Ge.PI_TIMES_2;)n-=Ge.PI_TIMES_2;n<0&&(n=0)}return n},Ge.angleBetween=function(n,i,s){var l=Ge.angle(i,n),h=Ge.angle(i,s);return Ge.diff(l,h)},Ge.diff=function(n,i){var s=null;return(s=n<i?i-n:n-i)>Math.PI&&(s=2*Math.PI-s),s},Ge.toRadians=function(n){return n*Math.PI/180},Ge.getTurn=function(n,i){var s=Math.sin(i-n);return s>0?Ge.COUNTERCLOCKWISE:s<0?Ge.CLOCKWISE:Ge.NONE},Ge.angleBetweenOriented=function(n,i,s){var l=Ge.angle(i,n),h=Ge.angle(i,s)-l;return h<=-Math.PI?h+Ge.PI_TIMES_2:h>Math.PI?h-Ge.PI_TIMES_2:h},Ks.PI_TIMES_2.get=function(){return 2*Math.PI},Ks.PI_OVER_2.get=function(){return Math.PI/2},Ks.PI_OVER_4.get=function(){return Math.PI/4},Ks.COUNTERCLOCKWISE.get=function(){return rt.COUNTERCLOCKWISE},Ks.CLOCKWISE.get=function(){return rt.CLOCKWISE},Ks.NONE.get=function(){return rt.COLLINEAR},Object.defineProperties(Ge,Ks);var qn=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 ne,this._seg1=new ne,this._offset0=new ne,this._offset1=new ne,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],s=arguments[1],l=arguments[2];this._precisionModel=i,this._bufParams=s,this._li=new $n,this._filletAngleQuantum=Math.PI/2/s.getQuadrantSegments(),s.getQuadrantSegments()>=8&&s.getJoinStyle()===Fe.JOIN_ROUND&&(this._closingSegLengthFactor=n.MAX_CLOSING_SEG_LEN_FACTOR),this.init(l)},ds={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}};qn.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=rt.computeOrientation(this._s0,this._s1,this._s2),l=s===rt.CLOCKWISE&&this._side===Ht.LEFT||s===rt.COUNTERCLOCKWISE&&this._side===Ht.RIGHT;s===0?this.addCollinear(i):l?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},qn.prototype.addLineEndCap=function(n,i){var s=new ne(n,i),l=new ne;this.computeOffsetSegment(s,Ht.LEFT,this._distance,l);var h=new ne;this.computeOffsetSegment(s,Ht.RIGHT,this._distance,h);var v=i.x-n.x,S=i.y-n.y,R=Math.atan2(S,v);switch(this._bufParams.getEndCapStyle()){case Fe.CAP_ROUND:this._segList.addPt(l.p1),this.addFilletArc(i,R+Math.PI/2,R-Math.PI/2,rt.CLOCKWISE,this._distance),this._segList.addPt(h.p1);break;case Fe.CAP_FLAT:this._segList.addPt(l.p1),this._segList.addPt(h.p1);break;case Fe.CAP_SQUARE:var V=new D;V.x=Math.abs(this._distance)*Math.cos(R),V.y=Math.abs(this._distance)*Math.sin(R);var ot=new D(l.p1.x+V.x,l.p1.y+V.y),St=new D(h.p1.x+V.x,h.p1.y+V.y);this._segList.addPt(ot),this._segList.addPt(St)}},qn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},qn.prototype.addMitreJoin=function(n,i,s,l){var h=!0,v=null;try{v=me.intersection(i.p0,i.p1,s.p0,s.p1),(l<=0?1:v.distance(n)/Math.abs(l))>this._bufParams.getMitreLimit()&&(h=!1)}catch(S){if(!(S instanceof le))throw S;v=new D(0,0),h=!1}h?this._segList.addPt(v):this.addLimitedMitreJoin(i,s,l,this._bufParams.getMitreLimit())},qn.prototype.addFilletCorner=function(n,i,s,l,h){var v=i.x-n.x,S=i.y-n.y,R=Math.atan2(S,v),V=s.x-n.x,ot=s.y-n.y,St=Math.atan2(ot,V);l===rt.CLOCKWISE?R<=St&&(R+=2*Math.PI):R>=St&&(R-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,R,St,l,h),this._segList.addPt(s)},qn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*qn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Fe.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Fe.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(i&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))},qn.prototype.createSquare=function(n){this._segList.addPt(new D(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new D(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new D(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new D(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},qn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},qn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},qn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},qn.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)},qn.prototype.addLimitedMitreJoin=function(n,i,s,l){var h=this._seg0.p1,v=Ge.angle(h,this._seg0.p0),S=Ge.angleBetweenOriented(this._seg0.p0,h,this._seg1.p1)/2,R=Ge.normalize(v+S),V=Ge.normalize(R+Math.PI),ot=l*s,St=s-ot*Math.abs(Math.sin(S)),bt=h.x+ot*Math.cos(V),Yt=h.y+ot*Math.sin(V),Jt=new D(bt,Yt),se=new ne(h,Jt),_e=se.pointAlongOffset(1,St),Cn=se.pointAlongOffset(1,-St);this._side===Ht.LEFT?(this._segList.addPt(_e),this._segList.addPt(Cn)):(this._segList.addPt(Cn),this._segList.addPt(_e))},qn.prototype.computeOffsetSegment=function(n,i,s,l){var h=i===Ht.LEFT?1:-1,v=n.p1.x-n.p0.x,S=n.p1.y-n.p0.y,R=Math.sqrt(v*v+S*S),V=h*s*v/R,ot=h*s*S/R;l.p0.x=n.p0.x-ot,l.p0.y=n.p0.y+V,l.p1.x=n.p1.x-ot,l.p1.y=n.p1.y+V},qn.prototype.addFilletArc=function(n,i,s,l,h){var v=l===rt.CLOCKWISE?-1:1,S=Math.abs(i-s),R=Math.trunc(S/this._filletAngleQuantum+.5);if(R<1)return null;for(var V=S/R,ot=0,St=new D;ot<S;){var bt=i+v*ot;St.x=n.x+h*Math.cos(bt),St.y=n.y+h*Math.sin(bt),this._segList.addPt(St),ot+=V}},qn.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*qn.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 D((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s);var l=new D((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(l)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},qn.prototype.createCircle=function(n){var i=new D(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},qn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},qn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Gi,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*qn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},qn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Fe.JOIN_BEVEL||this._bufParams.getJoinStyle()===Fe.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,rt.CLOCKWISE,this._distance))},qn.prototype.closeRing=function(){this._segList.closeRing()},qn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn},ds.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},ds.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},ds.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},ds.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(qn,ds);var hi=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};hi.prototype.getOffsetCurve=function(n,i){if(this._distance=i,i===0)return null;var s=i<0,l=Math.abs(i),h=this.getSegGen(l);n.length<=1?this.computePointCurve(n[0],h):this.computeOffsetCurve(n,s,h);var v=h.getCoordinates();return s&&at.reverse(v),v},hi.prototype.computeSingleSidedBufferCurve=function(n,i,s){var l=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var h=gr.simplify(n,-l),v=h.length-1;s.initSideSegments(h[v],h[v-1],Ht.LEFT),s.addFirstSegment();for(var S=v-2;S>=0;S--)s.addNextSegment(h[S],!0)}else{s.addSegments(n,!1);var R=gr.simplify(n,l),V=R.length-1;s.initSideSegments(R[0],R[1],Ht.LEFT),s.addFirstSegment();for(var ot=2;ot<=V;ot++)s.addNextSegment(R[ot],!0)}s.addLastSegment(),s.closeRing()},hi.prototype.computeRingBufferCurve=function(n,i,s){var l=this.simplifyTolerance(this._distance);i===Ht.RIGHT&&(l=-l);var h=gr.simplify(n,l),v=h.length-1;s.initSideSegments(h[v-1],h[0],i);for(var S=1;S<=v;S++){var R=S!==1;s.addNextSegment(h[S],R)}s.closeRing()},hi.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),l=gr.simplify(n,s),h=l.length-1;i.initSideSegments(l[0],l[1],Ht.LEFT);for(var v=2;v<=h;v++)i.addNextSegment(l[v],!0);i.addLastSegment(),i.addLineEndCap(l[h-1],l[h]);var S=gr.simplify(n,-s),R=S.length-1;i.initSideSegments(S[R],S[R-1],Ht.LEFT);for(var V=R-2;V>=0;V--)i.addNextSegment(S[V],!0);i.addLastSegment(),i.addLineEndCap(S[1],S[0]),i.closeRing()},hi.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case Fe.CAP_ROUND:i.createCircle(n);break;case Fe.CAP_SQUARE:i.createSquare(n)}},hi.prototype.getLineCurve=function(n,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var s=Math.abs(i),l=this.getSegGen(s);if(n.length<=1)this.computePointCurve(n[0],l);else if(this._bufParams.isSingleSided()){var h=i<0;this.computeSingleSidedBufferCurve(n,h,l)}else this.computeLineBufferCurve(n,l);return l.getCoordinates()},hi.prototype.getBufferParameters=function(){return this._bufParams},hi.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},hi.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return hi.copyCoordinates(n);var l=this.getSegGen(s);return this.computeRingBufferCurve(n,i,l),l.getCoordinates()},hi.prototype.computeOffsetCurve=function(n,i,s){var l=this.simplifyTolerance(this._distance);if(i){var h=gr.simplify(n,-l),v=h.length-1;s.initSideSegments(h[v],h[v-1],Ht.LEFT),s.addFirstSegment();for(var S=v-2;S>=0;S--)s.addNextSegment(h[S],!0)}else{var R=gr.simplify(n,l),V=R.length-1;s.initSideSegments(R[0],R[1],Ht.LEFT),s.addFirstSegment();for(var ot=2;ot<=V;ot++)s.addNextSegment(R[ot],!0)}s.addLastSegment()},hi.prototype.getSegGen=function(n){return new qn(this._precisionModel,this._bufParams,n)},hi.prototype.interfaces_=function(){return[]},hi.prototype.getClass=function(){return hi},hi.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new D(n[s]);return i};var Qs=function(){this._subgraphs=null,this._seg=new ne,this._cga=new rt;var n=arguments[0];this._subgraphs=n},Rc={DepthSegment:{configurable:!0}};Qs.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new nt,s=this._subgraphs.iterator();s.hasNext();){var l=s.next(),h=l.getEnvelope();n.y<h.getMinY()||n.y>h.getMaxY()||this.findStabbedSegments(n,l.getDirectedEdges(),i)}return i}if(arguments.length===3){if(et(arguments[2],ut)&&arguments[0]instanceof D&&arguments[1]instanceof Cc){for(var v=arguments[0],S=arguments[1],R=arguments[2],V=S.getEdge().getCoordinates(),ot=0;ot<V.length-1;ot++)if(this._seg.p0=V[ot],this._seg.p1=V[ot+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<v.x)&&!(this._seg.isHorizontal()||v.y<this._seg.p0.y||v.y>this._seg.p1.y||rt.computeOrientation(this._seg.p0,this._seg.p1,v)===rt.RIGHT)){var St=S.getDepth(Ht.LEFT);this._seg.p0.equals(V[ot])||(St=S.getDepth(Ht.RIGHT));var bt=new gs(this._seg,St);R.add(bt)}}else if(et(arguments[2],ut)&&arguments[0]instanceof D&&et(arguments[1],ut))for(var Yt=arguments[0],Jt=arguments[1],se=arguments[2],_e=Jt.iterator();_e.hasNext();){var Cn=_e.next();Cn.isForward()&&this.findStabbedSegments(Yt,Cn,se)}}},Qs.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:uo.min(i)._leftDepth},Qs.prototype.interfaces_=function(){return[]},Qs.prototype.getClass=function(){return Qs},Rc.DepthSegment.get=function(){return gs},Object.defineProperties(Qs,Rc);var gs=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new ne(n),this._leftDepth=i};gs.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)},gs.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},gs.prototype.toString=function(){return this._upwardSeg.toString()},gs.prototype.interfaces_=function(){return[z]},gs.prototype.getClass=function(){return gs};var We=function(n,i,s){this.p0=n||null,this.p1=i||null,this.p2=s||null};We.prototype.area=function(){return We.area(this.p0,this.p1,this.p2)},We.prototype.signedArea=function(){return We.signedArea(this.p0,this.p1,this.p2)},We.prototype.interpolateZ=function(n){if(n===null)throw new N("Supplied point is null.");return We.interpolateZ(n,this.p0,this.p1,this.p2)},We.prototype.longestSideLength=function(){return We.longestSideLength(this.p0,this.p1,this.p2)},We.prototype.isAcute=function(){return We.isAcute(this.p0,this.p1,this.p2)},We.prototype.circumcentre=function(){return We.circumcentre(this.p0,this.p1,this.p2)},We.prototype.area3D=function(){return We.area3D(this.p0,this.p1,this.p2)},We.prototype.centroid=function(){return We.centroid(this.p0,this.p1,this.p2)},We.prototype.inCentre=function(){return We.inCentre(this.p0,this.p1,this.p2)},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We},We.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)},We.signedArea=function(n,i,s){return((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2},We.det=function(n,i,s,l){return n*l-i*s},We.interpolateZ=function(n,i,s,l){var h=i.x,v=i.y,S=s.x-h,R=l.x-h,V=s.y-v,ot=l.y-v,St=S*ot-R*V,bt=n.x-h,Yt=n.y-v,Jt=(ot*bt-R*Yt)/St,se=(-V*bt+S*Yt)/St;return i.z+Jt*(s.z-i.z)+se*(l.z-i.z)},We.longestSideLength=function(n,i,s){var l=n.distance(i),h=i.distance(s),v=s.distance(n),S=l;return h>S&&(S=h),v>S&&(S=v),S},We.isAcute=function(n,i,s){return!!Ge.isAcute(n,i,s)&&!!Ge.isAcute(i,s,n)&&!!Ge.isAcute(s,n,i)},We.circumcentre=function(n,i,s){var l=s.x,h=s.y,v=n.x-l,S=n.y-h,R=i.x-l,V=i.y-h,ot=2*We.det(v,S,R,V),St=We.det(S,v*v+S*S,V,R*R+V*V),bt=We.det(v,v*v+S*S,R,R*R+V*V);return new D(l-St/ot,h+bt/ot)},We.perpendicularBisector=function(n,i){var s=i.x-n.x,l=i.y-n.y,h=new me(n.x+s/2,n.y+l/2,1),v=new me(n.x-l+s/2,n.y+s+l/2,1);return new me(h,v)},We.angleBisector=function(n,i,s){var l=i.distance(n),h=l/(l+i.distance(s)),v=s.x-n.x,S=s.y-n.y;return new D(n.x+h*v,n.y+h*S)},We.area3D=function(n,i,s){var l=i.x-n.x,h=i.y-n.y,v=i.z-n.z,S=s.x-n.x,R=s.y-n.y,V=s.z-n.z,ot=h*V-v*R,St=v*S-l*V,bt=l*R-h*S,Yt=ot*ot+St*St+bt*bt,Jt=Math.sqrt(Yt)/2;return Jt},We.centroid=function(n,i,s){var l=(n.x+i.x+s.x)/3,h=(n.y+i.y+s.y)/3;return new D(l,h)},We.inCentre=function(n,i,s){var l=i.distance(s),h=n.distance(s),v=n.distance(i),S=l+h+v,R=(l*n.x+h*i.x+v*s.x)/S,V=(l*n.y+h*i.y+v*s.y)/S;return new D(R,V)};var ki=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new nt;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};ki.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,Z.EXTERIOR,Z.INTERIOR)},ki.prototype.addPolygon=function(n){var i=this._distance,s=Ht.LEFT;this._distance<0&&(i=-this._distance,s=Ht.RIGHT);var l=n.getExteriorRing(),h=at.removeRepeatedPoints(l.getCoordinates());if(this._distance<0&&this.isErodedCompletely(l,this._distance)||this._distance<=0&&h.length<3)return null;this.addPolygonRing(h,i,s,Z.EXTERIOR,Z.INTERIOR);for(var v=0;v<n.getNumInteriorRing();v++){var S=n.getInteriorRingN(v),R=at.removeRepeatedPoints(S.getCoordinates());this._distance>0&&this.isErodedCompletely(S,-this._distance)||this.addPolygonRing(R,i,Ht.opposite(s),Z.INTERIOR,Z.EXTERIOR)}},ki.prototype.isTriangleErodedCompletely=function(n,i){var s=new We(n[0],n[1],n[2]),l=s.inCentre();return rt.distancePointLine(l,s.p0,s.p1)<Math.abs(i)},ki.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=at.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,Z.EXTERIOR,Z.INTERIOR)},ki.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var l=new dr(n,new An(0,Z.BOUNDARY,i,s));this._curveList.add(l)},ki.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},ki.prototype.addPolygonRing=function(n,i,s,l,h){if(i===0&&n.length<Tn.MINIMUM_VALID_SIZE)return null;var v=l,S=h;n.length>=Tn.MINIMUM_VALID_SIZE&&rt.isCCW(n)&&(v=h,S=l,s=Ht.opposite(s));var R=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(R,v,S)},ki.prototype.add=function(n){if(n.isEmpty())return null;n instanceof pe?this.addPolygon(n):n instanceof jt?this.addLineString(n):n instanceof ge?this.addPoint(n):n instanceof Oe?this.addCollection(n):n instanceof K?this.addCollection(n):n instanceof Bn?this.addCollection(n):n instanceof Zn&&this.addCollection(n)},ki.prototype.isErodedCompletely=function(n,i){var s=n.getCoordinates();if(s.length<4)return i<0;if(s.length===4)return this.isTriangleErodedCompletely(s,i);var l=n.getEnvelopeInternal(),h=Math.min(l.getHeight(),l.getWidth());return i<0&&2*Math.abs(i)>h},ki.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},ki.prototype.interfaces_=function(){return[]},ki.prototype.getClass=function(){return ki};var eu=function(){};eu.prototype.locate=function(n){},eu.prototype.interfaces_=function(){return[]},eu.prototype.getClass=function(){return eu};var co=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()};co.prototype.next=function(){if(this._atStart)return this._atStart=!1,co.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 Zn?(this._subcollectionIterator=new co(n),this._subcollectionIterator.next()):n},co.prototype.remove=function(){throw new Error(this.getClass().getName())},co.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)},co.prototype.interfaces_=function(){return[k]},co.prototype.getClass=function(){return co},co.isAtomic=function(n){return!(n instanceof Zn)};var pi=function(){this._geom=null;var n=arguments[0];this._geom=n};pi.prototype.locate=function(n){return pi.locate(n,this._geom)},pi.prototype.interfaces_=function(){return[eu]},pi.prototype.getClass=function(){return pi},pi.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&rt.isPointInRing(n,i.getCoordinates())},pi.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!pi.isPointInRing(n,s))return!1;for(var l=0;l<i.getNumInteriorRing();l++){var h=i.getInteriorRingN(l);if(pi.isPointInRing(n,h))return!1}return!0},pi.containsPoint=function(n,i){if(i instanceof pe)return pi.containsPointInPolygon(n,i);if(i instanceof Zn)for(var s=new co(i);s.hasNext();){var l=s.next();if(l!==i&&pi.containsPoint(n,l))return!0}return!1},pi.locate=function(n,i){return i.isEmpty()?Z.EXTERIOR:pi.containsPoint(n,i)?Z.INTERIOR:Z.EXTERIOR};var jr=function(){this._edgeMap=new w,this._edgeList=null,this._ptInAreaLocation=[Z.NONE,Z.NONE]};jr.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)},jr.prototype.propagateSideLabels=function(n){for(var i=Z.NONE,s=this.iterator();s.hasNext();){var l=s.next().getLabel();l.isArea(n)&&l.getLocation(n,Ht.LEFT)!==Z.NONE&&(i=l.getLocation(n,Ht.LEFT))}if(i===Z.NONE)return null;for(var h=i,v=this.iterator();v.hasNext();){var S=v.next(),R=S.getLabel();if(R.getLocation(n,Ht.ON)===Z.NONE&&R.setLocation(n,Ht.ON,h),R.isArea(n)){var V=R.getLocation(n,Ht.LEFT),ot=R.getLocation(n,Ht.RIGHT);if(ot!==Z.NONE){if(ot!==h)throw new Zo("side location conflict",S.getCoordinate());V===Z.NONE&&kt.shouldNeverReachHere("found single null side (at "+S.getCoordinate()+")"),h=V}else kt.isTrue(R.getLocation(n,Ht.LEFT)===Z.NONE,"found single null side"),R.setLocation(n,Ht.RIGHT,h),R.setLocation(n,Ht.LEFT,h)}}},jr.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},jr.prototype.print=function(n){Qt.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},jr.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},jr.prototype.checkAreaLabelsConsistent=function(n){var i=this.getEdges();if(i.size()<=0)return!0;var s=i.size()-1,l=i.get(s).getLabel().getLocation(n,Ht.LEFT);kt.isTrue(l!==Z.NONE,"Found unlabelled area edge");for(var h=l,v=this.iterator();v.hasNext();){var S=v.next().getLabel();kt.isTrue(S.isArea(n),"Found non-area edge");var R=S.getLocation(n,Ht.LEFT),V=S.getLocation(n,Ht.RIGHT);if(R===V||V!==h)return!1;h=R}return!0},jr.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},jr.prototype.iterator=function(){return this.getEdges().iterator()},jr.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new nt(this._edgeMap.values())),this._edgeList},jr.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===Z.NONE&&(this._ptInAreaLocation[n]=pi.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},jr.prototype.toString=function(){var n=new Pt;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(\`
108
108
  \`);for(var i=this.iterator();i.hasNext();){var s=i.next();n.append(s),n.append(\`
109
- \`)}return n.toString()},jr.prototype.computeEdgeEndLabels=function(n){for(var i=this.iterator();i.hasNext();)i.next().computeLabel(n)},jr.prototype.computeLabelling=function(n){this.computeEdgeEndLabels(n[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var i=[!1,!1],s=this.iterator();s.hasNext();)for(var l=s.next().getLabel(),h=0;h<2;h++)l.isLine(h)&&l.getLocation(h)===Z.BOUNDARY&&(i[h]=!0);for(var v=this.iterator();v.hasNext();)for(var S=v.next(),R=S.getLabel(),V=0;V<2;V++)if(R.isAnyNull(V)){var ot=Z.NONE;if(i[V])ot=Z.EXTERIOR;else{var St=S.getCoordinate();ot=this.getLocation(V,St,n)}R.setAllLocationsIfNull(V,ot)}},jr.prototype.getDegree=function(){return this._edgeMap.size()},jr.prototype.insertEdgeEnd=function(n,i){this._edgeMap.put(n,i),this._edgeList=null},jr.prototype.interfaces_=function(){return[]},jr.prototype.getClass=function(){return jr};var Ff=function(n){function i(){n.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var s=null,l=null,h=this._SCANNING_FOR_INCOMING,v=0;v<this._resultAreaEdgeList.size();v++){var S=this._resultAreaEdgeList.get(v),R=S.getSym();if(S.getLabel().isArea())switch(s===null&&S.isInResult()&&(s=S),h){case this._SCANNING_FOR_INCOMING:if(!R.isInResult())continue;l=R,h=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!S.isInResult())continue;l.setNext(S),h=this._SCANNING_FOR_INCOMING}}if(h===this._LINKING_TO_OUTGOING){if(s===null)throw new Zo("no outgoing dirEdge found",this.getCoordinate());kt.isTrue(s.isInResult(),"unable to link last incoming dirEdge"),l.setNext(s)}},i.prototype.insert=function(s){var l=s;this.insertEdgeEnd(l,l)},i.prototype.getRightmostEdge=function(){var s=this.getEdges(),l=s.size();if(l<1)return null;var h=s.get(0);if(l===1)return h;var v=s.get(l-1),S=h.getQuadrant(),R=v.getQuadrant();return kn.isNorthern(S)&&kn.isNorthern(R)?h:kn.isNorthern(S)||kn.isNorthern(R)?h.getDy()!==0?h:v.getDy()!==0?v:(kt.shouldNeverReachHere("found two horizontal edges incident on node"),null):v},i.prototype.print=function(s){Qt.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var l=this.iterator();l.hasNext();){var h=l.next();s.print("out "),h.print(s),s.println(),s.print("in "),h.getSym().print(s),s.println()}},i.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new nt;for(var s=this.iterator();s.hasNext();){var l=s.next();(l.isInResult()||l.getSym().isInResult())&&this._resultAreaEdgeList.add(l)}return this._resultAreaEdgeList},i.prototype.updateLabelling=function(s){for(var l=this.iterator();l.hasNext();){var h=l.next().getLabel();h.setAllLocationsIfNull(0,s.getLocation(0)),h.setAllLocationsIfNull(1,s.getLocation(1))}},i.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var s=null,l=null,h=this._edgeList.size()-1;h>=0;h--){var v=this._edgeList.get(h),S=v.getSym();l===null&&(l=S),s!==null&&S.setNext(s),s=v}l.setNext(s)},i.prototype.computeDepths=function(){if(arguments.length===1){var s=arguments[0],l=this.findIndex(s),h=s.getDepth(Ht.LEFT),v=s.getDepth(Ht.RIGHT),S=this.computeDepths(l+1,this._edgeList.size(),h);if(this.computeDepths(0,l,S)!==v)throw new Zo("depth mismatch at "+s.getCoordinate())}else if(arguments.length===3){for(var R=arguments[0],V=arguments[1],ot=arguments[2],St=R;St<V;St++){var bt=this._edgeList.get(St);bt.setEdgeDepths(Ht.RIGHT,ot),ot=bt.getDepth(Ht.LEFT)}return ot}},i.prototype.mergeSymLabels=function(){for(var s=this.iterator();s.hasNext();){var l=s.next();l.getLabel().merge(l.getSym().getLabel())}},i.prototype.linkMinimalDirectedEdges=function(s){for(var l=null,h=null,v=this._SCANNING_FOR_INCOMING,S=this._resultAreaEdgeList.size()-1;S>=0;S--){var R=this._resultAreaEdgeList.get(S),V=R.getSym();switch(l===null&&R.getEdgeRing()===s&&(l=R),v){case this._SCANNING_FOR_INCOMING:if(V.getEdgeRing()!==s)continue;h=V,v=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(R.getEdgeRing()!==s)continue;h.setNextMin(R),v=this._SCANNING_FOR_INCOMING}}v===this._LINKING_TO_OUTGOING&&(kt.isTrue(l!==null,"found null for first outgoing dirEdge"),kt.isTrue(l.getEdgeRing()===s,"unable to link last incoming dirEdge"),h.setNextMin(l))},i.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var s=0,l=this.iterator();l.hasNext();)l.next().isInResult()&&s++;return s}if(arguments.length===1){for(var h=arguments[0],v=0,S=this.iterator();S.hasNext();)S.next().getEdgeRing()===h&&v++;return v}},i.prototype.getLabel=function(){return this._label},i.prototype.findCoveredLineEdges=function(){for(var s=Z.NONE,l=this.iterator();l.hasNext();){var h=l.next(),v=h.getSym();if(!h.isLineEdge()){if(h.isInResult()){s=Z.INTERIOR;break}if(v.isInResult()){s=Z.EXTERIOR;break}}}if(s===Z.NONE)return null;for(var S=s,R=this.iterator();R.hasNext();){var V=R.next(),ot=V.getSym();V.isLineEdge()?V.getEdge().setCovered(S===Z.INTERIOR):(V.isInResult()&&(S=Z.EXTERIOR),ot.isInResult()&&(S=Z.INTERIOR))}},i.prototype.computeLabelling=function(s){n.prototype.computeLabelling.call(this,s),this._label=new An(Z.NONE);for(var l=this.iterator();l.hasNext();)for(var h=l.next().getEdge().getLabel(),v=0;v<2;v++){var S=h.getLocation(v);S!==Z.INTERIOR&&S!==Z.BOUNDARY||this._label.setLocation(v,Z.INTERIOR)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(jr),ji=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.createNode=function(s){return new yl(s,new Ff)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ja),Jo=function n(){this._pts=null,this._orientation=null;var i=arguments[0];this._pts=i,this._orientation=n.orientation(i)};Jo.prototype.compareTo=function(n){var i=n;return Jo.compareOriented(this._pts,this._orientation,i._pts,i._orientation)},Jo.prototype.interfaces_=function(){return[z]},Jo.prototype.getClass=function(){return Jo},Jo.orientation=function(n){return at.increasingDirection(n)===1},Jo.compareOriented=function(n,i,s,l){for(var h=i?1:-1,v=l?1:-1,S=i?n.length:-1,R=l?s.length:-1,V=i?0:n.length-1,ot=l?0:s.length-1;;){var St=n[V].compareTo(s[ot]);if(St!==0)return St;var bt=(V+=h)===S,Yt=(ot+=v)===R;if(bt&&!Yt)return-1;if(!bt&&Yt)return 1;if(bt&&Yt)return 0}};var di=function(){this._edges=new nt,this._ocaMap=new w};di.prototype.print=function(n){n.print("MULTILINESTRING ( ");for(var i=0;i<this._edges.size();i++){var s=this._edges.get(i);i>0&&n.print(","),n.print("(");for(var l=s.getCoordinates(),h=0;h<l.length;h++)h>0&&n.print(","),n.print(l[h].x+" "+l[h].y);n.println(")")}n.print(") ")},di.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next())},di.prototype.findEdgeIndex=function(n){for(var i=0;i<this._edges.size();i++)if(this._edges.get(i).equals(n))return i;return-1},di.prototype.iterator=function(){return this._edges.iterator()},di.prototype.getEdges=function(){return this._edges},di.prototype.get=function(n){return this._edges.get(n)},di.prototype.findEqualEdge=function(n){var i=new Jo(n.getCoordinates());return this._ocaMap.get(i)},di.prototype.add=function(n){this._edges.add(n);var i=new Jo(n.getCoordinates());this._ocaMap.put(i,n)},di.prototype.interfaces_=function(){return[]},di.prototype.getClass=function(){return di};var Ls=function(){};Ls.prototype.processIntersections=function(n,i,s,l){},Ls.prototype.isDone=function(){},Ls.prototype.interfaces_=function(){return[]},Ls.prototype.getClass=function(){return Ls};var Si=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var n=arguments[0];this._li=n};Si.prototype.isTrivialIntersection=function(n,i,s,l){if(n===s&&this._li.getIntersectionNum()===1){if(Si.isAdjacentSegments(i,l))return!0;if(n.isClosed()){var h=n.size()-1;if(i===0&&l===h||l===0&&i===h)return!0}}return!1},Si.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Si.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Si.prototype.getLineIntersector=function(){return this._li},Si.prototype.hasProperIntersection=function(){return this._hasProper},Si.prototype.processIntersections=function(n,i,s,l){if(n===s&&i===l)return null;this.numTests++;var h=n.getCoordinates()[i],v=n.getCoordinates()[i+1],S=s.getCoordinates()[l],R=s.getCoordinates()[l+1];this._li.computeIntersection(h,v,S,R),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(n,i,s,l)||(this._hasIntersection=!0,n.addIntersections(this._li,i,0),s.addIntersections(this._li,l,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Si.prototype.hasIntersection=function(){return this._hasIntersection},Si.prototype.isDone=function(){return!1},Si.prototype.hasInteriorIntersection=function(){return this._hasInterior},Si.prototype.interfaces_=function(){return[Ls]},Si.prototype.getClass=function(){return Si},Si.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var Io=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var n=arguments[0],i=arguments[1],s=arguments[2];this.coord=new D(n),this.segmentIndex=i,this.dist=s};Io.prototype.getSegmentIndex=function(){return this.segmentIndex},Io.prototype.getCoordinate=function(){return this.coord},Io.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex),n.println(" dist = "+this.dist)},Io.prototype.compareTo=function(n){var i=n;return this.compare(i.segmentIndex,i.dist)},Io.prototype.isEndPoint=function(n){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===n},Io.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Io.prototype.getDistance=function(){return this.dist},Io.prototype.compare=function(n,i){return this.segmentIndex<n?-1:this.segmentIndex>n?1:this.dist<i?-1:this.dist>i?1:0},Io.prototype.interfaces_=function(){return[z]},Io.prototype.getClass=function(){return Io};var Ko=function(){this._nodeMap=new w,this.edge=null;var n=arguments[0];this.edge=n};Ko.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},Ko.prototype.iterator=function(){return this._nodeMap.values().iterator()},Ko.prototype.addSplitEdges=function(n){this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var l=i.next(),h=this.createSplitEdge(s,l);n.add(h),s=l}},Ko.prototype.addEndpoints=function(){var n=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[n],n,0)},Ko.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,l=this.edge.pts[i.segmentIndex],h=i.dist>0||!i.coord.equals2D(l);h||s--;var v=new Array(s).fill(null),S=0;v[S++]=new D(n.coord);for(var R=n.segmentIndex+1;R<=i.segmentIndex;R++)v[S++]=this.edge.pts[R];return h&&(v[S]=i.coord),new _l(v,new An(this.edge._label))},Ko.prototype.add=function(n,i,s){var l=new Io(n,i,s),h=this._nodeMap.get(l);return h!==null?h:(this._nodeMap.put(l,l),l)},Ko.prototype.isIntersection=function(n){for(var i=this.iterator();i.hasNext();)if(i.next().coord.equals(n))return!0;return!1},Ko.prototype.interfaces_=function(){return[]},Ko.prototype.getClass=function(){return Ko};var js=function(){};js.prototype.getChainStartIndices=function(n){var i=0,s=new nt;s.add(new Et(i));do{var l=this.findChainEnd(n,i);s.add(new Et(l)),i=l}while(i<n.length-1);return js.toIntArray(s)},js.prototype.findChainEnd=function(n,i){for(var s=kn.quadrant(n[i],n[i+1]),l=i+1;l<n.length&&kn.quadrant(n[l-1],n[l])===s;)l++;return l-1},js.prototype.interfaces_=function(){return[]},js.prototype.getClass=function(){return js},js.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 ms=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Xt,this.env2=new Xt;var n=arguments[0];this.e=n,this.pts=n.getCoordinates();var i=new js;this.startIndex=i.getChainStartIndices(this.pts)};ms.prototype.getCoordinates=function(){return this.pts},ms.prototype.getMaxX=function(n){var i=this.pts[this.startIndex[n]].x,s=this.pts[this.startIndex[n+1]].x;return i>s?i:s},ms.prototype.getMinX=function(n){var i=this.pts[this.startIndex[n]].x,s=this.pts[this.startIndex[n+1]].x;return i<s?i:s},ms.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];this.computeIntersectsForChain(this.startIndex[n],this.startIndex[n+1],i,i.startIndex[s],i.startIndex[s+1],l)}else if(arguments.length===6){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3],V=arguments[4],ot=arguments[5],St=this.pts[h],bt=this.pts[v],Yt=S.pts[R],Jt=S.pts[V];if(v-h==1&&V-R==1)return ot.addIntersections(this.e,h,S.e,R),null;if(this.env1.init(St,bt),this.env2.init(Yt,Jt),!this.env1.intersects(this.env2))return null;var se=Math.trunc((h+v)/2),_e=Math.trunc((R+V)/2);h<se&&(R<_e&&this.computeIntersectsForChain(h,se,S,R,_e,ot),_e<V&&this.computeIntersectsForChain(h,se,S,_e,V,ot)),se<v&&(R<_e&&this.computeIntersectsForChain(se,v,S,R,_e,ot),_e<V&&this.computeIntersectsForChain(se,v,S,_e,V,ot))}},ms.prototype.getStartIndexes=function(){return this.startIndex},ms.prototype.computeIntersects=function(n,i){for(var s=0;s<this.startIndex.length-1;s++)for(var l=0;l<n.startIndex.length-1;l++)this.computeIntersectsForChain(s,n,l,i)},ms.prototype.interfaces_=function(){return[]},ms.prototype.getClass=function(){return ms};var Wr=function n(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var i=0;i<2;i++)for(var s=0;s<3;s++)this._depth[i][s]=n.NULL_VALUE},Ma={NULL_VALUE:{configurable:!0}};Wr.prototype.getDepth=function(n,i){return this._depth[n][i]},Wr.prototype.setDepth=function(n,i,s){this._depth[n][i]=s},Wr.prototype.isNull=function(){if(arguments.length===0){for(var n=0;n<2;n++)for(var i=0;i<3;i++)if(this._depth[n][i]!==Wr.NULL_VALUE)return!1;return!0}if(arguments.length===1){var s=arguments[0];return this._depth[s][1]===Wr.NULL_VALUE}if(arguments.length===2){var l=arguments[0],h=arguments[1];return this._depth[l][h]===Wr.NULL_VALUE}},Wr.prototype.normalize=function(){for(var n=0;n<2;n++)if(!this.isNull(n)){var i=this._depth[n][1];this._depth[n][2]<i&&(i=this._depth[n][2]),i<0&&(i=0);for(var s=1;s<3;s++){var l=0;this._depth[n][s]>i&&(l=1),this._depth[n][s]=l}}},Wr.prototype.getDelta=function(n){return this._depth[n][Ht.RIGHT]-this._depth[n][Ht.LEFT]},Wr.prototype.getLocation=function(n,i){return this._depth[n][i]<=0?Z.EXTERIOR:Z.INTERIOR},Wr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Wr.prototype.add=function(){if(arguments.length===1)for(var n=arguments[0],i=0;i<2;i++)for(var s=1;s<3;s++){var l=n.getLocation(i,s);l!==Z.EXTERIOR&&l!==Z.INTERIOR||(this.isNull(i,s)?this._depth[i][s]=Wr.depthAtLocation(l):this._depth[i][s]+=Wr.depthAtLocation(l))}else if(arguments.length===3){var h=arguments[0],v=arguments[1];arguments[2]===Z.INTERIOR&&this._depth[h][v]++}},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr},Wr.depthAtLocation=function(n){return n===Z.EXTERIOR?0:n===Z.INTERIOR?1:Wr.NULL_VALUE},Ma.NULL_VALUE.get=function(){return-1},Object.defineProperties(Wr,Ma);var _l=function(n){function i(){if(n.call(this),this.pts=null,this._env=null,this.eiList=new Ko(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Wr,this._depthDelta=0,arguments.length===1){var s=arguments[0];i.call(this,s,null)}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.pts=l,this._label=h}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getDepth=function(){return this._depth},i.prototype.getCollapsedEdge=function(){var s=new Array(2).fill(null);return s[0]=this.pts[0],s[1]=this.pts[1],new i(s,An.toLineLabel(this._label))},i.prototype.isIsolated=function(){return this._isIsolated},i.prototype.getCoordinates=function(){return this.pts},i.prototype.setIsolated=function(s){this._isIsolated=s},i.prototype.setName=function(s){this._name=s},i.prototype.equals=function(s){if(!(s instanceof i))return!1;var l=s;if(this.pts.length!==l.pts.length)return!1;for(var h=!0,v=!0,S=this.pts.length,R=0;R<this.pts.length;R++)if(this.pts[R].equals2D(l.pts[R])||(h=!1),this.pts[R].equals2D(l.pts[--S])||(v=!1),!h&&!v)return!1;return!0},i.prototype.getCoordinate=function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var s=arguments[0];return this.pts[s]}},i.prototype.print=function(s){s.print("edge "+this._name+": "),s.print("LINESTRING (");for(var l=0;l<this.pts.length;l++)l>0&&s.print(","),s.print(this.pts[l].x+" "+this.pts[l].y);s.print(") "+this._label+" "+this._depthDelta)},i.prototype.computeIM=function(s){i.updateIM(this._label,s)},i.prototype.isCollapsed=function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])},i.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},i.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},i.prototype.getDepthDelta=function(){return this._depthDelta},i.prototype.getNumPoints=function(){return this.pts.length},i.prototype.printReverse=function(s){s.print("edge "+this._name+": ");for(var l=this.pts.length-1;l>=0;l--)s.print(this.pts[l]+" ");s.println("")},i.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ms(this)),this._mce},i.prototype.getEnvelope=function(){if(this._env===null){this._env=new Xt;for(var s=0;s<this.pts.length;s++)this._env.expandToInclude(this.pts[s])}return this._env},i.prototype.addIntersection=function(s,l,h,v){var S=new D(s.getIntersection(v)),R=l,V=s.getEdgeDistance(h,v),ot=R+1;if(ot<this.pts.length){var St=this.pts[ot];S.equals2D(St)&&(R=ot,V=0)}this.eiList.add(S,R,V)},i.prototype.toString=function(){var s=new Pt;s.append("edge "+this._name+": "),s.append("LINESTRING (");for(var l=0;l<this.pts.length;l++)l>0&&s.append(","),s.append(this.pts[l].x+" "+this.pts[l].y);return s.append(") "+this._label+" "+this._depthDelta),s.toString()},i.prototype.isPointwiseEqual=function(s){if(this.pts.length!==s.pts.length)return!1;for(var l=0;l<this.pts.length;l++)if(!this.pts[l].equals2D(s.pts[l]))return!1;return!0},i.prototype.setDepthDelta=function(s){this._depthDelta=s},i.prototype.getEdgeIntersectionList=function(){return this.eiList},i.prototype.addIntersections=function(s,l,h){for(var v=0;v<s.getIntersectionNum();v++)this.addIntersection(s,l,h,v)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.updateIM=function(){if(arguments.length!==2)return n.prototype.updateIM.apply(this,arguments);var s=arguments[0],l=arguments[1];l.setAtLeastIfValid(s.getLocation(0,Ht.ON),s.getLocation(1,Ht.ON),1),s.isArea()&&(l.setAtLeastIfValid(s.getLocation(0,Ht.LEFT),s.getLocation(1,Ht.LEFT),2),l.setAtLeastIfValid(s.getLocation(0,Ht.RIGHT),s.getLocation(1,Ht.RIGHT),2))},i}(Bi),ii=function(n){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new di,this._bufParams=n||null};ii.prototype.setWorkingPrecisionModel=function(n){this._workingPrecisionModel=n},ii.prototype.insertUniqueEdge=function(n){var i=this._edgeList.findEqualEdge(n);if(i!==null){var s=i.getLabel(),l=n.getLabel();i.isPointwiseEqual(n)||(l=new An(n.getLabel())).flip(),s.merge(l);var h=ii.depthDelta(l),v=i.getDepthDelta()+h;i.setDepthDelta(v)}else this._edgeList.add(n),n.setDepthDelta(ii.depthDelta(n.getLabel()))},ii.prototype.buildSubgraphs=function(n,i){for(var s=new nt,l=n.iterator();l.hasNext();){var h=l.next(),v=h.getRightmostCoordinate(),S=new Qs(s).getDepth(v);h.computeDepth(S),h.findResultEdges(),s.add(h),i.add(h.getDirectedEdges(),h.getNodes())}},ii.prototype.createSubgraphs=function(n){for(var i=new nt,s=n.getNodes().iterator();s.hasNext();){var l=s.next();if(!l.isVisited()){var h=new Jr;h.create(l),i.add(h)}}return uo.sort(i,uo.reverseOrder()),i},ii.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},ii.prototype.getNoder=function(n){if(this._workingNoder!==null)return this._workingNoder;var i=new zu,s=new $n;return s.setPrecisionModel(n),i.setSegmentIntersector(new Si(s)),i},ii.prototype.buffer=function(n,i){var s=this._workingPrecisionModel;s===null&&(s=n.getPrecisionModel()),this._geomFact=n.getFactory();var l=new hi(s,this._bufParams),h=new ki(n,i,l).getCurves();if(h.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(h,s),this._graph=new cr(new ji),this._graph.addEdges(this._edgeList.getEdges());var v=this.createSubgraphs(this._graph),S=new Ei(this._geomFact);this.buildSubgraphs(v,S);var R=S.getPolygons();return R.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(R)},ii.prototype.computeNodedEdges=function(n,i){var s=this.getNoder(i);s.computeNodes(n);for(var l=s.getNodedSubstrings().iterator();l.hasNext();){var h=l.next(),v=h.getCoordinates();if(v.length!==2||!v[0].equals2D(v[1])){var S=h.getData(),R=new _l(h.getCoordinates(),new An(S));this.insertUniqueEdge(R)}}},ii.prototype.setNoder=function(n){this._workingNoder=n},ii.prototype.interfaces_=function(){return[]},ii.prototype.getClass=function(){return ii},ii.depthDelta=function(n){var i=n.getLocation(0,Ht.LEFT),s=n.getLocation(0,Ht.RIGHT);return i===Z.INTERIOR&&s===Z.EXTERIOR?1:i===Z.EXTERIOR&&s===Z.INTERIOR?-1:0},ii.convertSegStrings=function(n){for(var i=new Ce,s=new nt;n.hasNext();){var l=n.next(),h=i.createLineString(l.getCoordinates());s.add(h)}return i.buildGeometry(s)};var Qo=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var n=arguments[0],i=arguments[1];this._noder=n,this._scaleFactor=i,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var s=arguments[0],l=arguments[1],h=arguments[2],v=arguments[3];this._noder=s,this._scaleFactor=l,this._offsetX=h,this._offsetY=v,this._isScaled=!this.isIntegerPrecision()}};Qo.prototype.rescale=function(){if(et(arguments[0],st))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.rescale(i.getCoordinates())}else if(arguments[0]instanceof Array){for(var s=arguments[0],l=0;l<s.length;l++)s[l].x=s[l].x/this._scaleFactor+this._offsetX,s[l].y=s[l].y/this._scaleFactor+this._offsetY;s.length===2&&s[0].equals2D(s[1])&&Qt.out.println(s)}},Qo.prototype.scale=function(){if(et(arguments[0],st)){for(var n=arguments[0],i=new nt,s=n.iterator();s.hasNext();){var l=s.next();i.add(new dr(this.scale(l.getCoordinates()),l.getData()))}return i}if(arguments[0]instanceof Array){for(var h=arguments[0],v=new Array(h.length).fill(null),S=0;S<h.length;S++)v[S]=new D(Math.round((h[S].x-this._offsetX)*this._scaleFactor),Math.round((h[S].y-this._offsetY)*this._scaleFactor),h[S].z);return at.removeRepeatedPoints(v)}},Qo.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},Qo.prototype.getNodedSubstrings=function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n},Qo.prototype.computeNodes=function(n){var i=n;this._isScaled&&(i=this.scale(n)),this._noder.computeNodes(i)},Qo.prototype.interfaces_=function(){return[zi]},Qo.prototype.getClass=function(){return Qo};var fo=function(){this._li=new $n,this._segStrings=null;var n=arguments[0];this._segStrings=n},Ns={fact:{configurable:!0}};fo.prototype.checkEndPtVertexIntersections=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next().getCoordinates();this.checkEndPtVertexIntersections(i[0],this._segStrings),this.checkEndPtVertexIntersections(i[i.length-1],this._segStrings)}else if(arguments.length===2){for(var s=arguments[0],l=arguments[1].iterator();l.hasNext();)for(var h=l.next().getCoordinates(),v=1;v<h.length-1;v++)if(h[v].equals(s))throw new Ue("found endpt/interior pt intersection at index "+v+" :pt "+s)}},fo.prototype.checkInteriorIntersections=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();)for(var i=n.next(),s=this._segStrings.iterator();s.hasNext();){var l=s.next();this.checkInteriorIntersections(i,l)}else if(arguments.length===2)for(var h=arguments[0],v=arguments[1],S=h.getCoordinates(),R=v.getCoordinates(),V=0;V<S.length-1;V++)for(var ot=0;ot<R.length-1;ot++)this.checkInteriorIntersections(h,V,v,ot);else if(arguments.length===4){var St=arguments[0],bt=arguments[1],Yt=arguments[2],Jt=arguments[3];if(St===Yt&&bt===Jt)return null;var se=St.getCoordinates()[bt],_e=St.getCoordinates()[bt+1],Cn=Yt.getCoordinates()[Jt],Xn=Yt.getCoordinates()[Jt+1];if(this._li.computeIntersection(se,_e,Cn,Xn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,se,_e)||this.hasInteriorIntersection(this._li,Cn,Xn)))throw new Ue("found non-noded intersection at "+se+"-"+_e+" and "+Cn+"-"+Xn)}},fo.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},fo.prototype.checkCollapses=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkCollapses(i)}else if(arguments.length===1)for(var s=arguments[0].getCoordinates(),l=0;l<s.length-2;l++)this.checkCollapse(s[l],s[l+1],s[l+2])},fo.prototype.hasInteriorIntersection=function(n,i,s){for(var l=0;l<n.getIntersectionNum();l++){var h=n.getIntersection(l);if(!h.equals(i)&&!h.equals(s))return!0}return!1},fo.prototype.checkCollapse=function(n,i,s){if(n.equals(s))throw new Ue("found non-noded collapse at "+fo.fact.createLineString([n,i,s]))},fo.prototype.interfaces_=function(){return[]},fo.prototype.getClass=function(){return fo},Ns.fact.get=function(){return new Ce},Object.defineProperties(fo,Ns);var qr=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var n=arguments[0],i=arguments[1],s=arguments[2];if(this._originalPt=n,this._pt=n,this._scaleFactor=i,this._li=s,i<=0)throw new N("Scale factor must be non-zero");i!==1&&(this._pt=new D(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new D,this._p1Scaled=new D),this.initCorners(this._pt)},Uf={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};qr.prototype.intersectsScaled=function(n,i){var s=Math.min(n.x,i.x),l=Math.max(n.x,i.x),h=Math.min(n.y,i.y),v=Math.max(n.y,i.y),S=this._maxx<s||this._minx>l||this._maxy<h||this._miny>v;if(S)return!1;var R=this.intersectsToleranceSquare(n,i);return kt.isTrue(!(S&&R),"Found bad envelope test"),R},qr.prototype.initCorners=function(n){this._minx=n.x-.5,this._maxx=n.x+.5,this._miny=n.y-.5,this._maxy=n.y+.5,this._corner[0]=new D(this._maxx,this._maxy),this._corner[1]=new D(this._minx,this._maxy),this._corner[2]=new D(this._minx,this._miny),this._corner[3]=new D(this._maxx,this._miny)},qr.prototype.intersects=function(n,i){return this._scaleFactor===1?this.intersectsScaled(n,i):(this.copyScaled(n,this._p0Scaled),this.copyScaled(i,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},qr.prototype.scale=function(n){return Math.round(n*this._scaleFactor)},qr.prototype.getCoordinate=function(){return this._originalPt},qr.prototype.copyScaled=function(n,i){i.x=this.scale(n.x),i.y=this.scale(n.y)},qr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var n=qr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Xt(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv},qr.prototype.intersectsPixelClosure=function(n,i){return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},qr.prototype.intersectsToleranceSquare=function(n,i){var s=!1,l=!1;return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(s=!0),this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(l=!0),this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!s||!l)||!!n.equals(this._pt)||!!i.equals(this._pt))))},qr.prototype.addSnappedNode=function(n,i){var s=n.getCoordinate(i),l=n.getCoordinate(i+1);return!!this.intersects(s,l)&&(n.addIntersection(this.getCoordinate(),i),!0)},qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr},Uf.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(qr,Uf);var Gu=function(){this.tempEnv1=new Xt,this.selectedSegment=new ne};Gu.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var n=arguments[0],i=arguments[1];n.getLineSegment(i,this.selectedSegment),this.select(this.selectedSegment)}}},Gu.prototype.interfaces_=function(){return[]},Gu.prototype.getClass=function(){return Gu};var nu=function(){this._index=null;var n=arguments[0];this._index=n},Sa={HotPixelSnapAction:{configurable:!0}};nu.prototype.snap=function(){if(arguments.length===1){var n=arguments[0];return this.snap(n,null,-1)}if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2],h=i.getSafeEnvelope(),v=new Ro(i,s,l);return this._index.query(h,{interfaces_:function(){return[Rs]},visitItem:function(S){S.select(h,v)}}),v.isNodeAdded()}},nu.prototype.interfaces_=function(){return[]},nu.prototype.getClass=function(){return nu},Sa.HotPixelSnapAction.get=function(){return Ro},Object.defineProperties(nu,Sa);var Ro=function(n){function i(){n.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var s=arguments[0],l=arguments[1],h=arguments[2];this._hotPixel=s,this._parentEdge=l,this._hotPixelVertexIndex=h}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isNodeAdded=function(){return this._isNodeAdded},i.prototype.select=function(){if(arguments.length!==2)return n.prototype.select.apply(this,arguments);var s=arguments[0],l=arguments[1],h=s.getContext();if(this._parentEdge!==null&&h===this._parentEdge&&l===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(h,l)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Gu),ta=function(){this._li=null,this._interiorIntersections=null;var n=arguments[0];this._li=n,this._interiorIntersections=new nt};ta.prototype.processIntersections=function(n,i,s,l){if(n===s&&i===l)return null;var h=n.getCoordinates()[i],v=n.getCoordinates()[i+1],S=s.getCoordinates()[l],R=s.getCoordinates()[l+1];if(this._li.computeIntersection(h,v,S,R),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var V=0;V<this._li.getIntersectionNum();V++)this._interiorIntersections.add(this._li.getIntersection(V));n.addIntersections(this._li,i,0),s.addIntersections(this._li,l,1)}},ta.prototype.isDone=function(){return!1},ta.prototype.getInteriorIntersections=function(){return this._interiorIntersections},ta.prototype.interfaces_=function(){return[Ls]},ta.prototype.getClass=function(){return ta};var jo=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var n=arguments[0];this._pm=n,this._li=new $n,this._li.setPrecisionModel(n),this._scaleFactor=n.getScale()};jo.prototype.checkCorrectness=function(n){var i=dr.getNodedSubstrings(n),s=new fo(i);try{s.checkValid()}catch(l){if(!(l instanceof ue))throw l;l.printStackTrace()}},jo.prototype.getNodedSubstrings=function(){return dr.getNodedSubstrings(this._nodedSegStrings)},jo.prototype.snapRound=function(n,i){var s=this.findInteriorIntersections(n,i);this.computeIntersectionSnaps(s),this.computeVertexSnaps(n)},jo.prototype.findInteriorIntersections=function(n,i){var s=new ta(i);return this._noder.setSegmentIntersector(s),this._noder.computeNodes(n),s.getInteriorIntersections()},jo.prototype.computeVertexSnaps=function(){if(et(arguments[0],st))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.computeVertexSnaps(i)}else if(arguments[0]instanceof dr)for(var s=arguments[0],l=s.getCoordinates(),h=0;h<l.length;h++){var v=new qr(l[h],this._scaleFactor,this._li);this._pointSnapper.snap(v,s,h)&&s.addIntersection(l[h],h)}},jo.prototype.computeNodes=function(n){this._nodedSegStrings=n,this._noder=new zu,this._pointSnapper=new nu(this._noder.getIndex()),this.snapRound(n,this._li)},jo.prototype.computeIntersectionSnaps=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),l=new qr(s,this._scaleFactor,this._li);this._pointSnapper.snap(l)}},jo.prototype.interfaces_=function(){return[zi]},jo.prototype.getClass=function(){return jo};var Xr=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Fe,this._resultGeometry=null,this._saveException=null,arguments.length===1){var n=arguments[0];this._argGeom=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._argGeom=i,this._bufParams=s}},ru={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};Xr.prototype.bufferFixedPrecision=function(n){var i=new Qo(new jo(new Se(1)),n.getScale()),s=new ii(this._bufParams);s.setWorkingPrecisionModel(n),s.setNoder(i),this._resultGeometry=s.buffer(this._argGeom,this._distance)},Xr.prototype.bufferReducedPrecision=function(){var n=this;if(arguments.length===0){for(var i=Xr.MAX_PRECISION_DIGITS;i>=0;i--){try{n.bufferReducedPrecision(i)}catch(v){if(!(v instanceof Zo))throw v;n._saveException=v}if(n._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var s=arguments[0],l=Xr.precisionScaleFactor(this._argGeom,this._distance,s),h=new Se(l);this.bufferFixedPrecision(h)}},Xr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var n=this._argGeom.getFactory().getPrecisionModel();n.getType()===Se.FIXED?this.bufferFixedPrecision(n):this.bufferReducedPrecision()},Xr.prototype.setQuadrantSegments=function(n){this._bufParams.setQuadrantSegments(n)},Xr.prototype.bufferOriginalPrecision=function(){try{var n=new ii(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(i){if(!(i instanceof Ue))throw i;this._saveException=i}},Xr.prototype.getResultGeometry=function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry},Xr.prototype.setEndCapStyle=function(n){this._bufParams.setEndCapStyle(n)},Xr.prototype.interfaces_=function(){return[]},Xr.prototype.getClass=function(){return Xr},Xr.bufferOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new Xr(n).getResultGeometry(i)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ct&&typeof arguments[1]=="number"){var s=arguments[0],l=arguments[1],h=arguments[2],v=new Xr(s);return v.setQuadrantSegments(h),v.getResultGeometry(l)}if(arguments[2]instanceof Fe&&arguments[0]instanceof Ct&&typeof arguments[1]=="number"){var S=arguments[0],R=arguments[1],V=arguments[2];return new Xr(S,V).getResultGeometry(R)}}else if(arguments.length===4){var ot=arguments[0],St=arguments[1],bt=arguments[2],Yt=arguments[3],Jt=new Xr(ot);return Jt.setQuadrantSegments(bt),Jt.setEndCapStyle(Yt),Jt.getResultGeometry(St)}},Xr.precisionScaleFactor=function(n,i,s){var l=n.getEnvelopeInternal(),h=vt.max(Math.abs(l.getMaxX()),Math.abs(l.getMaxY()),Math.abs(l.getMinX()),Math.abs(l.getMinY()))+2*(i>0?i:0),v=s-Math.trunc(Math.log(h)/Math.log(10)+1);return Math.pow(10,v)},ru.CAP_ROUND.get=function(){return Fe.CAP_ROUND},ru.CAP_BUTT.get=function(){return Fe.CAP_FLAT},ru.CAP_FLAT.get=function(){return Fe.CAP_FLAT},ru.CAP_SQUARE.get=function(){return Fe.CAP_SQUARE},ru.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(Xr,ru);var oi=function(){this._pt=[new D,new D],this._distance=A.NaN,this._isNull=!0};oi.prototype.getCoordinates=function(){return this._pt},oi.prototype.getCoordinate=function(n){return this._pt[n]},oi.prototype.setMinimum=function(){if(arguments.length===1){var n=arguments[0];this.setMinimum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var l=i.distance(s);l<this._distance&&this.initialize(i,s,l)}},oi.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=n.distance(i),this._isNull=!1}else if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(l),this._distance=h,this._isNull=!1}},oi.prototype.getDistance=function(){return this._distance},oi.prototype.setMaximum=function(){if(arguments.length===1){var n=arguments[0];this.setMaximum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var l=i.distance(s);l>this._distance&&this.initialize(i,s,l)}},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi};var ts=function(){};ts.prototype.interfaces_=function(){return[]},ts.prototype.getClass=function(){return ts},ts.computeDistance=function(){if(arguments[2]instanceof oi&&arguments[0]instanceof jt&&arguments[1]instanceof D)for(var n=arguments[0],i=arguments[1],s=arguments[2],l=n.getCoordinates(),h=new ne,v=0;v<l.length-1;v++){h.setCoordinates(l[v],l[v+1]);var S=h.closestPoint(i);s.setMinimum(S,i)}else if(arguments[2]instanceof oi&&arguments[0]instanceof pe&&arguments[1]instanceof D){var R=arguments[0],V=arguments[1],ot=arguments[2];ts.computeDistance(R.getExteriorRing(),V,ot);for(var St=0;St<R.getNumInteriorRing();St++)ts.computeDistance(R.getInteriorRingN(St),V,ot)}else if(arguments[2]instanceof oi&&arguments[0]instanceof Ct&&arguments[1]instanceof D){var bt=arguments[0],Yt=arguments[1],Jt=arguments[2];if(bt instanceof jt)ts.computeDistance(bt,Yt,Jt);else if(bt instanceof pe)ts.computeDistance(bt,Yt,Jt);else if(bt instanceof Zn)for(var se=bt,_e=0;_e<se.getNumGeometries();_e++){var Cn=se.getGeometryN(_e);ts.computeDistance(Cn,Yt,Jt)}else Jt.setMinimum(bt.getCoordinate(),Yt)}else if(arguments[2]instanceof oi&&arguments[0]instanceof ne&&arguments[1]instanceof D){var Xn=arguments[0],ui=arguments[1],rs=arguments[2],Fs=Xn.closestPoint(ui);rs.setMinimum(Fs,ui)}};var Hi=function(n){this._maxPtDist=new oi,this._inputGeom=n||null},gt={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Hi.prototype.computeMaxMidpointDistance=function(n){var i=new Tt(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},Hi.prototype.computeMaxVertexDistance=function(n){var i=new Nt(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},Hi.prototype.findDistance=function(n){return this.computeMaxVertexDistance(n),this.computeMaxMidpointDistance(n),this._maxPtDist.getDistance()},Hi.prototype.getDistancePoints=function(){return this._maxPtDist},Hi.prototype.interfaces_=function(){return[]},Hi.prototype.getClass=function(){return Hi},gt.MaxPointDistanceFilter.get=function(){return Nt},gt.MaxMidpointDistanceFilter.get=function(){return Tt},Object.defineProperties(Hi,gt);var Nt=function(n){this._maxPtDist=new oi,this._minPtDist=new oi,this._geom=n||null};Nt.prototype.filter=function(n){this._minPtDist.initialize(),ts.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Nt.prototype.getMaxPointDistance=function(){return this._maxPtDist},Nt.prototype.interfaces_=function(){return[tt]},Nt.prototype.getClass=function(){return Nt};var Tt=function(n){this._maxPtDist=new oi,this._minPtDist=new oi,this._geom=n||null};Tt.prototype.filter=function(n,i){if(i===0)return null;var s=n.getCoordinate(i-1),l=n.getCoordinate(i),h=new D((s.x+l.x)/2,(s.y+l.y)/2);this._minPtDist.initialize(),ts.computeDistance(this._geom,h,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Tt.prototype.isDone=function(){return!1},Tt.prototype.isGeometryChanged=function(){return!1},Tt.prototype.getMaxPointDistance=function(){return this._maxPtDist},Tt.prototype.interfaces_=function(){return[lr]},Tt.prototype.getClass=function(){return Tt};var re=function(n){this._comps=n||null};re.prototype.filter=function(n){n instanceof pe&&this._comps.add(n)},re.prototype.interfaces_=function(){return[hr]},re.prototype.getClass=function(){return re},re.getPolygons=function(){if(arguments.length===1){var n=arguments[0];return re.getPolygons(n,new nt)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof pe?s.add(i):i instanceof Zn&&i.apply(new re(s)),s}};var ve=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var n=arguments[0];this._lines=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._lines=i,this._isForcedToLineString=s}};ve.prototype.filter=function(n){if(this._isForcedToLineString&&n instanceof Tn){var i=n.getFactory().createLineString(n.getCoordinateSequence());return this._lines.add(i),null}n instanceof jt&&this._lines.add(n)},ve.prototype.setForceToLineString=function(n){this._isForcedToLineString=n},ve.prototype.interfaces_=function(){return[Gt]},ve.prototype.getClass=function(){return ve},ve.getGeometry=function(){if(arguments.length===1){var n=arguments[0];return n.getFactory().buildGeometry(ve.getLines(n))}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().buildGeometry(ve.getLines(i,s))}},ve.getLines=function(){if(arguments.length===1){var n=arguments[0];return ve.getLines(n,!1)}if(arguments.length===2){if(et(arguments[0],st)&&et(arguments[1],st)){for(var i=arguments[0],s=arguments[1],l=i.iterator();l.hasNext();){var h=l.next();ve.getLines(h,s)}return s}if(arguments[0]instanceof Ct&&typeof arguments[1]=="boolean"){var v=arguments[0],S=arguments[1],R=new nt;return v.apply(new ve(R,S)),R}if(arguments[0]instanceof Ct&&et(arguments[1],st)){var V=arguments[0],ot=arguments[1];return V instanceof jt?ot.add(V):V.apply(new ve(ot)),ot}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&et(arguments[0],st)&&et(arguments[1],st)){for(var St=arguments[0],bt=arguments[1],Yt=arguments[2],Jt=St.iterator();Jt.hasNext();){var se=Jt.next();ve.getLines(se,bt,Yt)}return bt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Ct&&et(arguments[1],st)){var _e=arguments[0],Cn=arguments[1],Xn=arguments[2];return _e.apply(new ve(Cn,Xn)),Cn}}};var Be=function(){if(this._boundaryRule=C.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];if(n===null)throw new N("Rule must be non-null");this._boundaryRule=n}}};Be.prototype.locateInternal=function(){if(arguments[0]instanceof D&&arguments[1]instanceof pe){var n=arguments[0],i=arguments[1];if(i.isEmpty())return Z.EXTERIOR;var s=i.getExteriorRing(),l=this.locateInPolygonRing(n,s);if(l===Z.EXTERIOR)return Z.EXTERIOR;if(l===Z.BOUNDARY)return Z.BOUNDARY;for(var h=0;h<i.getNumInteriorRing();h++){var v=i.getInteriorRingN(h),S=this.locateInPolygonRing(n,v);if(S===Z.INTERIOR)return Z.EXTERIOR;if(S===Z.BOUNDARY)return Z.BOUNDARY}return Z.INTERIOR}if(arguments[0]instanceof D&&arguments[1]instanceof jt){var R=arguments[0],V=arguments[1];if(!V.getEnvelopeInternal().intersects(R))return Z.EXTERIOR;var ot=V.getCoordinates();return V.isClosed()||!R.equals(ot[0])&&!R.equals(ot[ot.length-1])?rt.isOnLine(R,ot)?Z.INTERIOR:Z.EXTERIOR:Z.BOUNDARY}if(arguments[0]instanceof D&&arguments[1]instanceof ge){var St=arguments[0];return arguments[1].getCoordinate().equals2D(St)?Z.INTERIOR:Z.EXTERIOR}},Be.prototype.locateInPolygonRing=function(n,i){return i.getEnvelopeInternal().intersects(n)?rt.locatePointInRing(n,i.getCoordinates()):Z.EXTERIOR},Be.prototype.intersects=function(n,i){return this.locate(n,i)!==Z.EXTERIOR},Be.prototype.updateLocationInfo=function(n){n===Z.INTERIOR&&(this._isIn=!0),n===Z.BOUNDARY&&this._numBoundaries++},Be.prototype.computeLocation=function(n,i){if(i instanceof ge&&this.updateLocationInfo(this.locateInternal(n,i)),i instanceof jt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof pe)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof K)for(var s=i,l=0;l<s.getNumGeometries();l++){var h=s.getGeometryN(l);this.updateLocationInfo(this.locateInternal(n,h))}else if(i instanceof Bn)for(var v=i,S=0;S<v.getNumGeometries();S++){var R=v.getGeometryN(S);this.updateLocationInfo(this.locateInternal(n,R))}else if(i instanceof Zn)for(var V=new co(i);V.hasNext();){var ot=V.next();ot!==i&&this.computeLocation(n,ot)}},Be.prototype.locate=function(n,i){return i.isEmpty()?Z.EXTERIOR:i instanceof jt?this.locateInternal(n,i):i instanceof pe?this.locateInternal(n,i):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(n,i),this._boundaryRule.isInBoundary(this._numBoundaries)?Z.BOUNDARY:this._numBoundaries>0||this._isIn?Z.INTERIOR:Z.EXTERIOR)},Be.prototype.interfaces_=function(){return[]},Be.prototype.getClass=function(){return Be};var tn=function n(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var i=arguments[0],s=arguments[1];n.call(this,i,n.INSIDE_AREA,s)}else if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2];this._component=l,this._segIndex=h,this._pt=v}},or={INSIDE_AREA:{configurable:!0}};tn.prototype.isInsideArea=function(){return this._segIndex===tn.INSIDE_AREA},tn.prototype.getCoordinate=function(){return this._pt},tn.prototype.getGeometryComponent=function(){return this._component},tn.prototype.getSegmentIndex=function(){return this._segIndex},tn.prototype.interfaces_=function(){return[]},tn.prototype.getClass=function(){return tn},or.INSIDE_AREA.get=function(){return-1},Object.defineProperties(tn,or);var es=function(n){this._pts=n||null};es.prototype.filter=function(n){n instanceof ge&&this._pts.add(n)},es.prototype.interfaces_=function(){return[hr]},es.prototype.getClass=function(){return es},es.getPoints=function(){if(arguments.length===1){var n=arguments[0];return n instanceof ge?uo.singletonList(n):es.getPoints(n,new nt)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof ge?s.add(i):i instanceof Zn&&i.apply(new es(s)),s}};var ba=function(){this._locations=null;var n=arguments[0];this._locations=n};ba.prototype.filter=function(n){(n instanceof ge||n instanceof jt||n instanceof pe)&&this._locations.add(new tn(n,0,n.getCoordinate()))},ba.prototype.interfaces_=function(){return[hr]},ba.prototype.getClass=function(){return ba},ba.getLocations=function(n){var i=new nt;return n.apply(new ba(i)),i};var Jn=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Be,this._minDistanceLocation=null,this._minDistance=A.MAX_VALUE,arguments.length===2){var n=arguments[0],i=arguments[1];this._geom=[n,i],this._terminateDistance=0}else if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=s,this._geom[1]=l,this._terminateDistance=h}};Jn.prototype.computeContainmentDistance=function(){if(arguments.length===0){var n=new Array(2).fill(null);if(this.computeContainmentDistance(0,n),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],l=1-i,h=re.getPolygons(this._geom[i]);if(h.size()>0){var v=ba.getLocations(this._geom[l]);if(this.computeContainmentDistance(v,h,s),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[l]=s[0],this._minDistanceLocation[i]=s[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&et(arguments[0],ut)&&et(arguments[1],ut)){for(var S=arguments[0],R=arguments[1],V=arguments[2],ot=0;ot<S.size();ot++)for(var St=S.get(ot),bt=0;bt<R.size();bt++)if(this.computeContainmentDistance(St,R.get(bt),V),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof tn&&arguments[1]instanceof pe){var Yt=arguments[0],Jt=arguments[1],se=arguments[2],_e=Yt.getCoordinate();if(Z.EXTERIOR!==this._ptLocator.locate(_e,Jt))return this._minDistance=0,se[0]=Yt,se[1]=new tn(Jt,_e),null}}},Jn.prototype.computeMinDistanceLinesPoints=function(n,i,s){for(var l=0;l<n.size();l++)for(var h=n.get(l),v=0;v<i.size();v++){var S=i.get(v);if(this.computeMinDistance(h,S,s),this._minDistance<=this._terminateDistance)return null}},Jn.prototype.computeFacetDistance=function(){var n=new Array(2).fill(null),i=ve.getLines(this._geom[0]),s=ve.getLines(this._geom[1]),l=es.getPoints(this._geom[0]),h=es.getPoints(this._geom[1]);return this.computeMinDistanceLines(i,s,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(i,h,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(s,l,n),this.updateMinDistance(n,!0),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistancePoints(l,h,n),void this.updateMinDistance(n,!1))))},Jn.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},Jn.prototype.updateMinDistance=function(n,i){if(n[0]===null)return null;i?(this._minDistanceLocation[0]=n[1],this._minDistanceLocation[1]=n[0]):(this._minDistanceLocation[0]=n[0],this._minDistanceLocation[1]=n[1])},Jn.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},Jn.prototype.computeMinDistance=function(){if(arguments.length===0){if(this._minDistanceLocation!==null||(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance))return null;this.computeFacetDistance()}else if(arguments.length===3){if(arguments[2]instanceof Array&&arguments[0]instanceof jt&&arguments[1]instanceof ge){var n=arguments[0],i=arguments[1],s=arguments[2];if(n.getEnvelopeInternal().distance(i.getEnvelopeInternal())>this._minDistance)return null;for(var l=n.getCoordinates(),h=i.getCoordinate(),v=0;v<l.length-1;v++){var S=rt.distancePointLine(h,l[v],l[v+1]);if(S<this._minDistance){this._minDistance=S;var R=new ne(l[v],l[v+1]).closestPoint(h);s[0]=new tn(n,v,R),s[1]=new tn(i,0,h)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof jt&&arguments[1]instanceof jt){var V=arguments[0],ot=arguments[1],St=arguments[2];if(V.getEnvelopeInternal().distance(ot.getEnvelopeInternal())>this._minDistance)return null;for(var bt=V.getCoordinates(),Yt=ot.getCoordinates(),Jt=0;Jt<bt.length-1;Jt++)for(var se=0;se<Yt.length-1;se++){var _e=rt.distanceLineLine(bt[Jt],bt[Jt+1],Yt[se],Yt[se+1]);if(_e<this._minDistance){this._minDistance=_e;var Cn=new ne(bt[Jt],bt[Jt+1]),Xn=new ne(Yt[se],Yt[se+1]),ui=Cn.closestPoints(Xn);St[0]=new tn(V,Jt,ui[0]),St[1]=new tn(ot,se,ui[1])}if(this._minDistance<=this._terminateDistance)return null}}}},Jn.prototype.computeMinDistancePoints=function(n,i,s){for(var l=0;l<n.size();l++)for(var h=n.get(l),v=0;v<i.size();v++){var S=i.get(v),R=h.getCoordinate().distance(S.getCoordinate());if(R<this._minDistance&&(this._minDistance=R,s[0]=new tn(h,0,h.getCoordinate()),s[1]=new tn(S,0,S.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},Jn.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new N("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},Jn.prototype.computeMinDistanceLines=function(n,i,s){for(var l=0;l<n.size();l++)for(var h=n.get(l),v=0;v<i.size();v++){var S=i.get(v);if(this.computeMinDistance(h,S,s),this._minDistance<=this._terminateDistance)return null}},Jn.prototype.interfaces_=function(){return[]},Jn.prototype.getClass=function(){return Jn},Jn.distance=function(n,i){return new Jn(n,i).distance()},Jn.isWithinDistance=function(n,i,s){return new Jn(n,i,s).distance()<=s},Jn.nearestPoints=function(n,i){return new Jn(n,i).nearestPoints()};var Rr=function(){this._pt=[new D,new D],this._distance=A.NaN,this._isNull=!0};Rr.prototype.getCoordinates=function(){return this._pt},Rr.prototype.getCoordinate=function(n){return this._pt[n]},Rr.prototype.setMinimum=function(){if(arguments.length===1){var n=arguments[0];this.setMinimum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var l=i.distance(s);l<this._distance&&this.initialize(i,s,l)}},Rr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=n.distance(i),this._isNull=!1}else if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(l),this._distance=h,this._isNull=!1}},Rr.prototype.toString=function(){return de.toLineString(this._pt[0],this._pt[1])},Rr.prototype.getDistance=function(){return this._distance},Rr.prototype.setMaximum=function(){if(arguments.length===1){var n=arguments[0];this.setMaximum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var l=i.distance(s);l>this._distance&&this.initialize(i,s,l)}},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr};var Lo=function(){};Lo.prototype.interfaces_=function(){return[]},Lo.prototype.getClass=function(){return Lo},Lo.computeDistance=function(){if(arguments[2]instanceof Rr&&arguments[0]instanceof jt&&arguments[1]instanceof D)for(var n=arguments[0],i=arguments[1],s=arguments[2],l=new ne,h=n.getCoordinates(),v=0;v<h.length-1;v++){l.setCoordinates(h[v],h[v+1]);var S=l.closestPoint(i);s.setMinimum(S,i)}else if(arguments[2]instanceof Rr&&arguments[0]instanceof pe&&arguments[1]instanceof D){var R=arguments[0],V=arguments[1],ot=arguments[2];Lo.computeDistance(R.getExteriorRing(),V,ot);for(var St=0;St<R.getNumInteriorRing();St++)Lo.computeDistance(R.getInteriorRingN(St),V,ot)}else if(arguments[2]instanceof Rr&&arguments[0]instanceof Ct&&arguments[1]instanceof D){var bt=arguments[0],Yt=arguments[1],Jt=arguments[2];if(bt instanceof jt)Lo.computeDistance(bt,Yt,Jt);else if(bt instanceof pe)Lo.computeDistance(bt,Yt,Jt);else if(bt instanceof Zn)for(var se=bt,_e=0;_e<se.getNumGeometries();_e++){var Cn=se.getGeometryN(_e);Lo.computeDistance(Cn,Yt,Jt)}else Jt.setMinimum(bt.getCoordinate(),Yt)}else if(arguments[2]instanceof Rr&&arguments[0]instanceof ne&&arguments[1]instanceof D){var Xn=arguments[0],ui=arguments[1],rs=arguments[2],Fs=Xn.closestPoint(ui);rs.setMinimum(Fs,ui)}};var ti=function(){this._g0=null,this._g1=null,this._ptDist=new Rr,this._densifyFrac=0;var n=arguments[0],i=arguments[1];this._g0=n,this._g1=i},iu={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};ti.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},ti.prototype.setDensifyFraction=function(n){if(n>1||n<=0)throw new N("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=n},ti.prototype.compute=function(n,i){this.computeOrientedDistance(n,i,this._ptDist),this.computeOrientedDistance(i,n,this._ptDist)},ti.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},ti.prototype.computeOrientedDistance=function(n,i,s){var l=new ys(i);if(n.apply(l),s.setMaximum(l.getMaxPointDistance()),this._densifyFrac>0){var h=new Ze(i,this._densifyFrac);n.apply(h),s.setMaximum(h.getMaxPointDistance())}},ti.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti},ti.distance=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new ti(n,i).distance()}if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2],v=new ti(s,l);return v.setDensifyFraction(h),v.distance()}},iu.MaxPointDistanceFilter.get=function(){return ys},iu.MaxDensifiedByFractionDistanceFilter.get=function(){return Ze},Object.defineProperties(ti,iu);var ys=function(){this._maxPtDist=new Rr,this._minPtDist=new Rr,this._euclideanDist=new Lo,this._geom=null;var n=arguments[0];this._geom=n};ys.prototype.filter=function(n){this._minPtDist.initialize(),Lo.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ys.prototype.getMaxPointDistance=function(){return this._maxPtDist},ys.prototype.interfaces_=function(){return[tt]},ys.prototype.getClass=function(){return ys};var Ze=function(){this._maxPtDist=new Rr,this._minPtDist=new Rr,this._geom=null,this._numSubSegs=0;var n=arguments[0],i=arguments[1];this._geom=n,this._numSubSegs=Math.trunc(Math.round(1/i))};Ze.prototype.filter=function(n,i){if(i===0)return null;for(var s=n.getCoordinate(i-1),l=n.getCoordinate(i),h=(l.x-s.x)/this._numSubSegs,v=(l.y-s.y)/this._numSubSegs,S=0;S<this._numSubSegs;S++){var R=s.x+S*h,V=s.y+S*v,ot=new D(R,V);this._minPtDist.initialize(),Lo.computeDistance(this._geom,ot,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},Ze.prototype.isDone=function(){return!1},Ze.prototype.isGeometryChanged=function(){return!1},Ze.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ze.prototype.interfaces_=function(){return[lr]},Ze.prototype.getClass=function(){return Ze};var bi=function(n,i,s){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=n||null,this._bufDistance=i||null,this._result=s||null},xl={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};bi.prototype.checkMaximumDistance=function(n,i,s){var l=new ti(i,n);if(l.setDensifyFraction(.25),this._maxDistanceFound=l.orientedDistance(),this._maxDistanceFound>s){this._isValid=!1;var h=l.getCoordinates();this._errorLocation=h[1],this._errorIndicator=n.getFactory().createLineString(h),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+de.toLineString(h[0],h[1])+")"}},bi.prototype.isValid=function(){var n=Math.abs(this._bufDistance),i=bi.MAX_DISTANCE_DIFF_FRAC*n;return this._minValidDistance=n-i,this._maxValidDistance=n+i,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),bi.VERBOSE&&Qt.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},bi.prototype.checkNegativeValid=function(){if(!(this._input instanceof pe||this._input instanceof Bn||this._input instanceof Zn))return null;var n=this.getPolygonLines(this._input);if(this.checkMinimumDistance(n,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(n,this._result,this._maxValidDistance)},bi.prototype.getErrorIndicator=function(){return this._errorIndicator},bi.prototype.checkMinimumDistance=function(n,i,s){var l=new Jn(n,i,s);if(this._minDistanceFound=l.distance(),this._minDistanceFound<s){this._isValid=!1;var h=l.nearestPoints();this._errorLocation=l.nearestPoints()[1],this._errorIndicator=n.getFactory().createLineString(h),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+de.toLineString(h[0],h[1])+" )"}},bi.prototype.checkPositiveValid=function(){var n=this._result.getBoundary();if(this.checkMinimumDistance(this._input,n,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,n,this._maxValidDistance)},bi.prototype.getErrorLocation=function(){return this._errorLocation},bi.prototype.getPolygonLines=function(n){for(var i=new nt,s=new ve(i),l=re.getPolygons(n).iterator();l.hasNext();)l.next().apply(s);return n.getFactory().buildGeometry(i)},bi.prototype.getErrorMessage=function(){return this._errMsg},bi.prototype.interfaces_=function(){return[]},bi.prototype.getClass=function(){return bi},xl.VERBOSE.get=function(){return!1},xl.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(bi,xl);var Cr=function(n,i,s){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=n||null,this._distance=i||null,this._result=s||null},Lc={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Cr.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},Cr.prototype.checkEnvelope=function(){if(this._distance<0)return null;var n=this._distance*Cr.MAX_ENV_DIFF_FRAC;n===0&&(n=.001);var i=new Xt(this._input.getEnvelopeInternal());i.expandBy(this._distance);var s=new Xt(this._result.getEnvelopeInternal());s.expandBy(n),s.contains(i)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(s)),this.report("Envelope")},Cr.prototype.checkDistance=function(){var n=new bi(this._input,this._distance,this._result);n.isValid()||(this._isValid=!1,this._errorMsg=n.getErrorMessage(),this._errorLocation=n.getErrorLocation(),this._errorIndicator=n.getErrorIndicator()),this.report("Distance")},Cr.prototype.checkArea=function(){var n=this._input.getArea(),i=this._result.getArea();this._distance>0&&n>i&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&n<i&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},Cr.prototype.checkPolygonal=function(){this._result instanceof pe||this._result instanceof Bn||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Cr.prototype.getErrorIndicator=function(){return this._errorIndicator},Cr.prototype.getErrorLocation=function(){return this._errorLocation},Cr.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Cr.prototype.report=function(n){if(!Cr.VERBOSE)return null;Qt.out.println("Check "+n+": "+(this._isValid?"passed":"FAILED"))},Cr.prototype.getErrorMessage=function(){return this._errorMsg},Cr.prototype.interfaces_=function(){return[]},Cr.prototype.getClass=function(){return Cr},Cr.isValidMsg=function(n,i,s){var l=new Cr(n,i,s);return l.isValid()?null:l.getErrorMessage()},Cr.isValid=function(n,i,s){return!!new Cr(n,i,s).isValid()},Lc.VERBOSE.get=function(){return!1},Lc.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Cr,Lc);var No=function(){this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};No.prototype.getCoordinates=function(){return this._pts},No.prototype.size=function(){return this._pts.length},No.prototype.getCoordinate=function(n){return this._pts[n]},No.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},No.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:Zs.octant(this.getCoordinate(n),this.getCoordinate(n+1))},No.prototype.setData=function(n){this._data=n},No.prototype.getData=function(){return this._data},No.prototype.toString=function(){return de.toLineString(new De(this._pts))},No.prototype.interfaces_=function(){return[Co]},No.prototype.getClass=function(){return No};var Br=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new nt,this._intersectionCount=0,this._keepIntersections=!0;var n=arguments[0];this._li=n,this._interiorIntersection=null};Br.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Br.prototype.setCheckEndSegmentsOnly=function(n){this._isCheckEndSegmentsOnly=n},Br.prototype.getIntersectionSegments=function(){return this._intSegments},Br.prototype.count=function(){return this._intersectionCount},Br.prototype.getIntersections=function(){return this._intersections},Br.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Br.prototype.setKeepIntersections=function(n){this._keepIntersections=n},Br.prototype.processIntersections=function(n,i,s,l){if(!this._findAllIntersections&&this.hasIntersection()||n===s&&i===l||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(n,i)||this.isEndSegment(s,l)))return null;var h=n.getCoordinates()[i],v=n.getCoordinates()[i+1],S=s.getCoordinates()[l],R=s.getCoordinates()[l+1];this._li.computeIntersection(h,v,S,R),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=h,this._intSegments[1]=v,this._intSegments[2]=S,this._intSegments[3]=R,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Br.prototype.isEndSegment=function(n,i){return i===0||i>=n.size()-2},Br.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Br.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},Br.prototype.interfaces_=function(){return[Ls]},Br.prototype.getClass=function(){return Br},Br.createAllIntersectionsFinder=function(n){var i=new Br(n);return i.setFindAllIntersections(!0),i},Br.createAnyIntersectionFinder=function(n){return new Br(n)},Br.createIntersectionCounter=function(n){var i=new Br(n);return i.setFindAllIntersections(!0),i.setKeepIntersections(!1),i};var Ti=function(){this._li=new $n,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var n=arguments[0];this._segStrings=n};Ti.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},Ti.prototype.getIntersections=function(){return this._segInt.getIntersections()},Ti.prototype.isValid=function(){return this.execute(),this._isValid},Ti.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Ti.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Br(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var n=new zu;if(n.setSegmentIntersector(this._segInt),n.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Ti.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Zo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Ti.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var n=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+de.toLineString(n[0],n[1])+" and "+de.toLineString(n[2],n[3])},Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti},Ti.computeIntersections=function(n){var i=new Ti(n);return i.setFindAllIntersections(!0),i.isValid(),i.getIntersections()};var Vi=function n(){this._nv=null;var i=arguments[0];this._nv=new Ti(n.toSegmentStrings(i))};Vi.prototype.checkValid=function(){this._nv.checkValid()},Vi.prototype.interfaces_=function(){return[]},Vi.prototype.getClass=function(){return Vi},Vi.toSegmentStrings=function(n){for(var i=new nt,s=n.iterator();s.hasNext();){var l=s.next();i.add(new No(l.getCoordinates(),l))}return i},Vi.checkValid=function(n){new Vi(n).checkValid()};var vs=function(n){this._mapOp=n};vs.prototype.map=function(n){for(var i=new nt,s=0;s<n.getNumGeometries();s++){var l=this._mapOp.map(n.getGeometryN(s));l.isEmpty()||i.add(l)}return n.getFactory().createGeometryCollection(Ce.toGeometryArray(i))},vs.prototype.interfaces_=function(){return[]},vs.prototype.getClass=function(){return vs},vs.map=function(n,i){return new vs(i).map(n)};var ho=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new nt,this._resultLineList=new nt;var n=arguments[0],i=arguments[1],s=arguments[2];this._op=n,this._geometryFactory=i,this._ptLocator=s};ho.prototype.collectLines=function(n){for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next();this.collectLineEdge(s,n,this._lineEdgesList),this.collectBoundaryTouchEdge(s,n,this._lineEdgesList)}},ho.prototype.labelIsolatedLine=function(n,i){var s=this._ptLocator.locate(n.getCoordinate(),this._op.getArgGeometry(i));n.getLabel().setLocation(i,s)},ho.prototype.build=function(n){return this.findCoveredLineEdges(),this.collectLines(n),this.buildLines(n),this._resultLineList},ho.prototype.collectLineEdge=function(n,i,s){var l=n.getLabel(),h=n.getEdge();n.isLineEdge()&&(n.isVisited()||!Ae.isResultOfOp(l,i)||h.isCovered()||(s.add(h),n.setVisitedEdge(!0)))},ho.prototype.findCoveredLineEdges=function(){for(var n=this._op.getGraph().getNodes().iterator();n.hasNext();)n.next().getEdges().findCoveredLineEdges();for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next(),l=s.getEdge();if(s.isLineEdge()&&!l.isCoveredSet()){var h=this._op.isCoveredByA(s.getCoordinate());l.setCovered(h)}}},ho.prototype.labelIsolatedLines=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),l=s.getLabel();s.isIsolated()&&(l.isNull(0)?this.labelIsolatedLine(s,0):this.labelIsolatedLine(s,1))}},ho.prototype.buildLines=function(n){for(var i=this._lineEdgesList.iterator();i.hasNext();){var s=i.next(),l=this._geometryFactory.createLineString(s.getCoordinates());this._resultLineList.add(l),s.setInResult(!0)}},ho.prototype.collectBoundaryTouchEdge=function(n,i,s){var l=n.getLabel();return n.isLineEdge()||n.isVisited()||n.isInteriorAreaEdge()||n.getEdge().isInResult()?null:(kt.isTrue(!(n.isInResult()||n.getSym().isInResult())||!n.getEdge().isInResult()),void(Ae.isResultOfOp(l,i)&&i===Ae.INTERSECTION&&(s.add(n.getEdge()),n.setVisitedEdge(!0))))},ho.prototype.interfaces_=function(){return[]},ho.prototype.getClass=function(){return ho};var _s=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new nt;var n=arguments[0],i=arguments[1];this._op=n,this._geometryFactory=i};_s.prototype.filterCoveredNodeToPoint=function(n){var i=n.getCoordinate();if(!this._op.isCoveredByLA(i)){var s=this._geometryFactory.createPoint(i);this._resultPointList.add(s)}},_s.prototype.extractNonCoveredResultNodes=function(n){for(var i=this._op.getGraph().getNodes().iterator();i.hasNext();){var s=i.next();if(!s.isInResult()&&!s.isIncidentEdgeInResult()&&(s.getEdges().getDegree()===0||n===Ae.INTERSECTION)){var l=s.getLabel();Ae.isResultOfOp(l,n)&&this.filterCoveredNodeToPoint(s)}}},_s.prototype.build=function(n){return this.extractNonCoveredResultNodes(n),this._resultPointList},_s.prototype.interfaces_=function(){return[]},_s.prototype.getClass=function(){return _s};var si=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};si.prototype.transformPoint=function(n,i){return this._factory.createPoint(this.transformCoordinates(n.getCoordinateSequence(),n))},si.prototype.transformPolygon=function(n,i){var s=!0,l=this.transformLinearRing(n.getExteriorRing(),n);l!==null&&l instanceof Tn&&!l.isEmpty()||(s=!1);for(var h=new nt,v=0;v<n.getNumInteriorRing();v++){var S=this.transformLinearRing(n.getInteriorRingN(v),n);S===null||S.isEmpty()||(S instanceof Tn||(s=!1),h.add(S))}if(s)return this._factory.createPolygon(l,h.toArray([]));var R=new nt;return l!==null&&R.add(l),R.addAll(h),this._factory.buildGeometry(R)},si.prototype.createCoordinateSequence=function(n){return this._factory.getCoordinateSequenceFactory().create(n)},si.prototype.getInputGeometry=function(){return this._inputGeom},si.prototype.transformMultiLineString=function(n,i){for(var s=new nt,l=0;l<n.getNumGeometries();l++){var h=this.transformLineString(n.getGeometryN(l),n);h!==null&&(h.isEmpty()||s.add(h))}return this._factory.buildGeometry(s)},si.prototype.transformCoordinates=function(n,i){return this.copy(n)},si.prototype.transformLineString=function(n,i){return this._factory.createLineString(this.transformCoordinates(n.getCoordinateSequence(),n))},si.prototype.transformMultiPoint=function(n,i){for(var s=new nt,l=0;l<n.getNumGeometries();l++){var h=this.transformPoint(n.getGeometryN(l),n);h!==null&&(h.isEmpty()||s.add(h))}return this._factory.buildGeometry(s)},si.prototype.transformMultiPolygon=function(n,i){for(var s=new nt,l=0;l<n.getNumGeometries();l++){var h=this.transformPolygon(n.getGeometryN(l),n);h!==null&&(h.isEmpty()||s.add(h))}return this._factory.buildGeometry(s)},si.prototype.copy=function(n){return n.copy()},si.prototype.transformGeometryCollection=function(n,i){for(var s=new nt,l=0;l<n.getNumGeometries();l++){var h=this.transform(n.getGeometryN(l));h!==null&&(this._pruneEmptyGeometry&&h.isEmpty()||s.add(h))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Ce.toGeometryArray(s)):this._factory.buildGeometry(s)},si.prototype.transform=function(n){if(this._inputGeom=n,this._factory=n.getFactory(),n instanceof ge)return this.transformPoint(n,null);if(n instanceof Oe)return this.transformMultiPoint(n,null);if(n instanceof Tn)return this.transformLinearRing(n,null);if(n instanceof jt)return this.transformLineString(n,null);if(n instanceof K)return this.transformMultiLineString(n,null);if(n instanceof pe)return this.transformPolygon(n,null);if(n instanceof Bn)return this.transformMultiPolygon(n,null);if(n instanceof Zn)return this.transformGeometryCollection(n,null);throw new N("Unknown Geometry subtype: "+n.getClass().getName())},si.prototype.transformLinearRing=function(n,i){var s=this.transformCoordinates(n.getCoordinateSequence(),n);if(s===null)return this._factory.createLinearRing(null);var l=s.size();return l>0&&l<4&&!this._preserveType?this._factory.createLineString(s):this._factory.createLinearRing(s)},si.prototype.interfaces_=function(){return[]},si.prototype.getClass=function(){return si};var Oo=function n(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new ne,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof jt&&typeof arguments[1]=="number"){var i=arguments[0],s=arguments[1];n.call(this,i.getCoordinates(),s)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var l=arguments[0],h=arguments[1];this._srcPts=l,this._isClosed=n.isClosed(l),this._snapTolerance=h}};Oo.prototype.snapVertices=function(n,i){for(var s=this._isClosed?n.size()-1:n.size(),l=0;l<s;l++){var h=n.get(l),v=this.findSnapForVertex(h,i);v!==null&&(n.set(l,new D(v)),l===0&&this._isClosed&&n.set(n.size()-1,new D(v)))}},Oo.prototype.findSnapForVertex=function(n,i){for(var s=0;s<i.length;s++){if(n.equals2D(i[s]))return null;if(n.distance(i[s])<this._snapTolerance)return i[s]}return null},Oo.prototype.snapTo=function(n){var i=new dt(this._srcPts);return this.snapVertices(i,n),this.snapSegments(i,n),i.toCoordinateArray()},Oo.prototype.snapSegments=function(n,i){if(i.length===0)return null;var s=i.length;i[0].equals2D(i[i.length-1])&&(s=i.length-1);for(var l=0;l<s;l++){var h=i[l],v=this.findSegmentIndexToSnap(h,n);v>=0&&n.add(v+1,new D(h),!1)}},Oo.prototype.findSegmentIndexToSnap=function(n,i){for(var s=A.MAX_VALUE,l=-1,h=0;h<i.size()-1;h++){if(this._seg.p0=i.get(h),this._seg.p1=i.get(h+1),this._seg.p0.equals2D(n)||this._seg.p1.equals2D(n)){if(this._allowSnappingToSourceVertices)continue;return-1}var v=this._seg.distance(n);v<this._snapTolerance&&v<s&&(s=v,l=h)}return l},Oo.prototype.setAllowSnappingToSourceVertices=function(n){this._allowSnappingToSourceVertices=n},Oo.prototype.interfaces_=function(){return[]},Oo.prototype.getClass=function(){return Oo},Oo.isClosed=function(n){return!(n.length<=1)&&n[0].equals2D(n[n.length-1])};var sr=function(n){this._srcGeom=n||null},Nc={SNAP_PRECISION_FACTOR:{configurable:!0}};sr.prototype.snapTo=function(n,i){var s=this.extractTargetCoordinates(n);return new ou(i,s).transform(this._srcGeom)},sr.prototype.snapToSelf=function(n,i){var s=this.extractTargetCoordinates(this._srcGeom),l=new ou(n,s,!0).transform(this._srcGeom),h=l;return i&&et(h,Ne)&&(h=l.buffer(0)),h},sr.prototype.computeSnapTolerance=function(n){return this.computeMinimumSegmentLength(n)/10},sr.prototype.extractTargetCoordinates=function(n){for(var i=new b,s=n.getCoordinates(),l=0;l<s.length;l++)i.add(s[l]);return i.toArray(new Array(0).fill(null))},sr.prototype.computeMinimumSegmentLength=function(n){for(var i=A.MAX_VALUE,s=0;s<n.length-1;s++){var l=n[s].distance(n[s+1]);l<i&&(i=l)}return i},sr.prototype.interfaces_=function(){return[]},sr.prototype.getClass=function(){return sr},sr.snap=function(n,i,s){var l=new Array(2).fill(null),h=new sr(n);l[0]=h.snapTo(i,s);var v=new sr(i);return l[1]=v.snapTo(l[0],s),l},sr.computeOverlaySnapTolerance=function(){if(arguments.length===1){var n=arguments[0],i=sr.computeSizeBasedSnapTolerance(n),s=n.getPrecisionModel();if(s.getType()===Se.FIXED){var l=1/s.getScale()*2/1.415;l>i&&(i=l)}return i}if(arguments.length===2){var h=arguments[0],v=arguments[1];return Math.min(sr.computeOverlaySnapTolerance(h),sr.computeOverlaySnapTolerance(v))}},sr.computeSizeBasedSnapTolerance=function(n){var i=n.getEnvelopeInternal();return Math.min(i.getHeight(),i.getWidth())*sr.SNAP_PRECISION_FACTOR},sr.snapToSelf=function(n,i,s){return new sr(n).snapToSelf(i,s)},Nc.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(sr,Nc);var ou=function(n){function i(s,l,h){n.call(this),this._snapTolerance=s||null,this._snapPts=l||null,this._isSelfSnap=h!==void 0&&h}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.snapLine=function(s,l){var h=new Oo(s,this._snapTolerance);return h.setAllowSnappingToSourceVertices(this._isSelfSnap),h.snapTo(l)},i.prototype.transformCoordinates=function(s,l){var h=s.toCoordinateArray(),v=this.snapLine(h,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(v)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(si),Sr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Sr.prototype.getCommon=function(){return A.longBitsToDouble(this._commonBits)},Sr.prototype.add=function(n){var i=A.doubleToLongBits(n);if(this._isFirst)return this._commonBits=i,this._commonSignExp=Sr.signExpBits(this._commonBits),this._isFirst=!1,null;if(Sr.signExpBits(i)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Sr.numCommonMostSigMantissaBits(this._commonBits,i),this._commonBits=Sr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Sr.prototype.toString=function(){if(arguments.length===1){var n=arguments[0],i=A.longBitsToDouble(n),s="0000000000000000000000000000000000000000000000000000000000000000"+A.toBinaryString(n),l=s.substring(s.length-64);return l.substring(0,1)+" "+l.substring(1,12)+"(exp) "+l.substring(12)+" [ "+i+" ]"}},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},Sr.getBit=function(n,i){return n&1<<i?1:0},Sr.signExpBits=function(n){return n>>52},Sr.zeroLowerBits=function(n,i){return n&~((1<<i)-1)},Sr.numCommonMostSigMantissaBits=function(n,i){for(var s=0,l=52;l>=0;l--){if(Sr.getBit(n,l)!==Sr.getBit(i,l))return s;s++}return 52};var Do=function(){this._commonCoord=null,this._ccFilter=new Ta},Oc={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Do.prototype.addCommonBits=function(n){var i=new Os(this._commonCoord);n.apply(i),n.geometryChanged()},Do.prototype.removeCommonBits=function(n){if(this._commonCoord.x===0&&this._commonCoord.y===0)return n;var i=new D(this._commonCoord);i.x=-i.x,i.y=-i.y;var s=new Os(i);return n.apply(s),n.geometryChanged(),n},Do.prototype.getCommonCoordinate=function(){return this._commonCoord},Do.prototype.add=function(n){n.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Do.prototype.interfaces_=function(){return[]},Do.prototype.getClass=function(){return Do},Oc.CommonCoordinateFilter.get=function(){return Ta},Oc.Translater.get=function(){return Os},Object.defineProperties(Do,Oc);var Ta=function(){this._commonBitsX=new Sr,this._commonBitsY=new Sr};Ta.prototype.filter=function(n){this._commonBitsX.add(n.x),this._commonBitsY.add(n.y)},Ta.prototype.getCommonCoordinate=function(){return new D(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Ta.prototype.interfaces_=function(){return[tt]},Ta.prototype.getClass=function(){return Ta};var Os=function(){this.trans=null;var n=arguments[0];this.trans=n};Os.prototype.filter=function(n,i){var s=n.getOrdinate(i,0)+this.trans.x,l=n.getOrdinate(i,1)+this.trans.y;n.setOrdinate(i,0,s),n.setOrdinate(i,1,l)},Os.prototype.isDone=function(){return!1},Os.prototype.isGeometryChanged=function(){return!0},Os.prototype.interfaces_=function(){return[lr]},Os.prototype.getClass=function(){return Os};var br=function(n,i){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=n,this._geom[1]=i,this.computeSnapTolerance()};br.prototype.selfSnap=function(n){return new sr(n).snapTo(n,this._snapTolerance)},br.prototype.removeCommonBits=function(n){this._cbr=new Do,this._cbr.add(n[0]),this._cbr.add(n[1]);var i=new Array(2).fill(null);return i[0]=this._cbr.removeCommonBits(n[0].copy()),i[1]=this._cbr.removeCommonBits(n[1].copy()),i},br.prototype.prepareResult=function(n){return this._cbr.addCommonBits(n),n},br.prototype.getResultGeometry=function(n){var i=this.snap(this._geom),s=Ae.overlayOp(i[0],i[1],n);return this.prepareResult(s)},br.prototype.checkValid=function(n){n.isValid()||Qt.out.println("Snapped geometry is invalid")},br.prototype.computeSnapTolerance=function(){this._snapTolerance=sr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},br.prototype.snap=function(n){var i=this.removeCommonBits(n);return sr.snap(i[0],i[1],this._snapTolerance)},br.prototype.interfaces_=function(){return[]},br.prototype.getClass=function(){return br},br.overlayOp=function(n,i,s){return new br(n,i).getResultGeometry(s)},br.union=function(n,i){return br.overlayOp(n,i,Ae.UNION)},br.intersection=function(n,i){return br.overlayOp(n,i,Ae.INTERSECTION)},br.symDifference=function(n,i){return br.overlayOp(n,i,Ae.SYMDIFFERENCE)},br.difference=function(n,i){return br.overlayOp(n,i,Ae.DIFFERENCE)};var zr=function(n,i){this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i};zr.prototype.getResultGeometry=function(n){var i=null,s=!1,l=null;try{i=Ae.overlayOp(this._geom[0],this._geom[1],n),s=!0}catch(h){if(!(h instanceof Ue))throw h;l=h}if(!s)try{i=br.overlayOp(this._geom[0],this._geom[1],n)}catch(h){throw h instanceof Ue?l:h}return i},zr.prototype.interfaces_=function(){return[]},zr.prototype.getClass=function(){return zr},zr.overlayOp=function(n,i,s){return new zr(n,i).getResultGeometry(s)},zr.union=function(n,i){return zr.overlayOp(n,i,Ae.UNION)},zr.intersection=function(n,i){return zr.overlayOp(n,i,Ae.INTERSECTION)},zr.symDifference=function(n,i){return zr.overlayOp(n,i,Ae.SYMDIFFERENCE)},zr.difference=function(n,i){return zr.overlayOp(n,i,Ae.DIFFERENCE)};var Aa=function(){this.mce=null,this.chainIndex=null;var n=arguments[0],i=arguments[1];this.mce=n,this.chainIndex=i};Aa.prototype.computeIntersections=function(n,i){this.mce.computeIntersectsForChain(this.chainIndex,n.mce,n.chainIndex,i)},Aa.prototype.interfaces_=function(){return[]},Aa.prototype.getClass=function(){return Aa};var Ai=function n(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var i=arguments[0],s=arguments[1];this._eventType=n.DELETE,this._xValue=i,this._insertEvent=s}else if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2];this._eventType=n.INSERT,this._label=l,this._xValue=h,this._obj=v}},El={INSERT:{configurable:!0},DELETE:{configurable:!0}};Ai.prototype.isDelete=function(){return this._eventType===Ai.DELETE},Ai.prototype.setDeleteEventIndex=function(n){this._deleteEventIndex=n},Ai.prototype.getObject=function(){return this._obj},Ai.prototype.compareTo=function(n){var i=n;return this._xValue<i._xValue?-1:this._xValue>i._xValue?1:this._eventType<i._eventType?-1:this._eventType>i._eventType?1:0},Ai.prototype.getInsertEvent=function(){return this._insertEvent},Ai.prototype.isInsert=function(){return this._eventType===Ai.INSERT},Ai.prototype.isSameLabel=function(n){return this._label!==null&&this._label===n._label},Ai.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Ai.prototype.interfaces_=function(){return[z]},Ai.prototype.getClass=function(){return Ai},El.INSERT.get=function(){return 1},El.DELETE.get=function(){return 2},Object.defineProperties(Ai,El);var wl=function(){};wl.prototype.interfaces_=function(){return[]},wl.prototype.getClass=function(){return wl};var Yr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var n=arguments[0],i=arguments[1],s=arguments[2];this._li=n,this._includeProper=i,this._recordIsolated=s};Yr.prototype.isTrivialIntersection=function(n,i,s,l){if(n===s&&this._li.getIntersectionNum()===1){if(Yr.isAdjacentSegments(i,l))return!0;if(n.isClosed()){var h=n.getNumPoints()-1;if(i===0&&l===h||l===0&&i===h)return!0}}return!1},Yr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Yr.prototype.setIsDoneIfProperInt=function(n){this._isDoneWhenProperInt=n},Yr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Yr.prototype.isBoundaryPointInternal=function(n,i){for(var s=i.iterator();s.hasNext();){var l=s.next().getCoordinate();if(n.isIntersection(l))return!0}return!1},Yr.prototype.hasProperIntersection=function(){return this._hasProper},Yr.prototype.hasIntersection=function(){return this._hasIntersection},Yr.prototype.isDone=function(){return this._isDone},Yr.prototype.isBoundaryPoint=function(n,i){return i!==null&&(!!this.isBoundaryPointInternal(n,i[0])||!!this.isBoundaryPointInternal(n,i[1]))},Yr.prototype.setBoundaryNodes=function(n,i){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=n,this._bdyNodes[1]=i},Yr.prototype.addIntersections=function(n,i,s,l){if(n===s&&i===l)return null;this.numTests++;var h=n.getCoordinates()[i],v=n.getCoordinates()[i+1],S=s.getCoordinates()[l],R=s.getCoordinates()[l+1];this._li.computeIntersection(h,v,S,R),this._li.hasIntersection()&&(this._recordIsolated&&(n.setIsolated(!1),s.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(n,i,s,l)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(n.addIntersections(this._li,i,0),s.addIntersections(this._li,l,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr},Yr.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var ei=function(n){function i(){n.call(this),this.events=new nt,this.nOverlaps=null}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.prepareEvents=function(){uo.sort(this.events);for(var s=0;s<this.events.size();s++){var l=this.events.get(s);l.isDelete()&&l.getInsertEvent().setDeleteEventIndex(s)}},i.prototype.computeIntersections=function(){if(arguments.length===1){var s=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var l=0;l<this.events.size();l++){var h=this.events.get(l);if(h.isInsert()&&this.processOverlaps(l,h.getDeleteEventIndex(),h,s),s.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof Yr&&et(arguments[0],ut)&&et(arguments[1],ut)){var v=arguments[0],S=arguments[1],R=arguments[2];this.addEdges(v,v),this.addEdges(S,S),this.computeIntersections(R)}else if(typeof arguments[2]=="boolean"&&et(arguments[0],ut)&&arguments[1]instanceof Yr){var V=arguments[0],ot=arguments[1];arguments[2]?this.addEdges(V,null):this.addEdges(V),this.computeIntersections(ot)}}},i.prototype.addEdge=function(s,l){for(var h=s.getMonotoneChainEdge(),v=h.getStartIndexes(),S=0;S<v.length-1;S++){var R=new Aa(h,S),V=new Ai(l,h.getMinX(S),R);this.events.add(V),this.events.add(new Ai(h.getMaxX(S),V))}},i.prototype.processOverlaps=function(s,l,h,v){for(var S=h.getObject(),R=s;R<l;R++){var V=this.events.get(R);if(V.isInsert()){var ot=V.getObject();h.isSameLabel(V)||(S.computeIntersections(ot,v),this.nOverlaps++)}}},i.prototype.addEdges=function(){if(arguments.length===1)for(var s=arguments[0].iterator();s.hasNext();){var l=s.next();this.addEdge(l,l)}else if(arguments.length===2)for(var h=arguments[0],v=arguments[1],S=h.iterator();S.hasNext();){var R=S.next();this.addEdge(R,v)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(wl),mr=function(){this._min=A.POSITIVE_INFINITY,this._max=A.NEGATIVE_INFINITY},Bf={NodeComparator:{configurable:!0}};mr.prototype.getMin=function(){return this._min},mr.prototype.intersects=function(n,i){return!(this._min>i||this._max<n)},mr.prototype.getMax=function(){return this._max},mr.prototype.toString=function(){return de.toLineString(new D(this._min,0),new D(this._max,0))},mr.prototype.interfaces_=function(){return[]},mr.prototype.getClass=function(){return mr},Bf.NodeComparator.get=function(){return ku},Object.defineProperties(mr,Bf);var ku=function(){};ku.prototype.compare=function(n,i){var s=n,l=i,h=(s._min+s._max)/2,v=(l._min+l._max)/2;return h<v?-1:h>v?1:0},ku.prototype.interfaces_=function(){return[q]},ku.prototype.getClass=function(){return ku};var zf=function(n){function i(){n.call(this),this._item=null;var s=arguments[0],l=arguments[1],h=arguments[2];this._min=s,this._max=l,this._item=h}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.query=function(s,l,h){if(!this.intersects(s,l))return null;h.visitItem(this._item)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(mr),id=function(n){function i(){n.call(this),this._node1=null,this._node2=null;var s=arguments[0],l=arguments[1];this._node1=s,this._node2=l,this.buildExtent(this._node1,this._node2)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildExtent=function(s,l){this._min=Math.min(s._min,l._min),this._max=Math.max(s._max,l._max)},i.prototype.query=function(s,l,h){if(!this.intersects(s,l))return null;this._node1!==null&&this._node1.query(s,l,h),this._node2!==null&&this._node2.query(s,l,h)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(mr),po=function(){this._leaves=new nt,this._root=null,this._level=0};po.prototype.buildTree=function(){uo.sort(this._leaves,new mr.NodeComparator);for(var n=this._leaves,i=null,s=new nt;;){if(this.buildLevel(n,s),s.size()===1)return s.get(0);i=n,n=s,s=i}},po.prototype.insert=function(n,i,s){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new zf(n,i,s))},po.prototype.query=function(n,i,s){this.init(),this._root.query(n,i,s)},po.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},po.prototype.printNode=function(n){Qt.out.println(de.toLineString(new D(n._min,this._level),new D(n._max,this._level)))},po.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},po.prototype.buildLevel=function(n,i){this._level++,i.clear();for(var s=0;s<n.size();s+=2){var l=n.get(s);if((s+1<n.size()?n.get(s):null)===null)i.add(l);else{var h=new id(n.get(s),n.get(s+1));i.add(h)}}},po.prototype.interfaces_=function(){return[]},po.prototype.getClass=function(){return po};var xs=function(){this._items=new nt};xs.prototype.visitItem=function(n){this._items.add(n)},xs.prototype.getItems=function(){return this._items},xs.prototype.interfaces_=function(){return[Rs]},xs.prototype.getClass=function(){return xs};var ea=function(){this._index=null;var n=arguments[0];if(!et(n,Ne))throw new N("Argument must be Polygonal");this._index=new Fo(n)},na={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};ea.prototype.locate=function(n){var i=new H(n),s=new Es(i);return this._index.query(n.y,n.y,s),i.getLocation()},ea.prototype.interfaces_=function(){return[eu]},ea.prototype.getClass=function(){return ea},na.SegmentVisitor.get=function(){return Es},na.IntervalIndexedGeometry.get=function(){return Fo},Object.defineProperties(ea,na);var Es=function(){this._counter=null;var n=arguments[0];this._counter=n};Es.prototype.visitItem=function(n){var i=n;this._counter.countSegment(i.getCoordinate(0),i.getCoordinate(1))},Es.prototype.interfaces_=function(){return[Rs]},Es.prototype.getClass=function(){return Es};var Fo=function(){this._index=new po;var n=arguments[0];this.init(n)};Fo.prototype.init=function(n){for(var i=ve.getLines(n).iterator();i.hasNext();){var s=i.next().getCoordinates();this.addLine(s)}},Fo.prototype.addLine=function(n){for(var i=1;i<n.length;i++){var s=new ne(n[i-1],n[i]),l=Math.min(s.p0.y,s.p1.y),h=Math.max(s.p0.y,s.p1.y);this._index.insert(l,h,s)}},Fo.prototype.query=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new xs;return this._index.query(n,i,s),s.getItems()}if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2];this._index.query(l,h,v)}},Fo.prototype.interfaces_=function(){return[]},Fo.prototype.getClass=function(){return Fo};var ra=function(n){function i(){if(n.call(this),this._parentGeom=null,this._lineEdgeMap=new Ka,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Be,arguments.length===2){var s=arguments[0],l=arguments[1],h=C.OGC_SFS_BOUNDARY_RULE;this._argIndex=s,this._parentGeom=l,this._boundaryNodeRule=h,l!==null&&this.add(l)}else if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];this._argIndex=v,this._parentGeom=S,this._boundaryNodeRule=R,S!==null&&this.add(S)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertBoundaryPoint=function(s,l){var h=this._nodes.addNode(l).getLabel(),v=1;Z.NONE,h.getLocation(s,Ht.ON)===Z.BOUNDARY&&v++;var S=i.determineBoundary(this._boundaryNodeRule,v);h.setLocation(s,S)},i.prototype.computeSelfNodes=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return this.computeSelfNodes(s,l,!1)}if(arguments.length===3){var h=arguments[0],v=arguments[1],S=arguments[2],R=new Yr(h,!0,!1);R.setIsDoneIfProperInt(S);var V=this.createEdgeSetIntersector(),ot=this._parentGeom instanceof Tn||this._parentGeom instanceof pe||this._parentGeom instanceof Bn,St=v||!ot;return V.computeIntersections(this._edges,R,St),this.addSelfIntersectionNodes(this._argIndex),R}},i.prototype.computeSplitEdges=function(s){for(var l=this._edges.iterator();l.hasNext();)l.next().eiList.addSplitEdges(s)},i.prototype.computeEdgeIntersections=function(s,l,h){var v=new Yr(l,h,!0);return v.setBoundaryNodes(this.getBoundaryNodes(),s.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,s._edges,v),v},i.prototype.getGeometry=function(){return this._parentGeom},i.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},i.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},i.prototype.addPoint=function(){if(arguments[0]instanceof ge){var s=arguments[0].getCoordinate();this.insertPoint(this._argIndex,s,Z.INTERIOR)}else if(arguments[0]instanceof D){var l=arguments[0];this.insertPoint(this._argIndex,l,Z.INTERIOR)}},i.prototype.addPolygon=function(s){this.addPolygonRing(s.getExteriorRing(),Z.EXTERIOR,Z.INTERIOR);for(var l=0;l<s.getNumInteriorRing();l++){var h=s.getInteriorRingN(l);this.addPolygonRing(h,Z.INTERIOR,Z.EXTERIOR)}},i.prototype.addEdge=function(s){this.insertEdge(s);var l=s.getCoordinates();this.insertPoint(this._argIndex,l[0],Z.BOUNDARY),this.insertPoint(this._argIndex,l[l.length-1],Z.BOUNDARY)},i.prototype.addLineString=function(s){var l=at.removeRepeatedPoints(s.getCoordinates());if(l.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=l[0],null;var h=new _l(l,new An(this._argIndex,Z.INTERIOR));this._lineEdgeMap.put(s,h),this.insertEdge(h),kt.isTrue(l.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,l[0]),this.insertBoundaryPoint(this._argIndex,l[l.length-1])},i.prototype.getInvalidPoint=function(){return this._invalidPoint},i.prototype.getBoundaryPoints=function(){for(var s=this.getBoundaryNodes(),l=new Array(s.size()).fill(null),h=0,v=s.iterator();v.hasNext();){var S=v.next();l[h++]=S.getCoordinate().copy()}return l},i.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},i.prototype.addSelfIntersectionNode=function(s,l,h){if(this.isBoundaryNode(s,l))return null;h===Z.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(s,l):this.insertPoint(s,l,h)},i.prototype.addPolygonRing=function(s,l,h){if(s.isEmpty())return null;var v=at.removeRepeatedPoints(s.getCoordinates());if(v.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=v[0],null;var S=l,R=h;rt.isCCW(v)&&(S=h,R=l);var V=new _l(v,new An(this._argIndex,Z.BOUNDARY,S,R));this._lineEdgeMap.put(s,V),this.insertEdge(V),this.insertPoint(this._argIndex,v[0],Z.BOUNDARY)},i.prototype.insertPoint=function(s,l,h){var v=this._nodes.addNode(l),S=v.getLabel();S===null?v._label=new An(s,h):S.setLocation(s,h)},i.prototype.createEdgeSetIntersector=function(){return new ei},i.prototype.addSelfIntersectionNodes=function(s){for(var l=this._edges.iterator();l.hasNext();)for(var h=l.next(),v=h.getLabel().getLocation(s),S=h.eiList.iterator();S.hasNext();){var R=S.next();this.addSelfIntersectionNode(s,R.coord,v)}},i.prototype.add=function(){if(arguments.length!==1)return n.prototype.add.apply(this,arguments);var s=arguments[0];if(s.isEmpty())return null;if(s instanceof Bn&&(this._useBoundaryDeterminationRule=!1),s instanceof pe)this.addPolygon(s);else if(s instanceof jt)this.addLineString(s);else if(s instanceof ge)this.addPoint(s);else if(s instanceof Oe)this.addCollection(s);else if(s instanceof K)this.addCollection(s);else if(s instanceof Bn)this.addCollection(s);else{if(!(s instanceof Zn))throw new Error(s.getClass().getName());this.addCollection(s)}},i.prototype.addCollection=function(s){for(var l=0;l<s.getNumGeometries();l++){var h=s.getGeometryN(l);this.add(h)}},i.prototype.locate=function(s){return et(this._parentGeom,Ne)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new ea(this._parentGeom)),this._areaPtLocator.locate(s)):this._ptLocator.locate(s,this._parentGeom)},i.prototype.findEdge=function(){if(arguments.length===1){var s=arguments[0];return this._lineEdgeMap.get(s)}return n.prototype.findEdge.apply(this,arguments)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.determineBoundary=function(s,l){return s.isInBoundary(l)?Z.BOUNDARY:Z.INTERIOR},i}(cr),ns=function(){if(this._li=new $n,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var n=arguments[0];this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new ra(0,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],l=C.OGC_SFS_BOUNDARY_RULE;i.getPrecisionModel().compareTo(s.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(s.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ra(0,i,l),this._arg[1]=new ra(1,s,l)}else if(arguments.length===3){var h=arguments[0],v=arguments[1],S=arguments[2];h.getPrecisionModel().compareTo(v.getPrecisionModel())>=0?this.setComputationPrecision(h.getPrecisionModel()):this.setComputationPrecision(v.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ra(0,h,S),this._arg[1]=new ra(1,v,S)}};ns.prototype.getArgGeometry=function(n){return this._arg[n].getGeometry()},ns.prototype.setComputationPrecision=function(n){this._resultPrecisionModel=n,this._li.setPrecisionModel(this._resultPrecisionModel)},ns.prototype.interfaces_=function(){return[]},ns.prototype.getClass=function(){return ns};var ia=function(){};ia.prototype.interfaces_=function(){return[]},ia.prototype.getClass=function(){return ia},ia.map=function(){if(arguments[0]instanceof Ct&&et(arguments[1],ia.MapOp)){for(var n=arguments[0],i=arguments[1],s=new nt,l=0;l<n.getNumGeometries();l++){var h=i.map(n.getGeometryN(l));h!==null&&s.add(h)}return n.getFactory().buildGeometry(s)}if(et(arguments[0],st)&&et(arguments[1],ia.MapOp)){for(var v=arguments[0],S=arguments[1],R=new nt,V=v.iterator();V.hasNext();){var ot=V.next(),St=S.map(ot);St!==null&&R.add(St)}return R}},ia.MapOp=function(){};var Ae=function(n){function i(){var s=arguments[0],l=arguments[1];n.call(this,s,l),this._ptLocator=new Be,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new di,this._resultPolyList=new nt,this._resultLineList=new nt,this._resultPointList=new nt,this._graph=new cr(new ji),this._geomFact=s.getFactory()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertUniqueEdge=function(s){var l=this._edgeList.findEqualEdge(s);if(l!==null){var h=l.getLabel(),v=s.getLabel();l.isPointwiseEqual(s)||(v=new An(s.getLabel())).flip();var S=l.getDepth();S.isNull()&&S.add(h),S.add(v),h.merge(v)}else this._edgeList.add(s)},i.prototype.getGraph=function(){return this._graph},i.prototype.cancelDuplicateResultEdges=function(){for(var s=this._graph.getEdgeEnds().iterator();s.hasNext();){var l=s.next(),h=l.getSym();l.isInResult()&&h.isInResult()&&(l.setInResult(!1),h.setInResult(!1))}},i.prototype.isCoveredByLA=function(s){return!!this.isCovered(s,this._resultLineList)||!!this.isCovered(s,this._resultPolyList)},i.prototype.computeGeometry=function(s,l,h,v){var S=new nt;return S.addAll(s),S.addAll(l),S.addAll(h),S.isEmpty()?i.createEmptyResult(v,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(S)},i.prototype.mergeSymLabels=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().mergeSymLabels()},i.prototype.isCovered=function(s,l){for(var h=l.iterator();h.hasNext();){var v=h.next();if(this._ptLocator.locate(s,v)!==Z.EXTERIOR)return!0}return!1},i.prototype.replaceCollapsedEdges=function(){for(var s=new nt,l=this._edgeList.iterator();l.hasNext();){var h=l.next();h.isCollapsed()&&(l.remove(),s.add(h.getCollapsedEdge()))}this._edgeList.addAll(s)},i.prototype.updateNodeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var l=s.next(),h=l.getEdges().getLabel();l.getLabel().merge(h)}},i.prototype.getResultGeometry=function(s){return this.computeOverlay(s),this._resultGeom},i.prototype.insertUniqueEdges=function(s){for(var l=s.iterator();l.hasNext();){var h=l.next();this.insertUniqueEdge(h)}},i.prototype.computeOverlay=function(s){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var l=new nt;this._arg[0].computeSplitEdges(l),this._arg[1].computeSplitEdges(l),this.insertUniqueEdges(l),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Vi.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(s),this.cancelDuplicateResultEdges();var h=new Ei(this._geomFact);h.add(this._graph),this._resultPolyList=h.getPolygons();var v=new ho(this,this._geomFact,this._ptLocator);this._resultLineList=v.build(s);var S=new _s(this,this._geomFact,this._ptLocator);this._resultPointList=S.build(s),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,s)},i.prototype.labelIncompleteNode=function(s,l){var h=this._ptLocator.locate(s.getCoordinate(),this._arg[l].getGeometry());s.getLabel().setLocation(l,h)},i.prototype.copyPoints=function(s){for(var l=this._arg[s].getNodeIterator();l.hasNext();){var h=l.next();this._graph.addNode(h.getCoordinate()).setLabel(s,h.getLabel().getLocation(s))}},i.prototype.findResultAreaEdges=function(s){for(var l=this._graph.getEdgeEnds().iterator();l.hasNext();){var h=l.next(),v=h.getLabel();v.isArea()&&!h.isInteriorAreaEdge()&&i.isResultOfOp(v.getLocation(0,Ht.RIGHT),v.getLocation(1,Ht.RIGHT),s)&&h.setInResult(!0)}},i.prototype.computeLabelsFromDepths=function(){for(var s=this._edgeList.iterator();s.hasNext();){var l=s.next(),h=l.getLabel(),v=l.getDepth();if(!v.isNull()){v.normalize();for(var S=0;S<2;S++)h.isNull(S)||!h.isArea()||v.isNull(S)||(v.getDelta(S)===0?h.toLine(S):(kt.isTrue(!v.isNull(S,Ht.LEFT),"depth of LEFT side has not been initialized"),h.setLocation(S,Ht.LEFT,v.getLocation(S,Ht.LEFT)),kt.isTrue(!v.isNull(S,Ht.RIGHT),"depth of RIGHT side has not been initialized"),h.setLocation(S,Ht.RIGHT,v.getLocation(S,Ht.RIGHT))))}}},i.prototype.computeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},i.prototype.labelIncompleteNodes=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var l=s.next(),h=l.getLabel();l.isIsolated()&&(h.isNull(0)?this.labelIncompleteNode(l,0):this.labelIncompleteNode(l,1)),l.getEdges().updateLabelling(h)}},i.prototype.isCoveredByA=function(s){return!!this.isCovered(s,this._resultPolyList)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ns);Ae.overlayOp=function(n,i,s){return new Ae(n,i).getResultGeometry(s)},Ae.intersection=function(n,i){if(n.isEmpty()||i.isEmpty())return Ae.createEmptyResult(Ae.INTERSECTION,n,i,n.getFactory());if(n.isGeometryCollection()){var s=i;return vs.map(n,{interfaces_:function(){return[ia.MapOp]},map:function(l){return l.intersection(s)}})}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),zr.overlayOp(n,i,Ae.INTERSECTION)},Ae.symDifference=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return Ae.createEmptyResult(Ae.SYMDIFFERENCE,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),zr.overlayOp(n,i,Ae.SYMDIFFERENCE)},Ae.resultDimension=function(n,i,s){var l=i.getDimension(),h=s.getDimension(),v=-1;switch(n){case Ae.INTERSECTION:v=Math.min(l,h);break;case Ae.UNION:v=Math.max(l,h);break;case Ae.DIFFERENCE:v=l;break;case Ae.SYMDIFFERENCE:v=Math.max(l,h)}return v},Ae.createEmptyResult=function(n,i,s,l){var h=null;switch(Ae.resultDimension(n,i,s)){case-1:h=l.createGeometryCollection(new Array(0).fill(null));break;case 0:h=l.createPoint();break;case 1:h=l.createLineString();break;case 2:h=l.createPolygon()}return h},Ae.difference=function(n,i){return n.isEmpty()?Ae.createEmptyResult(Ae.DIFFERENCE,n,i,n.getFactory()):i.isEmpty()?n.copy():(n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),zr.overlayOp(n,i,Ae.DIFFERENCE))},Ae.isResultOfOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getLocation(0),l=n.getLocation(1);return Ae.isResultOfOp(s,l,i)}if(arguments.length===3){var h=arguments[0],v=arguments[1],S=arguments[2];switch(h===Z.BOUNDARY&&(h=Z.INTERIOR),v===Z.BOUNDARY&&(v=Z.INTERIOR),S){case Ae.INTERSECTION:return h===Z.INTERIOR&&v===Z.INTERIOR;case Ae.UNION:return h===Z.INTERIOR||v===Z.INTERIOR;case Ae.DIFFERENCE:return h===Z.INTERIOR&&v!==Z.INTERIOR;case Ae.SYMDIFFERENCE:return h===Z.INTERIOR&&v!==Z.INTERIOR||h!==Z.INTERIOR&&v===Z.INTERIOR}return!1}},Ae.INTERSECTION=1,Ae.UNION=2,Ae.DIFFERENCE=3,Ae.SYMDIFFERENCE=4;var Ds=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Be,this._seg=new ne;var n=arguments[0],i=arguments[1];this._g=n,this._boundaryDistanceTolerance=i,this._linework=this.extractLinework(n)};Ds.prototype.isWithinToleranceOfBoundary=function(n){for(var i=0;i<this._linework.getNumGeometries();i++)for(var s=this._linework.getGeometryN(i).getCoordinateSequence(),l=0;l<s.size()-1;l++)if(s.getCoordinate(l,this._seg.p0),s.getCoordinate(l+1,this._seg.p1),this._seg.distance(n)<=this._boundaryDistanceTolerance)return!0;return!1},Ds.prototype.getLocation=function(n){return this.isWithinToleranceOfBoundary(n)?Z.BOUNDARY:this._ptLocator.locate(n,this._g)},Ds.prototype.extractLinework=function(n){var i=new su;n.apply(i);var s=i.getLinework(),l=Ce.toLineStringArray(s);return n.getFactory().createMultiLineString(l)},Ds.prototype.interfaces_=function(){return[]},Ds.prototype.getClass=function(){return Ds};var su=function(){this._linework=null,this._linework=new nt};su.prototype.getLinework=function(){return this._linework},su.prototype.filter=function(n){if(n instanceof pe){var i=n;this._linework.add(i.getExteriorRing());for(var s=0;s<i.getNumInteriorRing();s++)this._linework.add(i.getInteriorRingN(s))}},su.prototype.interfaces_=function(){return[hr]},su.prototype.getClass=function(){return su};var oa=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var n=arguments[0];this._g=n};oa.prototype.extractPoints=function(n,i,s){for(var l=n.getCoordinates(),h=0;h<l.length-1;h++)this.computeOffsetPoints(l[h],l[h+1],i,s)},oa.prototype.setSidesToGenerate=function(n,i){this._doLeft=n,this._doRight=i},oa.prototype.getPoints=function(n){for(var i=new nt,s=ve.getLines(this._g).iterator();s.hasNext();){var l=s.next();this.extractPoints(l,n,i)}return i},oa.prototype.computeOffsetPoints=function(n,i,s,l){var h=i.x-n.x,v=i.y-n.y,S=Math.sqrt(h*h+v*v),R=s*h/S,V=s*v/S,ot=(i.x+n.x)/2,St=(i.y+n.y)/2;if(this._doLeft){var bt=new D(ot-V,St+R);l.add(bt)}if(this._doRight){var Yt=new D(ot+V,St-R);l.add(Yt)}},oa.prototype.interfaces_=function(){return[]},oa.prototype.getClass=function(){return oa};var ai=function n(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=n.TOLERANCE,this._testCoords=new nt;var i=arguments[0],s=arguments[1],l=arguments[2];this._boundaryDistanceTolerance=n.computeBoundaryDistanceTolerance(i,s),this._geom=[i,s,l],this._locFinder=[new Ds(this._geom[0],this._boundaryDistanceTolerance),new Ds(this._geom[1],this._boundaryDistanceTolerance),new Ds(this._geom[2],this._boundaryDistanceTolerance)]},au={TOLERANCE:{configurable:!0}};ai.prototype.reportResult=function(n,i,s){Qt.out.println("Overlay result invalid - A:"+Z.toLocationSymbol(i[0])+" B:"+Z.toLocationSymbol(i[1])+" expected:"+(s?"i":"e")+" actual:"+Z.toLocationSymbol(i[2]))},ai.prototype.isValid=function(n){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var i=this.checkValid(n);return i},ai.prototype.checkValid=function(){if(arguments.length===1){for(var n=arguments[0],i=0;i<this._testCoords.size();i++){var s=this._testCoords.get(i);if(!this.checkValid(n,s))return this._invalidLocation=s,!1}return!0}if(arguments.length===2){var l=arguments[0],h=arguments[1];return this._location[0]=this._locFinder[0].getLocation(h),this._location[1]=this._locFinder[1].getLocation(h),this._location[2]=this._locFinder[2].getLocation(h),!!ai.hasLocation(this._location,Z.BOUNDARY)||this.isValidResult(l,this._location)}},ai.prototype.addTestPts=function(n){var i=new oa(n);this._testCoords.addAll(i.getPoints(5*this._boundaryDistanceTolerance))},ai.prototype.isValidResult=function(n,i){var s=Ae.isResultOfOp(i[0],i[1],n),l=!(s^i[2]===Z.INTERIOR);return l||this.reportResult(n,i,s),l},ai.prototype.getInvalidLocation=function(){return this._invalidLocation},ai.prototype.interfaces_=function(){return[]},ai.prototype.getClass=function(){return ai},ai.hasLocation=function(n,i){for(var s=0;s<3;s++)if(n[s]===i)return!0;return!1},ai.computeBoundaryDistanceTolerance=function(n,i){return Math.min(sr.computeSizeBasedSnapTolerance(n),sr.computeSizeBasedSnapTolerance(i))},ai.isValid=function(n,i,s,l){return new ai(n,i,l).isValid(s)},au.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(ai,au);var Ci=function n(i){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=n.extractFactory(i),this._inputGeoms=i};Ci.prototype.extractElements=function(n,i){if(n===null)return null;for(var s=0;s<n.getNumGeometries();s++){var l=n.getGeometryN(s);this._skipEmpty&&l.isEmpty()||i.add(l)}},Ci.prototype.combine=function(){for(var n=new nt,i=this._inputGeoms.iterator();i.hasNext();){var s=i.next();this.extractElements(s,n)}return n.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(n)},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci},Ci.combine=function(){if(arguments.length===1){var n=arguments[0];return new Ci(n).combine()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new Ci(Ci.createList(i,s)).combine()}if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2];return new Ci(Ci.createList(l,h,v)).combine()}},Ci.extractFactory=function(n){return n.isEmpty()?null:n.iterator().next().getFactory()},Ci.createList=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new nt;return s.add(n),s.add(i),s}if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2],S=new nt;return S.add(l),S.add(h),S.add(v),S}};var B=function(){this._inputPolys=null,this._geomFactory=null;var n=arguments[0];this._inputPolys=n,this._inputPolys===null&&(this._inputPolys=new nt)},Ca={STRTREE_NODE_CAPACITY:{configurable:!0}};B.prototype.reduceToGeometries=function(n){for(var i=new nt,s=n.iterator();s.hasNext();){var l=s.next(),h=null;et(l,ut)?h=this.unionTree(l):l instanceof Ct&&(h=l),i.add(h)}return i},B.prototype.extractByEnvelope=function(n,i,s){for(var l=new nt,h=0;h<i.getNumGeometries();h++){var v=i.getGeometryN(h);v.getEnvelopeInternal().intersects(n)?l.add(v):s.add(v)}return this._geomFactory.buildGeometry(l)},B.prototype.unionOptimized=function(n,i){var s=n.getEnvelopeInternal(),l=i.getEnvelopeInternal();if(!s.intersects(l))return Ci.combine(n,i);if(n.getNumGeometries()<=1&&i.getNumGeometries()<=1)return this.unionActual(n,i);var h=s.intersection(l);return this.unionUsingEnvelopeIntersection(n,i,h)},B.prototype.union=function(){if(this._inputPolys===null)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var n=new Ic(B.STRTREE_NODE_CAPACITY),i=this._inputPolys.iterator();i.hasNext();){var s=i.next();n.insert(s.getEnvelopeInternal(),s)}this._inputPolys=null;var l=n.itemsTree();return this.unionTree(l)},B.prototype.binaryUnion=function(){if(arguments.length===1){var n=arguments[0];return this.binaryUnion(n,0,n.size())}if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];if(l-s<=1){var h=B.getGeometry(i,s);return this.unionSafe(h,null)}if(l-s==2)return this.unionSafe(B.getGeometry(i,s),B.getGeometry(i,s+1));var v=Math.trunc((l+s)/2),S=this.binaryUnion(i,s,v),R=this.binaryUnion(i,v,l);return this.unionSafe(S,R)}},B.prototype.repeatedUnion=function(n){for(var i=null,s=n.iterator();s.hasNext();){var l=s.next();i=i===null?l.copy():i.union(l)}return i},B.prototype.unionSafe=function(n,i){return n===null&&i===null?null:n===null?i.copy():i===null?n.copy():this.unionOptimized(n,i)},B.prototype.unionActual=function(n,i){return B.restrictToPolygons(n.union(i))},B.prototype.unionTree=function(n){var i=this.reduceToGeometries(n);return this.binaryUnion(i)},B.prototype.unionUsingEnvelopeIntersection=function(n,i,s){var l=new nt,h=this.extractByEnvelope(s,n,l),v=this.extractByEnvelope(s,i,l),S=this.unionActual(h,v);return l.add(S),Ci.combine(l)},B.prototype.bufferUnion=function(){if(arguments.length===1){var n=arguments[0];return n.get(0).getFactory().buildGeometry(n).buffer(0)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().createGeometryCollection([i,s]).buffer(0)}},B.prototype.interfaces_=function(){return[]},B.prototype.getClass=function(){return B},B.restrictToPolygons=function(n){if(et(n,Ne))return n;var i=re.getPolygons(n);return i.size()===1?i.get(0):n.getFactory().createMultiPolygon(Ce.toPolygonArray(i))},B.getGeometry=function(n,i){return i>=n.size()?null:n.get(i)},B.union=function(n){return new B(n).union()},Ca.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(B,Ca);var sa=function(){};sa.prototype.interfaces_=function(){return[]},sa.prototype.getClass=function(){return sa},sa.union=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return Ae.createEmptyResult(Ae.UNION,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),zr.overlayOp(n,i,Ae.UNION)},r.GeoJSONReader=Fu,r.GeoJSONWriter=_a,r.OverlayOp=Ae,r.UnionOp=sa,r.BufferOp=Xr,Object.defineProperty(r,"__esModule",{value:!0})})});var pS=ce((Ac,Rf)=>{(function(){var r,t="4.17.21",e=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",c="Invalid \`variable\` option passed into \`_.template\`",p="__lodash_hash_undefined__",d=500,g="__lodash_placeholder__",y=1,_=2,w=4,x=1,b=2,P=1,I=2,M=4,E=8,N=16,A=32,U=64,z=128,$=256,q=512,D=30,G="...",Q=800,_t=16,Z=1,Dt=2,et=3,vt=1/0,It=9007199254740991,Pt=17976931348623157e292,Et=NaN,yt=4294967295,Y=yt-1,ht=yt>>>1,Mt=[["ary",z],["bind",P],["bindKey",I],["curry",E],["curryRight",N],["flip",q],["partial",A],["partialRight",U],["rearg",$]],zt="[object Arguments]",At="[object Array]",$t="[object AsyncFunction]",ue="[object Boolean]",le="[object Date]",Qt="[object DOMException]",me="[object Error]",Xt="[object Function]",Ee="[object GeneratorFunction]",ft="[object Map]",He="[object Number]",te="[object Null]",fe="[object Object]",de="[object Promise]",Ue="[object Proxy]",be="[object RegExp]",kt="[object Set]",ye="[object String]",Vn="[object Symbol]",$n="[object Undefined]",j="[object WeakMap]",H="[object WeakSet]",rt="[object ArrayBuffer]",Wt="[object DataView]",Gt="[object Float32Array]",Ct="[object Float64Array]",he="[object Int8Array]",Kt="[object Int16Array]",tt="[object Int32Array]",C="[object Uint8Array]",L="[object Uint8ClampedArray]",F="[object Uint16Array]",J="[object Uint32Array]",X=/\\b__p \\+= '';/g,pt=/\\b(__p \\+=) '' \\+/g,st=/(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g,k=/&(?:amp|lt|gt|quot|#39);/g,ut=/[&<>"']/g,nt=RegExp(k.source),lt=RegExp(ut.source),dt=/<%-([\\s\\S]+?)%>/g,at=/<%([\\s\\S]+?)%>/g,Bt=/<%=([\\s\\S]+?)%>/g,qt=/\\.|\\[(?:[^[\\]]*|(["'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,we=/^\\w*$/,oe=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,Ve=/[\\\\^$.*+?()[\\]{}|]/g,je=RegExp(Ve.source),ur=/^\\s+/,Qn=/\\s/,wr=/\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,Ir=/\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,er=/,? & /,Me=/[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g,nr=/[()=,{}\\[\\]\\/\\s]/,hr=/\\\\(\\\\)?/g,lr=/\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g,Zn=/\\w*$/,K=/^[-+]0x[0-9a-f]+$/i,xt=/^0b[01]+$/i,Lt=/^\\[object .+?Constructor\\]$/,wt=/^0o[0-7]+$/i,Ot=/^(?:0|[1-9]\\d*)$/,Zt=/[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g,jt=/($^)/,Te=/['\\n\\r\\u2028\\u2029\\\\]/g,ge="\\\\ud800-\\\\udfff",Ne="\\\\u0300-\\\\u036f",pe="\\\\ufe20-\\\\ufe2f",Oe="\\\\u20d0-\\\\u20ff",Tn=Ne+pe+Oe,Bn="\\\\u2700-\\\\u27bf",rr="a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff",Ki="\\\\xac\\\\xb1\\\\xd7\\\\xf7",pr="\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf",ze="\\\\u2000-\\\\u206f",Is=" \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000",De="A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde",Yo="\\\\ufe0e\\\\ufe0f",Ui=Ki+pr+ze+Is,$o="['\\u2019]",Ka="["+ge+"]",Se="["+Ui+"]",Qi="["+Tn+"]",ci="\\\\d+",fi="["+Bn+"]",Ce="["+rr+"]",Du="[^"+ge+Ui+ci+Bn+rr+De+"]",Qa="\\\\ud83c[\\\\udffb-\\\\udfff]",ml="(?:"+Qi+"|"+Qa+")",ao="[^"+ge+"]",So="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",Fu="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",_a="["+De+"]",Ht="\\\\u200d",Uu="(?:"+Ce+"|"+Du+")",bo="(?:"+_a+"|"+Du+")",Zo="(?:"+$o+"(?:d|ll|m|re|s|t|ve))?",Bu="(?:"+$o+"(?:D|LL|M|RE|S|T|VE))?",Jr=ml+"?",Wn="["+Yo+"]?",An="(?:"+Ht+"(?:"+[ao,So,Fu].join("|")+")"+Wn+Jr+")*",Mr="\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])",rd="\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])",Lf=Wn+Jr+An,Bi="(?:"+[fi,So,Fu].join("|")+")"+Lf,yl="(?:"+[ao+Qi+"?",Qi,So,Fu,Ka].join("|")+")",To=RegExp($o,"g"),kn=RegExp(Qi,"g"),xa=RegExp(Qa+"(?="+Qa+")|"+yl+Lf,"g"),Kr=RegExp([_a+"?"+Ce+"+"+Zo+"(?="+[Se,_a,"$"].join("|")+")",bo+"+"+Bu+"(?="+[Se,_a+Uu,"$"].join("|")+")",_a+"?"+Uu+"+"+Zo,_a+"+"+Bu,rd,Mr,ci,Bi].join("|"),"g"),Cc=RegExp("["+Ht+ge+Tn+Yo+"]"),ja=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,cr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ei=-1,jn={};jn[Gt]=jn[Ct]=jn[he]=jn[Kt]=jn[tt]=jn[C]=jn[L]=jn[F]=jn[J]=!0,jn[zt]=jn[At]=jn[rt]=jn[ue]=jn[Wt]=jn[le]=jn[me]=jn[Xt]=jn[ft]=jn[He]=jn[fe]=jn[be]=jn[kt]=jn[ye]=jn[j]=!1;var Xe={};Xe[zt]=Xe[At]=Xe[rt]=Xe[Wt]=Xe[ue]=Xe[le]=Xe[Gt]=Xe[Ct]=Xe[he]=Xe[Kt]=Xe[tt]=Xe[ft]=Xe[He]=Xe[fe]=Xe[be]=Xe[kt]=Xe[ye]=Xe[Vn]=Xe[C]=Xe[L]=Xe[F]=Xe[J]=!0,Xe[me]=Xe[Xt]=Xe[j]=!1;var hs={\\u00C0:"A",\\u00C1:"A",\\u00C2:"A",\\u00C3:"A",\\u00C4:"A",\\u00C5:"A",\\u00E0:"a",\\u00E1:"a",\\u00E2:"a",\\u00E3:"a",\\u00E4:"a",\\u00E5:"a",\\u00C7:"C",\\u00E7:"c",\\u00D0:"D",\\u00F0:"d",\\u00C8:"E",\\u00C9:"E",\\u00CA:"E",\\u00CB:"E",\\u00E8:"e",\\u00E9:"e",\\u00EA:"e",\\u00EB:"e",\\u00CC:"I",\\u00CD:"I",\\u00CE:"I",\\u00CF:"I",\\u00EC:"i",\\u00ED:"i",\\u00EE:"i",\\u00EF:"i",\\u00D1:"N",\\u00F1:"n",\\u00D2:"O",\\u00D3:"O",\\u00D4:"O",\\u00D5:"O",\\u00D6:"O",\\u00D8:"O",\\u00F2:"o",\\u00F3:"o",\\u00F4:"o",\\u00F5:"o",\\u00F6:"o",\\u00F8:"o",\\u00D9:"U",\\u00DA:"U",\\u00DB:"U",\\u00DC:"U",\\u00F9:"u",\\u00FA:"u",\\u00FB:"u",\\u00FC:"u",\\u00DD:"Y",\\u00FD:"y",\\u00FF:"y",\\u00C6:"Ae",\\u00E6:"ae",\\u00DE:"Th",\\u00FE:"th",\\u00DF:"ss",\\u0100:"A",\\u0102:"A",\\u0104:"A",\\u0101:"a",\\u0103:"a",\\u0105:"a",\\u0106:"C",\\u0108:"C",\\u010A:"C",\\u010C:"C",\\u0107:"c",\\u0109:"c",\\u010B:"c",\\u010D:"c",\\u010E:"D",\\u0110:"D",\\u010F:"d",\\u0111:"d",\\u0112:"E",\\u0114:"E",\\u0116:"E",\\u0118:"E",\\u011A:"E",\\u0113:"e",\\u0115:"e",\\u0117:"e",\\u0119:"e",\\u011B:"e",\\u011C:"G",\\u011E:"G",\\u0120:"G",\\u0122:"G",\\u011D:"g",\\u011F:"g",\\u0121:"g",\\u0123:"g",\\u0124:"H",\\u0126:"H",\\u0125:"h",\\u0127:"h",\\u0128:"I",\\u012A:"I",\\u012C:"I",\\u012E:"I",\\u0130:"I",\\u0129:"i",\\u012B:"i",\\u012D:"i",\\u012F:"i",\\u0131:"i",\\u0134:"J",\\u0135:"j",\\u0136:"K",\\u0137:"k",\\u0138:"k",\\u0139:"L",\\u013B:"L",\\u013D:"L",\\u013F:"L",\\u0141:"L",\\u013A:"l",\\u013C:"l",\\u013E:"l",\\u0140:"l",\\u0142:"l",\\u0143:"N",\\u0145:"N",\\u0147:"N",\\u014A:"N",\\u0144:"n",\\u0146:"n",\\u0148:"n",\\u014B:"n",\\u014C:"O",\\u014E:"O",\\u0150:"O",\\u014D:"o",\\u014F:"o",\\u0151:"o",\\u0154:"R",\\u0156:"R",\\u0158:"R",\\u0155:"r",\\u0157:"r",\\u0159:"r",\\u015A:"S",\\u015C:"S",\\u015E:"S",\\u0160:"S",\\u015B:"s",\\u015D:"s",\\u015F:"s",\\u0161:"s",\\u0162:"T",\\u0164:"T",\\u0166:"T",\\u0163:"t",\\u0165:"t",\\u0167:"t",\\u0168:"U",\\u016A:"U",\\u016C:"U",\\u016E:"U",\\u0170:"U",\\u0172:"U",\\u0169:"u",\\u016B:"u",\\u016D:"u",\\u016F:"u",\\u0171:"u",\\u0173:"u",\\u0174:"W",\\u0175:"w",\\u0176:"Y",\\u0177:"y",\\u0178:"Y",\\u0179:"Z",\\u017B:"Z",\\u017D:"Z",\\u017A:"z",\\u017C:"z",\\u017E:"z",\\u0132:"IJ",\\u0133:"ij",\\u0152:"Oe",\\u0153:"oe",\\u0149:"'n",\\u017F:"s"},Rs={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ea={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Ar={"\\\\":"\\\\","'":"'","\\n":"n","\\r":"r","\\u2028":"u2028","\\u2029":"u2029"},Nf=parseFloat,uo=parseInt,_r=typeof global=="object"&&global&&global.Object===Object&&global,Fr=typeof self=="object"&&self&&self.Object===Object&&self,Ur=_r||Fr||Function("return this")(),Pc=typeof Ac=="object"&&Ac&&!Ac.nodeType&&Ac,Ao=Pc&&typeof Rf=="object"&&Rf&&!Rf.nodeType&&Rf,Ic=Ao&&Ao.exports===Pc,vl=Ic&&_r.process,ir=function(){try{var gt=Ao&&Ao.require&&Ao.require("util").types;return gt||vl&&vl.binding&&vl.binding("util")}catch(Nt){}}(),ps=ir&&ir.isArrayBuffer,Qr=ir&&ir.isDate,Zs=ir&&ir.isMap,Co=ir&&ir.isRegExp,tu=ir&&ir.isSet,dr=ir&&ir.isTypedArray;function ne(gt,Nt,Tt){switch(Tt.length){case 0:return gt.call(Nt);case 1:return gt.call(Nt,Tt[0]);case 2:return gt.call(Nt,Tt[0],Tt[1]);case 3:return gt.call(Nt,Tt[0],Tt[1],Tt[2])}return gt.apply(Nt,Tt)}function Of(gt,Nt,Tt,re){for(var ve=-1,Be=gt==null?0:gt.length;++ve<Be;){var tn=gt[ve];Nt(re,tn,Tt(tn),gt)}return re}function wi(gt,Nt){for(var Tt=-1,re=gt==null?0:gt.length;++Tt<re&&Nt(gt[Tt],Tt,gt)!==!1;);return gt}function Mi(gt,Nt){for(var Tt=gt==null?0:gt.length;Tt--&&Nt(gt[Tt],Tt,gt)!==!1;);return gt}function lo(gt,Nt){for(var Tt=-1,re=gt==null?0:gt.length;++Tt<re;)if(!Nt(gt[Tt],Tt,gt))return!1;return!0}function zi(gt,Nt){for(var Tt=-1,re=gt==null?0:gt.length,ve=0,Be=[];++Tt<re;){var tn=gt[Tt];Nt(tn,Tt,gt)&&(Be[ve++]=tn)}return Be}function Js(gt,Nt){var Tt=gt==null?0:gt.length;return!!Tt&&ds(gt,Nt,0)>-1}function zu(gt,Nt,Tt){for(var re=-1,ve=gt==null?0:gt.length;++re<ve;)if(Tt(Nt,gt[re]))return!0;return!1}function xr(gt,Nt){for(var Tt=-1,re=gt==null?0:gt.length,ve=Array(re);++Tt<re;)ve[Tt]=Nt(gt[Tt],Tt,gt);return ve}function Fe(gt,Nt){for(var Tt=-1,re=Nt.length,ve=gt.length;++Tt<re;)gt[ve+Tt]=Nt[Tt];return gt}function Po(gt,Nt,Tt,re){var ve=-1,Be=gt==null?0:gt.length;for(re&&Be&&(Tt=gt[++ve]);++ve<Be;)Tt=Nt(Tt,gt[ve],ve,gt);return Tt}function gr(gt,Nt,Tt,re){var ve=gt==null?0:gt.length;for(re&&ve&&(Tt=gt[--ve]);ve--;)Tt=Nt(Tt,gt[ve],ve,gt);return Tt}function wa(gt,Nt){for(var Tt=-1,re=gt==null?0:gt.length;++Tt<re;)if(Nt(gt[Tt],Tt,gt))return!0;return!1}var Gi=gs("length");function Df(gt){return gt.split("")}function Ge(gt){return gt.match(Me)||[]}function Ks(gt,Nt,Tt){var re;return Tt(gt,function(ve,Be,tn){if(Nt(ve,Be,tn))return re=Be,!1}),re}function qn(gt,Nt,Tt,re){for(var ve=gt.length,Be=Tt+(re?1:-1);re?Be--:++Be<ve;)if(Nt(gt[Be],Be,gt))return Be;return-1}function ds(gt,Nt,Tt){return Nt===Nt?Gu(gt,Nt,Tt):qn(gt,Qs,Tt)}function hi(gt,Nt,Tt,re){for(var ve=Tt-1,Be=gt.length;++ve<Be;)if(re(gt[ve],Nt))return ve;return-1}function Qs(gt){return gt!==gt}function Rc(gt,Nt){var Tt=gt==null?0:gt.length;return Tt?co(gt,Nt)/Tt:Et}function gs(gt){return function(Nt){return Nt==null?r:Nt[gt]}}function We(gt){return function(Nt){return gt==null?r:gt[Nt]}}function ki(gt,Nt,Tt,re,ve){return ve(gt,function(Be,tn,or){Tt=re?(re=!1,Be):Nt(Tt,Be,tn,or)}),Tt}function eu(gt,Nt){var Tt=gt.length;for(gt.sort(Nt);Tt--;)gt[Tt]=gt[Tt].value;return gt}function co(gt,Nt){for(var Tt,re=-1,ve=gt.length;++re<ve;){var Be=Nt(gt[re]);Be!==r&&(Tt=Tt===r?Be:Tt+Be)}return Tt}function pi(gt,Nt){for(var Tt=-1,re=Array(gt);++Tt<gt;)re[Tt]=Nt(Tt);return re}function jr(gt,Nt){return xr(Nt,function(Tt){return[Tt,gt[Tt]]})}function Ff(gt){return gt&&gt.slice(0,ta(gt)+1).replace(ur,"")}function ji(gt){return function(Nt){return gt(Nt)}}function Jo(gt,Nt){return xr(Nt,function(Tt){return gt[Tt]})}function di(gt,Nt){return gt.has(Nt)}function Ls(gt,Nt){for(var Tt=-1,re=gt.length;++Tt<re&&ds(Nt,gt[Tt],0)>-1;);return Tt}function Si(gt,Nt){for(var Tt=gt.length;Tt--&&ds(Nt,gt[Tt],0)>-1;);return Tt}function Io(gt,Nt){for(var Tt=gt.length,re=0;Tt--;)gt[Tt]===Nt&&++re;return re}var Ko=We(hs),js=We(Rs);function ms(gt){return"\\\\"+Ar[gt]}function Wr(gt,Nt){return gt==null?r:gt[Nt]}function Ma(gt){return Cc.test(gt)}function _l(gt){return ja.test(gt)}function ii(gt){for(var Nt,Tt=[];!(Nt=gt.next()).done;)Tt.push(Nt.value);return Tt}function Qo(gt){var Nt=-1,Tt=Array(gt.size);return gt.forEach(function(re,ve){Tt[++Nt]=[ve,re]}),Tt}function fo(gt,Nt){return function(Tt){return gt(Nt(Tt))}}function Ns(gt,Nt){for(var Tt=-1,re=gt.length,ve=0,Be=[];++Tt<re;){var tn=gt[Tt];(tn===Nt||tn===g)&&(gt[Tt]=g,Be[ve++]=Tt)}return Be}function qr(gt){var Nt=-1,Tt=Array(gt.size);return gt.forEach(function(re){Tt[++Nt]=re}),Tt}function Uf(gt){var Nt=-1,Tt=Array(gt.size);return gt.forEach(function(re){Tt[++Nt]=[re,re]}),Tt}function Gu(gt,Nt,Tt){for(var re=Tt-1,ve=gt.length;++re<ve;)if(gt[re]===Nt)return re;return-1}function nu(gt,Nt,Tt){for(var re=Tt+1;re--;)if(gt[re]===Nt)return re;return re}function Sa(gt){return Ma(gt)?Xr(gt):Gi(gt)}function Ro(gt){return Ma(gt)?ru(gt):Df(gt)}function ta(gt){for(var Nt=gt.length;Nt--&&Qn.test(gt.charAt(Nt)););return Nt}var jo=We(Ea);function Xr(gt){for(var Nt=xa.lastIndex=0;xa.test(gt);)++Nt;return Nt}function ru(gt){return gt.match(xa)||[]}function oi(gt){return gt.match(Kr)||[]}var ts=function gt(Nt){Nt=Nt==null?Ur:Hi.defaults(Ur.Object(),Nt,Hi.pick(Ur,cr));var Tt=Nt.Array,re=Nt.Date,ve=Nt.Error,Be=Nt.Function,tn=Nt.Math,or=Nt.Object,es=Nt.RegExp,ba=Nt.String,Jn=Nt.TypeError,Rr=Tt.prototype,Lo=Be.prototype,ti=or.prototype,iu=Nt["__core-js_shared__"],ys=Lo.toString,Ze=ti.hasOwnProperty,bi=0,xl=function(){var u=/[^.]+$/.exec(iu&&iu.keys&&iu.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),Cr=ti.toString,Lc=ys.call(or),No=Ur._,Br=es("^"+ys.call(Ze).replace(Ve,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$"),Ti=Ic?Nt.Buffer:r,Vi=Nt.Symbol,vs=Nt.Uint8Array,ho=Ti?Ti.allocUnsafe:r,_s=fo(or.getPrototypeOf,or),si=or.create,Oo=ti.propertyIsEnumerable,sr=Rr.splice,Nc=Vi?Vi.isConcatSpreadable:r,ou=Vi?Vi.iterator:r,Sr=Vi?Vi.toStringTag:r,Do=function(){try{var u=qu(or,"defineProperty");return u({},"",{}),u}catch(f){}}(),Oc=Nt.clearTimeout!==Ur.clearTimeout&&Nt.clearTimeout,Ta=re&&re.now!==Ur.Date.now&&re.now,Os=Nt.setTimeout!==Ur.setTimeout&&Nt.setTimeout,br=tn.ceil,zr=tn.floor,Aa=or.getOwnPropertySymbols,Ai=Ti?Ti.isBuffer:r,El=Nt.isFinite,wl=Rr.join,Yr=fo(or.keys,or),ei=tn.max,mr=tn.min,Bf=re.now,ku=Nt.parseInt,zf=tn.random,id=Rr.reverse,po=qu(Nt,"DataView"),xs=qu(Nt,"Map"),ea=qu(Nt,"Promise"),na=qu(Nt,"Set"),Es=qu(Nt,"WeakMap"),Fo=qu(or,"create"),ra=Es&&new Es,ns={},ia=Xu(po),Ae=Xu(xs),Ds=Xu(ea),su=Xu(na),oa=Xu(Es),ai=Vi?Vi.prototype:r,au=ai?ai.valueOf:r,Ci=ai?ai.toString:r;function B(u){if($r(u)&&!ke(u)&&!(u instanceof i)){if(u instanceof n)return u;if(Ze.call(u,"__wrapped__"))return cv(u)}return new n(u)}var Ca=function(){function u(){}return function(f){if(!Gr(f))return{};if(si)return si(f);u.prototype=f;var m=new u;return u.prototype=r,m}}();function sa(){}function n(u,f){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!f,this.__index__=0,this.__values__=r}B.templateSettings={escape:dt,evaluate:at,interpolate:Bt,variable:"",imports:{_:B}},B.prototype=sa.prototype,B.prototype.constructor=B,n.prototype=Ca(sa.prototype),n.prototype.constructor=n;function i(u){this.__wrapped__=u,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=yt,this.__views__=[]}function s(){var u=new i(this.__wrapped__);return u.__actions__=Uo(this.__actions__),u.__dir__=this.__dir__,u.__filtered__=this.__filtered__,u.__iteratees__=Uo(this.__iteratees__),u.__takeCount__=this.__takeCount__,u.__views__=Uo(this.__views__),u}function l(){if(this.__filtered__){var u=new i(this);u.__dir__=-1,u.__filtered__=!0}else u=this.clone(),u.__dir__*=-1;return u}function h(){var u=this.__wrapped__.value(),f=this.__dir__,m=ke(u),T=f<0,O=m?u.length:0,W=_b(0,O,this.__views__),it=W.start,ct=W.end,mt=ct-it,Ft=T?ct:it-1,Ut=this.__iteratees__,Vt=Ut.length,ae=0,xe=mr(mt,this.__takeCount__);if(!m||!T&&O==mt&&xe==mt)return Ny(u,this.__actions__);var Re=[];t:for(;mt--&&ae<xe;){Ft+=f;for(var Ye=-1,Le=u[Ft];++Ye<Vt;){var Pn=Ut[Ye],Hn=Pn.iteratee,ss=Pn.type,yo=Hn(Le);if(ss==Dt)Le=yo;else if(!yo){if(ss==Z)continue t;break t}}Re[ae++]=Le}return Re}i.prototype=Ca(sa.prototype),i.prototype.constructor=i;function v(u){var f=-1,m=u==null?0:u.length;for(this.clear();++f<m;){var T=u[f];this.set(T[0],T[1])}}function S(){this.__data__=Fo?Fo(null):{},this.size=0}function R(u){var f=this.has(u)&&delete this.__data__[u];return this.size-=f?1:0,f}function V(u){var f=this.__data__;if(Fo){var m=f[u];return m===p?r:m}return Ze.call(f,u)?f[u]:r}function ot(u){var f=this.__data__;return Fo?f[u]!==r:Ze.call(f,u)}function St(u,f){var m=this.__data__;return this.size+=this.has(u)?0:1,m[u]=Fo&&f===r?p:f,this}v.prototype.clear=S,v.prototype.delete=R,v.prototype.get=V,v.prototype.has=ot,v.prototype.set=St;function bt(u){var f=-1,m=u==null?0:u.length;for(this.clear();++f<m;){var T=u[f];this.set(T[0],T[1])}}function Yt(){this.__data__=[],this.size=0}function Jt(u){var f=this.__data__,m=Gf(f,u);if(m<0)return!1;var T=f.length-1;return m==T?f.pop():sr.call(f,m,1),--this.size,!0}function se(u){var f=this.__data__,m=Gf(f,u);return m<0?r:f[m][1]}function _e(u){return Gf(this.__data__,u)>-1}function Cn(u,f){var m=this.__data__,T=Gf(m,u);return T<0?(++this.size,m.push([u,f])):m[T][1]=f,this}bt.prototype.clear=Yt,bt.prototype.delete=Jt,bt.prototype.get=se,bt.prototype.has=_e,bt.prototype.set=Cn;function Xn(u){var f=-1,m=u==null?0:u.length;for(this.clear();++f<m;){var T=u[f];this.set(T[0],T[1])}}function ui(){this.size=0,this.__data__={hash:new v,map:new(xs||bt),string:new v}}function rs(u){var f=Qf(this,u).delete(u);return this.size-=f?1:0,f}function Fs(u){return Qf(this,u).get(u)}function Dc(u){return Qf(this,u).has(u)}function wS(u,f){var m=Qf(this,u),T=m.size;return m.set(u,f),this.size+=m.size==T?0:1,this}Xn.prototype.clear=ui,Xn.prototype.delete=rs,Xn.prototype.get=Fs,Xn.prototype.has=Dc,Xn.prototype.set=wS;function Hu(u){var f=-1,m=u==null?0:u.length;for(this.__data__=new Xn;++f<m;)this.add(u[f])}function MS(u){return this.__data__.set(u,p),this}function SS(u){return this.__data__.has(u)}Hu.prototype.add=Hu.prototype.push=MS,Hu.prototype.has=SS;function Us(u){var f=this.__data__=new bt(u);this.size=f.size}function bS(){this.__data__=new bt,this.size=0}function TS(u){var f=this.__data__,m=f.delete(u);return this.size=f.size,m}function AS(u){return this.__data__.get(u)}function CS(u){return this.__data__.has(u)}function PS(u,f){var m=this.__data__;if(m instanceof bt){var T=m.__data__;if(!xs||T.length<e-1)return T.push([u,f]),this.size=++m.size,this;m=this.__data__=new Xn(T)}return m.set(u,f),this.size=m.size,this}Us.prototype.clear=bS,Us.prototype.delete=TS,Us.prototype.get=AS,Us.prototype.has=CS,Us.prototype.set=PS;function cy(u,f){var m=ke(u),T=!m&&Yu(u),O=!m&&!T&&hu(u),W=!m&&!T&&!O&&Tl(u),it=m||T||O||W,ct=it?pi(u.length,ba):[],mt=ct.length;for(var Ft in u)(f||Ze.call(u,Ft))&&!(it&&(Ft=="length"||O&&(Ft=="offset"||Ft=="parent")||W&&(Ft=="buffer"||Ft=="byteLength"||Ft=="byteOffset")||La(Ft,mt)))&&ct.push(Ft);return ct}function fy(u){var f=u.length;return f?u[gd(0,f-1)]:r}function IS(u,f){return jf(Uo(u),Vu(f,0,u.length))}function RS(u){return jf(Uo(u))}function od(u,f,m){(m!==r&&!Bs(u[f],m)||m===r&&!(f in u))&&Pa(u,f,m)}function Fc(u,f,m){var T=u[f];(!(Ze.call(u,f)&&Bs(T,m))||m===r&&!(f in u))&&Pa(u,f,m)}function Gf(u,f){for(var m=u.length;m--;)if(Bs(u[m][0],f))return m;return-1}function LS(u,f,m,T){return uu(u,function(O,W,it){f(T,O,m(O),it)}),T}function hy(u,f){return u&&ua(f,Pi(f),u)}function NS(u,f){return u&&ua(f,zo(f),u)}function Pa(u,f,m){f=="__proto__"&&Do?Do(u,f,{configurable:!0,enumerable:!0,value:m,writable:!0}):u[f]=m}function sd(u,f){for(var m=-1,T=f.length,O=Tt(T),W=u==null;++m<T;)O[m]=W?r:Gd(u,f[m]);return O}function Vu(u,f,m){return u===u&&(m!==r&&(u=u<=m?u:m),f!==r&&(u=u>=f?u:f)),u}function ws(u,f,m,T,O,W){var it,ct=f&y,mt=f&_,Ft=f&w;if(m&&(it=O?m(u,T,O,W):m(u)),it!==r)return it;if(!Gr(u))return u;var Ut=ke(u);if(Ut){if(it=Eb(u),!ct)return Uo(u,it)}else{var Vt=to(u),ae=Vt==Xt||Vt==Ee;if(hu(u))return Fy(u,ct);if(Vt==fe||Vt==zt||ae&&!O){if(it=mt||ae?{}:ev(u),!ct)return mt?cb(u,NS(it,u)):lb(u,hy(it,u))}else{if(!Xe[Vt])return O?u:{};it=wb(u,Vt,ct)}}W||(W=new Us);var xe=W.get(u);if(xe)return xe;W.set(u,it),Iv(u)?u.forEach(function(Le){it.add(ws(Le,f,m,Le,u,W))}):Cv(u)&&u.forEach(function(Le,Pn){it.set(Pn,ws(Le,f,m,Pn,u,W))});var Re=Ft?mt?Td:bd:mt?zo:Pi,Ye=Ut?r:Re(u);return wi(Ye||u,function(Le,Pn){Ye&&(Pn=Le,Le=u[Pn]),Fc(it,Pn,ws(Le,f,m,Pn,u,W))}),it}function OS(u){var f=Pi(u);return function(m){return py(m,u,f)}}function py(u,f,m){var T=m.length;if(u==null)return!T;for(u=or(u);T--;){var O=m[T],W=f[O],it=u[O];if(it===r&&!(O in u)||!W(it))return!1}return!0}function dy(u,f,m){if(typeof u!="function")throw new Jn(a);return Vc(function(){u.apply(r,m)},f)}function Uc(u,f,m,T){var O=-1,W=Js,it=!0,ct=u.length,mt=[],Ft=f.length;if(!ct)return mt;m&&(f=xr(f,ji(m))),T?(W=zu,it=!1):f.length>=e&&(W=di,it=!1,f=new Hu(f));t:for(;++O<ct;){var Ut=u[O],Vt=m==null?Ut:m(Ut);if(Ut=T||Ut!==0?Ut:0,it&&Vt===Vt){for(var ae=Ft;ae--;)if(f[ae]===Vt)continue t;mt.push(Ut)}else W(f,Vt,T)||mt.push(Ut)}return mt}var uu=ky(aa),gy=ky(ud,!0);function DS(u,f){var m=!0;return uu(u,function(T,O,W){return m=!!f(T,O,W),m}),m}function kf(u,f,m){for(var T=-1,O=u.length;++T<O;){var W=u[T],it=f(W);if(it!=null&&(ct===r?it===it&&!os(it):m(it,ct)))var ct=it,mt=W}return mt}function FS(u,f,m,T){var O=u.length;for(m=qe(m),m<0&&(m=-m>O?0:O+m),T=T===r||T>O?O:qe(T),T<0&&(T+=O),T=m>T?0:Lv(T);m<T;)u[m++]=f;return u}function my(u,f){var m=[];return uu(u,function(T,O,W){f(T,O,W)&&m.push(T)}),m}function Wi(u,f,m,T,O){var W=-1,it=u.length;for(m||(m=Sb),O||(O=[]);++W<it;){var ct=u[W];f>0&&m(ct)?f>1?Wi(ct,f-1,m,T,O):Fe(O,ct):T||(O[O.length]=ct)}return O}var ad=Hy(),yy=Hy(!0);function aa(u,f){return u&&ad(u,f,Pi)}function ud(u,f){return u&&yy(u,f,Pi)}function Hf(u,f){return zi(f,function(m){return Na(u[m])})}function Wu(u,f){f=cu(f,u);for(var m=0,T=f.length;u!=null&&m<T;)u=u[la(f[m++])];return m&&m==T?u:r}function vy(u,f,m){var T=f(u);return ke(u)?T:Fe(T,m(u))}function go(u){return u==null?u===r?$n:te:Sr&&Sr in or(u)?vb(u):Rb(u)}function ld(u,f){return u>f}function US(u,f){return u!=null&&Ze.call(u,f)}function BS(u,f){return u!=null&&f in or(u)}function zS(u,f,m){return u>=mr(f,m)&&u<ei(f,m)}function cd(u,f,m){for(var T=m?zu:Js,O=u[0].length,W=u.length,it=W,ct=Tt(W),mt=1/0,Ft=[];it--;){var Ut=u[it];it&&f&&(Ut=xr(Ut,ji(f))),mt=mr(Ut.length,mt),ct[it]=!m&&(f||O>=120&&Ut.length>=120)?new Hu(it&&Ut):r}Ut=u[0];var Vt=-1,ae=ct[0];t:for(;++Vt<O&&Ft.length<mt;){var xe=Ut[Vt],Re=f?f(xe):xe;if(xe=m||xe!==0?xe:0,!(ae?di(ae,Re):T(Ft,Re,m))){for(it=W;--it;){var Ye=ct[it];if(!(Ye?di(Ye,Re):T(u[it],Re,m)))continue t}ae&&ae.push(Re),Ft.push(xe)}}return Ft}function GS(u,f,m,T){return aa(u,function(O,W,it){f(T,m(O),W,it)}),T}function Bc(u,f,m){f=cu(f,u),u=ov(u,f);var T=u==null?u:u[la(Ss(f))];return T==null?r:ne(T,u,m)}function _y(u){return $r(u)&&go(u)==zt}function kS(u){return $r(u)&&go(u)==rt}function HS(u){return $r(u)&&go(u)==le}function zc(u,f,m,T,O){return u===f?!0:u==null||f==null||!$r(u)&&!$r(f)?u!==u&&f!==f:VS(u,f,m,T,zc,O)}function VS(u,f,m,T,O,W){var it=ke(u),ct=ke(f),mt=it?At:to(u),Ft=ct?At:to(f);mt=mt==zt?fe:mt,Ft=Ft==zt?fe:Ft;var Ut=mt==fe,Vt=Ft==fe,ae=mt==Ft;if(ae&&hu(u)){if(!hu(f))return!1;it=!0,Ut=!1}if(ae&&!Ut)return W||(W=new Us),it||Tl(u)?Qy(u,f,m,T,O,W):mb(u,f,mt,m,T,O,W);if(!(m&x)){var xe=Ut&&Ze.call(u,"__wrapped__"),Re=Vt&&Ze.call(f,"__wrapped__");if(xe||Re){var Ye=xe?u.value():u,Le=Re?f.value():f;return W||(W=new Us),O(Ye,Le,m,T,W)}}return ae?(W||(W=new Us),yb(u,f,m,T,O,W)):!1}function WS(u){return $r(u)&&to(u)==ft}function fd(u,f,m,T){var O=m.length,W=O,it=!T;if(u==null)return!W;for(u=or(u);O--;){var ct=m[O];if(it&&ct[2]?ct[1]!==u[ct[0]]:!(ct[0]in u))return!1}for(;++O<W;){ct=m[O];var mt=ct[0],Ft=u[mt],Ut=ct[1];if(it&&ct[2]){if(Ft===r&&!(mt in u))return!1}else{var Vt=new Us;if(T)var ae=T(Ft,Ut,mt,u,f,Vt);if(!(ae===r?zc(Ut,Ft,x|b,T,Vt):ae))return!1}}return!0}function xy(u){if(!Gr(u)||Tb(u))return!1;var f=Na(u)?Br:Lt;return f.test(Xu(u))}function qS(u){return $r(u)&&go(u)==be}function XS(u){return $r(u)&&to(u)==kt}function YS(u){return $r(u)&&oh(u.length)&&!!jn[go(u)]}function Ey(u){return typeof u=="function"?u:u==null?Go:typeof u=="object"?ke(u)?Sy(u[0],u[1]):My(u):Vv(u)}function hd(u){if(!Hc(u))return Yr(u);var f=[];for(var m in or(u))Ze.call(u,m)&&m!="constructor"&&f.push(m);return f}function $S(u){if(!Gr(u))return Ib(u);var f=Hc(u),m=[];for(var T in u)T=="constructor"&&(f||!Ze.call(u,T))||m.push(T);return m}function pd(u,f){return u<f}function wy(u,f){var m=-1,T=Bo(u)?Tt(u.length):[];return uu(u,function(O,W,it){T[++m]=f(O,W,it)}),T}function My(u){var f=Cd(u);return f.length==1&&f[0][2]?rv(f[0][0],f[0][1]):function(m){return m===u||fd(m,u,f)}}function Sy(u,f){return Id(u)&&nv(f)?rv(la(u),f):function(m){var T=Gd(m,u);return T===r&&T===f?kd(m,u):zc(f,T,x|b)}}function Vf(u,f,m,T,O){u!==f&&ad(f,function(W,it){if(O||(O=new Us),Gr(W))ZS(u,f,it,m,Vf,T,O);else{var ct=T?T(Ld(u,it),W,it+"",u,f,O):r;ct===r&&(ct=W),od(u,it,ct)}},zo)}function ZS(u,f,m,T,O,W,it){var ct=Ld(u,m),mt=Ld(f,m),Ft=it.get(mt);if(Ft){od(u,m,Ft);return}var Ut=W?W(ct,mt,m+"",u,f,it):r,Vt=Ut===r;if(Vt){var ae=ke(mt),xe=!ae&&hu(mt),Re=!ae&&!xe&&Tl(mt);Ut=mt,ae||xe||Re?ke(ct)?Ut=ct:ni(ct)?Ut=Uo(ct):xe?(Vt=!1,Ut=Fy(mt,!0)):Re?(Vt=!1,Ut=Uy(mt,!0)):Ut=[]:Wc(mt)||Yu(mt)?(Ut=ct,Yu(ct)?Ut=Nv(ct):(!Gr(ct)||Na(ct))&&(Ut=ev(mt))):Vt=!1}Vt&&(it.set(mt,Ut),O(Ut,mt,T,W,it),it.delete(mt)),od(u,m,Ut)}function by(u,f){var m=u.length;if(m)return f+=f<0?m:0,La(f,m)?u[f]:r}function Ty(u,f,m){f.length?f=xr(f,function(W){return ke(W)?function(it){return Wu(it,W.length===1?W[0]:W)}:W}):f=[Go];var T=-1;f=xr(f,ji(Pe()));var O=wy(u,function(W,it,ct){var mt=xr(f,function(Ft){return Ft(W)});return{criteria:mt,index:++T,value:W}});return eu(O,function(W,it){return ub(W,it,m)})}function JS(u,f){return Ay(u,f,function(m,T){return kd(u,T)})}function Ay(u,f,m){for(var T=-1,O=f.length,W={};++T<O;){var it=f[T],ct=Wu(u,it);m(ct,it)&&Gc(W,cu(it,u),ct)}return W}function KS(u){return function(f){return Wu(f,u)}}function dd(u,f,m,T){var O=T?hi:ds,W=-1,it=f.length,ct=u;for(u===f&&(f=Uo(f)),m&&(ct=xr(u,ji(m)));++W<it;)for(var mt=0,Ft=f[W],Ut=m?m(Ft):Ft;(mt=O(ct,Ut,mt,T))>-1;)ct!==u&&sr.call(ct,mt,1),sr.call(u,mt,1);return u}function Cy(u,f){for(var m=u?f.length:0,T=m-1;m--;){var O=f[m];if(m==T||O!==W){var W=O;La(O)?sr.call(u,O,1):vd(u,O)}}return u}function gd(u,f){return u+zr(zf()*(f-u+1))}function QS(u,f,m,T){for(var O=-1,W=ei(br((f-u)/(m||1)),0),it=Tt(W);W--;)it[T?W:++O]=u,u+=m;return it}function md(u,f){var m="";if(!u||f<1||f>It)return m;do f%2&&(m+=u),f=zr(f/2),f&&(u+=u);while(f);return m}function Je(u,f){return Nd(iv(u,f,Go),u+"")}function jS(u){return fy(Al(u))}function tb(u,f){var m=Al(u);return jf(m,Vu(f,0,m.length))}function Gc(u,f,m,T){if(!Gr(u))return u;f=cu(f,u);for(var O=-1,W=f.length,it=W-1,ct=u;ct!=null&&++O<W;){var mt=la(f[O]),Ft=m;if(mt==="__proto__"||mt==="constructor"||mt==="prototype")return u;if(O!=it){var Ut=ct[mt];Ft=T?T(Ut,mt,ct):r,Ft===r&&(Ft=Gr(Ut)?Ut:La(f[O+1])?[]:{})}Fc(ct,mt,Ft),ct=ct[mt]}return u}var Py=ra?function(u,f){return ra.set(u,f),u}:Go,eb=Do?function(u,f){return Do(u,"toString",{configurable:!0,enumerable:!1,value:Vd(f),writable:!0})}:Go;function nb(u){return jf(Al(u))}function Ms(u,f,m){var T=-1,O=u.length;f<0&&(f=-f>O?0:O+f),m=m>O?O:m,m<0&&(m+=O),O=f>m?0:m-f>>>0,f>>>=0;for(var W=Tt(O);++T<O;)W[T]=u[T+f];return W}function rb(u,f){var m;return uu(u,function(T,O,W){return m=f(T,O,W),!m}),!!m}function Wf(u,f,m){var T=0,O=u==null?T:u.length;if(typeof f=="number"&&f===f&&O<=ht){for(;T<O;){var W=T+O>>>1,it=u[W];it!==null&&!os(it)&&(m?it<=f:it<f)?T=W+1:O=W}return O}return yd(u,f,Go,m)}function yd(u,f,m,T){var O=0,W=u==null?0:u.length;if(W===0)return 0;f=m(f);for(var it=f!==f,ct=f===null,mt=os(f),Ft=f===r;O<W;){var Ut=zr((O+W)/2),Vt=m(u[Ut]),ae=Vt!==r,xe=Vt===null,Re=Vt===Vt,Ye=os(Vt);if(it)var Le=T||Re;else Ft?Le=Re&&(T||ae):ct?Le=Re&&ae&&(T||!xe):mt?Le=Re&&ae&&!xe&&(T||!Ye):xe||Ye?Le=!1:Le=T?Vt<=f:Vt<f;Le?O=Ut+1:W=Ut}return mr(W,Y)}function Iy(u,f){for(var m=-1,T=u.length,O=0,W=[];++m<T;){var it=u[m],ct=f?f(it):it;if(!m||!Bs(ct,mt)){var mt=ct;W[O++]=it===0?0:it}}return W}function Ry(u){return typeof u=="number"?u:os(u)?Et:+u}function is(u){if(typeof u=="string")return u;if(ke(u))return xr(u,is)+"";if(os(u))return Ci?Ci.call(u):"";var f=u+"";return f=="0"&&1/u==-vt?"-0":f}function lu(u,f,m){var T=-1,O=Js,W=u.length,it=!0,ct=[],mt=ct;if(m)it=!1,O=zu;else if(W>=e){var Ft=f?null:db(u);if(Ft)return qr(Ft);it=!1,O=di,mt=new Hu}else mt=f?[]:ct;t:for(;++T<W;){var Ut=u[T],Vt=f?f(Ut):Ut;if(Ut=m||Ut!==0?Ut:0,it&&Vt===Vt){for(var ae=mt.length;ae--;)if(mt[ae]===Vt)continue t;f&&mt.push(Vt),ct.push(Ut)}else O(mt,Vt,m)||(mt!==ct&&mt.push(Vt),ct.push(Ut))}return ct}function vd(u,f){return f=cu(f,u),u=ov(u,f),u==null||delete u[la(Ss(f))]}function Ly(u,f,m,T){return Gc(u,f,m(Wu(u,f)),T)}function qf(u,f,m,T){for(var O=u.length,W=T?O:-1;(T?W--:++W<O)&&f(u[W],W,u););return m?Ms(u,T?0:W,T?W+1:O):Ms(u,T?W+1:0,T?O:W)}function Ny(u,f){var m=u;return m instanceof i&&(m=m.value()),Po(f,function(T,O){return O.func.apply(O.thisArg,Fe([T],O.args))},m)}function _d(u,f,m){var T=u.length;if(T<2)return T?lu(u[0]):[];for(var O=-1,W=Tt(T);++O<T;)for(var it=u[O],ct=-1;++ct<T;)ct!=O&&(W[O]=Uc(W[O]||it,u[ct],f,m));return lu(Wi(W,1),f,m)}function Oy(u,f,m){for(var T=-1,O=u.length,W=f.length,it={};++T<O;){var ct=T<W?f[T]:r;m(it,u[T],ct)}return it}function xd(u){return ni(u)?u:[]}function Ed(u){return typeof u=="function"?u:Go}function cu(u,f){return ke(u)?u:Id(u,f)?[u]:lv(ar(u))}var ib=Je;function fu(u,f,m){var T=u.length;return m=m===r?T:m,!f&&m>=T?u:Ms(u,f,m)}var Dy=Oc||function(u){return Ur.clearTimeout(u)};function Fy(u,f){if(f)return u.slice();var m=u.length,T=ho?ho(m):new u.constructor(m);return u.copy(T),T}function wd(u){var f=new u.constructor(u.byteLength);return new vs(f).set(new vs(u)),f}function ob(u,f){var m=f?wd(u.buffer):u.buffer;return new u.constructor(m,u.byteOffset,u.byteLength)}function sb(u){var f=new u.constructor(u.source,Zn.exec(u));return f.lastIndex=u.lastIndex,f}function ab(u){return au?or(au.call(u)):{}}function Uy(u,f){var m=f?wd(u.buffer):u.buffer;return new u.constructor(m,u.byteOffset,u.length)}function By(u,f){if(u!==f){var m=u!==r,T=u===null,O=u===u,W=os(u),it=f!==r,ct=f===null,mt=f===f,Ft=os(f);if(!ct&&!Ft&&!W&&u>f||W&&it&&mt&&!ct&&!Ft||T&&it&&mt||!m&&mt||!O)return 1;if(!T&&!W&&!Ft&&u<f||Ft&&m&&O&&!T&&!W||ct&&m&&O||!it&&O||!mt)return-1}return 0}function ub(u,f,m){for(var T=-1,O=u.criteria,W=f.criteria,it=O.length,ct=m.length;++T<it;){var mt=By(O[T],W[T]);if(mt){if(T>=ct)return mt;var Ft=m[T];return mt*(Ft=="desc"?-1:1)}}return u.index-f.index}function zy(u,f,m,T){for(var O=-1,W=u.length,it=m.length,ct=-1,mt=f.length,Ft=ei(W-it,0),Ut=Tt(mt+Ft),Vt=!T;++ct<mt;)Ut[ct]=f[ct];for(;++O<it;)(Vt||O<W)&&(Ut[m[O]]=u[O]);for(;Ft--;)Ut[ct++]=u[O++];return Ut}function Gy(u,f,m,T){for(var O=-1,W=u.length,it=-1,ct=m.length,mt=-1,Ft=f.length,Ut=ei(W-ct,0),Vt=Tt(Ut+Ft),ae=!T;++O<Ut;)Vt[O]=u[O];for(var xe=O;++mt<Ft;)Vt[xe+mt]=f[mt];for(;++it<ct;)(ae||O<W)&&(Vt[xe+m[it]]=u[O++]);return Vt}function Uo(u,f){var m=-1,T=u.length;for(f||(f=Tt(T));++m<T;)f[m]=u[m];return f}function ua(u,f,m,T){var O=!m;m||(m={});for(var W=-1,it=f.length;++W<it;){var ct=f[W],mt=T?T(m[ct],u[ct],ct,m,u):r;mt===r&&(mt=u[ct]),O?Pa(m,ct,mt):Fc(m,ct,mt)}return m}function lb(u,f){return ua(u,Pd(u),f)}function cb(u,f){return ua(u,jy(u),f)}function Xf(u,f){return function(m,T){var O=ke(m)?Of:LS,W=f?f():{};return O(m,u,Pe(T,2),W)}}function Ml(u){return Je(function(f,m){var T=-1,O=m.length,W=O>1?m[O-1]:r,it=O>2?m[2]:r;for(W=u.length>3&&typeof W=="function"?(O--,W):r,it&&mo(m[0],m[1],it)&&(W=O<3?r:W,O=1),f=or(f);++T<O;){var ct=m[T];ct&&u(f,ct,T,W)}return f})}function ky(u,f){return function(m,T){if(m==null)return m;if(!Bo(m))return u(m,T);for(var O=m.length,W=f?O:-1,it=or(m);(f?W--:++W<O)&&T(it[W],W,it)!==!1;);return m}}function Hy(u){return function(f,m,T){for(var O=-1,W=or(f),it=T(f),ct=it.length;ct--;){var mt=it[u?ct:++O];if(m(W[mt],mt,W)===!1)break}return f}}function fb(u,f,m){var T=f&P,O=kc(u);function W(){var it=this&&this!==Ur&&this instanceof W?O:u;return it.apply(T?m:this,arguments)}return W}function Vy(u){return function(f){f=ar(f);var m=Ma(f)?Ro(f):r,T=m?m[0]:f.charAt(0),O=m?fu(m,1).join(""):f.slice(1);return T[u]()+O}}function Sl(u){return function(f){return Po(kv(Gv(f).replace(To,"")),u,"")}}function kc(u){return function(){var f=arguments;switch(f.length){case 0:return new u;case 1:return new u(f[0]);case 2:return new u(f[0],f[1]);case 3:return new u(f[0],f[1],f[2]);case 4:return new u(f[0],f[1],f[2],f[3]);case 5:return new u(f[0],f[1],f[2],f[3],f[4]);case 6:return new u(f[0],f[1],f[2],f[3],f[4],f[5]);case 7:return new u(f[0],f[1],f[2],f[3],f[4],f[5],f[6])}var m=Ca(u.prototype),T=u.apply(m,f);return Gr(T)?T:m}}function hb(u,f,m){var T=kc(u);function O(){for(var W=arguments.length,it=Tt(W),ct=W,mt=bl(O);ct--;)it[ct]=arguments[ct];var Ft=W<3&&it[0]!==mt&&it[W-1]!==mt?[]:Ns(it,mt);if(W-=Ft.length,W<m)return $y(u,f,Yf,O.placeholder,r,it,Ft,r,r,m-W);var Ut=this&&this!==Ur&&this instanceof O?T:u;return ne(Ut,this,it)}return O}function Wy(u){return function(f,m,T){var O=or(f);if(!Bo(f)){var W=Pe(m,3);f=Pi(f),m=function(ct){return W(O[ct],ct,O)}}var it=u(f,m,T);return it>-1?O[W?f[it]:it]:r}}function qy(u){return Ra(function(f){var m=f.length,T=m,O=n.prototype.thru;for(u&&f.reverse();T--;){var W=f[T];if(typeof W!="function")throw new Jn(a);if(O&&!it&&Kf(W)=="wrapper")var it=new n([],!0)}for(T=it?T:m;++T<m;){W=f[T];var ct=Kf(W),mt=ct=="wrapper"?Ad(W):r;mt&&Rd(mt[0])&&mt[1]==(z|E|A|$)&&!mt[4].length&&mt[9]==1?it=it[Kf(mt[0])].apply(it,mt[3]):it=W.length==1&&Rd(W)?it[ct]():it.thru(W)}return function(){var Ft=arguments,Ut=Ft[0];if(it&&Ft.length==1&&ke(Ut))return it.plant(Ut).value();for(var Vt=0,ae=m?f[Vt].apply(this,Ft):Ut;++Vt<m;)ae=f[Vt].call(this,ae);return ae}})}function Yf(u,f,m,T,O,W,it,ct,mt,Ft){var Ut=f&z,Vt=f&P,ae=f&I,xe=f&(E|N),Re=f&q,Ye=ae?r:kc(u);function Le(){for(var Pn=arguments.length,Hn=Tt(Pn),ss=Pn;ss--;)Hn[ss]=arguments[ss];if(xe)var yo=bl(Le),as=Io(Hn,yo);if(T&&(Hn=zy(Hn,T,O,xe)),W&&(Hn=Gy(Hn,W,it,xe)),Pn-=as,xe&&Pn<Ft){var ri=Ns(Hn,yo);return $y(u,f,Yf,Le.placeholder,m,Hn,ri,ct,mt,Ft-Pn)}var zs=Vt?m:this,Da=ae?zs[u]:u;return Pn=Hn.length,ct?Hn=Lb(Hn,ct):Re&&Pn>1&&Hn.reverse(),Ut&&mt<Pn&&(Hn.length=mt),this&&this!==Ur&&this instanceof Le&&(Da=Ye||kc(Da)),Da.apply(zs,Hn)}return Le}function Xy(u,f){return function(m,T){return GS(m,u,f(T),{})}}function $f(u,f){return function(m,T){var O;if(m===r&&T===r)return f;if(m!==r&&(O=m),T!==r){if(O===r)return T;typeof m=="string"||typeof T=="string"?(m=is(m),T=is(T)):(m=Ry(m),T=Ry(T)),O=u(m,T)}return O}}function Md(u){return Ra(function(f){return f=xr(f,ji(Pe())),Je(function(m){var T=this;return u(f,function(O){return ne(O,T,m)})})})}function Zf(u,f){f=f===r?" ":is(f);var m=f.length;if(m<2)return m?md(f,u):f;var T=md(f,br(u/Sa(f)));return Ma(f)?fu(Ro(T),0,u).join(""):T.slice(0,u)}function pb(u,f,m,T){var O=f&P,W=kc(u);function it(){for(var ct=-1,mt=arguments.length,Ft=-1,Ut=T.length,Vt=Tt(Ut+mt),ae=this&&this!==Ur&&this instanceof it?W:u;++Ft<Ut;)Vt[Ft]=T[Ft];for(;mt--;)Vt[Ft++]=arguments[++ct];return ne(ae,O?m:this,Vt)}return it}function Yy(u){return function(f,m,T){return T&&typeof T!="number"&&mo(f,m,T)&&(m=T=r),f=Oa(f),m===r?(m=f,f=0):m=Oa(m),T=T===r?f<m?1:-1:Oa(T),QS(f,m,T,u)}}function Jf(u){return function(f,m){return typeof f=="string"&&typeof m=="string"||(f=bs(f),m=bs(m)),u(f,m)}}function $y(u,f,m,T,O,W,it,ct,mt,Ft){var Ut=f&E,Vt=Ut?it:r,ae=Ut?r:it,xe=Ut?W:r,Re=Ut?r:W;f|=Ut?A:U,f&=~(Ut?U:A),f&M||(f&=~(P|I));var Ye=[u,f,O,xe,Vt,Re,ae,ct,mt,Ft],Le=m.apply(r,Ye);return Rd(u)&&sv(Le,Ye),Le.placeholder=T,av(Le,u,f)}function Sd(u){var f=tn[u];return function(m,T){if(m=bs(m),T=T==null?0:mr(qe(T),292),T&&El(m)){var O=(ar(m)+"e").split("e"),W=f(O[0]+"e"+(+O[1]+T));return O=(ar(W)+"e").split("e"),+(O[0]+"e"+(+O[1]-T))}return f(m)}}var db=na&&1/qr(new na([,-0]))[1]==vt?function(u){return new na(u)}:Xd;function Zy(u){return function(f){var m=to(f);return m==ft?Qo(f):m==kt?Uf(f):jr(f,u(f))}}function Ia(u,f,m,T,O,W,it,ct){var mt=f&I;if(!mt&&typeof u!="function")throw new Jn(a);var Ft=T?T.length:0;if(Ft||(f&=~(A|U),T=O=r),it=it===r?it:ei(qe(it),0),ct=ct===r?ct:qe(ct),Ft-=O?O.length:0,f&U){var Ut=T,Vt=O;T=O=r}var ae=mt?r:Ad(u),xe=[u,f,m,T,O,Ut,Vt,W,it,ct];if(ae&&Pb(xe,ae),u=xe[0],f=xe[1],m=xe[2],T=xe[3],O=xe[4],ct=xe[9]=xe[9]===r?mt?0:u.length:ei(xe[9]-Ft,0),!ct&&f&(E|N)&&(f&=~(E|N)),!f||f==P)var Re=fb(u,f,m);else f==E||f==N?Re=hb(u,f,ct):(f==A||f==(P|A))&&!O.length?Re=pb(u,f,m,T):Re=Yf.apply(r,xe);var Ye=ae?Py:sv;return av(Ye(Re,xe),u,f)}function Jy(u,f,m,T){return u===r||Bs(u,ti[m])&&!Ze.call(T,m)?f:u}function Ky(u,f,m,T,O,W){return Gr(u)&&Gr(f)&&(W.set(f,u),Vf(u,f,r,Ky,W),W.delete(f)),u}function gb(u){return Wc(u)?r:u}function Qy(u,f,m,T,O,W){var it=m&x,ct=u.length,mt=f.length;if(ct!=mt&&!(it&&mt>ct))return!1;var Ft=W.get(u),Ut=W.get(f);if(Ft&&Ut)return Ft==f&&Ut==u;var Vt=-1,ae=!0,xe=m&b?new Hu:r;for(W.set(u,f),W.set(f,u);++Vt<ct;){var Re=u[Vt],Ye=f[Vt];if(T)var Le=it?T(Ye,Re,Vt,f,u,W):T(Re,Ye,Vt,u,f,W);if(Le!==r){if(Le)continue;ae=!1;break}if(xe){if(!wa(f,function(Pn,Hn){if(!di(xe,Hn)&&(Re===Pn||O(Re,Pn,m,T,W)))return xe.push(Hn)})){ae=!1;break}}else if(!(Re===Ye||O(Re,Ye,m,T,W))){ae=!1;break}}return W.delete(u),W.delete(f),ae}function mb(u,f,m,T,O,W,it){switch(m){case Wt:if(u.byteLength!=f.byteLength||u.byteOffset!=f.byteOffset)return!1;u=u.buffer,f=f.buffer;case rt:return!(u.byteLength!=f.byteLength||!W(new vs(u),new vs(f)));case ue:case le:case He:return Bs(+u,+f);case me:return u.name==f.name&&u.message==f.message;case be:case ye:return u==f+"";case ft:var ct=Qo;case kt:var mt=T&x;if(ct||(ct=qr),u.size!=f.size&&!mt)return!1;var Ft=it.get(u);if(Ft)return Ft==f;T|=b,it.set(u,f);var Ut=Qy(ct(u),ct(f),T,O,W,it);return it.delete(u),Ut;case Vn:if(au)return au.call(u)==au.call(f)}return!1}function yb(u,f,m,T,O,W){var it=m&x,ct=bd(u),mt=ct.length,Ft=bd(f),Ut=Ft.length;if(mt!=Ut&&!it)return!1;for(var Vt=mt;Vt--;){var ae=ct[Vt];if(!(it?ae in f:Ze.call(f,ae)))return!1}var xe=W.get(u),Re=W.get(f);if(xe&&Re)return xe==f&&Re==u;var Ye=!0;W.set(u,f),W.set(f,u);for(var Le=it;++Vt<mt;){ae=ct[Vt];var Pn=u[ae],Hn=f[ae];if(T)var ss=it?T(Hn,Pn,ae,f,u,W):T(Pn,Hn,ae,u,f,W);if(!(ss===r?Pn===Hn||O(Pn,Hn,m,T,W):ss)){Ye=!1;break}Le||(Le=ae=="constructor")}if(Ye&&!Le){var yo=u.constructor,as=f.constructor;yo!=as&&"constructor"in u&&"constructor"in f&&!(typeof yo=="function"&&yo instanceof yo&&typeof as=="function"&&as instanceof as)&&(Ye=!1)}return W.delete(u),W.delete(f),Ye}function Ra(u){return Nd(iv(u,r,pv),u+"")}function bd(u){return vy(u,Pi,Pd)}function Td(u){return vy(u,zo,jy)}var Ad=ra?function(u){return ra.get(u)}:Xd;function Kf(u){for(var f=u.name+"",m=ns[f],T=Ze.call(ns,f)?m.length:0;T--;){var O=m[T],W=O.func;if(W==null||W==u)return O.name}return f}function bl(u){var f=Ze.call(B,"placeholder")?B:u;return f.placeholder}function Pe(){var u=B.iteratee||Wd;return u=u===Wd?Ey:u,arguments.length?u(arguments[0],arguments[1]):u}function Qf(u,f){var m=u.__data__;return bb(f)?m[typeof f=="string"?"string":"hash"]:m.map}function Cd(u){for(var f=Pi(u),m=f.length;m--;){var T=f[m],O=u[T];f[m]=[T,O,nv(O)]}return f}function qu(u,f){var m=Wr(u,f);return xy(m)?m:r}function vb(u){var f=Ze.call(u,Sr),m=u[Sr];try{u[Sr]=r;var T=!0}catch(W){}var O=Cr.call(u);return T&&(f?u[Sr]=m:delete u[Sr]),O}var Pd=Aa?function(u){return u==null?[]:(u=or(u),zi(Aa(u),function(f){return Oo.call(u,f)}))}:Yd,jy=Aa?function(u){for(var f=[];u;)Fe(f,Pd(u)),u=_s(u);return f}:Yd,to=go;(po&&to(new po(new ArrayBuffer(1)))!=Wt||xs&&to(new xs)!=ft||ea&&to(ea.resolve())!=de||na&&to(new na)!=kt||Es&&to(new Es)!=j)&&(to=function(u){var f=go(u),m=f==fe?u.constructor:r,T=m?Xu(m):"";if(T)switch(T){case ia:return Wt;case Ae:return ft;case Ds:return de;case su:return kt;case oa:return j}return f});function _b(u,f,m){for(var T=-1,O=m.length;++T<O;){var W=m[T],it=W.size;switch(W.type){case"drop":u+=it;break;case"dropRight":f-=it;break;case"take":f=mr(f,u+it);break;case"takeRight":u=ei(u,f-it);break}}return{start:u,end:f}}function xb(u){var f=u.match(Ir);return f?f[1].split(er):[]}function tv(u,f,m){f=cu(f,u);for(var T=-1,O=f.length,W=!1;++T<O;){var it=la(f[T]);if(!(W=u!=null&&m(u,it)))break;u=u[it]}return W||++T!=O?W:(O=u==null?0:u.length,!!O&&oh(O)&&La(it,O)&&(ke(u)||Yu(u)))}function Eb(u){var f=u.length,m=new u.constructor(f);return f&&typeof u[0]=="string"&&Ze.call(u,"index")&&(m.index=u.index,m.input=u.input),m}function ev(u){return typeof u.constructor=="function"&&!Hc(u)?Ca(_s(u)):{}}function wb(u,f,m){var T=u.constructor;switch(f){case rt:return wd(u);case ue:case le:return new T(+u);case Wt:return ob(u,m);case Gt:case Ct:case he:case Kt:case tt:case C:case L:case F:case J:return Uy(u,m);case ft:return new T;case He:case ye:return new T(u);case be:return sb(u);case kt:return new T;case Vn:return ab(u)}}function Mb(u,f){var m=f.length;if(!m)return u;var T=m-1;return f[T]=(m>1?"& ":"")+f[T],f=f.join(m>2?", ":" "),u.replace(wr,\`{
109
+ \`)}return n.toString()},jr.prototype.computeEdgeEndLabels=function(n){for(var i=this.iterator();i.hasNext();)i.next().computeLabel(n)},jr.prototype.computeLabelling=function(n){this.computeEdgeEndLabels(n[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var i=[!1,!1],s=this.iterator();s.hasNext();)for(var l=s.next().getLabel(),h=0;h<2;h++)l.isLine(h)&&l.getLocation(h)===Z.BOUNDARY&&(i[h]=!0);for(var v=this.iterator();v.hasNext();)for(var S=v.next(),R=S.getLabel(),V=0;V<2;V++)if(R.isAnyNull(V)){var ot=Z.NONE;if(i[V])ot=Z.EXTERIOR;else{var St=S.getCoordinate();ot=this.getLocation(V,St,n)}R.setAllLocationsIfNull(V,ot)}},jr.prototype.getDegree=function(){return this._edgeMap.size()},jr.prototype.insertEdgeEnd=function(n,i){this._edgeMap.put(n,i),this._edgeList=null},jr.prototype.interfaces_=function(){return[]},jr.prototype.getClass=function(){return jr};var Ff=function(n){function i(){n.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var s=null,l=null,h=this._SCANNING_FOR_INCOMING,v=0;v<this._resultAreaEdgeList.size();v++){var S=this._resultAreaEdgeList.get(v),R=S.getSym();if(S.getLabel().isArea())switch(s===null&&S.isInResult()&&(s=S),h){case this._SCANNING_FOR_INCOMING:if(!R.isInResult())continue;l=R,h=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!S.isInResult())continue;l.setNext(S),h=this._SCANNING_FOR_INCOMING}}if(h===this._LINKING_TO_OUTGOING){if(s===null)throw new Zo("no outgoing dirEdge found",this.getCoordinate());kt.isTrue(s.isInResult(),"unable to link last incoming dirEdge"),l.setNext(s)}},i.prototype.insert=function(s){var l=s;this.insertEdgeEnd(l,l)},i.prototype.getRightmostEdge=function(){var s=this.getEdges(),l=s.size();if(l<1)return null;var h=s.get(0);if(l===1)return h;var v=s.get(l-1),S=h.getQuadrant(),R=v.getQuadrant();return kn.isNorthern(S)&&kn.isNorthern(R)?h:kn.isNorthern(S)||kn.isNorthern(R)?h.getDy()!==0?h:v.getDy()!==0?v:(kt.shouldNeverReachHere("found two horizontal edges incident on node"),null):v},i.prototype.print=function(s){Qt.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var l=this.iterator();l.hasNext();){var h=l.next();s.print("out "),h.print(s),s.println(),s.print("in "),h.getSym().print(s),s.println()}},i.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new nt;for(var s=this.iterator();s.hasNext();){var l=s.next();(l.isInResult()||l.getSym().isInResult())&&this._resultAreaEdgeList.add(l)}return this._resultAreaEdgeList},i.prototype.updateLabelling=function(s){for(var l=this.iterator();l.hasNext();){var h=l.next().getLabel();h.setAllLocationsIfNull(0,s.getLocation(0)),h.setAllLocationsIfNull(1,s.getLocation(1))}},i.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var s=null,l=null,h=this._edgeList.size()-1;h>=0;h--){var v=this._edgeList.get(h),S=v.getSym();l===null&&(l=S),s!==null&&S.setNext(s),s=v}l.setNext(s)},i.prototype.computeDepths=function(){if(arguments.length===1){var s=arguments[0],l=this.findIndex(s),h=s.getDepth(Ht.LEFT),v=s.getDepth(Ht.RIGHT),S=this.computeDepths(l+1,this._edgeList.size(),h);if(this.computeDepths(0,l,S)!==v)throw new Zo("depth mismatch at "+s.getCoordinate())}else if(arguments.length===3){for(var R=arguments[0],V=arguments[1],ot=arguments[2],St=R;St<V;St++){var bt=this._edgeList.get(St);bt.setEdgeDepths(Ht.RIGHT,ot),ot=bt.getDepth(Ht.LEFT)}return ot}},i.prototype.mergeSymLabels=function(){for(var s=this.iterator();s.hasNext();){var l=s.next();l.getLabel().merge(l.getSym().getLabel())}},i.prototype.linkMinimalDirectedEdges=function(s){for(var l=null,h=null,v=this._SCANNING_FOR_INCOMING,S=this._resultAreaEdgeList.size()-1;S>=0;S--){var R=this._resultAreaEdgeList.get(S),V=R.getSym();switch(l===null&&R.getEdgeRing()===s&&(l=R),v){case this._SCANNING_FOR_INCOMING:if(V.getEdgeRing()!==s)continue;h=V,v=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(R.getEdgeRing()!==s)continue;h.setNextMin(R),v=this._SCANNING_FOR_INCOMING}}v===this._LINKING_TO_OUTGOING&&(kt.isTrue(l!==null,"found null for first outgoing dirEdge"),kt.isTrue(l.getEdgeRing()===s,"unable to link last incoming dirEdge"),h.setNextMin(l))},i.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var s=0,l=this.iterator();l.hasNext();)l.next().isInResult()&&s++;return s}if(arguments.length===1){for(var h=arguments[0],v=0,S=this.iterator();S.hasNext();)S.next().getEdgeRing()===h&&v++;return v}},i.prototype.getLabel=function(){return this._label},i.prototype.findCoveredLineEdges=function(){for(var s=Z.NONE,l=this.iterator();l.hasNext();){var h=l.next(),v=h.getSym();if(!h.isLineEdge()){if(h.isInResult()){s=Z.INTERIOR;break}if(v.isInResult()){s=Z.EXTERIOR;break}}}if(s===Z.NONE)return null;for(var S=s,R=this.iterator();R.hasNext();){var V=R.next(),ot=V.getSym();V.isLineEdge()?V.getEdge().setCovered(S===Z.INTERIOR):(V.isInResult()&&(S=Z.EXTERIOR),ot.isInResult()&&(S=Z.INTERIOR))}},i.prototype.computeLabelling=function(s){n.prototype.computeLabelling.call(this,s),this._label=new An(Z.NONE);for(var l=this.iterator();l.hasNext();)for(var h=l.next().getEdge().getLabel(),v=0;v<2;v++){var S=h.getLocation(v);S!==Z.INTERIOR&&S!==Z.BOUNDARY||this._label.setLocation(v,Z.INTERIOR)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(jr),ji=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.createNode=function(s){return new yl(s,new Ff)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ja),Jo=function n(){this._pts=null,this._orientation=null;var i=arguments[0];this._pts=i,this._orientation=n.orientation(i)};Jo.prototype.compareTo=function(n){var i=n;return Jo.compareOriented(this._pts,this._orientation,i._pts,i._orientation)},Jo.prototype.interfaces_=function(){return[z]},Jo.prototype.getClass=function(){return Jo},Jo.orientation=function(n){return at.increasingDirection(n)===1},Jo.compareOriented=function(n,i,s,l){for(var h=i?1:-1,v=l?1:-1,S=i?n.length:-1,R=l?s.length:-1,V=i?0:n.length-1,ot=l?0:s.length-1;;){var St=n[V].compareTo(s[ot]);if(St!==0)return St;var bt=(V+=h)===S,Yt=(ot+=v)===R;if(bt&&!Yt)return-1;if(!bt&&Yt)return 1;if(bt&&Yt)return 0}};var di=function(){this._edges=new nt,this._ocaMap=new w};di.prototype.print=function(n){n.print("MULTILINESTRING ( ");for(var i=0;i<this._edges.size();i++){var s=this._edges.get(i);i>0&&n.print(","),n.print("(");for(var l=s.getCoordinates(),h=0;h<l.length;h++)h>0&&n.print(","),n.print(l[h].x+" "+l[h].y);n.println(")")}n.print(") ")},di.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next())},di.prototype.findEdgeIndex=function(n){for(var i=0;i<this._edges.size();i++)if(this._edges.get(i).equals(n))return i;return-1},di.prototype.iterator=function(){return this._edges.iterator()},di.prototype.getEdges=function(){return this._edges},di.prototype.get=function(n){return this._edges.get(n)},di.prototype.findEqualEdge=function(n){var i=new Jo(n.getCoordinates());return this._ocaMap.get(i)},di.prototype.add=function(n){this._edges.add(n);var i=new Jo(n.getCoordinates());this._ocaMap.put(i,n)},di.prototype.interfaces_=function(){return[]},di.prototype.getClass=function(){return di};var Ls=function(){};Ls.prototype.processIntersections=function(n,i,s,l){},Ls.prototype.isDone=function(){},Ls.prototype.interfaces_=function(){return[]},Ls.prototype.getClass=function(){return Ls};var Si=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var n=arguments[0];this._li=n};Si.prototype.isTrivialIntersection=function(n,i,s,l){if(n===s&&this._li.getIntersectionNum()===1){if(Si.isAdjacentSegments(i,l))return!0;if(n.isClosed()){var h=n.size()-1;if(i===0&&l===h||l===0&&i===h)return!0}}return!1},Si.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Si.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Si.prototype.getLineIntersector=function(){return this._li},Si.prototype.hasProperIntersection=function(){return this._hasProper},Si.prototype.processIntersections=function(n,i,s,l){if(n===s&&i===l)return null;this.numTests++;var h=n.getCoordinates()[i],v=n.getCoordinates()[i+1],S=s.getCoordinates()[l],R=s.getCoordinates()[l+1];this._li.computeIntersection(h,v,S,R),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(n,i,s,l)||(this._hasIntersection=!0,n.addIntersections(this._li,i,0),s.addIntersections(this._li,l,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Si.prototype.hasIntersection=function(){return this._hasIntersection},Si.prototype.isDone=function(){return!1},Si.prototype.hasInteriorIntersection=function(){return this._hasInterior},Si.prototype.interfaces_=function(){return[Ls]},Si.prototype.getClass=function(){return Si},Si.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var Io=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var n=arguments[0],i=arguments[1],s=arguments[2];this.coord=new D(n),this.segmentIndex=i,this.dist=s};Io.prototype.getSegmentIndex=function(){return this.segmentIndex},Io.prototype.getCoordinate=function(){return this.coord},Io.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex),n.println(" dist = "+this.dist)},Io.prototype.compareTo=function(n){var i=n;return this.compare(i.segmentIndex,i.dist)},Io.prototype.isEndPoint=function(n){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===n},Io.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Io.prototype.getDistance=function(){return this.dist},Io.prototype.compare=function(n,i){return this.segmentIndex<n?-1:this.segmentIndex>n?1:this.dist<i?-1:this.dist>i?1:0},Io.prototype.interfaces_=function(){return[z]},Io.prototype.getClass=function(){return Io};var Ko=function(){this._nodeMap=new w,this.edge=null;var n=arguments[0];this.edge=n};Ko.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},Ko.prototype.iterator=function(){return this._nodeMap.values().iterator()},Ko.prototype.addSplitEdges=function(n){this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var l=i.next(),h=this.createSplitEdge(s,l);n.add(h),s=l}},Ko.prototype.addEndpoints=function(){var n=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[n],n,0)},Ko.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,l=this.edge.pts[i.segmentIndex],h=i.dist>0||!i.coord.equals2D(l);h||s--;var v=new Array(s).fill(null),S=0;v[S++]=new D(n.coord);for(var R=n.segmentIndex+1;R<=i.segmentIndex;R++)v[S++]=this.edge.pts[R];return h&&(v[S]=i.coord),new _l(v,new An(this.edge._label))},Ko.prototype.add=function(n,i,s){var l=new Io(n,i,s),h=this._nodeMap.get(l);return h!==null?h:(this._nodeMap.put(l,l),l)},Ko.prototype.isIntersection=function(n){for(var i=this.iterator();i.hasNext();)if(i.next().coord.equals(n))return!0;return!1},Ko.prototype.interfaces_=function(){return[]},Ko.prototype.getClass=function(){return Ko};var js=function(){};js.prototype.getChainStartIndices=function(n){var i=0,s=new nt;s.add(new Et(i));do{var l=this.findChainEnd(n,i);s.add(new Et(l)),i=l}while(i<n.length-1);return js.toIntArray(s)},js.prototype.findChainEnd=function(n,i){for(var s=kn.quadrant(n[i],n[i+1]),l=i+1;l<n.length&&kn.quadrant(n[l-1],n[l])===s;)l++;return l-1},js.prototype.interfaces_=function(){return[]},js.prototype.getClass=function(){return js},js.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 ms=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Xt,this.env2=new Xt;var n=arguments[0];this.e=n,this.pts=n.getCoordinates();var i=new js;this.startIndex=i.getChainStartIndices(this.pts)};ms.prototype.getCoordinates=function(){return this.pts},ms.prototype.getMaxX=function(n){var i=this.pts[this.startIndex[n]].x,s=this.pts[this.startIndex[n+1]].x;return i>s?i:s},ms.prototype.getMinX=function(n){var i=this.pts[this.startIndex[n]].x,s=this.pts[this.startIndex[n+1]].x;return i<s?i:s},ms.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];this.computeIntersectsForChain(this.startIndex[n],this.startIndex[n+1],i,i.startIndex[s],i.startIndex[s+1],l)}else if(arguments.length===6){var h=arguments[0],v=arguments[1],S=arguments[2],R=arguments[3],V=arguments[4],ot=arguments[5],St=this.pts[h],bt=this.pts[v],Yt=S.pts[R],Jt=S.pts[V];if(v-h==1&&V-R==1)return ot.addIntersections(this.e,h,S.e,R),null;if(this.env1.init(St,bt),this.env2.init(Yt,Jt),!this.env1.intersects(this.env2))return null;var se=Math.trunc((h+v)/2),_e=Math.trunc((R+V)/2);h<se&&(R<_e&&this.computeIntersectsForChain(h,se,S,R,_e,ot),_e<V&&this.computeIntersectsForChain(h,se,S,_e,V,ot)),se<v&&(R<_e&&this.computeIntersectsForChain(se,v,S,R,_e,ot),_e<V&&this.computeIntersectsForChain(se,v,S,_e,V,ot))}},ms.prototype.getStartIndexes=function(){return this.startIndex},ms.prototype.computeIntersects=function(n,i){for(var s=0;s<this.startIndex.length-1;s++)for(var l=0;l<n.startIndex.length-1;l++)this.computeIntersectsForChain(s,n,l,i)},ms.prototype.interfaces_=function(){return[]},ms.prototype.getClass=function(){return ms};var Wr=function n(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var i=0;i<2;i++)for(var s=0;s<3;s++)this._depth[i][s]=n.NULL_VALUE},Ma={NULL_VALUE:{configurable:!0}};Wr.prototype.getDepth=function(n,i){return this._depth[n][i]},Wr.prototype.setDepth=function(n,i,s){this._depth[n][i]=s},Wr.prototype.isNull=function(){if(arguments.length===0){for(var n=0;n<2;n++)for(var i=0;i<3;i++)if(this._depth[n][i]!==Wr.NULL_VALUE)return!1;return!0}if(arguments.length===1){var s=arguments[0];return this._depth[s][1]===Wr.NULL_VALUE}if(arguments.length===2){var l=arguments[0],h=arguments[1];return this._depth[l][h]===Wr.NULL_VALUE}},Wr.prototype.normalize=function(){for(var n=0;n<2;n++)if(!this.isNull(n)){var i=this._depth[n][1];this._depth[n][2]<i&&(i=this._depth[n][2]),i<0&&(i=0);for(var s=1;s<3;s++){var l=0;this._depth[n][s]>i&&(l=1),this._depth[n][s]=l}}},Wr.prototype.getDelta=function(n){return this._depth[n][Ht.RIGHT]-this._depth[n][Ht.LEFT]},Wr.prototype.getLocation=function(n,i){return this._depth[n][i]<=0?Z.EXTERIOR:Z.INTERIOR},Wr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Wr.prototype.add=function(){if(arguments.length===1)for(var n=arguments[0],i=0;i<2;i++)for(var s=1;s<3;s++){var l=n.getLocation(i,s);l!==Z.EXTERIOR&&l!==Z.INTERIOR||(this.isNull(i,s)?this._depth[i][s]=Wr.depthAtLocation(l):this._depth[i][s]+=Wr.depthAtLocation(l))}else if(arguments.length===3){var h=arguments[0],v=arguments[1];arguments[2]===Z.INTERIOR&&this._depth[h][v]++}},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr},Wr.depthAtLocation=function(n){return n===Z.EXTERIOR?0:n===Z.INTERIOR?1:Wr.NULL_VALUE},Ma.NULL_VALUE.get=function(){return-1},Object.defineProperties(Wr,Ma);var _l=function(n){function i(){if(n.call(this),this.pts=null,this._env=null,this.eiList=new Ko(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Wr,this._depthDelta=0,arguments.length===1){var s=arguments[0];i.call(this,s,null)}else if(arguments.length===2){var l=arguments[0],h=arguments[1];this.pts=l,this._label=h}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getDepth=function(){return this._depth},i.prototype.getCollapsedEdge=function(){var s=new Array(2).fill(null);return s[0]=this.pts[0],s[1]=this.pts[1],new i(s,An.toLineLabel(this._label))},i.prototype.isIsolated=function(){return this._isIsolated},i.prototype.getCoordinates=function(){return this.pts},i.prototype.setIsolated=function(s){this._isIsolated=s},i.prototype.setName=function(s){this._name=s},i.prototype.equals=function(s){if(!(s instanceof i))return!1;var l=s;if(this.pts.length!==l.pts.length)return!1;for(var h=!0,v=!0,S=this.pts.length,R=0;R<this.pts.length;R++)if(this.pts[R].equals2D(l.pts[R])||(h=!1),this.pts[R].equals2D(l.pts[--S])||(v=!1),!h&&!v)return!1;return!0},i.prototype.getCoordinate=function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var s=arguments[0];return this.pts[s]}},i.prototype.print=function(s){s.print("edge "+this._name+": "),s.print("LINESTRING (");for(var l=0;l<this.pts.length;l++)l>0&&s.print(","),s.print(this.pts[l].x+" "+this.pts[l].y);s.print(") "+this._label+" "+this._depthDelta)},i.prototype.computeIM=function(s){i.updateIM(this._label,s)},i.prototype.isCollapsed=function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])},i.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},i.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},i.prototype.getDepthDelta=function(){return this._depthDelta},i.prototype.getNumPoints=function(){return this.pts.length},i.prototype.printReverse=function(s){s.print("edge "+this._name+": ");for(var l=this.pts.length-1;l>=0;l--)s.print(this.pts[l]+" ");s.println("")},i.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ms(this)),this._mce},i.prototype.getEnvelope=function(){if(this._env===null){this._env=new Xt;for(var s=0;s<this.pts.length;s++)this._env.expandToInclude(this.pts[s])}return this._env},i.prototype.addIntersection=function(s,l,h,v){var S=new D(s.getIntersection(v)),R=l,V=s.getEdgeDistance(h,v),ot=R+1;if(ot<this.pts.length){var St=this.pts[ot];S.equals2D(St)&&(R=ot,V=0)}this.eiList.add(S,R,V)},i.prototype.toString=function(){var s=new Pt;s.append("edge "+this._name+": "),s.append("LINESTRING (");for(var l=0;l<this.pts.length;l++)l>0&&s.append(","),s.append(this.pts[l].x+" "+this.pts[l].y);return s.append(") "+this._label+" "+this._depthDelta),s.toString()},i.prototype.isPointwiseEqual=function(s){if(this.pts.length!==s.pts.length)return!1;for(var l=0;l<this.pts.length;l++)if(!this.pts[l].equals2D(s.pts[l]))return!1;return!0},i.prototype.setDepthDelta=function(s){this._depthDelta=s},i.prototype.getEdgeIntersectionList=function(){return this.eiList},i.prototype.addIntersections=function(s,l,h){for(var v=0;v<s.getIntersectionNum();v++)this.addIntersection(s,l,h,v)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.updateIM=function(){if(arguments.length!==2)return n.prototype.updateIM.apply(this,arguments);var s=arguments[0],l=arguments[1];l.setAtLeastIfValid(s.getLocation(0,Ht.ON),s.getLocation(1,Ht.ON),1),s.isArea()&&(l.setAtLeastIfValid(s.getLocation(0,Ht.LEFT),s.getLocation(1,Ht.LEFT),2),l.setAtLeastIfValid(s.getLocation(0,Ht.RIGHT),s.getLocation(1,Ht.RIGHT),2))},i}(Bi),ii=function(n){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new di,this._bufParams=n||null};ii.prototype.setWorkingPrecisionModel=function(n){this._workingPrecisionModel=n},ii.prototype.insertUniqueEdge=function(n){var i=this._edgeList.findEqualEdge(n);if(i!==null){var s=i.getLabel(),l=n.getLabel();i.isPointwiseEqual(n)||(l=new An(n.getLabel())).flip(),s.merge(l);var h=ii.depthDelta(l),v=i.getDepthDelta()+h;i.setDepthDelta(v)}else this._edgeList.add(n),n.setDepthDelta(ii.depthDelta(n.getLabel()))},ii.prototype.buildSubgraphs=function(n,i){for(var s=new nt,l=n.iterator();l.hasNext();){var h=l.next(),v=h.getRightmostCoordinate(),S=new Qs(s).getDepth(v);h.computeDepth(S),h.findResultEdges(),s.add(h),i.add(h.getDirectedEdges(),h.getNodes())}},ii.prototype.createSubgraphs=function(n){for(var i=new nt,s=n.getNodes().iterator();s.hasNext();){var l=s.next();if(!l.isVisited()){var h=new Jr;h.create(l),i.add(h)}}return uo.sort(i,uo.reverseOrder()),i},ii.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},ii.prototype.getNoder=function(n){if(this._workingNoder!==null)return this._workingNoder;var i=new zu,s=new $n;return s.setPrecisionModel(n),i.setSegmentIntersector(new Si(s)),i},ii.prototype.buffer=function(n,i){var s=this._workingPrecisionModel;s===null&&(s=n.getPrecisionModel()),this._geomFact=n.getFactory();var l=new hi(s,this._bufParams),h=new ki(n,i,l).getCurves();if(h.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(h,s),this._graph=new cr(new ji),this._graph.addEdges(this._edgeList.getEdges());var v=this.createSubgraphs(this._graph),S=new Ei(this._geomFact);this.buildSubgraphs(v,S);var R=S.getPolygons();return R.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(R)},ii.prototype.computeNodedEdges=function(n,i){var s=this.getNoder(i);s.computeNodes(n);for(var l=s.getNodedSubstrings().iterator();l.hasNext();){var h=l.next(),v=h.getCoordinates();if(v.length!==2||!v[0].equals2D(v[1])){var S=h.getData(),R=new _l(h.getCoordinates(),new An(S));this.insertUniqueEdge(R)}}},ii.prototype.setNoder=function(n){this._workingNoder=n},ii.prototype.interfaces_=function(){return[]},ii.prototype.getClass=function(){return ii},ii.depthDelta=function(n){var i=n.getLocation(0,Ht.LEFT),s=n.getLocation(0,Ht.RIGHT);return i===Z.INTERIOR&&s===Z.EXTERIOR?1:i===Z.EXTERIOR&&s===Z.INTERIOR?-1:0},ii.convertSegStrings=function(n){for(var i=new Ce,s=new nt;n.hasNext();){var l=n.next(),h=i.createLineString(l.getCoordinates());s.add(h)}return i.buildGeometry(s)};var Qo=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var n=arguments[0],i=arguments[1];this._noder=n,this._scaleFactor=i,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var s=arguments[0],l=arguments[1],h=arguments[2],v=arguments[3];this._noder=s,this._scaleFactor=l,this._offsetX=h,this._offsetY=v,this._isScaled=!this.isIntegerPrecision()}};Qo.prototype.rescale=function(){if(et(arguments[0],st))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.rescale(i.getCoordinates())}else if(arguments[0]instanceof Array){for(var s=arguments[0],l=0;l<s.length;l++)s[l].x=s[l].x/this._scaleFactor+this._offsetX,s[l].y=s[l].y/this._scaleFactor+this._offsetY;s.length===2&&s[0].equals2D(s[1])&&Qt.out.println(s)}},Qo.prototype.scale=function(){if(et(arguments[0],st)){for(var n=arguments[0],i=new nt,s=n.iterator();s.hasNext();){var l=s.next();i.add(new dr(this.scale(l.getCoordinates()),l.getData()))}return i}if(arguments[0]instanceof Array){for(var h=arguments[0],v=new Array(h.length).fill(null),S=0;S<h.length;S++)v[S]=new D(Math.round((h[S].x-this._offsetX)*this._scaleFactor),Math.round((h[S].y-this._offsetY)*this._scaleFactor),h[S].z);return at.removeRepeatedPoints(v)}},Qo.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},Qo.prototype.getNodedSubstrings=function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n},Qo.prototype.computeNodes=function(n){var i=n;this._isScaled&&(i=this.scale(n)),this._noder.computeNodes(i)},Qo.prototype.interfaces_=function(){return[zi]},Qo.prototype.getClass=function(){return Qo};var fo=function(){this._li=new $n,this._segStrings=null;var n=arguments[0];this._segStrings=n},Ns={fact:{configurable:!0}};fo.prototype.checkEndPtVertexIntersections=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next().getCoordinates();this.checkEndPtVertexIntersections(i[0],this._segStrings),this.checkEndPtVertexIntersections(i[i.length-1],this._segStrings)}else if(arguments.length===2){for(var s=arguments[0],l=arguments[1].iterator();l.hasNext();)for(var h=l.next().getCoordinates(),v=1;v<h.length-1;v++)if(h[v].equals(s))throw new Ue("found endpt/interior pt intersection at index "+v+" :pt "+s)}},fo.prototype.checkInteriorIntersections=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();)for(var i=n.next(),s=this._segStrings.iterator();s.hasNext();){var l=s.next();this.checkInteriorIntersections(i,l)}else if(arguments.length===2)for(var h=arguments[0],v=arguments[1],S=h.getCoordinates(),R=v.getCoordinates(),V=0;V<S.length-1;V++)for(var ot=0;ot<R.length-1;ot++)this.checkInteriorIntersections(h,V,v,ot);else if(arguments.length===4){var St=arguments[0],bt=arguments[1],Yt=arguments[2],Jt=arguments[3];if(St===Yt&&bt===Jt)return null;var se=St.getCoordinates()[bt],_e=St.getCoordinates()[bt+1],Cn=Yt.getCoordinates()[Jt],Xn=Yt.getCoordinates()[Jt+1];if(this._li.computeIntersection(se,_e,Cn,Xn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,se,_e)||this.hasInteriorIntersection(this._li,Cn,Xn)))throw new Ue("found non-noded intersection at "+se+"-"+_e+" and "+Cn+"-"+Xn)}},fo.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},fo.prototype.checkCollapses=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkCollapses(i)}else if(arguments.length===1)for(var s=arguments[0].getCoordinates(),l=0;l<s.length-2;l++)this.checkCollapse(s[l],s[l+1],s[l+2])},fo.prototype.hasInteriorIntersection=function(n,i,s){for(var l=0;l<n.getIntersectionNum();l++){var h=n.getIntersection(l);if(!h.equals(i)&&!h.equals(s))return!0}return!1},fo.prototype.checkCollapse=function(n,i,s){if(n.equals(s))throw new Ue("found non-noded collapse at "+fo.fact.createLineString([n,i,s]))},fo.prototype.interfaces_=function(){return[]},fo.prototype.getClass=function(){return fo},Ns.fact.get=function(){return new Ce},Object.defineProperties(fo,Ns);var qr=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var n=arguments[0],i=arguments[1],s=arguments[2];if(this._originalPt=n,this._pt=n,this._scaleFactor=i,this._li=s,i<=0)throw new N("Scale factor must be non-zero");i!==1&&(this._pt=new D(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new D,this._p1Scaled=new D),this.initCorners(this._pt)},Uf={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};qr.prototype.intersectsScaled=function(n,i){var s=Math.min(n.x,i.x),l=Math.max(n.x,i.x),h=Math.min(n.y,i.y),v=Math.max(n.y,i.y),S=this._maxx<s||this._minx>l||this._maxy<h||this._miny>v;if(S)return!1;var R=this.intersectsToleranceSquare(n,i);return kt.isTrue(!(S&&R),"Found bad envelope test"),R},qr.prototype.initCorners=function(n){this._minx=n.x-.5,this._maxx=n.x+.5,this._miny=n.y-.5,this._maxy=n.y+.5,this._corner[0]=new D(this._maxx,this._maxy),this._corner[1]=new D(this._minx,this._maxy),this._corner[2]=new D(this._minx,this._miny),this._corner[3]=new D(this._maxx,this._miny)},qr.prototype.intersects=function(n,i){return this._scaleFactor===1?this.intersectsScaled(n,i):(this.copyScaled(n,this._p0Scaled),this.copyScaled(i,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},qr.prototype.scale=function(n){return Math.round(n*this._scaleFactor)},qr.prototype.getCoordinate=function(){return this._originalPt},qr.prototype.copyScaled=function(n,i){i.x=this.scale(n.x),i.y=this.scale(n.y)},qr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var n=qr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Xt(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv},qr.prototype.intersectsPixelClosure=function(n,i){return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},qr.prototype.intersectsToleranceSquare=function(n,i){var s=!1,l=!1;return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(s=!0),this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(l=!0),this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!s||!l)||!!n.equals(this._pt)||!!i.equals(this._pt))))},qr.prototype.addSnappedNode=function(n,i){var s=n.getCoordinate(i),l=n.getCoordinate(i+1);return!!this.intersects(s,l)&&(n.addIntersection(this.getCoordinate(),i),!0)},qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr},Uf.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(qr,Uf);var Gu=function(){this.tempEnv1=new Xt,this.selectedSegment=new ne};Gu.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var n=arguments[0],i=arguments[1];n.getLineSegment(i,this.selectedSegment),this.select(this.selectedSegment)}}},Gu.prototype.interfaces_=function(){return[]},Gu.prototype.getClass=function(){return Gu};var nu=function(){this._index=null;var n=arguments[0];this._index=n},Sa={HotPixelSnapAction:{configurable:!0}};nu.prototype.snap=function(){if(arguments.length===1){var n=arguments[0];return this.snap(n,null,-1)}if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2],h=i.getSafeEnvelope(),v=new Ro(i,s,l);return this._index.query(h,{interfaces_:function(){return[Rs]},visitItem:function(S){S.select(h,v)}}),v.isNodeAdded()}},nu.prototype.interfaces_=function(){return[]},nu.prototype.getClass=function(){return nu},Sa.HotPixelSnapAction.get=function(){return Ro},Object.defineProperties(nu,Sa);var Ro=function(n){function i(){n.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var s=arguments[0],l=arguments[1],h=arguments[2];this._hotPixel=s,this._parentEdge=l,this._hotPixelVertexIndex=h}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isNodeAdded=function(){return this._isNodeAdded},i.prototype.select=function(){if(arguments.length!==2)return n.prototype.select.apply(this,arguments);var s=arguments[0],l=arguments[1],h=s.getContext();if(this._parentEdge!==null&&h===this._parentEdge&&l===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(h,l)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Gu),ta=function(){this._li=null,this._interiorIntersections=null;var n=arguments[0];this._li=n,this._interiorIntersections=new nt};ta.prototype.processIntersections=function(n,i,s,l){if(n===s&&i===l)return null;var h=n.getCoordinates()[i],v=n.getCoordinates()[i+1],S=s.getCoordinates()[l],R=s.getCoordinates()[l+1];if(this._li.computeIntersection(h,v,S,R),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var V=0;V<this._li.getIntersectionNum();V++)this._interiorIntersections.add(this._li.getIntersection(V));n.addIntersections(this._li,i,0),s.addIntersections(this._li,l,1)}},ta.prototype.isDone=function(){return!1},ta.prototype.getInteriorIntersections=function(){return this._interiorIntersections},ta.prototype.interfaces_=function(){return[Ls]},ta.prototype.getClass=function(){return ta};var jo=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var n=arguments[0];this._pm=n,this._li=new $n,this._li.setPrecisionModel(n),this._scaleFactor=n.getScale()};jo.prototype.checkCorrectness=function(n){var i=dr.getNodedSubstrings(n),s=new fo(i);try{s.checkValid()}catch(l){if(!(l instanceof ue))throw l;l.printStackTrace()}},jo.prototype.getNodedSubstrings=function(){return dr.getNodedSubstrings(this._nodedSegStrings)},jo.prototype.snapRound=function(n,i){var s=this.findInteriorIntersections(n,i);this.computeIntersectionSnaps(s),this.computeVertexSnaps(n)},jo.prototype.findInteriorIntersections=function(n,i){var s=new ta(i);return this._noder.setSegmentIntersector(s),this._noder.computeNodes(n),s.getInteriorIntersections()},jo.prototype.computeVertexSnaps=function(){if(et(arguments[0],st))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.computeVertexSnaps(i)}else if(arguments[0]instanceof dr)for(var s=arguments[0],l=s.getCoordinates(),h=0;h<l.length;h++){var v=new qr(l[h],this._scaleFactor,this._li);this._pointSnapper.snap(v,s,h)&&s.addIntersection(l[h],h)}},jo.prototype.computeNodes=function(n){this._nodedSegStrings=n,this._noder=new zu,this._pointSnapper=new nu(this._noder.getIndex()),this.snapRound(n,this._li)},jo.prototype.computeIntersectionSnaps=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),l=new qr(s,this._scaleFactor,this._li);this._pointSnapper.snap(l)}},jo.prototype.interfaces_=function(){return[zi]},jo.prototype.getClass=function(){return jo};var Xr=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Fe,this._resultGeometry=null,this._saveException=null,arguments.length===1){var n=arguments[0];this._argGeom=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._argGeom=i,this._bufParams=s}},ru={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};Xr.prototype.bufferFixedPrecision=function(n){var i=new Qo(new jo(new Se(1)),n.getScale()),s=new ii(this._bufParams);s.setWorkingPrecisionModel(n),s.setNoder(i),this._resultGeometry=s.buffer(this._argGeom,this._distance)},Xr.prototype.bufferReducedPrecision=function(){var n=this;if(arguments.length===0){for(var i=Xr.MAX_PRECISION_DIGITS;i>=0;i--){try{n.bufferReducedPrecision(i)}catch(v){if(!(v instanceof Zo))throw v;n._saveException=v}if(n._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var s=arguments[0],l=Xr.precisionScaleFactor(this._argGeom,this._distance,s),h=new Se(l);this.bufferFixedPrecision(h)}},Xr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var n=this._argGeom.getFactory().getPrecisionModel();n.getType()===Se.FIXED?this.bufferFixedPrecision(n):this.bufferReducedPrecision()},Xr.prototype.setQuadrantSegments=function(n){this._bufParams.setQuadrantSegments(n)},Xr.prototype.bufferOriginalPrecision=function(){try{var n=new ii(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(i){if(!(i instanceof Ue))throw i;this._saveException=i}},Xr.prototype.getResultGeometry=function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry},Xr.prototype.setEndCapStyle=function(n){this._bufParams.setEndCapStyle(n)},Xr.prototype.interfaces_=function(){return[]},Xr.prototype.getClass=function(){return Xr},Xr.bufferOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new Xr(n).getResultGeometry(i)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ct&&typeof arguments[1]=="number"){var s=arguments[0],l=arguments[1],h=arguments[2],v=new Xr(s);return v.setQuadrantSegments(h),v.getResultGeometry(l)}if(arguments[2]instanceof Fe&&arguments[0]instanceof Ct&&typeof arguments[1]=="number"){var S=arguments[0],R=arguments[1],V=arguments[2];return new Xr(S,V).getResultGeometry(R)}}else if(arguments.length===4){var ot=arguments[0],St=arguments[1],bt=arguments[2],Yt=arguments[3],Jt=new Xr(ot);return Jt.setQuadrantSegments(bt),Jt.setEndCapStyle(Yt),Jt.getResultGeometry(St)}},Xr.precisionScaleFactor=function(n,i,s){var l=n.getEnvelopeInternal(),h=vt.max(Math.abs(l.getMaxX()),Math.abs(l.getMaxY()),Math.abs(l.getMinX()),Math.abs(l.getMinY()))+2*(i>0?i:0),v=s-Math.trunc(Math.log(h)/Math.log(10)+1);return Math.pow(10,v)},ru.CAP_ROUND.get=function(){return Fe.CAP_ROUND},ru.CAP_BUTT.get=function(){return Fe.CAP_FLAT},ru.CAP_FLAT.get=function(){return Fe.CAP_FLAT},ru.CAP_SQUARE.get=function(){return Fe.CAP_SQUARE},ru.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(Xr,ru);var oi=function(){this._pt=[new D,new D],this._distance=A.NaN,this._isNull=!0};oi.prototype.getCoordinates=function(){return this._pt},oi.prototype.getCoordinate=function(n){return this._pt[n]},oi.prototype.setMinimum=function(){if(arguments.length===1){var n=arguments[0];this.setMinimum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var l=i.distance(s);l<this._distance&&this.initialize(i,s,l)}},oi.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=n.distance(i),this._isNull=!1}else if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(l),this._distance=h,this._isNull=!1}},oi.prototype.getDistance=function(){return this._distance},oi.prototype.setMaximum=function(){if(arguments.length===1){var n=arguments[0];this.setMaximum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var l=i.distance(s);l>this._distance&&this.initialize(i,s,l)}},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi};var ts=function(){};ts.prototype.interfaces_=function(){return[]},ts.prototype.getClass=function(){return ts},ts.computeDistance=function(){if(arguments[2]instanceof oi&&arguments[0]instanceof jt&&arguments[1]instanceof D)for(var n=arguments[0],i=arguments[1],s=arguments[2],l=n.getCoordinates(),h=new ne,v=0;v<l.length-1;v++){h.setCoordinates(l[v],l[v+1]);var S=h.closestPoint(i);s.setMinimum(S,i)}else if(arguments[2]instanceof oi&&arguments[0]instanceof pe&&arguments[1]instanceof D){var R=arguments[0],V=arguments[1],ot=arguments[2];ts.computeDistance(R.getExteriorRing(),V,ot);for(var St=0;St<R.getNumInteriorRing();St++)ts.computeDistance(R.getInteriorRingN(St),V,ot)}else if(arguments[2]instanceof oi&&arguments[0]instanceof Ct&&arguments[1]instanceof D){var bt=arguments[0],Yt=arguments[1],Jt=arguments[2];if(bt instanceof jt)ts.computeDistance(bt,Yt,Jt);else if(bt instanceof pe)ts.computeDistance(bt,Yt,Jt);else if(bt instanceof Zn)for(var se=bt,_e=0;_e<se.getNumGeometries();_e++){var Cn=se.getGeometryN(_e);ts.computeDistance(Cn,Yt,Jt)}else Jt.setMinimum(bt.getCoordinate(),Yt)}else if(arguments[2]instanceof oi&&arguments[0]instanceof ne&&arguments[1]instanceof D){var Xn=arguments[0],ui=arguments[1],rs=arguments[2],Fs=Xn.closestPoint(ui);rs.setMinimum(Fs,ui)}};var Hi=function(n){this._maxPtDist=new oi,this._inputGeom=n||null},gt={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Hi.prototype.computeMaxMidpointDistance=function(n){var i=new Tt(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},Hi.prototype.computeMaxVertexDistance=function(n){var i=new Nt(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},Hi.prototype.findDistance=function(n){return this.computeMaxVertexDistance(n),this.computeMaxMidpointDistance(n),this._maxPtDist.getDistance()},Hi.prototype.getDistancePoints=function(){return this._maxPtDist},Hi.prototype.interfaces_=function(){return[]},Hi.prototype.getClass=function(){return Hi},gt.MaxPointDistanceFilter.get=function(){return Nt},gt.MaxMidpointDistanceFilter.get=function(){return Tt},Object.defineProperties(Hi,gt);var Nt=function(n){this._maxPtDist=new oi,this._minPtDist=new oi,this._geom=n||null};Nt.prototype.filter=function(n){this._minPtDist.initialize(),ts.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Nt.prototype.getMaxPointDistance=function(){return this._maxPtDist},Nt.prototype.interfaces_=function(){return[tt]},Nt.prototype.getClass=function(){return Nt};var Tt=function(n){this._maxPtDist=new oi,this._minPtDist=new oi,this._geom=n||null};Tt.prototype.filter=function(n,i){if(i===0)return null;var s=n.getCoordinate(i-1),l=n.getCoordinate(i),h=new D((s.x+l.x)/2,(s.y+l.y)/2);this._minPtDist.initialize(),ts.computeDistance(this._geom,h,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Tt.prototype.isDone=function(){return!1},Tt.prototype.isGeometryChanged=function(){return!1},Tt.prototype.getMaxPointDistance=function(){return this._maxPtDist},Tt.prototype.interfaces_=function(){return[lr]},Tt.prototype.getClass=function(){return Tt};var re=function(n){this._comps=n||null};re.prototype.filter=function(n){n instanceof pe&&this._comps.add(n)},re.prototype.interfaces_=function(){return[hr]},re.prototype.getClass=function(){return re},re.getPolygons=function(){if(arguments.length===1){var n=arguments[0];return re.getPolygons(n,new nt)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof pe?s.add(i):i instanceof Zn&&i.apply(new re(s)),s}};var ve=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var n=arguments[0];this._lines=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._lines=i,this._isForcedToLineString=s}};ve.prototype.filter=function(n){if(this._isForcedToLineString&&n instanceof Tn){var i=n.getFactory().createLineString(n.getCoordinateSequence());return this._lines.add(i),null}n instanceof jt&&this._lines.add(n)},ve.prototype.setForceToLineString=function(n){this._isForcedToLineString=n},ve.prototype.interfaces_=function(){return[Gt]},ve.prototype.getClass=function(){return ve},ve.getGeometry=function(){if(arguments.length===1){var n=arguments[0];return n.getFactory().buildGeometry(ve.getLines(n))}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().buildGeometry(ve.getLines(i,s))}},ve.getLines=function(){if(arguments.length===1){var n=arguments[0];return ve.getLines(n,!1)}if(arguments.length===2){if(et(arguments[0],st)&&et(arguments[1],st)){for(var i=arguments[0],s=arguments[1],l=i.iterator();l.hasNext();){var h=l.next();ve.getLines(h,s)}return s}if(arguments[0]instanceof Ct&&typeof arguments[1]=="boolean"){var v=arguments[0],S=arguments[1],R=new nt;return v.apply(new ve(R,S)),R}if(arguments[0]instanceof Ct&&et(arguments[1],st)){var V=arguments[0],ot=arguments[1];return V instanceof jt?ot.add(V):V.apply(new ve(ot)),ot}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&et(arguments[0],st)&&et(arguments[1],st)){for(var St=arguments[0],bt=arguments[1],Yt=arguments[2],Jt=St.iterator();Jt.hasNext();){var se=Jt.next();ve.getLines(se,bt,Yt)}return bt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Ct&&et(arguments[1],st)){var _e=arguments[0],Cn=arguments[1],Xn=arguments[2];return _e.apply(new ve(Cn,Xn)),Cn}}};var Be=function(){if(this._boundaryRule=C.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];if(n===null)throw new N("Rule must be non-null");this._boundaryRule=n}}};Be.prototype.locateInternal=function(){if(arguments[0]instanceof D&&arguments[1]instanceof pe){var n=arguments[0],i=arguments[1];if(i.isEmpty())return Z.EXTERIOR;var s=i.getExteriorRing(),l=this.locateInPolygonRing(n,s);if(l===Z.EXTERIOR)return Z.EXTERIOR;if(l===Z.BOUNDARY)return Z.BOUNDARY;for(var h=0;h<i.getNumInteriorRing();h++){var v=i.getInteriorRingN(h),S=this.locateInPolygonRing(n,v);if(S===Z.INTERIOR)return Z.EXTERIOR;if(S===Z.BOUNDARY)return Z.BOUNDARY}return Z.INTERIOR}if(arguments[0]instanceof D&&arguments[1]instanceof jt){var R=arguments[0],V=arguments[1];if(!V.getEnvelopeInternal().intersects(R))return Z.EXTERIOR;var ot=V.getCoordinates();return V.isClosed()||!R.equals(ot[0])&&!R.equals(ot[ot.length-1])?rt.isOnLine(R,ot)?Z.INTERIOR:Z.EXTERIOR:Z.BOUNDARY}if(arguments[0]instanceof D&&arguments[1]instanceof ge){var St=arguments[0];return arguments[1].getCoordinate().equals2D(St)?Z.INTERIOR:Z.EXTERIOR}},Be.prototype.locateInPolygonRing=function(n,i){return i.getEnvelopeInternal().intersects(n)?rt.locatePointInRing(n,i.getCoordinates()):Z.EXTERIOR},Be.prototype.intersects=function(n,i){return this.locate(n,i)!==Z.EXTERIOR},Be.prototype.updateLocationInfo=function(n){n===Z.INTERIOR&&(this._isIn=!0),n===Z.BOUNDARY&&this._numBoundaries++},Be.prototype.computeLocation=function(n,i){if(i instanceof ge&&this.updateLocationInfo(this.locateInternal(n,i)),i instanceof jt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof pe)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof K)for(var s=i,l=0;l<s.getNumGeometries();l++){var h=s.getGeometryN(l);this.updateLocationInfo(this.locateInternal(n,h))}else if(i instanceof Bn)for(var v=i,S=0;S<v.getNumGeometries();S++){var R=v.getGeometryN(S);this.updateLocationInfo(this.locateInternal(n,R))}else if(i instanceof Zn)for(var V=new co(i);V.hasNext();){var ot=V.next();ot!==i&&this.computeLocation(n,ot)}},Be.prototype.locate=function(n,i){return i.isEmpty()?Z.EXTERIOR:i instanceof jt?this.locateInternal(n,i):i instanceof pe?this.locateInternal(n,i):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(n,i),this._boundaryRule.isInBoundary(this._numBoundaries)?Z.BOUNDARY:this._numBoundaries>0||this._isIn?Z.INTERIOR:Z.EXTERIOR)},Be.prototype.interfaces_=function(){return[]},Be.prototype.getClass=function(){return Be};var tn=function n(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var i=arguments[0],s=arguments[1];n.call(this,i,n.INSIDE_AREA,s)}else if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2];this._component=l,this._segIndex=h,this._pt=v}},or={INSIDE_AREA:{configurable:!0}};tn.prototype.isInsideArea=function(){return this._segIndex===tn.INSIDE_AREA},tn.prototype.getCoordinate=function(){return this._pt},tn.prototype.getGeometryComponent=function(){return this._component},tn.prototype.getSegmentIndex=function(){return this._segIndex},tn.prototype.interfaces_=function(){return[]},tn.prototype.getClass=function(){return tn},or.INSIDE_AREA.get=function(){return-1},Object.defineProperties(tn,or);var es=function(n){this._pts=n||null};es.prototype.filter=function(n){n instanceof ge&&this._pts.add(n)},es.prototype.interfaces_=function(){return[hr]},es.prototype.getClass=function(){return es},es.getPoints=function(){if(arguments.length===1){var n=arguments[0];return n instanceof ge?uo.singletonList(n):es.getPoints(n,new nt)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof ge?s.add(i):i instanceof Zn&&i.apply(new es(s)),s}};var ba=function(){this._locations=null;var n=arguments[0];this._locations=n};ba.prototype.filter=function(n){(n instanceof ge||n instanceof jt||n instanceof pe)&&this._locations.add(new tn(n,0,n.getCoordinate()))},ba.prototype.interfaces_=function(){return[hr]},ba.prototype.getClass=function(){return ba},ba.getLocations=function(n){var i=new nt;return n.apply(new ba(i)),i};var Jn=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Be,this._minDistanceLocation=null,this._minDistance=A.MAX_VALUE,arguments.length===2){var n=arguments[0],i=arguments[1];this._geom=[n,i],this._terminateDistance=0}else if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=s,this._geom[1]=l,this._terminateDistance=h}};Jn.prototype.computeContainmentDistance=function(){if(arguments.length===0){var n=new Array(2).fill(null);if(this.computeContainmentDistance(0,n),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],l=1-i,h=re.getPolygons(this._geom[i]);if(h.size()>0){var v=ba.getLocations(this._geom[l]);if(this.computeContainmentDistance(v,h,s),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[l]=s[0],this._minDistanceLocation[i]=s[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&et(arguments[0],ut)&&et(arguments[1],ut)){for(var S=arguments[0],R=arguments[1],V=arguments[2],ot=0;ot<S.size();ot++)for(var St=S.get(ot),bt=0;bt<R.size();bt++)if(this.computeContainmentDistance(St,R.get(bt),V),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof tn&&arguments[1]instanceof pe){var Yt=arguments[0],Jt=arguments[1],se=arguments[2],_e=Yt.getCoordinate();if(Z.EXTERIOR!==this._ptLocator.locate(_e,Jt))return this._minDistance=0,se[0]=Yt,se[1]=new tn(Jt,_e),null}}},Jn.prototype.computeMinDistanceLinesPoints=function(n,i,s){for(var l=0;l<n.size();l++)for(var h=n.get(l),v=0;v<i.size();v++){var S=i.get(v);if(this.computeMinDistance(h,S,s),this._minDistance<=this._terminateDistance)return null}},Jn.prototype.computeFacetDistance=function(){var n=new Array(2).fill(null),i=ve.getLines(this._geom[0]),s=ve.getLines(this._geom[1]),l=es.getPoints(this._geom[0]),h=es.getPoints(this._geom[1]);return this.computeMinDistanceLines(i,s,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(i,h,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(s,l,n),this.updateMinDistance(n,!0),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistancePoints(l,h,n),void this.updateMinDistance(n,!1))))},Jn.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},Jn.prototype.updateMinDistance=function(n,i){if(n[0]===null)return null;i?(this._minDistanceLocation[0]=n[1],this._minDistanceLocation[1]=n[0]):(this._minDistanceLocation[0]=n[0],this._minDistanceLocation[1]=n[1])},Jn.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},Jn.prototype.computeMinDistance=function(){if(arguments.length===0){if(this._minDistanceLocation!==null||(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance))return null;this.computeFacetDistance()}else if(arguments.length===3){if(arguments[2]instanceof Array&&arguments[0]instanceof jt&&arguments[1]instanceof ge){var n=arguments[0],i=arguments[1],s=arguments[2];if(n.getEnvelopeInternal().distance(i.getEnvelopeInternal())>this._minDistance)return null;for(var l=n.getCoordinates(),h=i.getCoordinate(),v=0;v<l.length-1;v++){var S=rt.distancePointLine(h,l[v],l[v+1]);if(S<this._minDistance){this._minDistance=S;var R=new ne(l[v],l[v+1]).closestPoint(h);s[0]=new tn(n,v,R),s[1]=new tn(i,0,h)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof jt&&arguments[1]instanceof jt){var V=arguments[0],ot=arguments[1],St=arguments[2];if(V.getEnvelopeInternal().distance(ot.getEnvelopeInternal())>this._minDistance)return null;for(var bt=V.getCoordinates(),Yt=ot.getCoordinates(),Jt=0;Jt<bt.length-1;Jt++)for(var se=0;se<Yt.length-1;se++){var _e=rt.distanceLineLine(bt[Jt],bt[Jt+1],Yt[se],Yt[se+1]);if(_e<this._minDistance){this._minDistance=_e;var Cn=new ne(bt[Jt],bt[Jt+1]),Xn=new ne(Yt[se],Yt[se+1]),ui=Cn.closestPoints(Xn);St[0]=new tn(V,Jt,ui[0]),St[1]=new tn(ot,se,ui[1])}if(this._minDistance<=this._terminateDistance)return null}}}},Jn.prototype.computeMinDistancePoints=function(n,i,s){for(var l=0;l<n.size();l++)for(var h=n.get(l),v=0;v<i.size();v++){var S=i.get(v),R=h.getCoordinate().distance(S.getCoordinate());if(R<this._minDistance&&(this._minDistance=R,s[0]=new tn(h,0,h.getCoordinate()),s[1]=new tn(S,0,S.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},Jn.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new N("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},Jn.prototype.computeMinDistanceLines=function(n,i,s){for(var l=0;l<n.size();l++)for(var h=n.get(l),v=0;v<i.size();v++){var S=i.get(v);if(this.computeMinDistance(h,S,s),this._minDistance<=this._terminateDistance)return null}},Jn.prototype.interfaces_=function(){return[]},Jn.prototype.getClass=function(){return Jn},Jn.distance=function(n,i){return new Jn(n,i).distance()},Jn.isWithinDistance=function(n,i,s){return new Jn(n,i,s).distance()<=s},Jn.nearestPoints=function(n,i){return new Jn(n,i).nearestPoints()};var Lr=function(){this._pt=[new D,new D],this._distance=A.NaN,this._isNull=!0};Lr.prototype.getCoordinates=function(){return this._pt},Lr.prototype.getCoordinate=function(n){return this._pt[n]},Lr.prototype.setMinimum=function(){if(arguments.length===1){var n=arguments[0];this.setMinimum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var l=i.distance(s);l<this._distance&&this.initialize(i,s,l)}},Lr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=n.distance(i),this._isNull=!1}else if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(l),this._distance=h,this._isNull=!1}},Lr.prototype.toString=function(){return de.toLineString(this._pt[0],this._pt[1])},Lr.prototype.getDistance=function(){return this._distance},Lr.prototype.setMaximum=function(){if(arguments.length===1){var n=arguments[0];this.setMaximum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var l=i.distance(s);l>this._distance&&this.initialize(i,s,l)}},Lr.prototype.interfaces_=function(){return[]},Lr.prototype.getClass=function(){return Lr};var Lo=function(){};Lo.prototype.interfaces_=function(){return[]},Lo.prototype.getClass=function(){return Lo},Lo.computeDistance=function(){if(arguments[2]instanceof Lr&&arguments[0]instanceof jt&&arguments[1]instanceof D)for(var n=arguments[0],i=arguments[1],s=arguments[2],l=new ne,h=n.getCoordinates(),v=0;v<h.length-1;v++){l.setCoordinates(h[v],h[v+1]);var S=l.closestPoint(i);s.setMinimum(S,i)}else if(arguments[2]instanceof Lr&&arguments[0]instanceof pe&&arguments[1]instanceof D){var R=arguments[0],V=arguments[1],ot=arguments[2];Lo.computeDistance(R.getExteriorRing(),V,ot);for(var St=0;St<R.getNumInteriorRing();St++)Lo.computeDistance(R.getInteriorRingN(St),V,ot)}else if(arguments[2]instanceof Lr&&arguments[0]instanceof Ct&&arguments[1]instanceof D){var bt=arguments[0],Yt=arguments[1],Jt=arguments[2];if(bt instanceof jt)Lo.computeDistance(bt,Yt,Jt);else if(bt instanceof pe)Lo.computeDistance(bt,Yt,Jt);else if(bt instanceof Zn)for(var se=bt,_e=0;_e<se.getNumGeometries();_e++){var Cn=se.getGeometryN(_e);Lo.computeDistance(Cn,Yt,Jt)}else Jt.setMinimum(bt.getCoordinate(),Yt)}else if(arguments[2]instanceof Lr&&arguments[0]instanceof ne&&arguments[1]instanceof D){var Xn=arguments[0],ui=arguments[1],rs=arguments[2],Fs=Xn.closestPoint(ui);rs.setMinimum(Fs,ui)}};var ti=function(){this._g0=null,this._g1=null,this._ptDist=new Lr,this._densifyFrac=0;var n=arguments[0],i=arguments[1];this._g0=n,this._g1=i},iu={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};ti.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},ti.prototype.setDensifyFraction=function(n){if(n>1||n<=0)throw new N("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=n},ti.prototype.compute=function(n,i){this.computeOrientedDistance(n,i,this._ptDist),this.computeOrientedDistance(i,n,this._ptDist)},ti.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},ti.prototype.computeOrientedDistance=function(n,i,s){var l=new ys(i);if(n.apply(l),s.setMaximum(l.getMaxPointDistance()),this._densifyFrac>0){var h=new Ze(i,this._densifyFrac);n.apply(h),s.setMaximum(h.getMaxPointDistance())}},ti.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti},ti.distance=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new ti(n,i).distance()}if(arguments.length===3){var s=arguments[0],l=arguments[1],h=arguments[2],v=new ti(s,l);return v.setDensifyFraction(h),v.distance()}},iu.MaxPointDistanceFilter.get=function(){return ys},iu.MaxDensifiedByFractionDistanceFilter.get=function(){return Ze},Object.defineProperties(ti,iu);var ys=function(){this._maxPtDist=new Lr,this._minPtDist=new Lr,this._euclideanDist=new Lo,this._geom=null;var n=arguments[0];this._geom=n};ys.prototype.filter=function(n){this._minPtDist.initialize(),Lo.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ys.prototype.getMaxPointDistance=function(){return this._maxPtDist},ys.prototype.interfaces_=function(){return[tt]},ys.prototype.getClass=function(){return ys};var Ze=function(){this._maxPtDist=new Lr,this._minPtDist=new Lr,this._geom=null,this._numSubSegs=0;var n=arguments[0],i=arguments[1];this._geom=n,this._numSubSegs=Math.trunc(Math.round(1/i))};Ze.prototype.filter=function(n,i){if(i===0)return null;for(var s=n.getCoordinate(i-1),l=n.getCoordinate(i),h=(l.x-s.x)/this._numSubSegs,v=(l.y-s.y)/this._numSubSegs,S=0;S<this._numSubSegs;S++){var R=s.x+S*h,V=s.y+S*v,ot=new D(R,V);this._minPtDist.initialize(),Lo.computeDistance(this._geom,ot,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},Ze.prototype.isDone=function(){return!1},Ze.prototype.isGeometryChanged=function(){return!1},Ze.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ze.prototype.interfaces_=function(){return[lr]},Ze.prototype.getClass=function(){return Ze};var bi=function(n,i,s){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=n||null,this._bufDistance=i||null,this._result=s||null},xl={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};bi.prototype.checkMaximumDistance=function(n,i,s){var l=new ti(i,n);if(l.setDensifyFraction(.25),this._maxDistanceFound=l.orientedDistance(),this._maxDistanceFound>s){this._isValid=!1;var h=l.getCoordinates();this._errorLocation=h[1],this._errorIndicator=n.getFactory().createLineString(h),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+de.toLineString(h[0],h[1])+")"}},bi.prototype.isValid=function(){var n=Math.abs(this._bufDistance),i=bi.MAX_DISTANCE_DIFF_FRAC*n;return this._minValidDistance=n-i,this._maxValidDistance=n+i,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),bi.VERBOSE&&Qt.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},bi.prototype.checkNegativeValid=function(){if(!(this._input instanceof pe||this._input instanceof Bn||this._input instanceof Zn))return null;var n=this.getPolygonLines(this._input);if(this.checkMinimumDistance(n,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(n,this._result,this._maxValidDistance)},bi.prototype.getErrorIndicator=function(){return this._errorIndicator},bi.prototype.checkMinimumDistance=function(n,i,s){var l=new Jn(n,i,s);if(this._minDistanceFound=l.distance(),this._minDistanceFound<s){this._isValid=!1;var h=l.nearestPoints();this._errorLocation=l.nearestPoints()[1],this._errorIndicator=n.getFactory().createLineString(h),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+de.toLineString(h[0],h[1])+" )"}},bi.prototype.checkPositiveValid=function(){var n=this._result.getBoundary();if(this.checkMinimumDistance(this._input,n,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,n,this._maxValidDistance)},bi.prototype.getErrorLocation=function(){return this._errorLocation},bi.prototype.getPolygonLines=function(n){for(var i=new nt,s=new ve(i),l=re.getPolygons(n).iterator();l.hasNext();)l.next().apply(s);return n.getFactory().buildGeometry(i)},bi.prototype.getErrorMessage=function(){return this._errMsg},bi.prototype.interfaces_=function(){return[]},bi.prototype.getClass=function(){return bi},xl.VERBOSE.get=function(){return!1},xl.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(bi,xl);var Cr=function(n,i,s){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=n||null,this._distance=i||null,this._result=s||null},Lc={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Cr.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},Cr.prototype.checkEnvelope=function(){if(this._distance<0)return null;var n=this._distance*Cr.MAX_ENV_DIFF_FRAC;n===0&&(n=.001);var i=new Xt(this._input.getEnvelopeInternal());i.expandBy(this._distance);var s=new Xt(this._result.getEnvelopeInternal());s.expandBy(n),s.contains(i)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(s)),this.report("Envelope")},Cr.prototype.checkDistance=function(){var n=new bi(this._input,this._distance,this._result);n.isValid()||(this._isValid=!1,this._errorMsg=n.getErrorMessage(),this._errorLocation=n.getErrorLocation(),this._errorIndicator=n.getErrorIndicator()),this.report("Distance")},Cr.prototype.checkArea=function(){var n=this._input.getArea(),i=this._result.getArea();this._distance>0&&n>i&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&n<i&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},Cr.prototype.checkPolygonal=function(){this._result instanceof pe||this._result instanceof Bn||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Cr.prototype.getErrorIndicator=function(){return this._errorIndicator},Cr.prototype.getErrorLocation=function(){return this._errorLocation},Cr.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Cr.prototype.report=function(n){if(!Cr.VERBOSE)return null;Qt.out.println("Check "+n+": "+(this._isValid?"passed":"FAILED"))},Cr.prototype.getErrorMessage=function(){return this._errorMsg},Cr.prototype.interfaces_=function(){return[]},Cr.prototype.getClass=function(){return Cr},Cr.isValidMsg=function(n,i,s){var l=new Cr(n,i,s);return l.isValid()?null:l.getErrorMessage()},Cr.isValid=function(n,i,s){return!!new Cr(n,i,s).isValid()},Lc.VERBOSE.get=function(){return!1},Lc.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Cr,Lc);var No=function(){this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};No.prototype.getCoordinates=function(){return this._pts},No.prototype.size=function(){return this._pts.length},No.prototype.getCoordinate=function(n){return this._pts[n]},No.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},No.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:Zs.octant(this.getCoordinate(n),this.getCoordinate(n+1))},No.prototype.setData=function(n){this._data=n},No.prototype.getData=function(){return this._data},No.prototype.toString=function(){return de.toLineString(new De(this._pts))},No.prototype.interfaces_=function(){return[Co]},No.prototype.getClass=function(){return No};var Br=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new nt,this._intersectionCount=0,this._keepIntersections=!0;var n=arguments[0];this._li=n,this._interiorIntersection=null};Br.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Br.prototype.setCheckEndSegmentsOnly=function(n){this._isCheckEndSegmentsOnly=n},Br.prototype.getIntersectionSegments=function(){return this._intSegments},Br.prototype.count=function(){return this._intersectionCount},Br.prototype.getIntersections=function(){return this._intersections},Br.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Br.prototype.setKeepIntersections=function(n){this._keepIntersections=n},Br.prototype.processIntersections=function(n,i,s,l){if(!this._findAllIntersections&&this.hasIntersection()||n===s&&i===l||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(n,i)||this.isEndSegment(s,l)))return null;var h=n.getCoordinates()[i],v=n.getCoordinates()[i+1],S=s.getCoordinates()[l],R=s.getCoordinates()[l+1];this._li.computeIntersection(h,v,S,R),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=h,this._intSegments[1]=v,this._intSegments[2]=S,this._intSegments[3]=R,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Br.prototype.isEndSegment=function(n,i){return i===0||i>=n.size()-2},Br.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Br.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},Br.prototype.interfaces_=function(){return[Ls]},Br.prototype.getClass=function(){return Br},Br.createAllIntersectionsFinder=function(n){var i=new Br(n);return i.setFindAllIntersections(!0),i},Br.createAnyIntersectionFinder=function(n){return new Br(n)},Br.createIntersectionCounter=function(n){var i=new Br(n);return i.setFindAllIntersections(!0),i.setKeepIntersections(!1),i};var Ti=function(){this._li=new $n,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var n=arguments[0];this._segStrings=n};Ti.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},Ti.prototype.getIntersections=function(){return this._segInt.getIntersections()},Ti.prototype.isValid=function(){return this.execute(),this._isValid},Ti.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Ti.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Br(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var n=new zu;if(n.setSegmentIntersector(this._segInt),n.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Ti.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Zo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Ti.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var n=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+de.toLineString(n[0],n[1])+" and "+de.toLineString(n[2],n[3])},Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti},Ti.computeIntersections=function(n){var i=new Ti(n);return i.setFindAllIntersections(!0),i.isValid(),i.getIntersections()};var Vi=function n(){this._nv=null;var i=arguments[0];this._nv=new Ti(n.toSegmentStrings(i))};Vi.prototype.checkValid=function(){this._nv.checkValid()},Vi.prototype.interfaces_=function(){return[]},Vi.prototype.getClass=function(){return Vi},Vi.toSegmentStrings=function(n){for(var i=new nt,s=n.iterator();s.hasNext();){var l=s.next();i.add(new No(l.getCoordinates(),l))}return i},Vi.checkValid=function(n){new Vi(n).checkValid()};var vs=function(n){this._mapOp=n};vs.prototype.map=function(n){for(var i=new nt,s=0;s<n.getNumGeometries();s++){var l=this._mapOp.map(n.getGeometryN(s));l.isEmpty()||i.add(l)}return n.getFactory().createGeometryCollection(Ce.toGeometryArray(i))},vs.prototype.interfaces_=function(){return[]},vs.prototype.getClass=function(){return vs},vs.map=function(n,i){return new vs(i).map(n)};var ho=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new nt,this._resultLineList=new nt;var n=arguments[0],i=arguments[1],s=arguments[2];this._op=n,this._geometryFactory=i,this._ptLocator=s};ho.prototype.collectLines=function(n){for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next();this.collectLineEdge(s,n,this._lineEdgesList),this.collectBoundaryTouchEdge(s,n,this._lineEdgesList)}},ho.prototype.labelIsolatedLine=function(n,i){var s=this._ptLocator.locate(n.getCoordinate(),this._op.getArgGeometry(i));n.getLabel().setLocation(i,s)},ho.prototype.build=function(n){return this.findCoveredLineEdges(),this.collectLines(n),this.buildLines(n),this._resultLineList},ho.prototype.collectLineEdge=function(n,i,s){var l=n.getLabel(),h=n.getEdge();n.isLineEdge()&&(n.isVisited()||!Ae.isResultOfOp(l,i)||h.isCovered()||(s.add(h),n.setVisitedEdge(!0)))},ho.prototype.findCoveredLineEdges=function(){for(var n=this._op.getGraph().getNodes().iterator();n.hasNext();)n.next().getEdges().findCoveredLineEdges();for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next(),l=s.getEdge();if(s.isLineEdge()&&!l.isCoveredSet()){var h=this._op.isCoveredByA(s.getCoordinate());l.setCovered(h)}}},ho.prototype.labelIsolatedLines=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),l=s.getLabel();s.isIsolated()&&(l.isNull(0)?this.labelIsolatedLine(s,0):this.labelIsolatedLine(s,1))}},ho.prototype.buildLines=function(n){for(var i=this._lineEdgesList.iterator();i.hasNext();){var s=i.next(),l=this._geometryFactory.createLineString(s.getCoordinates());this._resultLineList.add(l),s.setInResult(!0)}},ho.prototype.collectBoundaryTouchEdge=function(n,i,s){var l=n.getLabel();return n.isLineEdge()||n.isVisited()||n.isInteriorAreaEdge()||n.getEdge().isInResult()?null:(kt.isTrue(!(n.isInResult()||n.getSym().isInResult())||!n.getEdge().isInResult()),void(Ae.isResultOfOp(l,i)&&i===Ae.INTERSECTION&&(s.add(n.getEdge()),n.setVisitedEdge(!0))))},ho.prototype.interfaces_=function(){return[]},ho.prototype.getClass=function(){return ho};var _s=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new nt;var n=arguments[0],i=arguments[1];this._op=n,this._geometryFactory=i};_s.prototype.filterCoveredNodeToPoint=function(n){var i=n.getCoordinate();if(!this._op.isCoveredByLA(i)){var s=this._geometryFactory.createPoint(i);this._resultPointList.add(s)}},_s.prototype.extractNonCoveredResultNodes=function(n){for(var i=this._op.getGraph().getNodes().iterator();i.hasNext();){var s=i.next();if(!s.isInResult()&&!s.isIncidentEdgeInResult()&&(s.getEdges().getDegree()===0||n===Ae.INTERSECTION)){var l=s.getLabel();Ae.isResultOfOp(l,n)&&this.filterCoveredNodeToPoint(s)}}},_s.prototype.build=function(n){return this.extractNonCoveredResultNodes(n),this._resultPointList},_s.prototype.interfaces_=function(){return[]},_s.prototype.getClass=function(){return _s};var si=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};si.prototype.transformPoint=function(n,i){return this._factory.createPoint(this.transformCoordinates(n.getCoordinateSequence(),n))},si.prototype.transformPolygon=function(n,i){var s=!0,l=this.transformLinearRing(n.getExteriorRing(),n);l!==null&&l instanceof Tn&&!l.isEmpty()||(s=!1);for(var h=new nt,v=0;v<n.getNumInteriorRing();v++){var S=this.transformLinearRing(n.getInteriorRingN(v),n);S===null||S.isEmpty()||(S instanceof Tn||(s=!1),h.add(S))}if(s)return this._factory.createPolygon(l,h.toArray([]));var R=new nt;return l!==null&&R.add(l),R.addAll(h),this._factory.buildGeometry(R)},si.prototype.createCoordinateSequence=function(n){return this._factory.getCoordinateSequenceFactory().create(n)},si.prototype.getInputGeometry=function(){return this._inputGeom},si.prototype.transformMultiLineString=function(n,i){for(var s=new nt,l=0;l<n.getNumGeometries();l++){var h=this.transformLineString(n.getGeometryN(l),n);h!==null&&(h.isEmpty()||s.add(h))}return this._factory.buildGeometry(s)},si.prototype.transformCoordinates=function(n,i){return this.copy(n)},si.prototype.transformLineString=function(n,i){return this._factory.createLineString(this.transformCoordinates(n.getCoordinateSequence(),n))},si.prototype.transformMultiPoint=function(n,i){for(var s=new nt,l=0;l<n.getNumGeometries();l++){var h=this.transformPoint(n.getGeometryN(l),n);h!==null&&(h.isEmpty()||s.add(h))}return this._factory.buildGeometry(s)},si.prototype.transformMultiPolygon=function(n,i){for(var s=new nt,l=0;l<n.getNumGeometries();l++){var h=this.transformPolygon(n.getGeometryN(l),n);h!==null&&(h.isEmpty()||s.add(h))}return this._factory.buildGeometry(s)},si.prototype.copy=function(n){return n.copy()},si.prototype.transformGeometryCollection=function(n,i){for(var s=new nt,l=0;l<n.getNumGeometries();l++){var h=this.transform(n.getGeometryN(l));h!==null&&(this._pruneEmptyGeometry&&h.isEmpty()||s.add(h))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Ce.toGeometryArray(s)):this._factory.buildGeometry(s)},si.prototype.transform=function(n){if(this._inputGeom=n,this._factory=n.getFactory(),n instanceof ge)return this.transformPoint(n,null);if(n instanceof Oe)return this.transformMultiPoint(n,null);if(n instanceof Tn)return this.transformLinearRing(n,null);if(n instanceof jt)return this.transformLineString(n,null);if(n instanceof K)return this.transformMultiLineString(n,null);if(n instanceof pe)return this.transformPolygon(n,null);if(n instanceof Bn)return this.transformMultiPolygon(n,null);if(n instanceof Zn)return this.transformGeometryCollection(n,null);throw new N("Unknown Geometry subtype: "+n.getClass().getName())},si.prototype.transformLinearRing=function(n,i){var s=this.transformCoordinates(n.getCoordinateSequence(),n);if(s===null)return this._factory.createLinearRing(null);var l=s.size();return l>0&&l<4&&!this._preserveType?this._factory.createLineString(s):this._factory.createLinearRing(s)},si.prototype.interfaces_=function(){return[]},si.prototype.getClass=function(){return si};var Oo=function n(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new ne,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof jt&&typeof arguments[1]=="number"){var i=arguments[0],s=arguments[1];n.call(this,i.getCoordinates(),s)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var l=arguments[0],h=arguments[1];this._srcPts=l,this._isClosed=n.isClosed(l),this._snapTolerance=h}};Oo.prototype.snapVertices=function(n,i){for(var s=this._isClosed?n.size()-1:n.size(),l=0;l<s;l++){var h=n.get(l),v=this.findSnapForVertex(h,i);v!==null&&(n.set(l,new D(v)),l===0&&this._isClosed&&n.set(n.size()-1,new D(v)))}},Oo.prototype.findSnapForVertex=function(n,i){for(var s=0;s<i.length;s++){if(n.equals2D(i[s]))return null;if(n.distance(i[s])<this._snapTolerance)return i[s]}return null},Oo.prototype.snapTo=function(n){var i=new dt(this._srcPts);return this.snapVertices(i,n),this.snapSegments(i,n),i.toCoordinateArray()},Oo.prototype.snapSegments=function(n,i){if(i.length===0)return null;var s=i.length;i[0].equals2D(i[i.length-1])&&(s=i.length-1);for(var l=0;l<s;l++){var h=i[l],v=this.findSegmentIndexToSnap(h,n);v>=0&&n.add(v+1,new D(h),!1)}},Oo.prototype.findSegmentIndexToSnap=function(n,i){for(var s=A.MAX_VALUE,l=-1,h=0;h<i.size()-1;h++){if(this._seg.p0=i.get(h),this._seg.p1=i.get(h+1),this._seg.p0.equals2D(n)||this._seg.p1.equals2D(n)){if(this._allowSnappingToSourceVertices)continue;return-1}var v=this._seg.distance(n);v<this._snapTolerance&&v<s&&(s=v,l=h)}return l},Oo.prototype.setAllowSnappingToSourceVertices=function(n){this._allowSnappingToSourceVertices=n},Oo.prototype.interfaces_=function(){return[]},Oo.prototype.getClass=function(){return Oo},Oo.isClosed=function(n){return!(n.length<=1)&&n[0].equals2D(n[n.length-1])};var sr=function(n){this._srcGeom=n||null},Nc={SNAP_PRECISION_FACTOR:{configurable:!0}};sr.prototype.snapTo=function(n,i){var s=this.extractTargetCoordinates(n);return new ou(i,s).transform(this._srcGeom)},sr.prototype.snapToSelf=function(n,i){var s=this.extractTargetCoordinates(this._srcGeom),l=new ou(n,s,!0).transform(this._srcGeom),h=l;return i&&et(h,Ne)&&(h=l.buffer(0)),h},sr.prototype.computeSnapTolerance=function(n){return this.computeMinimumSegmentLength(n)/10},sr.prototype.extractTargetCoordinates=function(n){for(var i=new b,s=n.getCoordinates(),l=0;l<s.length;l++)i.add(s[l]);return i.toArray(new Array(0).fill(null))},sr.prototype.computeMinimumSegmentLength=function(n){for(var i=A.MAX_VALUE,s=0;s<n.length-1;s++){var l=n[s].distance(n[s+1]);l<i&&(i=l)}return i},sr.prototype.interfaces_=function(){return[]},sr.prototype.getClass=function(){return sr},sr.snap=function(n,i,s){var l=new Array(2).fill(null),h=new sr(n);l[0]=h.snapTo(i,s);var v=new sr(i);return l[1]=v.snapTo(l[0],s),l},sr.computeOverlaySnapTolerance=function(){if(arguments.length===1){var n=arguments[0],i=sr.computeSizeBasedSnapTolerance(n),s=n.getPrecisionModel();if(s.getType()===Se.FIXED){var l=1/s.getScale()*2/1.415;l>i&&(i=l)}return i}if(arguments.length===2){var h=arguments[0],v=arguments[1];return Math.min(sr.computeOverlaySnapTolerance(h),sr.computeOverlaySnapTolerance(v))}},sr.computeSizeBasedSnapTolerance=function(n){var i=n.getEnvelopeInternal();return Math.min(i.getHeight(),i.getWidth())*sr.SNAP_PRECISION_FACTOR},sr.snapToSelf=function(n,i,s){return new sr(n).snapToSelf(i,s)},Nc.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(sr,Nc);var ou=function(n){function i(s,l,h){n.call(this),this._snapTolerance=s||null,this._snapPts=l||null,this._isSelfSnap=h!==void 0&&h}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.snapLine=function(s,l){var h=new Oo(s,this._snapTolerance);return h.setAllowSnappingToSourceVertices(this._isSelfSnap),h.snapTo(l)},i.prototype.transformCoordinates=function(s,l){var h=s.toCoordinateArray(),v=this.snapLine(h,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(v)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(si),Sr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Sr.prototype.getCommon=function(){return A.longBitsToDouble(this._commonBits)},Sr.prototype.add=function(n){var i=A.doubleToLongBits(n);if(this._isFirst)return this._commonBits=i,this._commonSignExp=Sr.signExpBits(this._commonBits),this._isFirst=!1,null;if(Sr.signExpBits(i)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Sr.numCommonMostSigMantissaBits(this._commonBits,i),this._commonBits=Sr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Sr.prototype.toString=function(){if(arguments.length===1){var n=arguments[0],i=A.longBitsToDouble(n),s="0000000000000000000000000000000000000000000000000000000000000000"+A.toBinaryString(n),l=s.substring(s.length-64);return l.substring(0,1)+" "+l.substring(1,12)+"(exp) "+l.substring(12)+" [ "+i+" ]"}},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},Sr.getBit=function(n,i){return n&1<<i?1:0},Sr.signExpBits=function(n){return n>>52},Sr.zeroLowerBits=function(n,i){return n&~((1<<i)-1)},Sr.numCommonMostSigMantissaBits=function(n,i){for(var s=0,l=52;l>=0;l--){if(Sr.getBit(n,l)!==Sr.getBit(i,l))return s;s++}return 52};var Do=function(){this._commonCoord=null,this._ccFilter=new Ta},Oc={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Do.prototype.addCommonBits=function(n){var i=new Os(this._commonCoord);n.apply(i),n.geometryChanged()},Do.prototype.removeCommonBits=function(n){if(this._commonCoord.x===0&&this._commonCoord.y===0)return n;var i=new D(this._commonCoord);i.x=-i.x,i.y=-i.y;var s=new Os(i);return n.apply(s),n.geometryChanged(),n},Do.prototype.getCommonCoordinate=function(){return this._commonCoord},Do.prototype.add=function(n){n.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Do.prototype.interfaces_=function(){return[]},Do.prototype.getClass=function(){return Do},Oc.CommonCoordinateFilter.get=function(){return Ta},Oc.Translater.get=function(){return Os},Object.defineProperties(Do,Oc);var Ta=function(){this._commonBitsX=new Sr,this._commonBitsY=new Sr};Ta.prototype.filter=function(n){this._commonBitsX.add(n.x),this._commonBitsY.add(n.y)},Ta.prototype.getCommonCoordinate=function(){return new D(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Ta.prototype.interfaces_=function(){return[tt]},Ta.prototype.getClass=function(){return Ta};var Os=function(){this.trans=null;var n=arguments[0];this.trans=n};Os.prototype.filter=function(n,i){var s=n.getOrdinate(i,0)+this.trans.x,l=n.getOrdinate(i,1)+this.trans.y;n.setOrdinate(i,0,s),n.setOrdinate(i,1,l)},Os.prototype.isDone=function(){return!1},Os.prototype.isGeometryChanged=function(){return!0},Os.prototype.interfaces_=function(){return[lr]},Os.prototype.getClass=function(){return Os};var br=function(n,i){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=n,this._geom[1]=i,this.computeSnapTolerance()};br.prototype.selfSnap=function(n){return new sr(n).snapTo(n,this._snapTolerance)},br.prototype.removeCommonBits=function(n){this._cbr=new Do,this._cbr.add(n[0]),this._cbr.add(n[1]);var i=new Array(2).fill(null);return i[0]=this._cbr.removeCommonBits(n[0].copy()),i[1]=this._cbr.removeCommonBits(n[1].copy()),i},br.prototype.prepareResult=function(n){return this._cbr.addCommonBits(n),n},br.prototype.getResultGeometry=function(n){var i=this.snap(this._geom),s=Ae.overlayOp(i[0],i[1],n);return this.prepareResult(s)},br.prototype.checkValid=function(n){n.isValid()||Qt.out.println("Snapped geometry is invalid")},br.prototype.computeSnapTolerance=function(){this._snapTolerance=sr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},br.prototype.snap=function(n){var i=this.removeCommonBits(n);return sr.snap(i[0],i[1],this._snapTolerance)},br.prototype.interfaces_=function(){return[]},br.prototype.getClass=function(){return br},br.overlayOp=function(n,i,s){return new br(n,i).getResultGeometry(s)},br.union=function(n,i){return br.overlayOp(n,i,Ae.UNION)},br.intersection=function(n,i){return br.overlayOp(n,i,Ae.INTERSECTION)},br.symDifference=function(n,i){return br.overlayOp(n,i,Ae.SYMDIFFERENCE)},br.difference=function(n,i){return br.overlayOp(n,i,Ae.DIFFERENCE)};var zr=function(n,i){this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i};zr.prototype.getResultGeometry=function(n){var i=null,s=!1,l=null;try{i=Ae.overlayOp(this._geom[0],this._geom[1],n),s=!0}catch(h){if(!(h instanceof Ue))throw h;l=h}if(!s)try{i=br.overlayOp(this._geom[0],this._geom[1],n)}catch(h){throw h instanceof Ue?l:h}return i},zr.prototype.interfaces_=function(){return[]},zr.prototype.getClass=function(){return zr},zr.overlayOp=function(n,i,s){return new zr(n,i).getResultGeometry(s)},zr.union=function(n,i){return zr.overlayOp(n,i,Ae.UNION)},zr.intersection=function(n,i){return zr.overlayOp(n,i,Ae.INTERSECTION)},zr.symDifference=function(n,i){return zr.overlayOp(n,i,Ae.SYMDIFFERENCE)},zr.difference=function(n,i){return zr.overlayOp(n,i,Ae.DIFFERENCE)};var Aa=function(){this.mce=null,this.chainIndex=null;var n=arguments[0],i=arguments[1];this.mce=n,this.chainIndex=i};Aa.prototype.computeIntersections=function(n,i){this.mce.computeIntersectsForChain(this.chainIndex,n.mce,n.chainIndex,i)},Aa.prototype.interfaces_=function(){return[]},Aa.prototype.getClass=function(){return Aa};var Ai=function n(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var i=arguments[0],s=arguments[1];this._eventType=n.DELETE,this._xValue=i,this._insertEvent=s}else if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2];this._eventType=n.INSERT,this._label=l,this._xValue=h,this._obj=v}},El={INSERT:{configurable:!0},DELETE:{configurable:!0}};Ai.prototype.isDelete=function(){return this._eventType===Ai.DELETE},Ai.prototype.setDeleteEventIndex=function(n){this._deleteEventIndex=n},Ai.prototype.getObject=function(){return this._obj},Ai.prototype.compareTo=function(n){var i=n;return this._xValue<i._xValue?-1:this._xValue>i._xValue?1:this._eventType<i._eventType?-1:this._eventType>i._eventType?1:0},Ai.prototype.getInsertEvent=function(){return this._insertEvent},Ai.prototype.isInsert=function(){return this._eventType===Ai.INSERT},Ai.prototype.isSameLabel=function(n){return this._label!==null&&this._label===n._label},Ai.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Ai.prototype.interfaces_=function(){return[z]},Ai.prototype.getClass=function(){return Ai},El.INSERT.get=function(){return 1},El.DELETE.get=function(){return 2},Object.defineProperties(Ai,El);var wl=function(){};wl.prototype.interfaces_=function(){return[]},wl.prototype.getClass=function(){return wl};var Yr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var n=arguments[0],i=arguments[1],s=arguments[2];this._li=n,this._includeProper=i,this._recordIsolated=s};Yr.prototype.isTrivialIntersection=function(n,i,s,l){if(n===s&&this._li.getIntersectionNum()===1){if(Yr.isAdjacentSegments(i,l))return!0;if(n.isClosed()){var h=n.getNumPoints()-1;if(i===0&&l===h||l===0&&i===h)return!0}}return!1},Yr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Yr.prototype.setIsDoneIfProperInt=function(n){this._isDoneWhenProperInt=n},Yr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Yr.prototype.isBoundaryPointInternal=function(n,i){for(var s=i.iterator();s.hasNext();){var l=s.next().getCoordinate();if(n.isIntersection(l))return!0}return!1},Yr.prototype.hasProperIntersection=function(){return this._hasProper},Yr.prototype.hasIntersection=function(){return this._hasIntersection},Yr.prototype.isDone=function(){return this._isDone},Yr.prototype.isBoundaryPoint=function(n,i){return i!==null&&(!!this.isBoundaryPointInternal(n,i[0])||!!this.isBoundaryPointInternal(n,i[1]))},Yr.prototype.setBoundaryNodes=function(n,i){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=n,this._bdyNodes[1]=i},Yr.prototype.addIntersections=function(n,i,s,l){if(n===s&&i===l)return null;this.numTests++;var h=n.getCoordinates()[i],v=n.getCoordinates()[i+1],S=s.getCoordinates()[l],R=s.getCoordinates()[l+1];this._li.computeIntersection(h,v,S,R),this._li.hasIntersection()&&(this._recordIsolated&&(n.setIsolated(!1),s.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(n,i,s,l)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(n.addIntersections(this._li,i,0),s.addIntersections(this._li,l,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr},Yr.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var ei=function(n){function i(){n.call(this),this.events=new nt,this.nOverlaps=null}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.prepareEvents=function(){uo.sort(this.events);for(var s=0;s<this.events.size();s++){var l=this.events.get(s);l.isDelete()&&l.getInsertEvent().setDeleteEventIndex(s)}},i.prototype.computeIntersections=function(){if(arguments.length===1){var s=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var l=0;l<this.events.size();l++){var h=this.events.get(l);if(h.isInsert()&&this.processOverlaps(l,h.getDeleteEventIndex(),h,s),s.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof Yr&&et(arguments[0],ut)&&et(arguments[1],ut)){var v=arguments[0],S=arguments[1],R=arguments[2];this.addEdges(v,v),this.addEdges(S,S),this.computeIntersections(R)}else if(typeof arguments[2]=="boolean"&&et(arguments[0],ut)&&arguments[1]instanceof Yr){var V=arguments[0],ot=arguments[1];arguments[2]?this.addEdges(V,null):this.addEdges(V),this.computeIntersections(ot)}}},i.prototype.addEdge=function(s,l){for(var h=s.getMonotoneChainEdge(),v=h.getStartIndexes(),S=0;S<v.length-1;S++){var R=new Aa(h,S),V=new Ai(l,h.getMinX(S),R);this.events.add(V),this.events.add(new Ai(h.getMaxX(S),V))}},i.prototype.processOverlaps=function(s,l,h,v){for(var S=h.getObject(),R=s;R<l;R++){var V=this.events.get(R);if(V.isInsert()){var ot=V.getObject();h.isSameLabel(V)||(S.computeIntersections(ot,v),this.nOverlaps++)}}},i.prototype.addEdges=function(){if(arguments.length===1)for(var s=arguments[0].iterator();s.hasNext();){var l=s.next();this.addEdge(l,l)}else if(arguments.length===2)for(var h=arguments[0],v=arguments[1],S=h.iterator();S.hasNext();){var R=S.next();this.addEdge(R,v)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(wl),mr=function(){this._min=A.POSITIVE_INFINITY,this._max=A.NEGATIVE_INFINITY},Bf={NodeComparator:{configurable:!0}};mr.prototype.getMin=function(){return this._min},mr.prototype.intersects=function(n,i){return!(this._min>i||this._max<n)},mr.prototype.getMax=function(){return this._max},mr.prototype.toString=function(){return de.toLineString(new D(this._min,0),new D(this._max,0))},mr.prototype.interfaces_=function(){return[]},mr.prototype.getClass=function(){return mr},Bf.NodeComparator.get=function(){return ku},Object.defineProperties(mr,Bf);var ku=function(){};ku.prototype.compare=function(n,i){var s=n,l=i,h=(s._min+s._max)/2,v=(l._min+l._max)/2;return h<v?-1:h>v?1:0},ku.prototype.interfaces_=function(){return[q]},ku.prototype.getClass=function(){return ku};var zf=function(n){function i(){n.call(this),this._item=null;var s=arguments[0],l=arguments[1],h=arguments[2];this._min=s,this._max=l,this._item=h}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.query=function(s,l,h){if(!this.intersects(s,l))return null;h.visitItem(this._item)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(mr),id=function(n){function i(){n.call(this),this._node1=null,this._node2=null;var s=arguments[0],l=arguments[1];this._node1=s,this._node2=l,this.buildExtent(this._node1,this._node2)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildExtent=function(s,l){this._min=Math.min(s._min,l._min),this._max=Math.max(s._max,l._max)},i.prototype.query=function(s,l,h){if(!this.intersects(s,l))return null;this._node1!==null&&this._node1.query(s,l,h),this._node2!==null&&this._node2.query(s,l,h)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(mr),po=function(){this._leaves=new nt,this._root=null,this._level=0};po.prototype.buildTree=function(){uo.sort(this._leaves,new mr.NodeComparator);for(var n=this._leaves,i=null,s=new nt;;){if(this.buildLevel(n,s),s.size()===1)return s.get(0);i=n,n=s,s=i}},po.prototype.insert=function(n,i,s){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new zf(n,i,s))},po.prototype.query=function(n,i,s){this.init(),this._root.query(n,i,s)},po.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},po.prototype.printNode=function(n){Qt.out.println(de.toLineString(new D(n._min,this._level),new D(n._max,this._level)))},po.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},po.prototype.buildLevel=function(n,i){this._level++,i.clear();for(var s=0;s<n.size();s+=2){var l=n.get(s);if((s+1<n.size()?n.get(s):null)===null)i.add(l);else{var h=new id(n.get(s),n.get(s+1));i.add(h)}}},po.prototype.interfaces_=function(){return[]},po.prototype.getClass=function(){return po};var xs=function(){this._items=new nt};xs.prototype.visitItem=function(n){this._items.add(n)},xs.prototype.getItems=function(){return this._items},xs.prototype.interfaces_=function(){return[Rs]},xs.prototype.getClass=function(){return xs};var ea=function(){this._index=null;var n=arguments[0];if(!et(n,Ne))throw new N("Argument must be Polygonal");this._index=new Fo(n)},na={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};ea.prototype.locate=function(n){var i=new H(n),s=new Es(i);return this._index.query(n.y,n.y,s),i.getLocation()},ea.prototype.interfaces_=function(){return[eu]},ea.prototype.getClass=function(){return ea},na.SegmentVisitor.get=function(){return Es},na.IntervalIndexedGeometry.get=function(){return Fo},Object.defineProperties(ea,na);var Es=function(){this._counter=null;var n=arguments[0];this._counter=n};Es.prototype.visitItem=function(n){var i=n;this._counter.countSegment(i.getCoordinate(0),i.getCoordinate(1))},Es.prototype.interfaces_=function(){return[Rs]},Es.prototype.getClass=function(){return Es};var Fo=function(){this._index=new po;var n=arguments[0];this.init(n)};Fo.prototype.init=function(n){for(var i=ve.getLines(n).iterator();i.hasNext();){var s=i.next().getCoordinates();this.addLine(s)}},Fo.prototype.addLine=function(n){for(var i=1;i<n.length;i++){var s=new ne(n[i-1],n[i]),l=Math.min(s.p0.y,s.p1.y),h=Math.max(s.p0.y,s.p1.y);this._index.insert(l,h,s)}},Fo.prototype.query=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new xs;return this._index.query(n,i,s),s.getItems()}if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2];this._index.query(l,h,v)}},Fo.prototype.interfaces_=function(){return[]},Fo.prototype.getClass=function(){return Fo};var ra=function(n){function i(){if(n.call(this),this._parentGeom=null,this._lineEdgeMap=new Ka,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Be,arguments.length===2){var s=arguments[0],l=arguments[1],h=C.OGC_SFS_BOUNDARY_RULE;this._argIndex=s,this._parentGeom=l,this._boundaryNodeRule=h,l!==null&&this.add(l)}else if(arguments.length===3){var v=arguments[0],S=arguments[1],R=arguments[2];this._argIndex=v,this._parentGeom=S,this._boundaryNodeRule=R,S!==null&&this.add(S)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertBoundaryPoint=function(s,l){var h=this._nodes.addNode(l).getLabel(),v=1;Z.NONE,h.getLocation(s,Ht.ON)===Z.BOUNDARY&&v++;var S=i.determineBoundary(this._boundaryNodeRule,v);h.setLocation(s,S)},i.prototype.computeSelfNodes=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return this.computeSelfNodes(s,l,!1)}if(arguments.length===3){var h=arguments[0],v=arguments[1],S=arguments[2],R=new Yr(h,!0,!1);R.setIsDoneIfProperInt(S);var V=this.createEdgeSetIntersector(),ot=this._parentGeom instanceof Tn||this._parentGeom instanceof pe||this._parentGeom instanceof Bn,St=v||!ot;return V.computeIntersections(this._edges,R,St),this.addSelfIntersectionNodes(this._argIndex),R}},i.prototype.computeSplitEdges=function(s){for(var l=this._edges.iterator();l.hasNext();)l.next().eiList.addSplitEdges(s)},i.prototype.computeEdgeIntersections=function(s,l,h){var v=new Yr(l,h,!0);return v.setBoundaryNodes(this.getBoundaryNodes(),s.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,s._edges,v),v},i.prototype.getGeometry=function(){return this._parentGeom},i.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},i.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},i.prototype.addPoint=function(){if(arguments[0]instanceof ge){var s=arguments[0].getCoordinate();this.insertPoint(this._argIndex,s,Z.INTERIOR)}else if(arguments[0]instanceof D){var l=arguments[0];this.insertPoint(this._argIndex,l,Z.INTERIOR)}},i.prototype.addPolygon=function(s){this.addPolygonRing(s.getExteriorRing(),Z.EXTERIOR,Z.INTERIOR);for(var l=0;l<s.getNumInteriorRing();l++){var h=s.getInteriorRingN(l);this.addPolygonRing(h,Z.INTERIOR,Z.EXTERIOR)}},i.prototype.addEdge=function(s){this.insertEdge(s);var l=s.getCoordinates();this.insertPoint(this._argIndex,l[0],Z.BOUNDARY),this.insertPoint(this._argIndex,l[l.length-1],Z.BOUNDARY)},i.prototype.addLineString=function(s){var l=at.removeRepeatedPoints(s.getCoordinates());if(l.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=l[0],null;var h=new _l(l,new An(this._argIndex,Z.INTERIOR));this._lineEdgeMap.put(s,h),this.insertEdge(h),kt.isTrue(l.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,l[0]),this.insertBoundaryPoint(this._argIndex,l[l.length-1])},i.prototype.getInvalidPoint=function(){return this._invalidPoint},i.prototype.getBoundaryPoints=function(){for(var s=this.getBoundaryNodes(),l=new Array(s.size()).fill(null),h=0,v=s.iterator();v.hasNext();){var S=v.next();l[h++]=S.getCoordinate().copy()}return l},i.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},i.prototype.addSelfIntersectionNode=function(s,l,h){if(this.isBoundaryNode(s,l))return null;h===Z.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(s,l):this.insertPoint(s,l,h)},i.prototype.addPolygonRing=function(s,l,h){if(s.isEmpty())return null;var v=at.removeRepeatedPoints(s.getCoordinates());if(v.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=v[0],null;var S=l,R=h;rt.isCCW(v)&&(S=h,R=l);var V=new _l(v,new An(this._argIndex,Z.BOUNDARY,S,R));this._lineEdgeMap.put(s,V),this.insertEdge(V),this.insertPoint(this._argIndex,v[0],Z.BOUNDARY)},i.prototype.insertPoint=function(s,l,h){var v=this._nodes.addNode(l),S=v.getLabel();S===null?v._label=new An(s,h):S.setLocation(s,h)},i.prototype.createEdgeSetIntersector=function(){return new ei},i.prototype.addSelfIntersectionNodes=function(s){for(var l=this._edges.iterator();l.hasNext();)for(var h=l.next(),v=h.getLabel().getLocation(s),S=h.eiList.iterator();S.hasNext();){var R=S.next();this.addSelfIntersectionNode(s,R.coord,v)}},i.prototype.add=function(){if(arguments.length!==1)return n.prototype.add.apply(this,arguments);var s=arguments[0];if(s.isEmpty())return null;if(s instanceof Bn&&(this._useBoundaryDeterminationRule=!1),s instanceof pe)this.addPolygon(s);else if(s instanceof jt)this.addLineString(s);else if(s instanceof ge)this.addPoint(s);else if(s instanceof Oe)this.addCollection(s);else if(s instanceof K)this.addCollection(s);else if(s instanceof Bn)this.addCollection(s);else{if(!(s instanceof Zn))throw new Error(s.getClass().getName());this.addCollection(s)}},i.prototype.addCollection=function(s){for(var l=0;l<s.getNumGeometries();l++){var h=s.getGeometryN(l);this.add(h)}},i.prototype.locate=function(s){return et(this._parentGeom,Ne)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new ea(this._parentGeom)),this._areaPtLocator.locate(s)):this._ptLocator.locate(s,this._parentGeom)},i.prototype.findEdge=function(){if(arguments.length===1){var s=arguments[0];return this._lineEdgeMap.get(s)}return n.prototype.findEdge.apply(this,arguments)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.determineBoundary=function(s,l){return s.isInBoundary(l)?Z.BOUNDARY:Z.INTERIOR},i}(cr),ns=function(){if(this._li=new $n,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var n=arguments[0];this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new ra(0,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],l=C.OGC_SFS_BOUNDARY_RULE;i.getPrecisionModel().compareTo(s.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(s.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ra(0,i,l),this._arg[1]=new ra(1,s,l)}else if(arguments.length===3){var h=arguments[0],v=arguments[1],S=arguments[2];h.getPrecisionModel().compareTo(v.getPrecisionModel())>=0?this.setComputationPrecision(h.getPrecisionModel()):this.setComputationPrecision(v.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ra(0,h,S),this._arg[1]=new ra(1,v,S)}};ns.prototype.getArgGeometry=function(n){return this._arg[n].getGeometry()},ns.prototype.setComputationPrecision=function(n){this._resultPrecisionModel=n,this._li.setPrecisionModel(this._resultPrecisionModel)},ns.prototype.interfaces_=function(){return[]},ns.prototype.getClass=function(){return ns};var ia=function(){};ia.prototype.interfaces_=function(){return[]},ia.prototype.getClass=function(){return ia},ia.map=function(){if(arguments[0]instanceof Ct&&et(arguments[1],ia.MapOp)){for(var n=arguments[0],i=arguments[1],s=new nt,l=0;l<n.getNumGeometries();l++){var h=i.map(n.getGeometryN(l));h!==null&&s.add(h)}return n.getFactory().buildGeometry(s)}if(et(arguments[0],st)&&et(arguments[1],ia.MapOp)){for(var v=arguments[0],S=arguments[1],R=new nt,V=v.iterator();V.hasNext();){var ot=V.next(),St=S.map(ot);St!==null&&R.add(St)}return R}},ia.MapOp=function(){};var Ae=function(n){function i(){var s=arguments[0],l=arguments[1];n.call(this,s,l),this._ptLocator=new Be,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new di,this._resultPolyList=new nt,this._resultLineList=new nt,this._resultPointList=new nt,this._graph=new cr(new ji),this._geomFact=s.getFactory()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertUniqueEdge=function(s){var l=this._edgeList.findEqualEdge(s);if(l!==null){var h=l.getLabel(),v=s.getLabel();l.isPointwiseEqual(s)||(v=new An(s.getLabel())).flip();var S=l.getDepth();S.isNull()&&S.add(h),S.add(v),h.merge(v)}else this._edgeList.add(s)},i.prototype.getGraph=function(){return this._graph},i.prototype.cancelDuplicateResultEdges=function(){for(var s=this._graph.getEdgeEnds().iterator();s.hasNext();){var l=s.next(),h=l.getSym();l.isInResult()&&h.isInResult()&&(l.setInResult(!1),h.setInResult(!1))}},i.prototype.isCoveredByLA=function(s){return!!this.isCovered(s,this._resultLineList)||!!this.isCovered(s,this._resultPolyList)},i.prototype.computeGeometry=function(s,l,h,v){var S=new nt;return S.addAll(s),S.addAll(l),S.addAll(h),S.isEmpty()?i.createEmptyResult(v,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(S)},i.prototype.mergeSymLabels=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().mergeSymLabels()},i.prototype.isCovered=function(s,l){for(var h=l.iterator();h.hasNext();){var v=h.next();if(this._ptLocator.locate(s,v)!==Z.EXTERIOR)return!0}return!1},i.prototype.replaceCollapsedEdges=function(){for(var s=new nt,l=this._edgeList.iterator();l.hasNext();){var h=l.next();h.isCollapsed()&&(l.remove(),s.add(h.getCollapsedEdge()))}this._edgeList.addAll(s)},i.prototype.updateNodeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var l=s.next(),h=l.getEdges().getLabel();l.getLabel().merge(h)}},i.prototype.getResultGeometry=function(s){return this.computeOverlay(s),this._resultGeom},i.prototype.insertUniqueEdges=function(s){for(var l=s.iterator();l.hasNext();){var h=l.next();this.insertUniqueEdge(h)}},i.prototype.computeOverlay=function(s){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var l=new nt;this._arg[0].computeSplitEdges(l),this._arg[1].computeSplitEdges(l),this.insertUniqueEdges(l),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Vi.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(s),this.cancelDuplicateResultEdges();var h=new Ei(this._geomFact);h.add(this._graph),this._resultPolyList=h.getPolygons();var v=new ho(this,this._geomFact,this._ptLocator);this._resultLineList=v.build(s);var S=new _s(this,this._geomFact,this._ptLocator);this._resultPointList=S.build(s),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,s)},i.prototype.labelIncompleteNode=function(s,l){var h=this._ptLocator.locate(s.getCoordinate(),this._arg[l].getGeometry());s.getLabel().setLocation(l,h)},i.prototype.copyPoints=function(s){for(var l=this._arg[s].getNodeIterator();l.hasNext();){var h=l.next();this._graph.addNode(h.getCoordinate()).setLabel(s,h.getLabel().getLocation(s))}},i.prototype.findResultAreaEdges=function(s){for(var l=this._graph.getEdgeEnds().iterator();l.hasNext();){var h=l.next(),v=h.getLabel();v.isArea()&&!h.isInteriorAreaEdge()&&i.isResultOfOp(v.getLocation(0,Ht.RIGHT),v.getLocation(1,Ht.RIGHT),s)&&h.setInResult(!0)}},i.prototype.computeLabelsFromDepths=function(){for(var s=this._edgeList.iterator();s.hasNext();){var l=s.next(),h=l.getLabel(),v=l.getDepth();if(!v.isNull()){v.normalize();for(var S=0;S<2;S++)h.isNull(S)||!h.isArea()||v.isNull(S)||(v.getDelta(S)===0?h.toLine(S):(kt.isTrue(!v.isNull(S,Ht.LEFT),"depth of LEFT side has not been initialized"),h.setLocation(S,Ht.LEFT,v.getLocation(S,Ht.LEFT)),kt.isTrue(!v.isNull(S,Ht.RIGHT),"depth of RIGHT side has not been initialized"),h.setLocation(S,Ht.RIGHT,v.getLocation(S,Ht.RIGHT))))}}},i.prototype.computeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},i.prototype.labelIncompleteNodes=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var l=s.next(),h=l.getLabel();l.isIsolated()&&(h.isNull(0)?this.labelIncompleteNode(l,0):this.labelIncompleteNode(l,1)),l.getEdges().updateLabelling(h)}},i.prototype.isCoveredByA=function(s){return!!this.isCovered(s,this._resultPolyList)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ns);Ae.overlayOp=function(n,i,s){return new Ae(n,i).getResultGeometry(s)},Ae.intersection=function(n,i){if(n.isEmpty()||i.isEmpty())return Ae.createEmptyResult(Ae.INTERSECTION,n,i,n.getFactory());if(n.isGeometryCollection()){var s=i;return vs.map(n,{interfaces_:function(){return[ia.MapOp]},map:function(l){return l.intersection(s)}})}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),zr.overlayOp(n,i,Ae.INTERSECTION)},Ae.symDifference=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return Ae.createEmptyResult(Ae.SYMDIFFERENCE,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),zr.overlayOp(n,i,Ae.SYMDIFFERENCE)},Ae.resultDimension=function(n,i,s){var l=i.getDimension(),h=s.getDimension(),v=-1;switch(n){case Ae.INTERSECTION:v=Math.min(l,h);break;case Ae.UNION:v=Math.max(l,h);break;case Ae.DIFFERENCE:v=l;break;case Ae.SYMDIFFERENCE:v=Math.max(l,h)}return v},Ae.createEmptyResult=function(n,i,s,l){var h=null;switch(Ae.resultDimension(n,i,s)){case-1:h=l.createGeometryCollection(new Array(0).fill(null));break;case 0:h=l.createPoint();break;case 1:h=l.createLineString();break;case 2:h=l.createPolygon()}return h},Ae.difference=function(n,i){return n.isEmpty()?Ae.createEmptyResult(Ae.DIFFERENCE,n,i,n.getFactory()):i.isEmpty()?n.copy():(n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),zr.overlayOp(n,i,Ae.DIFFERENCE))},Ae.isResultOfOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getLocation(0),l=n.getLocation(1);return Ae.isResultOfOp(s,l,i)}if(arguments.length===3){var h=arguments[0],v=arguments[1],S=arguments[2];switch(h===Z.BOUNDARY&&(h=Z.INTERIOR),v===Z.BOUNDARY&&(v=Z.INTERIOR),S){case Ae.INTERSECTION:return h===Z.INTERIOR&&v===Z.INTERIOR;case Ae.UNION:return h===Z.INTERIOR||v===Z.INTERIOR;case Ae.DIFFERENCE:return h===Z.INTERIOR&&v!==Z.INTERIOR;case Ae.SYMDIFFERENCE:return h===Z.INTERIOR&&v!==Z.INTERIOR||h!==Z.INTERIOR&&v===Z.INTERIOR}return!1}},Ae.INTERSECTION=1,Ae.UNION=2,Ae.DIFFERENCE=3,Ae.SYMDIFFERENCE=4;var Ds=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Be,this._seg=new ne;var n=arguments[0],i=arguments[1];this._g=n,this._boundaryDistanceTolerance=i,this._linework=this.extractLinework(n)};Ds.prototype.isWithinToleranceOfBoundary=function(n){for(var i=0;i<this._linework.getNumGeometries();i++)for(var s=this._linework.getGeometryN(i).getCoordinateSequence(),l=0;l<s.size()-1;l++)if(s.getCoordinate(l,this._seg.p0),s.getCoordinate(l+1,this._seg.p1),this._seg.distance(n)<=this._boundaryDistanceTolerance)return!0;return!1},Ds.prototype.getLocation=function(n){return this.isWithinToleranceOfBoundary(n)?Z.BOUNDARY:this._ptLocator.locate(n,this._g)},Ds.prototype.extractLinework=function(n){var i=new su;n.apply(i);var s=i.getLinework(),l=Ce.toLineStringArray(s);return n.getFactory().createMultiLineString(l)},Ds.prototype.interfaces_=function(){return[]},Ds.prototype.getClass=function(){return Ds};var su=function(){this._linework=null,this._linework=new nt};su.prototype.getLinework=function(){return this._linework},su.prototype.filter=function(n){if(n instanceof pe){var i=n;this._linework.add(i.getExteriorRing());for(var s=0;s<i.getNumInteriorRing();s++)this._linework.add(i.getInteriorRingN(s))}},su.prototype.interfaces_=function(){return[hr]},su.prototype.getClass=function(){return su};var oa=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var n=arguments[0];this._g=n};oa.prototype.extractPoints=function(n,i,s){for(var l=n.getCoordinates(),h=0;h<l.length-1;h++)this.computeOffsetPoints(l[h],l[h+1],i,s)},oa.prototype.setSidesToGenerate=function(n,i){this._doLeft=n,this._doRight=i},oa.prototype.getPoints=function(n){for(var i=new nt,s=ve.getLines(this._g).iterator();s.hasNext();){var l=s.next();this.extractPoints(l,n,i)}return i},oa.prototype.computeOffsetPoints=function(n,i,s,l){var h=i.x-n.x,v=i.y-n.y,S=Math.sqrt(h*h+v*v),R=s*h/S,V=s*v/S,ot=(i.x+n.x)/2,St=(i.y+n.y)/2;if(this._doLeft){var bt=new D(ot-V,St+R);l.add(bt)}if(this._doRight){var Yt=new D(ot+V,St-R);l.add(Yt)}},oa.prototype.interfaces_=function(){return[]},oa.prototype.getClass=function(){return oa};var ai=function n(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=n.TOLERANCE,this._testCoords=new nt;var i=arguments[0],s=arguments[1],l=arguments[2];this._boundaryDistanceTolerance=n.computeBoundaryDistanceTolerance(i,s),this._geom=[i,s,l],this._locFinder=[new Ds(this._geom[0],this._boundaryDistanceTolerance),new Ds(this._geom[1],this._boundaryDistanceTolerance),new Ds(this._geom[2],this._boundaryDistanceTolerance)]},au={TOLERANCE:{configurable:!0}};ai.prototype.reportResult=function(n,i,s){Qt.out.println("Overlay result invalid - A:"+Z.toLocationSymbol(i[0])+" B:"+Z.toLocationSymbol(i[1])+" expected:"+(s?"i":"e")+" actual:"+Z.toLocationSymbol(i[2]))},ai.prototype.isValid=function(n){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var i=this.checkValid(n);return i},ai.prototype.checkValid=function(){if(arguments.length===1){for(var n=arguments[0],i=0;i<this._testCoords.size();i++){var s=this._testCoords.get(i);if(!this.checkValid(n,s))return this._invalidLocation=s,!1}return!0}if(arguments.length===2){var l=arguments[0],h=arguments[1];return this._location[0]=this._locFinder[0].getLocation(h),this._location[1]=this._locFinder[1].getLocation(h),this._location[2]=this._locFinder[2].getLocation(h),!!ai.hasLocation(this._location,Z.BOUNDARY)||this.isValidResult(l,this._location)}},ai.prototype.addTestPts=function(n){var i=new oa(n);this._testCoords.addAll(i.getPoints(5*this._boundaryDistanceTolerance))},ai.prototype.isValidResult=function(n,i){var s=Ae.isResultOfOp(i[0],i[1],n),l=!(s^i[2]===Z.INTERIOR);return l||this.reportResult(n,i,s),l},ai.prototype.getInvalidLocation=function(){return this._invalidLocation},ai.prototype.interfaces_=function(){return[]},ai.prototype.getClass=function(){return ai},ai.hasLocation=function(n,i){for(var s=0;s<3;s++)if(n[s]===i)return!0;return!1},ai.computeBoundaryDistanceTolerance=function(n,i){return Math.min(sr.computeSizeBasedSnapTolerance(n),sr.computeSizeBasedSnapTolerance(i))},ai.isValid=function(n,i,s,l){return new ai(n,i,l).isValid(s)},au.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(ai,au);var Ci=function n(i){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=n.extractFactory(i),this._inputGeoms=i};Ci.prototype.extractElements=function(n,i){if(n===null)return null;for(var s=0;s<n.getNumGeometries();s++){var l=n.getGeometryN(s);this._skipEmpty&&l.isEmpty()||i.add(l)}},Ci.prototype.combine=function(){for(var n=new nt,i=this._inputGeoms.iterator();i.hasNext();){var s=i.next();this.extractElements(s,n)}return n.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(n)},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci},Ci.combine=function(){if(arguments.length===1){var n=arguments[0];return new Ci(n).combine()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new Ci(Ci.createList(i,s)).combine()}if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2];return new Ci(Ci.createList(l,h,v)).combine()}},Ci.extractFactory=function(n){return n.isEmpty()?null:n.iterator().next().getFactory()},Ci.createList=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new nt;return s.add(n),s.add(i),s}if(arguments.length===3){var l=arguments[0],h=arguments[1],v=arguments[2],S=new nt;return S.add(l),S.add(h),S.add(v),S}};var B=function(){this._inputPolys=null,this._geomFactory=null;var n=arguments[0];this._inputPolys=n,this._inputPolys===null&&(this._inputPolys=new nt)},Ca={STRTREE_NODE_CAPACITY:{configurable:!0}};B.prototype.reduceToGeometries=function(n){for(var i=new nt,s=n.iterator();s.hasNext();){var l=s.next(),h=null;et(l,ut)?h=this.unionTree(l):l instanceof Ct&&(h=l),i.add(h)}return i},B.prototype.extractByEnvelope=function(n,i,s){for(var l=new nt,h=0;h<i.getNumGeometries();h++){var v=i.getGeometryN(h);v.getEnvelopeInternal().intersects(n)?l.add(v):s.add(v)}return this._geomFactory.buildGeometry(l)},B.prototype.unionOptimized=function(n,i){var s=n.getEnvelopeInternal(),l=i.getEnvelopeInternal();if(!s.intersects(l))return Ci.combine(n,i);if(n.getNumGeometries()<=1&&i.getNumGeometries()<=1)return this.unionActual(n,i);var h=s.intersection(l);return this.unionUsingEnvelopeIntersection(n,i,h)},B.prototype.union=function(){if(this._inputPolys===null)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var n=new Ic(B.STRTREE_NODE_CAPACITY),i=this._inputPolys.iterator();i.hasNext();){var s=i.next();n.insert(s.getEnvelopeInternal(),s)}this._inputPolys=null;var l=n.itemsTree();return this.unionTree(l)},B.prototype.binaryUnion=function(){if(arguments.length===1){var n=arguments[0];return this.binaryUnion(n,0,n.size())}if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];if(l-s<=1){var h=B.getGeometry(i,s);return this.unionSafe(h,null)}if(l-s==2)return this.unionSafe(B.getGeometry(i,s),B.getGeometry(i,s+1));var v=Math.trunc((l+s)/2),S=this.binaryUnion(i,s,v),R=this.binaryUnion(i,v,l);return this.unionSafe(S,R)}},B.prototype.repeatedUnion=function(n){for(var i=null,s=n.iterator();s.hasNext();){var l=s.next();i=i===null?l.copy():i.union(l)}return i},B.prototype.unionSafe=function(n,i){return n===null&&i===null?null:n===null?i.copy():i===null?n.copy():this.unionOptimized(n,i)},B.prototype.unionActual=function(n,i){return B.restrictToPolygons(n.union(i))},B.prototype.unionTree=function(n){var i=this.reduceToGeometries(n);return this.binaryUnion(i)},B.prototype.unionUsingEnvelopeIntersection=function(n,i,s){var l=new nt,h=this.extractByEnvelope(s,n,l),v=this.extractByEnvelope(s,i,l),S=this.unionActual(h,v);return l.add(S),Ci.combine(l)},B.prototype.bufferUnion=function(){if(arguments.length===1){var n=arguments[0];return n.get(0).getFactory().buildGeometry(n).buffer(0)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().createGeometryCollection([i,s]).buffer(0)}},B.prototype.interfaces_=function(){return[]},B.prototype.getClass=function(){return B},B.restrictToPolygons=function(n){if(et(n,Ne))return n;var i=re.getPolygons(n);return i.size()===1?i.get(0):n.getFactory().createMultiPolygon(Ce.toPolygonArray(i))},B.getGeometry=function(n,i){return i>=n.size()?null:n.get(i)},B.union=function(n){return new B(n).union()},Ca.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(B,Ca);var sa=function(){};sa.prototype.interfaces_=function(){return[]},sa.prototype.getClass=function(){return sa},sa.union=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return Ae.createEmptyResult(Ae.UNION,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),zr.overlayOp(n,i,Ae.UNION)},r.GeoJSONReader=Fu,r.GeoJSONWriter=_a,r.OverlayOp=Ae,r.UnionOp=sa,r.BufferOp=Xr,Object.defineProperty(r,"__esModule",{value:!0})})});var pS=ce((Ac,Rf)=>{(function(){var r,t="4.17.21",e=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",c="Invalid \`variable\` option passed into \`_.template\`",p="__lodash_hash_undefined__",d=500,g="__lodash_placeholder__",y=1,_=2,w=4,x=1,b=2,P=1,I=2,M=4,E=8,N=16,A=32,U=64,z=128,$=256,q=512,D=30,G="...",Q=800,_t=16,Z=1,Dt=2,et=3,vt=1/0,It=9007199254740991,Pt=17976931348623157e292,Et=NaN,yt=4294967295,Y=yt-1,ht=yt>>>1,Mt=[["ary",z],["bind",P],["bindKey",I],["curry",E],["curryRight",N],["flip",q],["partial",A],["partialRight",U],["rearg",$]],zt="[object Arguments]",At="[object Array]",$t="[object AsyncFunction]",ue="[object Boolean]",le="[object Date]",Qt="[object DOMException]",me="[object Error]",Xt="[object Function]",Ee="[object GeneratorFunction]",ft="[object Map]",He="[object Number]",te="[object Null]",fe="[object Object]",de="[object Promise]",Ue="[object Proxy]",be="[object RegExp]",kt="[object Set]",ye="[object String]",Vn="[object Symbol]",$n="[object Undefined]",j="[object WeakMap]",H="[object WeakSet]",rt="[object ArrayBuffer]",Wt="[object DataView]",Gt="[object Float32Array]",Ct="[object Float64Array]",he="[object Int8Array]",Kt="[object Int16Array]",tt="[object Int32Array]",C="[object Uint8Array]",L="[object Uint8ClampedArray]",F="[object Uint16Array]",J="[object Uint32Array]",X=/\\b__p \\+= '';/g,pt=/\\b(__p \\+=) '' \\+/g,st=/(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g,k=/&(?:amp|lt|gt|quot|#39);/g,ut=/[&<>"']/g,nt=RegExp(k.source),lt=RegExp(ut.source),dt=/<%-([\\s\\S]+?)%>/g,at=/<%([\\s\\S]+?)%>/g,Bt=/<%=([\\s\\S]+?)%>/g,qt=/\\.|\\[(?:[^[\\]]*|(["'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,we=/^\\w*$/,oe=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,Ve=/[\\\\^$.*+?()[\\]{}|]/g,je=RegExp(Ve.source),ur=/^\\s+/,Qn=/\\s/,wr=/\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,Rr=/\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,er=/,? & /,Me=/[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g,nr=/[()=,{}\\[\\]\\/\\s]/,hr=/\\\\(\\\\)?/g,lr=/\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g,Zn=/\\w*$/,K=/^[-+]0x[0-9a-f]+$/i,xt=/^0b[01]+$/i,Lt=/^\\[object .+?Constructor\\]$/,wt=/^0o[0-7]+$/i,Ot=/^(?:0|[1-9]\\d*)$/,Zt=/[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g,jt=/($^)/,Te=/['\\n\\r\\u2028\\u2029\\\\]/g,ge="\\\\ud800-\\\\udfff",Ne="\\\\u0300-\\\\u036f",pe="\\\\ufe20-\\\\ufe2f",Oe="\\\\u20d0-\\\\u20ff",Tn=Ne+pe+Oe,Bn="\\\\u2700-\\\\u27bf",rr="a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff",Ki="\\\\xac\\\\xb1\\\\xd7\\\\xf7",pr="\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf",ze="\\\\u2000-\\\\u206f",Is=" \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000",De="A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde",Yo="\\\\ufe0e\\\\ufe0f",Ui=Ki+pr+ze+Is,$o="['\\u2019]",Ka="["+ge+"]",Se="["+Ui+"]",Qi="["+Tn+"]",ci="\\\\d+",fi="["+Bn+"]",Ce="["+rr+"]",Du="[^"+ge+Ui+ci+Bn+rr+De+"]",Qa="\\\\ud83c[\\\\udffb-\\\\udfff]",ml="(?:"+Qi+"|"+Qa+")",ao="[^"+ge+"]",So="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",Fu="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",_a="["+De+"]",Ht="\\\\u200d",Uu="(?:"+Ce+"|"+Du+")",bo="(?:"+_a+"|"+Du+")",Zo="(?:"+$o+"(?:d|ll|m|re|s|t|ve))?",Bu="(?:"+$o+"(?:D|LL|M|RE|S|T|VE))?",Jr=ml+"?",Wn="["+Yo+"]?",An="(?:"+Ht+"(?:"+[ao,So,Fu].join("|")+")"+Wn+Jr+")*",Mr="\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])",rd="\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])",Lf=Wn+Jr+An,Bi="(?:"+[fi,So,Fu].join("|")+")"+Lf,yl="(?:"+[ao+Qi+"?",Qi,So,Fu,Ka].join("|")+")",To=RegExp($o,"g"),kn=RegExp(Qi,"g"),xa=RegExp(Qa+"(?="+Qa+")|"+yl+Lf,"g"),Kr=RegExp([_a+"?"+Ce+"+"+Zo+"(?="+[Se,_a,"$"].join("|")+")",bo+"+"+Bu+"(?="+[Se,_a+Uu,"$"].join("|")+")",_a+"?"+Uu+"+"+Zo,_a+"+"+Bu,rd,Mr,ci,Bi].join("|"),"g"),Cc=RegExp("["+Ht+ge+Tn+Yo+"]"),ja=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,cr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ei=-1,jn={};jn[Gt]=jn[Ct]=jn[he]=jn[Kt]=jn[tt]=jn[C]=jn[L]=jn[F]=jn[J]=!0,jn[zt]=jn[At]=jn[rt]=jn[ue]=jn[Wt]=jn[le]=jn[me]=jn[Xt]=jn[ft]=jn[He]=jn[fe]=jn[be]=jn[kt]=jn[ye]=jn[j]=!1;var Xe={};Xe[zt]=Xe[At]=Xe[rt]=Xe[Wt]=Xe[ue]=Xe[le]=Xe[Gt]=Xe[Ct]=Xe[he]=Xe[Kt]=Xe[tt]=Xe[ft]=Xe[He]=Xe[fe]=Xe[be]=Xe[kt]=Xe[ye]=Xe[Vn]=Xe[C]=Xe[L]=Xe[F]=Xe[J]=!0,Xe[me]=Xe[Xt]=Xe[j]=!1;var hs={\\u00C0:"A",\\u00C1:"A",\\u00C2:"A",\\u00C3:"A",\\u00C4:"A",\\u00C5:"A",\\u00E0:"a",\\u00E1:"a",\\u00E2:"a",\\u00E3:"a",\\u00E4:"a",\\u00E5:"a",\\u00C7:"C",\\u00E7:"c",\\u00D0:"D",\\u00F0:"d",\\u00C8:"E",\\u00C9:"E",\\u00CA:"E",\\u00CB:"E",\\u00E8:"e",\\u00E9:"e",\\u00EA:"e",\\u00EB:"e",\\u00CC:"I",\\u00CD:"I",\\u00CE:"I",\\u00CF:"I",\\u00EC:"i",\\u00ED:"i",\\u00EE:"i",\\u00EF:"i",\\u00D1:"N",\\u00F1:"n",\\u00D2:"O",\\u00D3:"O",\\u00D4:"O",\\u00D5:"O",\\u00D6:"O",\\u00D8:"O",\\u00F2:"o",\\u00F3:"o",\\u00F4:"o",\\u00F5:"o",\\u00F6:"o",\\u00F8:"o",\\u00D9:"U",\\u00DA:"U",\\u00DB:"U",\\u00DC:"U",\\u00F9:"u",\\u00FA:"u",\\u00FB:"u",\\u00FC:"u",\\u00DD:"Y",\\u00FD:"y",\\u00FF:"y",\\u00C6:"Ae",\\u00E6:"ae",\\u00DE:"Th",\\u00FE:"th",\\u00DF:"ss",\\u0100:"A",\\u0102:"A",\\u0104:"A",\\u0101:"a",\\u0103:"a",\\u0105:"a",\\u0106:"C",\\u0108:"C",\\u010A:"C",\\u010C:"C",\\u0107:"c",\\u0109:"c",\\u010B:"c",\\u010D:"c",\\u010E:"D",\\u0110:"D",\\u010F:"d",\\u0111:"d",\\u0112:"E",\\u0114:"E",\\u0116:"E",\\u0118:"E",\\u011A:"E",\\u0113:"e",\\u0115:"e",\\u0117:"e",\\u0119:"e",\\u011B:"e",\\u011C:"G",\\u011E:"G",\\u0120:"G",\\u0122:"G",\\u011D:"g",\\u011F:"g",\\u0121:"g",\\u0123:"g",\\u0124:"H",\\u0126:"H",\\u0125:"h",\\u0127:"h",\\u0128:"I",\\u012A:"I",\\u012C:"I",\\u012E:"I",\\u0130:"I",\\u0129:"i",\\u012B:"i",\\u012D:"i",\\u012F:"i",\\u0131:"i",\\u0134:"J",\\u0135:"j",\\u0136:"K",\\u0137:"k",\\u0138:"k",\\u0139:"L",\\u013B:"L",\\u013D:"L",\\u013F:"L",\\u0141:"L",\\u013A:"l",\\u013C:"l",\\u013E:"l",\\u0140:"l",\\u0142:"l",\\u0143:"N",\\u0145:"N",\\u0147:"N",\\u014A:"N",\\u0144:"n",\\u0146:"n",\\u0148:"n",\\u014B:"n",\\u014C:"O",\\u014E:"O",\\u0150:"O",\\u014D:"o",\\u014F:"o",\\u0151:"o",\\u0154:"R",\\u0156:"R",\\u0158:"R",\\u0155:"r",\\u0157:"r",\\u0159:"r",\\u015A:"S",\\u015C:"S",\\u015E:"S",\\u0160:"S",\\u015B:"s",\\u015D:"s",\\u015F:"s",\\u0161:"s",\\u0162:"T",\\u0164:"T",\\u0166:"T",\\u0163:"t",\\u0165:"t",\\u0167:"t",\\u0168:"U",\\u016A:"U",\\u016C:"U",\\u016E:"U",\\u0170:"U",\\u0172:"U",\\u0169:"u",\\u016B:"u",\\u016D:"u",\\u016F:"u",\\u0171:"u",\\u0173:"u",\\u0174:"W",\\u0175:"w",\\u0176:"Y",\\u0177:"y",\\u0178:"Y",\\u0179:"Z",\\u017B:"Z",\\u017D:"Z",\\u017A:"z",\\u017C:"z",\\u017E:"z",\\u0132:"IJ",\\u0133:"ij",\\u0152:"Oe",\\u0153:"oe",\\u0149:"'n",\\u017F:"s"},Rs={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ea={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Ar={"\\\\":"\\\\","'":"'","\\n":"n","\\r":"r","\\u2028":"u2028","\\u2029":"u2029"},Nf=parseFloat,uo=parseInt,_r=typeof global=="object"&&global&&global.Object===Object&&global,Fr=typeof self=="object"&&self&&self.Object===Object&&self,Ur=_r||Fr||Function("return this")(),Pc=typeof Ac=="object"&&Ac&&!Ac.nodeType&&Ac,Ao=Pc&&typeof Rf=="object"&&Rf&&!Rf.nodeType&&Rf,Ic=Ao&&Ao.exports===Pc,vl=Ic&&_r.process,ir=function(){try{var gt=Ao&&Ao.require&&Ao.require("util").types;return gt||vl&&vl.binding&&vl.binding("util")}catch(Nt){}}(),ps=ir&&ir.isArrayBuffer,Qr=ir&&ir.isDate,Zs=ir&&ir.isMap,Co=ir&&ir.isRegExp,tu=ir&&ir.isSet,dr=ir&&ir.isTypedArray;function ne(gt,Nt,Tt){switch(Tt.length){case 0:return gt.call(Nt);case 1:return gt.call(Nt,Tt[0]);case 2:return gt.call(Nt,Tt[0],Tt[1]);case 3:return gt.call(Nt,Tt[0],Tt[1],Tt[2])}return gt.apply(Nt,Tt)}function Of(gt,Nt,Tt,re){for(var ve=-1,Be=gt==null?0:gt.length;++ve<Be;){var tn=gt[ve];Nt(re,tn,Tt(tn),gt)}return re}function wi(gt,Nt){for(var Tt=-1,re=gt==null?0:gt.length;++Tt<re&&Nt(gt[Tt],Tt,gt)!==!1;);return gt}function Mi(gt,Nt){for(var Tt=gt==null?0:gt.length;Tt--&&Nt(gt[Tt],Tt,gt)!==!1;);return gt}function lo(gt,Nt){for(var Tt=-1,re=gt==null?0:gt.length;++Tt<re;)if(!Nt(gt[Tt],Tt,gt))return!1;return!0}function zi(gt,Nt){for(var Tt=-1,re=gt==null?0:gt.length,ve=0,Be=[];++Tt<re;){var tn=gt[Tt];Nt(tn,Tt,gt)&&(Be[ve++]=tn)}return Be}function Js(gt,Nt){var Tt=gt==null?0:gt.length;return!!Tt&&ds(gt,Nt,0)>-1}function zu(gt,Nt,Tt){for(var re=-1,ve=gt==null?0:gt.length;++re<ve;)if(Tt(Nt,gt[re]))return!0;return!1}function xr(gt,Nt){for(var Tt=-1,re=gt==null?0:gt.length,ve=Array(re);++Tt<re;)ve[Tt]=Nt(gt[Tt],Tt,gt);return ve}function Fe(gt,Nt){for(var Tt=-1,re=Nt.length,ve=gt.length;++Tt<re;)gt[ve+Tt]=Nt[Tt];return gt}function Po(gt,Nt,Tt,re){var ve=-1,Be=gt==null?0:gt.length;for(re&&Be&&(Tt=gt[++ve]);++ve<Be;)Tt=Nt(Tt,gt[ve],ve,gt);return Tt}function gr(gt,Nt,Tt,re){var ve=gt==null?0:gt.length;for(re&&ve&&(Tt=gt[--ve]);ve--;)Tt=Nt(Tt,gt[ve],ve,gt);return Tt}function wa(gt,Nt){for(var Tt=-1,re=gt==null?0:gt.length;++Tt<re;)if(Nt(gt[Tt],Tt,gt))return!0;return!1}var Gi=gs("length");function Df(gt){return gt.split("")}function Ge(gt){return gt.match(Me)||[]}function Ks(gt,Nt,Tt){var re;return Tt(gt,function(ve,Be,tn){if(Nt(ve,Be,tn))return re=Be,!1}),re}function qn(gt,Nt,Tt,re){for(var ve=gt.length,Be=Tt+(re?1:-1);re?Be--:++Be<ve;)if(Nt(gt[Be],Be,gt))return Be;return-1}function ds(gt,Nt,Tt){return Nt===Nt?Gu(gt,Nt,Tt):qn(gt,Qs,Tt)}function hi(gt,Nt,Tt,re){for(var ve=Tt-1,Be=gt.length;++ve<Be;)if(re(gt[ve],Nt))return ve;return-1}function Qs(gt){return gt!==gt}function Rc(gt,Nt){var Tt=gt==null?0:gt.length;return Tt?co(gt,Nt)/Tt:Et}function gs(gt){return function(Nt){return Nt==null?r:Nt[gt]}}function We(gt){return function(Nt){return gt==null?r:gt[Nt]}}function ki(gt,Nt,Tt,re,ve){return ve(gt,function(Be,tn,or){Tt=re?(re=!1,Be):Nt(Tt,Be,tn,or)}),Tt}function eu(gt,Nt){var Tt=gt.length;for(gt.sort(Nt);Tt--;)gt[Tt]=gt[Tt].value;return gt}function co(gt,Nt){for(var Tt,re=-1,ve=gt.length;++re<ve;){var Be=Nt(gt[re]);Be!==r&&(Tt=Tt===r?Be:Tt+Be)}return Tt}function pi(gt,Nt){for(var Tt=-1,re=Array(gt);++Tt<gt;)re[Tt]=Nt(Tt);return re}function jr(gt,Nt){return xr(Nt,function(Tt){return[Tt,gt[Tt]]})}function Ff(gt){return gt&&gt.slice(0,ta(gt)+1).replace(ur,"")}function ji(gt){return function(Nt){return gt(Nt)}}function Jo(gt,Nt){return xr(Nt,function(Tt){return gt[Tt]})}function di(gt,Nt){return gt.has(Nt)}function Ls(gt,Nt){for(var Tt=-1,re=gt.length;++Tt<re&&ds(Nt,gt[Tt],0)>-1;);return Tt}function Si(gt,Nt){for(var Tt=gt.length;Tt--&&ds(Nt,gt[Tt],0)>-1;);return Tt}function Io(gt,Nt){for(var Tt=gt.length,re=0;Tt--;)gt[Tt]===Nt&&++re;return re}var Ko=We(hs),js=We(Rs);function ms(gt){return"\\\\"+Ar[gt]}function Wr(gt,Nt){return gt==null?r:gt[Nt]}function Ma(gt){return Cc.test(gt)}function _l(gt){return ja.test(gt)}function ii(gt){for(var Nt,Tt=[];!(Nt=gt.next()).done;)Tt.push(Nt.value);return Tt}function Qo(gt){var Nt=-1,Tt=Array(gt.size);return gt.forEach(function(re,ve){Tt[++Nt]=[ve,re]}),Tt}function fo(gt,Nt){return function(Tt){return gt(Nt(Tt))}}function Ns(gt,Nt){for(var Tt=-1,re=gt.length,ve=0,Be=[];++Tt<re;){var tn=gt[Tt];(tn===Nt||tn===g)&&(gt[Tt]=g,Be[ve++]=Tt)}return Be}function qr(gt){var Nt=-1,Tt=Array(gt.size);return gt.forEach(function(re){Tt[++Nt]=re}),Tt}function Uf(gt){var Nt=-1,Tt=Array(gt.size);return gt.forEach(function(re){Tt[++Nt]=[re,re]}),Tt}function Gu(gt,Nt,Tt){for(var re=Tt-1,ve=gt.length;++re<ve;)if(gt[re]===Nt)return re;return-1}function nu(gt,Nt,Tt){for(var re=Tt+1;re--;)if(gt[re]===Nt)return re;return re}function Sa(gt){return Ma(gt)?Xr(gt):Gi(gt)}function Ro(gt){return Ma(gt)?ru(gt):Df(gt)}function ta(gt){for(var Nt=gt.length;Nt--&&Qn.test(gt.charAt(Nt)););return Nt}var jo=We(Ea);function Xr(gt){for(var Nt=xa.lastIndex=0;xa.test(gt);)++Nt;return Nt}function ru(gt){return gt.match(xa)||[]}function oi(gt){return gt.match(Kr)||[]}var ts=function gt(Nt){Nt=Nt==null?Ur:Hi.defaults(Ur.Object(),Nt,Hi.pick(Ur,cr));var Tt=Nt.Array,re=Nt.Date,ve=Nt.Error,Be=Nt.Function,tn=Nt.Math,or=Nt.Object,es=Nt.RegExp,ba=Nt.String,Jn=Nt.TypeError,Lr=Tt.prototype,Lo=Be.prototype,ti=or.prototype,iu=Nt["__core-js_shared__"],ys=Lo.toString,Ze=ti.hasOwnProperty,bi=0,xl=function(){var u=/[^.]+$/.exec(iu&&iu.keys&&iu.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),Cr=ti.toString,Lc=ys.call(or),No=Ur._,Br=es("^"+ys.call(Ze).replace(Ve,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$"),Ti=Ic?Nt.Buffer:r,Vi=Nt.Symbol,vs=Nt.Uint8Array,ho=Ti?Ti.allocUnsafe:r,_s=fo(or.getPrototypeOf,or),si=or.create,Oo=ti.propertyIsEnumerable,sr=Lr.splice,Nc=Vi?Vi.isConcatSpreadable:r,ou=Vi?Vi.iterator:r,Sr=Vi?Vi.toStringTag:r,Do=function(){try{var u=qu(or,"defineProperty");return u({},"",{}),u}catch(f){}}(),Oc=Nt.clearTimeout!==Ur.clearTimeout&&Nt.clearTimeout,Ta=re&&re.now!==Ur.Date.now&&re.now,Os=Nt.setTimeout!==Ur.setTimeout&&Nt.setTimeout,br=tn.ceil,zr=tn.floor,Aa=or.getOwnPropertySymbols,Ai=Ti?Ti.isBuffer:r,El=Nt.isFinite,wl=Lr.join,Yr=fo(or.keys,or),ei=tn.max,mr=tn.min,Bf=re.now,ku=Nt.parseInt,zf=tn.random,id=Lr.reverse,po=qu(Nt,"DataView"),xs=qu(Nt,"Map"),ea=qu(Nt,"Promise"),na=qu(Nt,"Set"),Es=qu(Nt,"WeakMap"),Fo=qu(or,"create"),ra=Es&&new Es,ns={},ia=Xu(po),Ae=Xu(xs),Ds=Xu(ea),su=Xu(na),oa=Xu(Es),ai=Vi?Vi.prototype:r,au=ai?ai.valueOf:r,Ci=ai?ai.toString:r;function B(u){if($r(u)&&!ke(u)&&!(u instanceof i)){if(u instanceof n)return u;if(Ze.call(u,"__wrapped__"))return cv(u)}return new n(u)}var Ca=function(){function u(){}return function(f){if(!Gr(f))return{};if(si)return si(f);u.prototype=f;var m=new u;return u.prototype=r,m}}();function sa(){}function n(u,f){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!f,this.__index__=0,this.__values__=r}B.templateSettings={escape:dt,evaluate:at,interpolate:Bt,variable:"",imports:{_:B}},B.prototype=sa.prototype,B.prototype.constructor=B,n.prototype=Ca(sa.prototype),n.prototype.constructor=n;function i(u){this.__wrapped__=u,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=yt,this.__views__=[]}function s(){var u=new i(this.__wrapped__);return u.__actions__=Uo(this.__actions__),u.__dir__=this.__dir__,u.__filtered__=this.__filtered__,u.__iteratees__=Uo(this.__iteratees__),u.__takeCount__=this.__takeCount__,u.__views__=Uo(this.__views__),u}function l(){if(this.__filtered__){var u=new i(this);u.__dir__=-1,u.__filtered__=!0}else u=this.clone(),u.__dir__*=-1;return u}function h(){var u=this.__wrapped__.value(),f=this.__dir__,m=ke(u),T=f<0,O=m?u.length:0,W=_b(0,O,this.__views__),it=W.start,ct=W.end,mt=ct-it,Ft=T?ct:it-1,Ut=this.__iteratees__,Vt=Ut.length,ae=0,xe=mr(mt,this.__takeCount__);if(!m||!T&&O==mt&&xe==mt)return Ny(u,this.__actions__);var Re=[];t:for(;mt--&&ae<xe;){Ft+=f;for(var Ye=-1,Le=u[Ft];++Ye<Vt;){var Pn=Ut[Ye],Hn=Pn.iteratee,ss=Pn.type,yo=Hn(Le);if(ss==Dt)Le=yo;else if(!yo){if(ss==Z)continue t;break t}}Re[ae++]=Le}return Re}i.prototype=Ca(sa.prototype),i.prototype.constructor=i;function v(u){var f=-1,m=u==null?0:u.length;for(this.clear();++f<m;){var T=u[f];this.set(T[0],T[1])}}function S(){this.__data__=Fo?Fo(null):{},this.size=0}function R(u){var f=this.has(u)&&delete this.__data__[u];return this.size-=f?1:0,f}function V(u){var f=this.__data__;if(Fo){var m=f[u];return m===p?r:m}return Ze.call(f,u)?f[u]:r}function ot(u){var f=this.__data__;return Fo?f[u]!==r:Ze.call(f,u)}function St(u,f){var m=this.__data__;return this.size+=this.has(u)?0:1,m[u]=Fo&&f===r?p:f,this}v.prototype.clear=S,v.prototype.delete=R,v.prototype.get=V,v.prototype.has=ot,v.prototype.set=St;function bt(u){var f=-1,m=u==null?0:u.length;for(this.clear();++f<m;){var T=u[f];this.set(T[0],T[1])}}function Yt(){this.__data__=[],this.size=0}function Jt(u){var f=this.__data__,m=Gf(f,u);if(m<0)return!1;var T=f.length-1;return m==T?f.pop():sr.call(f,m,1),--this.size,!0}function se(u){var f=this.__data__,m=Gf(f,u);return m<0?r:f[m][1]}function _e(u){return Gf(this.__data__,u)>-1}function Cn(u,f){var m=this.__data__,T=Gf(m,u);return T<0?(++this.size,m.push([u,f])):m[T][1]=f,this}bt.prototype.clear=Yt,bt.prototype.delete=Jt,bt.prototype.get=se,bt.prototype.has=_e,bt.prototype.set=Cn;function Xn(u){var f=-1,m=u==null?0:u.length;for(this.clear();++f<m;){var T=u[f];this.set(T[0],T[1])}}function ui(){this.size=0,this.__data__={hash:new v,map:new(xs||bt),string:new v}}function rs(u){var f=Qf(this,u).delete(u);return this.size-=f?1:0,f}function Fs(u){return Qf(this,u).get(u)}function Dc(u){return Qf(this,u).has(u)}function wS(u,f){var m=Qf(this,u),T=m.size;return m.set(u,f),this.size+=m.size==T?0:1,this}Xn.prototype.clear=ui,Xn.prototype.delete=rs,Xn.prototype.get=Fs,Xn.prototype.has=Dc,Xn.prototype.set=wS;function Hu(u){var f=-1,m=u==null?0:u.length;for(this.__data__=new Xn;++f<m;)this.add(u[f])}function MS(u){return this.__data__.set(u,p),this}function SS(u){return this.__data__.has(u)}Hu.prototype.add=Hu.prototype.push=MS,Hu.prototype.has=SS;function Us(u){var f=this.__data__=new bt(u);this.size=f.size}function bS(){this.__data__=new bt,this.size=0}function TS(u){var f=this.__data__,m=f.delete(u);return this.size=f.size,m}function AS(u){return this.__data__.get(u)}function CS(u){return this.__data__.has(u)}function PS(u,f){var m=this.__data__;if(m instanceof bt){var T=m.__data__;if(!xs||T.length<e-1)return T.push([u,f]),this.size=++m.size,this;m=this.__data__=new Xn(T)}return m.set(u,f),this.size=m.size,this}Us.prototype.clear=bS,Us.prototype.delete=TS,Us.prototype.get=AS,Us.prototype.has=CS,Us.prototype.set=PS;function cy(u,f){var m=ke(u),T=!m&&Yu(u),O=!m&&!T&&hu(u),W=!m&&!T&&!O&&Tl(u),it=m||T||O||W,ct=it?pi(u.length,ba):[],mt=ct.length;for(var Ft in u)(f||Ze.call(u,Ft))&&!(it&&(Ft=="length"||O&&(Ft=="offset"||Ft=="parent")||W&&(Ft=="buffer"||Ft=="byteLength"||Ft=="byteOffset")||La(Ft,mt)))&&ct.push(Ft);return ct}function fy(u){var f=u.length;return f?u[gd(0,f-1)]:r}function IS(u,f){return jf(Uo(u),Vu(f,0,u.length))}function RS(u){return jf(Uo(u))}function od(u,f,m){(m!==r&&!Bs(u[f],m)||m===r&&!(f in u))&&Pa(u,f,m)}function Fc(u,f,m){var T=u[f];(!(Ze.call(u,f)&&Bs(T,m))||m===r&&!(f in u))&&Pa(u,f,m)}function Gf(u,f){for(var m=u.length;m--;)if(Bs(u[m][0],f))return m;return-1}function LS(u,f,m,T){return uu(u,function(O,W,it){f(T,O,m(O),it)}),T}function hy(u,f){return u&&ua(f,Pi(f),u)}function NS(u,f){return u&&ua(f,zo(f),u)}function Pa(u,f,m){f=="__proto__"&&Do?Do(u,f,{configurable:!0,enumerable:!0,value:m,writable:!0}):u[f]=m}function sd(u,f){for(var m=-1,T=f.length,O=Tt(T),W=u==null;++m<T;)O[m]=W?r:Gd(u,f[m]);return O}function Vu(u,f,m){return u===u&&(m!==r&&(u=u<=m?u:m),f!==r&&(u=u>=f?u:f)),u}function ws(u,f,m,T,O,W){var it,ct=f&y,mt=f&_,Ft=f&w;if(m&&(it=O?m(u,T,O,W):m(u)),it!==r)return it;if(!Gr(u))return u;var Ut=ke(u);if(Ut){if(it=Eb(u),!ct)return Uo(u,it)}else{var Vt=to(u),ae=Vt==Xt||Vt==Ee;if(hu(u))return Fy(u,ct);if(Vt==fe||Vt==zt||ae&&!O){if(it=mt||ae?{}:ev(u),!ct)return mt?cb(u,NS(it,u)):lb(u,hy(it,u))}else{if(!Xe[Vt])return O?u:{};it=wb(u,Vt,ct)}}W||(W=new Us);var xe=W.get(u);if(xe)return xe;W.set(u,it),Iv(u)?u.forEach(function(Le){it.add(ws(Le,f,m,Le,u,W))}):Cv(u)&&u.forEach(function(Le,Pn){it.set(Pn,ws(Le,f,m,Pn,u,W))});var Re=Ft?mt?Td:bd:mt?zo:Pi,Ye=Ut?r:Re(u);return wi(Ye||u,function(Le,Pn){Ye&&(Pn=Le,Le=u[Pn]),Fc(it,Pn,ws(Le,f,m,Pn,u,W))}),it}function OS(u){var f=Pi(u);return function(m){return py(m,u,f)}}function py(u,f,m){var T=m.length;if(u==null)return!T;for(u=or(u);T--;){var O=m[T],W=f[O],it=u[O];if(it===r&&!(O in u)||!W(it))return!1}return!0}function dy(u,f,m){if(typeof u!="function")throw new Jn(a);return Vc(function(){u.apply(r,m)},f)}function Uc(u,f,m,T){var O=-1,W=Js,it=!0,ct=u.length,mt=[],Ft=f.length;if(!ct)return mt;m&&(f=xr(f,ji(m))),T?(W=zu,it=!1):f.length>=e&&(W=di,it=!1,f=new Hu(f));t:for(;++O<ct;){var Ut=u[O],Vt=m==null?Ut:m(Ut);if(Ut=T||Ut!==0?Ut:0,it&&Vt===Vt){for(var ae=Ft;ae--;)if(f[ae]===Vt)continue t;mt.push(Ut)}else W(f,Vt,T)||mt.push(Ut)}return mt}var uu=ky(aa),gy=ky(ud,!0);function DS(u,f){var m=!0;return uu(u,function(T,O,W){return m=!!f(T,O,W),m}),m}function kf(u,f,m){for(var T=-1,O=u.length;++T<O;){var W=u[T],it=f(W);if(it!=null&&(ct===r?it===it&&!os(it):m(it,ct)))var ct=it,mt=W}return mt}function FS(u,f,m,T){var O=u.length;for(m=qe(m),m<0&&(m=-m>O?0:O+m),T=T===r||T>O?O:qe(T),T<0&&(T+=O),T=m>T?0:Lv(T);m<T;)u[m++]=f;return u}function my(u,f){var m=[];return uu(u,function(T,O,W){f(T,O,W)&&m.push(T)}),m}function Wi(u,f,m,T,O){var W=-1,it=u.length;for(m||(m=Sb),O||(O=[]);++W<it;){var ct=u[W];f>0&&m(ct)?f>1?Wi(ct,f-1,m,T,O):Fe(O,ct):T||(O[O.length]=ct)}return O}var ad=Hy(),yy=Hy(!0);function aa(u,f){return u&&ad(u,f,Pi)}function ud(u,f){return u&&yy(u,f,Pi)}function Hf(u,f){return zi(f,function(m){return Na(u[m])})}function Wu(u,f){f=cu(f,u);for(var m=0,T=f.length;u!=null&&m<T;)u=u[la(f[m++])];return m&&m==T?u:r}function vy(u,f,m){var T=f(u);return ke(u)?T:Fe(T,m(u))}function go(u){return u==null?u===r?$n:te:Sr&&Sr in or(u)?vb(u):Rb(u)}function ld(u,f){return u>f}function US(u,f){return u!=null&&Ze.call(u,f)}function BS(u,f){return u!=null&&f in or(u)}function zS(u,f,m){return u>=mr(f,m)&&u<ei(f,m)}function cd(u,f,m){for(var T=m?zu:Js,O=u[0].length,W=u.length,it=W,ct=Tt(W),mt=1/0,Ft=[];it--;){var Ut=u[it];it&&f&&(Ut=xr(Ut,ji(f))),mt=mr(Ut.length,mt),ct[it]=!m&&(f||O>=120&&Ut.length>=120)?new Hu(it&&Ut):r}Ut=u[0];var Vt=-1,ae=ct[0];t:for(;++Vt<O&&Ft.length<mt;){var xe=Ut[Vt],Re=f?f(xe):xe;if(xe=m||xe!==0?xe:0,!(ae?di(ae,Re):T(Ft,Re,m))){for(it=W;--it;){var Ye=ct[it];if(!(Ye?di(Ye,Re):T(u[it],Re,m)))continue t}ae&&ae.push(Re),Ft.push(xe)}}return Ft}function GS(u,f,m,T){return aa(u,function(O,W,it){f(T,m(O),W,it)}),T}function Bc(u,f,m){f=cu(f,u),u=ov(u,f);var T=u==null?u:u[la(Ss(f))];return T==null?r:ne(T,u,m)}function _y(u){return $r(u)&&go(u)==zt}function kS(u){return $r(u)&&go(u)==rt}function HS(u){return $r(u)&&go(u)==le}function zc(u,f,m,T,O){return u===f?!0:u==null||f==null||!$r(u)&&!$r(f)?u!==u&&f!==f:VS(u,f,m,T,zc,O)}function VS(u,f,m,T,O,W){var it=ke(u),ct=ke(f),mt=it?At:to(u),Ft=ct?At:to(f);mt=mt==zt?fe:mt,Ft=Ft==zt?fe:Ft;var Ut=mt==fe,Vt=Ft==fe,ae=mt==Ft;if(ae&&hu(u)){if(!hu(f))return!1;it=!0,Ut=!1}if(ae&&!Ut)return W||(W=new Us),it||Tl(u)?Qy(u,f,m,T,O,W):mb(u,f,mt,m,T,O,W);if(!(m&x)){var xe=Ut&&Ze.call(u,"__wrapped__"),Re=Vt&&Ze.call(f,"__wrapped__");if(xe||Re){var Ye=xe?u.value():u,Le=Re?f.value():f;return W||(W=new Us),O(Ye,Le,m,T,W)}}return ae?(W||(W=new Us),yb(u,f,m,T,O,W)):!1}function WS(u){return $r(u)&&to(u)==ft}function fd(u,f,m,T){var O=m.length,W=O,it=!T;if(u==null)return!W;for(u=or(u);O--;){var ct=m[O];if(it&&ct[2]?ct[1]!==u[ct[0]]:!(ct[0]in u))return!1}for(;++O<W;){ct=m[O];var mt=ct[0],Ft=u[mt],Ut=ct[1];if(it&&ct[2]){if(Ft===r&&!(mt in u))return!1}else{var Vt=new Us;if(T)var ae=T(Ft,Ut,mt,u,f,Vt);if(!(ae===r?zc(Ut,Ft,x|b,T,Vt):ae))return!1}}return!0}function xy(u){if(!Gr(u)||Tb(u))return!1;var f=Na(u)?Br:Lt;return f.test(Xu(u))}function qS(u){return $r(u)&&go(u)==be}function XS(u){return $r(u)&&to(u)==kt}function YS(u){return $r(u)&&oh(u.length)&&!!jn[go(u)]}function Ey(u){return typeof u=="function"?u:u==null?Go:typeof u=="object"?ke(u)?Sy(u[0],u[1]):My(u):Vv(u)}function hd(u){if(!Hc(u))return Yr(u);var f=[];for(var m in or(u))Ze.call(u,m)&&m!="constructor"&&f.push(m);return f}function $S(u){if(!Gr(u))return Ib(u);var f=Hc(u),m=[];for(var T in u)T=="constructor"&&(f||!Ze.call(u,T))||m.push(T);return m}function pd(u,f){return u<f}function wy(u,f){var m=-1,T=Bo(u)?Tt(u.length):[];return uu(u,function(O,W,it){T[++m]=f(O,W,it)}),T}function My(u){var f=Cd(u);return f.length==1&&f[0][2]?rv(f[0][0],f[0][1]):function(m){return m===u||fd(m,u,f)}}function Sy(u,f){return Id(u)&&nv(f)?rv(la(u),f):function(m){var T=Gd(m,u);return T===r&&T===f?kd(m,u):zc(f,T,x|b)}}function Vf(u,f,m,T,O){u!==f&&ad(f,function(W,it){if(O||(O=new Us),Gr(W))ZS(u,f,it,m,Vf,T,O);else{var ct=T?T(Ld(u,it),W,it+"",u,f,O):r;ct===r&&(ct=W),od(u,it,ct)}},zo)}function ZS(u,f,m,T,O,W,it){var ct=Ld(u,m),mt=Ld(f,m),Ft=it.get(mt);if(Ft){od(u,m,Ft);return}var Ut=W?W(ct,mt,m+"",u,f,it):r,Vt=Ut===r;if(Vt){var ae=ke(mt),xe=!ae&&hu(mt),Re=!ae&&!xe&&Tl(mt);Ut=mt,ae||xe||Re?ke(ct)?Ut=ct:ni(ct)?Ut=Uo(ct):xe?(Vt=!1,Ut=Fy(mt,!0)):Re?(Vt=!1,Ut=Uy(mt,!0)):Ut=[]:Wc(mt)||Yu(mt)?(Ut=ct,Yu(ct)?Ut=Nv(ct):(!Gr(ct)||Na(ct))&&(Ut=ev(mt))):Vt=!1}Vt&&(it.set(mt,Ut),O(Ut,mt,T,W,it),it.delete(mt)),od(u,m,Ut)}function by(u,f){var m=u.length;if(m)return f+=f<0?m:0,La(f,m)?u[f]:r}function Ty(u,f,m){f.length?f=xr(f,function(W){return ke(W)?function(it){return Wu(it,W.length===1?W[0]:W)}:W}):f=[Go];var T=-1;f=xr(f,ji(Pe()));var O=wy(u,function(W,it,ct){var mt=xr(f,function(Ft){return Ft(W)});return{criteria:mt,index:++T,value:W}});return eu(O,function(W,it){return ub(W,it,m)})}function JS(u,f){return Ay(u,f,function(m,T){return kd(u,T)})}function Ay(u,f,m){for(var T=-1,O=f.length,W={};++T<O;){var it=f[T],ct=Wu(u,it);m(ct,it)&&Gc(W,cu(it,u),ct)}return W}function KS(u){return function(f){return Wu(f,u)}}function dd(u,f,m,T){var O=T?hi:ds,W=-1,it=f.length,ct=u;for(u===f&&(f=Uo(f)),m&&(ct=xr(u,ji(m)));++W<it;)for(var mt=0,Ft=f[W],Ut=m?m(Ft):Ft;(mt=O(ct,Ut,mt,T))>-1;)ct!==u&&sr.call(ct,mt,1),sr.call(u,mt,1);return u}function Cy(u,f){for(var m=u?f.length:0,T=m-1;m--;){var O=f[m];if(m==T||O!==W){var W=O;La(O)?sr.call(u,O,1):vd(u,O)}}return u}function gd(u,f){return u+zr(zf()*(f-u+1))}function QS(u,f,m,T){for(var O=-1,W=ei(br((f-u)/(m||1)),0),it=Tt(W);W--;)it[T?W:++O]=u,u+=m;return it}function md(u,f){var m="";if(!u||f<1||f>It)return m;do f%2&&(m+=u),f=zr(f/2),f&&(u+=u);while(f);return m}function Je(u,f){return Nd(iv(u,f,Go),u+"")}function jS(u){return fy(Al(u))}function tb(u,f){var m=Al(u);return jf(m,Vu(f,0,m.length))}function Gc(u,f,m,T){if(!Gr(u))return u;f=cu(f,u);for(var O=-1,W=f.length,it=W-1,ct=u;ct!=null&&++O<W;){var mt=la(f[O]),Ft=m;if(mt==="__proto__"||mt==="constructor"||mt==="prototype")return u;if(O!=it){var Ut=ct[mt];Ft=T?T(Ut,mt,ct):r,Ft===r&&(Ft=Gr(Ut)?Ut:La(f[O+1])?[]:{})}Fc(ct,mt,Ft),ct=ct[mt]}return u}var Py=ra?function(u,f){return ra.set(u,f),u}:Go,eb=Do?function(u,f){return Do(u,"toString",{configurable:!0,enumerable:!1,value:Vd(f),writable:!0})}:Go;function nb(u){return jf(Al(u))}function Ms(u,f,m){var T=-1,O=u.length;f<0&&(f=-f>O?0:O+f),m=m>O?O:m,m<0&&(m+=O),O=f>m?0:m-f>>>0,f>>>=0;for(var W=Tt(O);++T<O;)W[T]=u[T+f];return W}function rb(u,f){var m;return uu(u,function(T,O,W){return m=f(T,O,W),!m}),!!m}function Wf(u,f,m){var T=0,O=u==null?T:u.length;if(typeof f=="number"&&f===f&&O<=ht){for(;T<O;){var W=T+O>>>1,it=u[W];it!==null&&!os(it)&&(m?it<=f:it<f)?T=W+1:O=W}return O}return yd(u,f,Go,m)}function yd(u,f,m,T){var O=0,W=u==null?0:u.length;if(W===0)return 0;f=m(f);for(var it=f!==f,ct=f===null,mt=os(f),Ft=f===r;O<W;){var Ut=zr((O+W)/2),Vt=m(u[Ut]),ae=Vt!==r,xe=Vt===null,Re=Vt===Vt,Ye=os(Vt);if(it)var Le=T||Re;else Ft?Le=Re&&(T||ae):ct?Le=Re&&ae&&(T||!xe):mt?Le=Re&&ae&&!xe&&(T||!Ye):xe||Ye?Le=!1:Le=T?Vt<=f:Vt<f;Le?O=Ut+1:W=Ut}return mr(W,Y)}function Iy(u,f){for(var m=-1,T=u.length,O=0,W=[];++m<T;){var it=u[m],ct=f?f(it):it;if(!m||!Bs(ct,mt)){var mt=ct;W[O++]=it===0?0:it}}return W}function Ry(u){return typeof u=="number"?u:os(u)?Et:+u}function is(u){if(typeof u=="string")return u;if(ke(u))return xr(u,is)+"";if(os(u))return Ci?Ci.call(u):"";var f=u+"";return f=="0"&&1/u==-vt?"-0":f}function lu(u,f,m){var T=-1,O=Js,W=u.length,it=!0,ct=[],mt=ct;if(m)it=!1,O=zu;else if(W>=e){var Ft=f?null:db(u);if(Ft)return qr(Ft);it=!1,O=di,mt=new Hu}else mt=f?[]:ct;t:for(;++T<W;){var Ut=u[T],Vt=f?f(Ut):Ut;if(Ut=m||Ut!==0?Ut:0,it&&Vt===Vt){for(var ae=mt.length;ae--;)if(mt[ae]===Vt)continue t;f&&mt.push(Vt),ct.push(Ut)}else O(mt,Vt,m)||(mt!==ct&&mt.push(Vt),ct.push(Ut))}return ct}function vd(u,f){return f=cu(f,u),u=ov(u,f),u==null||delete u[la(Ss(f))]}function Ly(u,f,m,T){return Gc(u,f,m(Wu(u,f)),T)}function qf(u,f,m,T){for(var O=u.length,W=T?O:-1;(T?W--:++W<O)&&f(u[W],W,u););return m?Ms(u,T?0:W,T?W+1:O):Ms(u,T?W+1:0,T?O:W)}function Ny(u,f){var m=u;return m instanceof i&&(m=m.value()),Po(f,function(T,O){return O.func.apply(O.thisArg,Fe([T],O.args))},m)}function _d(u,f,m){var T=u.length;if(T<2)return T?lu(u[0]):[];for(var O=-1,W=Tt(T);++O<T;)for(var it=u[O],ct=-1;++ct<T;)ct!=O&&(W[O]=Uc(W[O]||it,u[ct],f,m));return lu(Wi(W,1),f,m)}function Oy(u,f,m){for(var T=-1,O=u.length,W=f.length,it={};++T<O;){var ct=T<W?f[T]:r;m(it,u[T],ct)}return it}function xd(u){return ni(u)?u:[]}function Ed(u){return typeof u=="function"?u:Go}function cu(u,f){return ke(u)?u:Id(u,f)?[u]:lv(ar(u))}var ib=Je;function fu(u,f,m){var T=u.length;return m=m===r?T:m,!f&&m>=T?u:Ms(u,f,m)}var Dy=Oc||function(u){return Ur.clearTimeout(u)};function Fy(u,f){if(f)return u.slice();var m=u.length,T=ho?ho(m):new u.constructor(m);return u.copy(T),T}function wd(u){var f=new u.constructor(u.byteLength);return new vs(f).set(new vs(u)),f}function ob(u,f){var m=f?wd(u.buffer):u.buffer;return new u.constructor(m,u.byteOffset,u.byteLength)}function sb(u){var f=new u.constructor(u.source,Zn.exec(u));return f.lastIndex=u.lastIndex,f}function ab(u){return au?or(au.call(u)):{}}function Uy(u,f){var m=f?wd(u.buffer):u.buffer;return new u.constructor(m,u.byteOffset,u.length)}function By(u,f){if(u!==f){var m=u!==r,T=u===null,O=u===u,W=os(u),it=f!==r,ct=f===null,mt=f===f,Ft=os(f);if(!ct&&!Ft&&!W&&u>f||W&&it&&mt&&!ct&&!Ft||T&&it&&mt||!m&&mt||!O)return 1;if(!T&&!W&&!Ft&&u<f||Ft&&m&&O&&!T&&!W||ct&&m&&O||!it&&O||!mt)return-1}return 0}function ub(u,f,m){for(var T=-1,O=u.criteria,W=f.criteria,it=O.length,ct=m.length;++T<it;){var mt=By(O[T],W[T]);if(mt){if(T>=ct)return mt;var Ft=m[T];return mt*(Ft=="desc"?-1:1)}}return u.index-f.index}function zy(u,f,m,T){for(var O=-1,W=u.length,it=m.length,ct=-1,mt=f.length,Ft=ei(W-it,0),Ut=Tt(mt+Ft),Vt=!T;++ct<mt;)Ut[ct]=f[ct];for(;++O<it;)(Vt||O<W)&&(Ut[m[O]]=u[O]);for(;Ft--;)Ut[ct++]=u[O++];return Ut}function Gy(u,f,m,T){for(var O=-1,W=u.length,it=-1,ct=m.length,mt=-1,Ft=f.length,Ut=ei(W-ct,0),Vt=Tt(Ut+Ft),ae=!T;++O<Ut;)Vt[O]=u[O];for(var xe=O;++mt<Ft;)Vt[xe+mt]=f[mt];for(;++it<ct;)(ae||O<W)&&(Vt[xe+m[it]]=u[O++]);return Vt}function Uo(u,f){var m=-1,T=u.length;for(f||(f=Tt(T));++m<T;)f[m]=u[m];return f}function ua(u,f,m,T){var O=!m;m||(m={});for(var W=-1,it=f.length;++W<it;){var ct=f[W],mt=T?T(m[ct],u[ct],ct,m,u):r;mt===r&&(mt=u[ct]),O?Pa(m,ct,mt):Fc(m,ct,mt)}return m}function lb(u,f){return ua(u,Pd(u),f)}function cb(u,f){return ua(u,jy(u),f)}function Xf(u,f){return function(m,T){var O=ke(m)?Of:LS,W=f?f():{};return O(m,u,Pe(T,2),W)}}function Ml(u){return Je(function(f,m){var T=-1,O=m.length,W=O>1?m[O-1]:r,it=O>2?m[2]:r;for(W=u.length>3&&typeof W=="function"?(O--,W):r,it&&mo(m[0],m[1],it)&&(W=O<3?r:W,O=1),f=or(f);++T<O;){var ct=m[T];ct&&u(f,ct,T,W)}return f})}function ky(u,f){return function(m,T){if(m==null)return m;if(!Bo(m))return u(m,T);for(var O=m.length,W=f?O:-1,it=or(m);(f?W--:++W<O)&&T(it[W],W,it)!==!1;);return m}}function Hy(u){return function(f,m,T){for(var O=-1,W=or(f),it=T(f),ct=it.length;ct--;){var mt=it[u?ct:++O];if(m(W[mt],mt,W)===!1)break}return f}}function fb(u,f,m){var T=f&P,O=kc(u);function W(){var it=this&&this!==Ur&&this instanceof W?O:u;return it.apply(T?m:this,arguments)}return W}function Vy(u){return function(f){f=ar(f);var m=Ma(f)?Ro(f):r,T=m?m[0]:f.charAt(0),O=m?fu(m,1).join(""):f.slice(1);return T[u]()+O}}function Sl(u){return function(f){return Po(kv(Gv(f).replace(To,"")),u,"")}}function kc(u){return function(){var f=arguments;switch(f.length){case 0:return new u;case 1:return new u(f[0]);case 2:return new u(f[0],f[1]);case 3:return new u(f[0],f[1],f[2]);case 4:return new u(f[0],f[1],f[2],f[3]);case 5:return new u(f[0],f[1],f[2],f[3],f[4]);case 6:return new u(f[0],f[1],f[2],f[3],f[4],f[5]);case 7:return new u(f[0],f[1],f[2],f[3],f[4],f[5],f[6])}var m=Ca(u.prototype),T=u.apply(m,f);return Gr(T)?T:m}}function hb(u,f,m){var T=kc(u);function O(){for(var W=arguments.length,it=Tt(W),ct=W,mt=bl(O);ct--;)it[ct]=arguments[ct];var Ft=W<3&&it[0]!==mt&&it[W-1]!==mt?[]:Ns(it,mt);if(W-=Ft.length,W<m)return $y(u,f,Yf,O.placeholder,r,it,Ft,r,r,m-W);var Ut=this&&this!==Ur&&this instanceof O?T:u;return ne(Ut,this,it)}return O}function Wy(u){return function(f,m,T){var O=or(f);if(!Bo(f)){var W=Pe(m,3);f=Pi(f),m=function(ct){return W(O[ct],ct,O)}}var it=u(f,m,T);return it>-1?O[W?f[it]:it]:r}}function qy(u){return Ra(function(f){var m=f.length,T=m,O=n.prototype.thru;for(u&&f.reverse();T--;){var W=f[T];if(typeof W!="function")throw new Jn(a);if(O&&!it&&Kf(W)=="wrapper")var it=new n([],!0)}for(T=it?T:m;++T<m;){W=f[T];var ct=Kf(W),mt=ct=="wrapper"?Ad(W):r;mt&&Rd(mt[0])&&mt[1]==(z|E|A|$)&&!mt[4].length&&mt[9]==1?it=it[Kf(mt[0])].apply(it,mt[3]):it=W.length==1&&Rd(W)?it[ct]():it.thru(W)}return function(){var Ft=arguments,Ut=Ft[0];if(it&&Ft.length==1&&ke(Ut))return it.plant(Ut).value();for(var Vt=0,ae=m?f[Vt].apply(this,Ft):Ut;++Vt<m;)ae=f[Vt].call(this,ae);return ae}})}function Yf(u,f,m,T,O,W,it,ct,mt,Ft){var Ut=f&z,Vt=f&P,ae=f&I,xe=f&(E|N),Re=f&q,Ye=ae?r:kc(u);function Le(){for(var Pn=arguments.length,Hn=Tt(Pn),ss=Pn;ss--;)Hn[ss]=arguments[ss];if(xe)var yo=bl(Le),as=Io(Hn,yo);if(T&&(Hn=zy(Hn,T,O,xe)),W&&(Hn=Gy(Hn,W,it,xe)),Pn-=as,xe&&Pn<Ft){var ri=Ns(Hn,yo);return $y(u,f,Yf,Le.placeholder,m,Hn,ri,ct,mt,Ft-Pn)}var zs=Vt?m:this,Da=ae?zs[u]:u;return Pn=Hn.length,ct?Hn=Lb(Hn,ct):Re&&Pn>1&&Hn.reverse(),Ut&&mt<Pn&&(Hn.length=mt),this&&this!==Ur&&this instanceof Le&&(Da=Ye||kc(Da)),Da.apply(zs,Hn)}return Le}function Xy(u,f){return function(m,T){return GS(m,u,f(T),{})}}function $f(u,f){return function(m,T){var O;if(m===r&&T===r)return f;if(m!==r&&(O=m),T!==r){if(O===r)return T;typeof m=="string"||typeof T=="string"?(m=is(m),T=is(T)):(m=Ry(m),T=Ry(T)),O=u(m,T)}return O}}function Md(u){return Ra(function(f){return f=xr(f,ji(Pe())),Je(function(m){var T=this;return u(f,function(O){return ne(O,T,m)})})})}function Zf(u,f){f=f===r?" ":is(f);var m=f.length;if(m<2)return m?md(f,u):f;var T=md(f,br(u/Sa(f)));return Ma(f)?fu(Ro(T),0,u).join(""):T.slice(0,u)}function pb(u,f,m,T){var O=f&P,W=kc(u);function it(){for(var ct=-1,mt=arguments.length,Ft=-1,Ut=T.length,Vt=Tt(Ut+mt),ae=this&&this!==Ur&&this instanceof it?W:u;++Ft<Ut;)Vt[Ft]=T[Ft];for(;mt--;)Vt[Ft++]=arguments[++ct];return ne(ae,O?m:this,Vt)}return it}function Yy(u){return function(f,m,T){return T&&typeof T!="number"&&mo(f,m,T)&&(m=T=r),f=Oa(f),m===r?(m=f,f=0):m=Oa(m),T=T===r?f<m?1:-1:Oa(T),QS(f,m,T,u)}}function Jf(u){return function(f,m){return typeof f=="string"&&typeof m=="string"||(f=bs(f),m=bs(m)),u(f,m)}}function $y(u,f,m,T,O,W,it,ct,mt,Ft){var Ut=f&E,Vt=Ut?it:r,ae=Ut?r:it,xe=Ut?W:r,Re=Ut?r:W;f|=Ut?A:U,f&=~(Ut?U:A),f&M||(f&=~(P|I));var Ye=[u,f,O,xe,Vt,Re,ae,ct,mt,Ft],Le=m.apply(r,Ye);return Rd(u)&&sv(Le,Ye),Le.placeholder=T,av(Le,u,f)}function Sd(u){var f=tn[u];return function(m,T){if(m=bs(m),T=T==null?0:mr(qe(T),292),T&&El(m)){var O=(ar(m)+"e").split("e"),W=f(O[0]+"e"+(+O[1]+T));return O=(ar(W)+"e").split("e"),+(O[0]+"e"+(+O[1]-T))}return f(m)}}var db=na&&1/qr(new na([,-0]))[1]==vt?function(u){return new na(u)}:Xd;function Zy(u){return function(f){var m=to(f);return m==ft?Qo(f):m==kt?Uf(f):jr(f,u(f))}}function Ia(u,f,m,T,O,W,it,ct){var mt=f&I;if(!mt&&typeof u!="function")throw new Jn(a);var Ft=T?T.length:0;if(Ft||(f&=~(A|U),T=O=r),it=it===r?it:ei(qe(it),0),ct=ct===r?ct:qe(ct),Ft-=O?O.length:0,f&U){var Ut=T,Vt=O;T=O=r}var ae=mt?r:Ad(u),xe=[u,f,m,T,O,Ut,Vt,W,it,ct];if(ae&&Pb(xe,ae),u=xe[0],f=xe[1],m=xe[2],T=xe[3],O=xe[4],ct=xe[9]=xe[9]===r?mt?0:u.length:ei(xe[9]-Ft,0),!ct&&f&(E|N)&&(f&=~(E|N)),!f||f==P)var Re=fb(u,f,m);else f==E||f==N?Re=hb(u,f,ct):(f==A||f==(P|A))&&!O.length?Re=pb(u,f,m,T):Re=Yf.apply(r,xe);var Ye=ae?Py:sv;return av(Ye(Re,xe),u,f)}function Jy(u,f,m,T){return u===r||Bs(u,ti[m])&&!Ze.call(T,m)?f:u}function Ky(u,f,m,T,O,W){return Gr(u)&&Gr(f)&&(W.set(f,u),Vf(u,f,r,Ky,W),W.delete(f)),u}function gb(u){return Wc(u)?r:u}function Qy(u,f,m,T,O,W){var it=m&x,ct=u.length,mt=f.length;if(ct!=mt&&!(it&&mt>ct))return!1;var Ft=W.get(u),Ut=W.get(f);if(Ft&&Ut)return Ft==f&&Ut==u;var Vt=-1,ae=!0,xe=m&b?new Hu:r;for(W.set(u,f),W.set(f,u);++Vt<ct;){var Re=u[Vt],Ye=f[Vt];if(T)var Le=it?T(Ye,Re,Vt,f,u,W):T(Re,Ye,Vt,u,f,W);if(Le!==r){if(Le)continue;ae=!1;break}if(xe){if(!wa(f,function(Pn,Hn){if(!di(xe,Hn)&&(Re===Pn||O(Re,Pn,m,T,W)))return xe.push(Hn)})){ae=!1;break}}else if(!(Re===Ye||O(Re,Ye,m,T,W))){ae=!1;break}}return W.delete(u),W.delete(f),ae}function mb(u,f,m,T,O,W,it){switch(m){case Wt:if(u.byteLength!=f.byteLength||u.byteOffset!=f.byteOffset)return!1;u=u.buffer,f=f.buffer;case rt:return!(u.byteLength!=f.byteLength||!W(new vs(u),new vs(f)));case ue:case le:case He:return Bs(+u,+f);case me:return u.name==f.name&&u.message==f.message;case be:case ye:return u==f+"";case ft:var ct=Qo;case kt:var mt=T&x;if(ct||(ct=qr),u.size!=f.size&&!mt)return!1;var Ft=it.get(u);if(Ft)return Ft==f;T|=b,it.set(u,f);var Ut=Qy(ct(u),ct(f),T,O,W,it);return it.delete(u),Ut;case Vn:if(au)return au.call(u)==au.call(f)}return!1}function yb(u,f,m,T,O,W){var it=m&x,ct=bd(u),mt=ct.length,Ft=bd(f),Ut=Ft.length;if(mt!=Ut&&!it)return!1;for(var Vt=mt;Vt--;){var ae=ct[Vt];if(!(it?ae in f:Ze.call(f,ae)))return!1}var xe=W.get(u),Re=W.get(f);if(xe&&Re)return xe==f&&Re==u;var Ye=!0;W.set(u,f),W.set(f,u);for(var Le=it;++Vt<mt;){ae=ct[Vt];var Pn=u[ae],Hn=f[ae];if(T)var ss=it?T(Hn,Pn,ae,f,u,W):T(Pn,Hn,ae,u,f,W);if(!(ss===r?Pn===Hn||O(Pn,Hn,m,T,W):ss)){Ye=!1;break}Le||(Le=ae=="constructor")}if(Ye&&!Le){var yo=u.constructor,as=f.constructor;yo!=as&&"constructor"in u&&"constructor"in f&&!(typeof yo=="function"&&yo instanceof yo&&typeof as=="function"&&as instanceof as)&&(Ye=!1)}return W.delete(u),W.delete(f),Ye}function Ra(u){return Nd(iv(u,r,pv),u+"")}function bd(u){return vy(u,Pi,Pd)}function Td(u){return vy(u,zo,jy)}var Ad=ra?function(u){return ra.get(u)}:Xd;function Kf(u){for(var f=u.name+"",m=ns[f],T=Ze.call(ns,f)?m.length:0;T--;){var O=m[T],W=O.func;if(W==null||W==u)return O.name}return f}function bl(u){var f=Ze.call(B,"placeholder")?B:u;return f.placeholder}function Pe(){var u=B.iteratee||Wd;return u=u===Wd?Ey:u,arguments.length?u(arguments[0],arguments[1]):u}function Qf(u,f){var m=u.__data__;return bb(f)?m[typeof f=="string"?"string":"hash"]:m.map}function Cd(u){for(var f=Pi(u),m=f.length;m--;){var T=f[m],O=u[T];f[m]=[T,O,nv(O)]}return f}function qu(u,f){var m=Wr(u,f);return xy(m)?m:r}function vb(u){var f=Ze.call(u,Sr),m=u[Sr];try{u[Sr]=r;var T=!0}catch(W){}var O=Cr.call(u);return T&&(f?u[Sr]=m:delete u[Sr]),O}var Pd=Aa?function(u){return u==null?[]:(u=or(u),zi(Aa(u),function(f){return Oo.call(u,f)}))}:Yd,jy=Aa?function(u){for(var f=[];u;)Fe(f,Pd(u)),u=_s(u);return f}:Yd,to=go;(po&&to(new po(new ArrayBuffer(1)))!=Wt||xs&&to(new xs)!=ft||ea&&to(ea.resolve())!=de||na&&to(new na)!=kt||Es&&to(new Es)!=j)&&(to=function(u){var f=go(u),m=f==fe?u.constructor:r,T=m?Xu(m):"";if(T)switch(T){case ia:return Wt;case Ae:return ft;case Ds:return de;case su:return kt;case oa:return j}return f});function _b(u,f,m){for(var T=-1,O=m.length;++T<O;){var W=m[T],it=W.size;switch(W.type){case"drop":u+=it;break;case"dropRight":f-=it;break;case"take":f=mr(f,u+it);break;case"takeRight":u=ei(u,f-it);break}}return{start:u,end:f}}function xb(u){var f=u.match(Rr);return f?f[1].split(er):[]}function tv(u,f,m){f=cu(f,u);for(var T=-1,O=f.length,W=!1;++T<O;){var it=la(f[T]);if(!(W=u!=null&&m(u,it)))break;u=u[it]}return W||++T!=O?W:(O=u==null?0:u.length,!!O&&oh(O)&&La(it,O)&&(ke(u)||Yu(u)))}function Eb(u){var f=u.length,m=new u.constructor(f);return f&&typeof u[0]=="string"&&Ze.call(u,"index")&&(m.index=u.index,m.input=u.input),m}function ev(u){return typeof u.constructor=="function"&&!Hc(u)?Ca(_s(u)):{}}function wb(u,f,m){var T=u.constructor;switch(f){case rt:return wd(u);case ue:case le:return new T(+u);case Wt:return ob(u,m);case Gt:case Ct:case he:case Kt:case tt:case C:case L:case F:case J:return Uy(u,m);case ft:return new T;case He:case ye:return new T(u);case be:return sb(u);case kt:return new T;case Vn:return ab(u)}}function Mb(u,f){var m=f.length;if(!m)return u;var T=m-1;return f[T]=(m>1?"& ":"")+f[T],f=f.join(m>2?", ":" "),u.replace(wr,\`{
110
110
  /* [wrapped with \`+f+\`] */
111
111
  \`)}function Sb(u){return ke(u)||Yu(u)||!!(Nc&&u&&u[Nc])}function La(u,f){var m=typeof u;return f=f==null?It:f,!!f&&(m=="number"||m!="symbol"&&Ot.test(u))&&u>-1&&u%1==0&&u<f}function mo(u,f,m){if(!Gr(m))return!1;var T=typeof f;return(T=="number"?Bo(m)&&La(f,m.length):T=="string"&&f in m)?Bs(m[f],u):!1}function Id(u,f){if(ke(u))return!1;var m=typeof u;return m=="number"||m=="symbol"||m=="boolean"||u==null||os(u)?!0:we.test(u)||!qt.test(u)||f!=null&&u in or(f)}function bb(u){var f=typeof u;return f=="string"||f=="number"||f=="symbol"||f=="boolean"?u!=="__proto__":u===null}function Rd(u){var f=Kf(u),m=B[f];if(typeof m!="function"||!(f in i.prototype))return!1;if(u===m)return!0;var T=Ad(m);return!!T&&u===T[0]}function Tb(u){return!!xl&&xl in u}var Ab=iu?Na:$d;function Hc(u){var f=u&&u.constructor,m=typeof f=="function"&&f.prototype||ti;return u===m}function nv(u){return u===u&&!Gr(u)}function rv(u,f){return function(m){return m==null?!1:m[u]===f&&(f!==r||u in or(m))}}function Cb(u){var f=rh(u,function(T){return m.size===d&&m.clear(),T}),m=f.cache;return f}function Pb(u,f){var m=u[1],T=f[1],O=m|T,W=O<(P|I|z),it=T==z&&m==E||T==z&&m==$&&u[7].length<=f[8]||T==(z|$)&&f[7].length<=f[8]&&m==E;if(!(W||it))return u;T&P&&(u[2]=f[2],O|=m&P?0:M);var ct=f[3];if(ct){var mt=u[3];u[3]=mt?zy(mt,ct,f[4]):ct,u[4]=mt?Ns(u[3],g):f[4]}return ct=f[5],ct&&(mt=u[5],u[5]=mt?Gy(mt,ct,f[6]):ct,u[6]=mt?Ns(u[5],g):f[6]),ct=f[7],ct&&(u[7]=ct),T&z&&(u[8]=u[8]==null?f[8]:mr(u[8],f[8])),u[9]==null&&(u[9]=f[9]),u[0]=f[0],u[1]=O,u}function Ib(u){var f=[];if(u!=null)for(var m in or(u))f.push(m);return f}function Rb(u){return Cr.call(u)}function iv(u,f,m){return f=ei(f===r?u.length-1:f,0),function(){for(var T=arguments,O=-1,W=ei(T.length-f,0),it=Tt(W);++O<W;)it[O]=T[f+O];O=-1;for(var ct=Tt(f+1);++O<f;)ct[O]=T[O];return ct[f]=m(it),ne(u,this,ct)}}function ov(u,f){return f.length<2?u:Wu(u,Ms(f,0,-1))}function Lb(u,f){for(var m=u.length,T=mr(f.length,m),O=Uo(u);T--;){var W=f[T];u[T]=La(W,m)?O[W]:r}return u}function Ld(u,f){if(!(f==="constructor"&&typeof u[f]=="function")&&f!="__proto__")return u[f]}var sv=uv(Py),Vc=Os||function(u,f){return Ur.setTimeout(u,f)},Nd=uv(eb);function av(u,f,m){var T=f+"";return Nd(u,Mb(T,Nb(xb(T),m)))}function uv(u){var f=0,m=0;return function(){var T=Bf(),O=_t-(T-m);if(m=T,O>0){if(++f>=Q)return arguments[0]}else f=0;return u.apply(r,arguments)}}function jf(u,f){var m=-1,T=u.length,O=T-1;for(f=f===r?T:f;++m<f;){var W=gd(m,O),it=u[W];u[W]=u[m],u[m]=it}return u.length=f,u}var lv=Cb(function(u){var f=[];return u.charCodeAt(0)===46&&f.push(""),u.replace(oe,function(m,T,O,W){f.push(O?W.replace(hr,"$1"):T||m)}),f});function la(u){if(typeof u=="string"||os(u))return u;var f=u+"";return f=="0"&&1/u==-vt?"-0":f}function Xu(u){if(u!=null){try{return ys.call(u)}catch(f){}try{return u+""}catch(f){}}return""}function Nb(u,f){return wi(Mt,function(m){var T="_."+m[0];f&m[1]&&!Js(u,T)&&u.push(T)}),u.sort()}function cv(u){if(u instanceof i)return u.clone();var f=new n(u.__wrapped__,u.__chain__);return f.__actions__=Uo(u.__actions__),f.__index__=u.__index__,f.__values__=u.__values__,f}function Ob(u,f,m){(m?mo(u,f,m):f===r)?f=1:f=ei(qe(f),0);var T=u==null?0:u.length;if(!T||f<1)return[];for(var O=0,W=0,it=Tt(br(T/f));O<T;)it[W++]=Ms(u,O,O+=f);return it}function Db(u){for(var f=-1,m=u==null?0:u.length,T=0,O=[];++f<m;){var W=u[f];W&&(O[T++]=W)}return O}function Fb(){var u=arguments.length;if(!u)return[];for(var f=Tt(u-1),m=arguments[0],T=u;T--;)f[T-1]=arguments[T];return Fe(ke(m)?Uo(m):[m],Wi(f,1))}var Ub=Je(function(u,f){return ni(u)?Uc(u,Wi(f,1,ni,!0)):[]}),Bb=Je(function(u,f){var m=Ss(f);return ni(m)&&(m=r),ni(u)?Uc(u,Wi(f,1,ni,!0),Pe(m,2)):[]}),zb=Je(function(u,f){var m=Ss(f);return ni(m)&&(m=r),ni(u)?Uc(u,Wi(f,1,ni,!0),r,m):[]});function Gb(u,f,m){var T=u==null?0:u.length;return T?(f=m||f===r?1:qe(f),Ms(u,f<0?0:f,T)):[]}function kb(u,f,m){var T=u==null?0:u.length;return T?(f=m||f===r?1:qe(f),f=T-f,Ms(u,0,f<0?0:f)):[]}function Hb(u,f){return u&&u.length?qf(u,Pe(f,3),!0,!0):[]}function Vb(u,f){return u&&u.length?qf(u,Pe(f,3),!0):[]}function Wb(u,f,m,T){var O=u==null?0:u.length;return O?(m&&typeof m!="number"&&mo(u,f,m)&&(m=0,T=O),FS(u,f,m,T)):[]}function fv(u,f,m){var T=u==null?0:u.length;if(!T)return-1;var O=m==null?0:qe(m);return O<0&&(O=ei(T+O,0)),qn(u,Pe(f,3),O)}function hv(u,f,m){var T=u==null?0:u.length;if(!T)return-1;var O=T-1;return m!==r&&(O=qe(m),O=m<0?ei(T+O,0):mr(O,T-1)),qn(u,Pe(f,3),O,!0)}function pv(u){var f=u==null?0:u.length;return f?Wi(u,1):[]}function qb(u){var f=u==null?0:u.length;return f?Wi(u,vt):[]}function Xb(u,f){var m=u==null?0:u.length;return m?(f=f===r?1:qe(f),Wi(u,f)):[]}function Yb(u){for(var f=-1,m=u==null?0:u.length,T={};++f<m;){var O=u[f];T[O[0]]=O[1]}return T}function dv(u){return u&&u.length?u[0]:r}function $b(u,f,m){var T=u==null?0:u.length;if(!T)return-1;var O=m==null?0:qe(m);return O<0&&(O=ei(T+O,0)),ds(u,f,O)}function Zb(u){var f=u==null?0:u.length;return f?Ms(u,0,-1):[]}var Jb=Je(function(u){var f=xr(u,xd);return f.length&&f[0]===u[0]?cd(f):[]}),Kb=Je(function(u){var f=Ss(u),m=xr(u,xd);return f===Ss(m)?f=r:m.pop(),m.length&&m[0]===u[0]?cd(m,Pe(f,2)):[]}),Qb=Je(function(u){var f=Ss(u),m=xr(u,xd);return f=typeof f=="function"?f:r,f&&m.pop(),m.length&&m[0]===u[0]?cd(m,r,f):[]});function jb(u,f){return u==null?"":wl.call(u,f)}function Ss(u){var f=u==null?0:u.length;return f?u[f-1]:r}function tT(u,f,m){var T=u==null?0:u.length;if(!T)return-1;var O=T;return m!==r&&(O=qe(m),O=O<0?ei(T+O,0):mr(O,T-1)),f===f?nu(u,f,O):qn(u,Qs,O,!0)}function eT(u,f){return u&&u.length?by(u,qe(f)):r}var nT=Je(gv);function gv(u,f){return u&&u.length&&f&&f.length?dd(u,f):u}function rT(u,f,m){return u&&u.length&&f&&f.length?dd(u,f,Pe(m,2)):u}function iT(u,f,m){return u&&u.length&&f&&f.length?dd(u,f,r,m):u}var oT=Ra(function(u,f){var m=u==null?0:u.length,T=sd(u,f);return Cy(u,xr(f,function(O){return La(O,m)?+O:O}).sort(By)),T});function sT(u,f){var m=[];if(!(u&&u.length))return m;var T=-1,O=[],W=u.length;for(f=Pe(f,3);++T<W;){var it=u[T];f(it,T,u)&&(m.push(it),O.push(T))}return Cy(u,O),m}function Od(u){return u==null?u:id.call(u)}function aT(u,f,m){var T=u==null?0:u.length;return T?(m&&typeof m!="number"&&mo(u,f,m)?(f=0,m=T):(f=f==null?0:qe(f),m=m===r?T:qe(m)),Ms(u,f,m)):[]}function uT(u,f){return Wf(u,f)}function lT(u,f,m){return yd(u,f,Pe(m,2))}function cT(u,f){var m=u==null?0:u.length;if(m){var T=Wf(u,f);if(T<m&&Bs(u[T],f))return T}return-1}function fT(u,f){return Wf(u,f,!0)}function hT(u,f,m){return yd(u,f,Pe(m,2),!0)}function pT(u,f){var m=u==null?0:u.length;if(m){var T=Wf(u,f,!0)-1;if(Bs(u[T],f))return T}return-1}function dT(u){return u&&u.length?Iy(u):[]}function gT(u,f){return u&&u.length?Iy(u,Pe(f,2)):[]}function mT(u){var f=u==null?0:u.length;return f?Ms(u,1,f):[]}function yT(u,f,m){return u&&u.length?(f=m||f===r?1:qe(f),Ms(u,0,f<0?0:f)):[]}function vT(u,f,m){var T=u==null?0:u.length;return T?(f=m||f===r?1:qe(f),f=T-f,Ms(u,f<0?0:f,T)):[]}function _T(u,f){return u&&u.length?qf(u,Pe(f,3),!1,!0):[]}function xT(u,f){return u&&u.length?qf(u,Pe(f,3)):[]}var ET=Je(function(u){return lu(Wi(u,1,ni,!0))}),wT=Je(function(u){var f=Ss(u);return ni(f)&&(f=r),lu(Wi(u,1,ni,!0),Pe(f,2))}),MT=Je(function(u){var f=Ss(u);return f=typeof f=="function"?f:r,lu(Wi(u,1,ni,!0),r,f)});function ST(u){return u&&u.length?lu(u):[]}function bT(u,f){return u&&u.length?lu(u,Pe(f,2)):[]}function TT(u,f){return f=typeof f=="function"?f:r,u&&u.length?lu(u,r,f):[]}function Dd(u){if(!(u&&u.length))return[];var f=0;return u=zi(u,function(m){if(ni(m))return f=ei(m.length,f),!0}),pi(f,function(m){return xr(u,gs(m))})}function mv(u,f){if(!(u&&u.length))return[];var m=Dd(u);return f==null?m:xr(m,function(T){return ne(f,r,T)})}var AT=Je(function(u,f){return ni(u)?Uc(u,f):[]}),CT=Je(function(u){return _d(zi(u,ni))}),PT=Je(function(u){var f=Ss(u);return ni(f)&&(f=r),_d(zi(u,ni),Pe(f,2))}),IT=Je(function(u){var f=Ss(u);return f=typeof f=="function"?f:r,_d(zi(u,ni),r,f)}),RT=Je(Dd);function LT(u,f){return Oy(u||[],f||[],Fc)}function NT(u,f){return Oy(u||[],f||[],Gc)}var OT=Je(function(u){var f=u.length,m=f>1?u[f-1]:r;return m=typeof m=="function"?(u.pop(),m):r,mv(u,m)});function yv(u){var f=B(u);return f.__chain__=!0,f}function DT(u,f){return f(u),u}function th(u,f){return f(u)}var FT=Ra(function(u){var f=u.length,m=f?u[0]:0,T=this.__wrapped__,O=function(W){return sd(W,u)};return f>1||this.__actions__.length||!(T instanceof i)||!La(m)?this.thru(O):(T=T.slice(m,+m+(f?1:0)),T.__actions__.push({func:th,args:[O],thisArg:r}),new n(T,this.__chain__).thru(function(W){return f&&!W.length&&W.push(r),W}))});function UT(){return yv(this)}function BT(){return new n(this.value(),this.__chain__)}function zT(){this.__values__===r&&(this.__values__=Rv(this.value()));var u=this.__index__>=this.__values__.length,f=u?r:this.__values__[this.__index__++];return{done:u,value:f}}function GT(){return this}function kT(u){for(var f,m=this;m instanceof sa;){var T=cv(m);T.__index__=0,T.__values__=r,f?O.__wrapped__=T:f=T;var O=T;m=m.__wrapped__}return O.__wrapped__=u,f}function HT(){var u=this.__wrapped__;if(u instanceof i){var f=u;return this.__actions__.length&&(f=new i(this)),f=f.reverse(),f.__actions__.push({func:th,args:[Od],thisArg:r}),new n(f,this.__chain__)}return this.thru(Od)}function VT(){return Ny(this.__wrapped__,this.__actions__)}var WT=Xf(function(u,f,m){Ze.call(u,m)?++u[m]:Pa(u,m,1)});function qT(u,f,m){var T=ke(u)?lo:DS;return m&&mo(u,f,m)&&(f=r),T(u,Pe(f,3))}function XT(u,f){var m=ke(u)?zi:my;return m(u,Pe(f,3))}var YT=Wy(fv),$T=Wy(hv);function ZT(u,f){return Wi(eh(u,f),1)}function JT(u,f){return Wi(eh(u,f),vt)}function KT(u,f,m){return m=m===r?1:qe(m),Wi(eh(u,f),m)}function vv(u,f){var m=ke(u)?wi:uu;return m(u,Pe(f,3))}function _v(u,f){var m=ke(u)?Mi:gy;return m(u,Pe(f,3))}var QT=Xf(function(u,f,m){Ze.call(u,m)?u[m].push(f):Pa(u,m,[f])});function jT(u,f,m,T){u=Bo(u)?u:Al(u),m=m&&!T?qe(m):0;var O=u.length;return m<0&&(m=ei(O+m,0)),sh(u)?m<=O&&u.indexOf(f,m)>-1:!!O&&ds(u,f,m)>-1}var tA=Je(function(u,f,m){var T=-1,O=typeof f=="function",W=Bo(u)?Tt(u.length):[];return uu(u,function(it){W[++T]=O?ne(f,it,m):Bc(it,f,m)}),W}),eA=Xf(function(u,f,m){Pa(u,m,f)});function eh(u,f){var m=ke(u)?xr:wy;return m(u,Pe(f,3))}function nA(u,f,m,T){return u==null?[]:(ke(f)||(f=f==null?[]:[f]),m=T?r:m,ke(m)||(m=m==null?[]:[m]),Ty(u,f,m))}var rA=Xf(function(u,f,m){u[m?0:1].push(f)},function(){return[[],[]]});function iA(u,f,m){var T=ke(u)?Po:ki,O=arguments.length<3;return T(u,Pe(f,4),m,O,uu)}function oA(u,f,m){var T=ke(u)?gr:ki,O=arguments.length<3;return T(u,Pe(f,4),m,O,gy)}function sA(u,f){var m=ke(u)?zi:my;return m(u,ih(Pe(f,3)))}function aA(u){var f=ke(u)?fy:jS;return f(u)}function uA(u,f,m){(m?mo(u,f,m):f===r)?f=1:f=qe(f);var T=ke(u)?IS:tb;return T(u,f)}function lA(u){var f=ke(u)?RS:nb;return f(u)}function cA(u){if(u==null)return 0;if(Bo(u))return sh(u)?Sa(u):u.length;var f=to(u);return f==ft||f==kt?u.size:hd(u).length}function fA(u,f,m){var T=ke(u)?wa:rb;return m&&mo(u,f,m)&&(f=r),T(u,Pe(f,3))}var hA=Je(function(u,f){if(u==null)return[];var m=f.length;return m>1&&mo(u,f[0],f[1])?f=[]:m>2&&mo(f[0],f[1],f[2])&&(f=[f[0]]),Ty(u,Wi(f,1),[])}),nh=Ta||function(){return Ur.Date.now()};function pA(u,f){if(typeof f!="function")throw new Jn(a);return u=qe(u),function(){if(--u<1)return f.apply(this,arguments)}}function xv(u,f,m){return f=m?r:f,f=u&&f==null?u.length:f,Ia(u,z,r,r,r,r,f)}function Ev(u,f){var m;if(typeof f!="function")throw new Jn(a);return u=qe(u),function(){return--u>0&&(m=f.apply(this,arguments)),u<=1&&(f=r),m}}var Fd=Je(function(u,f,m){var T=P;if(m.length){var O=Ns(m,bl(Fd));T|=A}return Ia(u,T,f,m,O)}),wv=Je(function(u,f,m){var T=P|I;if(m.length){var O=Ns(m,bl(wv));T|=A}return Ia(f,T,u,m,O)});function Mv(u,f,m){f=m?r:f;var T=Ia(u,E,r,r,r,r,r,f);return T.placeholder=Mv.placeholder,T}function Sv(u,f,m){f=m?r:f;var T=Ia(u,N,r,r,r,r,r,f);return T.placeholder=Sv.placeholder,T}function bv(u,f,m){var T,O,W,it,ct,mt,Ft=0,Ut=!1,Vt=!1,ae=!0;if(typeof u!="function")throw new Jn(a);f=bs(f)||0,Gr(m)&&(Ut=!!m.leading,Vt="maxWait"in m,W=Vt?ei(bs(m.maxWait)||0,f):W,ae="trailing"in m?!!m.trailing:ae);function xe(ri){var zs=T,Da=O;return T=O=r,Ft=ri,it=u.apply(Da,zs),it}function Re(ri){return Ft=ri,ct=Vc(Pn,f),Ut?xe(ri):it}function Ye(ri){var zs=ri-mt,Da=ri-Ft,Wv=f-zs;return Vt?mr(Wv,W-Da):Wv}function Le(ri){var zs=ri-mt,Da=ri-Ft;return mt===r||zs>=f||zs<0||Vt&&Da>=W}function Pn(){var ri=nh();if(Le(ri))return Hn(ri);ct=Vc(Pn,Ye(ri))}function Hn(ri){return ct=r,ae&&T?xe(ri):(T=O=r,it)}function ss(){ct!==r&&Dy(ct),Ft=0,T=mt=O=ct=r}function yo(){return ct===r?it:Hn(nh())}function as(){var ri=nh(),zs=Le(ri);if(T=arguments,O=this,mt=ri,zs){if(ct===r)return Re(mt);if(Vt)return Dy(ct),ct=Vc(Pn,f),xe(mt)}return ct===r&&(ct=Vc(Pn,f)),it}return as.cancel=ss,as.flush=yo,as}var dA=Je(function(u,f){return dy(u,1,f)}),gA=Je(function(u,f,m){return dy(u,bs(f)||0,m)});function mA(u){return Ia(u,q)}function rh(u,f){if(typeof u!="function"||f!=null&&typeof f!="function")throw new Jn(a);var m=function(){var T=arguments,O=f?f.apply(this,T):T[0],W=m.cache;if(W.has(O))return W.get(O);var it=u.apply(this,T);return m.cache=W.set(O,it)||W,it};return m.cache=new(rh.Cache||Xn),m}rh.Cache=Xn;function ih(u){if(typeof u!="function")throw new Jn(a);return function(){var f=arguments;switch(f.length){case 0:return!u.call(this);case 1:return!u.call(this,f[0]);case 2:return!u.call(this,f[0],f[1]);case 3:return!u.call(this,f[0],f[1],f[2])}return!u.apply(this,f)}}function yA(u){return Ev(2,u)}var vA=ib(function(u,f){f=f.length==1&&ke(f[0])?xr(f[0],ji(Pe())):xr(Wi(f,1),ji(Pe()));var m=f.length;return Je(function(T){for(var O=-1,W=mr(T.length,m);++O<W;)T[O]=f[O].call(this,T[O]);return ne(u,this,T)})}),Ud=Je(function(u,f){var m=Ns(f,bl(Ud));return Ia(u,A,r,f,m)}),Tv=Je(function(u,f){var m=Ns(f,bl(Tv));return Ia(u,U,r,f,m)}),_A=Ra(function(u,f){return Ia(u,$,r,r,r,f)});function xA(u,f){if(typeof u!="function")throw new Jn(a);return f=f===r?f:qe(f),Je(u,f)}function EA(u,f){if(typeof u!="function")throw new Jn(a);return f=f==null?0:ei(qe(f),0),Je(function(m){var T=m[f],O=fu(m,0,f);return T&&Fe(O,T),ne(u,this,O)})}function wA(u,f,m){var T=!0,O=!0;if(typeof u!="function")throw new Jn(a);return Gr(m)&&(T="leading"in m?!!m.leading:T,O="trailing"in m?!!m.trailing:O),bv(u,f,{leading:T,maxWait:f,trailing:O})}function MA(u){return xv(u,1)}function SA(u,f){return Ud(Ed(f),u)}function bA(){if(!arguments.length)return[];var u=arguments[0];return ke(u)?u:[u]}function TA(u){return ws(u,w)}function AA(u,f){return f=typeof f=="function"?f:r,ws(u,w,f)}function CA(u){return ws(u,y|w)}function PA(u,f){return f=typeof f=="function"?f:r,ws(u,y|w,f)}function IA(u,f){return f==null||py(u,f,Pi(f))}function Bs(u,f){return u===f||u!==u&&f!==f}var RA=Jf(ld),LA=Jf(function(u,f){return u>=f}),Yu=_y(function(){return arguments}())?_y:function(u){return $r(u)&&Ze.call(u,"callee")&&!Oo.call(u,"callee")},ke=Tt.isArray,NA=ps?ji(ps):kS;function Bo(u){return u!=null&&oh(u.length)&&!Na(u)}function ni(u){return $r(u)&&Bo(u)}function OA(u){return u===!0||u===!1||$r(u)&&go(u)==ue}var hu=Ai||$d,DA=Qr?ji(Qr):HS;function FA(u){return $r(u)&&u.nodeType===1&&!Wc(u)}function UA(u){if(u==null)return!0;if(Bo(u)&&(ke(u)||typeof u=="string"||typeof u.splice=="function"||hu(u)||Tl(u)||Yu(u)))return!u.length;var f=to(u);if(f==ft||f==kt)return!u.size;if(Hc(u))return!hd(u).length;for(var m in u)if(Ze.call(u,m))return!1;return!0}function BA(u,f){return zc(u,f)}function zA(u,f,m){m=typeof m=="function"?m:r;var T=m?m(u,f):r;return T===r?zc(u,f,r,m):!!T}function Bd(u){if(!$r(u))return!1;var f=go(u);return f==me||f==Qt||typeof u.message=="string"&&typeof u.name=="string"&&!Wc(u)}function GA(u){return typeof u=="number"&&El(u)}function Na(u){if(!Gr(u))return!1;var f=go(u);return f==Xt||f==Ee||f==$t||f==Ue}function Av(u){return typeof u=="number"&&u==qe(u)}function oh(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=It}function Gr(u){var f=typeof u;return u!=null&&(f=="object"||f=="function")}function $r(u){return u!=null&&typeof u=="object"}var Cv=Zs?ji(Zs):WS;function kA(u,f){return u===f||fd(u,f,Cd(f))}function HA(u,f,m){return m=typeof m=="function"?m:r,fd(u,f,Cd(f),m)}function VA(u){return Pv(u)&&u!=+u}function WA(u){if(Ab(u))throw new ve(o);return xy(u)}function qA(u){return u===null}function XA(u){return u==null}function Pv(u){return typeof u=="number"||$r(u)&&go(u)==He}function Wc(u){if(!$r(u)||go(u)!=fe)return!1;var f=_s(u);if(f===null)return!0;var m=Ze.call(f,"constructor")&&f.constructor;return typeof m=="function"&&m instanceof m&&ys.call(m)==Lc}var zd=Co?ji(Co):qS;function YA(u){return Av(u)&&u>=-It&&u<=It}var Iv=tu?ji(tu):XS;function sh(u){return typeof u=="string"||!ke(u)&&$r(u)&&go(u)==ye}function os(u){return typeof u=="symbol"||$r(u)&&go(u)==Vn}var Tl=dr?ji(dr):YS;function $A(u){return u===r}function ZA(u){return $r(u)&&to(u)==j}function JA(u){return $r(u)&&go(u)==H}var KA=Jf(pd),QA=Jf(function(u,f){return u<=f});function Rv(u){if(!u)return[];if(Bo(u))return sh(u)?Ro(u):Uo(u);if(ou&&u[ou])return ii(u[ou]());var f=to(u),m=f==ft?Qo:f==kt?qr:Al;return m(u)}function Oa(u){if(!u)return u===0?u:0;if(u=bs(u),u===vt||u===-vt){var f=u<0?-1:1;return f*Pt}return u===u?u:0}function qe(u){var f=Oa(u),m=f%1;return f===f?m?f-m:f:0}function Lv(u){return u?Vu(qe(u),0,yt):0}function bs(u){if(typeof u=="number")return u;if(os(u))return Et;if(Gr(u)){var f=typeof u.valueOf=="function"?u.valueOf():u;u=Gr(f)?f+"":f}if(typeof u!="string")return u===0?u:+u;u=Ff(u);var m=xt.test(u);return m||wt.test(u)?uo(u.slice(2),m?2:8):K.test(u)?Et:+u}function Nv(u){return ua(u,zo(u))}function jA(u){return u?Vu(qe(u),-It,It):u===0?u:0}function ar(u){return u==null?"":is(u)}var tC=Ml(function(u,f){if(Hc(f)||Bo(f)){ua(f,Pi(f),u);return}for(var m in f)Ze.call(f,m)&&Fc(u,m,f[m])}),Ov=Ml(function(u,f){ua(f,zo(f),u)}),ah=Ml(function(u,f,m,T){ua(f,zo(f),u,T)}),eC=Ml(function(u,f,m,T){ua(f,Pi(f),u,T)}),nC=Ra(sd);function rC(u,f){var m=Ca(u);return f==null?m:hy(m,f)}var iC=Je(function(u,f){u=or(u);var m=-1,T=f.length,O=T>2?f[2]:r;for(O&&mo(f[0],f[1],O)&&(T=1);++m<T;)for(var W=f[m],it=zo(W),ct=-1,mt=it.length;++ct<mt;){var Ft=it[ct],Ut=u[Ft];(Ut===r||Bs(Ut,ti[Ft])&&!Ze.call(u,Ft))&&(u[Ft]=W[Ft])}return u}),oC=Je(function(u){return u.push(r,Ky),ne(Dv,r,u)});function sC(u,f){return Ks(u,Pe(f,3),aa)}function aC(u,f){return Ks(u,Pe(f,3),ud)}function uC(u,f){return u==null?u:ad(u,Pe(f,3),zo)}function lC(u,f){return u==null?u:yy(u,Pe(f,3),zo)}function cC(u,f){return u&&aa(u,Pe(f,3))}function fC(u,f){return u&&ud(u,Pe(f,3))}function hC(u){return u==null?[]:Hf(u,Pi(u))}function pC(u){return u==null?[]:Hf(u,zo(u))}function Gd(u,f,m){var T=u==null?r:Wu(u,f);return T===r?m:T}function dC(u,f){return u!=null&&tv(u,f,US)}function kd(u,f){return u!=null&&tv(u,f,BS)}var gC=Xy(function(u,f,m){f!=null&&typeof f.toString!="function"&&(f=Cr.call(f)),u[f]=m},Vd(Go)),mC=Xy(function(u,f,m){f!=null&&typeof f.toString!="function"&&(f=Cr.call(f)),Ze.call(u,f)?u[f].push(m):u[f]=[m]},Pe),yC=Je(Bc);function Pi(u){return Bo(u)?cy(u):hd(u)}function zo(u){return Bo(u)?cy(u,!0):$S(u)}function vC(u,f){var m={};return f=Pe(f,3),aa(u,function(T,O,W){Pa(m,f(T,O,W),T)}),m}function _C(u,f){var m={};return f=Pe(f,3),aa(u,function(T,O,W){Pa(m,O,f(T,O,W))}),m}var xC=Ml(function(u,f,m){Vf(u,f,m)}),Dv=Ml(function(u,f,m,T){Vf(u,f,m,T)}),EC=Ra(function(u,f){var m={};if(u==null)return m;var T=!1;f=xr(f,function(W){return W=cu(W,u),T||(T=W.length>1),W}),ua(u,Td(u),m),T&&(m=ws(m,y|_|w,gb));for(var O=f.length;O--;)vd(m,f[O]);return m});function wC(u,f){return Fv(u,ih(Pe(f)))}var MC=Ra(function(u,f){return u==null?{}:JS(u,f)});function Fv(u,f){if(u==null)return{};var m=xr(Td(u),function(T){return[T]});return f=Pe(f),Ay(u,m,function(T,O){return f(T,O[0])})}function SC(u,f,m){f=cu(f,u);var T=-1,O=f.length;for(O||(O=1,u=r);++T<O;){var W=u==null?r:u[la(f[T])];W===r&&(T=O,W=m),u=Na(W)?W.call(u):W}return u}function bC(u,f,m){return u==null?u:Gc(u,f,m)}function TC(u,f,m,T){return T=typeof T=="function"?T:r,u==null?u:Gc(u,f,m,T)}var Uv=Zy(Pi),Bv=Zy(zo);function AC(u,f,m){var T=ke(u),O=T||hu(u)||Tl(u);if(f=Pe(f,4),m==null){var W=u&&u.constructor;O?m=T?new W:[]:Gr(u)?m=Na(W)?Ca(_s(u)):{}:m={}}return(O?wi:aa)(u,function(it,ct,mt){return f(m,it,ct,mt)}),m}function CC(u,f){return u==null?!0:vd(u,f)}function PC(u,f,m){return u==null?u:Ly(u,f,Ed(m))}function IC(u,f,m,T){return T=typeof T=="function"?T:r,u==null?u:Ly(u,f,Ed(m),T)}function Al(u){return u==null?[]:Jo(u,Pi(u))}function RC(u){return u==null?[]:Jo(u,zo(u))}function LC(u,f,m){return m===r&&(m=f,f=r),m!==r&&(m=bs(m),m=m===m?m:0),f!==r&&(f=bs(f),f=f===f?f:0),Vu(bs(u),f,m)}function NC(u,f,m){return f=Oa(f),m===r?(m=f,f=0):m=Oa(m),u=bs(u),zS(u,f,m)}function OC(u,f,m){if(m&&typeof m!="boolean"&&mo(u,f,m)&&(f=m=r),m===r&&(typeof f=="boolean"?(m=f,f=r):typeof u=="boolean"&&(m=u,u=r)),u===r&&f===r?(u=0,f=1):(u=Oa(u),f===r?(f=u,u=0):f=Oa(f)),u>f){var T=u;u=f,f=T}if(m||u%1||f%1){var O=zf();return mr(u+O*(f-u+Nf("1e-"+((O+"").length-1))),f)}return gd(u,f)}var DC=Sl(function(u,f,m){return f=f.toLowerCase(),u+(m?zv(f):f)});function zv(u){return Hd(ar(u).toLowerCase())}function Gv(u){return u=ar(u),u&&u.replace(Zt,Ko).replace(kn,"")}function FC(u,f,m){u=ar(u),f=is(f);var T=u.length;m=m===r?T:Vu(qe(m),0,T);var O=m;return m-=f.length,m>=0&&u.slice(m,O)==f}function UC(u){return u=ar(u),u&&lt.test(u)?u.replace(ut,js):u}function BC(u){return u=ar(u),u&&je.test(u)?u.replace(Ve,"\\\\$&"):u}var zC=Sl(function(u,f,m){return u+(m?"-":"")+f.toLowerCase()}),GC=Sl(function(u,f,m){return u+(m?" ":"")+f.toLowerCase()}),kC=Vy("toLowerCase");function HC(u,f,m){u=ar(u),f=qe(f);var T=f?Sa(u):0;if(!f||T>=f)return u;var O=(f-T)/2;return Zf(zr(O),m)+u+Zf(br(O),m)}function VC(u,f,m){u=ar(u),f=qe(f);var T=f?Sa(u):0;return f&&T<f?u+Zf(f-T,m):u}function WC(u,f,m){u=ar(u),f=qe(f);var T=f?Sa(u):0;return f&&T<f?Zf(f-T,m)+u:u}function qC(u,f,m){return m||f==null?f=0:f&&(f=+f),ku(ar(u).replace(ur,""),f||0)}function XC(u,f,m){return(m?mo(u,f,m):f===r)?f=1:f=qe(f),md(ar(u),f)}function YC(){var u=arguments,f=ar(u[0]);return u.length<3?f:f.replace(u[1],u[2])}var $C=Sl(function(u,f,m){return u+(m?"_":"")+f.toLowerCase()});function ZC(u,f,m){return m&&typeof m!="number"&&mo(u,f,m)&&(f=m=r),m=m===r?yt:m>>>0,m?(u=ar(u),u&&(typeof f=="string"||f!=null&&!zd(f))&&(f=is(f),!f&&Ma(u))?fu(Ro(u),0,m):u.split(f,m)):[]}var JC=Sl(function(u,f,m){return u+(m?" ":"")+Hd(f)});function KC(u,f,m){return u=ar(u),m=m==null?0:Vu(qe(m),0,u.length),f=is(f),u.slice(m,m+f.length)==f}function QC(u,f,m){var T=B.templateSettings;m&&mo(u,f,m)&&(f=r),u=ar(u),f=ah({},f,T,Jy);var O=ah({},f.imports,T.imports,Jy),W=Pi(O),it=Jo(O,W),ct,mt,Ft=0,Ut=f.interpolate||jt,Vt="__p += '",ae=es((f.escape||jt).source+"|"+Ut.source+"|"+(Ut===Bt?lr:jt).source+"|"+(f.evaluate||jt).source+"|$","g"),xe="//# sourceURL="+(Ze.call(f,"sourceURL")?(f.sourceURL+"").replace(/\\s/g," "):"lodash.templateSources["+ ++Ei+"]")+\`
112
112
  \`;u.replace(ae,function(Le,Pn,Hn,ss,yo,as){return Hn||(Hn=ss),Vt+=u.slice(Ft,as).replace(Te,ms),Pn&&(ct=!0,Vt+=\`' +
@@ -125,7 +125,7 @@ __p += '\`),Hn&&(Vt+=\`' +
125
125
  function print() { __p += __j.call(arguments, '') }
126
126
  \`:\`;
127
127
  \`)+Vt+\`return __p
128
- }\`;var Ye=Hv(function(){return Be(W,xe+"return "+Vt).apply(r,it)});if(Ye.source=Vt,Bd(Ye))throw Ye;return Ye}function jC(u){return ar(u).toLowerCase()}function tP(u){return ar(u).toUpperCase()}function eP(u,f,m){if(u=ar(u),u&&(m||f===r))return Ff(u);if(!u||!(f=is(f)))return u;var T=Ro(u),O=Ro(f),W=Ls(T,O),it=Si(T,O)+1;return fu(T,W,it).join("")}function nP(u,f,m){if(u=ar(u),u&&(m||f===r))return u.slice(0,ta(u)+1);if(!u||!(f=is(f)))return u;var T=Ro(u),O=Si(T,Ro(f))+1;return fu(T,0,O).join("")}function rP(u,f,m){if(u=ar(u),u&&(m||f===r))return u.replace(ur,"");if(!u||!(f=is(f)))return u;var T=Ro(u),O=Ls(T,Ro(f));return fu(T,O).join("")}function iP(u,f){var m=D,T=G;if(Gr(f)){var O="separator"in f?f.separator:O;m="length"in f?qe(f.length):m,T="omission"in f?is(f.omission):T}u=ar(u);var W=u.length;if(Ma(u)){var it=Ro(u);W=it.length}if(m>=W)return u;var ct=m-Sa(T);if(ct<1)return T;var mt=it?fu(it,0,ct).join(""):u.slice(0,ct);if(O===r)return mt+T;if(it&&(ct+=mt.length-ct),zd(O)){if(u.slice(ct).search(O)){var Ft,Ut=mt;for(O.global||(O=es(O.source,ar(Zn.exec(O))+"g")),O.lastIndex=0;Ft=O.exec(Ut);)var Vt=Ft.index;mt=mt.slice(0,Vt===r?ct:Vt)}}else if(u.indexOf(is(O),ct)!=ct){var ae=mt.lastIndexOf(O);ae>-1&&(mt=mt.slice(0,ae))}return mt+T}function oP(u){return u=ar(u),u&&nt.test(u)?u.replace(k,jo):u}var sP=Sl(function(u,f,m){return u+(m?" ":"")+f.toUpperCase()}),Hd=Vy("toUpperCase");function kv(u,f,m){return u=ar(u),f=m?r:f,f===r?_l(u)?oi(u):Ge(u):u.match(f)||[]}var Hv=Je(function(u,f){try{return ne(u,r,f)}catch(m){return Bd(m)?m:new ve(m)}}),aP=Ra(function(u,f){return wi(f,function(m){m=la(m),Pa(u,m,Fd(u[m],u))}),u});function uP(u){var f=u==null?0:u.length,m=Pe();return u=f?xr(u,function(T){if(typeof T[1]!="function")throw new Jn(a);return[m(T[0]),T[1]]}):[],Je(function(T){for(var O=-1;++O<f;){var W=u[O];if(ne(W[0],this,T))return ne(W[1],this,T)}})}function lP(u){return OS(ws(u,y))}function Vd(u){return function(){return u}}function cP(u,f){return u==null||u!==u?f:u}var fP=qy(),hP=qy(!0);function Go(u){return u}function Wd(u){return Ey(typeof u=="function"?u:ws(u,y))}function pP(u){return My(ws(u,y))}function dP(u,f){return Sy(u,ws(f,y))}var gP=Je(function(u,f){return function(m){return Bc(m,u,f)}}),mP=Je(function(u,f){return function(m){return Bc(u,m,f)}});function qd(u,f,m){var T=Pi(f),O=Hf(f,T);m==null&&!(Gr(f)&&(O.length||!T.length))&&(m=f,f=u,u=this,O=Hf(f,Pi(f)));var W=!(Gr(m)&&"chain"in m)||!!m.chain,it=Na(u);return wi(O,function(ct){var mt=f[ct];u[ct]=mt,it&&(u.prototype[ct]=function(){var Ft=this.__chain__;if(W||Ft){var Ut=u(this.__wrapped__),Vt=Ut.__actions__=Uo(this.__actions__);return Vt.push({func:mt,args:arguments,thisArg:u}),Ut.__chain__=Ft,Ut}return mt.apply(u,Fe([this.value()],arguments))})}),u}function yP(){return Ur._===this&&(Ur._=No),this}function Xd(){}function vP(u){return u=qe(u),Je(function(f){return by(f,u)})}var _P=Md(xr),xP=Md(lo),EP=Md(wa);function Vv(u){return Id(u)?gs(la(u)):KS(u)}function wP(u){return function(f){return u==null?r:Wu(u,f)}}var MP=Yy(),SP=Yy(!0);function Yd(){return[]}function $d(){return!1}function bP(){return{}}function TP(){return""}function AP(){return!0}function CP(u,f){if(u=qe(u),u<1||u>It)return[];var m=yt,T=mr(u,yt);f=Pe(f),u-=yt;for(var O=pi(T,f);++m<u;)f(m);return O}function PP(u){return ke(u)?xr(u,la):os(u)?[u]:Uo(lv(ar(u)))}function IP(u){var f=++bi;return ar(u)+f}var RP=$f(function(u,f){return u+f},0),LP=Sd("ceil"),NP=$f(function(u,f){return u/f},1),OP=Sd("floor");function DP(u){return u&&u.length?kf(u,Go,ld):r}function FP(u,f){return u&&u.length?kf(u,Pe(f,2),ld):r}function UP(u){return Rc(u,Go)}function BP(u,f){return Rc(u,Pe(f,2))}function zP(u){return u&&u.length?kf(u,Go,pd):r}function GP(u,f){return u&&u.length?kf(u,Pe(f,2),pd):r}var kP=$f(function(u,f){return u*f},1),HP=Sd("round"),VP=$f(function(u,f){return u-f},0);function WP(u){return u&&u.length?co(u,Go):0}function qP(u,f){return u&&u.length?co(u,Pe(f,2)):0}return B.after=pA,B.ary=xv,B.assign=tC,B.assignIn=Ov,B.assignInWith=ah,B.assignWith=eC,B.at=nC,B.before=Ev,B.bind=Fd,B.bindAll=aP,B.bindKey=wv,B.castArray=bA,B.chain=yv,B.chunk=Ob,B.compact=Db,B.concat=Fb,B.cond=uP,B.conforms=lP,B.constant=Vd,B.countBy=WT,B.create=rC,B.curry=Mv,B.curryRight=Sv,B.debounce=bv,B.defaults=iC,B.defaultsDeep=oC,B.defer=dA,B.delay=gA,B.difference=Ub,B.differenceBy=Bb,B.differenceWith=zb,B.drop=Gb,B.dropRight=kb,B.dropRightWhile=Hb,B.dropWhile=Vb,B.fill=Wb,B.filter=XT,B.flatMap=ZT,B.flatMapDeep=JT,B.flatMapDepth=KT,B.flatten=pv,B.flattenDeep=qb,B.flattenDepth=Xb,B.flip=mA,B.flow=fP,B.flowRight=hP,B.fromPairs=Yb,B.functions=hC,B.functionsIn=pC,B.groupBy=QT,B.initial=Zb,B.intersection=Jb,B.intersectionBy=Kb,B.intersectionWith=Qb,B.invert=gC,B.invertBy=mC,B.invokeMap=tA,B.iteratee=Wd,B.keyBy=eA,B.keys=Pi,B.keysIn=zo,B.map=eh,B.mapKeys=vC,B.mapValues=_C,B.matches=pP,B.matchesProperty=dP,B.memoize=rh,B.merge=xC,B.mergeWith=Dv,B.method=gP,B.methodOf=mP,B.mixin=qd,B.negate=ih,B.nthArg=vP,B.omit=EC,B.omitBy=wC,B.once=yA,B.orderBy=nA,B.over=_P,B.overArgs=vA,B.overEvery=xP,B.overSome=EP,B.partial=Ud,B.partialRight=Tv,B.partition=rA,B.pick=MC,B.pickBy=Fv,B.property=Vv,B.propertyOf=wP,B.pull=nT,B.pullAll=gv,B.pullAllBy=rT,B.pullAllWith=iT,B.pullAt=oT,B.range=MP,B.rangeRight=SP,B.rearg=_A,B.reject=sA,B.remove=sT,B.rest=xA,B.reverse=Od,B.sampleSize=uA,B.set=bC,B.setWith=TC,B.shuffle=lA,B.slice=aT,B.sortBy=hA,B.sortedUniq=dT,B.sortedUniqBy=gT,B.split=ZC,B.spread=EA,B.tail=mT,B.take=yT,B.takeRight=vT,B.takeRightWhile=_T,B.takeWhile=xT,B.tap=DT,B.throttle=wA,B.thru=th,B.toArray=Rv,B.toPairs=Uv,B.toPairsIn=Bv,B.toPath=PP,B.toPlainObject=Nv,B.transform=AC,B.unary=MA,B.union=ET,B.unionBy=wT,B.unionWith=MT,B.uniq=ST,B.uniqBy=bT,B.uniqWith=TT,B.unset=CC,B.unzip=Dd,B.unzipWith=mv,B.update=PC,B.updateWith=IC,B.values=Al,B.valuesIn=RC,B.without=AT,B.words=kv,B.wrap=SA,B.xor=CT,B.xorBy=PT,B.xorWith=IT,B.zip=RT,B.zipObject=LT,B.zipObjectDeep=NT,B.zipWith=OT,B.entries=Uv,B.entriesIn=Bv,B.extend=Ov,B.extendWith=ah,qd(B,B),B.add=RP,B.attempt=Hv,B.camelCase=DC,B.capitalize=zv,B.ceil=LP,B.clamp=LC,B.clone=TA,B.cloneDeep=CA,B.cloneDeepWith=PA,B.cloneWith=AA,B.conformsTo=IA,B.deburr=Gv,B.defaultTo=cP,B.divide=NP,B.endsWith=FC,B.eq=Bs,B.escape=UC,B.escapeRegExp=BC,B.every=qT,B.find=YT,B.findIndex=fv,B.findKey=sC,B.findLast=$T,B.findLastIndex=hv,B.findLastKey=aC,B.floor=OP,B.forEach=vv,B.forEachRight=_v,B.forIn=uC,B.forInRight=lC,B.forOwn=cC,B.forOwnRight=fC,B.get=Gd,B.gt=RA,B.gte=LA,B.has=dC,B.hasIn=kd,B.head=dv,B.identity=Go,B.includes=jT,B.indexOf=$b,B.inRange=NC,B.invoke=yC,B.isArguments=Yu,B.isArray=ke,B.isArrayBuffer=NA,B.isArrayLike=Bo,B.isArrayLikeObject=ni,B.isBoolean=OA,B.isBuffer=hu,B.isDate=DA,B.isElement=FA,B.isEmpty=UA,B.isEqual=BA,B.isEqualWith=zA,B.isError=Bd,B.isFinite=GA,B.isFunction=Na,B.isInteger=Av,B.isLength=oh,B.isMap=Cv,B.isMatch=kA,B.isMatchWith=HA,B.isNaN=VA,B.isNative=WA,B.isNil=XA,B.isNull=qA,B.isNumber=Pv,B.isObject=Gr,B.isObjectLike=$r,B.isPlainObject=Wc,B.isRegExp=zd,B.isSafeInteger=YA,B.isSet=Iv,B.isString=sh,B.isSymbol=os,B.isTypedArray=Tl,B.isUndefined=$A,B.isWeakMap=ZA,B.isWeakSet=JA,B.join=jb,B.kebabCase=zC,B.last=Ss,B.lastIndexOf=tT,B.lowerCase=GC,B.lowerFirst=kC,B.lt=KA,B.lte=QA,B.max=DP,B.maxBy=FP,B.mean=UP,B.meanBy=BP,B.min=zP,B.minBy=GP,B.stubArray=Yd,B.stubFalse=$d,B.stubObject=bP,B.stubString=TP,B.stubTrue=AP,B.multiply=kP,B.nth=eT,B.noConflict=yP,B.noop=Xd,B.now=nh,B.pad=HC,B.padEnd=VC,B.padStart=WC,B.parseInt=qC,B.random=OC,B.reduce=iA,B.reduceRight=oA,B.repeat=XC,B.replace=YC,B.result=SC,B.round=HP,B.runInContext=gt,B.sample=aA,B.size=cA,B.snakeCase=$C,B.some=fA,B.sortedIndex=uT,B.sortedIndexBy=lT,B.sortedIndexOf=cT,B.sortedLastIndex=fT,B.sortedLastIndexBy=hT,B.sortedLastIndexOf=pT,B.startCase=JC,B.startsWith=KC,B.subtract=VP,B.sum=WP,B.sumBy=qP,B.template=QC,B.times=CP,B.toFinite=Oa,B.toInteger=qe,B.toLength=Lv,B.toLower=jC,B.toNumber=bs,B.toSafeInteger=jA,B.toString=ar,B.toUpper=tP,B.trim=eP,B.trimEnd=nP,B.trimStart=rP,B.truncate=iP,B.unescape=oP,B.uniqueId=IP,B.upperCase=sP,B.upperFirst=Hd,B.each=vv,B.eachRight=_v,B.first=dv,qd(B,function(){var u={};return aa(B,function(f,m){Ze.call(B.prototype,m)||(u[m]=f)}),u}(),{chain:!1}),B.VERSION=t,wi(["bind","bindKey","curry","curryRight","partial","partialRight"],function(u){B[u].placeholder=B}),wi(["drop","take"],function(u,f){i.prototype[u]=function(m){m=m===r?1:ei(qe(m),0);var T=this.__filtered__&&!f?new i(this):this.clone();return T.__filtered__?T.__takeCount__=mr(m,T.__takeCount__):T.__views__.push({size:mr(m,yt),type:u+(T.__dir__<0?"Right":"")}),T},i.prototype[u+"Right"]=function(m){return this.reverse()[u](m).reverse()}}),wi(["filter","map","takeWhile"],function(u,f){var m=f+1,T=m==Z||m==et;i.prototype[u]=function(O){var W=this.clone();return W.__iteratees__.push({iteratee:Pe(O,3),type:m}),W.__filtered__=W.__filtered__||T,W}}),wi(["head","last"],function(u,f){var m="take"+(f?"Right":"");i.prototype[u]=function(){return this[m](1).value()[0]}}),wi(["initial","tail"],function(u,f){var m="drop"+(f?"":"Right");i.prototype[u]=function(){return this.__filtered__?new i(this):this[m](1)}}),i.prototype.compact=function(){return this.filter(Go)},i.prototype.find=function(u){return this.filter(u).head()},i.prototype.findLast=function(u){return this.reverse().find(u)},i.prototype.invokeMap=Je(function(u,f){return typeof u=="function"?new i(this):this.map(function(m){return Bc(m,u,f)})}),i.prototype.reject=function(u){return this.filter(ih(Pe(u)))},i.prototype.slice=function(u,f){u=qe(u);var m=this;return m.__filtered__&&(u>0||f<0)?new i(m):(u<0?m=m.takeRight(-u):u&&(m=m.drop(u)),f!==r&&(f=qe(f),m=f<0?m.dropRight(-f):m.take(f-u)),m)},i.prototype.takeRightWhile=function(u){return this.reverse().takeWhile(u).reverse()},i.prototype.toArray=function(){return this.take(yt)},aa(i.prototype,function(u,f){var m=/^(?:filter|find|map|reject)|While$/.test(f),T=/^(?:head|last)$/.test(f),O=B[T?"take"+(f=="last"?"Right":""):f],W=T||/^find/.test(f);O&&(B.prototype[f]=function(){var it=this.__wrapped__,ct=T?[1]:arguments,mt=it instanceof i,Ft=ct[0],Ut=mt||ke(it),Vt=function(Pn){var Hn=O.apply(B,Fe([Pn],ct));return T&&ae?Hn[0]:Hn};Ut&&m&&typeof Ft=="function"&&Ft.length!=1&&(mt=Ut=!1);var ae=this.__chain__,xe=!!this.__actions__.length,Re=W&&!ae,Ye=mt&&!xe;if(!W&&Ut){it=Ye?it:new i(this);var Le=u.apply(it,ct);return Le.__actions__.push({func:th,args:[Vt],thisArg:r}),new n(Le,ae)}return Re&&Ye?u.apply(this,ct):(Le=this.thru(Vt),Re?T?Le.value()[0]:Le.value():Le)})}),wi(["pop","push","shift","sort","splice","unshift"],function(u){var f=Rr[u],m=/^(?:push|sort|unshift)$/.test(u)?"tap":"thru",T=/^(?:pop|shift)$/.test(u);B.prototype[u]=function(){var O=arguments;if(T&&!this.__chain__){var W=this.value();return f.apply(ke(W)?W:[],O)}return this[m](function(it){return f.apply(ke(it)?it:[],O)})}}),aa(i.prototype,function(u,f){var m=B[f];if(m){var T=m.name+"";Ze.call(ns,T)||(ns[T]=[]),ns[T].push({name:f,func:m})}}),ns[Yf(r,I).name]=[{name:"wrapper",func:r}],i.prototype.clone=s,i.prototype.reverse=l,i.prototype.value=h,B.prototype.at=FT,B.prototype.chain=UT,B.prototype.commit=BT,B.prototype.next=zT,B.prototype.plant=kT,B.prototype.reverse=HT,B.prototype.toJSON=B.prototype.valueOf=B.prototype.value=VT,B.prototype.first=B.prototype.head,ou&&(B.prototype[ou]=GT),B},Hi=ts();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ur._=Hi,define(function(){return Hi})):Ao?((Ao.exports=Hi)._=Hi,Pc._=Hi):Ur._=Hi}).call(Ac)});var gS=ce((lnt,dS)=>{dS.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}});var vS=ce((cnt,yS)=>{var mS=gS();yS.exports=function(r,t){Array.isArray(t)||(t=[]),r.length>0&&t.push(mS([0,0],r[0]));for(var e=0;e<r.length-1;e++){var o=r[e],a=r[e+1],c=o[0],p=o[1],d=a[0],g=a[1],y=[.75*c+.25*d,.75*p+.25*g],_=[.25*c+.75*d,.25*p+.75*g];t.push(y),t.push(_)}return r.length>1&&t.push(mS([0,0],r[r.length-1])),t}});var so=Lr(u_(),1);var pm="157";var rI=0,l_=1,iI=2;var I1=1,oI=2,Ha=3,Mu=0,Vo=1,Wa=2;var xu=0,$l=1,c_=2,f_=3,h_=4,sI=5,Wl=100,aI=101,uI=102,p_=103,d_=104,lI=200,cI=201,fI=202,hI=203,R1=204,L1=205,pI=206,dI=207,gI=208,mI=209,yI=210,vI=0,_I=1,xI=2,Pg=3,EI=4,wI=5,MI=6,SI=7,N1=0,bI=1,TI=2,Eu=0,AI=1,CI=2,PI=3,II=4,RI=5,O1=300,Kl=301,Ql=302,Ig=303,Rg=304,Zh=306,Lg=1e3,Hs=1001,Ng=1002,_o=1003,g_=1004;var jd=1005;var As=1006,LI=1007;var tf=1008;var wu=1009,NI=1010,OI=1011,dm=1012,D1=1013,vu=1014,_u=1015,ef=1016,F1=1017,U1=1018,tl=1020,DI=1021,Vs=1023,FI=1024,UI=1025,el=1026,jl=1027,BI=1028,B1=1029,zI=1030,z1=1031,G1=1033,tg=33776,eg=33777,ng=33778,rg=33779,m_=35840,y_=35841,v_=35842,__=35843,GI=36196,x_=37492,E_=37496,w_=37808,M_=37809,S_=37810,b_=37811,T_=37812,A_=37813,C_=37814,P_=37815,I_=37816,R_=37817,L_=37818,N_=37819,O_=37820,D_=37821,ig=36492,F_=36494,U_=36495,kI=36283,B_=36284,z_=36285,G_=36286;var Ih=2300,Rh=2301,og=2302,k_=2400,H_=2401,V_=2402;var k1=3e3,nl=3001,HI=3200,VI=3201,WI=0,qI=1,Cs="",qi="srgb",Ya="srgb-linear",gm="display-p3",Jh="display-p3-linear",Lh="linear",Pr="srgb",Nh="rec709",Oh="p3";var sg=7680;var XI=519,YI=512,$I=513,ZI=514,JI=515,KI=516,QI=517,jI=518,tR=519,W_=35044;var q_="300 es",Og=1035,qa=2e3,Dh=2001,Su=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let o=this._listeners;o[t]===void 0&&(o[t]=[]),o[t].indexOf(e)===-1&&o[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;let o=this._listeners;return o[t]!==void 0&&o[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;let a=this._listeners[t];if(a!==void 0){let c=a.indexOf(e);c!==-1&&a.splice(c,1)}}dispatchEvent(t){if(this._listeners===void 0)return;let o=this._listeners[t.type];if(o!==void 0){t.target=this;let a=o.slice(0);for(let c=0,p=a.length;c<p;c++)a[c].call(this,t);t.target=null}}},eo=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var ag=Math.PI/180,Dg=180/Math.PI;function sf(){let r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(eo[r&255]+eo[r>>8&255]+eo[r>>16&255]+eo[r>>24&255]+"-"+eo[t&255]+eo[t>>8&255]+"-"+eo[t>>16&15|64]+eo[t>>24&255]+"-"+eo[e&63|128]+eo[e>>8&255]+"-"+eo[e>>16&255]+eo[e>>24&255]+eo[o&255]+eo[o>>8&255]+eo[o>>16&255]+eo[o>>24&255]).toLowerCase()}function Ho(r,t,e){return Math.max(t,Math.min(e,r))}function eR(r,t){return(r%t+t)%t}function ug(r,t,e){return(1-e)*r+e*t}function X_(r){return(r&r-1)===0&&r!==0}function Fg(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Xc(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function ko(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var tr=class r{constructor(t=0,e=0){r.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,o=this.y,a=t.elements;return this.x=a[0]*e+a[3]*o+a[6],this.y=a[1]*e+a[4]*o+a[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let o=this.dot(t)/e;return Math.acos(Ho(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y;return e*e+o*o}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let o=Math.cos(e),a=Math.sin(e),c=this.x-t.x,p=this.y-t.y;return this.x=c*o-p*a+t.x,this.y=c*a+p*o+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Ke=class r{constructor(t,e,o,a,c,p,d,g,y){r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,o,a,c,p,d,g,y)}set(t,e,o,a,c,p,d,g,y){let _=this.elements;return _[0]=t,_[1]=a,_[2]=d,_[3]=e,_[4]=c,_[5]=g,_[6]=o,_[7]=p,_[8]=y,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,o=t.elements;return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=o[3],e[4]=o[4],e[5]=o[5],e[6]=o[6],e[7]=o[7],e[8]=o[8],this}extractBasis(t,e,o){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),o.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,a=e.elements,c=this.elements,p=o[0],d=o[3],g=o[6],y=o[1],_=o[4],w=o[7],x=o[2],b=o[5],P=o[8],I=a[0],M=a[3],E=a[6],N=a[1],A=a[4],U=a[7],z=a[2],$=a[5],q=a[8];return c[0]=p*I+d*N+g*z,c[3]=p*M+d*A+g*$,c[6]=p*E+d*U+g*q,c[1]=y*I+_*N+w*z,c[4]=y*M+_*A+w*$,c[7]=y*E+_*U+w*q,c[2]=x*I+b*N+P*z,c[5]=x*M+b*A+P*$,c[8]=x*E+b*U+P*q,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],o=t[1],a=t[2],c=t[3],p=t[4],d=t[5],g=t[6],y=t[7],_=t[8];return e*p*_-e*d*y-o*c*_+o*d*g+a*c*y-a*p*g}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],c=t[3],p=t[4],d=t[5],g=t[6],y=t[7],_=t[8],w=_*p-d*y,x=d*g-_*c,b=y*c-p*g,P=e*w+o*x+a*b;if(P===0)return this.set(0,0,0,0,0,0,0,0,0);let I=1/P;return t[0]=w*I,t[1]=(a*y-_*o)*I,t[2]=(d*o-a*p)*I,t[3]=x*I,t[4]=(_*e-a*g)*I,t[5]=(a*c-d*e)*I,t[6]=b*I,t[7]=(o*g-y*e)*I,t[8]=(p*e-o*c)*I,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,o,a,c,p,d){let g=Math.cos(c),y=Math.sin(c);return this.set(o*g,o*y,-o*(g*p+y*d)+p+t,-a*y,a*g,-a*(-y*p+g*d)+d+e,0,0,1),this}scale(t,e){return this.premultiply(lg.makeScale(t,e)),this}rotate(t){return this.premultiply(lg.makeRotation(-t)),this}translate(t,e){return this.premultiply(lg.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,-o,0,o,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,o=t.elements;for(let a=0;a<9;a++)if(e[a]!==o[a])return!1;return!0}fromArray(t,e=0){for(let o=0;o<9;o++)this.elements[o]=t[o+e];return this}toArray(t=[],e=0){let o=this.elements;return t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3],t[e+4]=o[4],t[e+5]=o[5],t[e+6]=o[6],t[e+7]=o[7],t[e+8]=o[8],t}clone(){return new this.constructor().fromArray(this.elements)}},lg=new Ke;function H1(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}function Fh(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function nR(){let r=Fh("canvas");return r.style.display="block",r}var Y_={};function Qc(r){r in Y_||(Y_[r]=!0,console.warn(r))}var $_=new Ke().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Z_=new Ke().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),uh={[Ya]:{transfer:Lh,primaries:Nh,toReference:r=>r,fromReference:r=>r},[qi]:{transfer:Pr,primaries:Nh,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[Jh]:{transfer:Lh,primaries:Oh,toReference:r=>r.applyMatrix3(Z_),fromReference:r=>r.applyMatrix3($_)},[gm]:{transfer:Pr,primaries:Oh,toReference:r=>r.convertSRGBToLinear().applyMatrix3(Z_),fromReference:r=>r.applyMatrix3($_).convertLinearToSRGB()}},rR=new Set([Ya,Jh]),yr={enabled:!0,_workingColorSpace:Ya,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(r){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!r},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!rR.has(r))throw new Error(\`Unsupported working color space, "\${r}".\`);this._workingColorSpace=r},convert:function(r,t,e){if(this.enabled===!1||t===e||!t||!e)return r;let o=uh[t].toReference,a=uh[e].fromReference;return a(o(r))},fromWorkingColorSpace:function(r,t){return this.convert(r,this._workingColorSpace,t)},toWorkingColorSpace:function(r,t){return this.convert(r,t,this._workingColorSpace)},getPrimaries:function(r){return uh[r].primaries},getTransfer:function(r){return r===Cs?Lh:uh[r].transfer}};function Zl(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function cg(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var Cl,Uh=class{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement=="undefined")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{Cl===void 0&&(Cl=Fh("canvas")),Cl.width=t.width,Cl.height=t.height;let o=Cl.getContext("2d");t instanceof ImageData?o.putImageData(t,0,0):o.drawImage(t,0,0,t.width,t.height),e=Cl}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement!="undefined"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&t instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap){let e=Fh("canvas");e.width=t.width,e.height=t.height;let o=e.getContext("2d");o.drawImage(t,0,0,t.width,t.height);let a=o.getImageData(0,0,t.width,t.height),c=a.data;for(let p=0;p<c.length;p++)c[p]=Zl(c[p]/255)*255;return o.putImageData(a,0,0),e}else if(t.data){let e=t.data.slice(0);for(let o=0;o<e.length;o++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[o]=Math.floor(Zl(e[o]/255)*255):e[o]=Zl(e[o]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},iR=0,Bh=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:iR++}),this.uuid=sf(),this.data=t,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let o={uuid:this.uuid,url:""},a=this.data;if(a!==null){let c;if(Array.isArray(a)){c=[];for(let p=0,d=a.length;p<d;p++)a[p].isDataTexture?c.push(fg(a[p].image)):c.push(fg(a[p]))}else c=fg(a);o.url=c}return e||(t.images[this.uuid]=o),o}};function fg(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?Uh.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var oR=0,Ws=class r extends Su{constructor(t=r.DEFAULT_IMAGE,e=r.DEFAULT_MAPPING,o=Hs,a=Hs,c=As,p=tf,d=Vs,g=wu,y=r.DEFAULT_ANISOTROPY,_=Cs){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:oR++}),this.uuid=sf(),this.name="",this.source=new Bh(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=o,this.wrapT=a,this.magFilter=c,this.minFilter=p,this.anisotropy=y,this.format=d,this.internalFormat=null,this.type=g,this.offset=new tr(0,0),this.repeat=new tr(1,1),this.center=new tr(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ke,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof _=="string"?this.colorSpace=_:(Qc("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=_===nl?qi:Cs),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let o={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(o.userData=this.userData),e||(t.textures[this.uuid]=o),o}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==O1)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Lg:t.x=t.x-Math.floor(t.x);break;case Hs:t.x=t.x<0?0:1;break;case Ng:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Lg:t.y=t.y-Math.floor(t.y);break;case Hs:t.y=t.y<0?0:1;break;case Ng:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Qc("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===qi?nl:k1}set encoding(t){Qc("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===nl?qi:Cs}};Ws.DEFAULT_IMAGE=null;Ws.DEFAULT_MAPPING=O1;Ws.DEFAULT_ANISOTROPY=1;var Xi=class r{constructor(t=0,e=0,o=0,a=1){r.prototype.isVector4=!0,this.x=t,this.y=e,this.z=o,this.w=a}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,o,a){return this.x=t,this.y=e,this.z=o,this.w=a,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,o=this.y,a=this.z,c=this.w,p=t.elements;return this.x=p[0]*e+p[4]*o+p[8]*a+p[12]*c,this.y=p[1]*e+p[5]*o+p[9]*a+p[13]*c,this.z=p[2]*e+p[6]*o+p[10]*a+p[14]*c,this.w=p[3]*e+p[7]*o+p[11]*a+p[15]*c,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,o,a,c,g=t.elements,y=g[0],_=g[4],w=g[8],x=g[1],b=g[5],P=g[9],I=g[2],M=g[6],E=g[10];if(Math.abs(_-x)<.01&&Math.abs(w-I)<.01&&Math.abs(P-M)<.01){if(Math.abs(_+x)<.1&&Math.abs(w+I)<.1&&Math.abs(P+M)<.1&&Math.abs(y+b+E-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let A=(y+1)/2,U=(b+1)/2,z=(E+1)/2,$=(_+x)/4,q=(w+I)/4,D=(P+M)/4;return A>U&&A>z?A<.01?(o=0,a=.707106781,c=.707106781):(o=Math.sqrt(A),a=$/o,c=q/o):U>z?U<.01?(o=.707106781,a=0,c=.707106781):(a=Math.sqrt(U),o=$/a,c=D/a):z<.01?(o=.707106781,a=.707106781,c=0):(c=Math.sqrt(z),o=q/c,a=D/c),this.set(o,a,c,e),this}let N=Math.sqrt((M-P)*(M-P)+(w-I)*(w-I)+(x-_)*(x-_));return Math.abs(N)<.001&&(N=1),this.x=(M-P)/N,this.y=(w-I)/N,this.z=(x-_)/N,this.w=Math.acos((y+b+E-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this.z=t.z+(e.z-t.z)*o,this.w=t.w+(e.w-t.w)*o,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Ug=class extends Su{constructor(t=1,e=1,o={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Xi(0,0,t,e),this.scissorTest=!1,this.viewport=new Xi(0,0,t,e);let a={width:t,height:e,depth:1};o.encoding!==void 0&&(Qc("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=o.encoding===nl?qi:Cs),o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:As,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},o),this.texture=new Ws(a,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=o.generateMipmaps,this.texture.internalFormat=o.internalFormat,this.depthBuffer=o.depthBuffer,this.stencilBuffer=o.stencilBuffer,this.depthTexture=o.depthTexture,this.samples=o.samples}setSize(t,e,o=1){(this.width!==t||this.height!==e||this.depth!==o)&&(this.width=t,this.height=e,this.depth=o,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=o,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;let e=Object.assign({},t.texture.image);return this.texture.source=new Bh(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},$a=class extends Ug{constructor(t=1,e=1,o={}){super(t,e,o),this.isWebGLRenderTarget=!0}},zh=class extends Ws{constructor(t=null,e=1,o=1,a=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:o,depth:a},this.magFilter=_o,this.minFilter=_o,this.wrapR=Hs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Bg=class extends Ws{constructor(t=null,e=1,o=1,a=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:o,depth:a},this.magFilter=_o,this.minFilter=_o,this.wrapR=Hs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var bu=class{constructor(t=0,e=0,o=0,a=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=o,this._w=a}static slerpFlat(t,e,o,a,c,p,d){let g=o[a+0],y=o[a+1],_=o[a+2],w=o[a+3],x=c[p+0],b=c[p+1],P=c[p+2],I=c[p+3];if(d===0){t[e+0]=g,t[e+1]=y,t[e+2]=_,t[e+3]=w;return}if(d===1){t[e+0]=x,t[e+1]=b,t[e+2]=P,t[e+3]=I;return}if(w!==I||g!==x||y!==b||_!==P){let M=1-d,E=g*x+y*b+_*P+w*I,N=E>=0?1:-1,A=1-E*E;if(A>Number.EPSILON){let z=Math.sqrt(A),$=Math.atan2(z,E*N);M=Math.sin(M*$)/z,d=Math.sin(d*$)/z}let U=d*N;if(g=g*M+x*U,y=y*M+b*U,_=_*M+P*U,w=w*M+I*U,M===1-d){let z=1/Math.sqrt(g*g+y*y+_*_+w*w);g*=z,y*=z,_*=z,w*=z}}t[e]=g,t[e+1]=y,t[e+2]=_,t[e+3]=w}static multiplyQuaternionsFlat(t,e,o,a,c,p){let d=o[a],g=o[a+1],y=o[a+2],_=o[a+3],w=c[p],x=c[p+1],b=c[p+2],P=c[p+3];return t[e]=d*P+_*w+g*b-y*x,t[e+1]=g*P+_*x+y*w-d*b,t[e+2]=y*P+_*b+d*x-g*w,t[e+3]=_*P-d*w-g*x-y*b,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,o,a){return this._x=t,this._y=e,this._z=o,this._w=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){let o=t._x,a=t._y,c=t._z,p=t._order,d=Math.cos,g=Math.sin,y=d(o/2),_=d(a/2),w=d(c/2),x=g(o/2),b=g(a/2),P=g(c/2);switch(p){case"XYZ":this._x=x*_*w+y*b*P,this._y=y*b*w-x*_*P,this._z=y*_*P+x*b*w,this._w=y*_*w-x*b*P;break;case"YXZ":this._x=x*_*w+y*b*P,this._y=y*b*w-x*_*P,this._z=y*_*P-x*b*w,this._w=y*_*w+x*b*P;break;case"ZXY":this._x=x*_*w-y*b*P,this._y=y*b*w+x*_*P,this._z=y*_*P+x*b*w,this._w=y*_*w-x*b*P;break;case"ZYX":this._x=x*_*w-y*b*P,this._y=y*b*w+x*_*P,this._z=y*_*P-x*b*w,this._w=y*_*w+x*b*P;break;case"YZX":this._x=x*_*w+y*b*P,this._y=y*b*w+x*_*P,this._z=y*_*P-x*b*w,this._w=y*_*w-x*b*P;break;case"XZY":this._x=x*_*w-y*b*P,this._y=y*b*w-x*_*P,this._z=y*_*P+x*b*w,this._w=y*_*w+x*b*P;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+p)}return e!==!1&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let o=e/2,a=Math.sin(o);return this._x=t.x*a,this._y=t.y*a,this._z=t.z*a,this._w=Math.cos(o),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,o=e[0],a=e[4],c=e[8],p=e[1],d=e[5],g=e[9],y=e[2],_=e[6],w=e[10],x=o+d+w;if(x>0){let b=.5/Math.sqrt(x+1);this._w=.25/b,this._x=(_-g)*b,this._y=(c-y)*b,this._z=(p-a)*b}else if(o>d&&o>w){let b=2*Math.sqrt(1+o-d-w);this._w=(_-g)/b,this._x=.25*b,this._y=(a+p)/b,this._z=(c+y)/b}else if(d>w){let b=2*Math.sqrt(1+d-o-w);this._w=(c-y)/b,this._x=(a+p)/b,this._y=.25*b,this._z=(g+_)/b}else{let b=2*Math.sqrt(1+w-o-d);this._w=(p-a)/b,this._x=(c+y)/b,this._y=(g+_)/b,this._z=.25*b}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let o=t.dot(e)+1;return o<Number.EPSILON?(o=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=o):(this._x=0,this._y=-t.z,this._z=t.y,this._w=o)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=o),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Ho(this.dot(t),-1,1)))}rotateTowards(t,e){let o=this.angleTo(t);if(o===0)return this;let a=Math.min(1,e/o);return this.slerp(t,a),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let o=t._x,a=t._y,c=t._z,p=t._w,d=e._x,g=e._y,y=e._z,_=e._w;return this._x=o*_+p*d+a*y-c*g,this._y=a*_+p*g+c*d-o*y,this._z=c*_+p*y+o*g-a*d,this._w=p*_-o*d-a*g-c*y,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);let o=this._x,a=this._y,c=this._z,p=this._w,d=p*t._w+o*t._x+a*t._y+c*t._z;if(d<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,d=-d):this.copy(t),d>=1)return this._w=p,this._x=o,this._y=a,this._z=c,this;let g=1-d*d;if(g<=Number.EPSILON){let b=1-e;return this._w=b*p+e*this._w,this._x=b*o+e*this._x,this._y=b*a+e*this._y,this._z=b*c+e*this._z,this.normalize(),this._onChangeCallback(),this}let y=Math.sqrt(g),_=Math.atan2(y,d),w=Math.sin((1-e)*_)/y,x=Math.sin(e*_)/y;return this._w=p*w+this._w*x,this._x=o*w+this._x*x,this._y=a*w+this._y*x,this._z=c*w+this._z*x,this._onChangeCallback(),this}slerpQuaternions(t,e,o){return this.copy(t).slerp(e,o)}random(){let t=Math.random(),e=Math.sqrt(1-t),o=Math.sqrt(t),a=2*Math.PI*Math.random(),c=2*Math.PI*Math.random();return this.set(e*Math.cos(a),o*Math.sin(c),o*Math.cos(c),e*Math.sin(a))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Rt=class r{constructor(t=0,e=0,o=0){r.prototype.isVector3=!0,this.x=t,this.y=e,this.z=o}set(t,e,o){return o===void 0&&(o=this.z),this.x=t,this.y=e,this.z=o,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(J_.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(J_.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,o=this.y,a=this.z,c=t.elements;return this.x=c[0]*e+c[3]*o+c[6]*a,this.y=c[1]*e+c[4]*o+c[7]*a,this.z=c[2]*e+c[5]*o+c[8]*a,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,o=this.y,a=this.z,c=t.elements,p=1/(c[3]*e+c[7]*o+c[11]*a+c[15]);return this.x=(c[0]*e+c[4]*o+c[8]*a+c[12])*p,this.y=(c[1]*e+c[5]*o+c[9]*a+c[13])*p,this.z=(c[2]*e+c[6]*o+c[10]*a+c[14])*p,this}applyQuaternion(t){let e=this.x,o=this.y,a=this.z,c=t.x,p=t.y,d=t.z,g=t.w,y=g*e+p*a-d*o,_=g*o+d*e-c*a,w=g*a+c*o-p*e,x=-c*e-p*o-d*a;return this.x=y*g+x*-c+_*-d-w*-p,this.y=_*g+x*-p+w*-c-y*-d,this.z=w*g+x*-d+y*-p-_*-c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,o=this.y,a=this.z,c=t.elements;return this.x=c[0]*e+c[4]*o+c[8]*a,this.y=c[1]*e+c[5]*o+c[9]*a,this.z=c[2]*e+c[6]*o+c[10]*a,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this.z=t.z+(e.z-t.z)*o,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let o=t.x,a=t.y,c=t.z,p=e.x,d=e.y,g=e.z;return this.x=a*g-c*d,this.y=c*p-o*g,this.z=o*d-a*p,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let o=t.dot(this)/e;return this.copy(t).multiplyScalar(o)}projectOnPlane(t){return hg.copy(this).projectOnVector(t),this.sub(hg)}reflect(t){return this.sub(hg.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let o=this.dot(t)/e;return Math.acos(Ho(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y,a=this.z-t.z;return e*e+o*o+a*a}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,o){let a=Math.sin(e)*t;return this.x=a*Math.sin(o),this.y=Math.cos(e)*t,this.z=a*Math.cos(o),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,o){return this.x=t*Math.sin(e),this.y=o,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),o=this.setFromMatrixColumn(t,1).length(),a=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=o,this.z=a,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=(Math.random()-.5)*2,e=Math.random()*Math.PI*2,o=Math.sqrt(1-t**2);return this.x=o*Math.cos(e),this.y=o*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},hg=new Rt,J_=new bu,rl=class{constructor(t=new Rt(1/0,1/0,1/0),e=new Rt(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,o=t.length;e<o;e+=3)this.expandByPoint(Ua.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,o=t.count;e<o;e++)this.expandByPoint(Ua.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,o=t.length;e<o;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let o=Ua.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(o),this.max.copy(t).add(o),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){if(t.updateWorldMatrix(!1,!1),t.boundingBox!==void 0)t.boundingBox===null&&t.computeBoundingBox(),Pl.copy(t.boundingBox),Pl.applyMatrix4(t.matrixWorld),this.union(Pl);else{let a=t.geometry;if(a!==void 0)if(e&&a.attributes!==void 0&&a.attributes.position!==void 0){let c=a.attributes.position;for(let p=0,d=c.count;p<d;p++)Ua.fromBufferAttribute(c,p).applyMatrix4(t.matrixWorld),this.expandByPoint(Ua)}else a.boundingBox===null&&a.computeBoundingBox(),Pl.copy(a.boundingBox),Pl.applyMatrix4(t.matrixWorld),this.union(Pl)}let o=t.children;for(let a=0,c=o.length;a<c;a++)this.expandByObject(o[a],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Ua),Ua.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,o;return t.normal.x>0?(e=t.normal.x*this.min.x,o=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,o=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,o+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,o+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,o+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,o+=t.normal.z*this.min.z),e<=-t.constant&&o>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Yc),lh.subVectors(this.max,Yc),Il.subVectors(t.a,Yc),Rl.subVectors(t.b,Yc),Ll.subVectors(t.c,Yc),pu.subVectors(Rl,Il),du.subVectors(Ll,Rl),$u.subVectors(Il,Ll);let e=[0,-pu.z,pu.y,0,-du.z,du.y,0,-$u.z,$u.y,pu.z,0,-pu.x,du.z,0,-du.x,$u.z,0,-$u.x,-pu.y,pu.x,0,-du.y,du.x,0,-$u.y,$u.x,0];return!pg(e,Il,Rl,Ll,lh)||(e=[1,0,0,0,1,0,0,0,1],!pg(e,Il,Rl,Ll,lh))?!1:(ch.crossVectors(pu,du),e=[ch.x,ch.y,ch.z],pg(e,Il,Rl,Ll,lh))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Ua).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Ua).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Fa[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Fa[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Fa[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Fa[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Fa[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Fa[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Fa[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Fa[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Fa),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},Fa=[new Rt,new Rt,new Rt,new Rt,new Rt,new Rt,new Rt,new Rt],Ua=new Rt,Pl=new rl,Il=new Rt,Rl=new Rt,Ll=new Rt,pu=new Rt,du=new Rt,$u=new Rt,Yc=new Rt,lh=new Rt,ch=new Rt,Zu=new Rt;function pg(r,t,e,o,a){for(let c=0,p=r.length-3;c<=p;c+=3){Zu.fromArray(r,c);let d=a.x*Math.abs(Zu.x)+a.y*Math.abs(Zu.y)+a.z*Math.abs(Zu.z),g=t.dot(Zu),y=e.dot(Zu),_=o.dot(Zu);if(Math.max(-Math.max(g,y,_),Math.min(g,y,_))>d)return!1}return!0}var sR=new rl,$c=new Rt,dg=new Rt,nf=class{constructor(t=new Rt,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let o=this.center;e!==void 0?o.copy(e):sR.setFromPoints(t).getCenter(o);let a=0;for(let c=0,p=t.length;c<p;c++)a=Math.max(a,o.distanceToSquared(t[c]));return this.radius=Math.sqrt(a),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let o=this.center.distanceToSquared(t);return e.copy(t),o>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;$c.subVectors(t,this.center);let e=$c.lengthSq();if(e>this.radius*this.radius){let o=Math.sqrt(e),a=(o-this.radius)*.5;this.center.addScaledVector($c,a/o),this.radius+=a}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(dg.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint($c.copy(t.center).add(dg)),this.expandByPoint($c.copy(t.center).sub(dg))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},Ba=new Rt,gg=new Rt,fh=new Rt,gu=new Rt,mg=new Rt,hh=new Rt,yg=new Rt,zg=class{constructor(t=new Rt,e=new Rt(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Ba)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let o=e.dot(this.direction);return o<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,o)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=Ba.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Ba.copy(this.origin).addScaledVector(this.direction,e),Ba.distanceToSquared(t))}distanceSqToSegment(t,e,o,a){gg.copy(t).add(e).multiplyScalar(.5),fh.copy(e).sub(t).normalize(),gu.copy(this.origin).sub(gg);let c=t.distanceTo(e)*.5,p=-this.direction.dot(fh),d=gu.dot(this.direction),g=-gu.dot(fh),y=gu.lengthSq(),_=Math.abs(1-p*p),w,x,b,P;if(_>0)if(w=p*g-d,x=p*d-g,P=c*_,w>=0)if(x>=-P)if(x<=P){let I=1/_;w*=I,x*=I,b=w*(w+p*x+2*d)+x*(p*w+x+2*g)+y}else x=c,w=Math.max(0,-(p*x+d)),b=-w*w+x*(x+2*g)+y;else x=-c,w=Math.max(0,-(p*x+d)),b=-w*w+x*(x+2*g)+y;else x<=-P?(w=Math.max(0,-(-p*c+d)),x=w>0?-c:Math.min(Math.max(-c,-g),c),b=-w*w+x*(x+2*g)+y):x<=P?(w=0,x=Math.min(Math.max(-c,-g),c),b=x*(x+2*g)+y):(w=Math.max(0,-(p*c+d)),x=w>0?c:Math.min(Math.max(-c,-g),c),b=-w*w+x*(x+2*g)+y);else x=p>0?-c:c,w=Math.max(0,-(p*x+d)),b=-w*w+x*(x+2*g)+y;return o&&o.copy(this.origin).addScaledVector(this.direction,w),a&&a.copy(gg).addScaledVector(fh,x),b}intersectSphere(t,e){Ba.subVectors(t.center,this.origin);let o=Ba.dot(this.direction),a=Ba.dot(Ba)-o*o,c=t.radius*t.radius;if(a>c)return null;let p=Math.sqrt(c-a),d=o-p,g=o+p;return g<0?null:d<0?this.at(g,e):this.at(d,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let o=-(this.origin.dot(t.normal)+t.constant)/e;return o>=0?o:null}intersectPlane(t,e){let o=this.distanceToPlane(t);return o===null?null:this.at(o,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let o,a,c,p,d,g,y=1/this.direction.x,_=1/this.direction.y,w=1/this.direction.z,x=this.origin;return y>=0?(o=(t.min.x-x.x)*y,a=(t.max.x-x.x)*y):(o=(t.max.x-x.x)*y,a=(t.min.x-x.x)*y),_>=0?(c=(t.min.y-x.y)*_,p=(t.max.y-x.y)*_):(c=(t.max.y-x.y)*_,p=(t.min.y-x.y)*_),o>p||c>a||((c>o||isNaN(o))&&(o=c),(p<a||isNaN(a))&&(a=p),w>=0?(d=(t.min.z-x.z)*w,g=(t.max.z-x.z)*w):(d=(t.max.z-x.z)*w,g=(t.min.z-x.z)*w),o>g||d>a)||((d>o||o!==o)&&(o=d),(g<a||a!==a)&&(a=g),a<0)?null:this.at(o>=0?o:a,e)}intersectsBox(t){return this.intersectBox(t,Ba)!==null}intersectTriangle(t,e,o,a,c){mg.subVectors(e,t),hh.subVectors(o,t),yg.crossVectors(mg,hh);let p=this.direction.dot(yg),d;if(p>0){if(a)return null;d=1}else if(p<0)d=-1,p=-p;else return null;gu.subVectors(this.origin,t);let g=d*this.direction.dot(hh.crossVectors(gu,hh));if(g<0)return null;let y=d*this.direction.dot(mg.cross(gu));if(y<0||g+y>p)return null;let _=-d*gu.dot(yg);return _<0?null:this.at(_/p,c)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},ro=class r{constructor(t,e,o,a,c,p,d,g,y,_,w,x,b,P,I,M){r.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,o,a,c,p,d,g,y,_,w,x,b,P,I,M)}set(t,e,o,a,c,p,d,g,y,_,w,x,b,P,I,M){let E=this.elements;return E[0]=t,E[4]=e,E[8]=o,E[12]=a,E[1]=c,E[5]=p,E[9]=d,E[13]=g,E[2]=y,E[6]=_,E[10]=w,E[14]=x,E[3]=b,E[7]=P,E[11]=I,E[15]=M,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new r().fromArray(this.elements)}copy(t){let e=this.elements,o=t.elements;return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=o[3],e[4]=o[4],e[5]=o[5],e[6]=o[6],e[7]=o[7],e[8]=o[8],e[9]=o[9],e[10]=o[10],e[11]=o[11],e[12]=o[12],e[13]=o[13],e[14]=o[14],e[15]=o[15],this}copyPosition(t){let e=this.elements,o=t.elements;return e[12]=o[12],e[13]=o[13],e[14]=o[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,o){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),o.setFromMatrixColumn(this,2),this}makeBasis(t,e,o){return this.set(t.x,e.x,o.x,0,t.y,e.y,o.y,0,t.z,e.z,o.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,o=t.elements,a=1/Nl.setFromMatrixColumn(t,0).length(),c=1/Nl.setFromMatrixColumn(t,1).length(),p=1/Nl.setFromMatrixColumn(t,2).length();return e[0]=o[0]*a,e[1]=o[1]*a,e[2]=o[2]*a,e[3]=0,e[4]=o[4]*c,e[5]=o[5]*c,e[6]=o[6]*c,e[7]=0,e[8]=o[8]*p,e[9]=o[9]*p,e[10]=o[10]*p,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,o=t.x,a=t.y,c=t.z,p=Math.cos(o),d=Math.sin(o),g=Math.cos(a),y=Math.sin(a),_=Math.cos(c),w=Math.sin(c);if(t.order==="XYZ"){let x=p*_,b=p*w,P=d*_,I=d*w;e[0]=g*_,e[4]=-g*w,e[8]=y,e[1]=b+P*y,e[5]=x-I*y,e[9]=-d*g,e[2]=I-x*y,e[6]=P+b*y,e[10]=p*g}else if(t.order==="YXZ"){let x=g*_,b=g*w,P=y*_,I=y*w;e[0]=x+I*d,e[4]=P*d-b,e[8]=p*y,e[1]=p*w,e[5]=p*_,e[9]=-d,e[2]=b*d-P,e[6]=I+x*d,e[10]=p*g}else if(t.order==="ZXY"){let x=g*_,b=g*w,P=y*_,I=y*w;e[0]=x-I*d,e[4]=-p*w,e[8]=P+b*d,e[1]=b+P*d,e[5]=p*_,e[9]=I-x*d,e[2]=-p*y,e[6]=d,e[10]=p*g}else if(t.order==="ZYX"){let x=p*_,b=p*w,P=d*_,I=d*w;e[0]=g*_,e[4]=P*y-b,e[8]=x*y+I,e[1]=g*w,e[5]=I*y+x,e[9]=b*y-P,e[2]=-y,e[6]=d*g,e[10]=p*g}else if(t.order==="YZX"){let x=p*g,b=p*y,P=d*g,I=d*y;e[0]=g*_,e[4]=I-x*w,e[8]=P*w+b,e[1]=w,e[5]=p*_,e[9]=-d*_,e[2]=-y*_,e[6]=b*w+P,e[10]=x-I*w}else if(t.order==="XZY"){let x=p*g,b=p*y,P=d*g,I=d*y;e[0]=g*_,e[4]=-w,e[8]=y*_,e[1]=x*w+I,e[5]=p*_,e[9]=b*w-P,e[2]=P*w-b,e[6]=d*_,e[10]=I*w+x}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(aR,t,uR)}lookAt(t,e,o){let a=this.elements;return us.subVectors(t,e),us.lengthSq()===0&&(us.z=1),us.normalize(),mu.crossVectors(o,us),mu.lengthSq()===0&&(Math.abs(o.z)===1?us.x+=1e-4:us.z+=1e-4,us.normalize(),mu.crossVectors(o,us)),mu.normalize(),ph.crossVectors(us,mu),a[0]=mu.x,a[4]=ph.x,a[8]=us.x,a[1]=mu.y,a[5]=ph.y,a[9]=us.y,a[2]=mu.z,a[6]=ph.z,a[10]=us.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,a=e.elements,c=this.elements,p=o[0],d=o[4],g=o[8],y=o[12],_=o[1],w=o[5],x=o[9],b=o[13],P=o[2],I=o[6],M=o[10],E=o[14],N=o[3],A=o[7],U=o[11],z=o[15],$=a[0],q=a[4],D=a[8],G=a[12],Q=a[1],_t=a[5],Z=a[9],Dt=a[13],et=a[2],vt=a[6],It=a[10],Pt=a[14],Et=a[3],yt=a[7],Y=a[11],ht=a[15];return c[0]=p*$+d*Q+g*et+y*Et,c[4]=p*q+d*_t+g*vt+y*yt,c[8]=p*D+d*Z+g*It+y*Y,c[12]=p*G+d*Dt+g*Pt+y*ht,c[1]=_*$+w*Q+x*et+b*Et,c[5]=_*q+w*_t+x*vt+b*yt,c[9]=_*D+w*Z+x*It+b*Y,c[13]=_*G+w*Dt+x*Pt+b*ht,c[2]=P*$+I*Q+M*et+E*Et,c[6]=P*q+I*_t+M*vt+E*yt,c[10]=P*D+I*Z+M*It+E*Y,c[14]=P*G+I*Dt+M*Pt+E*ht,c[3]=N*$+A*Q+U*et+z*Et,c[7]=N*q+A*_t+U*vt+z*yt,c[11]=N*D+A*Z+U*It+z*Y,c[15]=N*G+A*Dt+U*Pt+z*ht,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],o=t[4],a=t[8],c=t[12],p=t[1],d=t[5],g=t[9],y=t[13],_=t[2],w=t[6],x=t[10],b=t[14],P=t[3],I=t[7],M=t[11],E=t[15];return P*(+c*g*w-a*y*w-c*d*x+o*y*x+a*d*b-o*g*b)+I*(+e*g*b-e*y*x+c*p*x-a*p*b+a*y*_-c*g*_)+M*(+e*y*w-e*d*b-c*p*w+o*p*b+c*d*_-o*y*_)+E*(-a*d*_-e*g*w+e*d*x+a*p*w-o*p*x+o*g*_)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,o){let a=this.elements;return t.isVector3?(a[12]=t.x,a[13]=t.y,a[14]=t.z):(a[12]=t,a[13]=e,a[14]=o),this}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],c=t[3],p=t[4],d=t[5],g=t[6],y=t[7],_=t[8],w=t[9],x=t[10],b=t[11],P=t[12],I=t[13],M=t[14],E=t[15],N=w*M*y-I*x*y+I*g*b-d*M*b-w*g*E+d*x*E,A=P*x*y-_*M*y-P*g*b+p*M*b+_*g*E-p*x*E,U=_*I*y-P*w*y+P*d*b-p*I*b-_*d*E+p*w*E,z=P*w*g-_*I*g-P*d*x+p*I*x+_*d*M-p*w*M,$=e*N+o*A+a*U+c*z;if($===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let q=1/$;return t[0]=N*q,t[1]=(I*x*c-w*M*c-I*a*b+o*M*b+w*a*E-o*x*E)*q,t[2]=(d*M*c-I*g*c+I*a*y-o*M*y-d*a*E+o*g*E)*q,t[3]=(w*g*c-d*x*c-w*a*y+o*x*y+d*a*b-o*g*b)*q,t[4]=A*q,t[5]=(_*M*c-P*x*c+P*a*b-e*M*b-_*a*E+e*x*E)*q,t[6]=(P*g*c-p*M*c-P*a*y+e*M*y+p*a*E-e*g*E)*q,t[7]=(p*x*c-_*g*c+_*a*y-e*x*y-p*a*b+e*g*b)*q,t[8]=U*q,t[9]=(P*w*c-_*I*c-P*o*b+e*I*b+_*o*E-e*w*E)*q,t[10]=(p*I*c-P*d*c+P*o*y-e*I*y-p*o*E+e*d*E)*q,t[11]=(_*d*c-p*w*c-_*o*y+e*w*y+p*o*b-e*d*b)*q,t[12]=z*q,t[13]=(_*I*a-P*w*a+P*o*x-e*I*x-_*o*M+e*w*M)*q,t[14]=(P*d*a-p*I*a-P*o*g+e*I*g+p*o*M-e*d*M)*q,t[15]=(p*w*a-_*d*a+_*o*g-e*w*g-p*o*x+e*d*x)*q,this}scale(t){let e=this.elements,o=t.x,a=t.y,c=t.z;return e[0]*=o,e[4]*=a,e[8]*=c,e[1]*=o,e[5]*=a,e[9]*=c,e[2]*=o,e[6]*=a,e[10]*=c,e[3]*=o,e[7]*=a,e[11]*=c,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],o=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],a=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,o,a))}makeTranslation(t,e,o){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,o,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),o=Math.sin(t);return this.set(1,0,0,0,0,e,-o,0,0,o,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,0,o,0,0,1,0,0,-o,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,-o,0,0,o,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let o=Math.cos(e),a=Math.sin(e),c=1-o,p=t.x,d=t.y,g=t.z,y=c*p,_=c*d;return this.set(y*p+o,y*d-a*g,y*g+a*d,0,y*d+a*g,_*d+o,_*g-a*p,0,y*g-a*d,_*g+a*p,c*g*g+o,0,0,0,0,1),this}makeScale(t,e,o){return this.set(t,0,0,0,0,e,0,0,0,0,o,0,0,0,0,1),this}makeShear(t,e,o,a,c,p){return this.set(1,o,c,0,t,1,p,0,e,a,1,0,0,0,0,1),this}compose(t,e,o){let a=this.elements,c=e._x,p=e._y,d=e._z,g=e._w,y=c+c,_=p+p,w=d+d,x=c*y,b=c*_,P=c*w,I=p*_,M=p*w,E=d*w,N=g*y,A=g*_,U=g*w,z=o.x,$=o.y,q=o.z;return a[0]=(1-(I+E))*z,a[1]=(b+U)*z,a[2]=(P-A)*z,a[3]=0,a[4]=(b-U)*$,a[5]=(1-(x+E))*$,a[6]=(M+N)*$,a[7]=0,a[8]=(P+A)*q,a[9]=(M-N)*q,a[10]=(1-(x+I))*q,a[11]=0,a[12]=t.x,a[13]=t.y,a[14]=t.z,a[15]=1,this}decompose(t,e,o){let a=this.elements,c=Nl.set(a[0],a[1],a[2]).length(),p=Nl.set(a[4],a[5],a[6]).length(),d=Nl.set(a[8],a[9],a[10]).length();this.determinant()<0&&(c=-c),t.x=a[12],t.y=a[13],t.z=a[14],Gs.copy(this);let y=1/c,_=1/p,w=1/d;return Gs.elements[0]*=y,Gs.elements[1]*=y,Gs.elements[2]*=y,Gs.elements[4]*=_,Gs.elements[5]*=_,Gs.elements[6]*=_,Gs.elements[8]*=w,Gs.elements[9]*=w,Gs.elements[10]*=w,e.setFromRotationMatrix(Gs),o.x=c,o.y=p,o.z=d,this}makePerspective(t,e,o,a,c,p,d=qa){let g=this.elements,y=2*c/(e-t),_=2*c/(o-a),w=(e+t)/(e-t),x=(o+a)/(o-a),b,P;if(d===qa)b=-(p+c)/(p-c),P=-2*p*c/(p-c);else if(d===Dh)b=-p/(p-c),P=-p*c/(p-c);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+d);return g[0]=y,g[4]=0,g[8]=w,g[12]=0,g[1]=0,g[5]=_,g[9]=x,g[13]=0,g[2]=0,g[6]=0,g[10]=b,g[14]=P,g[3]=0,g[7]=0,g[11]=-1,g[15]=0,this}makeOrthographic(t,e,o,a,c,p,d=qa){let g=this.elements,y=1/(e-t),_=1/(o-a),w=1/(p-c),x=(e+t)*y,b=(o+a)*_,P,I;if(d===qa)P=(p+c)*w,I=-2*w;else if(d===Dh)P=c*w,I=-1*w;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+d);return g[0]=2*y,g[4]=0,g[8]=0,g[12]=-x,g[1]=0,g[5]=2*_,g[9]=0,g[13]=-b,g[2]=0,g[6]=0,g[10]=I,g[14]=-P,g[3]=0,g[7]=0,g[11]=0,g[15]=1,this}equals(t){let e=this.elements,o=t.elements;for(let a=0;a<16;a++)if(e[a]!==o[a])return!1;return!0}fromArray(t,e=0){for(let o=0;o<16;o++)this.elements[o]=t[o+e];return this}toArray(t=[],e=0){let o=this.elements;return t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3],t[e+4]=o[4],t[e+5]=o[5],t[e+6]=o[6],t[e+7]=o[7],t[e+8]=o[8],t[e+9]=o[9],t[e+10]=o[10],t[e+11]=o[11],t[e+12]=o[12],t[e+13]=o[13],t[e+14]=o[14],t[e+15]=o[15],t}},Nl=new Rt,Gs=new ro,aR=new Rt(0,0,0),uR=new Rt(1,1,1),mu=new Rt,ph=new Rt,us=new Rt,K_=new ro,Q_=new bu,Gh=class r{constructor(t=0,e=0,o=0,a=r.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=o,this._order=a}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,o,a=this._order){return this._x=t,this._y=e,this._z=o,this._order=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,o=!0){let a=t.elements,c=a[0],p=a[4],d=a[8],g=a[1],y=a[5],_=a[9],w=a[2],x=a[6],b=a[10];switch(e){case"XYZ":this._y=Math.asin(Ho(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(-_,b),this._z=Math.atan2(-p,c)):(this._x=Math.atan2(x,y),this._z=0);break;case"YXZ":this._x=Math.asin(-Ho(_,-1,1)),Math.abs(_)<.9999999?(this._y=Math.atan2(d,b),this._z=Math.atan2(g,y)):(this._y=Math.atan2(-w,c),this._z=0);break;case"ZXY":this._x=Math.asin(Ho(x,-1,1)),Math.abs(x)<.9999999?(this._y=Math.atan2(-w,b),this._z=Math.atan2(-p,y)):(this._y=0,this._z=Math.atan2(g,c));break;case"ZYX":this._y=Math.asin(-Ho(w,-1,1)),Math.abs(w)<.9999999?(this._x=Math.atan2(x,b),this._z=Math.atan2(g,c)):(this._x=0,this._z=Math.atan2(-p,y));break;case"YZX":this._z=Math.asin(Ho(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(-_,y),this._y=Math.atan2(-w,c)):(this._x=0,this._y=Math.atan2(d,b));break;case"XZY":this._z=Math.asin(-Ho(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(x,y),this._y=Math.atan2(d,c)):(this._x=Math.atan2(-_,b),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,o===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,o){return K_.makeRotationFromQuaternion(t),this.setFromRotationMatrix(K_,e,o)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Q_.setFromEuler(this),this.setFromQuaternion(Q_,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Gh.DEFAULT_ORDER="XYZ";var kh=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},lR=0,j_=new Rt,Ol=new bu,za=new ro,dh=new Rt,Zc=new Rt,cR=new Rt,fR=new bu,t1=new Rt(1,0,0),e1=new Rt(0,1,0),n1=new Rt(0,0,1),hR={type:"added"},pR={type:"removed"},ha=class r extends Su{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:lR++}),this.uuid=sf(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new Rt,e=new Gh,o=new bu,a=new Rt(1,1,1);function c(){o.setFromEuler(e,!1)}function p(){e.setFromQuaternion(o,void 0,!1)}e._onChange(c),o._onChange(p),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:o},scale:{configurable:!0,enumerable:!0,value:a},modelViewMatrix:{value:new ro},normalMatrix:{value:new Ke}}),this.matrix=new ro,this.matrixWorld=new ro,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new kh,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Ol.setFromAxisAngle(t,e),this.quaternion.multiply(Ol),this}rotateOnWorldAxis(t,e){return Ol.setFromAxisAngle(t,e),this.quaternion.premultiply(Ol),this}rotateX(t){return this.rotateOnAxis(t1,t)}rotateY(t){return this.rotateOnAxis(e1,t)}rotateZ(t){return this.rotateOnAxis(n1,t)}translateOnAxis(t,e){return j_.copy(t).applyQuaternion(this.quaternion),this.position.add(j_.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(t1,t)}translateY(t){return this.translateOnAxis(e1,t)}translateZ(t){return this.translateOnAxis(n1,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(za.copy(this.matrixWorld).invert())}lookAt(t,e,o){t.isVector3?dh.copy(t):dh.set(t,e,o);let a=this.parent;this.updateWorldMatrix(!0,!1),Zc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?za.lookAt(Zc,dh,this.up):za.lookAt(dh,Zc,this.up),this.quaternion.setFromRotationMatrix(za),a&&(za.extractRotation(a.matrixWorld),Ol.setFromRotationMatrix(za),this.quaternion.premultiply(Ol.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(hR)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let o=0;o<arguments.length;o++)this.remove(arguments[o]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(pR)),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),za.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),za.multiply(t.parent.matrixWorld)),t.applyMatrix4(za),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let o=0,a=this.children.length;o<a;o++){let p=this.children[o].getObjectByProperty(t,e);if(p!==void 0)return p}}getObjectsByProperty(t,e){let o=[];this[t]===e&&o.push(this);for(let a=0,c=this.children.length;a<c;a++){let p=this.children[a].getObjectsByProperty(t,e);p.length>0&&(o=o.concat(p))}return o}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Zc,t,cR),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Zc,fR,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let o=0,a=e.length;o<a;o++)e[o].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let o=0,a=e.length;o<a;o++)e[o].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let o=0,a=e.length;o<a;o++){let c=e[o];(c.matrixWorldAutoUpdate===!0||t===!0)&&c.updateMatrixWorld(t)}}updateWorldMatrix(t,e){let o=this.parent;if(t===!0&&o!==null&&o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e===!0){let a=this.children;for(let c=0,p=a.length;c<p;c++){let d=a[c];d.matrixWorldAutoUpdate===!0&&d.updateWorldMatrix(!1,!0)}}}toJSON(t){let e=t===void 0||typeof t=="string",o={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},o.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let a={};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.castShadow===!0&&(a.castShadow=!0),this.receiveShadow===!0&&(a.receiveShadow=!0),this.visible===!1&&(a.visible=!1),this.frustumCulled===!1&&(a.frustumCulled=!1),this.renderOrder!==0&&(a.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),a.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(a.instanceColor=this.instanceColor.toJSON()));function c(d,g){return d[g.uuid]===void 0&&(d[g.uuid]=g.toJSON(t)),g.uuid}if(this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(a.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=c(t.geometries,this.geometry);let d=this.geometry.parameters;if(d!==void 0&&d.shapes!==void 0){let g=d.shapes;if(Array.isArray(g))for(let y=0,_=g.length;y<_;y++){let w=g[y];c(t.shapes,w)}else c(t.shapes,g)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(c(t.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let d=[];for(let g=0,y=this.material.length;g<y;g++)d.push(c(t.materials,this.material[g]));a.material=d}else a.material=c(t.materials,this.material);if(this.children.length>0){a.children=[];for(let d=0;d<this.children.length;d++)a.children.push(this.children[d].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let d=0;d<this.animations.length;d++){let g=this.animations[d];a.animations.push(c(t.animations,g))}}if(e){let d=p(t.geometries),g=p(t.materials),y=p(t.textures),_=p(t.images),w=p(t.shapes),x=p(t.skeletons),b=p(t.animations),P=p(t.nodes);d.length>0&&(o.geometries=d),g.length>0&&(o.materials=g),y.length>0&&(o.textures=y),_.length>0&&(o.images=_),w.length>0&&(o.shapes=w),x.length>0&&(o.skeletons=x),b.length>0&&(o.animations=b),P.length>0&&(o.nodes=P)}return o.object=a,o;function p(d){let g=[];for(let y in d){let _=d[y];delete _.metadata,g.push(_)}return g}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let o=0;o<t.children.length;o++){let a=t.children[o];this.add(a.clone())}return this}};ha.DEFAULT_UP=new Rt(0,1,0);ha.DEFAULT_MATRIX_AUTO_UPDATE=!0;ha.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var ks=new Rt,Ga=new Rt,vg=new Rt,ka=new Rt,Dl=new Rt,Fl=new Rt,r1=new Rt,_g=new Rt,xg=new Rt,Eg=new Rt,gh=!1,ql=class r{constructor(t=new Rt,e=new Rt,o=new Rt){this.a=t,this.b=e,this.c=o}static getNormal(t,e,o,a){a.subVectors(o,e),ks.subVectors(t,e),a.cross(ks);let c=a.lengthSq();return c>0?a.multiplyScalar(1/Math.sqrt(c)):a.set(0,0,0)}static getBarycoord(t,e,o,a,c){ks.subVectors(a,e),Ga.subVectors(o,e),vg.subVectors(t,e);let p=ks.dot(ks),d=ks.dot(Ga),g=ks.dot(vg),y=Ga.dot(Ga),_=Ga.dot(vg),w=p*y-d*d;if(w===0)return c.set(-2,-1,-1);let x=1/w,b=(y*g-d*_)*x,P=(p*_-d*g)*x;return c.set(1-b-P,P,b)}static containsPoint(t,e,o,a){return this.getBarycoord(t,e,o,a,ka),ka.x>=0&&ka.y>=0&&ka.x+ka.y<=1}static getUV(t,e,o,a,c,p,d,g){return gh===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),gh=!0),this.getInterpolation(t,e,o,a,c,p,d,g)}static getInterpolation(t,e,o,a,c,p,d,g){return this.getBarycoord(t,e,o,a,ka),g.setScalar(0),g.addScaledVector(c,ka.x),g.addScaledVector(p,ka.y),g.addScaledVector(d,ka.z),g}static isFrontFacing(t,e,o,a){return ks.subVectors(o,e),Ga.subVectors(t,e),ks.cross(Ga).dot(a)<0}set(t,e,o){return this.a.copy(t),this.b.copy(e),this.c.copy(o),this}setFromPointsAndIndices(t,e,o,a){return this.a.copy(t[e]),this.b.copy(t[o]),this.c.copy(t[a]),this}setFromAttributeAndIndices(t,e,o,a){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,o),this.c.fromBufferAttribute(t,a),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ks.subVectors(this.c,this.b),Ga.subVectors(this.a,this.b),ks.cross(Ga).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return r.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return r.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,o,a,c){return gh===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),gh=!0),r.getInterpolation(t,this.a,this.b,this.c,e,o,a,c)}getInterpolation(t,e,o,a,c){return r.getInterpolation(t,this.a,this.b,this.c,e,o,a,c)}containsPoint(t){return r.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return r.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let o=this.a,a=this.b,c=this.c,p,d;Dl.subVectors(a,o),Fl.subVectors(c,o),_g.subVectors(t,o);let g=Dl.dot(_g),y=Fl.dot(_g);if(g<=0&&y<=0)return e.copy(o);xg.subVectors(t,a);let _=Dl.dot(xg),w=Fl.dot(xg);if(_>=0&&w<=_)return e.copy(a);let x=g*w-_*y;if(x<=0&&g>=0&&_<=0)return p=g/(g-_),e.copy(o).addScaledVector(Dl,p);Eg.subVectors(t,c);let b=Dl.dot(Eg),P=Fl.dot(Eg);if(P>=0&&b<=P)return e.copy(c);let I=b*y-g*P;if(I<=0&&y>=0&&P<=0)return d=y/(y-P),e.copy(o).addScaledVector(Fl,d);let M=_*P-b*w;if(M<=0&&w-_>=0&&b-P>=0)return r1.subVectors(c,a),d=(w-_)/(w-_+(b-P)),e.copy(a).addScaledVector(r1,d);let E=1/(M+I+x);return p=I*E,d=x*E,e.copy(o).addScaledVector(Dl,p).addScaledVector(Fl,d)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},dR=0,tc=class extends Su{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:dR++}),this.uuid=sf(),this.name="",this.type="Material",this.blending=$l,this.side=Mu,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=R1,this.blendDst=L1,this.blendEquation=Wl,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Pg,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=XI,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=sg,this.stencilZFail=sg,this.stencilZPass=sg,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let o=t[e];if(o===void 0){console.warn(\`THREE.Material: parameter '\${e}' has value of undefined.\`);continue}let a=this[e];if(a===void 0){console.warn(\`THREE.Material: '\${e}' is not a property of THREE.\${this.type}.\`);continue}a&&a.isColor?a.set(o):a&&a.isVector3&&o&&o.isVector3?a.copy(o):this[e]=o}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let o={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};o.uuid=this.uuid,o.type=this.type,this.name!==""&&(o.name=this.name),this.color&&this.color.isColor&&(o.color=this.color.getHex()),this.roughness!==void 0&&(o.roughness=this.roughness),this.metalness!==void 0&&(o.metalness=this.metalness),this.sheen!==void 0&&(o.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(o.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(o.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(o.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(o.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(o.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(o.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(o.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(o.shininess=this.shininess),this.clearcoat!==void 0&&(o.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(o.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(o.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(o.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(o.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,o.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(o.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(o.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(o.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(o.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(o.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(o.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(o.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(o.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(o.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(o.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(o.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(o.lightMap=this.lightMap.toJSON(t).uuid,o.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(o.aoMap=this.aoMap.toJSON(t).uuid,o.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(o.bumpMap=this.bumpMap.toJSON(t).uuid,o.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(o.normalMap=this.normalMap.toJSON(t).uuid,o.normalMapType=this.normalMapType,o.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(o.displacementMap=this.displacementMap.toJSON(t).uuid,o.displacementScale=this.displacementScale,o.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(o.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(o.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(o.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(o.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(o.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(o.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(o.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(o.combine=this.combine)),this.envMapIntensity!==void 0&&(o.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(o.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(o.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(o.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(o.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(o.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(o.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(o.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(o.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(o.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(o.size=this.size),this.shadowSide!==null&&(o.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(o.sizeAttenuation=this.sizeAttenuation),this.blending!==$l&&(o.blending=this.blending),this.side!==Mu&&(o.side=this.side),this.vertexColors===!0&&(o.vertexColors=!0),this.opacity<1&&(o.opacity=this.opacity),this.transparent===!0&&(o.transparent=!0),o.depthFunc=this.depthFunc,o.depthTest=this.depthTest,o.depthWrite=this.depthWrite,o.colorWrite=this.colorWrite,o.stencilWrite=this.stencilWrite,o.stencilWriteMask=this.stencilWriteMask,o.stencilFunc=this.stencilFunc,o.stencilRef=this.stencilRef,o.stencilFuncMask=this.stencilFuncMask,o.stencilFail=this.stencilFail,o.stencilZFail=this.stencilZFail,o.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(o.rotation=this.rotation),this.polygonOffset===!0&&(o.polygonOffset=!0),this.polygonOffsetFactor!==0&&(o.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(o.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(o.linewidth=this.linewidth),this.dashSize!==void 0&&(o.dashSize=this.dashSize),this.gapSize!==void 0&&(o.gapSize=this.gapSize),this.scale!==void 0&&(o.scale=this.scale),this.dithering===!0&&(o.dithering=!0),this.alphaTest>0&&(o.alphaTest=this.alphaTest),this.alphaHash===!0&&(o.alphaHash=!0),this.alphaToCoverage===!0&&(o.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(o.premultipliedAlpha=!0),this.forceSinglePass===!0&&(o.forceSinglePass=!0),this.wireframe===!0&&(o.wireframe=!0),this.wireframeLinewidth>1&&(o.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(o.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(o.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(o.flatShading=!0),this.visible===!1&&(o.visible=!1),this.toneMapped===!1&&(o.toneMapped=!1),this.fog===!1&&(o.fog=!1),Object.keys(this.userData).length>0&&(o.userData=this.userData);function a(c){let p=[];for(let d in c){let g=c[d];delete g.metadata,p.push(g)}return p}if(e){let c=a(t.textures),p=a(t.images);c.length>0&&(o.textures=c),p.length>0&&(o.images=p)}return o}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,o=null;if(e!==null){let a=e.length;o=new Array(a);for(let c=0;c!==a;++c)o[c]=e[c].clone()}return this.clippingPlanes=o,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},V1={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},yu={h:0,s:0,l:0},mh={h:0,s:0,l:0};function wg(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}var Er=class{constructor(t,e,o){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,o)}set(t,e,o){if(e===void 0&&o===void 0){let a=t;a&&a.isColor?this.copy(a):typeof a=="number"?this.setHex(a):typeof a=="string"&&this.setStyle(a)}else this.setRGB(t,e,o);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=qi){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,yr.toWorkingColorSpace(this,e),this}setRGB(t,e,o,a=yr.workingColorSpace){return this.r=t,this.g=e,this.b=o,yr.toWorkingColorSpace(this,a),this}setHSL(t,e,o,a=yr.workingColorSpace){if(t=eR(t,1),e=Ho(e,0,1),o=Ho(o,0,1),e===0)this.r=this.g=this.b=o;else{let c=o<=.5?o*(1+e):o+e-o*e,p=2*o-c;this.r=wg(p,c,t+1/3),this.g=wg(p,c,t),this.b=wg(p,c,t-1/3)}return yr.toWorkingColorSpace(this,a),this}setStyle(t,e=qi){function o(c){c!==void 0&&parseFloat(c)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let a;if(a=/^(\\w+)\\(([^\\)]*)\\)/.exec(t)){let c,p=a[1],d=a[2];switch(p){case"rgb":case"rgba":if(c=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(d))return o(c[4]),this.setRGB(Math.min(255,parseInt(c[1],10))/255,Math.min(255,parseInt(c[2],10))/255,Math.min(255,parseInt(c[3],10))/255,e);if(c=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(d))return o(c[4]),this.setRGB(Math.min(100,parseInt(c[1],10))/100,Math.min(100,parseInt(c[2],10))/100,Math.min(100,parseInt(c[3],10))/100,e);break;case"hsl":case"hsla":if(c=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(d))return o(c[4]),this.setHSL(parseFloat(c[1])/360,parseFloat(c[2])/100,parseFloat(c[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(a=/^\\#([A-Fa-f\\d]+)$/.exec(t)){let c=a[1],p=c.length;if(p===3)return this.setRGB(parseInt(c.charAt(0),16)/15,parseInt(c.charAt(1),16)/15,parseInt(c.charAt(2),16)/15,e);if(p===6)return this.setHex(parseInt(c,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=qi){let o=V1[t.toLowerCase()];return o!==void 0?this.setHex(o,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Zl(t.r),this.g=Zl(t.g),this.b=Zl(t.b),this}copyLinearToSRGB(t){return this.r=cg(t.r),this.g=cg(t.g),this.b=cg(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=qi){return yr.fromWorkingColorSpace(no.copy(this),t),Math.round(Ho(no.r*255,0,255))*65536+Math.round(Ho(no.g*255,0,255))*256+Math.round(Ho(no.b*255,0,255))}getHexString(t=qi){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=yr.workingColorSpace){yr.fromWorkingColorSpace(no.copy(this),e);let o=no.r,a=no.g,c=no.b,p=Math.max(o,a,c),d=Math.min(o,a,c),g,y,_=(d+p)/2;if(d===p)g=0,y=0;else{let w=p-d;switch(y=_<=.5?w/(p+d):w/(2-p-d),p){case o:g=(a-c)/w+(a<c?6:0);break;case a:g=(c-o)/w+2;break;case c:g=(o-a)/w+4;break}g/=6}return t.h=g,t.s=y,t.l=_,t}getRGB(t,e=yr.workingColorSpace){return yr.fromWorkingColorSpace(no.copy(this),e),t.r=no.r,t.g=no.g,t.b=no.b,t}getStyle(t=qi){yr.fromWorkingColorSpace(no.copy(this),t);let e=no.r,o=no.g,a=no.b;return t!==qi?\`color(\${t} \${e.toFixed(3)} \${o.toFixed(3)} \${a.toFixed(3)})\`:\`rgb(\${Math.round(e*255)},\${Math.round(o*255)},\${Math.round(a*255)})\`}offsetHSL(t,e,o){return this.getHSL(yu),this.setHSL(yu.h+t,yu.s+e,yu.l+o)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,o){return this.r=t.r+(e.r-t.r)*o,this.g=t.g+(e.g-t.g)*o,this.b=t.b+(e.b-t.b)*o,this}lerpHSL(t,e){this.getHSL(yu),t.getHSL(mh);let o=ug(yu.h,mh.h,e),a=ug(yu.s,mh.s,e),c=ug(yu.l,mh.l,e);return this.setHSL(o,a,c),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,o=this.g,a=this.b,c=t.elements;return this.r=c[0]*e+c[3]*o+c[6]*a,this.g=c[1]*e+c[4]*o+c[7]*a,this.b=c[2]*e+c[5]*o+c[8]*a,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},no=new Er;Er.NAMES=V1;var Hh=class extends tc{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Er(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=N1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}};var li=new Rt,yh=new tr,Ps=class{constructor(t,e,o=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=o,this.usage=W_,this.updateRange={offset:0,count:-1},this.gpuType=_u,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,o){t*=this.itemSize,o*=e.itemSize;for(let a=0,c=this.itemSize;a<c;a++)this.array[t+a]=e.array[o+a];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,o=this.count;e<o;e++)yh.fromBufferAttribute(this,e),yh.applyMatrix3(t),this.setXY(e,yh.x,yh.y);else if(this.itemSize===3)for(let e=0,o=this.count;e<o;e++)li.fromBufferAttribute(this,e),li.applyMatrix3(t),this.setXYZ(e,li.x,li.y,li.z);return this}applyMatrix4(t){for(let e=0,o=this.count;e<o;e++)li.fromBufferAttribute(this,e),li.applyMatrix4(t),this.setXYZ(e,li.x,li.y,li.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)li.fromBufferAttribute(this,e),li.applyNormalMatrix(t),this.setXYZ(e,li.x,li.y,li.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)li.fromBufferAttribute(this,e),li.transformDirection(t),this.setXYZ(e,li.x,li.y,li.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let o=this.array[t*this.itemSize+e];return this.normalized&&(o=Xc(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=ko(o,this.array)),this.array[t*this.itemSize+e]=o,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Xc(e,this.array)),e}setX(t,e){return this.normalized&&(e=ko(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Xc(e,this.array)),e}setY(t,e){return this.normalized&&(e=ko(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Xc(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ko(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Xc(e,this.array)),e}setW(t,e){return this.normalized&&(e=ko(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,o){return t*=this.itemSize,this.normalized&&(e=ko(e,this.array),o=ko(o,this.array)),this.array[t+0]=e,this.array[t+1]=o,this}setXYZ(t,e,o,a){return t*=this.itemSize,this.normalized&&(e=ko(e,this.array),o=ko(o,this.array),a=ko(a,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this}setXYZW(t,e,o,a,c){return t*=this.itemSize,this.normalized&&(e=ko(e,this.array),o=ko(o,this.array),a=ko(a,this.array),c=ko(c,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this.array[t+3]=c,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==W_&&(t.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(t.updateRange=this.updateRange),t}};var Vh=class extends Ps{constructor(t,e,o){super(new Uint16Array(t),e,o)}};var Wh=class extends Ps{constructor(t,e,o){super(new Uint32Array(t),e,o)}};var Xa=class extends Ps{constructor(t,e,o){super(new Float32Array(t),e,o)}};var gR=0,Ts=new ro,Mg=new ha,Ul=new Rt,ls=new rl,Jc=new rl,Ri=new Rt,il=class r extends Su{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:gR++}),this.uuid=sf(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(H1(t)?Wh:Vh)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,o=0){this.groups.push({start:t,count:e,materialIndex:o})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let o=this.attributes.normal;if(o!==void 0){let c=new Ke().getNormalMatrix(t);o.applyNormalMatrix(c),o.needsUpdate=!0}let a=this.attributes.tangent;return a!==void 0&&(a.transformDirection(t),a.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Ts.makeRotationFromQuaternion(t),this.applyMatrix4(Ts),this}rotateX(t){return Ts.makeRotationX(t),this.applyMatrix4(Ts),this}rotateY(t){return Ts.makeRotationY(t),this.applyMatrix4(Ts),this}rotateZ(t){return Ts.makeRotationZ(t),this.applyMatrix4(Ts),this}translate(t,e,o){return Ts.makeTranslation(t,e,o),this.applyMatrix4(Ts),this}scale(t,e,o){return Ts.makeScale(t,e,o),this.applyMatrix4(Ts),this}lookAt(t){return Mg.lookAt(t),Mg.updateMatrix(),this.applyMatrix4(Mg.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ul).negate(),this.translate(Ul.x,Ul.y,Ul.z),this}setFromPoints(t){let e=[];for(let o=0,a=t.length;o<a;o++){let c=t[o];e.push(c.x,c.y,c.z||0)}return this.setAttribute("position",new Xa(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new rl);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new Rt(-1/0,-1/0,-1/0),new Rt(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let o=0,a=e.length;o<a;o++){let c=e[o];ls.setFromBufferAttribute(c),this.morphTargetsRelative?(Ri.addVectors(this.boundingBox.min,ls.min),this.boundingBox.expandByPoint(Ri),Ri.addVectors(this.boundingBox.max,ls.max),this.boundingBox.expandByPoint(Ri)):(this.boundingBox.expandByPoint(ls.min),this.boundingBox.expandByPoint(ls.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new nf);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new Rt,1/0);return}if(t){let o=this.boundingSphere.center;if(ls.setFromBufferAttribute(t),e)for(let c=0,p=e.length;c<p;c++){let d=e[c];Jc.setFromBufferAttribute(d),this.morphTargetsRelative?(Ri.addVectors(ls.min,Jc.min),ls.expandByPoint(Ri),Ri.addVectors(ls.max,Jc.max),ls.expandByPoint(Ri)):(ls.expandByPoint(Jc.min),ls.expandByPoint(Jc.max))}ls.getCenter(o);let a=0;for(let c=0,p=t.count;c<p;c++)Ri.fromBufferAttribute(t,c),a=Math.max(a,o.distanceToSquared(Ri));if(e)for(let c=0,p=e.length;c<p;c++){let d=e[c],g=this.morphTargetsRelative;for(let y=0,_=d.count;y<_;y++)Ri.fromBufferAttribute(d,y),g&&(Ul.fromBufferAttribute(t,y),Ri.add(Ul)),a=Math.max(a,o.distanceToSquared(Ri))}this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let o=t.array,a=e.position.array,c=e.normal.array,p=e.uv.array,d=a.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ps(new Float32Array(4*d),4));let g=this.getAttribute("tangent").array,y=[],_=[];for(let Q=0;Q<d;Q++)y[Q]=new Rt,_[Q]=new Rt;let w=new Rt,x=new Rt,b=new Rt,P=new tr,I=new tr,M=new tr,E=new Rt,N=new Rt;function A(Q,_t,Z){w.fromArray(a,Q*3),x.fromArray(a,_t*3),b.fromArray(a,Z*3),P.fromArray(p,Q*2),I.fromArray(p,_t*2),M.fromArray(p,Z*2),x.sub(w),b.sub(w),I.sub(P),M.sub(P);let Dt=1/(I.x*M.y-M.x*I.y);isFinite(Dt)&&(E.copy(x).multiplyScalar(M.y).addScaledVector(b,-I.y).multiplyScalar(Dt),N.copy(b).multiplyScalar(I.x).addScaledVector(x,-M.x).multiplyScalar(Dt),y[Q].add(E),y[_t].add(E),y[Z].add(E),_[Q].add(N),_[_t].add(N),_[Z].add(N))}let U=this.groups;U.length===0&&(U=[{start:0,count:o.length}]);for(let Q=0,_t=U.length;Q<_t;++Q){let Z=U[Q],Dt=Z.start,et=Z.count;for(let vt=Dt,It=Dt+et;vt<It;vt+=3)A(o[vt+0],o[vt+1],o[vt+2])}let z=new Rt,$=new Rt,q=new Rt,D=new Rt;function G(Q){q.fromArray(c,Q*3),D.copy(q);let _t=y[Q];z.copy(_t),z.sub(q.multiplyScalar(q.dot(_t))).normalize(),$.crossVectors(D,_t);let Dt=$.dot(_[Q])<0?-1:1;g[Q*4]=z.x,g[Q*4+1]=z.y,g[Q*4+2]=z.z,g[Q*4+3]=Dt}for(let Q=0,_t=U.length;Q<_t;++Q){let Z=U[Q],Dt=Z.start,et=Z.count;for(let vt=Dt,It=Dt+et;vt<It;vt+=3)G(o[vt+0]),G(o[vt+1]),G(o[vt+2])}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let o=this.getAttribute("normal");if(o===void 0)o=new Ps(new Float32Array(e.count*3),3),this.setAttribute("normal",o);else for(let x=0,b=o.count;x<b;x++)o.setXYZ(x,0,0,0);let a=new Rt,c=new Rt,p=new Rt,d=new Rt,g=new Rt,y=new Rt,_=new Rt,w=new Rt;if(t)for(let x=0,b=t.count;x<b;x+=3){let P=t.getX(x+0),I=t.getX(x+1),M=t.getX(x+2);a.fromBufferAttribute(e,P),c.fromBufferAttribute(e,I),p.fromBufferAttribute(e,M),_.subVectors(p,c),w.subVectors(a,c),_.cross(w),d.fromBufferAttribute(o,P),g.fromBufferAttribute(o,I),y.fromBufferAttribute(o,M),d.add(_),g.add(_),y.add(_),o.setXYZ(P,d.x,d.y,d.z),o.setXYZ(I,g.x,g.y,g.z),o.setXYZ(M,y.x,y.y,y.z)}else for(let x=0,b=e.count;x<b;x+=3)a.fromBufferAttribute(e,x+0),c.fromBufferAttribute(e,x+1),p.fromBufferAttribute(e,x+2),_.subVectors(p,c),w.subVectors(a,c),_.cross(w),o.setXYZ(x+0,_.x,_.y,_.z),o.setXYZ(x+1,_.x,_.y,_.z),o.setXYZ(x+2,_.x,_.y,_.z);this.normalizeNormals(),o.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,o=t.count;e<o;e++)Ri.fromBufferAttribute(t,e),Ri.normalize(),t.setXYZ(e,Ri.x,Ri.y,Ri.z)}toNonIndexed(){function t(d,g){let y=d.array,_=d.itemSize,w=d.normalized,x=new y.constructor(g.length*_),b=0,P=0;for(let I=0,M=g.length;I<M;I++){d.isInterleavedBufferAttribute?b=g[I]*d.data.stride+d.offset:b=g[I]*_;for(let E=0;E<_;E++)x[P++]=y[b++]}return new Ps(x,_,w)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new r,o=this.index.array,a=this.attributes;for(let d in a){let g=a[d],y=t(g,o);e.setAttribute(d,y)}let c=this.morphAttributes;for(let d in c){let g=[],y=c[d];for(let _=0,w=y.length;_<w;_++){let x=y[_],b=t(x,o);g.push(b)}e.morphAttributes[d]=g}e.morphTargetsRelative=this.morphTargetsRelative;let p=this.groups;for(let d=0,g=p.length;d<g;d++){let y=p[d];e.addGroup(y.start,y.count,y.materialIndex)}return e}toJSON(){let t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let g=this.parameters;for(let y in g)g[y]!==void 0&&(t[y]=g[y]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let o=this.attributes;for(let g in o){let y=o[g];t.data.attributes[g]=y.toJSON(t.data)}let a={},c=!1;for(let g in this.morphAttributes){let y=this.morphAttributes[g],_=[];for(let w=0,x=y.length;w<x;w++){let b=y[w];_.push(b.toJSON(t.data))}_.length>0&&(a[g]=_,c=!0)}c&&(t.data.morphAttributes=a,t.data.morphTargetsRelative=this.morphTargetsRelative);let p=this.groups;p.length>0&&(t.data.groups=JSON.parse(JSON.stringify(p)));let d=this.boundingSphere;return d!==null&&(t.data.boundingSphere={center:d.center.toArray(),radius:d.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let o=t.index;o!==null&&this.setIndex(o.clone(e));let a=t.attributes;for(let y in a){let _=a[y];this.setAttribute(y,_.clone(e))}let c=t.morphAttributes;for(let y in c){let _=[],w=c[y];for(let x=0,b=w.length;x<b;x++)_.push(w[x].clone(e));this.morphAttributes[y]=_}this.morphTargetsRelative=t.morphTargetsRelative;let p=t.groups;for(let y=0,_=p.length;y<_;y++){let w=p[y];this.addGroup(w.start,w.count,w.materialIndex)}let d=t.boundingBox;d!==null&&(this.boundingBox=d.clone());let g=t.boundingSphere;return g!==null&&(this.boundingSphere=g.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},i1=new ro,Ju=new zg,vh=new nf,o1=new Rt,Bl=new Rt,zl=new Rt,Gl=new Rt,Sg=new Rt,_h=new Rt,xh=new tr,Eh=new tr,wh=new tr,s1=new Rt,a1=new Rt,u1=new Rt,Mh=new Rt,Sh=new Rt,fa=class extends ha{constructor(t=new il,e=new Hh){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,o=Object.keys(e);if(o.length>0){let a=e[o[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let c=0,p=a.length;c<p;c++){let d=a[c].name||String(c);this.morphTargetInfluences.push(0),this.morphTargetDictionary[d]=c}}}}getVertexPosition(t,e){let o=this.geometry,a=o.attributes.position,c=o.morphAttributes.position,p=o.morphTargetsRelative;e.fromBufferAttribute(a,t);let d=this.morphTargetInfluences;if(c&&d){_h.set(0,0,0);for(let g=0,y=c.length;g<y;g++){let _=d[g],w=c[g];_!==0&&(Sg.fromBufferAttribute(w,t),p?_h.addScaledVector(Sg,_):_h.addScaledVector(Sg.sub(e),_))}e.add(_h)}return e}raycast(t,e){let o=this.geometry,a=this.material,c=this.matrixWorld;a!==void 0&&(o.boundingSphere===null&&o.computeBoundingSphere(),vh.copy(o.boundingSphere),vh.applyMatrix4(c),Ju.copy(t.ray).recast(t.near),!(vh.containsPoint(Ju.origin)===!1&&(Ju.intersectSphere(vh,o1)===null||Ju.origin.distanceToSquared(o1)>(t.far-t.near)**2))&&(i1.copy(c).invert(),Ju.copy(t.ray).applyMatrix4(i1),!(o.boundingBox!==null&&Ju.intersectsBox(o.boundingBox)===!1)&&this._computeIntersections(t,e,Ju)))}_computeIntersections(t,e,o){let a,c=this.geometry,p=this.material,d=c.index,g=c.attributes.position,y=c.attributes.uv,_=c.attributes.uv1,w=c.attributes.normal,x=c.groups,b=c.drawRange;if(d!==null)if(Array.isArray(p))for(let P=0,I=x.length;P<I;P++){let M=x[P],E=p[M.materialIndex],N=Math.max(M.start,b.start),A=Math.min(d.count,Math.min(M.start+M.count,b.start+b.count));for(let U=N,z=A;U<z;U+=3){let $=d.getX(U),q=d.getX(U+1),D=d.getX(U+2);a=bh(this,E,t,o,y,_,w,$,q,D),a&&(a.faceIndex=Math.floor(U/3),a.face.materialIndex=M.materialIndex,e.push(a))}}else{let P=Math.max(0,b.start),I=Math.min(d.count,b.start+b.count);for(let M=P,E=I;M<E;M+=3){let N=d.getX(M),A=d.getX(M+1),U=d.getX(M+2);a=bh(this,p,t,o,y,_,w,N,A,U),a&&(a.faceIndex=Math.floor(M/3),e.push(a))}}else if(g!==void 0)if(Array.isArray(p))for(let P=0,I=x.length;P<I;P++){let M=x[P],E=p[M.materialIndex],N=Math.max(M.start,b.start),A=Math.min(g.count,Math.min(M.start+M.count,b.start+b.count));for(let U=N,z=A;U<z;U+=3){let $=U,q=U+1,D=U+2;a=bh(this,E,t,o,y,_,w,$,q,D),a&&(a.faceIndex=Math.floor(U/3),a.face.materialIndex=M.materialIndex,e.push(a))}}else{let P=Math.max(0,b.start),I=Math.min(g.count,b.start+b.count);for(let M=P,E=I;M<E;M+=3){let N=M,A=M+1,U=M+2;a=bh(this,p,t,o,y,_,w,N,A,U),a&&(a.faceIndex=Math.floor(M/3),e.push(a))}}}};function mR(r,t,e,o,a,c,p,d){let g;if(t.side===Vo?g=o.intersectTriangle(p,c,a,!0,d):g=o.intersectTriangle(a,c,p,t.side===Mu,d),g===null)return null;Sh.copy(d),Sh.applyMatrix4(r.matrixWorld);let y=e.ray.origin.distanceTo(Sh);return y<e.near||y>e.far?null:{distance:y,point:Sh.clone(),object:r}}function bh(r,t,e,o,a,c,p,d,g,y){r.getVertexPosition(d,Bl),r.getVertexPosition(g,zl),r.getVertexPosition(y,Gl);let _=mR(r,t,e,o,Bl,zl,Gl,Mh);if(_){a&&(xh.fromBufferAttribute(a,d),Eh.fromBufferAttribute(a,g),wh.fromBufferAttribute(a,y),_.uv=ql.getInterpolation(Mh,Bl,zl,Gl,xh,Eh,wh,new tr)),c&&(xh.fromBufferAttribute(c,d),Eh.fromBufferAttribute(c,g),wh.fromBufferAttribute(c,y),_.uv1=ql.getInterpolation(Mh,Bl,zl,Gl,xh,Eh,wh,new tr),_.uv2=_.uv1),p&&(s1.fromBufferAttribute(p,d),a1.fromBufferAttribute(p,g),u1.fromBufferAttribute(p,y),_.normal=ql.getInterpolation(Mh,Bl,zl,Gl,s1,a1,u1,new Rt),_.normal.dot(o.direction)>0&&_.normal.multiplyScalar(-1));let w={a:d,b:g,c:y,normal:new Rt,materialIndex:0};ql.getNormal(Bl,zl,Gl,w.normal),_.face=w}return _}var rf=class r extends il{constructor(t=1,e=1,o=1,a=1,c=1,p=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:o,widthSegments:a,heightSegments:c,depthSegments:p};let d=this;a=Math.floor(a),c=Math.floor(c),p=Math.floor(p);let g=[],y=[],_=[],w=[],x=0,b=0;P("z","y","x",-1,-1,o,e,t,p,c,0),P("z","y","x",1,-1,o,e,-t,p,c,1),P("x","z","y",1,1,t,o,e,a,p,2),P("x","z","y",1,-1,t,o,-e,a,p,3),P("x","y","z",1,-1,t,e,o,a,c,4),P("x","y","z",-1,-1,t,e,-o,a,c,5),this.setIndex(g),this.setAttribute("position",new Xa(y,3)),this.setAttribute("normal",new Xa(_,3)),this.setAttribute("uv",new Xa(w,2));function P(I,M,E,N,A,U,z,$,q,D,G){let Q=U/q,_t=z/D,Z=U/2,Dt=z/2,et=$/2,vt=q+1,It=D+1,Pt=0,Et=0,yt=new Rt;for(let Y=0;Y<It;Y++){let ht=Y*_t-Dt;for(let Mt=0;Mt<vt;Mt++){let zt=Mt*Q-Z;yt[I]=zt*N,yt[M]=ht*A,yt[E]=et,y.push(yt.x,yt.y,yt.z),yt[I]=0,yt[M]=0,yt[E]=$>0?1:-1,_.push(yt.x,yt.y,yt.z),w.push(Mt/q),w.push(1-Y/D),Pt+=1}}for(let Y=0;Y<D;Y++)for(let ht=0;ht<q;ht++){let Mt=x+ht+vt*Y,zt=x+ht+vt*(Y+1),At=x+(ht+1)+vt*(Y+1),$t=x+(ht+1)+vt*Y;g.push(Mt,zt,$t),g.push(zt,At,$t),Et+=6}d.addGroup(b,Et,G),b+=Et,x+=Pt}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function ec(r){let t={};for(let e in r){t[e]={};for(let o in r[e]){let a=r[e][o];a&&(a.isColor||a.isMatrix3||a.isMatrix4||a.isVector2||a.isVector3||a.isVector4||a.isTexture||a.isQuaternion)?a.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][o]=null):t[e][o]=a.clone():Array.isArray(a)?t[e][o]=a.slice():t[e][o]=a}}return t}function vo(r){let t={};for(let e=0;e<r.length;e++){let o=ec(r[e]);for(let a in o)t[a]=o[a]}return t}function yR(r){let t=[];for(let e=0;e<r.length;e++)t.push(r[e].clone());return t}function W1(r){return r.getRenderTarget()===null?r.outputColorSpace:yr.workingColorSpace}var vR={clone:ec,merge:vo},_R=\`void main() {
128
+ }\`;var Ye=Hv(function(){return Be(W,xe+"return "+Vt).apply(r,it)});if(Ye.source=Vt,Bd(Ye))throw Ye;return Ye}function jC(u){return ar(u).toLowerCase()}function tP(u){return ar(u).toUpperCase()}function eP(u,f,m){if(u=ar(u),u&&(m||f===r))return Ff(u);if(!u||!(f=is(f)))return u;var T=Ro(u),O=Ro(f),W=Ls(T,O),it=Si(T,O)+1;return fu(T,W,it).join("")}function nP(u,f,m){if(u=ar(u),u&&(m||f===r))return u.slice(0,ta(u)+1);if(!u||!(f=is(f)))return u;var T=Ro(u),O=Si(T,Ro(f))+1;return fu(T,0,O).join("")}function rP(u,f,m){if(u=ar(u),u&&(m||f===r))return u.replace(ur,"");if(!u||!(f=is(f)))return u;var T=Ro(u),O=Ls(T,Ro(f));return fu(T,O).join("")}function iP(u,f){var m=D,T=G;if(Gr(f)){var O="separator"in f?f.separator:O;m="length"in f?qe(f.length):m,T="omission"in f?is(f.omission):T}u=ar(u);var W=u.length;if(Ma(u)){var it=Ro(u);W=it.length}if(m>=W)return u;var ct=m-Sa(T);if(ct<1)return T;var mt=it?fu(it,0,ct).join(""):u.slice(0,ct);if(O===r)return mt+T;if(it&&(ct+=mt.length-ct),zd(O)){if(u.slice(ct).search(O)){var Ft,Ut=mt;for(O.global||(O=es(O.source,ar(Zn.exec(O))+"g")),O.lastIndex=0;Ft=O.exec(Ut);)var Vt=Ft.index;mt=mt.slice(0,Vt===r?ct:Vt)}}else if(u.indexOf(is(O),ct)!=ct){var ae=mt.lastIndexOf(O);ae>-1&&(mt=mt.slice(0,ae))}return mt+T}function oP(u){return u=ar(u),u&&nt.test(u)?u.replace(k,jo):u}var sP=Sl(function(u,f,m){return u+(m?" ":"")+f.toUpperCase()}),Hd=Vy("toUpperCase");function kv(u,f,m){return u=ar(u),f=m?r:f,f===r?_l(u)?oi(u):Ge(u):u.match(f)||[]}var Hv=Je(function(u,f){try{return ne(u,r,f)}catch(m){return Bd(m)?m:new ve(m)}}),aP=Ra(function(u,f){return wi(f,function(m){m=la(m),Pa(u,m,Fd(u[m],u))}),u});function uP(u){var f=u==null?0:u.length,m=Pe();return u=f?xr(u,function(T){if(typeof T[1]!="function")throw new Jn(a);return[m(T[0]),T[1]]}):[],Je(function(T){for(var O=-1;++O<f;){var W=u[O];if(ne(W[0],this,T))return ne(W[1],this,T)}})}function lP(u){return OS(ws(u,y))}function Vd(u){return function(){return u}}function cP(u,f){return u==null||u!==u?f:u}var fP=qy(),hP=qy(!0);function Go(u){return u}function Wd(u){return Ey(typeof u=="function"?u:ws(u,y))}function pP(u){return My(ws(u,y))}function dP(u,f){return Sy(u,ws(f,y))}var gP=Je(function(u,f){return function(m){return Bc(m,u,f)}}),mP=Je(function(u,f){return function(m){return Bc(u,m,f)}});function qd(u,f,m){var T=Pi(f),O=Hf(f,T);m==null&&!(Gr(f)&&(O.length||!T.length))&&(m=f,f=u,u=this,O=Hf(f,Pi(f)));var W=!(Gr(m)&&"chain"in m)||!!m.chain,it=Na(u);return wi(O,function(ct){var mt=f[ct];u[ct]=mt,it&&(u.prototype[ct]=function(){var Ft=this.__chain__;if(W||Ft){var Ut=u(this.__wrapped__),Vt=Ut.__actions__=Uo(this.__actions__);return Vt.push({func:mt,args:arguments,thisArg:u}),Ut.__chain__=Ft,Ut}return mt.apply(u,Fe([this.value()],arguments))})}),u}function yP(){return Ur._===this&&(Ur._=No),this}function Xd(){}function vP(u){return u=qe(u),Je(function(f){return by(f,u)})}var _P=Md(xr),xP=Md(lo),EP=Md(wa);function Vv(u){return Id(u)?gs(la(u)):KS(u)}function wP(u){return function(f){return u==null?r:Wu(u,f)}}var MP=Yy(),SP=Yy(!0);function Yd(){return[]}function $d(){return!1}function bP(){return{}}function TP(){return""}function AP(){return!0}function CP(u,f){if(u=qe(u),u<1||u>It)return[];var m=yt,T=mr(u,yt);f=Pe(f),u-=yt;for(var O=pi(T,f);++m<u;)f(m);return O}function PP(u){return ke(u)?xr(u,la):os(u)?[u]:Uo(lv(ar(u)))}function IP(u){var f=++bi;return ar(u)+f}var RP=$f(function(u,f){return u+f},0),LP=Sd("ceil"),NP=$f(function(u,f){return u/f},1),OP=Sd("floor");function DP(u){return u&&u.length?kf(u,Go,ld):r}function FP(u,f){return u&&u.length?kf(u,Pe(f,2),ld):r}function UP(u){return Rc(u,Go)}function BP(u,f){return Rc(u,Pe(f,2))}function zP(u){return u&&u.length?kf(u,Go,pd):r}function GP(u,f){return u&&u.length?kf(u,Pe(f,2),pd):r}var kP=$f(function(u,f){return u*f},1),HP=Sd("round"),VP=$f(function(u,f){return u-f},0);function WP(u){return u&&u.length?co(u,Go):0}function qP(u,f){return u&&u.length?co(u,Pe(f,2)):0}return B.after=pA,B.ary=xv,B.assign=tC,B.assignIn=Ov,B.assignInWith=ah,B.assignWith=eC,B.at=nC,B.before=Ev,B.bind=Fd,B.bindAll=aP,B.bindKey=wv,B.castArray=bA,B.chain=yv,B.chunk=Ob,B.compact=Db,B.concat=Fb,B.cond=uP,B.conforms=lP,B.constant=Vd,B.countBy=WT,B.create=rC,B.curry=Mv,B.curryRight=Sv,B.debounce=bv,B.defaults=iC,B.defaultsDeep=oC,B.defer=dA,B.delay=gA,B.difference=Ub,B.differenceBy=Bb,B.differenceWith=zb,B.drop=Gb,B.dropRight=kb,B.dropRightWhile=Hb,B.dropWhile=Vb,B.fill=Wb,B.filter=XT,B.flatMap=ZT,B.flatMapDeep=JT,B.flatMapDepth=KT,B.flatten=pv,B.flattenDeep=qb,B.flattenDepth=Xb,B.flip=mA,B.flow=fP,B.flowRight=hP,B.fromPairs=Yb,B.functions=hC,B.functionsIn=pC,B.groupBy=QT,B.initial=Zb,B.intersection=Jb,B.intersectionBy=Kb,B.intersectionWith=Qb,B.invert=gC,B.invertBy=mC,B.invokeMap=tA,B.iteratee=Wd,B.keyBy=eA,B.keys=Pi,B.keysIn=zo,B.map=eh,B.mapKeys=vC,B.mapValues=_C,B.matches=pP,B.matchesProperty=dP,B.memoize=rh,B.merge=xC,B.mergeWith=Dv,B.method=gP,B.methodOf=mP,B.mixin=qd,B.negate=ih,B.nthArg=vP,B.omit=EC,B.omitBy=wC,B.once=yA,B.orderBy=nA,B.over=_P,B.overArgs=vA,B.overEvery=xP,B.overSome=EP,B.partial=Ud,B.partialRight=Tv,B.partition=rA,B.pick=MC,B.pickBy=Fv,B.property=Vv,B.propertyOf=wP,B.pull=nT,B.pullAll=gv,B.pullAllBy=rT,B.pullAllWith=iT,B.pullAt=oT,B.range=MP,B.rangeRight=SP,B.rearg=_A,B.reject=sA,B.remove=sT,B.rest=xA,B.reverse=Od,B.sampleSize=uA,B.set=bC,B.setWith=TC,B.shuffle=lA,B.slice=aT,B.sortBy=hA,B.sortedUniq=dT,B.sortedUniqBy=gT,B.split=ZC,B.spread=EA,B.tail=mT,B.take=yT,B.takeRight=vT,B.takeRightWhile=_T,B.takeWhile=xT,B.tap=DT,B.throttle=wA,B.thru=th,B.toArray=Rv,B.toPairs=Uv,B.toPairsIn=Bv,B.toPath=PP,B.toPlainObject=Nv,B.transform=AC,B.unary=MA,B.union=ET,B.unionBy=wT,B.unionWith=MT,B.uniq=ST,B.uniqBy=bT,B.uniqWith=TT,B.unset=CC,B.unzip=Dd,B.unzipWith=mv,B.update=PC,B.updateWith=IC,B.values=Al,B.valuesIn=RC,B.without=AT,B.words=kv,B.wrap=SA,B.xor=CT,B.xorBy=PT,B.xorWith=IT,B.zip=RT,B.zipObject=LT,B.zipObjectDeep=NT,B.zipWith=OT,B.entries=Uv,B.entriesIn=Bv,B.extend=Ov,B.extendWith=ah,qd(B,B),B.add=RP,B.attempt=Hv,B.camelCase=DC,B.capitalize=zv,B.ceil=LP,B.clamp=LC,B.clone=TA,B.cloneDeep=CA,B.cloneDeepWith=PA,B.cloneWith=AA,B.conformsTo=IA,B.deburr=Gv,B.defaultTo=cP,B.divide=NP,B.endsWith=FC,B.eq=Bs,B.escape=UC,B.escapeRegExp=BC,B.every=qT,B.find=YT,B.findIndex=fv,B.findKey=sC,B.findLast=$T,B.findLastIndex=hv,B.findLastKey=aC,B.floor=OP,B.forEach=vv,B.forEachRight=_v,B.forIn=uC,B.forInRight=lC,B.forOwn=cC,B.forOwnRight=fC,B.get=Gd,B.gt=RA,B.gte=LA,B.has=dC,B.hasIn=kd,B.head=dv,B.identity=Go,B.includes=jT,B.indexOf=$b,B.inRange=NC,B.invoke=yC,B.isArguments=Yu,B.isArray=ke,B.isArrayBuffer=NA,B.isArrayLike=Bo,B.isArrayLikeObject=ni,B.isBoolean=OA,B.isBuffer=hu,B.isDate=DA,B.isElement=FA,B.isEmpty=UA,B.isEqual=BA,B.isEqualWith=zA,B.isError=Bd,B.isFinite=GA,B.isFunction=Na,B.isInteger=Av,B.isLength=oh,B.isMap=Cv,B.isMatch=kA,B.isMatchWith=HA,B.isNaN=VA,B.isNative=WA,B.isNil=XA,B.isNull=qA,B.isNumber=Pv,B.isObject=Gr,B.isObjectLike=$r,B.isPlainObject=Wc,B.isRegExp=zd,B.isSafeInteger=YA,B.isSet=Iv,B.isString=sh,B.isSymbol=os,B.isTypedArray=Tl,B.isUndefined=$A,B.isWeakMap=ZA,B.isWeakSet=JA,B.join=jb,B.kebabCase=zC,B.last=Ss,B.lastIndexOf=tT,B.lowerCase=GC,B.lowerFirst=kC,B.lt=KA,B.lte=QA,B.max=DP,B.maxBy=FP,B.mean=UP,B.meanBy=BP,B.min=zP,B.minBy=GP,B.stubArray=Yd,B.stubFalse=$d,B.stubObject=bP,B.stubString=TP,B.stubTrue=AP,B.multiply=kP,B.nth=eT,B.noConflict=yP,B.noop=Xd,B.now=nh,B.pad=HC,B.padEnd=VC,B.padStart=WC,B.parseInt=qC,B.random=OC,B.reduce=iA,B.reduceRight=oA,B.repeat=XC,B.replace=YC,B.result=SC,B.round=HP,B.runInContext=gt,B.sample=aA,B.size=cA,B.snakeCase=$C,B.some=fA,B.sortedIndex=uT,B.sortedIndexBy=lT,B.sortedIndexOf=cT,B.sortedLastIndex=fT,B.sortedLastIndexBy=hT,B.sortedLastIndexOf=pT,B.startCase=JC,B.startsWith=KC,B.subtract=VP,B.sum=WP,B.sumBy=qP,B.template=QC,B.times=CP,B.toFinite=Oa,B.toInteger=qe,B.toLength=Lv,B.toLower=jC,B.toNumber=bs,B.toSafeInteger=jA,B.toString=ar,B.toUpper=tP,B.trim=eP,B.trimEnd=nP,B.trimStart=rP,B.truncate=iP,B.unescape=oP,B.uniqueId=IP,B.upperCase=sP,B.upperFirst=Hd,B.each=vv,B.eachRight=_v,B.first=dv,qd(B,function(){var u={};return aa(B,function(f,m){Ze.call(B.prototype,m)||(u[m]=f)}),u}(),{chain:!1}),B.VERSION=t,wi(["bind","bindKey","curry","curryRight","partial","partialRight"],function(u){B[u].placeholder=B}),wi(["drop","take"],function(u,f){i.prototype[u]=function(m){m=m===r?1:ei(qe(m),0);var T=this.__filtered__&&!f?new i(this):this.clone();return T.__filtered__?T.__takeCount__=mr(m,T.__takeCount__):T.__views__.push({size:mr(m,yt),type:u+(T.__dir__<0?"Right":"")}),T},i.prototype[u+"Right"]=function(m){return this.reverse()[u](m).reverse()}}),wi(["filter","map","takeWhile"],function(u,f){var m=f+1,T=m==Z||m==et;i.prototype[u]=function(O){var W=this.clone();return W.__iteratees__.push({iteratee:Pe(O,3),type:m}),W.__filtered__=W.__filtered__||T,W}}),wi(["head","last"],function(u,f){var m="take"+(f?"Right":"");i.prototype[u]=function(){return this[m](1).value()[0]}}),wi(["initial","tail"],function(u,f){var m="drop"+(f?"":"Right");i.prototype[u]=function(){return this.__filtered__?new i(this):this[m](1)}}),i.prototype.compact=function(){return this.filter(Go)},i.prototype.find=function(u){return this.filter(u).head()},i.prototype.findLast=function(u){return this.reverse().find(u)},i.prototype.invokeMap=Je(function(u,f){return typeof u=="function"?new i(this):this.map(function(m){return Bc(m,u,f)})}),i.prototype.reject=function(u){return this.filter(ih(Pe(u)))},i.prototype.slice=function(u,f){u=qe(u);var m=this;return m.__filtered__&&(u>0||f<0)?new i(m):(u<0?m=m.takeRight(-u):u&&(m=m.drop(u)),f!==r&&(f=qe(f),m=f<0?m.dropRight(-f):m.take(f-u)),m)},i.prototype.takeRightWhile=function(u){return this.reverse().takeWhile(u).reverse()},i.prototype.toArray=function(){return this.take(yt)},aa(i.prototype,function(u,f){var m=/^(?:filter|find|map|reject)|While$/.test(f),T=/^(?:head|last)$/.test(f),O=B[T?"take"+(f=="last"?"Right":""):f],W=T||/^find/.test(f);O&&(B.prototype[f]=function(){var it=this.__wrapped__,ct=T?[1]:arguments,mt=it instanceof i,Ft=ct[0],Ut=mt||ke(it),Vt=function(Pn){var Hn=O.apply(B,Fe([Pn],ct));return T&&ae?Hn[0]:Hn};Ut&&m&&typeof Ft=="function"&&Ft.length!=1&&(mt=Ut=!1);var ae=this.__chain__,xe=!!this.__actions__.length,Re=W&&!ae,Ye=mt&&!xe;if(!W&&Ut){it=Ye?it:new i(this);var Le=u.apply(it,ct);return Le.__actions__.push({func:th,args:[Vt],thisArg:r}),new n(Le,ae)}return Re&&Ye?u.apply(this,ct):(Le=this.thru(Vt),Re?T?Le.value()[0]:Le.value():Le)})}),wi(["pop","push","shift","sort","splice","unshift"],function(u){var f=Lr[u],m=/^(?:push|sort|unshift)$/.test(u)?"tap":"thru",T=/^(?:pop|shift)$/.test(u);B.prototype[u]=function(){var O=arguments;if(T&&!this.__chain__){var W=this.value();return f.apply(ke(W)?W:[],O)}return this[m](function(it){return f.apply(ke(it)?it:[],O)})}}),aa(i.prototype,function(u,f){var m=B[f];if(m){var T=m.name+"";Ze.call(ns,T)||(ns[T]=[]),ns[T].push({name:f,func:m})}}),ns[Yf(r,I).name]=[{name:"wrapper",func:r}],i.prototype.clone=s,i.prototype.reverse=l,i.prototype.value=h,B.prototype.at=FT,B.prototype.chain=UT,B.prototype.commit=BT,B.prototype.next=zT,B.prototype.plant=kT,B.prototype.reverse=HT,B.prototype.toJSON=B.prototype.valueOf=B.prototype.value=VT,B.prototype.first=B.prototype.head,ou&&(B.prototype[ou]=GT),B},Hi=ts();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ur._=Hi,define(function(){return Hi})):Ao?((Ao.exports=Hi)._=Hi,Pc._=Hi):Ur._=Hi}).call(Ac)});var gS=ce((lnt,dS)=>{dS.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}});var vS=ce((cnt,yS)=>{var mS=gS();yS.exports=function(r,t){Array.isArray(t)||(t=[]),r.length>0&&t.push(mS([0,0],r[0]));for(var e=0;e<r.length-1;e++){var o=r[e],a=r[e+1],c=o[0],p=o[1],d=a[0],g=a[1],y=[.75*c+.25*d,.75*p+.25*g],_=[.25*c+.75*d,.25*p+.75*g];t.push(y),t.push(_)}return r.length>1&&t.push(mS([0,0],r[r.length-1])),t}});var so=Nr(u_(),1);var pm="157";var rI=0,l_=1,iI=2;var I1=1,oI=2,Ha=3,Mu=0,Vo=1,Wa=2;var xu=0,$l=1,c_=2,f_=3,h_=4,sI=5,Wl=100,aI=101,uI=102,p_=103,d_=104,lI=200,cI=201,fI=202,hI=203,R1=204,L1=205,pI=206,dI=207,gI=208,mI=209,yI=210,vI=0,_I=1,xI=2,Pg=3,EI=4,wI=5,MI=6,SI=7,N1=0,bI=1,TI=2,Eu=0,AI=1,CI=2,PI=3,II=4,RI=5,O1=300,Kl=301,Ql=302,Ig=303,Rg=304,Zh=306,Lg=1e3,Hs=1001,Ng=1002,_o=1003,g_=1004;var jd=1005;var As=1006,LI=1007;var tf=1008;var wu=1009,NI=1010,OI=1011,dm=1012,D1=1013,vu=1014,_u=1015,ef=1016,F1=1017,U1=1018,tl=1020,DI=1021,Vs=1023,FI=1024,UI=1025,el=1026,jl=1027,BI=1028,B1=1029,zI=1030,z1=1031,G1=1033,tg=33776,eg=33777,ng=33778,rg=33779,m_=35840,y_=35841,v_=35842,__=35843,GI=36196,x_=37492,E_=37496,w_=37808,M_=37809,S_=37810,b_=37811,T_=37812,A_=37813,C_=37814,P_=37815,I_=37816,R_=37817,L_=37818,N_=37819,O_=37820,D_=37821,ig=36492,F_=36494,U_=36495,kI=36283,B_=36284,z_=36285,G_=36286;var Ih=2300,Rh=2301,og=2302,k_=2400,H_=2401,V_=2402;var k1=3e3,nl=3001,HI=3200,VI=3201,WI=0,qI=1,Cs="",qi="srgb",Ya="srgb-linear",gm="display-p3",Jh="display-p3-linear",Lh="linear",Pr="srgb",Nh="rec709",Oh="p3";var sg=7680;var XI=519,YI=512,$I=513,ZI=514,JI=515,KI=516,QI=517,jI=518,tR=519,W_=35044;var q_="300 es",Og=1035,qa=2e3,Dh=2001,Su=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let o=this._listeners;o[t]===void 0&&(o[t]=[]),o[t].indexOf(e)===-1&&o[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;let o=this._listeners;return o[t]!==void 0&&o[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;let a=this._listeners[t];if(a!==void 0){let c=a.indexOf(e);c!==-1&&a.splice(c,1)}}dispatchEvent(t){if(this._listeners===void 0)return;let o=this._listeners[t.type];if(o!==void 0){t.target=this;let a=o.slice(0);for(let c=0,p=a.length;c<p;c++)a[c].call(this,t);t.target=null}}},eo=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var ag=Math.PI/180,Dg=180/Math.PI;function sf(){let r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(eo[r&255]+eo[r>>8&255]+eo[r>>16&255]+eo[r>>24&255]+"-"+eo[t&255]+eo[t>>8&255]+"-"+eo[t>>16&15|64]+eo[t>>24&255]+"-"+eo[e&63|128]+eo[e>>8&255]+"-"+eo[e>>16&255]+eo[e>>24&255]+eo[o&255]+eo[o>>8&255]+eo[o>>16&255]+eo[o>>24&255]).toLowerCase()}function Ho(r,t,e){return Math.max(t,Math.min(e,r))}function eR(r,t){return(r%t+t)%t}function ug(r,t,e){return(1-e)*r+e*t}function X_(r){return(r&r-1)===0&&r!==0}function Fg(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Xc(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function ko(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var tr=class r{constructor(t=0,e=0){r.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,o=this.y,a=t.elements;return this.x=a[0]*e+a[3]*o+a[6],this.y=a[1]*e+a[4]*o+a[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let o=this.dot(t)/e;return Math.acos(Ho(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y;return e*e+o*o}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let o=Math.cos(e),a=Math.sin(e),c=this.x-t.x,p=this.y-t.y;return this.x=c*o-p*a+t.x,this.y=c*a+p*o+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Ke=class r{constructor(t,e,o,a,c,p,d,g,y){r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,o,a,c,p,d,g,y)}set(t,e,o,a,c,p,d,g,y){let _=this.elements;return _[0]=t,_[1]=a,_[2]=d,_[3]=e,_[4]=c,_[5]=g,_[6]=o,_[7]=p,_[8]=y,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,o=t.elements;return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=o[3],e[4]=o[4],e[5]=o[5],e[6]=o[6],e[7]=o[7],e[8]=o[8],this}extractBasis(t,e,o){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),o.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,a=e.elements,c=this.elements,p=o[0],d=o[3],g=o[6],y=o[1],_=o[4],w=o[7],x=o[2],b=o[5],P=o[8],I=a[0],M=a[3],E=a[6],N=a[1],A=a[4],U=a[7],z=a[2],$=a[5],q=a[8];return c[0]=p*I+d*N+g*z,c[3]=p*M+d*A+g*$,c[6]=p*E+d*U+g*q,c[1]=y*I+_*N+w*z,c[4]=y*M+_*A+w*$,c[7]=y*E+_*U+w*q,c[2]=x*I+b*N+P*z,c[5]=x*M+b*A+P*$,c[8]=x*E+b*U+P*q,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],o=t[1],a=t[2],c=t[3],p=t[4],d=t[5],g=t[6],y=t[7],_=t[8];return e*p*_-e*d*y-o*c*_+o*d*g+a*c*y-a*p*g}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],c=t[3],p=t[4],d=t[5],g=t[6],y=t[7],_=t[8],w=_*p-d*y,x=d*g-_*c,b=y*c-p*g,P=e*w+o*x+a*b;if(P===0)return this.set(0,0,0,0,0,0,0,0,0);let I=1/P;return t[0]=w*I,t[1]=(a*y-_*o)*I,t[2]=(d*o-a*p)*I,t[3]=x*I,t[4]=(_*e-a*g)*I,t[5]=(a*c-d*e)*I,t[6]=b*I,t[7]=(o*g-y*e)*I,t[8]=(p*e-o*c)*I,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,o,a,c,p,d){let g=Math.cos(c),y=Math.sin(c);return this.set(o*g,o*y,-o*(g*p+y*d)+p+t,-a*y,a*g,-a*(-y*p+g*d)+d+e,0,0,1),this}scale(t,e){return this.premultiply(lg.makeScale(t,e)),this}rotate(t){return this.premultiply(lg.makeRotation(-t)),this}translate(t,e){return this.premultiply(lg.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,-o,0,o,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,o=t.elements;for(let a=0;a<9;a++)if(e[a]!==o[a])return!1;return!0}fromArray(t,e=0){for(let o=0;o<9;o++)this.elements[o]=t[o+e];return this}toArray(t=[],e=0){let o=this.elements;return t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3],t[e+4]=o[4],t[e+5]=o[5],t[e+6]=o[6],t[e+7]=o[7],t[e+8]=o[8],t}clone(){return new this.constructor().fromArray(this.elements)}},lg=new Ke;function H1(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}function Fh(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function nR(){let r=Fh("canvas");return r.style.display="block",r}var Y_={};function Qc(r){r in Y_||(Y_[r]=!0,console.warn(r))}var $_=new Ke().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Z_=new Ke().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),uh={[Ya]:{transfer:Lh,primaries:Nh,toReference:r=>r,fromReference:r=>r},[qi]:{transfer:Pr,primaries:Nh,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[Jh]:{transfer:Lh,primaries:Oh,toReference:r=>r.applyMatrix3(Z_),fromReference:r=>r.applyMatrix3($_)},[gm]:{transfer:Pr,primaries:Oh,toReference:r=>r.convertSRGBToLinear().applyMatrix3(Z_),fromReference:r=>r.applyMatrix3($_).convertLinearToSRGB()}},rR=new Set([Ya,Jh]),yr={enabled:!0,_workingColorSpace:Ya,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(r){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!r},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!rR.has(r))throw new Error(\`Unsupported working color space, "\${r}".\`);this._workingColorSpace=r},convert:function(r,t,e){if(this.enabled===!1||t===e||!t||!e)return r;let o=uh[t].toReference,a=uh[e].fromReference;return a(o(r))},fromWorkingColorSpace:function(r,t){return this.convert(r,this._workingColorSpace,t)},toWorkingColorSpace:function(r,t){return this.convert(r,t,this._workingColorSpace)},getPrimaries:function(r){return uh[r].primaries},getTransfer:function(r){return r===Cs?Lh:uh[r].transfer}};function Zl(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function cg(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var Cl,Uh=class{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement=="undefined")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{Cl===void 0&&(Cl=Fh("canvas")),Cl.width=t.width,Cl.height=t.height;let o=Cl.getContext("2d");t instanceof ImageData?o.putImageData(t,0,0):o.drawImage(t,0,0,t.width,t.height),e=Cl}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement!="undefined"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&t instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap){let e=Fh("canvas");e.width=t.width,e.height=t.height;let o=e.getContext("2d");o.drawImage(t,0,0,t.width,t.height);let a=o.getImageData(0,0,t.width,t.height),c=a.data;for(let p=0;p<c.length;p++)c[p]=Zl(c[p]/255)*255;return o.putImageData(a,0,0),e}else if(t.data){let e=t.data.slice(0);for(let o=0;o<e.length;o++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[o]=Math.floor(Zl(e[o]/255)*255):e[o]=Zl(e[o]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},iR=0,Bh=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:iR++}),this.uuid=sf(),this.data=t,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let o={uuid:this.uuid,url:""},a=this.data;if(a!==null){let c;if(Array.isArray(a)){c=[];for(let p=0,d=a.length;p<d;p++)a[p].isDataTexture?c.push(fg(a[p].image)):c.push(fg(a[p]))}else c=fg(a);o.url=c}return e||(t.images[this.uuid]=o),o}};function fg(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?Uh.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var oR=0,Ws=class r extends Su{constructor(t=r.DEFAULT_IMAGE,e=r.DEFAULT_MAPPING,o=Hs,a=Hs,c=As,p=tf,d=Vs,g=wu,y=r.DEFAULT_ANISOTROPY,_=Cs){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:oR++}),this.uuid=sf(),this.name="",this.source=new Bh(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=o,this.wrapT=a,this.magFilter=c,this.minFilter=p,this.anisotropy=y,this.format=d,this.internalFormat=null,this.type=g,this.offset=new tr(0,0),this.repeat=new tr(1,1),this.center=new tr(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ke,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof _=="string"?this.colorSpace=_:(Qc("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=_===nl?qi:Cs),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let o={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(o.userData=this.userData),e||(t.textures[this.uuid]=o),o}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==O1)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Lg:t.x=t.x-Math.floor(t.x);break;case Hs:t.x=t.x<0?0:1;break;case Ng:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Lg:t.y=t.y-Math.floor(t.y);break;case Hs:t.y=t.y<0?0:1;break;case Ng:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Qc("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===qi?nl:k1}set encoding(t){Qc("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===nl?qi:Cs}};Ws.DEFAULT_IMAGE=null;Ws.DEFAULT_MAPPING=O1;Ws.DEFAULT_ANISOTROPY=1;var Xi=class r{constructor(t=0,e=0,o=0,a=1){r.prototype.isVector4=!0,this.x=t,this.y=e,this.z=o,this.w=a}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,o,a){return this.x=t,this.y=e,this.z=o,this.w=a,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,o=this.y,a=this.z,c=this.w,p=t.elements;return this.x=p[0]*e+p[4]*o+p[8]*a+p[12]*c,this.y=p[1]*e+p[5]*o+p[9]*a+p[13]*c,this.z=p[2]*e+p[6]*o+p[10]*a+p[14]*c,this.w=p[3]*e+p[7]*o+p[11]*a+p[15]*c,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,o,a,c,g=t.elements,y=g[0],_=g[4],w=g[8],x=g[1],b=g[5],P=g[9],I=g[2],M=g[6],E=g[10];if(Math.abs(_-x)<.01&&Math.abs(w-I)<.01&&Math.abs(P-M)<.01){if(Math.abs(_+x)<.1&&Math.abs(w+I)<.1&&Math.abs(P+M)<.1&&Math.abs(y+b+E-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let A=(y+1)/2,U=(b+1)/2,z=(E+1)/2,$=(_+x)/4,q=(w+I)/4,D=(P+M)/4;return A>U&&A>z?A<.01?(o=0,a=.707106781,c=.707106781):(o=Math.sqrt(A),a=$/o,c=q/o):U>z?U<.01?(o=.707106781,a=0,c=.707106781):(a=Math.sqrt(U),o=$/a,c=D/a):z<.01?(o=.707106781,a=.707106781,c=0):(c=Math.sqrt(z),o=q/c,a=D/c),this.set(o,a,c,e),this}let N=Math.sqrt((M-P)*(M-P)+(w-I)*(w-I)+(x-_)*(x-_));return Math.abs(N)<.001&&(N=1),this.x=(M-P)/N,this.y=(w-I)/N,this.z=(x-_)/N,this.w=Math.acos((y+b+E-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this.z=t.z+(e.z-t.z)*o,this.w=t.w+(e.w-t.w)*o,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Ug=class extends Su{constructor(t=1,e=1,o={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Xi(0,0,t,e),this.scissorTest=!1,this.viewport=new Xi(0,0,t,e);let a={width:t,height:e,depth:1};o.encoding!==void 0&&(Qc("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=o.encoding===nl?qi:Cs),o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:As,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},o),this.texture=new Ws(a,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=o.generateMipmaps,this.texture.internalFormat=o.internalFormat,this.depthBuffer=o.depthBuffer,this.stencilBuffer=o.stencilBuffer,this.depthTexture=o.depthTexture,this.samples=o.samples}setSize(t,e,o=1){(this.width!==t||this.height!==e||this.depth!==o)&&(this.width=t,this.height=e,this.depth=o,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=o,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;let e=Object.assign({},t.texture.image);return this.texture.source=new Bh(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},$a=class extends Ug{constructor(t=1,e=1,o={}){super(t,e,o),this.isWebGLRenderTarget=!0}},zh=class extends Ws{constructor(t=null,e=1,o=1,a=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:o,depth:a},this.magFilter=_o,this.minFilter=_o,this.wrapR=Hs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Bg=class extends Ws{constructor(t=null,e=1,o=1,a=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:o,depth:a},this.magFilter=_o,this.minFilter=_o,this.wrapR=Hs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var bu=class{constructor(t=0,e=0,o=0,a=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=o,this._w=a}static slerpFlat(t,e,o,a,c,p,d){let g=o[a+0],y=o[a+1],_=o[a+2],w=o[a+3],x=c[p+0],b=c[p+1],P=c[p+2],I=c[p+3];if(d===0){t[e+0]=g,t[e+1]=y,t[e+2]=_,t[e+3]=w;return}if(d===1){t[e+0]=x,t[e+1]=b,t[e+2]=P,t[e+3]=I;return}if(w!==I||g!==x||y!==b||_!==P){let M=1-d,E=g*x+y*b+_*P+w*I,N=E>=0?1:-1,A=1-E*E;if(A>Number.EPSILON){let z=Math.sqrt(A),$=Math.atan2(z,E*N);M=Math.sin(M*$)/z,d=Math.sin(d*$)/z}let U=d*N;if(g=g*M+x*U,y=y*M+b*U,_=_*M+P*U,w=w*M+I*U,M===1-d){let z=1/Math.sqrt(g*g+y*y+_*_+w*w);g*=z,y*=z,_*=z,w*=z}}t[e]=g,t[e+1]=y,t[e+2]=_,t[e+3]=w}static multiplyQuaternionsFlat(t,e,o,a,c,p){let d=o[a],g=o[a+1],y=o[a+2],_=o[a+3],w=c[p],x=c[p+1],b=c[p+2],P=c[p+3];return t[e]=d*P+_*w+g*b-y*x,t[e+1]=g*P+_*x+y*w-d*b,t[e+2]=y*P+_*b+d*x-g*w,t[e+3]=_*P-d*w-g*x-y*b,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,o,a){return this._x=t,this._y=e,this._z=o,this._w=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){let o=t._x,a=t._y,c=t._z,p=t._order,d=Math.cos,g=Math.sin,y=d(o/2),_=d(a/2),w=d(c/2),x=g(o/2),b=g(a/2),P=g(c/2);switch(p){case"XYZ":this._x=x*_*w+y*b*P,this._y=y*b*w-x*_*P,this._z=y*_*P+x*b*w,this._w=y*_*w-x*b*P;break;case"YXZ":this._x=x*_*w+y*b*P,this._y=y*b*w-x*_*P,this._z=y*_*P-x*b*w,this._w=y*_*w+x*b*P;break;case"ZXY":this._x=x*_*w-y*b*P,this._y=y*b*w+x*_*P,this._z=y*_*P+x*b*w,this._w=y*_*w-x*b*P;break;case"ZYX":this._x=x*_*w-y*b*P,this._y=y*b*w+x*_*P,this._z=y*_*P-x*b*w,this._w=y*_*w+x*b*P;break;case"YZX":this._x=x*_*w+y*b*P,this._y=y*b*w+x*_*P,this._z=y*_*P-x*b*w,this._w=y*_*w-x*b*P;break;case"XZY":this._x=x*_*w-y*b*P,this._y=y*b*w-x*_*P,this._z=y*_*P+x*b*w,this._w=y*_*w+x*b*P;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+p)}return e!==!1&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let o=e/2,a=Math.sin(o);return this._x=t.x*a,this._y=t.y*a,this._z=t.z*a,this._w=Math.cos(o),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,o=e[0],a=e[4],c=e[8],p=e[1],d=e[5],g=e[9],y=e[2],_=e[6],w=e[10],x=o+d+w;if(x>0){let b=.5/Math.sqrt(x+1);this._w=.25/b,this._x=(_-g)*b,this._y=(c-y)*b,this._z=(p-a)*b}else if(o>d&&o>w){let b=2*Math.sqrt(1+o-d-w);this._w=(_-g)/b,this._x=.25*b,this._y=(a+p)/b,this._z=(c+y)/b}else if(d>w){let b=2*Math.sqrt(1+d-o-w);this._w=(c-y)/b,this._x=(a+p)/b,this._y=.25*b,this._z=(g+_)/b}else{let b=2*Math.sqrt(1+w-o-d);this._w=(p-a)/b,this._x=(c+y)/b,this._y=(g+_)/b,this._z=.25*b}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let o=t.dot(e)+1;return o<Number.EPSILON?(o=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=o):(this._x=0,this._y=-t.z,this._z=t.y,this._w=o)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=o),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Ho(this.dot(t),-1,1)))}rotateTowards(t,e){let o=this.angleTo(t);if(o===0)return this;let a=Math.min(1,e/o);return this.slerp(t,a),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let o=t._x,a=t._y,c=t._z,p=t._w,d=e._x,g=e._y,y=e._z,_=e._w;return this._x=o*_+p*d+a*y-c*g,this._y=a*_+p*g+c*d-o*y,this._z=c*_+p*y+o*g-a*d,this._w=p*_-o*d-a*g-c*y,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);let o=this._x,a=this._y,c=this._z,p=this._w,d=p*t._w+o*t._x+a*t._y+c*t._z;if(d<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,d=-d):this.copy(t),d>=1)return this._w=p,this._x=o,this._y=a,this._z=c,this;let g=1-d*d;if(g<=Number.EPSILON){let b=1-e;return this._w=b*p+e*this._w,this._x=b*o+e*this._x,this._y=b*a+e*this._y,this._z=b*c+e*this._z,this.normalize(),this._onChangeCallback(),this}let y=Math.sqrt(g),_=Math.atan2(y,d),w=Math.sin((1-e)*_)/y,x=Math.sin(e*_)/y;return this._w=p*w+this._w*x,this._x=o*w+this._x*x,this._y=a*w+this._y*x,this._z=c*w+this._z*x,this._onChangeCallback(),this}slerpQuaternions(t,e,o){return this.copy(t).slerp(e,o)}random(){let t=Math.random(),e=Math.sqrt(1-t),o=Math.sqrt(t),a=2*Math.PI*Math.random(),c=2*Math.PI*Math.random();return this.set(e*Math.cos(a),o*Math.sin(c),o*Math.cos(c),e*Math.sin(a))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Rt=class r{constructor(t=0,e=0,o=0){r.prototype.isVector3=!0,this.x=t,this.y=e,this.z=o}set(t,e,o){return o===void 0&&(o=this.z),this.x=t,this.y=e,this.z=o,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(J_.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(J_.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,o=this.y,a=this.z,c=t.elements;return this.x=c[0]*e+c[3]*o+c[6]*a,this.y=c[1]*e+c[4]*o+c[7]*a,this.z=c[2]*e+c[5]*o+c[8]*a,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,o=this.y,a=this.z,c=t.elements,p=1/(c[3]*e+c[7]*o+c[11]*a+c[15]);return this.x=(c[0]*e+c[4]*o+c[8]*a+c[12])*p,this.y=(c[1]*e+c[5]*o+c[9]*a+c[13])*p,this.z=(c[2]*e+c[6]*o+c[10]*a+c[14])*p,this}applyQuaternion(t){let e=this.x,o=this.y,a=this.z,c=t.x,p=t.y,d=t.z,g=t.w,y=g*e+p*a-d*o,_=g*o+d*e-c*a,w=g*a+c*o-p*e,x=-c*e-p*o-d*a;return this.x=y*g+x*-c+_*-d-w*-p,this.y=_*g+x*-p+w*-c-y*-d,this.z=w*g+x*-d+y*-p-_*-c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,o=this.y,a=this.z,c=t.elements;return this.x=c[0]*e+c[4]*o+c[8]*a,this.y=c[1]*e+c[5]*o+c[9]*a,this.z=c[2]*e+c[6]*o+c[10]*a,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this.z=t.z+(e.z-t.z)*o,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let o=t.x,a=t.y,c=t.z,p=e.x,d=e.y,g=e.z;return this.x=a*g-c*d,this.y=c*p-o*g,this.z=o*d-a*p,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let o=t.dot(this)/e;return this.copy(t).multiplyScalar(o)}projectOnPlane(t){return hg.copy(this).projectOnVector(t),this.sub(hg)}reflect(t){return this.sub(hg.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let o=this.dot(t)/e;return Math.acos(Ho(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y,a=this.z-t.z;return e*e+o*o+a*a}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,o){let a=Math.sin(e)*t;return this.x=a*Math.sin(o),this.y=Math.cos(e)*t,this.z=a*Math.cos(o),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,o){return this.x=t*Math.sin(e),this.y=o,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),o=this.setFromMatrixColumn(t,1).length(),a=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=o,this.z=a,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=(Math.random()-.5)*2,e=Math.random()*Math.PI*2,o=Math.sqrt(1-t**2);return this.x=o*Math.cos(e),this.y=o*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},hg=new Rt,J_=new bu,rl=class{constructor(t=new Rt(1/0,1/0,1/0),e=new Rt(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,o=t.length;e<o;e+=3)this.expandByPoint(Ua.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,o=t.count;e<o;e++)this.expandByPoint(Ua.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,o=t.length;e<o;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let o=Ua.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(o),this.max.copy(t).add(o),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){if(t.updateWorldMatrix(!1,!1),t.boundingBox!==void 0)t.boundingBox===null&&t.computeBoundingBox(),Pl.copy(t.boundingBox),Pl.applyMatrix4(t.matrixWorld),this.union(Pl);else{let a=t.geometry;if(a!==void 0)if(e&&a.attributes!==void 0&&a.attributes.position!==void 0){let c=a.attributes.position;for(let p=0,d=c.count;p<d;p++)Ua.fromBufferAttribute(c,p).applyMatrix4(t.matrixWorld),this.expandByPoint(Ua)}else a.boundingBox===null&&a.computeBoundingBox(),Pl.copy(a.boundingBox),Pl.applyMatrix4(t.matrixWorld),this.union(Pl)}let o=t.children;for(let a=0,c=o.length;a<c;a++)this.expandByObject(o[a],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Ua),Ua.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,o;return t.normal.x>0?(e=t.normal.x*this.min.x,o=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,o=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,o+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,o+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,o+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,o+=t.normal.z*this.min.z),e<=-t.constant&&o>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Yc),lh.subVectors(this.max,Yc),Il.subVectors(t.a,Yc),Rl.subVectors(t.b,Yc),Ll.subVectors(t.c,Yc),pu.subVectors(Rl,Il),du.subVectors(Ll,Rl),$u.subVectors(Il,Ll);let e=[0,-pu.z,pu.y,0,-du.z,du.y,0,-$u.z,$u.y,pu.z,0,-pu.x,du.z,0,-du.x,$u.z,0,-$u.x,-pu.y,pu.x,0,-du.y,du.x,0,-$u.y,$u.x,0];return!pg(e,Il,Rl,Ll,lh)||(e=[1,0,0,0,1,0,0,0,1],!pg(e,Il,Rl,Ll,lh))?!1:(ch.crossVectors(pu,du),e=[ch.x,ch.y,ch.z],pg(e,Il,Rl,Ll,lh))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Ua).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Ua).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Fa[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Fa[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Fa[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Fa[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Fa[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Fa[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Fa[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Fa[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Fa),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},Fa=[new Rt,new Rt,new Rt,new Rt,new Rt,new Rt,new Rt,new Rt],Ua=new Rt,Pl=new rl,Il=new Rt,Rl=new Rt,Ll=new Rt,pu=new Rt,du=new Rt,$u=new Rt,Yc=new Rt,lh=new Rt,ch=new Rt,Zu=new Rt;function pg(r,t,e,o,a){for(let c=0,p=r.length-3;c<=p;c+=3){Zu.fromArray(r,c);let d=a.x*Math.abs(Zu.x)+a.y*Math.abs(Zu.y)+a.z*Math.abs(Zu.z),g=t.dot(Zu),y=e.dot(Zu),_=o.dot(Zu);if(Math.max(-Math.max(g,y,_),Math.min(g,y,_))>d)return!1}return!0}var sR=new rl,$c=new Rt,dg=new Rt,nf=class{constructor(t=new Rt,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let o=this.center;e!==void 0?o.copy(e):sR.setFromPoints(t).getCenter(o);let a=0;for(let c=0,p=t.length;c<p;c++)a=Math.max(a,o.distanceToSquared(t[c]));return this.radius=Math.sqrt(a),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let o=this.center.distanceToSquared(t);return e.copy(t),o>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;$c.subVectors(t,this.center);let e=$c.lengthSq();if(e>this.radius*this.radius){let o=Math.sqrt(e),a=(o-this.radius)*.5;this.center.addScaledVector($c,a/o),this.radius+=a}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(dg.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint($c.copy(t.center).add(dg)),this.expandByPoint($c.copy(t.center).sub(dg))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},Ba=new Rt,gg=new Rt,fh=new Rt,gu=new Rt,mg=new Rt,hh=new Rt,yg=new Rt,zg=class{constructor(t=new Rt,e=new Rt(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Ba)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let o=e.dot(this.direction);return o<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,o)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=Ba.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Ba.copy(this.origin).addScaledVector(this.direction,e),Ba.distanceToSquared(t))}distanceSqToSegment(t,e,o,a){gg.copy(t).add(e).multiplyScalar(.5),fh.copy(e).sub(t).normalize(),gu.copy(this.origin).sub(gg);let c=t.distanceTo(e)*.5,p=-this.direction.dot(fh),d=gu.dot(this.direction),g=-gu.dot(fh),y=gu.lengthSq(),_=Math.abs(1-p*p),w,x,b,P;if(_>0)if(w=p*g-d,x=p*d-g,P=c*_,w>=0)if(x>=-P)if(x<=P){let I=1/_;w*=I,x*=I,b=w*(w+p*x+2*d)+x*(p*w+x+2*g)+y}else x=c,w=Math.max(0,-(p*x+d)),b=-w*w+x*(x+2*g)+y;else x=-c,w=Math.max(0,-(p*x+d)),b=-w*w+x*(x+2*g)+y;else x<=-P?(w=Math.max(0,-(-p*c+d)),x=w>0?-c:Math.min(Math.max(-c,-g),c),b=-w*w+x*(x+2*g)+y):x<=P?(w=0,x=Math.min(Math.max(-c,-g),c),b=x*(x+2*g)+y):(w=Math.max(0,-(p*c+d)),x=w>0?c:Math.min(Math.max(-c,-g),c),b=-w*w+x*(x+2*g)+y);else x=p>0?-c:c,w=Math.max(0,-(p*x+d)),b=-w*w+x*(x+2*g)+y;return o&&o.copy(this.origin).addScaledVector(this.direction,w),a&&a.copy(gg).addScaledVector(fh,x),b}intersectSphere(t,e){Ba.subVectors(t.center,this.origin);let o=Ba.dot(this.direction),a=Ba.dot(Ba)-o*o,c=t.radius*t.radius;if(a>c)return null;let p=Math.sqrt(c-a),d=o-p,g=o+p;return g<0?null:d<0?this.at(g,e):this.at(d,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let o=-(this.origin.dot(t.normal)+t.constant)/e;return o>=0?o:null}intersectPlane(t,e){let o=this.distanceToPlane(t);return o===null?null:this.at(o,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let o,a,c,p,d,g,y=1/this.direction.x,_=1/this.direction.y,w=1/this.direction.z,x=this.origin;return y>=0?(o=(t.min.x-x.x)*y,a=(t.max.x-x.x)*y):(o=(t.max.x-x.x)*y,a=(t.min.x-x.x)*y),_>=0?(c=(t.min.y-x.y)*_,p=(t.max.y-x.y)*_):(c=(t.max.y-x.y)*_,p=(t.min.y-x.y)*_),o>p||c>a||((c>o||isNaN(o))&&(o=c),(p<a||isNaN(a))&&(a=p),w>=0?(d=(t.min.z-x.z)*w,g=(t.max.z-x.z)*w):(d=(t.max.z-x.z)*w,g=(t.min.z-x.z)*w),o>g||d>a)||((d>o||o!==o)&&(o=d),(g<a||a!==a)&&(a=g),a<0)?null:this.at(o>=0?o:a,e)}intersectsBox(t){return this.intersectBox(t,Ba)!==null}intersectTriangle(t,e,o,a,c){mg.subVectors(e,t),hh.subVectors(o,t),yg.crossVectors(mg,hh);let p=this.direction.dot(yg),d;if(p>0){if(a)return null;d=1}else if(p<0)d=-1,p=-p;else return null;gu.subVectors(this.origin,t);let g=d*this.direction.dot(hh.crossVectors(gu,hh));if(g<0)return null;let y=d*this.direction.dot(mg.cross(gu));if(y<0||g+y>p)return null;let _=-d*gu.dot(yg);return _<0?null:this.at(_/p,c)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},ro=class r{constructor(t,e,o,a,c,p,d,g,y,_,w,x,b,P,I,M){r.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,o,a,c,p,d,g,y,_,w,x,b,P,I,M)}set(t,e,o,a,c,p,d,g,y,_,w,x,b,P,I,M){let E=this.elements;return E[0]=t,E[4]=e,E[8]=o,E[12]=a,E[1]=c,E[5]=p,E[9]=d,E[13]=g,E[2]=y,E[6]=_,E[10]=w,E[14]=x,E[3]=b,E[7]=P,E[11]=I,E[15]=M,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new r().fromArray(this.elements)}copy(t){let e=this.elements,o=t.elements;return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=o[3],e[4]=o[4],e[5]=o[5],e[6]=o[6],e[7]=o[7],e[8]=o[8],e[9]=o[9],e[10]=o[10],e[11]=o[11],e[12]=o[12],e[13]=o[13],e[14]=o[14],e[15]=o[15],this}copyPosition(t){let e=this.elements,o=t.elements;return e[12]=o[12],e[13]=o[13],e[14]=o[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,o){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),o.setFromMatrixColumn(this,2),this}makeBasis(t,e,o){return this.set(t.x,e.x,o.x,0,t.y,e.y,o.y,0,t.z,e.z,o.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,o=t.elements,a=1/Nl.setFromMatrixColumn(t,0).length(),c=1/Nl.setFromMatrixColumn(t,1).length(),p=1/Nl.setFromMatrixColumn(t,2).length();return e[0]=o[0]*a,e[1]=o[1]*a,e[2]=o[2]*a,e[3]=0,e[4]=o[4]*c,e[5]=o[5]*c,e[6]=o[6]*c,e[7]=0,e[8]=o[8]*p,e[9]=o[9]*p,e[10]=o[10]*p,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,o=t.x,a=t.y,c=t.z,p=Math.cos(o),d=Math.sin(o),g=Math.cos(a),y=Math.sin(a),_=Math.cos(c),w=Math.sin(c);if(t.order==="XYZ"){let x=p*_,b=p*w,P=d*_,I=d*w;e[0]=g*_,e[4]=-g*w,e[8]=y,e[1]=b+P*y,e[5]=x-I*y,e[9]=-d*g,e[2]=I-x*y,e[6]=P+b*y,e[10]=p*g}else if(t.order==="YXZ"){let x=g*_,b=g*w,P=y*_,I=y*w;e[0]=x+I*d,e[4]=P*d-b,e[8]=p*y,e[1]=p*w,e[5]=p*_,e[9]=-d,e[2]=b*d-P,e[6]=I+x*d,e[10]=p*g}else if(t.order==="ZXY"){let x=g*_,b=g*w,P=y*_,I=y*w;e[0]=x-I*d,e[4]=-p*w,e[8]=P+b*d,e[1]=b+P*d,e[5]=p*_,e[9]=I-x*d,e[2]=-p*y,e[6]=d,e[10]=p*g}else if(t.order==="ZYX"){let x=p*_,b=p*w,P=d*_,I=d*w;e[0]=g*_,e[4]=P*y-b,e[8]=x*y+I,e[1]=g*w,e[5]=I*y+x,e[9]=b*y-P,e[2]=-y,e[6]=d*g,e[10]=p*g}else if(t.order==="YZX"){let x=p*g,b=p*y,P=d*g,I=d*y;e[0]=g*_,e[4]=I-x*w,e[8]=P*w+b,e[1]=w,e[5]=p*_,e[9]=-d*_,e[2]=-y*_,e[6]=b*w+P,e[10]=x-I*w}else if(t.order==="XZY"){let x=p*g,b=p*y,P=d*g,I=d*y;e[0]=g*_,e[4]=-w,e[8]=y*_,e[1]=x*w+I,e[5]=p*_,e[9]=b*w-P,e[2]=P*w-b,e[6]=d*_,e[10]=I*w+x}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(aR,t,uR)}lookAt(t,e,o){let a=this.elements;return us.subVectors(t,e),us.lengthSq()===0&&(us.z=1),us.normalize(),mu.crossVectors(o,us),mu.lengthSq()===0&&(Math.abs(o.z)===1?us.x+=1e-4:us.z+=1e-4,us.normalize(),mu.crossVectors(o,us)),mu.normalize(),ph.crossVectors(us,mu),a[0]=mu.x,a[4]=ph.x,a[8]=us.x,a[1]=mu.y,a[5]=ph.y,a[9]=us.y,a[2]=mu.z,a[6]=ph.z,a[10]=us.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,a=e.elements,c=this.elements,p=o[0],d=o[4],g=o[8],y=o[12],_=o[1],w=o[5],x=o[9],b=o[13],P=o[2],I=o[6],M=o[10],E=o[14],N=o[3],A=o[7],U=o[11],z=o[15],$=a[0],q=a[4],D=a[8],G=a[12],Q=a[1],_t=a[5],Z=a[9],Dt=a[13],et=a[2],vt=a[6],It=a[10],Pt=a[14],Et=a[3],yt=a[7],Y=a[11],ht=a[15];return c[0]=p*$+d*Q+g*et+y*Et,c[4]=p*q+d*_t+g*vt+y*yt,c[8]=p*D+d*Z+g*It+y*Y,c[12]=p*G+d*Dt+g*Pt+y*ht,c[1]=_*$+w*Q+x*et+b*Et,c[5]=_*q+w*_t+x*vt+b*yt,c[9]=_*D+w*Z+x*It+b*Y,c[13]=_*G+w*Dt+x*Pt+b*ht,c[2]=P*$+I*Q+M*et+E*Et,c[6]=P*q+I*_t+M*vt+E*yt,c[10]=P*D+I*Z+M*It+E*Y,c[14]=P*G+I*Dt+M*Pt+E*ht,c[3]=N*$+A*Q+U*et+z*Et,c[7]=N*q+A*_t+U*vt+z*yt,c[11]=N*D+A*Z+U*It+z*Y,c[15]=N*G+A*Dt+U*Pt+z*ht,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],o=t[4],a=t[8],c=t[12],p=t[1],d=t[5],g=t[9],y=t[13],_=t[2],w=t[6],x=t[10],b=t[14],P=t[3],I=t[7],M=t[11],E=t[15];return P*(+c*g*w-a*y*w-c*d*x+o*y*x+a*d*b-o*g*b)+I*(+e*g*b-e*y*x+c*p*x-a*p*b+a*y*_-c*g*_)+M*(+e*y*w-e*d*b-c*p*w+o*p*b+c*d*_-o*y*_)+E*(-a*d*_-e*g*w+e*d*x+a*p*w-o*p*x+o*g*_)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,o){let a=this.elements;return t.isVector3?(a[12]=t.x,a[13]=t.y,a[14]=t.z):(a[12]=t,a[13]=e,a[14]=o),this}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],c=t[3],p=t[4],d=t[5],g=t[6],y=t[7],_=t[8],w=t[9],x=t[10],b=t[11],P=t[12],I=t[13],M=t[14],E=t[15],N=w*M*y-I*x*y+I*g*b-d*M*b-w*g*E+d*x*E,A=P*x*y-_*M*y-P*g*b+p*M*b+_*g*E-p*x*E,U=_*I*y-P*w*y+P*d*b-p*I*b-_*d*E+p*w*E,z=P*w*g-_*I*g-P*d*x+p*I*x+_*d*M-p*w*M,$=e*N+o*A+a*U+c*z;if($===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let q=1/$;return t[0]=N*q,t[1]=(I*x*c-w*M*c-I*a*b+o*M*b+w*a*E-o*x*E)*q,t[2]=(d*M*c-I*g*c+I*a*y-o*M*y-d*a*E+o*g*E)*q,t[3]=(w*g*c-d*x*c-w*a*y+o*x*y+d*a*b-o*g*b)*q,t[4]=A*q,t[5]=(_*M*c-P*x*c+P*a*b-e*M*b-_*a*E+e*x*E)*q,t[6]=(P*g*c-p*M*c-P*a*y+e*M*y+p*a*E-e*g*E)*q,t[7]=(p*x*c-_*g*c+_*a*y-e*x*y-p*a*b+e*g*b)*q,t[8]=U*q,t[9]=(P*w*c-_*I*c-P*o*b+e*I*b+_*o*E-e*w*E)*q,t[10]=(p*I*c-P*d*c+P*o*y-e*I*y-p*o*E+e*d*E)*q,t[11]=(_*d*c-p*w*c-_*o*y+e*w*y+p*o*b-e*d*b)*q,t[12]=z*q,t[13]=(_*I*a-P*w*a+P*o*x-e*I*x-_*o*M+e*w*M)*q,t[14]=(P*d*a-p*I*a-P*o*g+e*I*g+p*o*M-e*d*M)*q,t[15]=(p*w*a-_*d*a+_*o*g-e*w*g-p*o*x+e*d*x)*q,this}scale(t){let e=this.elements,o=t.x,a=t.y,c=t.z;return e[0]*=o,e[4]*=a,e[8]*=c,e[1]*=o,e[5]*=a,e[9]*=c,e[2]*=o,e[6]*=a,e[10]*=c,e[3]*=o,e[7]*=a,e[11]*=c,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],o=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],a=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,o,a))}makeTranslation(t,e,o){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,o,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),o=Math.sin(t);return this.set(1,0,0,0,0,e,-o,0,0,o,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,0,o,0,0,1,0,0,-o,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,-o,0,0,o,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let o=Math.cos(e),a=Math.sin(e),c=1-o,p=t.x,d=t.y,g=t.z,y=c*p,_=c*d;return this.set(y*p+o,y*d-a*g,y*g+a*d,0,y*d+a*g,_*d+o,_*g-a*p,0,y*g-a*d,_*g+a*p,c*g*g+o,0,0,0,0,1),this}makeScale(t,e,o){return this.set(t,0,0,0,0,e,0,0,0,0,o,0,0,0,0,1),this}makeShear(t,e,o,a,c,p){return this.set(1,o,c,0,t,1,p,0,e,a,1,0,0,0,0,1),this}compose(t,e,o){let a=this.elements,c=e._x,p=e._y,d=e._z,g=e._w,y=c+c,_=p+p,w=d+d,x=c*y,b=c*_,P=c*w,I=p*_,M=p*w,E=d*w,N=g*y,A=g*_,U=g*w,z=o.x,$=o.y,q=o.z;return a[0]=(1-(I+E))*z,a[1]=(b+U)*z,a[2]=(P-A)*z,a[3]=0,a[4]=(b-U)*$,a[5]=(1-(x+E))*$,a[6]=(M+N)*$,a[7]=0,a[8]=(P+A)*q,a[9]=(M-N)*q,a[10]=(1-(x+I))*q,a[11]=0,a[12]=t.x,a[13]=t.y,a[14]=t.z,a[15]=1,this}decompose(t,e,o){let a=this.elements,c=Nl.set(a[0],a[1],a[2]).length(),p=Nl.set(a[4],a[5],a[6]).length(),d=Nl.set(a[8],a[9],a[10]).length();this.determinant()<0&&(c=-c),t.x=a[12],t.y=a[13],t.z=a[14],Gs.copy(this);let y=1/c,_=1/p,w=1/d;return Gs.elements[0]*=y,Gs.elements[1]*=y,Gs.elements[2]*=y,Gs.elements[4]*=_,Gs.elements[5]*=_,Gs.elements[6]*=_,Gs.elements[8]*=w,Gs.elements[9]*=w,Gs.elements[10]*=w,e.setFromRotationMatrix(Gs),o.x=c,o.y=p,o.z=d,this}makePerspective(t,e,o,a,c,p,d=qa){let g=this.elements,y=2*c/(e-t),_=2*c/(o-a),w=(e+t)/(e-t),x=(o+a)/(o-a),b,P;if(d===qa)b=-(p+c)/(p-c),P=-2*p*c/(p-c);else if(d===Dh)b=-p/(p-c),P=-p*c/(p-c);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+d);return g[0]=y,g[4]=0,g[8]=w,g[12]=0,g[1]=0,g[5]=_,g[9]=x,g[13]=0,g[2]=0,g[6]=0,g[10]=b,g[14]=P,g[3]=0,g[7]=0,g[11]=-1,g[15]=0,this}makeOrthographic(t,e,o,a,c,p,d=qa){let g=this.elements,y=1/(e-t),_=1/(o-a),w=1/(p-c),x=(e+t)*y,b=(o+a)*_,P,I;if(d===qa)P=(p+c)*w,I=-2*w;else if(d===Dh)P=c*w,I=-1*w;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+d);return g[0]=2*y,g[4]=0,g[8]=0,g[12]=-x,g[1]=0,g[5]=2*_,g[9]=0,g[13]=-b,g[2]=0,g[6]=0,g[10]=I,g[14]=-P,g[3]=0,g[7]=0,g[11]=0,g[15]=1,this}equals(t){let e=this.elements,o=t.elements;for(let a=0;a<16;a++)if(e[a]!==o[a])return!1;return!0}fromArray(t,e=0){for(let o=0;o<16;o++)this.elements[o]=t[o+e];return this}toArray(t=[],e=0){let o=this.elements;return t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3],t[e+4]=o[4],t[e+5]=o[5],t[e+6]=o[6],t[e+7]=o[7],t[e+8]=o[8],t[e+9]=o[9],t[e+10]=o[10],t[e+11]=o[11],t[e+12]=o[12],t[e+13]=o[13],t[e+14]=o[14],t[e+15]=o[15],t}},Nl=new Rt,Gs=new ro,aR=new Rt(0,0,0),uR=new Rt(1,1,1),mu=new Rt,ph=new Rt,us=new Rt,K_=new ro,Q_=new bu,Gh=class r{constructor(t=0,e=0,o=0,a=r.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=o,this._order=a}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,o,a=this._order){return this._x=t,this._y=e,this._z=o,this._order=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,o=!0){let a=t.elements,c=a[0],p=a[4],d=a[8],g=a[1],y=a[5],_=a[9],w=a[2],x=a[6],b=a[10];switch(e){case"XYZ":this._y=Math.asin(Ho(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(-_,b),this._z=Math.atan2(-p,c)):(this._x=Math.atan2(x,y),this._z=0);break;case"YXZ":this._x=Math.asin(-Ho(_,-1,1)),Math.abs(_)<.9999999?(this._y=Math.atan2(d,b),this._z=Math.atan2(g,y)):(this._y=Math.atan2(-w,c),this._z=0);break;case"ZXY":this._x=Math.asin(Ho(x,-1,1)),Math.abs(x)<.9999999?(this._y=Math.atan2(-w,b),this._z=Math.atan2(-p,y)):(this._y=0,this._z=Math.atan2(g,c));break;case"ZYX":this._y=Math.asin(-Ho(w,-1,1)),Math.abs(w)<.9999999?(this._x=Math.atan2(x,b),this._z=Math.atan2(g,c)):(this._x=0,this._z=Math.atan2(-p,y));break;case"YZX":this._z=Math.asin(Ho(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(-_,y),this._y=Math.atan2(-w,c)):(this._x=0,this._y=Math.atan2(d,b));break;case"XZY":this._z=Math.asin(-Ho(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(x,y),this._y=Math.atan2(d,c)):(this._x=Math.atan2(-_,b),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,o===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,o){return K_.makeRotationFromQuaternion(t),this.setFromRotationMatrix(K_,e,o)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Q_.setFromEuler(this),this.setFromQuaternion(Q_,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Gh.DEFAULT_ORDER="XYZ";var kh=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},lR=0,j_=new Rt,Ol=new bu,za=new ro,dh=new Rt,Zc=new Rt,cR=new Rt,fR=new bu,t1=new Rt(1,0,0),e1=new Rt(0,1,0),n1=new Rt(0,0,1),hR={type:"added"},pR={type:"removed"},ha=class r extends Su{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:lR++}),this.uuid=sf(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new Rt,e=new Gh,o=new bu,a=new Rt(1,1,1);function c(){o.setFromEuler(e,!1)}function p(){e.setFromQuaternion(o,void 0,!1)}e._onChange(c),o._onChange(p),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:o},scale:{configurable:!0,enumerable:!0,value:a},modelViewMatrix:{value:new ro},normalMatrix:{value:new Ke}}),this.matrix=new ro,this.matrixWorld=new ro,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new kh,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Ol.setFromAxisAngle(t,e),this.quaternion.multiply(Ol),this}rotateOnWorldAxis(t,e){return Ol.setFromAxisAngle(t,e),this.quaternion.premultiply(Ol),this}rotateX(t){return this.rotateOnAxis(t1,t)}rotateY(t){return this.rotateOnAxis(e1,t)}rotateZ(t){return this.rotateOnAxis(n1,t)}translateOnAxis(t,e){return j_.copy(t).applyQuaternion(this.quaternion),this.position.add(j_.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(t1,t)}translateY(t){return this.translateOnAxis(e1,t)}translateZ(t){return this.translateOnAxis(n1,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(za.copy(this.matrixWorld).invert())}lookAt(t,e,o){t.isVector3?dh.copy(t):dh.set(t,e,o);let a=this.parent;this.updateWorldMatrix(!0,!1),Zc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?za.lookAt(Zc,dh,this.up):za.lookAt(dh,Zc,this.up),this.quaternion.setFromRotationMatrix(za),a&&(za.extractRotation(a.matrixWorld),Ol.setFromRotationMatrix(za),this.quaternion.premultiply(Ol.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(hR)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let o=0;o<arguments.length;o++)this.remove(arguments[o]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(pR)),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),za.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),za.multiply(t.parent.matrixWorld)),t.applyMatrix4(za),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let o=0,a=this.children.length;o<a;o++){let p=this.children[o].getObjectByProperty(t,e);if(p!==void 0)return p}}getObjectsByProperty(t,e){let o=[];this[t]===e&&o.push(this);for(let a=0,c=this.children.length;a<c;a++){let p=this.children[a].getObjectsByProperty(t,e);p.length>0&&(o=o.concat(p))}return o}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Zc,t,cR),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Zc,fR,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let o=0,a=e.length;o<a;o++)e[o].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let o=0,a=e.length;o<a;o++)e[o].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let o=0,a=e.length;o<a;o++){let c=e[o];(c.matrixWorldAutoUpdate===!0||t===!0)&&c.updateMatrixWorld(t)}}updateWorldMatrix(t,e){let o=this.parent;if(t===!0&&o!==null&&o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e===!0){let a=this.children;for(let c=0,p=a.length;c<p;c++){let d=a[c];d.matrixWorldAutoUpdate===!0&&d.updateWorldMatrix(!1,!0)}}}toJSON(t){let e=t===void 0||typeof t=="string",o={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},o.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let a={};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.castShadow===!0&&(a.castShadow=!0),this.receiveShadow===!0&&(a.receiveShadow=!0),this.visible===!1&&(a.visible=!1),this.frustumCulled===!1&&(a.frustumCulled=!1),this.renderOrder!==0&&(a.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),a.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(a.instanceColor=this.instanceColor.toJSON()));function c(d,g){return d[g.uuid]===void 0&&(d[g.uuid]=g.toJSON(t)),g.uuid}if(this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(a.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=c(t.geometries,this.geometry);let d=this.geometry.parameters;if(d!==void 0&&d.shapes!==void 0){let g=d.shapes;if(Array.isArray(g))for(let y=0,_=g.length;y<_;y++){let w=g[y];c(t.shapes,w)}else c(t.shapes,g)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(c(t.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let d=[];for(let g=0,y=this.material.length;g<y;g++)d.push(c(t.materials,this.material[g]));a.material=d}else a.material=c(t.materials,this.material);if(this.children.length>0){a.children=[];for(let d=0;d<this.children.length;d++)a.children.push(this.children[d].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let d=0;d<this.animations.length;d++){let g=this.animations[d];a.animations.push(c(t.animations,g))}}if(e){let d=p(t.geometries),g=p(t.materials),y=p(t.textures),_=p(t.images),w=p(t.shapes),x=p(t.skeletons),b=p(t.animations),P=p(t.nodes);d.length>0&&(o.geometries=d),g.length>0&&(o.materials=g),y.length>0&&(o.textures=y),_.length>0&&(o.images=_),w.length>0&&(o.shapes=w),x.length>0&&(o.skeletons=x),b.length>0&&(o.animations=b),P.length>0&&(o.nodes=P)}return o.object=a,o;function p(d){let g=[];for(let y in d){let _=d[y];delete _.metadata,g.push(_)}return g}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let o=0;o<t.children.length;o++){let a=t.children[o];this.add(a.clone())}return this}};ha.DEFAULT_UP=new Rt(0,1,0);ha.DEFAULT_MATRIX_AUTO_UPDATE=!0;ha.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var ks=new Rt,Ga=new Rt,vg=new Rt,ka=new Rt,Dl=new Rt,Fl=new Rt,r1=new Rt,_g=new Rt,xg=new Rt,Eg=new Rt,gh=!1,ql=class r{constructor(t=new Rt,e=new Rt,o=new Rt){this.a=t,this.b=e,this.c=o}static getNormal(t,e,o,a){a.subVectors(o,e),ks.subVectors(t,e),a.cross(ks);let c=a.lengthSq();return c>0?a.multiplyScalar(1/Math.sqrt(c)):a.set(0,0,0)}static getBarycoord(t,e,o,a,c){ks.subVectors(a,e),Ga.subVectors(o,e),vg.subVectors(t,e);let p=ks.dot(ks),d=ks.dot(Ga),g=ks.dot(vg),y=Ga.dot(Ga),_=Ga.dot(vg),w=p*y-d*d;if(w===0)return c.set(-2,-1,-1);let x=1/w,b=(y*g-d*_)*x,P=(p*_-d*g)*x;return c.set(1-b-P,P,b)}static containsPoint(t,e,o,a){return this.getBarycoord(t,e,o,a,ka),ka.x>=0&&ka.y>=0&&ka.x+ka.y<=1}static getUV(t,e,o,a,c,p,d,g){return gh===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),gh=!0),this.getInterpolation(t,e,o,a,c,p,d,g)}static getInterpolation(t,e,o,a,c,p,d,g){return this.getBarycoord(t,e,o,a,ka),g.setScalar(0),g.addScaledVector(c,ka.x),g.addScaledVector(p,ka.y),g.addScaledVector(d,ka.z),g}static isFrontFacing(t,e,o,a){return ks.subVectors(o,e),Ga.subVectors(t,e),ks.cross(Ga).dot(a)<0}set(t,e,o){return this.a.copy(t),this.b.copy(e),this.c.copy(o),this}setFromPointsAndIndices(t,e,o,a){return this.a.copy(t[e]),this.b.copy(t[o]),this.c.copy(t[a]),this}setFromAttributeAndIndices(t,e,o,a){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,o),this.c.fromBufferAttribute(t,a),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ks.subVectors(this.c,this.b),Ga.subVectors(this.a,this.b),ks.cross(Ga).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return r.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return r.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,o,a,c){return gh===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),gh=!0),r.getInterpolation(t,this.a,this.b,this.c,e,o,a,c)}getInterpolation(t,e,o,a,c){return r.getInterpolation(t,this.a,this.b,this.c,e,o,a,c)}containsPoint(t){return r.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return r.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let o=this.a,a=this.b,c=this.c,p,d;Dl.subVectors(a,o),Fl.subVectors(c,o),_g.subVectors(t,o);let g=Dl.dot(_g),y=Fl.dot(_g);if(g<=0&&y<=0)return e.copy(o);xg.subVectors(t,a);let _=Dl.dot(xg),w=Fl.dot(xg);if(_>=0&&w<=_)return e.copy(a);let x=g*w-_*y;if(x<=0&&g>=0&&_<=0)return p=g/(g-_),e.copy(o).addScaledVector(Dl,p);Eg.subVectors(t,c);let b=Dl.dot(Eg),P=Fl.dot(Eg);if(P>=0&&b<=P)return e.copy(c);let I=b*y-g*P;if(I<=0&&y>=0&&P<=0)return d=y/(y-P),e.copy(o).addScaledVector(Fl,d);let M=_*P-b*w;if(M<=0&&w-_>=0&&b-P>=0)return r1.subVectors(c,a),d=(w-_)/(w-_+(b-P)),e.copy(a).addScaledVector(r1,d);let E=1/(M+I+x);return p=I*E,d=x*E,e.copy(o).addScaledVector(Dl,p).addScaledVector(Fl,d)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},dR=0,tc=class extends Su{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:dR++}),this.uuid=sf(),this.name="",this.type="Material",this.blending=$l,this.side=Mu,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=R1,this.blendDst=L1,this.blendEquation=Wl,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Pg,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=XI,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=sg,this.stencilZFail=sg,this.stencilZPass=sg,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let o=t[e];if(o===void 0){console.warn(\`THREE.Material: parameter '\${e}' has value of undefined.\`);continue}let a=this[e];if(a===void 0){console.warn(\`THREE.Material: '\${e}' is not a property of THREE.\${this.type}.\`);continue}a&&a.isColor?a.set(o):a&&a.isVector3&&o&&o.isVector3?a.copy(o):this[e]=o}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let o={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};o.uuid=this.uuid,o.type=this.type,this.name!==""&&(o.name=this.name),this.color&&this.color.isColor&&(o.color=this.color.getHex()),this.roughness!==void 0&&(o.roughness=this.roughness),this.metalness!==void 0&&(o.metalness=this.metalness),this.sheen!==void 0&&(o.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(o.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(o.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(o.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(o.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(o.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(o.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(o.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(o.shininess=this.shininess),this.clearcoat!==void 0&&(o.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(o.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(o.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(o.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(o.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,o.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(o.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(o.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(o.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(o.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(o.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(o.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(o.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(o.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(o.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(o.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(o.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(o.lightMap=this.lightMap.toJSON(t).uuid,o.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(o.aoMap=this.aoMap.toJSON(t).uuid,o.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(o.bumpMap=this.bumpMap.toJSON(t).uuid,o.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(o.normalMap=this.normalMap.toJSON(t).uuid,o.normalMapType=this.normalMapType,o.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(o.displacementMap=this.displacementMap.toJSON(t).uuid,o.displacementScale=this.displacementScale,o.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(o.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(o.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(o.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(o.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(o.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(o.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(o.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(o.combine=this.combine)),this.envMapIntensity!==void 0&&(o.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(o.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(o.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(o.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(o.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(o.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(o.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(o.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(o.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(o.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(o.size=this.size),this.shadowSide!==null&&(o.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(o.sizeAttenuation=this.sizeAttenuation),this.blending!==$l&&(o.blending=this.blending),this.side!==Mu&&(o.side=this.side),this.vertexColors===!0&&(o.vertexColors=!0),this.opacity<1&&(o.opacity=this.opacity),this.transparent===!0&&(o.transparent=!0),o.depthFunc=this.depthFunc,o.depthTest=this.depthTest,o.depthWrite=this.depthWrite,o.colorWrite=this.colorWrite,o.stencilWrite=this.stencilWrite,o.stencilWriteMask=this.stencilWriteMask,o.stencilFunc=this.stencilFunc,o.stencilRef=this.stencilRef,o.stencilFuncMask=this.stencilFuncMask,o.stencilFail=this.stencilFail,o.stencilZFail=this.stencilZFail,o.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(o.rotation=this.rotation),this.polygonOffset===!0&&(o.polygonOffset=!0),this.polygonOffsetFactor!==0&&(o.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(o.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(o.linewidth=this.linewidth),this.dashSize!==void 0&&(o.dashSize=this.dashSize),this.gapSize!==void 0&&(o.gapSize=this.gapSize),this.scale!==void 0&&(o.scale=this.scale),this.dithering===!0&&(o.dithering=!0),this.alphaTest>0&&(o.alphaTest=this.alphaTest),this.alphaHash===!0&&(o.alphaHash=!0),this.alphaToCoverage===!0&&(o.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(o.premultipliedAlpha=!0),this.forceSinglePass===!0&&(o.forceSinglePass=!0),this.wireframe===!0&&(o.wireframe=!0),this.wireframeLinewidth>1&&(o.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(o.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(o.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(o.flatShading=!0),this.visible===!1&&(o.visible=!1),this.toneMapped===!1&&(o.toneMapped=!1),this.fog===!1&&(o.fog=!1),Object.keys(this.userData).length>0&&(o.userData=this.userData);function a(c){let p=[];for(let d in c){let g=c[d];delete g.metadata,p.push(g)}return p}if(e){let c=a(t.textures),p=a(t.images);c.length>0&&(o.textures=c),p.length>0&&(o.images=p)}return o}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,o=null;if(e!==null){let a=e.length;o=new Array(a);for(let c=0;c!==a;++c)o[c]=e[c].clone()}return this.clippingPlanes=o,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},V1={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},yu={h:0,s:0,l:0},mh={h:0,s:0,l:0};function wg(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}var Er=class{constructor(t,e,o){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,o)}set(t,e,o){if(e===void 0&&o===void 0){let a=t;a&&a.isColor?this.copy(a):typeof a=="number"?this.setHex(a):typeof a=="string"&&this.setStyle(a)}else this.setRGB(t,e,o);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=qi){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,yr.toWorkingColorSpace(this,e),this}setRGB(t,e,o,a=yr.workingColorSpace){return this.r=t,this.g=e,this.b=o,yr.toWorkingColorSpace(this,a),this}setHSL(t,e,o,a=yr.workingColorSpace){if(t=eR(t,1),e=Ho(e,0,1),o=Ho(o,0,1),e===0)this.r=this.g=this.b=o;else{let c=o<=.5?o*(1+e):o+e-o*e,p=2*o-c;this.r=wg(p,c,t+1/3),this.g=wg(p,c,t),this.b=wg(p,c,t-1/3)}return yr.toWorkingColorSpace(this,a),this}setStyle(t,e=qi){function o(c){c!==void 0&&parseFloat(c)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let a;if(a=/^(\\w+)\\(([^\\)]*)\\)/.exec(t)){let c,p=a[1],d=a[2];switch(p){case"rgb":case"rgba":if(c=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(d))return o(c[4]),this.setRGB(Math.min(255,parseInt(c[1],10))/255,Math.min(255,parseInt(c[2],10))/255,Math.min(255,parseInt(c[3],10))/255,e);if(c=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(d))return o(c[4]),this.setRGB(Math.min(100,parseInt(c[1],10))/100,Math.min(100,parseInt(c[2],10))/100,Math.min(100,parseInt(c[3],10))/100,e);break;case"hsl":case"hsla":if(c=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(d))return o(c[4]),this.setHSL(parseFloat(c[1])/360,parseFloat(c[2])/100,parseFloat(c[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(a=/^\\#([A-Fa-f\\d]+)$/.exec(t)){let c=a[1],p=c.length;if(p===3)return this.setRGB(parseInt(c.charAt(0),16)/15,parseInt(c.charAt(1),16)/15,parseInt(c.charAt(2),16)/15,e);if(p===6)return this.setHex(parseInt(c,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=qi){let o=V1[t.toLowerCase()];return o!==void 0?this.setHex(o,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Zl(t.r),this.g=Zl(t.g),this.b=Zl(t.b),this}copyLinearToSRGB(t){return this.r=cg(t.r),this.g=cg(t.g),this.b=cg(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=qi){return yr.fromWorkingColorSpace(no.copy(this),t),Math.round(Ho(no.r*255,0,255))*65536+Math.round(Ho(no.g*255,0,255))*256+Math.round(Ho(no.b*255,0,255))}getHexString(t=qi){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=yr.workingColorSpace){yr.fromWorkingColorSpace(no.copy(this),e);let o=no.r,a=no.g,c=no.b,p=Math.max(o,a,c),d=Math.min(o,a,c),g,y,_=(d+p)/2;if(d===p)g=0,y=0;else{let w=p-d;switch(y=_<=.5?w/(p+d):w/(2-p-d),p){case o:g=(a-c)/w+(a<c?6:0);break;case a:g=(c-o)/w+2;break;case c:g=(o-a)/w+4;break}g/=6}return t.h=g,t.s=y,t.l=_,t}getRGB(t,e=yr.workingColorSpace){return yr.fromWorkingColorSpace(no.copy(this),e),t.r=no.r,t.g=no.g,t.b=no.b,t}getStyle(t=qi){yr.fromWorkingColorSpace(no.copy(this),t);let e=no.r,o=no.g,a=no.b;return t!==qi?\`color(\${t} \${e.toFixed(3)} \${o.toFixed(3)} \${a.toFixed(3)})\`:\`rgb(\${Math.round(e*255)},\${Math.round(o*255)},\${Math.round(a*255)})\`}offsetHSL(t,e,o){return this.getHSL(yu),this.setHSL(yu.h+t,yu.s+e,yu.l+o)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,o){return this.r=t.r+(e.r-t.r)*o,this.g=t.g+(e.g-t.g)*o,this.b=t.b+(e.b-t.b)*o,this}lerpHSL(t,e){this.getHSL(yu),t.getHSL(mh);let o=ug(yu.h,mh.h,e),a=ug(yu.s,mh.s,e),c=ug(yu.l,mh.l,e);return this.setHSL(o,a,c),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,o=this.g,a=this.b,c=t.elements;return this.r=c[0]*e+c[3]*o+c[6]*a,this.g=c[1]*e+c[4]*o+c[7]*a,this.b=c[2]*e+c[5]*o+c[8]*a,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},no=new Er;Er.NAMES=V1;var Hh=class extends tc{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Er(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=N1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}};var li=new Rt,yh=new tr,Ps=class{constructor(t,e,o=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=o,this.usage=W_,this.updateRange={offset:0,count:-1},this.gpuType=_u,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,o){t*=this.itemSize,o*=e.itemSize;for(let a=0,c=this.itemSize;a<c;a++)this.array[t+a]=e.array[o+a];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,o=this.count;e<o;e++)yh.fromBufferAttribute(this,e),yh.applyMatrix3(t),this.setXY(e,yh.x,yh.y);else if(this.itemSize===3)for(let e=0,o=this.count;e<o;e++)li.fromBufferAttribute(this,e),li.applyMatrix3(t),this.setXYZ(e,li.x,li.y,li.z);return this}applyMatrix4(t){for(let e=0,o=this.count;e<o;e++)li.fromBufferAttribute(this,e),li.applyMatrix4(t),this.setXYZ(e,li.x,li.y,li.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)li.fromBufferAttribute(this,e),li.applyNormalMatrix(t),this.setXYZ(e,li.x,li.y,li.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)li.fromBufferAttribute(this,e),li.transformDirection(t),this.setXYZ(e,li.x,li.y,li.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let o=this.array[t*this.itemSize+e];return this.normalized&&(o=Xc(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=ko(o,this.array)),this.array[t*this.itemSize+e]=o,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Xc(e,this.array)),e}setX(t,e){return this.normalized&&(e=ko(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Xc(e,this.array)),e}setY(t,e){return this.normalized&&(e=ko(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Xc(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ko(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Xc(e,this.array)),e}setW(t,e){return this.normalized&&(e=ko(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,o){return t*=this.itemSize,this.normalized&&(e=ko(e,this.array),o=ko(o,this.array)),this.array[t+0]=e,this.array[t+1]=o,this}setXYZ(t,e,o,a){return t*=this.itemSize,this.normalized&&(e=ko(e,this.array),o=ko(o,this.array),a=ko(a,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this}setXYZW(t,e,o,a,c){return t*=this.itemSize,this.normalized&&(e=ko(e,this.array),o=ko(o,this.array),a=ko(a,this.array),c=ko(c,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this.array[t+3]=c,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==W_&&(t.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(t.updateRange=this.updateRange),t}};var Vh=class extends Ps{constructor(t,e,o){super(new Uint16Array(t),e,o)}};var Wh=class extends Ps{constructor(t,e,o){super(new Uint32Array(t),e,o)}};var Xa=class extends Ps{constructor(t,e,o){super(new Float32Array(t),e,o)}};var gR=0,Ts=new ro,Mg=new ha,Ul=new Rt,ls=new rl,Jc=new rl,Ri=new Rt,il=class r extends Su{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:gR++}),this.uuid=sf(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(H1(t)?Wh:Vh)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,o=0){this.groups.push({start:t,count:e,materialIndex:o})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let o=this.attributes.normal;if(o!==void 0){let c=new Ke().getNormalMatrix(t);o.applyNormalMatrix(c),o.needsUpdate=!0}let a=this.attributes.tangent;return a!==void 0&&(a.transformDirection(t),a.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Ts.makeRotationFromQuaternion(t),this.applyMatrix4(Ts),this}rotateX(t){return Ts.makeRotationX(t),this.applyMatrix4(Ts),this}rotateY(t){return Ts.makeRotationY(t),this.applyMatrix4(Ts),this}rotateZ(t){return Ts.makeRotationZ(t),this.applyMatrix4(Ts),this}translate(t,e,o){return Ts.makeTranslation(t,e,o),this.applyMatrix4(Ts),this}scale(t,e,o){return Ts.makeScale(t,e,o),this.applyMatrix4(Ts),this}lookAt(t){return Mg.lookAt(t),Mg.updateMatrix(),this.applyMatrix4(Mg.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ul).negate(),this.translate(Ul.x,Ul.y,Ul.z),this}setFromPoints(t){let e=[];for(let o=0,a=t.length;o<a;o++){let c=t[o];e.push(c.x,c.y,c.z||0)}return this.setAttribute("position",new Xa(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new rl);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new Rt(-1/0,-1/0,-1/0),new Rt(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let o=0,a=e.length;o<a;o++){let c=e[o];ls.setFromBufferAttribute(c),this.morphTargetsRelative?(Ri.addVectors(this.boundingBox.min,ls.min),this.boundingBox.expandByPoint(Ri),Ri.addVectors(this.boundingBox.max,ls.max),this.boundingBox.expandByPoint(Ri)):(this.boundingBox.expandByPoint(ls.min),this.boundingBox.expandByPoint(ls.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new nf);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new Rt,1/0);return}if(t){let o=this.boundingSphere.center;if(ls.setFromBufferAttribute(t),e)for(let c=0,p=e.length;c<p;c++){let d=e[c];Jc.setFromBufferAttribute(d),this.morphTargetsRelative?(Ri.addVectors(ls.min,Jc.min),ls.expandByPoint(Ri),Ri.addVectors(ls.max,Jc.max),ls.expandByPoint(Ri)):(ls.expandByPoint(Jc.min),ls.expandByPoint(Jc.max))}ls.getCenter(o);let a=0;for(let c=0,p=t.count;c<p;c++)Ri.fromBufferAttribute(t,c),a=Math.max(a,o.distanceToSquared(Ri));if(e)for(let c=0,p=e.length;c<p;c++){let d=e[c],g=this.morphTargetsRelative;for(let y=0,_=d.count;y<_;y++)Ri.fromBufferAttribute(d,y),g&&(Ul.fromBufferAttribute(t,y),Ri.add(Ul)),a=Math.max(a,o.distanceToSquared(Ri))}this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let o=t.array,a=e.position.array,c=e.normal.array,p=e.uv.array,d=a.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ps(new Float32Array(4*d),4));let g=this.getAttribute("tangent").array,y=[],_=[];for(let Q=0;Q<d;Q++)y[Q]=new Rt,_[Q]=new Rt;let w=new Rt,x=new Rt,b=new Rt,P=new tr,I=new tr,M=new tr,E=new Rt,N=new Rt;function A(Q,_t,Z){w.fromArray(a,Q*3),x.fromArray(a,_t*3),b.fromArray(a,Z*3),P.fromArray(p,Q*2),I.fromArray(p,_t*2),M.fromArray(p,Z*2),x.sub(w),b.sub(w),I.sub(P),M.sub(P);let Dt=1/(I.x*M.y-M.x*I.y);isFinite(Dt)&&(E.copy(x).multiplyScalar(M.y).addScaledVector(b,-I.y).multiplyScalar(Dt),N.copy(b).multiplyScalar(I.x).addScaledVector(x,-M.x).multiplyScalar(Dt),y[Q].add(E),y[_t].add(E),y[Z].add(E),_[Q].add(N),_[_t].add(N),_[Z].add(N))}let U=this.groups;U.length===0&&(U=[{start:0,count:o.length}]);for(let Q=0,_t=U.length;Q<_t;++Q){let Z=U[Q],Dt=Z.start,et=Z.count;for(let vt=Dt,It=Dt+et;vt<It;vt+=3)A(o[vt+0],o[vt+1],o[vt+2])}let z=new Rt,$=new Rt,q=new Rt,D=new Rt;function G(Q){q.fromArray(c,Q*3),D.copy(q);let _t=y[Q];z.copy(_t),z.sub(q.multiplyScalar(q.dot(_t))).normalize(),$.crossVectors(D,_t);let Dt=$.dot(_[Q])<0?-1:1;g[Q*4]=z.x,g[Q*4+1]=z.y,g[Q*4+2]=z.z,g[Q*4+3]=Dt}for(let Q=0,_t=U.length;Q<_t;++Q){let Z=U[Q],Dt=Z.start,et=Z.count;for(let vt=Dt,It=Dt+et;vt<It;vt+=3)G(o[vt+0]),G(o[vt+1]),G(o[vt+2])}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let o=this.getAttribute("normal");if(o===void 0)o=new Ps(new Float32Array(e.count*3),3),this.setAttribute("normal",o);else for(let x=0,b=o.count;x<b;x++)o.setXYZ(x,0,0,0);let a=new Rt,c=new Rt,p=new Rt,d=new Rt,g=new Rt,y=new Rt,_=new Rt,w=new Rt;if(t)for(let x=0,b=t.count;x<b;x+=3){let P=t.getX(x+0),I=t.getX(x+1),M=t.getX(x+2);a.fromBufferAttribute(e,P),c.fromBufferAttribute(e,I),p.fromBufferAttribute(e,M),_.subVectors(p,c),w.subVectors(a,c),_.cross(w),d.fromBufferAttribute(o,P),g.fromBufferAttribute(o,I),y.fromBufferAttribute(o,M),d.add(_),g.add(_),y.add(_),o.setXYZ(P,d.x,d.y,d.z),o.setXYZ(I,g.x,g.y,g.z),o.setXYZ(M,y.x,y.y,y.z)}else for(let x=0,b=e.count;x<b;x+=3)a.fromBufferAttribute(e,x+0),c.fromBufferAttribute(e,x+1),p.fromBufferAttribute(e,x+2),_.subVectors(p,c),w.subVectors(a,c),_.cross(w),o.setXYZ(x+0,_.x,_.y,_.z),o.setXYZ(x+1,_.x,_.y,_.z),o.setXYZ(x+2,_.x,_.y,_.z);this.normalizeNormals(),o.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,o=t.count;e<o;e++)Ri.fromBufferAttribute(t,e),Ri.normalize(),t.setXYZ(e,Ri.x,Ri.y,Ri.z)}toNonIndexed(){function t(d,g){let y=d.array,_=d.itemSize,w=d.normalized,x=new y.constructor(g.length*_),b=0,P=0;for(let I=0,M=g.length;I<M;I++){d.isInterleavedBufferAttribute?b=g[I]*d.data.stride+d.offset:b=g[I]*_;for(let E=0;E<_;E++)x[P++]=y[b++]}return new Ps(x,_,w)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new r,o=this.index.array,a=this.attributes;for(let d in a){let g=a[d],y=t(g,o);e.setAttribute(d,y)}let c=this.morphAttributes;for(let d in c){let g=[],y=c[d];for(let _=0,w=y.length;_<w;_++){let x=y[_],b=t(x,o);g.push(b)}e.morphAttributes[d]=g}e.morphTargetsRelative=this.morphTargetsRelative;let p=this.groups;for(let d=0,g=p.length;d<g;d++){let y=p[d];e.addGroup(y.start,y.count,y.materialIndex)}return e}toJSON(){let t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let g=this.parameters;for(let y in g)g[y]!==void 0&&(t[y]=g[y]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let o=this.attributes;for(let g in o){let y=o[g];t.data.attributes[g]=y.toJSON(t.data)}let a={},c=!1;for(let g in this.morphAttributes){let y=this.morphAttributes[g],_=[];for(let w=0,x=y.length;w<x;w++){let b=y[w];_.push(b.toJSON(t.data))}_.length>0&&(a[g]=_,c=!0)}c&&(t.data.morphAttributes=a,t.data.morphTargetsRelative=this.morphTargetsRelative);let p=this.groups;p.length>0&&(t.data.groups=JSON.parse(JSON.stringify(p)));let d=this.boundingSphere;return d!==null&&(t.data.boundingSphere={center:d.center.toArray(),radius:d.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let o=t.index;o!==null&&this.setIndex(o.clone(e));let a=t.attributes;for(let y in a){let _=a[y];this.setAttribute(y,_.clone(e))}let c=t.morphAttributes;for(let y in c){let _=[],w=c[y];for(let x=0,b=w.length;x<b;x++)_.push(w[x].clone(e));this.morphAttributes[y]=_}this.morphTargetsRelative=t.morphTargetsRelative;let p=t.groups;for(let y=0,_=p.length;y<_;y++){let w=p[y];this.addGroup(w.start,w.count,w.materialIndex)}let d=t.boundingBox;d!==null&&(this.boundingBox=d.clone());let g=t.boundingSphere;return g!==null&&(this.boundingSphere=g.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},i1=new ro,Ju=new zg,vh=new nf,o1=new Rt,Bl=new Rt,zl=new Rt,Gl=new Rt,Sg=new Rt,_h=new Rt,xh=new tr,Eh=new tr,wh=new tr,s1=new Rt,a1=new Rt,u1=new Rt,Mh=new Rt,Sh=new Rt,fa=class extends ha{constructor(t=new il,e=new Hh){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,o=Object.keys(e);if(o.length>0){let a=e[o[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let c=0,p=a.length;c<p;c++){let d=a[c].name||String(c);this.morphTargetInfluences.push(0),this.morphTargetDictionary[d]=c}}}}getVertexPosition(t,e){let o=this.geometry,a=o.attributes.position,c=o.morphAttributes.position,p=o.morphTargetsRelative;e.fromBufferAttribute(a,t);let d=this.morphTargetInfluences;if(c&&d){_h.set(0,0,0);for(let g=0,y=c.length;g<y;g++){let _=d[g],w=c[g];_!==0&&(Sg.fromBufferAttribute(w,t),p?_h.addScaledVector(Sg,_):_h.addScaledVector(Sg.sub(e),_))}e.add(_h)}return e}raycast(t,e){let o=this.geometry,a=this.material,c=this.matrixWorld;a!==void 0&&(o.boundingSphere===null&&o.computeBoundingSphere(),vh.copy(o.boundingSphere),vh.applyMatrix4(c),Ju.copy(t.ray).recast(t.near),!(vh.containsPoint(Ju.origin)===!1&&(Ju.intersectSphere(vh,o1)===null||Ju.origin.distanceToSquared(o1)>(t.far-t.near)**2))&&(i1.copy(c).invert(),Ju.copy(t.ray).applyMatrix4(i1),!(o.boundingBox!==null&&Ju.intersectsBox(o.boundingBox)===!1)&&this._computeIntersections(t,e,Ju)))}_computeIntersections(t,e,o){let a,c=this.geometry,p=this.material,d=c.index,g=c.attributes.position,y=c.attributes.uv,_=c.attributes.uv1,w=c.attributes.normal,x=c.groups,b=c.drawRange;if(d!==null)if(Array.isArray(p))for(let P=0,I=x.length;P<I;P++){let M=x[P],E=p[M.materialIndex],N=Math.max(M.start,b.start),A=Math.min(d.count,Math.min(M.start+M.count,b.start+b.count));for(let U=N,z=A;U<z;U+=3){let $=d.getX(U),q=d.getX(U+1),D=d.getX(U+2);a=bh(this,E,t,o,y,_,w,$,q,D),a&&(a.faceIndex=Math.floor(U/3),a.face.materialIndex=M.materialIndex,e.push(a))}}else{let P=Math.max(0,b.start),I=Math.min(d.count,b.start+b.count);for(let M=P,E=I;M<E;M+=3){let N=d.getX(M),A=d.getX(M+1),U=d.getX(M+2);a=bh(this,p,t,o,y,_,w,N,A,U),a&&(a.faceIndex=Math.floor(M/3),e.push(a))}}else if(g!==void 0)if(Array.isArray(p))for(let P=0,I=x.length;P<I;P++){let M=x[P],E=p[M.materialIndex],N=Math.max(M.start,b.start),A=Math.min(g.count,Math.min(M.start+M.count,b.start+b.count));for(let U=N,z=A;U<z;U+=3){let $=U,q=U+1,D=U+2;a=bh(this,E,t,o,y,_,w,$,q,D),a&&(a.faceIndex=Math.floor(U/3),a.face.materialIndex=M.materialIndex,e.push(a))}}else{let P=Math.max(0,b.start),I=Math.min(g.count,b.start+b.count);for(let M=P,E=I;M<E;M+=3){let N=M,A=M+1,U=M+2;a=bh(this,p,t,o,y,_,w,N,A,U),a&&(a.faceIndex=Math.floor(M/3),e.push(a))}}}};function mR(r,t,e,o,a,c,p,d){let g;if(t.side===Vo?g=o.intersectTriangle(p,c,a,!0,d):g=o.intersectTriangle(a,c,p,t.side===Mu,d),g===null)return null;Sh.copy(d),Sh.applyMatrix4(r.matrixWorld);let y=e.ray.origin.distanceTo(Sh);return y<e.near||y>e.far?null:{distance:y,point:Sh.clone(),object:r}}function bh(r,t,e,o,a,c,p,d,g,y){r.getVertexPosition(d,Bl),r.getVertexPosition(g,zl),r.getVertexPosition(y,Gl);let _=mR(r,t,e,o,Bl,zl,Gl,Mh);if(_){a&&(xh.fromBufferAttribute(a,d),Eh.fromBufferAttribute(a,g),wh.fromBufferAttribute(a,y),_.uv=ql.getInterpolation(Mh,Bl,zl,Gl,xh,Eh,wh,new tr)),c&&(xh.fromBufferAttribute(c,d),Eh.fromBufferAttribute(c,g),wh.fromBufferAttribute(c,y),_.uv1=ql.getInterpolation(Mh,Bl,zl,Gl,xh,Eh,wh,new tr),_.uv2=_.uv1),p&&(s1.fromBufferAttribute(p,d),a1.fromBufferAttribute(p,g),u1.fromBufferAttribute(p,y),_.normal=ql.getInterpolation(Mh,Bl,zl,Gl,s1,a1,u1,new Rt),_.normal.dot(o.direction)>0&&_.normal.multiplyScalar(-1));let w={a:d,b:g,c:y,normal:new Rt,materialIndex:0};ql.getNormal(Bl,zl,Gl,w.normal),_.face=w}return _}var rf=class r extends il{constructor(t=1,e=1,o=1,a=1,c=1,p=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:o,widthSegments:a,heightSegments:c,depthSegments:p};let d=this;a=Math.floor(a),c=Math.floor(c),p=Math.floor(p);let g=[],y=[],_=[],w=[],x=0,b=0;P("z","y","x",-1,-1,o,e,t,p,c,0),P("z","y","x",1,-1,o,e,-t,p,c,1),P("x","z","y",1,1,t,o,e,a,p,2),P("x","z","y",1,-1,t,o,-e,a,p,3),P("x","y","z",1,-1,t,e,o,a,c,4),P("x","y","z",-1,-1,t,e,-o,a,c,5),this.setIndex(g),this.setAttribute("position",new Xa(y,3)),this.setAttribute("normal",new Xa(_,3)),this.setAttribute("uv",new Xa(w,2));function P(I,M,E,N,A,U,z,$,q,D,G){let Q=U/q,_t=z/D,Z=U/2,Dt=z/2,et=$/2,vt=q+1,It=D+1,Pt=0,Et=0,yt=new Rt;for(let Y=0;Y<It;Y++){let ht=Y*_t-Dt;for(let Mt=0;Mt<vt;Mt++){let zt=Mt*Q-Z;yt[I]=zt*N,yt[M]=ht*A,yt[E]=et,y.push(yt.x,yt.y,yt.z),yt[I]=0,yt[M]=0,yt[E]=$>0?1:-1,_.push(yt.x,yt.y,yt.z),w.push(Mt/q),w.push(1-Y/D),Pt+=1}}for(let Y=0;Y<D;Y++)for(let ht=0;ht<q;ht++){let Mt=x+ht+vt*Y,zt=x+ht+vt*(Y+1),At=x+(ht+1)+vt*(Y+1),$t=x+(ht+1)+vt*Y;g.push(Mt,zt,$t),g.push(zt,At,$t),Et+=6}d.addGroup(b,Et,G),b+=Et,x+=Pt}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function ec(r){let t={};for(let e in r){t[e]={};for(let o in r[e]){let a=r[e][o];a&&(a.isColor||a.isMatrix3||a.isMatrix4||a.isVector2||a.isVector3||a.isVector4||a.isTexture||a.isQuaternion)?a.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][o]=null):t[e][o]=a.clone():Array.isArray(a)?t[e][o]=a.slice():t[e][o]=a}}return t}function vo(r){let t={};for(let e=0;e<r.length;e++){let o=ec(r[e]);for(let a in o)t[a]=o[a]}return t}function yR(r){let t=[];for(let e=0;e<r.length;e++)t.push(r[e].clone());return t}function W1(r){return r.getRenderTarget()===null?r.outputColorSpace:yr.workingColorSpace}var vR={clone:ec,merge:vo},_R=\`void main() {
129
129
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
130
130
  }\`,xR=\`void main() {
131
131
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
@@ -3701,8 +3701,8 @@ void main() {
3701
3701
  squared_mean = squared_mean / samples;
3702
3702
  float std_dev = sqrt( squared_mean - mean * mean );
3703
3703
  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
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&&lt&&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&&lt&&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&&lt&&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&&lt&&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&&lt++,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&&Ir(Ot,xt,Lt),Zt.length>0&&Ir(Zt,xt,Lt),jt.length>0&&Ir(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,Ir(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 Ir(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||Nr.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()}},Nr=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}};Nr.Composite=hm;Nr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Nr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Nr.prototype.GetterByBindingType=[Nr.prototype._getValue_direct,Nr.prototype._getValue_array,Nr.prototype._getValue_arrayElement,Nr.prototype._getValue_toArray];Nr.prototype.SetterByBindingTypeAndVersioning=[[Nr.prototype._setValue_direct,Nr.prototype._setValue_direct_setNeedsUpdate,Nr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_array,Nr.prototype._setValue_array_setNeedsUpdate,Nr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_arrayElement,Nr.prototype._setValue_arrayElement_setNeedsUpdate,Nr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_fromArray,Nr.prototype._setValue_fromArray_setNeedsUpdate,Nr.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 Or(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=Lr(Qh(),1);var yD=Lr(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=Lr(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 Or([[p,y,g,d,p]],t.properties,{bbox:r,id:t.id})}function FD(r){return cf(Eo(r))}var Bm=FD;var jD=Lr(Px(),1);var T3=Lr(gp(),1);var C3=Lr(Qh(),1);var R3=Lr(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=Lr(gp(),1);var pU=Lr(gp(),1);var dU=Lr(T0(),1);var yU=Lr(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=Or([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=Lr(B0(),1);var sB=Lr(B0(),1);var uB=Lr(pM(),1);var gB=Lr(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=Lr(bc(),1);var ay=Lr(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=Lr(bc(),1);var dz=Lr(bc(),1);var mz=Lr(bc(),1);var yz=Lr(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=Lr(pS(),1);var Dr="___",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}\${Dr}\${p.relatedId||p.id}\`;if(this.nodeMap.set(\`\${c.floor}\${Dr}\${p.nodeId}\`,d),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}\${Dr}\${p.name}\`,p)}),(c.lines||[]).filter(p=>p.direction!=="no").forEach(p=>{let d=\`\${c.floor}\${Dr}\${p.from}\`,g=\`\${c.floor}\${Dr}\${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}\${Dr}\${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}\${Dr}\${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}\${Dr}\${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}\${Dr}\${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}\${Dr}\${o.start.id}\`,c=\`\${o.end.floor}\${Dr}\${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}\${Dr}\${o.start.id}\`,c=\`\${o.end.floor}\${Dr}\${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}\${Dr}\${p[d].id}\`,y=this.pointMap.get(g);if(!(!y||y.permission)){for(let _=0;_<p.length;_++)if(d!==_){let w=\`\${p[_].floor}\${Dr}\${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}\${Dr}\${d.start.id}\`,y=\`\${d.end.floor}\${Dr}\${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}\${Dr}\${o.start.id}\`,c=\`\${o.end.floor}\${Dr}\${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}\${Dr}\${t.nodeId}\`);if(o){let[a,c]=o.split(Dr);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}\${Dr}\${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}\${Dr}\${t.id}\`,c=\`\${e.floor}\${Dr}\${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=Lr(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()}});
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&&lt&&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&&lt&&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&&lt&&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&&lt&&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&&lt++,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
3706
  /*! Bundled license information:
3707
3707
 
3708
3708
  object-assign/index.js: